PageSourceSearch

https://www.babybjorn.ca/component---src-templates-cart-page-cart-page-container-tsx-56876fef834e25bcbe29.js

js babybjorn.ca collected 2026-10-04 12:40:32 UTC 37,296 bytes, 2 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"1ca49186a670a66e04e3a4c02172ea34c0d138b6"};var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3091a4d2-cbb9-4786-bcb3-e811f0a8bd16",e._sentryDebugIdIdentifier="sentry-dbid-3091a4d2-cbb9-4786-bcb3-e811f0a8bd16")}catch(e){}}(),function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"1ca49186a670a66e04e3a4c02172ea34c0d138b6"};var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3091a4d2-cbb9-4786-bcb3-e811f0a8bd16",e._sentryDebugIdIdentifier="sentry-dbid-3091a4d2-cbb9-4786-bcb3-e811f0a8bd16")}catch(e){}}(),(self.webpackChunk_babybjorn_gatsby=self.webpackChunk_babybjorn_gatsby||[]).push([[337],{71431:function(e,t,a){a.d(t,{CW:function(){return f},Mw:function(){return l},Zd:function(){return o},cy:function(){return c},eo:function(){return m},fF:function(){return g},fw:function(){return d},hF:function(){return u},kx:function(){return n},oY:function(){return r},p_:function(){return i},qG:function(){return p},sJ:function(){return s}});var n="SingleInputForm-module--centerFeedbackText--f8cfc",r="SingleInputForm-module--errorMode--ce6bc",i="SingleInputForm-module--feedbackContainer--21d12",o="SingleInputForm-module--form--83266",l="SingleInputForm-module--formWrapper--ec196",s="SingleInputForm-module--giftCardId--4617f",c="SingleInputForm-module--helperText--fed27",u="SingleInputForm-module--input--ebb36",d="SingleInputForm-module--inputButton--948ee",m="SingleInputForm-module--inputFieldContainer--ac9ca",f="SingleInputForm-module--loadIcon--bee30",g="SingleInputForm-module--resultIcon--92e1a",p="SingleInputForm-module--successMessageAboveInput--ececf"},73188:function(e,t,a){a.r(t),a.d(t,{Head:function(){return ot},default:function(){return it}});var n=a(17656),r=a(40528),i=a(80787),o=a(52678),l=a(71295),s=a(27348),c=a(26139),u=a(71406),d=a(91637),m=a(55200),f=a(65673),g=a(64162),p=a(27186),v=a(84307),b=a(24872),y=a(43721),h=a(87645),E=a(57993),C=a(17501),I=a(3020),S=a(88605),M=a(86460),k=a(2692),x=a(68348),N=a(794),w=a(27348);var T=({heading:e,children:t})=>w.createElement("section",null,e&&w.createElement("header",{className:"CartList-module--header--5f079"},w.createElement("h3",null,e)),w.createElement("ul",{className:"divide-gray-border divide-y"},t)),G=a(56935),L=a(75682),_=a(68305),P=a(27348);var A=({lineItemId:e,productName:t,productImage:a,price:n,originalPrice:r,quantity:i,variantLabel:o,increaseQuantity:s,decreaseQuantity:c,incrementLabel:u,decrementLabel:d,removeItem:m,variantLink:f,enableQuantityCounter:p=!0,enableCloseButton:v=!0})=>{var b;const{t:y}=(0,l.useTranslation)(),{outOfStockItems:h,getAvailableQuantityForLineItem:E}=(0,g.R)(),C=h.some(t=>t.id===e),I=f?(0,M.EI)(f):void 0,S=E(e),k=i>=S;return P.createElement(x.gi,{productName:t,variantName:o,quantity:i,image:P.createElement(L.A,{width:64,sizes:"64px",alt:null!==(b=a.alt)&&void 0!==b?b:"",ratio:"portrait",objectFit:"cover",imgSrc:a.src}),price:n,originalPrice:r,originalPriceScreenReaderText:y("Original price before discount"),isOutOfStock:C,outOfStockLabel:y("Out of stock"),href:I,linkComponent:_.A},P.createElement("div",{className:"gap-bb flex items-center"},i&&s&&c&&p&&P.createElement(G.A,{count:i,decrement:c,increment:s,incrementLabel:u,decrementLabel:d,disableIncrement:k,decrementTestId:"cart-item-decrement-button",incrementTestId:"cart-item-increment-button",countTestId:"cart-item-quantity",disabledIncrementTitle:y("Only {{count}} available",{count:S})}),m&&v&&P.createElement("button",{className:"text-gray-2 hover:text-error bb-text-tiny transition-colors",onClick:()=>{m()},"data-testid":"cart-item-remove-button","aria-label":y("Remove {{productName}} from cart",{productName:t})},y("Remove"))))},D=a(27348);var F=({children:e})=>D.createElement("div",{className:"CartPage-module--container--e8583"},e),B=a(27348);var O=({children:e})=>
1B.createElement("div",{className:"CartProducts-module--container--93d3d"},e),R=a(5677),j=a(46093),$=a(53296),q=a(38744),W=a(29656),U=a(8264),Q=a(27348);var Y=({shippingInfo:e,helpLabel:t,freeShippingLabel:a,goToCheckoutLabel:n,sum:r,originalSum:i,totalLabel:c,helpUrl:u,giftCardPayments:d,appliedGiftCardMessage:m,...f})=>{const{cartIsValid:p}=(0,g.R)(),v=(0,W.Ww)(),{checkoutPath:b}=(0,U.e)(),{t:h}=(0,l.useTranslation)(),{0:E,1:C}=(0,s.useState)(!1);return Q.createElement("section",Object.assign({className:"CartSummary-module--container--0a759"},f),v&&Q.createElement("div",{className:"CartSummary-module--summaryContainer--d9a01"},Q.createElement("div",null,Q.createElement("p",null,c),Q.createElement("div",null,Q.createElement("h2",{className:"relative"},r),i&&Q.createElement(Q.Fragment,null,Q.createElement("span",{className:"sr-only"},h("Original price before discount")),Q.createElement("span",{className:"bb-text-display-h3 text-gray-2 line-through"},i))),Q.createElement($.A,{variant:"horizontal"}),a.length>0&&Q.createElement("h5",null,a),d&&d.length>0&&Q.createElement("span",{className:"CartSummary-module--giftCardMessage--77313"},m)),Q.createElement(j.A,{variant:E?"secondary":p?"primary":"disabled","data-testid":"go-to-checkout-button",icon:"cart",loading:E,disabled:!p,label:n,onClick:()=>{C(!0),(0,y.F)({type:"goToCheckout"}),(0,o.navigate)(b)}})),e.length>0&&Q.createElement("div",{className:"CartSummary-module--shippingInfo--12e12"},Q.createElement("h5",null,e)),Q.createElement("div",{className:"CartSummary-module--paymentInfo--ddfee"},Q.createElement(R.u,null)),Q.createElement(_.A,{className:"CartSummary-module--link--e004f",href:u},Q.createElement("div",{className:"CartSummary-module--help--18ae8",onClick:()=>({}),onKeyDown:()=>({}),role:"presentation"},Q.createElement(q.A,{name:"question",className:"text-gray-4 h-6 w-6"}),Q.createElement("span",null,t))))},K=a(27348);var V=({children:e,...t})=>K.createElement("section",Object.assign({className:(0,x.cn)("PaymentPane-module--container--b2d42")},t),e),H=a(27348);var J=({freeShippingLabel:e,sum:t,originalSum:a,totalLabel:n,appliedGiftCardMessage:r,giftCardPayments:i})=>{const{cartIsValid:c}=(0,g.R)(),{t:u}=(0,l.useTranslation)(),{checkoutPath:d}=(0,U.e)(),{0:m,1:f}=(0,s.useState)(!1);return H.createElement("div",{className:"StickyCartSummary-module--summaryContainer--23226"},H.createElement("div",{className:"StickyCartSummary-module--priceContainer--4d1fa"},H.createElement("p",null,n),H.createElement("span",{className:"flex gap-2"},H.createElement("h2",null,t),a&&H.createElement(H.Fragment,null,H.createElement("span",{className:"sr-only"},u("Original price before discount")),H.createElement("span",{className:"bb-text-display-h3 text-gray-2 line-through"},a))),e.length>0&&H.createElement("h5",null,e),i&&i.length>0&&H.createElement("span",{className:"StickyCartSummary-module--giftCardMessage--5be03"},r)),H.createElement(j.A,{variant:m?"secondary":c?"primary":"disabled","data-testid":"go-to-checkout-button",icon:"cart",loading:m,disabled:!c,label:u("Go to checkout"),fullWidth:!0,onClick:()=>{f(!0),(0,o.navigate)(d)}}))},X=a(90143),Z=a(84728),z=a(25276),ee=a(81896),te=a(9044),ae=a(6576),ne=a(59046);function re(e=!1,t=!0){const[a,n]=(0,s.useState)(e),r=(0,ne.J)(t);return[a,(0,s.useCallback)(e=>{n(t=>void 0===e||r.current&&"object"==typeof e&&("SyntheticBaseEvent"===e.constructor.name||"string"==typeof e._reactName)?!t:Boolean(function(...e){return 1===e.length?("function"==typeof(t=e[0])&&(t=t()),t):(a=e[0],n=e[1],"function"==typeof a?a(n):a);var t,a,n}(e,t)))},[])]}function ie(e,t,a,n=0){const r=(0,s.useRef)(void 0),i=(0,s.useRef)(void 0),o=(0,s.useRef)(e),l=(0,s.useRef)(void 0),c=()=>{r.current&&(clearTimeout(r.current),r.current=void 0),i.current&&(clearTimeout(i.current),i.current=void 0)};return function(e){const t=(0,ne.J)(e);(0,s.useEffect)(()=>()=>{t.current()},[])}(c),(0,s.useEffect)(()=>{o.current=e},t),(0,s.useMemo)(()=>{const t=()=>{if(c(),!l.current)return;const e=l.current;l.current=void 0,o.current.apply(e.this,e.args)},s=function(...e){r.current&&clearTimeout(r.current),l.current={args:e,this:this},r.current=setTimeout(t,a),n>0&&!i.current&&(i.current=setTimeout(t,n))};return Object.defineProperties(s,{length:{value:e.length},name:{value:`${e.name||"anonymous"}__debounced__${a}`}}),s},[a,n,...t])}function oe(e,t,a,n=0){(0,s.useEffect)(ie(e,t,a,n),t)}
1var le=a(39788),se=a(61746),ce=a(48624),ue=a(50396),de=a(3827),me="GiftOptionsItem-module--disabled--d773c",fe=a(27348);var ge=({...e})=>fe.createElement("li",{className:"GiftOptionsItem-module--giftOptionsWrapper--0d50f"},fe.createElement(de.A,{small:!0,disabled:e.disabled,checked:e.checked,onChange:e.onChange,className:(0,x.cn)({[me]:e.disabled})},e.text));const pe=e=>{if(!e)return!0;return new RegExp(`^[^${["😀-🙏","🌀-🗿","🚀-🛿","🜀-🝿","🞀-🟿","🠀-🣿","🤀-🧿","🨀-🩯","🩰-🫿","☀-⛿","✀-➿","⭐","⭕"].join("")}]+$`,"u").test(e)},ve=e=>{var t;return(null!==(t=e.match(/\n/g))&&void 0!==t?t:[]).length},be=(e,t,a)=>{if(ve(e)>=a)return!1;for(const n of e.split("\n"))if(n.length>t)return!1;return!0};var ye=a(99993),he="GiftOptionsMessage-module--messageLimit--18953",Ee="GiftOptionsMessage-module--visible--ad100",Ce=a(27348);var Ie=({visible:e,addMessageText:t,initialGiftMessageText:a,giftMessagePlaceholder:n,maxCharPerLine:r,maxLines:i,saveGiftMessageText:o})=>{const{t:u}=(0,l.useTranslation)(),{0:d,1:m}=(0,s.useState)(!1),{0:f,1:g}=(0,s.useState)(""),{0:p,1:v}=(0,s.useState)(a),b=(0,s.useRef)(null),y=(0,s.useRef)(!1),h=(0,s.useRef)(null),E=(0,s.useMemo)(()=>r*i+i-1,[r,i]),C=(0,s.useMemo)(()=>(p.match(/\n/g)||[]).length,[p]),I=(0,s.useMemo)(()=>r*i-p.length+C,[p.length,C,r,i]),S=(0,s.useMemo)(()=>i-(p.length>0?C+1:0),[p.length,C,i]),M=u("Special characters not allowed."),k=u("Your message will be printed exactly the way you write it, including blank spaces and line breaks. Do not use emojis. If you do not write anything in this field, your gift card will be blank. Your message is saved automatically. Click on 'Go to Checkout' to complete your order."),N=u("The message has more characters than allowed per line.")+" ("+r+")",w=u("{CHARACTERSLEFT} characters and {LINESLEFT} lines left.").replace("{CHARACTERSLEFT}",I.toString()).replace("{LINESLEFT}",S.toString()),T=(e,t)=>{if(g(""),!pe(e))return void g(M);const a=((e,t,a,n)=>{let r=e;if(ve(e)>=n)return{valid:!1,result:r};for(const i of e.split("\n"))if(i.length>t&&a>0){const a=i.lastIndexOf(" ")>t?t-1:i.lastIndexOf(" "),n=a>-1?a:t,o=i.slice(0,n),l=i.slice(n+(a>-1?1:0));r=e.replace(i,()=>`${o}\n${l}`)}else if(i.length>t&&a<=0)return{valid:!1,result:r};return{valid:!0,result:r}})(e,r,S,i);if(a.valid&&be(a.result,r,i)){const n=a.result;let r=null!=t?t:n.length;if(n!==e&&null!==t){const a=Math.min(e.length,n.length);let i=-1;for(let t=0;t<a;t++)if(e[t]!==n[t]){i=t;break}if(-1!==i&&i<t){const a=n.length-e.length;r=Math.max(0,Math.min(n.length,t+a))}}h.current=r,v(n)}else g(N)};return(0,c.Es)(()=>{if(null!==h.current&&b.current){try{const e=Math.min(h.current,p.length);b.current.setSelectionRange(e,e)}catch{}h.current=null}},[p]),oe(()=>{m(!0),o(p).catch(e=>{console.error(e),g(u("There was an error saving the gift message"))}).finally(()=>{m(!1)})},[p],500),Ce.createElement("div",{className:(0,x.cn)("GiftOptionsMessage-module--giftMessageText--b3c5f",{[Ee]:e})},t,Ce.createElement("div",{className:"GiftOptionsMessage-module--loadingIcon--f4447",style:{to
1p:(C>2?2+1.25*C:4)+"rem"}},d?Ce.createElement(ye.A,{hasSpinningDots:!0,className:"h-5 w-5"}):Ce.createElement(q.A,{name:"checkmark",className:"h-5 w-5"})),Ce.createElement("div",{className:"GiftOptionsMessage-module--textareaWrapper--e710c"},Ce.createElement("textarea",{ref:b,value:p,placeholder:n,maxLength:E,onChange:e=>{const t=e.target.value,a=e.target.selectionStart;y.current?v(t):T(t,a)},onCompositionStart:()=>{y.current=!0},onCompositionEnd:e=>{y.current=!1,T(e.currentTarget.value,e.currentTarget.selectionStart)},onPaste:e=>{const t=e.clipboardData.getData("text");pe(t)||(g(M),e.preventDefault()),be(t,r,i)||(g(N),e.preventDefault())},style:{height:2+1.25*C+"rem"}})),Ce.createElement("p",{className:he},w),Ce.createElement("p",{className:he},k),Ce.createElement(te.A,{className:"GiftOptionsMessage-module--errorMessage--d3390",message:f}))},Se=a(27348);var Me=({hasGiftBox:e,hasGiftMessage:t,initialGiftMessageText:a,toggleHasGiftBox:n,toggleHasGiftMessage:r,saveGiftMessageText:i,image:o,isNonWrappable:s,isNonMessageable:c,giftBoxPriceText:u,giftMessagePriceText:d,giftMessageDescription:m,maxCharPerLine:f,maxLines:g})=>{const{t:p}=(0,l.useTranslation)(),v=p("Is this a gift?"),b=p("Add gift wrap"),y=p("Add a gift message"),h=p("Dear friend, Congratulations on your beautiful baby! Looking forward to seeing you all soon. Love, Anna");return Se.createElement(Se.Fragment,null,Se.createElement("div",{className:"GiftOptions-module--row--ac0c2"},Se.createElement(ce.A,{imgSrc:o.src,alt:o.alt,className:"GiftOptions-module--image--3d99c"}),Se.createElement("div",{className:"GiftOptions-module--content--4f6c9"},Se.createElement("h5",null,v),Se.createElement("ul",null,Se.createElement(ge,{disabled:s,checked:e,onChange:()=>n(),text:u?`${b} (${u})`:b}),Se.createElement(ge,{disabled:c,checked:t,onChange:()=>r(),text:d?`${y} (${d})`:y})),Se.createElement(ue.A,{className:"GiftOptions-module--descriptionDesktop--02f19",content:m||""}))),Se.createElement(ue.A,{className:"GiftOptions-module--descriptionMobile--95fb5",content:m||""}),Se.createElement(Ie,{visible:t,initialGiftMessageText:a,addMessageText:y,giftMessagePlaceholder:h,saveGiftMessageText:i,maxCharPerLine:f,maxLines:g}))},ke=a(27348);const xe=e=>{if(!e)return!0;try{var t;const a=(0,se.i)(e),{availability:n}=a;return!(null!==(t=null==n?void 0:n.isOnStock)&&void 0!==t?t:!!Array.isArray(null==n?void 0:n.channels)&&n.channels.some(e=>e.isOnStock))}catch{return!0}};var Ne=({addGiftBoxItem:e,removeGiftBoxItem:t,addGiftMessageItem:a,updateGiftMessageItem:n,removeGiftMessageItem:r,giftBoxProduct:i,giftMessageProduct:o,displayPrice:c,initialGiftMessageText:u,image:d,isNonWrappable:f,isNonMessageable:g,hasGiftBoxItemInCart:p,hasGiftMessageItemInCart:v,maxLines:b,maxCharPerLine:y,giftMessageDescription:h})=>{const[E,C]=re(p),[I,S]=re(v),{t:M}=(0,l.useTranslation)(),{currency:k,userCountry:N}=(0,m.A1)(),w=M("Free");(0,s.useEffect)(function(){C(p)},[p,C]),(0,s.useEffect)(function(){S(v)},[v,S]);const T=e=>{if(e&&c)try{const t=(0,se.i)(e),a=(0,ae.LV)(t,k,N);return(0,ae.jQ)(a)>0?(0,le.up)(a):w}catch{return void console.error("Error getting price for gift box or gift message")}},G=T(i),L=T(o);oe(()=>{i&&(E?e(i):t(i))},[E],500),oe(()=>{o&&(I?a(o):r(o))},[I],500);const _=(0,s.useCallback)(async e=>{o&&await n(o,e)},[o,n]),P={hasGiftBox:E,hasGiftMessage:I,initialGiftMessageText:u,toggleHasGiftMessage:S,saveGiftMessageText:_,toggleHasGiftBox:C,image:d,isNonWrappable:f||xe(i),isNonMessageable:g||xe(o),giftBoxPriceText:G,giftMessagePriceText:L,giftMessageDescription:h,maxCharPerLine:y,maxLines:b};return ke.createElement("div",{className:(0,x.cn)("GiftOptions-module--container--ee055"),id:"gift-options"},ke.createElement(Me,P))},we=a(49166),Te=a(53920),Ge=a(32197),Le=a(27348);var _e=({children:e})=>Le.createElement(Ge.A,{className:"CartPageAccordion-module--cartAccordionContainer--61221"},e),Pe="RecommendationsWrapper-module--above--fa3c4",Ae=a(27348);var De=({above:e,children:t})=>Ae.createElement("section",{className:(0,x.cn)("RecommendationsWrapper-module--cartRecommendationsWrapper--413c2",{[Pe]:e})}
1,t),Fe=a(98739),Be=a(15272),Oe=a(26755),Re=a(27348);const je=({removeDiscountCode:e,onSetDiscountCode:t,setDiscountCode:a,discountLoading:n,appliedDiscountCode:r,discountCode:i,discountCodeSuccessMessage:o,discountCodeErrorMessage:s})=>{const{t:c}=(0,l.useTranslation)(),u=(0,Be.k)(),d=(0,Oe.g)();return Re.createElement(Fe.A,{id:"discount-code-input",placeholder:c("Coupon code"),buttonLabel:c("Apply"),loading:n,onFormSubmit:async e=>{e.preventDefault(),i&&await t(i)},onInputChange:e=>a(e.target.value),input:i,disabled:Boolean(r),errorMessage:s,successMessage:o,helperText:d&&u?c("This code is not valid on Gift Cards nor items added through the Bundle Builder."):d?c("This code is not valid on Gift Cards."):u?c("This code is not valid on items added through the Bundle Builder."):void 0,removeDiscountCode:e,appliedDiscountCode:r,removeButtonLabel:c("Remove")})},$e=new Set(["ApplicationStoppedByGroupBestDeal","ApplicationStoppedByPreviousDiscount"]),qe=e=>{const t=null==e?void 0:e.state;if(t&&"MatchesCart"!==t)return"MaxApplicationReached"===t?"This coupon code has reached its usage limit.":$e.has(t)?"This coupon code cannot be combined with the discounts already in your cart.":"The coupon code is not valid for this cart."};var We=a(27348);const Ue=()=>{var e;const{addCartDiscountCode:t,cart:a,hasCart:n,removeCartDiscountCode:r}=(0,g.R)(),{t:i}=(0,l.useTranslation)(),o=null==a?void 0:a.discountCodes[0],c=null==o||null===(e=o.discountCode.obj)||void 0===e?void 0:e.code,u=qe(o),d=(e=>"MatchesCart"===(null==e?void 0:e.state))(o),{0:m,1:f}=(0,s.useState)(!1),{0:p,1:v}=(0,s.useState)(),{0:b,1:y}=(0,s.useState)(""),{0:h,1:E}=(0,s.useState)(null!=c?c:""),C=u?i(u):"",I=c&&d?i("Coupon code applied successfully."):"",S=null!=p?p:C,M=b||I,k=h||c||"",x={removeDiscountCode:async()=>{E(""),await(async()=>{try{n&&await r(),v(""),y(i("Coupon code removed successfully."))}catch{y(""),v(i("Something went wrong"))}})()},onSetDiscountCode:async e=>{f(!0);try{var a;const n=await t(e),r=null!==(a=n.discountCodes.find(t=>{var a;return(null===(a=t.discountCode.obj)||void 0===a?void 0:a.code)===e}))&&void 0!==a?a:n.discountCodes[0],o=qe(r);if(o)return v(i(o)),void y("");v(void 0),y("")}catch{y(""),v(i("Something went wrong"))}finally{f(!1)}},setDiscountCode(e){v(void 0),E(e)},discountLoading:m,appliedDiscountCode:null!=c?c:"",discountCode:k,discountCodeSuccessMessage:M,discountCodeErrorMessage:S}
1;return We.createElement(je,x)};var Qe=a(85184),Ye=a(61218),Ke=a(72063),Ve=a(30584),He=a(71431),Je=a(27348);var Xe=({id:e,buttonLabel:t,removeButtonLabel:a,input:n,loading:r,errorMessage:i,onFormSubmit:o,onInputChange:l,removeGiftCard:s,giftCardPayments:c,...u})=>{const d=""===n,m=""!==n,f=i,g=(0,x.cn)(He.eo,{[He.oY]:f});return Je.createElement("form",{className:He.Zd,onSubmit:e=>{e.preventDefault(),o()}},Je.createElement("div",{className:(0,x.cn)(He.Mw)},Je.createElement("div",{className:g},Je.createElement("input",Object.assign({type:"text",id:e,className:(0,x.cn)(He.hF,"sentry-mask"),value:n,onChange:l},u)),!1===r?Je.createElement(j.A,{icon:d?"arrow-right":void 0,loading:r,type:d?"button":"submit",variant:d?"secondary":"primary",label:m?t:void 0,buttonType:d?"input":"standard",className:(0,x.cn)(He.fw),"aria-label":null!=t?t:"input-button"}):Je.createElement(j.A,{icon:"reload",loading:!0,variant:"primary",buttonType:"input",className:(0,x.cn)(He.CW),"aria-label":null!=t?t:"input-button",role:"button"})),f&&Je.createElement(te.A,{message:i}),null==c?void 0:c.map(e=>{var t;return Je.createElement("div",{className:He.p_,key:e.id},Je.createElement(q.A,{name:"gift",className:"h-6 w-6"}),Je.createElement("p",null,(0,le.up)(e.obj.amountPlanned)),Je.createElement("span",{className:He.sJ},null===(t=e.obj.custom)||void 0===t?void 0:t.fields.giftCardCode),Je.createElement(j.A,{label:a,onClick:()=>{s(e)},alwaysSmall:!0,variant:"secondary","aria-label":a}))})))},Ze=a(27348);const ze=({applyGiftCard:e,removeGiftCard:t,setGiftCardCode:a,giftCardCode:n,giftCardError:r,giftCardLoading:i,giftCardPayments:o})=>{const{t:s}=(0,l.useTranslation)();return Ze.createElement(Xe,{id:"gift-card-input",placeholder:s("Gift card code"),buttonLabel:s("Apply"),loading:i,onFormSubmit:async()=>{await e()},onInputChange:a,input:n,errorMessage:r,removeGiftCard:t,giftCardPayments:o,removeButtonLabel:s("Remove")})};var et=a(27348);const tt=()=>{var e;const t=(0,Qe.K)(),{0:a,1:n}=(0,s.useState)(""),{0:r,1:o}=(0,s.useState)(),{0:l,1:c}
1=(0,s.useState)(!1),{0:u,1:d}=(0,s.useState)(!1),{cart:m,addCartPayment:f,removeCartPayment:p}=(0,g.R)(),{createPayment:v,getPaymentByInterfaceId:b}=(0,Ye.d)(),{0:y,1:h}=(0,s.useState)(m&&(0,Te.DZ)(m)||!1),E=(0,s.useMemo)(()=>{var e;return(null==m||null===(e=m.paymentInfo)||void 0===e?void 0:e.payments.filter(e=>void 0!==e.obj&&(0,Te.Ve)(e.obj)))||[]},[null==m||null===(e=m.paymentInfo)||void 0===e?void 0:e.payments]),I={applyGiftCard:async()=>{if(m){if(o(void 0),n(""),(0,ae.jQ)((0,C.re)(m))<=0)return void o(t.cart_paid);if(m.lineItems.some(e=>{var t;return"gift-card"===(null===(t=e.productType.obj)||void 0===t?void 0:t.key)}))return void o(t.invalid_method);c(!0);try{let e=await b(`${a}_${m.id}`);e||(e=await v({amountPlanned:(0,ae.Pu)(0,m.totalPrice.currencyCode),paymentMethodInfo:{paymentInterface:"gift-card",method:"gift-card"},custom:{type:{typeId:"type",key:"gift-card-payments-type"},fields:{cartId:m.id,giftCardCode:a}}})),(0,Te.P7)(m,e.id)?o(t.already_applied):(await f(e.id),n(""))}catch(e){if((0,Ve.Cg)(e)){const a=e.errors[0]?(0,Ke.D)(e.errors[0]):(0,Ke.D)(e);a.includes("Gift card has no value left")||a.includes("no value left")?o(t.no_value):o(a)}else(0,i.bJ7)(e)&&e.message.includes("Gift card has no value left")?o(t.no_value):o(t.default)}finally{c(!1)}}},setGiftCardCode:e=>{o(void 0),n(e.target.value)},setGiftCardInputShown:h,giftCardInputShown:y,giftCardLoading:l,giftCardDeleteLoading:u,giftCardError:r,giftCardCode:a,giftCardPayments:E,removeGiftCard:async e=>{if(e.obj&&(0,C.$8)(m))try{o(void 0),d(!0),await p(e.obj.id)}catch{o(t.remove_error)}finally{d(!1)}}};return et.createElement(ze,I)};var at=a(27348);const nt=({title:e,cart:t,cartItems:a,setQuantity:r,removeItem:i,addGiftBoxItem:o,addGiftMessageItem:c,updateGiftMessageItem:u,outOfStockItems:d,limitedStockItems:f,subtotal:g,originalSubtotal:p,contactUsUrl:v,freeShippingUSP:b,errorMessage:y,viewLoading:h,isNonWrappable:E,isNonMessageable:M,giftWrapSettings:k,giftMessageDescription:w})=>{var G;const{t:L}=(0,l.useTranslation)(),{siteConfig:_}=(0,m.A1)(),P=(0,W.Ww)(),D=null!==(G=null==t?void 0:t.locale)&&void 0!==G?G:"",B=e=>{var t,a,n;return null===(t=(0,I.D)(null!==(n=e.attributes)&&void 0!==n?n:[],"color"))||void 0===t||null===(a=t.value.label)||void 0===a?void 0:a[D]},R=(0,s.useMemo)(()=>{var e;return(null==t||null===(e=t.paymentInfo)||void 0===e?void 0:e.payments.filter(e=>e.obj&&(0,Te.Ve)(e.obj)))||[]},[t]),j=(0,s.useMemo)(()=>{const t=a.reduce((e,t)=>e+t.quantity,0);return t?`${e} (${t})`:e},[a,e]),{giftBoxProduct:$,giftMessageProduct:q}=(0,m.A1)(),U=(0,s.useMemo)(()=>{var e,t,r;let l=!1,s=!1,d="",m="",f="";for(const i of a)if((0,n.Dy)(i.productKey)&&(d=i.id,l=!0),(0,n.J_)(i.productKey)){var g;m=i.id;const e=null===(g=i.custom)||void 0===g?void 0:g.fields;e&&"string"==typeof e.message&&(f=e.message),s=!0}return{addGiftBoxItem:o,removeGiftBoxItem:i(d),addGiftMessageItem:c,updateGiftMessageItem:u,removeGiftMessageItem:i(m),giftBoxProduct:$,giftMessageProduct:q,displayPrice:null===(e=null==k?void 0:k.displayPrice)||void 0===e||e,initialGiftMessageText:f,isNonWrappable:E,isNonMessageable:M,hasGiftBoxItemInCart:l,hasGiftMessageItemInCart:s,image:{src:"https://a.storyblok.com/f/187351/1143x1600/2fc38dd520/gift-options-na.jpg/m/",alt:L("Gift box and message card")},maxLines:null!==(t=null==k?void 0:k.lineCount)&&void 0!==t?t:0,maxCharPerLine:null!==(r=null==k?void 0:k.characterCount)&&void 0!==r?r:0,giftMessageDescription:w}},[o,i,c,u,$,q,null==k?void 0:k.displayPrice,null==k?void 0:k.lineCount,null==k?void 0:k.characterCount,E,M,L,w,a]);return at.createElement(we.A,{showFooter:!1},at.createElement("style",null,"\n\t\t\t\t\t@media (width <= 767px) {\n\t\t\t\t\t\t#launcher {\n\t\t\t\t\t\t\tbottom: 72px!important;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t"),at.createElement(F,null,h?at.createElement("div",{"data-testid":"cart-loading","aria-hidden":"true"}):at.createElement(at.Fragment,null,at.createElement(O,null,y&&at.createElement(te.A,{message:y}),d.length>0&&at.createElement(x.Fc,{variant:"error",className:"mt-bb"},at.createElement(N.WarningIcon,null),at.createElement("div",null,at.createElement("p",{className:"bb-text-tiny!"},L("The following items are out of stock and must be removed to continue"),":"),at.createElement("ul",{className:"list-inside list-disc space-y-1"},d.map(e=>{var a;const n=(0,S.R$)(e.variant.attributes,!0);return at.createElement("li",{key:e.id,className:"bb-text-tiny!"},e.name[null!==(a=null==t?void 0:t.locale)&&void 0!==a?a:""]||Object.values(e.name)[0]||"Unknown Product",n&&` - ${n}`)})))),f.length>0&&at.createElement(x.Fc,{variant:"info",className:"mt-bb"},at.createElement(N.WarningIcon,null),at.createElement("div",null,at.createElement("p",{className:"bb-text-tiny!"},L("The following items have limited stock. Please reduce quantity to continue"),":"),at.createElement("ul",{className:"list-inside list-disc space-y-1"},f.map(({lineItem:e,availableQuantity:a})=>{var n;const r=(0,S.R$)(e.variant.attributes,!0);return at.createElement("li",{key:e.id,className:"bb-text-tiny!"},e.name[null!==(n=null==t?void 0:t.locale)&&void 0!==n?n:""]||Object.values(e.name)[0]||"Unknown Product",r&&` - ${r}`," - ",L("Only {{count}} available",{count:a}))})))),at.createElement(T,{heading:j},a.map((e,t)=>{var a;const o="GiftLineItem"===e.lineItemMode,l=(0,n.gq)(e.productKey),s=d.some(t=>t.id===e.id),c=!o&&!l&&!s,u=!o,m=null!==(a=e.name[D])&&void 0!==a?a:"";return at.createElement("li",{key:e.id,"data-testid":`cart-item-${t}`,className:"py-bb"},at.createElement(A,{lineItemId:e.id,quantity:e.quantity,increaseQuantity:r(e.quantity+1,e.id),decreaseQuantity:r(e.quantity-1,e.id),incrementLabel:L("Increase quantity for {{productName}}",{productName:m}),decrementLabel:L("Decrease quantity for {{productName}}",{productName:m}),variantLabel:e.variantLabel,removeItem:i(e.id),productName:m,productImage:{src:e.image.src},material:(f=e.variant,null===(g=(0,I.D)(null!==(v=f.attributes)&&void 0!==v?v:[],"fabric"))||void 0===g||null===(p=g.value.label)||void 0===p?void 0:p[D]),color:B(e.variant),price:(0,le.up)(e.totalPrice),originalPrice
1:(0,C.Qc)(e),variantLink:e.variantLink,goToItemAriaLabel:`${L("Go back to")} ${m} ${L("button")}`,enableQuantityCounter:c,enableCloseButton:u}));var f,g,p,v})),at.createElement("section",null,at.createElement(_e,null,at.createElement(z.A,{key:"coupon",variant:"inverted"},at.createElement(Z.A,{key:"1-bar",icon:"cart",label:L("Add coupon code"),accordionIndex:"1"}),at.createElement(ee.A,{key:"1-panel",accordionIndex:"1",narrow:!0},at.createElement(Ue,null))),!_.hide_gift_card&&at.createElement(z.A,{key:"gift-card",variant:"inverted"},at.createElement(Z.A,{key:"2-bar",icon:"gift-envelope",label:L("Got a gift card from a loved one?"),accordionIndex:"2"}),at.createElement(ee.A,{key:"2-panel",accordionIndex:"2",narrow:!0},at.createElement(tt,null))))),at.createElement(De,{above:"above_recommendations"===(null==k?void 0:k.displayOptions)||"below_recommendations"===(null==k?void 0:k.displayOptions)},a.length>0&&"above_recommendations"===(null==k?void 0:k.displayOptions)&&at.createElement(Ne,U),at.createElement(X.h,{amount:2,scrollTopOnAdd:!0}),a.length>0&&"below_recommendations"===(null==k?void 0:k.displayOptions)&&at.createElement(Ne,U))),at.createElement(V,null,at.createElement(Y,{shippingInfo:b.lowestFreeAboveUSP,freeShippingLabel:b.freeShippingUSP,goToCheckoutLabel:L("Go to checkout"),helpLabel:L("Do you need help? Contact us here."),helpUrl:v,sum:g,originalSum:p,totalLabel:L("Total"),giftCardPayments:R,appliedGiftCardMessage:L("Gift card applied in checkout"),style:{height:P?"100vh":void 0,top:P?"0px":void 0}})),!P&&at.createElement(J,{freeShippingLabel:b.freeShippingUSP,sum:g,originalSum:p,totalLabel:L("Total"),giftCardPayments:R,appliedGiftCardMessage:L("Gift card applied in checkout")}))))};var rt=a(27348);var it=({data:e,pageContext:t})=>{var a,u,d,h,x,N,w,T,G;(0,p.e)(t.translatedSlugs);const L=e.page,{updateCartLineItemQuantity:_,addGiftBoxItemToCart:P,addGiftMessageItemToCart:A,updateGiftMessageItemInCart:D,removeLineItemFromCart:F,cart:B,hasCart:O,cartLoading:R,isCartQueryError:j,outOfStockItems:$,limitedStockItems:q,recalculateCart:W}=(0,g.R)(),{giftMessageProduct:U,giftBoxProduct:Q,siteConfig:Y}=(0,m.A1)(),{0:K,1:V}
1=(0,s.useState)(!1),{0:H,1:J}=(0,s.useState)(),{0:X,1:Z}=(0,s.useState)(!0),{0:z,1:ee}=(0,s.useState)(!0),{0:te,1:ae}=(0,s.useState)(!1),{t:ne}=(0,l.useTranslation)(),re=(0,c.DE)(),ie=(0,s.useRef)(null),oe=(0,s.useCallback)(()=>{null!=B&&B.id&&ie.current!==B.id&&(ie.current=B.id,W())},[B,W]);(0,s.useEffect)(function(){oe()},[oe]),(0,s.useEffect)(function(){re&&(j||R||null!=B&&B.lineItems.length||(0,o.navigate)("/",{replace:!0}))},[re,j,R,null==B?void 0:B.lineItems.length]);const le=(0,v.b)({...L,_uid:null!==(a=null==L?void 0:L._uid)&&void 0!==a?a:"",component:null!==(u=null==L?void 0:L.component)&&void 0!==u?u:""}),se=(0,b.o)(null!==(d=null==B?void 0:B.lineItems.map(e=>e.variant.sku).filter(e=>!!e))&&void 0!==d?d:[]);(0,s.useEffect)(function(){if(null!=B&&B.lineItems)if(Y.store in n._u){const e=B.lineItems.every(e=>{var t;const a=e.variant.attributes;if(!a)return!1;const o=null===(t=(0,I.D)(a,"product-family-identifier"))||void 0===t?void 0:t.value;return(0,i.uIM)(o)&&(0,r.P)(Y.store,n.Xc)&&n._u[Y.store].includes(o)});queueMicrotask(()=>{Z(e)})}else queueMicrotask(()=>{Z(!1)})},[B,Y.store]),(0,s.useEffect)(function(){if(null!=B&&B.lineItems)if(Y.store in n.Xc){const e=B.lineItems.every(e=>{var t;const a=e.variant.attributes;if(!a)return!1;const o=null===(t=(0,I.D)(a,"product-family-identifier"))||void 0===t?void 0:t.value;return(0,i.uIM)(o)&&(0,r.P)(Y.store,n.Xc)&&n.Xc[Y.store].includes(o)});queueMicrotask(()=>{ee(e)})}else queueMicrotask(()=>{ee(!1)})},[B,Y.store]),(0,s.useEffect)(function(){te&&requestAnimationFrame(()=>{const e=document.querySelector("#gift-options");e&&e.scrollIntoView({behavior:"smooth",block:"start"}),ae(!1)})},[null==B?void 0:B.version,te]);const ce=null==B?void 0:B.lineItems.map(e=>{var t,a;const r=e.variant.sku?se[e.variant.sku]:void 0;return{...e,image:(0,E.V)(e,r),variantLink:(0,n.gq)(e.productKey)?void 0:(null==r?void 0:r.path)||"",variantLabel:(0,n.Dy)(e.productKey)?null!==(t=null==Q?void 0:Q.description)&&void 0!==t?t:void 0:(0,n.J_)(e.productKey)?null!==(a=null==U?void 0:U.description)&&void 0!==a?a:void 0:(0,S.R$)(e.variant.attributes,!0)}}),ue=(0,f._)(B);(0,s.useEffect)(function(){(0,y.F)({type:"setPageType",data:{pageType:"cart"}})},[]);const de=(0,s.useCallback)((e,t)=>async()=>{if(!K)try{V(!0),await _(t,e),J(void 0)}catch(a){"doesNotMatchCart"===a.message?J(ne("It is not possible to change the content of the cart. Please remove any applied discounts and try again.")):(console.error("Error updating cart quantity:",a),J(ne("Error")))}finally{V(!1)}},[K,_,ne]),me=(0,s.useCallback)(e=>async()=>{if(O&&!K&&e)try{V(!0),await F(e),J(void 0)}catch(t){"doesNotMatchCart"===t.message?J(ne("It is not possible to change the content of the cart. Please remove any applied discounts and try again.")):console.error("Error removing this article:",t)}finally{V(!1)}},[O,K,F,ne]),fe=(0,s.useCallback)(async e=>{if(O&&!K)try{V(!0),await P(e),J(void 0)}catch{J(ne("Error"))}finally{V(!1)}},[P,K,O,ne]),ge=(0,s.useCallback)(async e=>{if(O&&!K)try{V(!0),await A(e),ae(!0),J(void 0)}catch{J(ne("Error"))}finally{V(!1)}},[A,O,K,ne]),pe=(0,s.useCallback)(async(e,t)=>{if(O&&!K)try{V(!0),await D(e,t),J(void 0)}catch{J(ne("Error"))}finally{V(!1)}},[O,K,ne,D]),{subtotalFormatted:ve,originalSubtotalFormatted:be}=B?(0,C.ZC)(B):{subtotalFormatted:"",originalSubtotalFormatted:void 0},ye={displayOptions:null!==(h=null==L?void 0:L.field_display_gift_options_string)&&void 0!==h?h:"",displayPrice:null===(x=null==L?void 0:L.field_gift_display_price_boolean)||void 0===x||x,lineCount:Number.parseInt(null!==(N=null==L?void 0:L.field_gift_message_line_count_string)&&void 0!==N?N:"0"),characterCount:Number.parseInt(null!==(w=null==L?void 0:L.field_gift_message_character_count_string)&&void 0!==w?w:"0")},he=null==L?void 0:L.gift_message_description,Ee=(0,M.Hx)(null==le?void 0:le.contact_us),Ce={cart:B||void 0,viewLoading:!re||R,cartUpdateLoading:K,setQuantity:de,removeItem:me,addGiftBoxItem:fe,addGiftMessageItem:ge,updateGiftMessageItem:pe,isNonWrappable:X,isNonMessageable:z,errorMessage:H,title:(null==le?void 0:le.meta_title)||(null==le?void 0:le.title)||"",description:(null==le?void 0:le.meta_description)||"",preamble:null==le?void 0:le.preamble,cartItems:ce||[],outOfStockItems:$,limitedStockItems:q,subtotal:ve,originalSubtotal:be,contactUsUrl:Ee,freeShippingUSP:ue,giftWrapSettings:ye,giftMe
1ssageDescription:he};return rt.createElement(k.I,{value:{adyenMerchantAccount:null!==(T=null===(G=e.commerceToolsStore)||void 0===G?void 0:G.adyenMerchantAccount)&&void 0!==T?T:void 0}},rt.createElement(nt,Ce))};const ot=e=>{var t,a,n;const r=e.data.page,i=null==r?void 0:r.title,{siteConfig:o}=(0,m.A1)(),l=(0,h.f)(o.name,e.location.pathname);return rt.createElement(rt.Fragment,null,rt.createElement(u.U,null),rt.createElement(d.k,{localesData:e.data.locales,title:null!==(t=null!==(a=null==r?void 0:r.meta_title)&&void 0!==a?a:i)&&void 0!==t?t:"",description:null!==(n=null==r?void 0:r.meta_description)&&void 0!==n?n:"",noIndex:Boolean(null==r?void 0:r.no_index),noFollow:Boolean(null==r?void 0:r.no_follow),canonicalUrl:l}))}},84307:function(e,t,a){a.d(t,{b:function(){return c}});var n=a(90562),r=a(99076),i=a(27348),o=a(97210),l=a(1254),s=a(29721);const c=e=>{const{search:t}=(0,r.useLocation)(),a=(0,s.X)(),c=(e=>{var t;const a=new URLSearchParams(e);return Number.parseInt(null!==(t=a.get("_storyblok"))&&void 0!==t?t:"0")})(t),u=(e=>{var t;return null!==(t=new URLSearchParams(e).get("_storyblok_lang"))&&void 0!==t?t:""})(t),{0:d,1:m}=(0,i.useState)(e),{0:f,1:g}=(0,i.useState)(a),p=(0,n.kY)({content:void 0,internalId:a?c:0},{language:u,resolveRelations:["blog_post.author"]}),v=(0,i.useMemo)(()=>{if(!a)return;const e=p.content;return e?{...e,name:p.name}:void 0},[a,p.content,p.name]),b=(0,i.useCallback)(async()=>{if(!c||!u)return;const e=new o.A({accessToken:"3uDwVQYVgOoBFyqpr67JYQtt"}),t={...(0,l.lP)(),language:u,version:"draft"},{data:{story:a}}=await e.getStory(c.toString(),t);return a},[c,u]);return(0,i.useEffect)(function(){a&&b().then(e=>{if(null!=e&&e.content){const t=e.content;t.name=e.name,m(t)}}).catch(e=>{console.error("Error while fetching initial story:",e)}).finally(()=>{g(!1)})},[b,a]),a?f?void 0:null!=v?v:d:e}},85184:function(e,t,a){a.d(t,{K:function(){return r}});var n=a(71295);const r=()=>{const{t:e}=(0,n.useTranslation)();return{default:e("Please make sure that the gift card code is correct and try again."),remove_error:e("Something went wrong, please try again."),no_value:e("The gift card has no remaining value."),cart_paid:e("The cart is already fully paid, can't add any more gift cards."),invalid_method:e("You can not use a gift card as payment method when buying another gift card."),already_applied:e("You can't use the same gift card multiple times.")}}},98739:function(e,t,a){a.d(t,{A:function(){return c}});var n=a(68348),r=a(46093),i=a(38744),o=a(9044),l=a(71431),s=a(27348);var c=({id:e,buttonLabel:t,input:a,loading:c,errorMessage:u,successMessage:d,showSuccessMessageAboveInput:m,hideSuccessMessage:f,centerFeedbackText:g,helperText:p,appliedDiscountCode:v,onFormSubmit:b,onInputChange:y,removeDiscountCode:h,removeButtonLabel:E,...C})=>{const I=""===a,S=""!==a,M=u,k=d,x=p?`${e}-helper-text`:void 0,N=M?`${e}-error-message`:void 0,w=[x,N].filter(Boolean).join(" ")||void 0,T=Boolean(k)&&Boolean(m)&&!f,G=Boolean(k)&&!m&&!f,L=Boolean(v)&&"function"==typeof h,_=G||L,P=g||Boolean(m),A=(0,n.cn)(l.eo,{[l.oY]:M}),D=c?s.createElement(r.A,{icon:"reload",loading:!0,variant:"primary",buttonType:"input",className:(0,n.cn)(l.CW),"aria-label":t||"input-button",role:"button"}):s.createElement(i.A,{name:k?"check":"close",className:(0,n.cn)(l.fF,{[l.oY]:M})});return s.createElement("form",{className:l.Zd,onSubmit:e=>{e.preventDefault(),b(e)}},s.createElement("div",{className:(0,n.cn)(l.Mw)},T&&s.createElement("p",{className:(0,n.cn)(l.qG,{[l.kx]:P}),role:"status","aria-live":"polite","aria-atomic":"true"},d),s.createElement("div",{className:A},s.createElement("input",Object.assign({type:"text",id:e,className:(0,n.cn)(l.hF),value:a,onChange:y,"aria-describedby":w,"aria-invalid":Boolean(M)},C)),v||!1!==c?D:s.createElement(r.A,{icon:I?"arrow-right":void 0,loading:c,type:I?"button":"submit",variant:I?"secondary":"primary",label:S?t:void 0,buttonType:I?"input":"standard",className:(0,n.cn)(l.fw),"aria-label":t||"input-button"})),!!p&&s.createElement("p",{id:x,className:(0,n.cn)(l.cy,{[l.kx]:P})},p),!!M&&s.createElement("div",{id:N},s.createElement(o.A,{message:u})),_&&s.createElement("div",{className:l.p_,"data-testid":"feedback-container"},G&&s.createElement("p",{role:"status","aria-live":"polite","aria-atomic":"true"},d),L&&s.createElement(r.A,{label:E,onClick:()=>{h&&h()},alwaysSmall:!0,variant:"secondary"}))))}}}]);
2//# sourceMappingURL=component---src-templates-cart-page-cart-page-container-tsx-56876fef834e25bcbe29.js.map

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.