1import{b as O,J as m,aP as S,c as U,l as K,bX as y,s as C,i as de,t as js,aN as os,c0 as ue,c1 as ke,c2 as tt,h as xt,c3 as Qs,c4 as vt,c5 as kt,a as z,c6 as Ys,aO as Mt,bO as ge,bQ as Ce,L as ls,aw as ie,c7 as Ft,bP as Ie,v,bq as ht,b_ as Js,c8 as cs,bN as H,T as J,e as ae,b8 as ds,c9 as Re,aM as hs,ca as $t,cb as Xs,cc as Pt,cd as Ct,ce as Zs,N as ei,M as ti,H as si,p as ii,D as ai,r as ni,C as ri}from"./storefrontApp.CsApItsi.min.js";import{B as q}from"./chunk-basket_updated_handler.eDRRsA9.js";import{g as B,f as Tt}from"./chunk-vendor-lodash.CWHFt7Z.js";import{d as k,m as A,e as D,B as ve,a as ps,c as oi,k as us,O as It,S as li,h as ci}from"./chunk-vendor-rxjs.Dp7kflo.js";import{w as ye,g as ce,s as be,c as fe,i as di}from"./chunk-index.esm.BJO8Gf1.js";import{F as Ot,B as hi,P as pi,D as ui,C as Ze,S as mi,a as _i,I as gi,H as yi,b as bi}from"./chunk-basket_mapper.Bf2V29H.js";import{S as L}from"./chunk-storefront_settings_constants.DIF02Gz.js";import{A as fi}from"./chunk-authentication_events._gjIzqq.js";import{U as Si}from"./chunk-user_events.DVe_9j8.js";import{U as _e,$ as r,b as P,d as I,f as g,w as d,e as p,t as u,a as ee,c as $e,B as ms,h as _s,J as we,T as Ai,g as j,q as vi}from"./chunk-vendor-lit.NvY0u02.js";import{M as ki}from"./chunk-modal_constants.RvL-5Lb.js";import{S as pt}from"./chunk-storefront_event_handler.Ci34Uxt.js";import{t as l}from"./chunk-translations_directive.DWSzkd6.js";import{o as $}from"./chunk-observable_directive.eGckMWP.js";import{B as Ve}from"./chunk-backdrop_constants.5bk4eBT.js";import{P as $i}from"./chunk-price_mapper.RARQykB.js";import{S as f}from"./chunk-storefront_base_lit_element.lX23Jvc.js";import{o as F}from"./chunk-observe_when_directive.DWgxaey.js";import{I as Pi}from"./chunk-input_stepper_constants.CxAeeF7.js";import{B as ne,a as Ci,G as Ii}from"./chunk-inpost_pay_button_constants.RkLheTG.js";import{S as Lt}from"./chunk-subscription_controller.pXrelaM.js";import{F as Pe}from"./chunk-form_state_constants.Gcz9tYH.js";import{P as wi}from"./chunk-product_stock_changed_handler.C3zWS6V.js";import{a as gs}from"./chunk-control_connector_constants.CepOMss.js";import"./chunk-vendor-di.Bh23gdA.js";import"./chunk-vendor-phoenix.cdKS79L.js";import"./chunk-address_mapper.CVcRwRB.js";import"./chunk-loyalty_points_mapper.DhjGhUJ.js";import"./chunk-bundle_item_mapper.C6saoi-.js";import"./chunk-producer_mapper.CMRXClb.js";import"./chunk-product_events_constants.BHFu5GP.js";class Ei extends O{#e;#t;#s;#a;#n;#r;constructor({basketProductsListRepository:e,basketHttpApi:t,basketUpdaterApi:i,messageStorageApi:s,flashMessengerApi:a,translationsApi:o}){super(),this.#e=e,this.#s=t,this.#a=i,this.#t=s,this.#n=a,this.#r=o,this._setupEventListeners()}_setupEventListeners(){new q(this.#o,this.#t)}#o=({body:e})=>{const t=e?.products.list||[];this._setProducts(t)};_setProducts(e){this.#e.set(e)}get(){return this.#e.get()}select$(){return this.#e.select$().pipe(k((e,t)=>B(e,t)))}async remove(e){const{response:t}=this.#s.removeProduct(e.actions.remove);try{const{data:i}=await t;this.eventBus.emit(new m(S.itemRemovedFromBasket,e)),this.#a.emitUpdateBasketEvent(i)}catch(i){this._handleUnexpectedError(i)}}async update(e,t){const{response:i}=this.#s.updateProduct(e.actions.changeQuantity,t);try{const{data:s}=await i;this.#a.emitUpdateBasketEvent(s)}catch(s){this._handleUnexpectedError(s)}}_handleUnexpectedError(e){console.error(e),this.#n.addFlashMessage({type:"error",content:this.#r.translate("An unexpected error occurred")}),this.eventBus.emit(new m(S.unexpectedError))}}const Bi=({storeName:n="BasketProductsListStore"}={})=>U({name:n},ye());class xi{#e;constructor(e){this.#e=e}get(){return this.#e.query(ce())}select$(){return this.#e.pipe(be())}set(e){this.#e.update(fe(e))}}const Ee={isValid:!0,validationMessage:""},Mi={sum:{currency:"",grossValue:0,grossValueFormatted:"",netValue:0,netValueFormatted:"",taxValue:0,taxValueFormatted:"",tax:0,taxFormatted:""},discountedSum:{currency:"",grossValue:0,grossValueFormatted:"",netValue:0,netValueFormatted:"",taxValue:0,taxValueFormatted:"",tax:0,taxFormatted:""}
1,position:0,count:0,...Ee},Fi=({storeName:n="BasketProductsSummaryStore"}={})=>U({name:n},K(Mi));class Ti{#e;#t;constructor(e){this.#e=e,this.#t=new Ot}setSum(e){this.#e.update(y("sum",this.#t.toDTO(e)))}getSum(){return this.#t.toModel(this.#e.getValue().sum)}selectSum$(){return this.#e.pipe(C(e=>this.#t.toModel(e.sum)))}setDiscountedSum(e){this.#e.update(y("discountedSum",this.#t.toDTO(e)))}getDiscountedSum(){return this.#t.toModel(this.#e.getValue().discountedSum)}selectDiscountedSum$(){return this.#e.pipe(C(e=>this.#t.toModel(e.discountedSum)))}setCount(e){this.#e.update(y("count",e))}getCount(){return this.#e.getValue().count}selectCount$(){return this.#e.pipe(C(e=>e.count))}setPosition(e){this.#e.update(y("position",e))}getPosition(){return this.#e.getValue().position}selectPosition$(){return this.#e.pipe(C(e=>e.position))}setSectionValidation(e){this.#e.update(y("isValid",e.isValid)),this.#e.update(y("validationMessage",e.validationMessage))}getSectionValidation(){return{isValid:this.#e.getValue().isValid,validationMessage:this.#e.getValue().validationMessage}}selectSectionValidation$(){return this.#e.pipe(C(e=>({isValid:e.isValid,validationMessage:e.validationMessage})))}}class Oi extends O{#e;#t;constructor({basketProductsSummaryRepository:e,messageStorageApi:t}){super(),this.#e=e,this.#t=t,this._setupEventListeners()}_setupEventListeners(){new q(this.#s,this.#t),this.eventBus.on("invalidSection.basketItems",({body:e})=>{this.#e.setSectionValidation({isValid:!1,validationMessage:e||""})})}#s=({body:e})=>{const t=e?.products.sum,i=e?.products.positions,s=e?.products.count,a=e?.products.discountedSum;t&&this._setSum(t),s!==void 0&&this._setCount(s),i!==void 0&&this._setPosition(i),a&&this._setDiscountedSum(a),e?.invalidSections.basketItems||this.#e.setSectionValidation({isValid:!0,validationMessage:""})};_setSum(e){this.#e.setSum(e)}getSum(){return this.#e.getSum()}selectSum$(){return this.#e.selectSum$().pipe(k((e,t)=>B(e,t)))}_setDiscountedSum(e){this.#e.setDiscountedSum(e)}getDiscountedSum(){return this.#e.getDiscountedSum()}selectDiscountedSum$(){return this.#e.selectDiscountedSum$().pipe(k((e,t)=>B(e,t)))}_setCount(e){this.#e.setCount(e)}getCount(){return this.#e.getCount()}selectCount$(){return this.#e.selectCount$()}_setPosition(e){this.#e.setPosition(e)}getPositions(){return this.#e.getPosition()}selectPositions$(){return this.#e.selectPosition$()}getSectionValidation(){return this.#e.getSectionValidation()}selectSectionValidation$(){return this.#e.selectSectionValidation$().pipe(k((e,t)=>B(e,t)))}}class Li extends de{constructor({basketProductsListService:e,basketProductsSummaryService:t}){super(),this.moduleName="basketProductsApi",this.#e=e,this.#t=t}#e;#t;get(){return this.#e.get()}select$(){return this.#e.select$()}remove(e){this.#e.remove(e)}update(e,t){this.#e.update(e,t)}getBasketCount(){return this.#t.getCount()}selectBasketCount$(){return this.#t.selectCount$()}getBasketPositions(){return this.#t.getPositions()}selectBasketPositions$(){return this.#t.selectPositions$()}getSum(){return this.#t.getSum()}selectSum$(){return this.#t.selectSum$()}getDiscountedSum(){return this.#t.getDiscountedSum()}selectDiscountedSum$(){return this.#t.selectDiscountedSum$()}getSectionValidation(){return this.#t.getSectionValidation()}selectSectionValidation$(){return this.#t.selectSectionValidation$()}}class Ni extends js{constructor({httpApi:e}){super(e),this.moduleName=os.httpApi,this._basketRequestQueue=Promise.resolve()}addItem({basketId:e,variantId:t,quantity:i,variantOptions:s,basketTrackingParams:a,isExchangedWithLoyaltyPoints:o=!1,bundleItems:c=[]}){return this._processBasket({method:"post",url:`/api/basket/${e}/item/${t}${a||""}`,data:{quantity:i,options:s,isExchangedWithLoyaltyPoints:o,bundledItems:c}})}updateProduct(e,t){return this._processBasket({method:e.method,url:`/${e.href}`,data:{quantity:t}})}removeProduct(e){return this._processBasket({method:e.method,url:`/${e.href}`})}createBasket(){return this._processBasket({method:"post",url:"/api/basket/"})}queueCreateBasket(){return this._processBasket({method:"post",url:"/api/basket/queue"})}getBasket(e){return this._processBasket({method:"get",url:`/api/basket/${e??""}`})}cleanBasket(e){return this._processBasket({method:e.method,url:`/${e.href}`})}
1addCoupon(e,t){return this._processBasket({method:e.method,url:`/${e.href}`,data:{code:t}})}removeCoupon(e){return this._processBasket({method:e.method,url:`/${e.href}`})}addGiftCard(e,t){return this._processBasket({method:e.method,url:`/${e.href}`,data:{giftCardCode:t}})}removeGiftCard(e){return this._processBasket({method:e.method,url:`/${e.href}`})}setShipping(e){return this._processBasket({method:e.method,url:`/${e.href}`})}setCountry(e,t){return this._processBasket({method:e.method,url:`/${e.href}/${t}`})}setPayment(e){return this._processBasket({method:e.method,url:`/${e.href}`})}setPaymentData(e,t){return this._processBasket({method:e.method,url:`/${e.href}`,data:t})}setAddress(e,t){return this._processBasket({method:e.method,url:`/${e.href}`,data:t})}changePickupPoint(e,t){return this._processBasket({method:e.method,url:`/${e.href}`,data:{...t}})}setComment(e,t){return this._processBasket({method:e.method,url:`/${e.href}`,data:{comment:t}})}changeAdditionalField(e,t,i){return this._processBasket({method:e.method,url:`/${e.href}`,data:{[t]:i}})}uploadVariantFile(e,t,i){return this._processBasket({method:"post",url:`/api/basket/${e}/product-option-file/${t}`,data:i,headers:{"Content-Type":"application/octet-stream","X-Uploaded-File-Name":encodeURI(i.name)}})}uploadAdditionalFieldFile(e,t){return this._processBasket({method:"post",url:`/${e.href}`,data:t,headers:{"Content-Type":"application/octet-stream","X-Uploaded-File-Name":encodeURI(t.name)}})}queueOrder(e){return this._processBasket({method:e.method,url:`/${e.href}`})}getQueueStatus(e){return this._processBasket({method:"get",url:`${e}`})}getCreateBasketQueueStatus(e){return this._processBasket({method:"get",url:`${e}`})}placeOrder(e){return this._processBasket({method:e.method,url:`/${e.href}`})}_processBasket(e){let t=null,i=!1;const s=()=>
1{if(i)return Promise.reject(new Error("Request canceled"));const o=setTimeout(()=>{this.eventBus.emit(new m(S.changeState,ue.longProcessing))},200);try{const{response:c,cancelRequest:h}=this.fetch(e);return t=h,c.then(b=>(clearTimeout(o),this.eventBus.emit(new m(S.changeState,ue.idle)),b)).catch(b=>{throw clearTimeout(o),this.eventBus.emit(new m(S.changeState,ue.idle)),b})}catch(c){return this.eventBus.emit(new m(S.changeState,ue.idle)),Promise.reject(c)}},a=this._basketRequestQueue.then(s,s);return this._basketRequestQueue=a.then(()=>{},()=>{}),{response:a,cancelRequest:()=>{t?t():i=!0}}}}const Vi={_links:{},id:"",comment:"",countries:[],isVatEu:!1,hasPromoCode:!1,promoCode:null,delivery:null,discounts:{list:[],sum:{currency:"",grossValue:0,grossValueFormatted:"0,00 zÅ",netValue:0,netValueFormatted:"0,00 zÅ",taxValue:0,taxValueFormatted:"0,00 zÅ",tax:0,taxFormatted:"0,00 zÅ"}},additionalFields:{selectFields:[],descriptionFields:[],inputFields:[],fileFields:[],hiddenFields:[],checkboxFields:[]},taxes:{list:[],sum:{value:0,valueFormatted:"0,00 zÅ"}},payments:[],shippings:[],billingAddress:null,shippingAddress:null,sum:{currency:"",grossValue:0,grossValueFormatted:"0,00 zÅ",netValue:0,netValueFormatted:"0,00 zÅ",taxValue:0,taxValueFormatted:"0,00 zÅ",tax:0,taxFormatted:"0,00 zÅ"},sumWithoutPaymentAndShipping:{currency:"",grossValue:0,grossValueFormatted:"0,00 zÅ",netValue:0,netValueFormatted:"0,00 zÅ",taxValue:0,taxValueFormatted:"0,00 zÅ",tax:0,taxFormatted:"0,00 zÅ"},loyaltyPointsAwarded:null,hasItemsExchangedWithLoyaltyPoints:!1,loyaltyPointsCost:null,loyaltyPointsExchangePrice:null,items:{list:[],count:0,positions:0,sum:{currency:"",grossValue:0,grossValueFormatted:"0,00 zÅ",netValue:0,netValueFormatted:"0,00 zÅ",taxValue:0,taxValueFormatted:"0,00 zÅ",tax:0,taxFormatted:"0,00 zÅ"},discountedSum:{currency:"",grossValue:0,grossValueFormatted:"0,00 zÅ",netValue:0,netValueFormatted:"0,00 zÅ",taxValue:0,taxValueFormatted:"0,00 zÅ",tax:0,taxFormatted:"0,00 zÅ"}},invalidSections:{}};class Ri extends O{#e;#t=new hi;#s;#a;#n;#r;#o;#i;#l;constructor({basketHttpApi:e,flashMessengerApi:t,settingsApi:i,storeFactoryApi:s,translationsApi:a,basketUpdaterRepository:o}){super(),this.#e=e,this.#s=t,this.#a=i,this.#n=s,this.#r=a,this.#o=o,this._setupLocalStore(),this._setupBasket(),this._setupEvents(),this._isRememberCreateBasketQueueEnabled()&&this._setupSessionStore()}_isRememberCreateBasketQueueEnabled(){return this.#a.isFeatureEnabled("dev_remember_create_basket_queue")}_isBasketExpired(){const e=this.#i?.get("basketUpdateTimestamp"),t=Date.now();if(e){const i=parseInt(e,10),s=1440*1e3;return t-i>s}return!1}_hasBasket(){return this.#i?.has("basketId")===!0}_setupLocalStore(){this.#i=this.#n.getStore(ke),this.#i||(this.#i=this.#n.createStore("local",ke))}_setupSessionStore(){this.#l=this.#n.getStore(tt),this.#l||(this.#l=this.#n.createStore("session",tt))}_setupBasket(){if(this._isBasketExpired()){const e=this.#i?.get("basketId");e&&this.getCurrentBasket(e,!0)}else if(this._hasBasket()){const e=this.#i?.get("basketId");this.getCurrentBasket(e)}}_setupEvents(){this.eventBus.on(S.unexpectedError,()=>{this._hasBasket()&&this._clearBasket()}),this.eventBus.on(fi.loggedOut,()=>{this._hasBasket()&&this._clearBasket()}),this.eventBus.on(S.orderPlaced,()=>{this._hasBasket()&&this._clearBasket()}),this.eventBus.on(Si.hasBasket,async({body:e})=>{if(!e)return;const t=this.#a.isFeatureEnabled("dev_basket_merging"),i=this._hasBasket();t||!i?(this.#i?.set("basketId",e),await this.getCurrentBasket(e,!0)):this.refreshBasket()})}async addItem({variantId:e,quantity:t,variantOptions:i,basketTrackingParams:s,isExchangedWithLoyaltyPoints:a,bundleItems:o,showAddedModal:c,showFlashMessage:h}){const _=this.#i?.get("basketId");if(_)try{const{response:b}=this.#e.addItem({basketId:_,variantId:e,quantity:t,variantOptions:i,basketTrackingParams:s,isExchangedWithLoyaltyPoints:a,bundleItems:o}),{data:w}=await b;this.emitUpdateBasketEvent(w);const M=this.#t.toModel(w.basket),x=w.addedItem;c=c===void 0?!0:c;const N=M.products.list?.find(se=>se.id===x?.itemId);return x&&x.addedQuantity>0&&(h&&this.#s.addFlashMessage({type:"success",content:this.#r.translate("Added to cart")}),this.eventBus.emit(new m(S.itemAddedToBasket,{addedItem:x,product:N,basket:M,showAddedModal:c}))),M}catch(b){return console.error(b),b.response.status===xt.notFound?(c=c===void 0?!0:c,this.#i?.remove("basketId"),this.addItem({variantId:e,quantity:t,variantOptions:i,basketTrackingParams:s,bundleItems:o,showAddedModal:c})):null}else return await this.createBasket()?this.addItem({variantId:e,quantity:t,variantOptions:i,basketTrackingParams:s,isExchangedWithLoyaltyPoints:a,bundleItems:o,showAddedModal:c,showFlashMessage:h}):(this._handleUnexpectedError("Basket not created"),null)}
1async uploadVariantFile(e,t){const i=this.#i?.get("basketId");if(i)try{const{response:s}=this.#e.uploadVariantFile(i,e,t),{data:a}=await s;return a}catch(s){return console.error(s),null}else return await this.createBasket()?this.uploadVariantFile(e,t):(this._handleUnexpectedError("Basket not created"),null)}async createBasket(){try{if(this.#a.isFeatureEnabled("create_basket_queue")){if(this._isRememberCreateBasketQueueEnabled()){const e=this._getRememberedCreateBasketCheckStatusUrl();if(e)return this._getQueueStatus(e)}return this._queueCreateBasket()}else return this._createBasket()}catch(e){return console.error(e),!1}}async _createBasket(){const{response:e}=this.#e.createBasket(),{data:t}=await e;return this.#i?.set("basketId",t.basket.id),!0}async _queueCreateBasket(){const{response:e}=this.#e.queueCreateBasket(),{data:t}=await e;if(t._links.checkStatus)if(this._isRememberCreateBasketQueueEnabled()){const i=this._setCreateBasketCheckStatusUrl(t._links.checkStatus.href);if(i)return this._getQueueStatus(i);console.error("Create basket queue returned invalid check status URL.")}else return this._getQueueStatus(t._links.checkStatus.href);return!1}async _getQueueStatus(e){try{for(;;){const{response:t}=this.#e.getCreateBasketQueueStatus(e),{data:i}=await t;switch(i.status){case"done":return this.#o.setIsCreateBasketInProgress(!1),this._removeCreateBasketCheckStatusUrl(),i.basket_id?(this.#i?.set("basketId",i.basket_id),!0):(console.error("Basket creation queue finished with 'done' status but without 'basket_id'."),!1);case"pending":this.#o.setIsCreateBasketInProgress(!0),await new Promise(s=>setTimeout(s,1e3));continue;case"error":return this.#o.setIsCreateBasketInProgress(!1),this._removeCreateBasketCheckStatusUrl(),!1;default:return this.#o.setIsCreateBasketInProgress(!1),this._removeCreateBasketCheckStatusUrl(),console.error(`Unknown basket creation queue status: "${i.status}"`),!1}}}catch(t){return this._removeCreateBasketCheckStatusUrl(),this.#o.setIsCreateBasketInProgress(!1),this._handleUnexpectedError(t),!1}}_normalizeCreateBasketCheckStatusUrl(e){try{const t=new URL(e,window.location.origin),i=t.origin===window.location.origin,s=Ys.test(t.pathname),a=t.hash!=="";return!i||!s||a?null:`${t.pathname}${t.search}`}catch{return null}}_isCreateBasketCheckStatusUrlExpired(e){if(!e)return!0;const t=parseInt(e,10);return Number.isNaN(t)?!0:Date.now()-t>Qs}_getRememberedCreateBasketCheckStatusUrl(){const e=this.#l?.get(vt),t=this.#l?.get(kt);if(!e||this._isCreateBasketCheckStatusUrlExpired(t))return this._removeCreateBasketCheckStatusUrl(),null;const i=this._normalizeCreateBasketCheckStatusUrl(e);return i||(this._removeCreateBasketCheckStatusUrl(),null)}_setCreateBasketCheckStatusUrl(e){const t=this._normalizeCreateBasketCheckStatusUrl(e);return t?(this._isRememberCreateBasketQueueEnabled()&&(this.#l?.set(vt,t),this.#l?.set(kt,String(Date.now()))),t):(this._removeCreateBasketCheckStatusUrl(),null)}_removeCreateBasketCheckStatusUrl(){this._isRememberCreateBasketQueueEnabled()&&(this.#l?.remove(vt),this.#l?.remove(kt))}selectIsCreateInProgress$(){return this.#o.selectIsCreateInProgress$()}async getBasket(e){try{const{response:t}=this.#e.getBasket(e),{data:i}=await t;return this.#t.toModel(i.basket)}catch(t){return console.error(t),null}}async getCurrentBasket(e,t=!1){if(this.#i?.has("basket")&&!t){const i=this.#i.getObject("basket"),s=this.#a.getSkinSettings().currency,a=!!i?.sum?.currency&&i?.sum?.currency!==s;if(i&&!a)return this.emitUpdateBasketEvent({basket:i,flashMessages:[]}),this.#t.toModel(i)}try{const{response:i}=this.#e.getBasket(e),{data:s}=await i;return this.emitUpdateBasketEvent(s),this.#t.toModel(s.basket)}catch(i){return console.error(i),this._clearBasket(),null}}async refreshBasket(){const e=this.#i?.get("basketId");if(e)return this.getCurrentBasket(e,!0);{await this.createBasket();const t=this.#i?.get("basketId");return this.getCurrentBasket(t)}}_clearBasket(){this.#i?.remove("basketId"),this.#i?.remove("basket"),this.#i?.remove("basketUpdateTimestamp"),this.#i?.remove("shippingChosenByUser"),this.#i?.remove("paymentChosenByUser"),this._removeCreateBasketCheckStatusUrl(),this.eventBus.emit(new m(S.basketUpdated,this.#t.toModel(Vi)))}emitUpdateBasketEvent(e){const t=e.flashMessages?.filter(s=>!s.showInBasketOnly)||[],i=e.flashMessages?.filter(s=>s.showInBasketOnly)||[];this.#s.addFlashMessages(t.map(s=>({type:s.isError?z.error:z.success,content:s.message}))),this.#a.getPageSettings().controller==="basket"&&this.#s.addFlashMessages(i.map(s=>({type:s.isError?z.error:z.success,content:s.message}))),this.#i?.set("basketUpdateTimestamp",String(Date.now())),this.#i?.setObject("basket",e.basket),this.eventBus.emit(new m(S.basketUpdated,this.#t.toModel(e.basket)))}_handleUnexpectedError(e){console.error(e),this.#s.addFlashMessage({type:"error",content:this.#r.translate("An unexpected error occurred")}),this.eventBus.emit(new m(S.unexpectedError))}}class Di extends de{constructor({basketUpdaterService:e}){super(),this.moduleName=Mt.api,this.#e=e}#e;emitUpdateBasketEvent(e){this.#e.emitUpdateBasketEvent(e)}
1async getBasket(e){return this.#e.getBasket(e)}async getCurrentBasket(e,t=!1){return this.#e.getCurrentBasket(e,t)}async addItem(e){return this.#e.addItem(e)}async uploadVariantFile(e,t){return this.#e.uploadVariantFile(e,t)}async refreshBasket(){return this.#e.refreshBasket()}selectIsBasketCreateInProgress$(){return this.#e.selectIsCreateInProgress$()}}const Ui=({storeName:n="BasketPromotionsListStore"}={})=>U({name:n},ye());class Gi extends O{#e;#t;#s;#a;#n;#r;#o;constructor({basketPromotionsListRepository:e,basketHttpApi:t,basketUpdaterApi:i,messageStorageApi:s,flashMessengerApi:a,translationsApi:o,basketOverallApi:c}){super(),this.#e=e,this.#s=t,this.#a=i,this.#t=s,this.#o=c,this.#n=a,this.#r=o,this._setupEventListeners()}_setupEventListeners(){new q(this.#i,this.#t)}#i=({body:e})=>{const t=e?.discounts.list||[];this._setPromotions(t)};_setPromotions(e){this.#e.set(e)}get(){return this.#e.get()}select$(){return this.#e.select$().pipe(k((e,t)=>B(e,t)))}async addCoupon(e){const t=this.#o.getActions().usePromoCode;if(!t)throw new Error("Using promo codes is not allowed");try{const{response:i}=this.#s.addCoupon(t,e),{data:s}=await i;return this.#a.emitUpdateBasketEvent(s),!s.flashMessages.some(a=>a.isError)}catch(i){return this._handleUnexpectedError(i),!1}}async removeCoupon(){const e=this.#o.getActions().removePromoCode;try{const{response:t}=this.#s.removeCoupon(e),{data:i}=await t;this.#a.emitUpdateBasketEvent(i)}catch(t){this._handleUnexpectedError(t)}}_handleUnexpectedError(e){console.error(e),this.#n.addFlashMessage({type:"error",content:this.#r.translate("An unexpected error occurred")}),this.eventBus.emit(new m(S.unexpectedError))}}class qi{#e;constructor(e){this.#e=e}get(){return this.#e.query(ce())}select$(){return this.#e.pipe(be())}set(e){this.#e.update(fe(e))}}class zi extends de{constructor({basketPromotionListService:e,basketPromotionSummaryService:t}){super(),this.moduleName=ge.api,this.#e=e,this.#t=t}#e;#t;add(e){return this.#e.addCoupon(e)}remove(){return this.#e.removeCoupon()}get(){return this.#e.get()}select$(){return this.#e.select$()}getDiscountsSum(){return this.#t.getDiscountsSum()}selectDiscountsSum$(){return this.#t.selectDiscountsSum$()}getHasPromotionCode(){return this.#t.getHasPromotionCode()}selectHasPromotionCode$(){return this.#t.selectHasPromotionCode$()}getPromotionCode(){return this.#t.getPromotionCode()}selectPromotionCode$(){return this.#t.selectPromotionCode$()}}class Hi extends O{#e;#t;constructor({basketPromotionsSummaryRepository:e,messageStorageApi:t}){super(),this.#e=e,this.#t=t,this._setupEventListeners()}_setupEventListeners(){new q(this.#s,this.#t)}#s=({body:e})=>{const t=e?.discounts.sum,i=e?.promotionCode,s=e?.hasPromotionCode;t!==void 0&&this._setDiscountsSum(t),i!==void 0&&this._setPromotionCode(i),s!==void 0&&this._setHasPromotionCode(s)};_setDiscountsSum(e){this.#e.setDiscountsSum(e)}getDiscountsSum(){return this.#e.getDiscountsSum()}selectDiscountsSum$(){return this.#e.selectDiscountsSum$().pipe(k((e,t)=>B(e,t)))}_setHasPromotionCode(e){this.#e.setHasPromotionCode(e)}getHasPromotionCode(){return this.#e.getHasPromotionCode()}selectHasPromotionCode$(){return this.#e.selectHasPromotionCode$()}_setPromotionCode(e){this.#e.setPromotionCode(e)}getPromotionCode(){return this.#e.getPromotionCode()}selectPromotionCode$(){return this.#e.selectPromotionCode$().pipe(k((e,t)=>B(e,t)))}}class Ki{#e;#t;#s;constructor(e){this.#e=e,this.#t=new Ot,this.#s=new pi}setDiscountsSum(e){this.#e.update(y("discountsSum",this.#t.toDTO(e)))}getDiscountsSum(){return this.#t.toModel(this.#e.getValue().discountsSum)}selectDiscountsSum$(){return this.#e.pipe(C(e=>this.#t.toModel(e.discountsSum)))}setHasPromotionCode(e){this.#e.update(y("hasPromotionCode",e))}getHasPromotionCode(){return this.#e.getValue().hasPromotionCode}selectHasPromotionCode$(){return this.#e.pipe(C(e=>e.hasPromotionCode))}setPromotionCode(e){this.#e.update(y("promotionCode",e?this.#s.toDTO(e):null))}getPromotionCode(){const e=this.#e.getValue().promotionCode;return e?this.#s.toModel(e):null}selectPromotionCode$(){return this.#e.pipe(C(({promotionCode:e})=>e?this.#s.toModel(e):null))}}const Wi={discountsSum:{currency:"",grossValue:0,grossValueFormatted:"",netValue:0,netValueFormatted:"",taxValue:0,taxValueFormatted:"",tax:0,taxFormatted:""},hasPromotionCode:!1,promotionCode:null},ji=({storeName:n="BasketPromotionsSummaryStore"}={})=>U({name:n},K(Wi));class Qi extends de{constructor({basketShippingsListService:e,basketShippingsCountriesService:t}){super(),this.moduleName=Ce.api,this.#e=e,this.#t=t}#e;#t;get(){return this.#e.get()}select$(){return this.#e.select$()}setShipping(e){this.#e.setShipping(e)}setPickupPoint(e,t){this.#e.setPickupPoint(e,t)}getAvailableShippingCountries(){return this.#t.get()}selectAvailableShippingCountries$(){return this.#t.select$()}getSelectedShippingCountries(){return this.#e.getSelectedShippingCountries()}getSelectedShippingCountry(){return this.#e.getSelectedShippingCountry()}selectSelectedShippingCountries$(){return this.#e.selectSelectedShippingCountries$()}selectSelectedShippingCountry$(){return this.#e.selectSelectedShippingCountry$()}setCountry(e){return this.#e.setCountry(e)}getSelectedShipping(){return this.#e.getSelectedShipping()}selectSelectedShipping$(){return this.#e.selectSelectedShipping$()}getPaymentCostForActiveShippingByPaymentId(e){return this.#e.getPaymentCostForActiveShippingByPaymentId(e)}selectPaymentCostForActiveShippingByPaymentId$(e){return this.#e.selectPaymentCostForActiveShippingByPaymentId$(e)}isEveryAvailablePaymentFree(){return this.#e.isEveryAvailablePaymentFree()}selectIsEveryAvailablePaymentFree$(){return this.#e.selectIsEveryAvailablePaymentFree$()}getSectionValidation(){return this.#e.getSectionValidation()}selectSectionValidation$(){return this.#e.selectSectionValidation$()}addMap(e,t){this.#e.addMap(e,t)}async showPickupPointMap(e){this.#e.showPickupPointMap(e)}shouldDisplayRemainingBasketValueForFreeShippingMessage(e){return this.#e.shouldDisplayRemainingBasketValueForFreeShippingMessage(e)}addShippingInfo(e,t){this.#e.addShippingInfo(e,t)}getShippingInfo(e){return this.#e.getShippingInfo(e)}}var ys;ys=ls;const Yi=class bs{constructor({code:e,isCollectOnDeliveryAvailable:t,supplier:i,name:s,description:a,street:o,house
1Number:c,city:h,postalCode:_,province:b,countryCode:w,latitude:M,longitude:x,openingHours:N}){this[ys]=!0,this.code=e,this.isCollectOnDeliveryAvailable=t,this.supplier=i,this.name=s,this.description=a,this.street=o,this.houseNumber=c,this.city=h,this.postalCode=_,this.province=b,this.countryCode=w,this.latitude=M,this.longitude=x,this.openingHours=N}static create(e){return new bs(e)}};let he=Yi;const wt={inpost:"INPOST",inpostInternational:"INPOST_INTERNATIONAL"};class re{toModel(e){return he.create(e)}pocztaPolskaToModel(e){return he.create({code:e.pni,isCollectOnDeliveryAvailable:e.payOnPickup,supplier:e.type,name:e.name,description:e.description,street:e.street,houseNumber:null,city:e.city,postalCode:e.zipCode,province:e.province,countryCode:null,latitude:e.latitude,longitude:e.longitude,openingHours:null})}inpostToModel(e){return he.create({code:e.name,isCollectOnDeliveryAvailable:null,supplier:wt.inpost,name:e.name,description:e.location_description,street:`${e.address_details.street}`,houseNumber:e.address_details.building_number,city:e.address_details.city,postalCode:e.address_details.post_code,province:e.address_details.province,countryCode:null,latitude:String(e.location.latitude),longitude:String(e.location.longitude),openingHours:e.opening_hours})}inpostInternationalToModel(e){const t=e.operatingHours.customer?Object.entries(e.operatingHours.customer).filter(([,i])=>i&&i.length>0).map(([i,s])=>{const a=s.map(({start:o,end:c})=>`${o} - ${c}`).join(", ");return`${i}: ${a}`}).join(", "):null;return he.create({code:e.id,isCollectOnDeliveryAvailable:null,supplier:wt.inpostInternational,name:e.id,description:e.description.content||e.description2.content||e.description3.content||"",street:e.address.street||"",houseNumber:e.address.buildingNumber,city:e.address.city,postalCode:e.address.postalCode,province:e.address.administrativeArea,countryCode:e.country,latitude:`${e.coordinates.latitude}`,longitude:`${e.coordinates.longitude}`,openingHours:t})}inpostInternationalMapToModel(e){return he.create({code:e.name,isCollectOnDeliveryAvailable:null,supplier:wt.inpostInternational,name:e.name,description:e.location_description||e.location_description_1||e.location_description_2||"",street:e.address_details.street||"",houseNumber:e.address_details.building_number,city:e.address_details.city,postalCode:e.address_details.post_code,province:e.address_details.province,countryCode:e.country,latitude:`${e.location.latitude}`,longitude:`${e.location.longitude}`,openingHours:e.opening_hours})}shoperDeliveryToModel(e){const t=e.house_number?String(e.house_number):"";return he.create({code:e.foreign_access_point_id,isCollectOnDeliveryAvailable:e.services_cod,supplier:e.supplier,name:e.name,description:e.name,street:e.street.replace(t,""),houseNumber:t,city:e.city,postalCode:e.postal_code,province:null,countryCode:e.country_code,latitude:e.latitude,longitude:e.longitude,openingHours:null})}alsendoToModel(e){return he.create({code:e.code,isCollectOnDeliveryAvailable:e.cod,supplier:e.operator,name:e.brandPretty,description:e.description,street:e.street,houseNumber:null,city:e.city,postalCode:e.postalCode,province:e.province||null,countryCode:null,latitude:String(e.latitude),longitude:String(e.longitude),openingHours:null})}}class st{static{this._isMapReady=!1}async showMap(e){await this._initMap(),PPWidgetApp.toggleMap({callback:t=>{const i=new re;e(i.pocztaPolskaToModel(t))},options:{basemapProvider:"OpenStreetMap",geocoderProvider:"Nominatim"},address:"Warszawa",type:["POCZTA","ORLEN","AUTOMAT_POCZTOWY","RUCH","ZABKA","FRESHMARKET","AUTOMAT_BIEDRONKA","AUTOMAT_CARREFOUR","AUTOMAT_SPOLEM","AUTOMAT_LEWIATAN","AUTOMAT_PLACOWKA","LEWIATAN","ABC","DELIKATESY_CENTRUM"]})}async _initMap(){st._isMapReady||(await this._createMapScript(),st._isMapReady=!0)}async _createMapScript(){return new Promise(e=>{const t=document.createElement("script");t.onload=function(){e(),window.addEventListener("message",PPWidgetApp.messageDispatcher,!1)},t.async=!0,t.src="https://mapa.ecommerce.poczta-polska.pl/widget/scripts/ppwidget.js",document.head.appendChild(t)})}}class Ji{execute(){return st}}class it{constructor(e){this._isPww=!1,e&&(this._isPww=e.isPww)}static{this._isMapReady=!1}async showMap(e,t){await this._initMap();const i=window.innerWidth<1e3?600:1100;window.easyPack.modalMap((a,o)=>
1{if(this._isPww&&a.location_247||!this._isPww){o.closeModal();const h=new re;e(h.inpostToModel(a))}else typeof t=="function"&&t("W wybranym punkcie nie ma możliwoÅci odbioru paczki w weekend. Aby odebraÄ paczkÄ w sobotÄ lub niedzielÄ, wybierz Paczkomat dostÄpny: 24/7.")},{width:i,height:700});const s=document.getElementById("widget-modal");s&&(this._manageFocus(s),this._styleModal(s),document.addEventListener("keydown",this._closeModalOnEsc))}_manageFocus(e){const t=document.querySelector(".widget-modal__close");setTimeout(()=>{_e.setFocusToFirstFocusableElementInContainer(e)},50);const i=s=>{_e.keepFocusWithinContainer(e,s)};document.addEventListener("keydown",i),t?.addEventListener("click",()=>{document.removeEventListener("keydown",i)})}_styleModal(e){e.style.backgroundColor="#fff",e.parentElement.style.zIndex="99"}_closeModalOnEsc(e){e.code==="Escape"&&(document.querySelector(".widget-modal__close")?.click(),document.removeEventListener("keydown",this._closeModalOnEsc))}async _initMap(){it._isMapReady||(window.easyPackAsyncInit=()=>{window.easyPack.init({apiEndpoint:"https://api-pl-points.easypack24.net/v1",showNonOperatingLockers:!1,showOverLoadedLockers:!1,defaultLocale:"pl",locales:["uk","pl"],langSelection:!0,mapType:"osm",searchType:"osm",points:{types:this._isPww?["parcel_locker_only"]:["parcel_locker","parcel_locker_superpop"]},map:{initialTypes:this._isPww?["parcel_locker_only"]:["parcel_locker","parcel_locker_superpop"]}})},await this._createMapScript(),await this._createMapStylesheet(),it._isMapReady=!0)}async _createMapScript(){return new Promise(e=>{const t=document.createElement("script");t.onload=function(){e()},t.async=!0,t.src="https://geowidget.easypack24.net/js/sdk-for-javascript.js",document.head.appendChild(t)})}async _createMapStylesheet(){return new Promise(e=>{const t=document.createElement("link");t.onload=function(){e()},t.rel="stylesheet",t.type="text/css",t.href="https://geowidget.easypack24.net/css/easypack.css",document.head.appendChild(t)})}}class Xi{execute(){return it}}const Qt="inpost-geowidget-map",Yt="inpost-geowidget-modal";class at{constructor(e){this._isPww=!1,this._token="",e&&(this._isPww=e.isPww,this._token=e.token)}static{this._isMapReady=!1}async showMap(e,t){await this._initMap();const i=this._createModal();i.addEventListener("opened",()=>{ie.nextTick(()=>{this._appendGeowidgetToModal(),document.getElementById(Qt)?.addEventListener("inpost.geowidget.init",s=>{this._removeLoader(),s.detail.api.addPointSelectedCallback(async o=>{this._isPww&&o.location_247||!this._isPww?this._selectPoint(o,e):this._notifyPointNotSelectable(t)})})})}),document.body.appendChild(i)}_selectPoint(e,t){const i=new re;t(i.inpostToModel(e)),this._closeModal()}_notifyPointNotSelectable(e){typeof e=="function"&&e("W wybranym punkcie nie ma możliwoÅci odbioru paczki w weekend. Aby odebraÄ paczkÄ w sobotÄ lub niedzielÄ, wybierz Paczkomat dostÄpny: 24/7.")}async _initMap(){at._isMapReady||(await this._createMapScript(),await this._createMapStylesheet(),at._isMapReady=!0)}async _createMapScript(){return new Promise(e=>{const t=document.createElement("script");t.onload=function(){e()},t.async=!0,t.src="https://geowidget.inpost.pl/inpost-geowidget.js",document.head.appendChild(t)})}async _createMapStylesheet(){return new Promise(e=>{const t=document.createElement("link");t.onload=function(){e()},t.rel="stylesheet",t.type="text/css",t.href="https://geowidget.inpost.pl/inpost-geowidget.css",document.head.appendChild(t)})}_createModal(){const e=document.createElement("aside");return e.innerHTML=` 2 <h-modal class="modal-wrapper_inpost-map" id="${Yt}" opened> 3 <h-modal-header> 4 <h2 class="font_semibold h2">Wybierz punkt</h2> 5 <h-modal-close class="btn btn_icon"> 6 <h-icon 7 icon-name="icon-x" 8 role="button" 9 size="xl" 10 clickable 11 ></h-icon> 12 </h-modal-close> 13 </h-modal-header> 14 15 <h-modal-body> 16 <div class="loader"> 17 <div class="loader__spinner loader__spinner_m"></div> 18 </div> 19 </h-modal-body> 20 </h-modal> 21 `,e}_createGeoWidgetWebComponent(){const e=document.createElement("inpost-geowidget");return e.setAttribute("id",Qt),e.setAttribute("token",this._token),e.setAttribute("language","pl"),e.setAttribute("config","parcelcollect"),e}_appendGeowidgetToModal(){const e=document.querySelector('h-portal-target[name="modals"] h-modal-body'),t=this._createGeoWidgetWebComponent();e?.appendChild(t)}_removeLoader(){const t=document.querySelector('h-portal-target[name="modals"] h-modal-body')?.querySelector(".loader");t&&t.remove()}_closeModal(){const e=document.querySelector(`#${Yt}`);e?.close().then(()=>{e?.parentElement?.remove()})}}class Zi{execute(){return at}}
21const ea="parcelCollect",ta="inpost-geowidget",Jt="inpost-geowidget-map",Xt="inpost-geowidget-modal",fs="en",sa=["pl",fs,"uk","es","fr","pt","it","nl","de"],ia="PL",aa="https://geowidget.inpost-group.com/inpost-geowidget.js",na="https://geowidget.inpost-group.com/inpost-geowidget.css",ra="https://sandbox-global-geowidget-sdk.easypack24.net/inpost-geowidget.js",oa="https://sandbox-global-geowidget-sdk.easypack24.net/inpost-geowidget.css";class nt{constructor(e){this._token="",this._isSandbox=!1,e&&(this._token=e.token,this._isSandbox=e.isSandbox??!1),this._translationApi=e.translationsApi,this._basketShippingListService=e.basketShippingListService,this._flashMessengerApi=e.flashMessengerApi}static{this._isMapReady=!1}async showMap(e){await this._initMap();const t=this._createModal();t.addEventListener(ki.opened,()=>{ie.nextTick(()=>{this._appendGeowidgetToModal(),document.getElementById(Jt)?.addEventListener("inpost.geowidget.init",i=>{this._removeLoader();const s=i.detail.api,a=this._basketShippingListService.getSelectedShipping()?.pickupPoint?.code;a&&s.showPoint(a),s.addPointSelectedCallback(async o=>{this._selectPoint(o,e)})})})}),document.body.appendChild(t)}_selectPoint(e,t){const i=new re;t(i.inpostInternationalMapToModel(e)),this._closeModal()}async _initMap(){nt._isMapReady||(await this._createMapScript(),await this._createMapStylesheet(),nt._isMapReady=!0)}async _createMapScript(){return new Promise(e=>{const t=document.createElement("script");t.onload=function(){e()},t.onerror=()=>{this._flashMessengerApi.addFlashMessage({type:"error",content:this._translationApi.translate("An error occurred while loading the map. Please try again later.")})},t.async=!0,t.src=this._isSandbox?ra:aa,document.head.appendChild(t)})}async _createMapStylesheet(){return new Promise(e=>{const t=document.createElement("link");t.onload=function(){e()},t.rel="stylesheet",t.type="text/css",t.href=this._isSandbox?oa:na,document.head.appendChild(t)})}_createModal(){const e=document.createElement("aside");return e.innerHTML=` 22 <h-modal 23 class="modal-wrapper_inpost-map" 24 id="${Xt}" 25 opened 26 > 27 <h-modal-header> 28 <h2 class="font_semibold h2"> 29 ${this._translationApi.translate("Choose delivery point")} 30 </h2> 31 <h-modal-close class="btn btn_icon"> 32 <h-icon 33 icon-name="icon-x" 34 role="button" 35 size="xl" 36 clickable 37 ></h-icon> 38 </h-modal-close> 39 </h-modal-header> 40 41 <h-modal-body> 42 <div class="loader"> 43 <div class="loader__spinner loader__spinner_m"></div> 44 </div> 45 </h-modal-body> 46 </h-modal> 47 `,e}_createGeoWidgetWebComponent(){const e=document.createElement(ta);e.setAttribute("id",Jt),e.setAttribute("token",this._token),e.setAttribute("config",ea);const t=this._translationApi.selectedLanguage().split("_")[0],i=sa.includes(t)?t:fs;e.setAttribute("language",i);const s=this._basketShippingListService.getSelectedShippingCountry()?.country.isocode??ia;return e.setAttribute("country",s),e}_appendGeowidgetToModal(){const e=document.querySelector('h-portal-target[name="modals"] h-modal-body'),t=this._createGeoWidgetWebComponent();e?.appendChild(t)}_removeLoader(){const t=document.querySelector('h-portal-target[name="modals"] h-modal-body')?.querySelector(".loader");t&&t.remove()}_closeModal(){const e=document.querySelector(`#${Xt}`);e?.close().then(()=>{e?.parentElement?.remove()})}}class la{execute(){return nt}}const Zt="alsendo-modal";class rt{static{this._isMapReady=!1}constructor({basketShippingListService:e,pickupPointTypes:t,appId:i}){this._appId=i,this._pickupPointTypes=t,this._basketShippingListService=e}_getWidgetLanguage(){const e=["pl","en","ro","cz","sk"],t=(document.documentElement.lang||navigator.language).substring(0,2).toLowerCase();return e.includes(t)?t:"pl"}async showMap(e){await this._initMap();const t=this._createModal();t.addEventListener("opened",()=>{ie.nextTick(()=>{this._createAlsendoWidget(e),this._removeLoader()})}),t.addEventListener("close",()=>t.remove()),document.body.appendChild(t)}async _initMap(){rt._isMapReady||(await this._createMapScript(),await this._createMapStylesheet(),rt._isMapReady=!0)}async _createMapScript(){return new Promise(e=>{const t=document.createElement("script");t.onload=function(){e()},t.async=!0,t.src="https://map.alsendo.com/v8.7/main.js",document.head.appendChild(t)})}async _createMapStylesheet(){return new Promise(e=>{const t=document.createElement("link");t.onload=function(){e()},t.rel="stylesheet",t.type="text/css",t.href="https://map.alsendo.com/v8.7/main.css",document.head.appendChild(t)})}_createModal(){const e=document.createElement("aside");return e.innerHTML=` 48 <h-modal class="modal-wrapper_inpost-map" id="${Zt}" opened> 49 <h-modal-header> 50 <h2 class="font_semibold h2">Wybierz punkt</h2> 51 <h-modal-close class="btn btn_icon"> 52 <h-icon 53 icon-name="icon-x" 54 role="button" 55 size="xl" 56 clickable 57 ></h-icon> 58 </h-modal-close> 59 </h-modal-header> 60 61 <h-modal-body> 62 <div class="loader"> 63 <div class="loader__spinner loader__spinner_m"></div> 64 </div> 65 </h-modal-body> 66 </h-modal> 67 `,e}_createAlsendoWidget(e){const t=document.querySelector('h-portal-target[name="modals"] h-modal-body');let i={};const s=this._basketShippingListService.getSelectedShipping();if(s&&s.isPickupPointDelivery){const a=s.pickupPoint?.supplier.code;i={code:s.pickupPoint?.code,operator:a?this._remapOperatorNameForAlsendo(a):void 0}}BPWidget.init(t,{language:this._getWidgetLanguage(),callback:a=>{this._selectPoint(a,e),this._closeModal()},posType:"DELIVERY",codOnly:!1,countryCodes:this._basketShippingListService.getSelectedShippingCountry()?.country.isocode||"PL",operatorMarkers:!0,operators:this._remapOperatorNamesForAlsendo(this._pickupPointTypes).map(a=>({operator:a})),selectedPos:i,codeSearch:!0,changeFiltersPosition:!0})}_remapOperatorNameForAlsendo(e){return e==="DHL_PARCEL"?"DHL":e==="PWR"?"RUCH":e}_remapOperatorNameFromAlsendo(e){return e==="DHL"?"DHL_PARCEL":e==="RUCH"?"PWR":e}_remapOperatorNamesForAlsendo(e){return e.map(t=>this._remapOperatorNameForAlsendo(t))}_selectPoint(e,t){const i=new re;t(i.alsendoToModel({...e,operator:this._remapOperatorNameFromAlsendo(e.operator)}))}_removeLoader(){const t=document.querySelector('h-portal-target[name="modals"] h-modal-body')?.querySelector(".loader");t&&t.remove()}_closeModal(){const e=document.querySelector(`#${Zt}`);e?.close().then(()=>{e?.parentElement?.remove()})}}class ca{execute(){return rt}}const es={pocztaPolska:Ji,inpost:Xi,inpostV5:Zi,InPostInternational:la,ShoperShipment:ca},G={billingAddressModalOpened:"billingAddressModal.opened",shippingAddressModalOpened:"shippingAddressModal.opened",basketPreviewOpened:"basketPreview.opened",ssoShippingSetEvent:"basket.SSOShippingSetEvent",paymentChosenByUser:"basket.paymentChosenByUser",shippingChosenByUser:"basket.shippingChosenByUser",ssoAddressSetEvent:"basket.ssoAddressSetEvent"};class da extends pt{constructor(e){super(e,{eventName:G.shippingChosenByUser})}}class ha extends pt{constructor(e){super(e,{eventName:G.ssoAddressSetEvent})}}class pa extends O{#e;#t;#s;#a;#n;#r;#o;#i;#l;#c;#d;#h;constructor({basketShippingsListRepository:e,basketHttpApi:t,basketUpdaterApi:i,messageStorageApi:s,flashMessengerApi:a,translationsApi:o,basketOverallApi:c,templateHolder:h,settingsApi:_,storeFactoryApi:b}){super(),this.#e=e,this.#t=t,this.#s=i,this.#a=s,this.#n=a,this.#r=o,this.#o=c,this.#i=_,this.#l=b,this.#d=h,this.#c=new Ft,this._setupLocalStore(),this._setupEventListeners(),this._setupSubscriptions(),Object.defineProperty(window,"__esModule",{value:void 0})}_setupLocalStore(){this.#h=this.#l.getStore(ke),this.#h||(this.#h=this.#l.createStore("local",ke))}_setupEventListeners(){new q(this.#p,this.#a),this.eventBus.on("invalidSection.shipping",({body:e})=>{this.#e.setSectionValidation({isValid:!1,validationMessage:e||""})}),new da(()=>{this.#h?.set("shippingChosenByUser","1")}),new ha(({body:e})=>{e&&this._setShippingFromSSO(e)})}_setupSubscriptions(){this._setDefaultCountryIfNone()}async _setShippingFromSSO(e){const t=e.shippingChannels;if(this.#h?.get("shippingChosenByUser")==="1"){this.eventBus.emit(new m(G.ssoShippingSetEvent));return}if(t.length===0)return;const s=this._findFirstAvailableShippingFromSSO(t);if(s){s.isSelected||await this.setShipping(s);const a=t.find(o=>o.shippingId==s.id);if(a?.pickupPoint&&!s.pickupPoint){const o=new re;await this.setPickupPoint(s,o.toModel(a.pickupPoint))}}this.eventBus.emit(new m(G.ssoShippingSetEvent,e))}_findFirstAvailableShippingFromSSO(e){const t=this.get();return e.reduce((i,s)=>i||t.find(o=>s.shippingId==o.id)||void 0,void 0)}_setDefaultCountryIfNone(){this.selectSelectedShipping$().subscribe(async e=>{if(this.#i.isFeatureEnabled("dev_storefront_basket_set_default_country_fix")){if(!e)return;if(!this.getSelectedShippingCountry()){const i=this._getCountryIdBasedOnLocale(e)||this._getCountryIdFromFirstCountryInList(e);await this.setCountry(i)}}else!this.getSelectedShippingCountry()&&e&&await this.setCountry(e.countries[0].c
67ountry.id)})}_getCountryIdBasedOnLocale(e){const t=this.#i.getSkinSettings().locale.split("_")[1];return e.countries.find(i=>i.country.isocode===t)?.country.id}_getCountryIdFromFirstCountryInList(e){return e.countries[0].country.id}#p=({body:e})=>{const t=e?.shippings||[];this._setShippings(t)};_setShippings(e){this.#e.set(e)}get(){return this.#e.get()}select$(){return this.#e.select$().pipe(k((e,t)=>B(e,t)))}getSelectedShipping(){return this.get().find(e=>e.isSelected)}selectSelectedShipping$(){return this.select$().pipe(A(e=>e.find(t=>t.isSelected))).pipe(k((e,t)=>e?.id===t?.id&&e?.price.grossValue===t?.price.grossValue))}getSelectedShippingCountries(){return this.get().flatMap(e=>e.countries)}getSelectedShippingCountry(){return this.getSelectedShippingCountries().find(e=>e.isSelected)}selectSelectedShippingCountries$(){return this.select$().pipe(A(e=>e.flatMap(t=>t.countries)))}selectSelectedShippingCountry$(){return this.selectSelectedShippingCountries$().pipe(A(e=>e.find(t=>t.isSelected)))}async setShipping(e){try{const t=e.actions.selectShipping,{response:i}=this.#t.setShipping(t),{data:s}=await i;s.basket.invalidSections.shipping||this.#e.setSectionValidation({isValid:!0,validationMessage:""}),this.eventBus.emit(new m(S.setShipping)),this.#s.emitUpdateBasketEvent(s)}catch(t){this._handleUnexpectedError(t)}}async setPickupPoint(e,t){try{const i=e.actions.changePickupPoint,{response:s}=this.#t.changePickupPoint(i,t),{data:a}=await s;a.basket.invalidSections.shipping||this.#e.setSectionValidation({isValid:!0,validationMessage:""}),this.eventBus.emit(new m(S.setPickupPoint,t)),this.#s.emitUpdateBasketEvent(a)}catch(i){this._handleUnexpectedError(i)}}async setCountry(e){try{const t=this.#o.getActions().changeShippingCountry,{response:i}=this.#t.setCountry(t,e),{data:s}=await i;this.#s.emitUpdateBasketEvent(s)}catch(t){this._handleUnexpectedError(t)}}getPaymentCostForActiveShippingByPaymentId(e){return this.getSelectedShipping()?.payments.find(i=>i.id===e)?.cost}selectPaymentCostForActiveShippingByPaymentId$(e){return this.select$().pipe(A(()=>this.getSelectedShipping()?.payments.find(i=>i.id===e)?.cost))}isEveryAvailablePaymentFree(){return this.getSelectedShipping()?.payments.every(t=>t.cost.grossValue===0)||!1}selectIsEveryAvailablePaymentFree$(){return this.select$().pipe(A(()=>this.getSelectedShipping()?.payments.every(t=>t.cost.grossValue===0)||!0))}getSectionValidation(){return this.#e.getSectionValidation()}selectSectionValidation$(){return this.#e.selectSectionValidation$()}addMap(e,t){let i=e.shippingKey;if(i==="inpost"&&e.integrationData.token&&(i="inpostV5"),i==="parcelLocker"){const s=e.integrationData;s.mapStrategyKey&&(i=s.mapStrategyKey)}this.#c.has(`${i}_${e.id}`)||this.#c.add(`${i}_${e.id}`,new t)}_setMap(e){this.#c.setCurrent(e)}_createMap(){return this.#c.execute(null)}async showPickupPointMap(e){let t=e.shippingKey;if(t==="inpost"&&e.integrationData.token&&(t="inpostV5"),t==="parcelLocker"){const i=e.integrationData;i.mapStrategyKey&&(t=i.mapStrategyKey)}if(es[t]&&this.addMap(e,es[t]),this.#c.has(`${t}_${e.id}`)){this._setMap(`${t}_${e.id}`);const i=this._createMap();new i({basketShippingListService:this,translationsApi:this.#r,flashMessengerApi:this.#n,...e.integrationData}).showMap(a=>this.setPickupPoint(e,a),a=>{this.#n.addFlashMessage({type:"error",content:this.#r.translate(a)})})}}shouldDisplayRemainingBasketValueForFreeShippingMessage(e){return e.price.grossValue>0&&e.remainingBasketValueForFreeShipping!==null&&e.remainingBasketValueForFreeShipping.float>0}addShippingInfo(e,t){this.#d.addTemplate(String(e.id),t),this.eventBus.emit(new m(S.shippingInfoAdded))}getShippingInfo(e){return this.#d.getTemplate(String(e.id))}_handleUnexpectedError(e){console.error(e),this.#n.addFlashMessage({type:"error",content:this.#r.translate("An unexpected error occurred")}),this.eventBus.emit(new m(S.unexpectedError))}}class ua{#e;constructor(e){this.#e=e}get(){return this.#e.query(ce())}select$(){return this.#e.pipe(be())}set(e){this.#e.update(fe(e))}setSectionValidation(e){this.#e.update(y("isValid",e.isValid)),this.#e.update(y("validationMessage",e.validationMessage))}getSectionValidation(){return{isValid:this.#e.getValue().isValid,validationMessage:this.#e.getValue().validationMessage}}selectSectionValidation$(){return this.#e.pipe(C(e=>({isValid:e.isValid,validationMessage:e.validationMessage})))}}const ma=({storeName:n="BasketShippingsListStore"}={})=>U({name:n},ye(),K(Ee));class _a extends de{constructor({basketPaymentsListService:e}){super(),this.moduleName=Ie.api,this.#e=e}#e;get(){return this.#e.get()}select$(){return this.#e.select$()}getAvailable(){return this.#e.getAvailable()}selectAvailable$(){return this.#e.selectAvailable$()}setPayment(e){return this.#e.set(e)}setPaymentData(e,t){return this.#e.setPaymentData(e,t)}getSelectedPayment(){return this.#e.getSelectedPayment()}selectSelectedPayment$(){return this.#e.selectSelectedPayment$()}getActivePaymentCost(){return this.#e.getActivePaymentCost()}selectActivePaymentCost$(){return this.#e.selectActivePaymentCost$()}addPaymentChannelStrategy(e,t){this.#e.addPaymentChannelStrategy(e,t)}getPaymentChannelStrategy(e){return this.#e.getPaymentChannelStrategy(e)}getSectionValidation(){return this.#e.getSectionValidation()}selectSectionValidation$(){return this.#e.selectSectionValidation$()}addPaymentInfo(e,t){this.#e.addPaymentInfo(e,t)}getPaymentInfo(e){return this.#e.getPaymentInfo(e)}}const ga=({storeName:n="BasketPaymentsListStore"}={})=>U({name:n},ye(),K(Ee));class ya{#e;constructor(e){this.#e=e}get(){return this.#e.query(ce())}select$(){return this.#e.pipe(be())}set(e){this.#e.update(fe(e))}setSectionValidation(e){this.#e.update(y("isValid",e.isValid)),this.#e.update(y("validationMessage",e.validationMessage))}getSectionValidation(){return{isValid:this.#e.getValue().isValid,validationMessage:this.#e.getValue().validationMessage}}selectSectionValidation$(){return this.#e.pipe(C(e=>({isValid:e.isValid,validationMessage:e.validationMessage})))}}class te{constructor({settingsApi:e,basketOverallApi:t,basketOrderApi:i,basketAddressesApi:s,basketPaymentsService:a,pageManagerApi:o,eventBus:c,flashMessengerApi:h,translationsApi:_}
67){this._placeOrder=async()=>{const b=await this.basketOrderApi.order();b?.isPlaced&&(this.pageManagerApi.visit(b._links.showOrder.href),this.eventBus.emit(new m(S.orderPlaced)))},this.settingsApi=e,this.basketOverallApi=t,this.basketOrderApi=i,this.basketAddressesApi=s,this.basketPaymentsService=a,this.pageManagerApi=o,this.eventBus=c,this.flashMessengerApi=h,this.translationsApi=_}initialize(e){}isPaymentAvailable(){return!0}getPaymentAdditionalInfo(){return null}async getPaymentButton(){return r` 68 <button 69 class="btn btn_primary btn_full-width" 70 @click=${this._placeOrder} 71 tabindex="0" 72 aria-label="${l("Place order and pay, you will be redirected to the payment gateway.")}" 73 > 74 <h-icon 75 icon-name="icon-basket" 76 css-classes="btn__icon btn__icon_left" 77 aria-hidden="true" 78 ></h-icon> 79 80 ${l("Place order and pay")} 81 </button> 82 `}execute(){return{initialize:this.initialize.bind(this),isPaymentAvailable:this.isPaymentAvailable.bind(this),getPaymentButton:this.getPaymentButton.bind(this),getPaymentAdditionalInfo:this.getPaymentAdditionalInfo.bind(this)}}getLocale(){return this.translationsApi.selectedLanguage().split("_")[1].toLowerCase()}}class ba extends te{constructor(){super(...arguments),this.isInitialized=!1,this.isTestEnvironment=!1,this.baseRequest={apiVersion:2,apiVersionMinor:0,emailRequired:!0,shippingAddressParameters:{phoneNumberRequired:!0}},this.allowedCardNetworks=["MASTERCARD","VISA"],this.allowedCardAuthMethods=["PAN_ONLY"],this.baseCardPaymentMethod={type:"CARD",parameters:{allowedAuthMethods:this.allowedCardAuthMethods,allowedCardNetworks:this.allowedCardNetworks}},this.isReadyToPay=!1,this.isButtonAdded=!1,this._onGooglePaymentButtonClicked=async e=>{if(!this._validateSections()){e?.preventDefault(),e?.stopPropagation(),e?.stopImmediatePropagation();return}const t=await this._processPayment(),i=this.basketPaymentsService.getSelectedPayment();i&&t&&await this.basketPaymentsService.setPaymentData(i,t);const s=await this.basketOrderApi.order();s?.isPlaced&&(this.pageManagerApi.visit(s._links.showOrder.href),this.eventBus.emit(new m(S.orderPlaced)))}}async initialize(e){this.isInitialized||(this.isTestEnvironment=e.environment==="TEST",this.settings={authJwt:e.jwt,environment:e.environment,gateway:e.gateway,gatewayMerchantId:e.gateway_merchant_id,isEnabled:e.active,merchantId:e.merchant_id,merchantName:e.merchant_name,merchantOrigin:e.merchant_origin},this.tokenizationSpecification={type:"PAYMENT_GATEWAY",parameters:{gateway:this.settings.gateway,gatewayMerchantId:this.settings.gatewayMerchantId}},this.cardPaymentMethod=Object.assign({},this.baseCardPaymentMethod,{tokenizationSpecification:this.tokenizationSpecification}),await this._getGPayScript(),this.paymentsClient=new google.payments.api.PaymentsClient({environment:this.settings.environment}),this.paymentsClient.isReadyToPay(this._getGoogleIsReadyToPayRequest()).then(t=>{this.isReadyToPay=t.result,this.isReadyToPay&&this._prefetchGooglePaymentData(),this.isButtonAdded||this._addGooglePayButton()}).catch(function(t){console.error(t)}),this.isInitialized=!0)}_addGooglePayButton(){let e=this.settingsApi.getLocales().locale.split("_")[1];const t=this.paymentsClient.createButton({onClick:this._onGooglePaymentButtonClicked,buttonLocale:e.toLowerCase()});document.getElementById("gpay")?.appendChild(t),this.isButtonAdded=!0}_doesGooglePayButtonExist(){const e=document.getElementById("gpay");return e?e.children.length>0:!1}_removeGooglePayButton(){document.getElementById("gpay")?.firstElementChild?.remove()}async _getGPayScript(){return new Promise(e=>{const t=document.createElement("script");t.onload=function(){e()},t.async=!0,t.src="https://pay.google.com/gp/p/js/pay.js",document.head.appendChild(t)})}_getGoogleIsReadyToPayRequest(){return Object.assign({},this.baseRequest,{allowedPaymentMethods:[this.baseCardPaymentMethod]})}_getGooglePaymentDataRequest(){const e=Object.assign({},this.baseRequest);return e.allowedPaymentMethods=[this.cardPaymentMethod],e.shippingAddressRequired=!0,e.transactionInfo=this._getGoogleTransactionInfo(),e.merchantInfo={merchantId:this.settings.merchantId,merchantName:this.settings.merchantName,merchantOrigin:this.settings.merchantOrigin},this.isTestEnvironment||(e.merchantInfo.authJwt=this.settings.authJwt),e}async getPaymentButton(){return this._doesGooglePayButtonExist()||(this.isButtonAdded=!1),setTimeout(()=>{this.isReadyToPay&&!this.isButtonAdded&&this._addGooglePayButton()},100),r`<div aria-label="${l("Pay with Google Pay, opens payment window with Google account.")}">
83 <span 84 id="gpay" 85 class="gpay" 86 ></span> 87 </div>`}_validateSections(){let e=!0;for(const[t,i]of Object.entries(this.basketOverallApi.getInvalidSections()))this.eventBus.emit(new m(`invalidSection.${t}`,i)),e=!1;return e}_getGoogleTransactionInfo(){const e=this.settingsApi.isFeatureEnabled("dev_gift_cards")?this.basketOverallApi.getSumToPay():this.basketOverallApi.getSum();return{currencyCode:e.currency,totalPriceStatus:"FINAL",totalPrice:`${e.grossValue}`,totalPriceLabel:"Total",countryCode:this.settingsApi.getLocales().locale.split("_")[1]}}_prefetchGooglePaymentData(){const e=this._getGooglePaymentDataRequest();e.transactionInfo={totalPriceStatus:"NOT_CURRENTLY_KNOWN",currencyCode:this.settingsApi.getSkinSettings().currency},this.paymentsClient.prefetchPaymentData(e)}async _processPayment(){const e=this._getGooglePaymentDataRequest();e.transactionInfo=this._getGoogleTransactionInfo();try{return await this.paymentsClient.loadPaymentData(e)}catch(t){return console.error(t),null}}execute(){return{initialize:this.initialize.bind(this),isPaymentAvailable:this.isPaymentAvailable.bind(this),getPaymentButton:this.getPaymentButton.bind(this),getPaymentAdditionalInfo:this.getPaymentAdditionalInfo.bind(this)}}}class fa extends te{isPaymentAvailable(){return window.ApplePaySession||this.settingsApi.isFeatureEnabled("dev_payments_basket_apple_pay")}}const T={default:"default",googlePay:"onlinePayment:gpay",applePay:"onlinePayment:applePay",autopayDefault:"onlinePayment:default",autopayInstallments:"onlinePayment:installments",paypalec:"paypalec",paypal:"paypal",p24:"shoperP24",googlePayP24:"shoperP24:gpay",applePayP24:"shoperP24:applePay",goPayP24:"shoperP24:goPay",blik:"shoperP24:blik",blik0:"shoperP24:blik0",hubP24:"shoperP24:installmentsHub",installmentsP24:"shoperP24:installments",cardsP24:"shoperP24:cards",paypoP24:"shoperP24:paypo",p24Default:"shoperP24:default",stripeApplePay:"stripe:apple_pay",stripeGooglePay:"stripe:google_pay",stripeLink:"stripe:link",stripeCard:"stripe:card",zagiel:"zagiel",stripeDefault:"stripe:default",klarna:"klarna",payu:"platnosci.pl"};class ts extends te{async getPaymentButton(){const e=this.basketOverallApi.selectSum$().pipe(A(({grossValueFormatted:t})=>l("Pay {{ price }} with PayPal, proceeding to payment gateway.",{price:t})));return r` <div 88 @click=${async()=>{const t=await this.basketOrderApi.order();t?.isPlaced&&(this.pageManagerApi.visit(t._links.showOrder.href),this.eventBus.emit(new m(S.orderPlaced)))}} 89 aria-label="${$(e)}" 90 > 91 <img 92 src="${`https://www.paypalobjects.com/webstatic/en_AU/i/buttons/btn_paywith_primary_l.png?${Date.now()}`}" 93 alt="PayPal" 94 /> 95 <p class="p_xs color_main mt-xs-2"> 96 ${this.translationsApi.translate("You will be redirected to the {{ gatewayName }} payment gateway.",{gatewayName:"Paypal"})} 97 </p> 98 </div>`}}class Y extends te{isPaymentAvailable(){const e=this.basketOverallApi.getSum().currency;return this.settingsApi.isFeatureEnabled("p24_payment_hide_none_pln_payments")?e==="PLN":!0}getPaymentAdditionalInfo(){const e=document.createElement("template");return e.id="p24",e.innerHTML=` 99 <p class="p p_xs mt-xs-1"> 100 ${this.translationsApi.translate("By paying, you accept the {{ tosLinkStart }}Terms and Conditions of Service{{ tosLinkEnd }} and confirm that you have read the {{ ioLinkStart }}Information Obligation{{ ioLinkEnd }}.",{tosLinkStart:`<a 101 href="https://www.przelewy24.pl/regulamin" 102 target="_blank" 103 rel="noopener noreferrer" 104 class="link link_secondary" 105 >`,tosLinkEnd:"</a>",ioLinkStart:`<a 106 href="https://www.przelewy24.pl/obowiazek-informacyjny-rodo-platnicy" 107 target="_blank" 108 rel="noopener noreferrer" 109 class="link link_secondary" 110 >
110`,ioLinkEnd:"</a>",interpolation:{escapeValue:!1}})} 111 </p> 112 `,e}async getPaymentButton(){const e=await super.getPaymentButton();return r` 113 ${e} 114 <p class="p_xs color_main mt-xs-2"> 115 ${this.translationsApi.translate("You will be redirected to the {{ gatewayName }} payment gateway.",{gatewayName:"Przelewy24"})} 116 </p> 117 `}}class Sa{constructor({payWithBlikId:e,blikWaitForAcceptanceId:t,blikCodeId:i,payWithBlikButtonId:s}){this._blikInputAbortController=null,this.getConfirmButton=()=>document.querySelector(`#${this._payWithBlikButtonId}`),this._preventConsentModalFromClosingOnBackdropClick=a=>{a.stopImmediatePropagation()},this._preventConsentModalFromClosingOnEscape=a=>{a.key==="Escape"&&a.stopImmediatePropagation()},this._payWithBlikId=e,this._blikWaitForAcceptanceId=t,this._blikCodeId=i,this._payWithBlikButtonId=s}setFocusOnBlikInput(){setTimeout(()=>document.querySelector(`#${this._blikCodeId}`)?.focus(),50)}allowOnlyFilledBlikCode(){ie.nextTick(()=>{const e=document.querySelector(`#${this._blikCodeId}`);if(e){this._blikInputAbortController?.abort(),this._blikInputAbortController=new AbortController;const{signal:t}=this._blikInputAbortController;e.addEventListener("input",()=>{const i=this.getBlikCode(),s=this.getConfirmButton();i.length===6&&i.indexOf("_")===-1?(s?.removeAttribute("disabled"),s?.classList.add("btn_primary"),s?.classList.remove("btn_primary-disabled")):(s?.classList.remove("btn_primary"),s?.classList.add("btn_primary-disabled"),s?.setAttribute("disabled","true"))},{signal:t}),e.addEventListener("paste",i=>{const s=i.clipboardData;if(!s)return;const a=s.getData("text");if(!a)return;i.preventDefault();const o=a.replace(/\D/g,"").slice(0,6),c=`${o.slice(0,3)} ${o.slice(3)}`.trim();e.value=c,e.dispatchEvent(new Event("input",{bubbles:!0}))},{signal:t})}})}getBlikCode(){return document.querySelector(`#${this._blikCodeId}`).value.replace(/\s/g,"")}async showWaitingForAcceptanceModal(){const e=document.querySelector(`h-modal#${this._payWithBlikId}`),t=document.querySelector(`h-modal#${this._blikWaitForAcceptanceId}`);t&&e&&!t.opened&&(this._disableModalAbilityToClose(),await e.close(),await t.open())}_disableModalAbilityToClose(){document.addEventListener(Ve.clicked,this._preventConsentModalFromClosingOnBackdropClick),document.addEventListener("keydown",this._preventConsentModalFromClosingOnEscape)}}class Aa extends Y{async getPaymentButton(){const e=`pay-with-blik-${v()}`,t=`blik-wait-for-acceptance-${v()}`,i=`blik-code-${v()}`,s=`pay-with-blik-button-${v()}`,a=new Sa({payWithBlikId:e,blikWaitForAcceptanceId:t,blikCodeId:i,payWithBlikButtonId:s});return r`<div> 118 <h-modal-opener 119 @click="${o=>{this._validateSections()||(o.preventDefault(),o.stopPropagation(),o.stopImmediatePropagation())}}" 120 name="${e}" 121 > 122 <a class="btn btn_primary btn_full-width" aria-label="${l("Pay with BLIK, opens a window to enter BLIK code.")}"> 123 ${l("Pay with BLIK")} 124 </a> 125 </h-modal-opener> 126 127 <h-modal 128 class="modal_blik" 129 @opened=${()=>{a.setFocusOnBlikInput(),a.allowOnlyFilledBlikCode()}} 130 id="${e}" 131 hidden 132 > 133 <h-modal-header> 134 135 136 <h-modal-close 137 aria-label="${l("Close window")}" 138 class="btn btn_icon" 139 > 140 <h-icon 141 icon-name="icon-x" 142 role="button" 143 size="xl" 144 clickable 145 ></h-icon> 146 </h-modal-close> 147 </h-modal-header> 148 149 <h-modal-body> 150 <div class="grid blik-modal"> 151 <div class="grid__row grid__row_xs-hcenter"> 152 <div class="grid__col"> 153 <figure class="align_center full-width mb
153-xs-3"> 154 <img 155 src="https://static.przelewy24.pl/payment-form-logo/svg/154" 156 alt="Blik logo" 157 width="100" 158 /> 159 </figure> 160 161 <div class="full-width font_size-l font_semibold align_center mb-xs-2"> 162 <p class="p_no-margin">${l("Enter the 6-digit BLIK code")}</p> 163 <span class="font_size-xs color_secondary font_normal"> 164 ${l("Generate the code in your banking app")} 165 </span> 166 </div> 167 168 <div class="blik-modal__input-container"> 169 <figure> 170 <img 171 src="https://static.przelewy24.pl/payment-form-logo/svg/154" 172 alt="Blik logo" 173 width="60" 174 /> 175 </figure> 176 177 <h-control> 178 <h-control-content> 179 <h-control-element> 180 <h-input 181 class="blik-modal__input" 182 controlId="${i}" 183 controlName="${i}" 184 autocomplete="off" 185 > 186 <h-input-control 187 autocomplete="off" 188 mask="___ ___" 189 pattern="^(\\d{3})(\\s)(\\d{3})$" 190 valid-pattern="000 000" 191 ></h-input-control> 192 </h-input> 193 </h-control-element> 194 195 <control-errors></control-errors> 196 </h-control-content> 197 </h-control> 198 </div> 199 </div> 200 </div> 201 </div> 202 203 <div class="full-width"> 204 <button 205 @click=${async()=>{await this._processPayment(a)}} 206 class="btn btn_full-width btn_primary-disabled mb-xs-2" 207 id="${s}" 208 disabled 209 > 210 ${l("Confirm order and pay")} 211 </button> 212 <h-modal-close class="btn btn_full-width btn_secondary mb-xs-4">${l("Pay with another method")}</h-modal-close> 213 214 <hr 215 class="separator" 216 aria-hidden="true" 217 /> 218 <p class="font_size-xs color_secondary mb-xs-2"> 219 <h-icon 220 icon-name="icon-lock" 221 role="button" 222 size="s" 223 ></h-icon> 224 ${l("Payment processed via Przelewy24.")} 225 </p> 226 </div> 227 </h-modal-body> 228 </h-modal> 229 230 <h-modal 231 class="modal_blik" 232 id="${t}" 233 hidden 234 > 235 <h-modal-body> 236 <div class="grid blik-modal"> 237 <div class="grid__row grid__row_xs-hcenter"> 238 <div class="grid__col"> 239 <figure class="align_center full-width mb
239-xs-3 mt-xs-6"> 240 <img 241 src="https://static.przelewy24.pl/payment-form-logo/svg/154" 242 alt="Blik logo" 243 width="100" 244 /> 245 </figure> 246 247 <div class="full-width font_size-l font_semibold align_center"> 248 <p class="p_no-margin">${l("Confirm the BLIK payment in your banking app")}</p> 249 <span class="font_size-xs color_secondary font_normal"> 250 ${l("If you don't do this, the payment will not be processed.")} 251 </span> 252 </div> 253 254 <div class="grid mt-xs-4 mb-xs-4"> 255 <div class="grid__row grid__row_xs-hcenter"> 256 <div class="grid__col"> 257 <div class="loader"> 258 <div class="loader__spinner loader__spinner_l"></div> 259 </div> 260 </div> 261 </div> 262 </div> 263 </div> 264 </div> 265 </div> 266 267 <div class="full-width"> 268 <hr 269 class="separator" 270 aria-hidden="true" 271 /> 272 <p class="font_size-xs color_secondary mb-xs-2"> 273 <h-icon 274 icon-name="icon-lock" 275 role="button" 276 size="s" 277 ></h-icon> 278 ${l("Payment processed via Przelewy24.")} 279 </p> 280 </div> 281 </h-modal-body> 282 </h-modal> 283 </div>`}async _processPayment(e){try{this._disableConfirmButton(e),await this._setBlikCodeForPayment(e);const t=await this.basketOrderApi.order();t?.isPlaced&&this._checkForTransactionStatus(e,t)}catch(t){console.error(t),this.flashMessengerApi.addFlashMessage({type:"error",content:this.translationsApi.translate("Blik payment temporary unavailable. Please try again later or change payment method."),timeout:3e3})}}_disableConfirmButton(e){e.getConfirmButton()?.setAttribute("disabled","true")}async _setBlikCodeForPayment(e){const t=e.getBlikCode(),i=this.basketPaymentsService.getSelectedPayment();i&&t&&await this.basketPaymentsService.setPaymentData(i,{blikCode:t})}async _checkForTransactionStatus(e,t){await e.showWaitingForAcceptanceModal();const i=await fetch("/console/plugin/execute/plugin/ShoperP24-Transaction/act/transactionStatus",{method:"post",body:JSON.stringify({orderId:t.orderId})});if(t.isPlaced)if(i.status===200){const s=await i.json();s.status==="success"?(this._redirectToBasketDonePage(t._links.showOrder.href),this.eventBus.emit(new m(S.orderPlaced))):s.status==="pending"?setTimeout(()=>{this._checkForTransactionStatus(e,t)},1e3):(this._redirectToBasketDonePage(t._links.showOrder.href),this.eventBus.emit(new m(S.orderPlaced)))}else this._redirectToBasketDonePage(t._links.showOrder.href),this.eventBus.emit(new m(S.orderPlaced))}_redirectToBasketDonePage(e){this.pageManagerApi.visit(e)}_validateSections(){let e=!0;for(const[t,i]of Object.entries(this.basketOverallApi.getInvalidSections()))this.eventBus.emit(new m(`invalidSection.${t}`,i)),e=!1;return e}}class ot extends Y{static{this.INSTALLMENTS_HUB_MIN_AMOUNT=100}static{this.INSTALLMENTS_HUB_MAX_AMOUNT=5e4}getPaymentAdditionalInfo(){const e=super.getPaymentAdditionalInfo();return e.id="p24-hub",e.innerHTML=` 284 <p24-installments-modal mode="basket"> 285 <div slot="modal-opener"> 286 <button class="btn btn_outline" id="p24-installments-button"> 287 ${this.translationsApi.translate("Check the instalments")} 288 </button> 289 </div> 290 </p24-installments-modal> 291 ${e.innerHTML} 292 `,e}isPaymentAvailable(){const e=this.settingsApi.isFeatureEnabled("dev_gift_cards")?this.basketOverallApi.get
292SumToPay():this.basketOverallApi.getSum();return super.isPaymentAvailable()&&e.grossValue>=ot.INSTALLMENTS_HUB_MIN_AMOUNT&&e.grossValue<=ot.INSTALLMENTS_HUB_MAX_AMOUNT}}class va extends Y{}class ka extends Y{isPaymentAvailable(){return window.ApplePaySession||this.settingsApi.isFeatureEnabled("dev_payments_basket_p24_apple_pay")}}class $a extends Y{constructor(){super(...arguments),this.isInitialized=!1,this.isTestEnvironment=!1,this.baseRequest={apiVersion:2,apiVersionMinor:0,emailRequired:!0,shippingAddressParameters:{phoneNumberRequired:!0}},this.allowedCardNetworks=["MASTERCARD","VISA"],this.allowedCardAuthMethods=["PAN_ONLY"],this.baseCardPaymentMethod={type:"CARD",parameters:{allowedAuthMethods:this.allowedCardAuthMethods,allowedCardNetworks:this.allowedCardNetworks}},this.isReadyToPay=!1,this.isButtonAdded=!1,this._onGooglePaymentButtonClicked=async e=>{if(!this._validateSections()){e?.preventDefault(),e?.stopPropagation(),e?.stopImmediatePropagation();return}const t=await this._processPayment(),i=this.basketPaymentsService.getSelectedPayment();i&&t&&await this.basketPaymentsService.setPaymentData(i,t);const s=await this.basketOrderApi.order();s?.isPlaced&&(this.pageManagerApi.visit(s._links.showOrder.href),this.eventBus.emit(new m(S.orderPlaced)))}}async initialize(e){this.isInitialized||(this.isTestEnvironment=e.environment==="TEST",this.settings={authJwt:e.jwt,environment:e.environment,gateway:e.gateway,gatewayMerchantId:e.gateway_merchant_id,isEnabled:e.active,merchantId:e.merchant_id,merchantName:e.merchant_name,merchantOrigin:e.merchant_origin},this.tokenizationSpecification={type:"PAYMENT_GATEWAY",parameters:{gateway:this.settings.gateway,gatewayMerchantId:this.settings.gatewayMerchantId}},this.cardPaymentMethod=Object.assign({},this.baseCardPaymentMethod,{tokenizationSpecification:this.tokenizationSpecification}),await this._getGPayScript(),this.paymentsClient=new google.payments.api.PaymentsClient({environment:this.settings.environment}),this.paymentsClient.isReadyToPay(this._getGoogleIsReadyToPayRequest()).then(t=>{this.isReadyToPay=t.result,this.isReadyToPay&&this._prefetchGooglePaymentData(),this.isButtonAdded||this._addGooglePayButton()}).catch(function(t){console.error(t)}),this.isInitialized=!0)}_addGooglePayButton(){let e=this.settingsApi.getLocales().locale.split("_")[1];const t=this.paymentsClient.createButton({onClick:this._onGooglePaymentButtonClicked,buttonLocale:e.toLowerCase()});document.getElementById("gpay")?.appendChild(t),this.isButtonAdded=!0}_doesGooglePayButtonExist(){const e=document.getElementById("gpay");return e?e.children.length>0:!1}_removeGooglePayButton(){document.getElementById("gpay")?.firstElementChild?.remove()}async _getGPayScript(){return new Promise(e=>{const t=document.createElement("script");t.onload=function(){e()},t.async=!0,t.src="https://pay.google.com/gp/p/js/pay.js",document.head.appendChild(t)})}_getGoogleIsReadyToPayRequest(){return Object.assign({},this.baseRequest,{allowedPaymentMethods:[this.baseCardPaymentMethod]})}_getGooglePaymentDataRequest(){const e=Object.assign({},this.baseRequest);return e.allowedPaymentMethods=[this.cardPaymentMethod],e.shippingAddressRequired=!0,e.transactionInfo=this._getGoogleTransactionInfo(),e.merchantInfo={merchantId:this.settings.merchantId,merchantName:this.settings.merchantName,merchantOrigin:this.settings.merchantOrigin},this.isTestEnvironment||(e.merchantInfo.authJwt=this.settings.authJwt),e}async getPaymentButton(){return this._doesGooglePayButtonExist()||(this.isButtonAdded=!1),setTimeout(()=>{this.isReadyToPay&&!this.isButtonAdded&&this._addGooglePayButton()},100),r`<div aria-label="${l("Pay with Google Pay, opens payment window with Google account.")}"> 293 <span 294 id="gpay" 295 class="gpay" 296 ></span> 297 </div>`}_validateSections(){let e=!0;for(const[t,i]of Object.entries(this.basketOverallApi.getInvalidSections()))this.eventBus.emit(new m(`invalidSection.${t}`,i)),e=!1;return e}_getGoogleTransactionInfo(){const e=this.settingsApi.isFeatureEnabled("dev_gift_cards")?this.basketOverallApi.get
297SumToPay():this.basketOverallApi.getSum();return{currencyCode:e.currency,totalPriceStatus:"FINAL",totalPrice:`${e.grossValue}`,totalPriceLabel:"Total",countryCode:this.settingsApi.getLocales().locale.split("_")[1]}}_prefetchGooglePaymentData(){const e=this._getGooglePaymentDataRequest();e.transactionInfo={totalPriceStatus:"NOT_CURRENTLY_KNOWN",currencyCode:this.settingsApi.getSkinSettings().currency},this.paymentsClient.prefetchPaymentData(e)}async _processPayment(){const e=this._getGooglePaymentDataRequest();e.transactionInfo=this._getGoogleTransactionInfo();try{return await this.paymentsClient.loadPaymentData(e)}catch(t){return console.error(t),null}}isPaymentAvailable(){return this.settingsApi.isFeatureEnabled("dev_payments_p24_gopay_googlepay_in_all_currencies")?!0:super.isPaymentAvailable()}execute(){return{initialize:this.initialize.bind(this),isPaymentAvailable:this.isPaymentAvailable.bind(this),getPaymentButton:this.getPaymentButton.bind(this),getPaymentAdditionalInfo:this.getPaymentAdditionalInfo.bind(this)}}}class Se extends te{static{this.minimumAmount={USD:.5,AED:2,ARS:.5,AUD:.5,BRL:.5,CAD:.5,CHF:.5,COP:.5,CZK:15,DKK:2.5,EUR:.5,GBP:.3,HKD:4,HUF:175,IDR:.5,ILS:.5,INR:.5,JPY:50,KRW:50,MXN:10,MYR:2,NOK:3,NZD:.5,PHP:.5,PLN:2,RON:2,RUB:.5,SEK:3,SGD:.5,THB:10,ZAR:.5}}async getPaymentButton(){const e=await super.getPaymentButton();return r` 298 ${e} 299 <p class="p_xs color_main mt-xs-2"> 300 ${this.translationsApi.translate("You will be redirected to the {{ gatewayName }} payment gateway.",{gatewayName:"Stripe"})} 301 </p> 302 `}isPaymentAvailable(){const e=this.settingsApi.isFeatureEnabled("dev_gift_cards")?this.basketOverallApi.getSumToPay():this.basketOverallApi.getSum(),t=e.currency,i=Se.minimumAmount[t]||0;return super.isPaymentAvailable()&&e.grossValue>=i}}class Pa{map(e){return{address:{city:e.city,country:e.country??null,line1:e.street,line2:e.streetAdditional,postal_code:e.zipCode,state:e.state},email:e.email,name:`${e.firstName} ${e.lastName}`.trim(),phone:e.phone}}}class ut{constructor({connectedAccountId:e,publicKey:t,paymentMethods:i,locale:s}){this._stripeBillingDetailsMapper=new Pa,this.stripe=Stripe(t,{stripeAccount:e}),this.locale=s,this.paymentMethods=i}createStripeElements(e,t={enabled:!0},i=[]){this.elements=this.stripe.elements({locale:this.locale,mode:"payment",amount:Math.round(e.grossValue*100),currency:e.currency.toLowerCase(),automatic_payment_methods:t,payment_method_types:i})}mountCardElement(e){this.cardElement=this.elements.create("payment",{payment_method_types:["card"],paymentMethodOrder:["card"],wallets:{applePay:"never",googlePay:"never",link:"never"}}),this.cardElement.mount(`#${e}`)}getStripeElements(){return this.elements}updateStripeElements(e){!e.grossValue||!e.currency||this.elements.update({amount:Math.round(e.grossValue*100),currency:e.currency.toLowerCase()})}createExpressCheckoutElement(e,t){this.expressCheckout=this.elements.create("expressCheckout",{paymentMethods:this.paymentMethods}),this.expressCheckout.on("click",e),this.expressCheckout.on("confirm",t)}mountCheckoutExpressElement(e){const t=document.querySelector(`#${e}`);t&&this.expressCheckout.mount(t)}async createConfirmationToken(){return this.stripe.createConfirmationToken({elements:this.getStripeElements()})}async createConfirmationTokenWithDetails(e){const t=this._stripeBillingDetailsMapper.map(e);return this.stripe.createConfirmationToken({elements:this.getStripeElements(),params:{payment_method_data:{billing_details:t}}})}async submit(){return this.getStripeElements().submit()}async handleNextAction(e){return await this.stripe.handleNextAction({clientSecret:e})}}class Ca extends Se{constructor(){super(...arguments),this._isInitialized=!1}async initialize(e){this._settings={publicKey:e.publicKey,connectedAccountId:e.connectedAccountId},await ht.create("stripe-pay","https://js.stripe.com/v3/"),this._isInitialized=!0}_isReady(){return new Promise(e=>{this._isInitialized&&e();const t=setInterval(()=>{this._isInitialized&&(clearInterval(t),e())},100)})}_validateSections(){let e=!0;for(const[t,i]of Object.entries(this.basketOverallApi.getInvalidSections()))this.eventBus.emit(new m(`invalidSection.${t}`,i)),e=!1;return e}async getPaymentButton(){const e=`express-checkout-element-${v()}`;await this._isReady();const t=new ut({connectedAccountId:this._settings.connectedAccountId,publicKey:this._settings.publicKey,paymentMethods:{applePay:"always",googlePay:"never",link:"never",klarna:"never"},locale:this.getLocale()}),i=this.settingsApi.isFeatureEnabled("dev_gift_cards")?this.basketOverallApi.get
302SumToPay():this.basketOverallApi.getSum();return t.createStripeElements(i),t.createExpressCheckoutElement(async s=>{if(this.settingsApi.isFeatureEnabled("dev_gift_cards")){const a=this.basketOverallApi.getSumToPay();t.updateStripeElements(a)}this._validateSections()&&s.resolve()},async()=>{const{error:s}=await t.submit();if(s){this.flashMessengerApi.addFlashMessage({type:"error",content:s.message});return}const{error:a,confirmationToken:o}=await t.createConfirmationToken();if(a){this.flashMessengerApi.addFlashMessage({type:"error",content:a.message});return}const c=this.basketPaymentsService.getSelectedPayment();c&&await this.basketPaymentsService.setPaymentData(c,{confirmationTokenId:o.id});const h=await this.basketOrderApi.order();h?.isPlaced&&(this.pageManagerApi.visit(h._links.showOrder.href),this.eventBus.emit(new m(S.orderPlaced)))}),this.basketOverallApi.selectSum$().subscribe(s=>{t.updateStripeElements(s)}),ie.nextTick(()=>{t.mountCheckoutExpressElement(e)}),r`<div id="${e}" aria-label="${l("Pay with Apple Pay, opens Link payment window.")}"></div>`}isAppleDevice(){const t=navigator.userAgentData?.platform?.toLowerCase();if(t)return t.includes("mac");const i=navigator.userAgent.toLowerCase();return/iphone|ipad|ipod|macintosh|mac os/.test(i)}isPaymentAvailable(){return!/Firefox|FxiOS/i.test(navigator.userAgent)&&this.isAppleDevice()&&super.isPaymentAvailable()&&(window.ApplePaySession||this.settingsApi.isFeatureEnabled("dev_payments_basket_stripe_apple_pay"))}}class Ia extends Se{constructor(){super(...arguments),this._isInitialized=!1}async initialize(e){this._settings={publicKey:e.publicKey,connectedAccountId:e.connectedAccountId},await ht.create("stripe-pay","https://js.stripe.com/v3/"),this._isInitialized=!0}_isReady(){return new Promise(e=>{this._isInitialized&&e();const t=setInterval(()=>{this._isInitialized&&(clearInterval(t),e())},100)})}_validateSections(){let e=!0;for(const[t,i]of Object.entries(this.basketOverallApi.getInvalidSections()))this.eventBus.emit(new m(`invalidSection.${t}`,i)),e=!1;return e}async getPaymentButton(){const e=`express-checkout-element-${v()}`;await this._isReady();const t=new ut({connectedAccountId:this._settings.connectedAccountId,publicKey:this._settings.publicKey,paymentMethods:{applePay:"never",googlePay:"always",link:"never",klarna:"never"},locale:this.getLocale()}),i=this.settingsApi.isFeatureEnabled("dev_gift_cards")?this.basketOverallApi.getSumToPay():this.basketOverallApi.getSum();return t.createStripeElements(i),t.createExpressCheckoutElement(async s=>{if(this.settingsApi.isFeatureEnabled("dev_gift_cards")){const a=this.basketOverallApi.getSumToPay();t.updateStripeElements(a)}
302this._validateSections()&&s.resolve()},async()=>{const{error:s}=await t.submit();if(s){this.flashMessengerApi.addFlashMessage({type:"error",content:s.message});return}const{error:a,confirmationToken:o}=await t.createConfirmationToken();if(a){this.flashMessengerApi.addFlashMessage({type:"error",content:a.message});return}const c=this.basketPaymentsService.getSelectedPayment();c&&await this.basketPaymentsService.setPaymentData(c,{confirmationTokenId:o.id});const h=await this.basketOrderApi.order();h?.isPlaced&&(this.pageManagerApi.visit(h._links.showOrder.href),this.eventBus.emit(new m(S.orderPlaced)))}),this.basketOverallApi.selectSum$().subscribe(s=>{t.updateStripeElements(s)}),ie.nextTick(()=>{t.mountCheckoutExpressElement(e)}),r`<div id="${e}" aria-label="${l("Pay with Google Pay, opens payment window with Google account.")}"></div>`}}class wa extends Se{constructor(){super(...arguments),this._isInitialized=!1}async initialize(e){this._settings={publicKey:e.publicKey,connectedAccountId:e.connectedAccountId},await ht.create("stripe-pay","https://js.stripe.com/v3/"),this._isInitialized=!0}_isReady(){return new Promise(e=>{this._isInitialized&&e();const t=setInterval(()=>{this._isInitialized&&(clearInterval(t),e())},100)})}_validateSections(){let e=!0;for(const[t,i]of Object.entries(this.basketOverallApi.getInvalidSections()))this.eventBus.emit(new m(`invalidSection.${t}`,i)),e=!1;return e}async getPaymentButton(){const e=`express-checkout-element-${v()}`;await this._isReady();const t=new ut({connectedAccountId:this._settings.connectedAccountId,publicKey:this._settings.publicKey,paymentMethods:{applePay:"never",googlePay:"never",link:"auto",klarna:"never"},locale:this.getLocale()}),i=this.settingsApi.isFeatureEnabled("dev_gift_cards")?this.basketOverallApi.getSumToPay():this.basketOverallApi.getSum();return t.createStripeElements(i),t.createExpressCheckoutElement(async s=>{if(this.settingsApi.isFeatureEnabled("dev_gift_cards")){const a=this.basketOverallApi.getSumToPay();t.updateStripeElements(a)}
302this._validateSections()&&s.resolve()},async()=>{const{error:s}=await t.submit();if(s){this.flashMessengerApi.addFlashMessage({type:"error",content:s.message});return}const{error:a,confirmationToken:o}=await t.createConfirmationToken();if(a){this.flashMessengerApi.addFlashMessage({type:"error",content:a.message});return}const c=this.basketPaymentsService.getSelectedPayment();c&&await this.basketPaymentsService.setPaymentData(c,{confirmationTokenId:o.id});const h=await this.basketOrderApi.order();h?.isPlaced&&(this.pageManagerApi.visit(h._links.showOrder.href),this.eventBus.emit(new m(S.orderPlaced)))}),this.basketOverallApi.selectSum$().subscribe(s=>{t.updateStripeElements(s)}),ie.nextTick(()=>{t.mountCheckoutExpressElement(e)}),r`<div id="${e}" aria-label="${l("Pay with Link, opens Link payment window.")}"></div>`}}var et=(n=>(n.Success="success",n.Failed="failed",n.Pending="pending",n))(et||{});class Ea extends Se{constructor(){super(...arguments),this._initPromise=null,this.STRIPE_CARD_ELEMENT_ID="stripe-card-payment-widget",this.STRIPE_CONTAINER_TIMEOUT=1500,this.STRIPE_TRANSACTION_STATUS_CHECK_INTERVAL=1e3,this.STRIPE_TRANSACTION_STATUS_CHECK_MAX_ATTEMPTS=10,this._paymentButton=null}async initialize(e){return this._initPromise=(async()=>{this._settings={publicKey:e.publicKey,connectedAccountId:e.connectedAccountId,embeddedCardCheckoutEnabled:e.embeddedCardCheckoutEnabled&&this.settingsApi.isFeatureEnabled("dev_payments_basket_stripe_card_storefront")},await ht.create("stripe-pay","https://js.stripe.com/v3/"),this.stripeClient=new ut({connectedAccountId:this._settings.connectedAccountId,publicKey:this._settings.publicKey,paymentMethods:void 0,locale:this.getLocale()})})(),this._initPromise}async _isReady(){return this._initPromise&&await this._initPromise,new Promise((e,t)=>{const i=setTimeout(()=>{clearInterval(s),t()},this.STRIPE_CONTAINER_TIMEOUT),s=setInterval(()=>{document.getElementById(this.STRIPE_CARD_ELEMENT_ID)&&(clearInterval(s),clearTimeout(i),e())},100)})}_validateSections(){let e=!0;for(const[t,i]of Object.entries(this.basketOverallApi.getInvalidSections()))this.eventBus.emit(new m(`invalidSection.${t}`,i)),e=!1;return e}async _fetchTransactionStatus(e){return(await fetch("/console/plugin/execute/plugin/Stripe-Transaction/act/transactionStatus",{method:"post",body:JSON.stringify({orderId:e})})).json()}async _checkForNextStep(e,t){const i=await this._fetchTransactionStatus(e),s=i?.status??null;if(s===et.Success||s===et.Failed)return Promise.resolve();if(s===et.Pending)if(i?.["3dsRequired"]){const a=await this.stripeClient.handleNextAction(i.transactionClientSecret);return a?.error?Promise.reject(a.error):Promise.resolve()}else return await new Promise(a=>setTimeout(a,1e3)),t===0?Promise.reject(new Error("Transaction is still pending after maximum number of attempts")):this._checkForNextStep(e,t-1)}async _placeCardOrder(){const e=await this._validateSections();let t=null;if(!e)return;this._disableButton();const{error:i}=await this.stripeClient.submit();if(i){this.flashMessengerApi.addFlashMessage({type:"error",content:i.message}),this._enableButton();return}const s=document.querySelector("billing-address-form");s?t=await s.getFormValues():t=this.basketAddressesApi.getBillingAddress();const a=t?await this.stripeClient.createConfirmationTokenWithDetails(t):await this.stripeClient.createConfirmationToken();if(a.error){this.flashMessengerApi.addFlashMessage({type:"error",content:a.error.message}),this._enableButton();return}const o=this.basketPaymentsService.getSelectedPayment();o&&await this.basketPaymentsService.setPaymentData(o,{confirmationTokenId:a.confirmationToken.id});const c=await this.basketOrderApi.order();c?.isPlaced&&this._checkForNextStep(c.orderId,this.STRIPE_TRANSACTION_STATUS_CHECK_MAX_ATTEMPTS).catch(h=>{console.error("Transaction status check failed or timed out, proceeding with order placement",h)}).finally(()=>{this.eventBus.emit(new m(S.orderPlaced)),this.pageManagerApi.visit(c._links.showOrder.href)})}_disableButton(){this._paymentButton?.classList.remove("btn_primary"),this._paymentButton?.classList.add("btn_primary-disabled"),this._paymentButton?.setAttribute("disabled","true")}_enableButton(){this._paymentButton?.classList.remove("btn_primary-disabled"),this._paymentButton?.classList.add("btn_primary"),this._paymentButton?.removeAttribute("disabled")}getPaymentAdditionalInfo(){if(!this._settings.embeddedCardCheckoutEnabled)return null;const e=document.createElement("template"),t='By clicking "Confirm purchase", you confirm that you have read the {{linkServiceStart}}Stripe Service Agreement{{linkEnd}} and {{linkPrivacyStart}}Privacy Policy{{linkPrivacyEnd}} and you accept their provisions.';return e.id="stripe-card-payment-widget-container",e.innerHTML=` 303 <div class="mt-xs-2 mb-xs-2" id="${this.STRIPE_CARD_ELEMENT_ID}"></div> 304 ${this.translationsApi.translate(t,{linkServiceStart:'<a href="https://stripe.com/en-pl/legal" target="_blank" rel="nofollow noopener">',linkEnd:"</a>",linkPrivacyStart:'<a href="https://stripe.com/en-pl/privacy" target="_blank" rel="nofollow noopener">',linkPrivacyEnd:"</a>",interpolation:{escapeValue:!1}})} 305 `,e}async getPaymentButton(){const e=await super.getPaymentButton();if(!this._settings.embeddedCardCheckoutEnabled)return r`${e}`;try{await this._isReady()}catch{return r`${e}`}const t=this.settingsApi.isFeatureEnabled("dev_gift_cards")?this.basketOverallApi.get
305SumToPay():this.basketOverallApi.getSum();return this.stripeClient.createStripeElements(t,{enabled:!1},["card"]),this.stripeClient.mountCardElement(this.STRIPE_CARD_ELEMENT_ID),this.settingsApi.isFeatureEnabled("dev_gift_cards")?this.basketOverallApi.selectSumToPay$().subscribe(i=>{this.stripeClient.updateStripeElements(i)}):this.basketOverallApi.selectSum$().subscribe(i=>{this.stripeClient.updateStripeElements(i)}),r` 306 <button 307 class="btn btn_primary btn_full-width" 308 @click=${i=>{this._paymentButton=i.currentTarget,this._placeCardOrder()}} 309 tabindex="0" 310 aria-label="${l("Place order and pay, you will be redirected to the payment gateway.")}" 311 > 312 <h-icon 313 icon-name="icon-basket" 314 css-classes="btn__icon btn__icon_left" 315 aria-hidden="true" 316 ></h-icon> 317 ${l("Place order and pay")} 318 </button> 319 `}}class Ss extends te{async getPaymentButton(){const e=await super.getPaymentButton();return r` 320 ${e} 321 <p class="p_xs color_main mt-xs-2"> 322 ${this.translationsApi.translate("You will be redirected to the {{ gatewayName }} payment gateway.",{gatewayName:"Autopay"})} 323 </p> 324 `}}class lt extends Ss{static{this.INSTALLMENTS_MIN_AMOUNT=100}static{this.INSTALLMENTS_MAX_AMOUNT=15e3}isPaymentAvailable(){const e=this.settingsApi.isFeatureEnabled("dev_gift_cards")?this.basketOverallApi.getSumToPay():this.basketOverallApi.getSum();return super.isPaymentAvailable()&&e.grossValue>=lt.INSTALLMENTS_MIN_AMOUNT&&e.grossValue<=lt.INSTALLMENTS_MAX_AMOUNT}}class Ba extends te{async getPaymentButton(){const e=await super.getPaymentButton();return r` 325 ${e} 326 <p class="p_xs color_main mt-xs-2"> 327 ${this.translationsApi.translate("You will be redirected to the {{ gatewayName }} payment gateway.",{gatewayName:"Klarna"})} 328 </p> 329 `}}class xa extends te{async getPaymentButton(){const e=await super.getPaymentButton();return r` 330 ${e} 331 <p class="p_xs color_main mt-xs-2"> 332 ${this.translationsApi.translate("You will be redirected to the {{ gatewayName }} payment gateway.",{gatewayName:"PayU"})} 333 </p> 334 `}}class Ma extends Y{isPaymentAvailable(){return!0}}class ct extends Y{static{this.INSTALLMENTS_MIN_AMOUNT=300}static{this.INSTALLMENTS_MAX_AMOUNT=1e4}isPaymentAvailable(){const e=this.settingsApi.isFeatureEnabled("dev_gift_cards")?this.basketOverallApi.getSumToPay():this.basketOverallApi.getSum();return super.isPaymentAvailable()&&e.grossValue>=ct.INSTALLMENTS_MIN_AMOUNT&&e.grossValue<=ct.INSTALLMENTS_MAX_AMOUNT}}class dt extends Y{static{this.PAYPO_MIN_AMOUNT=10}static{this.PAYPO_MAX_AMOUNT=8e3}isPaymentAvailable(){const e=this.settingsApi.isFeatureEnabled("dev_gift_cards")?this.basketOverallApi.getSumToPay():this.basketOverallApi.getSum();return super.isPaymentAvailable()&&e.grossValue>=dt.PAYPO_MIN_AMOUNT&&e.grossValue<=dt.PAYPO_MAX_AMOUNT}}class Fa extends te{constructor(e){super(e)}initialize(e){this.integrationData=e}isIntegrationDataValid(e){const{shopVariation:t,shopId:i}=e;return!(t===void 0||i===void 0||typeof t!="string"||typeof i!="string")}getPaymentAdditionalInfo(){const e=document.createElement("template");e.id="zagiel-payment-additional-info";const t=this.integrationData?.shopVariation,i=this.integrationData?.shopId,s=this.settingsApi.isFeatureEnabled("dev_gift_cards")?this.basketOverallApi.getSumToPay():this.basketOverallApi.getSum();if(!this.settingsApi.isFeatureEnabled("payments_santander_installments_calculator")||!s.grossValue||!this.isIntegrationDataValid(this.integrationData))return null;const a=`https://wniosek.eraty.pl/symulator/oblicz/numerSklepu/${i}/wariantSklepu/${t}/typProduktu/0/wartoscTowarow/${encodeURIComponent(s.grossValue)}`,o=document.createElement("a");o.href=a,o.setAttribute("data-sum-href",a),o.target="_blank",o.rel="noopener noreferrer",o.title=this.translationsApi.translate("calculate the installment"),o.className="d-block mt-xs-1";const c=document.createElement("img");return c.className="mr-xs-1",c.src="https://dcsaascdn.net/storefront/img/payments/santander_installments_calculator_button.svg",c.alt=this.translationsApi.translate("calculate the installment"),o.appendChild(c),e.content.appendChild(o),e}}class Ta extends Y{isPaymentAvailable(){return this.settingsApi.isFeatureEnabled("dev_payments_p24_gopay_googlepay_in_all_currencies")?!0:super.isPaymentAvailable()}}const Oa={[T.default]:te,[T.googlePay]:ba,[T.applePay]:fa,[T.autopayDefault]:Ss,[T.autopayInstallments]:lt,[T.paypalec]:ts,[T.paypal]:ts,[T.googlePayP24]:$a,[T.goPayP24]:Ta,[T.applePayP24]:ka,[T.blik]:va,[T.blik0]:Aa,[T.hubP24]:ot,[T.cardsP24]:Ma,[T.paypoP24]:dt,[T.installmentsP24]:ct,[T.p24]:Y,[T.p24Default]:Y,[T.stripeApplePay]:Ca,[T.stripeGooglePay]:Ia,[T.stripeLink]:wa,[T.stripeCard]:Ea,[T.zagiel]:Fa,[T.stripeDefault]:Se,[T.klarna]:Ba,[T.payu]:xa};class La extends pt{constructor(e){super(e,{eventName:G.ssoShippingSetEvent})}}class Na extends pt{constructor(e){super(e,{eventName:G.paymentChosenByUser})}}class Va extends O{#e;#t;#s;#a;#n;#r;#o;#i;#l;#c;#d;#h;#p;#u;#m=new Ft;#_;constructor({basketPaymentsListRepository:e,basketHttpApi:t,basketUpdaterApi:i,messageStorageApi:s,basketShippingsApi:a,basketOverallApi:o,flashMessengerApi:c,translationsApi:h,settingsApi:_,basketOrderApi:b,basketAddressesApi:w,pageManagerApi:M,templateHolder:x,storeFactoryApi:N}){super(),this.#e=e,this.#t=t,this.#s=i,this.#a=s,this.#n=a,this.#r=o,this.#o=c,this.#i=h,this.#l=_,this.#c=b,this.#d=w,this.#h=M,this.#_=x,this.#p=N;for(const[se,Le]of Object.entries(Oa))this.addPaymentChannelStrategy(se,new Le({settingsApi:this.#l,basketOverallApi:this.#r,basketOrderApi:this.#c,basketAddressesApi:this.#d,basketPaymentsService:this,pageManagerApi:this.#h,eventBus:this.eventBus,flashMessengerApi:this.#o,translationsApi:this.#i}));this._setupLocalStore(),this._setupEventListeners(),this._setupPaymentChannel()}_setupLocalStore(){this.#u=this.#p.getStore(ke),this.#u||(this.#u=this.#p.createStore("local",ke))}_setupEventListeners(){new q(this.#g,this.#a),this.eventBus.on("invalidSection.payment",({body:e})=>{this.#e.setSectionValidation({isValid:!1,validationMessage:e||""})}),new Na(()=>{this.#u?.set("paymentChosenByUser","1")}),new La(({body:e})=>{e&&this._setPaymentFromSSO(e)})}_setupPaymentChannel(){this.selectSelectedPayment$().subscribe(e=>{if(!e)return;
334const t=this.getPaymentChannelStrategy(e.channelKey);t.initialize(e?.integrationData);const i=t.getPaymentAdditionalInfo();i&&this.addPaymentInfo(e,i)})}async _setPaymentFromSSO(e){if(this.#u?.get("shippingChosenByUser")==="1")return;const i=this.#l.isFeatureEnabled("dev_sso_default_payment_method_fix")?this._findFirstAvailablePaymentFromSSOFixed(e.paymentChannels):this._findFirstAvailablePaymentFromSSO(e.paymentChannels);i&&!i.isSelected&&await this.set(i)}_findFirstAvailablePaymentFromSSOFixed(e){const t=this.getAvailable();return e.reduce((i,s)=>{if(i)return i;let a=t.find(c=>s.channelId===c.channelKey);if(a)return a;const[,o]=s.channelId.split(":");return o&&(a=t.find(c=>c.id===`${s.paymentId}:${o}`),a)?a:(a=t.find(c=>c.paymentId===s.paymentId),a||void 0)},void 0)}_findFirstAvailablePaymentFromSSO(e){const t=this.getAvailable();return e.reduce((i,s)=>i||t.find(o=>s.channelId===o.channelKey)||void 0,void 0)}#g=({body:e})=>{const t=e?.payments||[];this._setPayments(t)};_setPayments(e){this.#e.set(e)}addPaymentChannelStrategy(e,t){this.#m.add(e,t)}getPaymentChannelStrategy(e="default"){return this.#m.has(e)?this.#m.setCurrent(e):this.#m.setCurrent(this._getDefaultChannelStrategy(e)),this.#m.execute()}_getDefaultChannelStrategy(e){return e.includes("stripe")?"stripe:default":e.includes("onlinePayment")?"onlinePayment:default":e.includes("shoperP24")?"shoperP24:default":"default"}get(){return this.#e.get().filter(e=>this.getPaymentChannelStrategy(e.channelKey).isPaymentAvailable())}select$(){return D([this.#e.select$(),this.#r.selectSumToPay$()]).pipe(k((e,t)=>B(e,t)),A(([e])=>e.filter(t=>this.getPaymentChannelStrategy(t.channelKey).isPaymentAvailable())))}getAvailable(){return this._filterAvailablePayments(this.get())}selectAvailable$(){return D([this.select$(),this.#n.selectSelectedShipping$()]).pipe(A(([e,t])=>{const i=t?.payments.flatMap(s=>s.id)||[];return e.filter(s=>i.includes(s.paymentId))}))}_filterAvailablePayments(e){const i=this.#n.getSelectedShipping()?.payments.flatMap(s=>s.id)||[];return e.filter(s=>i.includes(s.paymentId))}async set(e){try{const t=e.actions.selectChannel,{response:i}=this.#t.setPayment(t),{data:s}=await i;s.basket.invalidSections.payment||this.#e.setSectionValidation({isValid:!0,validationMessage:""}),this.eventBus.emit(new m(S.setPayment)),this.#s.emitUpdateBasketEvent(s)}catch(t){this._handleUnexpectedError(t)}}getSelectedPayment(){return this.get().find(e=>e.isSelected)}selectSelectedPayment$(){return this.select$().pipe(A(e=>e.find(t=>t.isSelected))).pipe(k((e,t)=>e?.id===t?.id))}getActivePaymentCost(){const e=this.#n.getSelectedShipping(),t=this.getSelectedPayment();return e?.payments.find(i=>i.id===t?.paymentId)?.cost}selectActivePaymentCost$(){return D([this.#n.selectSelectedShipping$(),this.selectSelectedPayment$()]).pipe(A(([e,t])=>e?.payments.find(i=>i.id===t?.paymentId)?.cost))}async setPaymentData(e,t){try{const{response:i}=this.#t.setPaymentData(e.actions.savePaymentData,t),{data:s}=await i;this.#s.emitUpdateBasketEvent(s)}catch(i){this._handleUnexpectedError(i)}}addPaymentInfo(e,t){this.#_.addTemplate(e.channelKey,t),this.eventBus.emit(new m(S.paymentInfoAdded))}getPaymentInfo(e){return this.#_.getTemplate(e.channelKey)}getSectionValidation(){return this.#e.getSectionValidation()}selectSectionValidation$(){return this.#e.selectSectionValidation$()}_handleUnexpectedError(e){console.error(e),this.#o.addFlashMessage({type:"error",content:this.#i.translate("An unexpected error occurred")}),this.eventBus.emit(new m(S.unexpectedError))}}const Ra=({storeName:n="BasketAddressesStore"}={})=>U({name:n},K({shippingAddress:null,paymentAddress:null,pickupPointData:null,...Ee}));class Da{#e;constructor(e){this.#e=e}getShippingAddress(){return this.#e.getValue().shippingAddress}selectShippingAddress$(){return this.#e.pipe(C(e=>e.shippingAddress))}getBillingAddress(){return this.#e.getValue().paymentAddress}selectBillingAddress$(){return this.#e.pipe(C(e=>e.paymentAddress))}setShippingAddress(e){this.#e.update(y("shippingAddress",t=>e===null?null:t?{...t,...e}:e))}setBillingAddress(e){this.#e.update(y("paymentAddress",t=>e===null?null:t?{...t,...e}:e))}setSectionValidation(e){this.#e.update(y("isValid",e.isValid)),this.#e.update(y("validationMessage",e.validationMessage))}getSectionValidation(){return{isValid:this.#e.getValue().isValid,validationMessage:this.#e.getValue().validationMessage}}selectSectionValidation$(){return this.#e.pipe(C(e=>({isValid:e.isValid,validationMessage:e.validationMessage})))}setPickupPointData(e){this.#e.update(y("pickupPointData",{zipCode:e}))}getPickupPointData(){return this.#e.getValue().pickupPointData}}var As;As=ls;const Ua=class vs{constructor({isCompany:e,companyName:t,firstName:i,lastName:s,phone:a,street:o,countryId:c,buildingNumber:h,apartmentNumber:_,email:b,state:w,city:M,taxId:x,postalCode:N}){this[As]=!0,this.isCompany=e,this.companyName=t,this.firstName=i,this.lastName=s,this.countryId=c,this.city=M,this.postalCode=N,this.buildingNumber=h,this.apartmentNumber=_,this.phone=a,this.taxI
334d=x,this.email=b,this.street=o,this.state=w}static create(e){return new vs(e)}};let Ga=Ua;class qa{toModel(e){return Ga.create(e)}toDTO(e){return{...e}}toBasketAddressDTO(e){return{email:e.email,isCompany:e.isCompany,companyName:e.companyName,firstName:e.firstName,lastName:e.lastName,personalIdNumber:"",taxId:e.taxId,countryId:Number(e.countryId),city:e.city,postalCode:e.postalCode,street:e.street,street2:`${e.buildingNumber} ${e.apartmentNumber}`.trim(),phone:e.phone,state:e.state,createUserAccount:!1}}}class za extends O{constructor({basketAddressesRepository:e,messageStorageApi:t,basketShippingsApi:i,basketHttpApi:s,basketUpdaterApi:a,flashMessengerApi:o,translationsApi:c,userApi:h,basketOverallApi:_,settingsApi:b}){super(),this.showBillingAddressCard$=new ve(!1),this.showShippigAddressCard$=new ve(!1),this.isCompany$=new ve(!1),this.#d=({body:w})=>{w&&(this._setBillingAddress(w.billingAddress),this._setShippingAddress(w.shippingAddress))},this.#e=e,this.#t=t,this.#s=i,this.#a=s,this.#n=a,this.#r=o,this.#o=c,this.#i=h,this.#l=_,this.#c=b,this._setupEventListeners()}#e;#t;#s;#a;#n;#r;#o;#i;#l;#c;_setupEventListeners(){new q(this.#d,this.#t),this.eventBus.on("invalidSection.shippingAddress",({body:e})=>{this.#e.setSectionValidation({isValid:!1,validationMessage:e||""})}),this.eventBus.on("invalidSection.billingAddress",({body:e})=>{this.#e.setSectionValidation({isValid:!1,validationMessage:e||""})}),this.eventBus.on(S.setPickupPoint,({body:e})=>{const t=this.getBillingAddress();!e||!t||!this.isDifferentShippingAddressRequired()||this.setShippingAddress({email:t.email,isCompany:t.isCompany===!0,companyName:t.companyName,firstName:t.firstName,lastName:t.lastName,personalIdNumber:t.personalId||"",taxId:t.taxId,countryId:this.#s.getSelectedShipping().countries[0].country.id,city:e.city,postalCode:e.postalCode,street:`${e.street} ${e.houseNumber}`,street2:"",phone:t.phone,state:"",useAsShippingAddress:!0,createUserAccount:!1})}),this._subscribeToUserAddressesChange(),this.selectBillingAddress$().pipe(A(e=>e?.isCompany===!0),k()).subscribe(e=>this.isCompany$.next(e)),D([this.#i.selectUser$(),this.selectBillingAddress$()]).pipe(k((e,t)=>B(e,t))).subscribe(async([e,t])=>{this.showBillingAddressCard$.next(!1),this.isAddressFilled(t)&&e&&this.showBillingAddressCard$.next(!0)}),D([this.#i.selectUser$(),this.selectShippingAddress$()]).pipe(k((e,t)=>B(e,t))).subscribe(async([e,t])=>{this.showShippigAddressCard$.next(!1),this.isAddressFilled(t)&&e&&this.showShippigAddressCard$.next(!0)})}#d;_subscribeToUserAddressesChange(){const e=this.#l.selectActions$().pipe(A(i=>i.changeBillingAddress),k((i,s)=>B(i,s))),t=this.#l.selectActions$().pipe(A(i=>i.changeShippingAddress),k((i,s)=>B(i,s)));D([this.#i.selectUser$(),e,t]).pipe(k((i,s)=>B(i,s))).subscribe(async([i,s,a])=>{if(!(!s||!a)&&i){if(this.#c.getSkinSettings().isShoperSSOActive==="1"){const o=!this.isAddressFilled(this.getBillingAddress()),c=!this.isAddressFilled(this.getShippingAddress()),_=await(await this.getApi(Js.api)).getCheckoutData();if(o||c){const b=new qa;if(_?.billingAddress){const w=b.toModel(_?.billingAddress);if(w&&o){const M={...b.toBasketAddressDTO(w),useAsShippingAddress:!1,createUserAccount:!1};await this.setBillingAddress(M)}}if(_?.shippingAddress){const w=b.toModel(_?.shippingAddress);if(w&&c){const M={...b.toBasketAddressDTO(w),useAsShippingAddress:!1,createUserAccount:!1};await this.setShippingAddress(M)}}}this.eventBus.emit(new m(G.ssoAddressSetEvent,_))}await this._setBillingAddressFromUserBillingAddressIfEmpty(i),await this._setShippingAddressFromUserShippingAddressIfEmpty(i)}})}async _setBillingAddressFromUserBillingAddressIfEmpty(e){if(!this.isAddressFilled(this.getBillingAddress())){const i=e?.addresses.billing?.address;if(i){let s=i?.countryId;if(!s){const a=this.#c.getCountries().find(o=>o.isocode===i?.country);s=Number(a?.id)}await this.setBillingAddress({email:e.email,isCompany:i.companyName!=="",companyName:i.companyName,firstName:i.firstName,lastName:i.lastName,personalIdNumber:"",taxId:i.taxId,countryId:Number(s),city:i.city,postalCode:i.zipCode,street:i.street,street2:"",ph
334one:i.phone,state:"",useAsShippingAddress:!1,createUserAccount:!1})}}}async _setShippingAddressFromUserShippingAddressIfEmpty(e){if(!this.isAddressFilled(this.getShippingAddress())){const i=e?.addresses.shipping?.address;if(i){let s=i?.countryId;if(!s){const a=this.#c.getCountries().find(o=>o.isocode===i?.country);s=Number(a?.id)}await this.setShippingAddress({email:e.email,isCompany:i.companyName!=="",companyName:i.companyName,firstName:i.firstName,lastName:i.lastName,personalIdNumber:"",taxId:i.taxId,countryId:Number(s),city:i.city,postalCode:i.zipCode,street:i.street,street2:"",phone:i.phone,state:"",useAsShippingAddress:!1,createUserAccount:!1})}}}_setShippingAddress(e){this.#e.setShippingAddress(e)}_setBillingAddress(e){this.#e.setBillingAddress(e)}getShippingAddress(){return this.#e.getShippingAddress()}selectShippingAddress$(){return this.#e.selectShippingAddress$().pipe(k((e,t)=>B(e,t)))}getBillingAddress(){return this.#e.getBillingAddress()}selectBillingAddress$(){return this.#e.selectBillingAddress$().pipe(k((e,t)=>B(e,t)))}async setBillingAddressAsShippingAddress(){const e=this.getBillingAddress();e&&this.setShippingAddress({email:e.email,isCompany:e.isCompany===!0,companyName:e.companyName,firstName:e.firstName,lastName:e.lastName,personalIdNumber:e.personalId||"",taxId:e.taxId,countryId:e.countryId,city:e.city,postalCode:e.zipCode,street:e.street,street2:e.streetAdditional,phone:e.phone,state:e.state,useAsShippingAddress:!0,createUserAccount:!1})}async setShippingAddress(e){const t=this.#l.getActions().changeShippingAddress;if(t)return this._setAddress(t,e)}async setBillingAddress(e){const t=this.#s.getAvailableShippingCountries().find(h=>h.id===e.countryId),i=this.isAddressFilled(this.getShippingAddress())&&!this.isBillingAddressEqualShippingAddress(),s=e.countryId!==this.getBillingAddress()?.countryId;let a=!1;this.#c.isFeatureEnabled("select_shipping_country_on_shipping_step")&&(a=e.countryId!==this.getShippingAddress()?.countryId),t&&!a&&(!i||s)&&(e.useAsShippingAddress=!0);const c=this.#l.getActions().changeBillingAddress;if(c)return this._setAddress(c,e)}async _setAddress(e,t){const{response:i}=this.#a.setAddress(e,t);try{const{data:s}=await i;return this.#n.emitUpdateBasketEvent(s),!s.basket.invalidSections.shippingAddress&&!s.basket.invalidSections.billingAddress&&!s.formErrors&&(this.#e.setSectionValidation({isValid:!0,validationMessage:""}),this._displaySetAddressSuccessFlashMessage()),s.formErrors}catch(s){this._handleUnexpectedError(s)}}isAddressFilled(e){return e?[e.city,e.countryId,e.firstName,e.lastName,e.phone,e.street,e.zipCode].every(i=>i):!1}isBillingAddressEqualShippingAddress(){return B(this.getBillingAddress(),this.get
334ShippingAddress())}selectIsBillingAddressEqualShippingAddress$(){return D([this.selectBillingAddress$(),this.selectShippingAddress$()]).pipe(A(([e,t])=>JSON.stringify(e)===JSON.stringify(t)))}isDifferentShippingAddressRequired(){const e=this.getBillingAddress();return e?!this.#s.getAvailableShippingCountries().map(t=>t.id).includes(e.countryId):!1}selectIsDifferentShippingAddressRequired$(){return D([this.selectBillingAddress$(),this.#s.selectAvailableShippingCountries$()]).pipe(A(([e,t])=>e?!t.map(i=>i.id).includes(e.countryId):!1))}getSectionValidation(){return this.#e.getSectionValidation()}selectSectionValidation$(){return this.#e.selectSectionValidation$()}selectIsDifferentShippingAddressAvailable$(){return D([this.#s.selectSelectedShipping$()]).pipe(A(([e])=>!(e?.isPickupPointDelivery||e?.isPersonalCollect)))}selectShowBillingAddressCard$(){return this.showBillingAddressCard$.asObservable().pipe(k())}selectShowShippingAddressCard$(){return this.showShippigAddressCard$.asObservable().pipe(k())}setIsCompany(e){this.isCompany$.next(e)}selectIsCompany$(){return this.isCompany$.asObservable().pipe(k())}_handleUnexpectedError(e){console.error(e),this.#r.addFlashMessage({type:"error",content:this.#o.translate("An unexpected error occurred")}),this.eventBus.emit(new m(S.unexpectedError))}_displaySetAddressSuccessFlashMessage(){this.#r.addFlashMessage({type:"success",content:this.#o.translate("Buyer's details have been added to the order information")})}setPickupPointData(e){this.#e.setPickupPointData(e)}getPickupPointData(){return this.#e.getPickupPointData()}}class Ha extends O{constructor({basketAddressesService:e}){super(),this.moduleName="basketAddressesApi",this.#e=e}#e;getShippingAddress(){return this.#e.getShippingAddress()}selectShippingAddress$(){return this.#e.selectShippingAddress$()}getBillingAddress(){return this.#e.getBillingAddress()}selectBillingAddress$(){return this.#e.selectBillingAddress$()}async setShippingAddress(e){return this.#e.setShippingAddress(e)}async setBillingAddress(e){return this.#e.setBillingAddress(e)}isBillingAddressEqualShippingAddress(){return this.#e.isBillingAddressEqualShippingAddress()}selectIsBillingAddressEqualShippingAddress$(){return this.#e.selectIsBillingAddressEqualShippingAddress$()}isDifferentShippingAddressRequired(){return this.#e.isDifferentShippingAddressRequired()}selectIsDifferentShippingAddressRequired$(){return this.#e.selectIsDifferentShippingAddressRequired$()}setBillingAddressAsShippingAddress(){return this.#e.setBillingAddressAsShippingAddress()}getSectionValidation(){return this.#e.getSectionValidation()}selectSectionValidation$(){return this.#e.selectSectionValidation$()}selectIsDifferentShippingAddressAvailable$(){return this.#e.selectIsDifferentShippingAddressAvailable$()}isAddressFilled(e){return this.#e.isAddressFilled(e)}selectShowBillingAddressCard$(){return this.#e.selectShowBillingAddressCard$()}selectShowShippingAddressCard$(){return this.#e.selectShowShippingAddressCard$()}setIsCompany(e){this.#e.setIsCompany(e)}selectIsCompany$(){return this.#e.selectIsCompany$()}setPickupPointData(e){this.#e.setPickupPointData(e)}getPickupPointData(){return this.#e.getPickupPointData()}}const Ka=({storeName:n="BasketAdditionalFieldsStore"}={})=>U({name:n},K({selectFields:[],descriptionFields:[],inputFields:[],fileFields:[],hiddenFields:[],checkboxFields:[],...Ee}));class Wa{#e;constructor(e){this.#e=e}get(){return{selectFields:this.#e.getValue().selectFields,descriptionFields:this.#e.getValue().descriptionFields,inputFields:this.#e.getValue().inputFields,fileFields:this.#e.getValue().fileFields,hiddenFields:this.#e.getValue().hiddenFields,checkboxFields:this.#e.getValue().checkboxFields}}select$(){return this.#e.pipe(C(e=>({selectFields:e.selectFields,descriptionFields:e.descriptionFields,inputFields:e.inputFields,fileFields:e.fileFields,hiddenFields:e.hiddenFields,checkboxFields:e.checkboxFields})))}set(e){this.#e.update(y("selectFields",e.selectFields)),this.#e.update(y("descriptionFields",e.descriptionFields)),this.#e.update(y("inputFields",e.inputFields)),this.#e.update(y("fileFields",e.fileFields)),this.#e.update(y("hiddenFields",e.hiddenFields)),this.#e.update(y("checkboxFields",e.checkboxFields))}setSectionValidation(e){this.#e.update(y("isValid",e.isValid)),this.#e.update(y("validationMessage",e.validationMessage))}getSectionValidation(){return{isValid:this.#e.getValue().isValid,validationMessage:this.#e.getValue().validationMessage}}selectSectionValidation$(){return this.#e.pipe(C(e=>({isValid:e.isValid,validationMessage:e.validationMessage})))}}class ja extends O{#e;#t;#s;#a;#n;constructor({basketAdditionalFieldsRepository:e,messageStorageApi:t,basketOverallApi:i,basketHttpApi:s,basketUpdaterApi:a}){super(),this.#e=e,this.#t=t,this.#s=i,this.#a=s,this.#n=a,this._setupEventListeners()}_setupEventListeners(){new q(this.#r,this.#t),this.eventBus.on("invalidSection.additionalFields",({body:e})=>{this.#e.setSectionValidation({isValid:!1,validationMessage:e||""})})}#r=({body:e})=>{const t=e?.additionalFields;t&&this._setAdditionalFields(t)};_setAdditionalFields(e){this.#e.set(e)}#o(e){const t=this.get(),i=t.selectFields.find(c=>c.id===e);if(i)return i.options.find(h=>h.isSelected)?.value||null;const s=t.checkboxFields.find(c=>c.id===e);if(s)return s.isChecked?"1":"0";const a=t.inputFields.find(c=>c.id===e);if(a)return a.value||null;const o=t.hiddenFields.find(c=>c.id===e);return o&&o.value||null}get(){return this.#e.get()}select$(){return this.#e.select$().pipe(k((e,t)=>B(e,t)))}async change(e,t){const i=this.#o(e);if(t===i)return;const s=this.#s.getActions().changeAdditionalFields,{response:a}=this.#a.changeAdditionalField(s,e,t);try{const{data:o}=await a;return this.#n.emitUpdateBasketEvent(o),o.basket.invalidSections.additionalFields||this.#e.setSectionValidation({isValid:!0,validationMessage:""}),o.formErrors}catch(o){console.error(o)}}async upload(e,t){try{const{response:i}=this.#a.uploadAdditionalFieldFile(e.actions.upload,t),{data:s}=await i;return s}catch(i){return console.error(i),null}}getSectionValidation(){return this.#e.getSectionValidation()}selectSectionValidation$(){return this.#e.selectSectionValidation$()}}class Qa extends O{constructor({basketAdditionalFieldsService:e}){super(),this.moduleName=cs.api,this.#e=e}#e;get(){return this.#e.get()}select$(){return this.#e.select$()}change(e,t){return this.#e.change(e,t)}upload(e,t){return this.#e.upload(e,t)}getSectionValidation(){return this.#e.getSectionValidation()}selectSectionValidation$(){return this.#e.selectSectionValidation$()}}const Ya=({storeName:n="BasketOverallStore"}={})=>{const e=new ui,t=new Ot,i=e.toModel({name:"",duration:{valueFormatted:"",timeInSeconds:0,timeInHours:0,timeInDays:0}}),s=t.toModel({currency:"",grossValue:0,grossValueFormatted:"",netValue:0,netValueFormatted:"",taxValue:0,taxValueFormatted:"",tax:0,taxFormatted:""}),a=t.toModel({currency:"",grossValue:0,grossValueFormatted:"",netValue:0,netValueFormatted:"",taxValue:0,taxValueFormatted:"",tax:0,taxFormatted:""}),o=t.toModel({currency:"",grossValue:0,grossValueFormatted:"",netValue:0,netValueFormatted:"",taxValue:0,taxValueFormatted:"",tax:0,taxFormatted:""});return U({name:n},K({actions:{},id:"",comment:"",isVatEu:!1,delivery:i,sum:s,sumWithoutPaymentAndShipping:a,sumToPay:o,state:ue.empty,invalidSections:{},...Ee}))};class Ja{#e;constructor(e){this.#e=e}setActions(e){this.#e.update(y("actions",e))}getActions(){return this.#e.getValue().actions}selectActions$(){return this.#e.pipe(C(e=>e.actions))}setId(e){this.#e.update(y("id",e))}getId(){return this.#e.getValue().id}selectId$(){return this.#e.pipe(C(e=>e.id))}setComment(e){this.#e.update(y("comment",e))}getComment(){return this.#e.getValue().comment}selectComment$(){return this.#e.pipe(C(e=>e.comment))}setIsVatEu(e){this.#e.update(y("isVatEu",e))}getIsVatEu(){return this.#e.getValue().isVatEu}selectIsVatEu$(){return this.#e.pipe(C(e=>e.isVatEu))}setDelivery(e){this.#e.update(y("delivery",e))}getDelivery(){return this.#e.getValue().delivery}selectDelivery$(){return this.#e.pipe(C(e=>e.delivery))}setSum(e){this.#e.update(y("sum",e))}getSum(){return this.#e.getValue().sum}selectSum$(){return this.#e.pipe(C(e=>e.sum))}setSumWithoutPaymentAndShipping(e){this.#e.update(y("sumWithoutPaymentAndShipping",e))}getSumWithoutPaymentAndShipping(){return this.#e.getValue().sumWithoutPaymentAndShipping}selectSumWithoutPaymentAndShipping$(){return this.#e.pipe(C(e=>e.sumWithoutPaymentAndShipping))}setSumToPay(e){this.#e.update(y("sumToPay",e))}getSumToPay(){return this.#e.getValue().sumToPay}selectSumToPay$(){return this.#e.pipe(C(e=>e.sumToPay))}setInvalidSections(e){this.#e.update(y("invalidSections",e))}getInvalidSections(){return this.#e.getValue().invalidSections}selectInvalidSections$(){return this.#e.pipe(C(e=>e.invalidSections))}setSectionValidation(e){this.#e.update(y("isValid",e.isValid)),this.#e.update(y("validationMessage",e.validationMessage))}getSectionValidation(){return{isValid:this.#e.getValue().isValid,validationMessage:this.#e.getValue().validationMessage}}selectSectionValidation$(){return this.#e.pipe(C(e=>({isValid:e.isValid,validationMessage:e.validationMessage})))}setState(e){this.#e.update(y("state",e))}getState(){return this.#e.getValue().state}selectState$(){return this.#e.pipe(C(e=>e.state))}}class Xa extends O{#e;#t;#s;#a;#n;#r;constructor({basketHttpApi:e,basketUpdaterApi:t,basketOverallRepository:i,messageStorageApi:s,flashMessengerApi:a,translationsApi:o}){super(),this.#e=i,this.#s=e,this.#a=t,this.#t=s,this.#n=a,this.#r=o,this._setupEventListeners()}_setupEventListeners(){new q(this.#o,this.#t),this.eventBus.on("invalidSection.sum",({body:e})=>{this.#e.setSectionValidation({isValid:!1,validationMessage:e||""})}),this.eventBus.on(S.changeState,({body:e})=>{e&&this.#e.setState(e)}),this.#e.selectState$().subscribe(e=>{e===ue.longProcessing&&document.querySelectorAll(".basket-module").forEach(t=>t.classList.add("basket-module_processing")),e===ue.idle&&document.querySelectorAll(".basket-module").forEach(t=>t.classList.remove("basket-module_processing"))})}#o=({body:e})=>{e?.actions&&this._setActions(e.actions),e?.id&&this._setId(e.id),e?.comment!==void 0&&this._setComment(e.comment),e?.isVatEu!==void 0&&this._setIsVatEu(e.isVatEu),e?.delivery&&this._setDelivery(e.delivery),e?.sum&&this._setSum(e.sum),e?.sumWithoutPaymentAndShipping&&this._setSumWithoutPaymentAndShipping(e.sumWithoutPaymentAndShipping),e?.sumToPay&&this._setSumToPay(e.sumToPay),e?.invali
334dSections&&this._setInvalidSections(e.invalidSections),e?.invalidSections.sum||this.#e.setSectionValidation({isValid:!0,validationMessage:""})};_setActions(e){this.#e.setActions(e)}getActions(){return this.#e.getActions()}selectActions$(){return this.#e.selectActions$()}_setId(e){this.#e.setId(e)}getId(){return this.#e.getId()}selectId$(){return this.#e.selectId$()}_setComment(e){this.#e.setComment(e)}getComment(){return this.#e.getComment()}selectComment$(){return this.#e.selectComment$()}_setIsVatEu(e){this.#e.setIsVatEu(e)}getIsVatEu(){return this.#e.getIsVatEu()}selectIsVatEu$(){return this.#e.selectIsVatEu$()}_setDelivery(e){this.#e.setDelivery(e)}getDelivery(){return this.#e.getDelivery()}selectDelivery$(){return this.#e.selectDelivery$().pipe(k((e,t)=>B(e,t)))}_setSum(e){this.#e.setSum(e)}getSum(){return this.#e.getSum()}selectSum$(){return this.#e.selectSum$().pipe(k((e,t)=>B(e,t)))}_setSumWithoutPaymentAndShipping(e){this.#e.setSumWithoutPaymentAndShipping(e)}getSumWithoutPaymentAndShipping(){return this.#e.getSumWithoutPaymentAndShipping()}selectSumWithoutPaymentAndShipping$(){return this.#e.selectSumWithoutPaymentAndShipping$().pipe(k((e,t)=>B(e,t)))}_setSumToPay(e){this.#e.setSumToPay(e)}getSumToPay(){return this.#e.getSumToPay()}selectSumToPay$(){return this.#e.selectSumToPay$().pipe(k((e,t)=>B(e,t)))}async setComment(e){const t=this.getActions().changeComment,{response:i}=this.#s.setComment(t,e);try{const{data:s}=await i;this.#a.emitUpdateBasketEvent(s)}catch(s){this._handleUnexpectedError(s)}}async cleanBasket(){const e=this.getActions().clean,{response:t}=this.#s.cleanBasket(e);try{const{data:i}=await t;this.#a.emitUpdateBasketEvent(i)}catch(i){this._handleUnexpectedError(i)}}_setInvalidSections(e){this.#e.setInvalidSections(e)}getInvalidSections(){return this.#e.getInvalidSections()}selectInvalidSections$(){return this.#e.selectInvalidSections$().pipe(k((e,t)=>B(e,t)))}getSectionValidation(){return this.#e.getSectionValidation()}selectSectionValidation$(){return this.#e.selectSectionValidation$()}_handleUnexpectedError(e){console.error(e),this.#n.addFlashMessage({type:"error",content:this.#r.translate("An unexpected error occurred")}),this.eventBus.emit(new m(S.unexpectedError))}}class Za extends de{constructor({basketOverallService:e}){super(),this.moduleName=H.api,this.#e=e}#e;getActions(){return this.#e.getActions()}selectActions$(){return this.#e.selectActions$()}getId(){return this.#e.getId()}selectId$(){return this.#e.selectId$()}getComment(){return this.#e.getComment()}selectComment$(){return this.#e.selectComment$()}getIsVatEu(){return this.#e.getIsVatEu()}selectIsVatEu$(){return this.#e.selectIsVatEu$()}getDelivery(){return this.#e.getDelivery()}selectDelivery$(){return this.#e.selectDelivery$()}getSum(){return this.#e.getSum()}selectSum$(){return this.#e.selectSum$()}getSumWithoutPaymentAndShipping(){return this.#e.getSumWithoutPaymentAndShipping()}selectSumWithoutPaymentAndShipping$(){return this.#e.selectSumWithoutPaymentAndShipping$()}getSumToPay(){return this.#e.getSumToPay()}selectSumToPay$(){return this.#e.selectSumToPay$()}async cleanBasket(){return this.#e.cleanBasket()}async setComment(e){return this.#e.setComment(e)}getInvalidSections(){return this.#e.getInvalidSections()}selectInvalidSections$(){return this.#e.selectInvalidSections$()}getSectionValidation(){return this.#e.getSectionValidation()}selectSectionValidation$(){return this.#e.selectSectionValidation$()}}class en extends O{constructor({basketTaxesSummaryService:e,basketTaxesListService:t}){super(),this.moduleName="basketTaxesApi",this.#e=e,this.#t=t}#e;#t;get(){return this.#t.get()}select$(){return this.#t.select$()}getSum(){return this.#e.getSum()}selectSum$(){return this.#e.selectSum$()}}const tn=({storeName:n="BasketTaxesSummaryStore"}={})=>{const e=new $i().toModel({text:"",float:0});return U({name:n},K({sum:e}))};class sn extends O{#e;#t;constructor({basketTaxesSummaryRepository:e,messageStorageApi:t}){super(),this.#e=e,this.#t=t,this._setupEventListeners()}_setupEventListeners(){new q(this.#s,this.#t)}#s=({body:e})=>{const t=e?.taxes.sum;t&&this._setSum(t)};_setSum(e){this.#e.setSum(e)}getSum(){return this.#e.getSum()}selectSum$(){return this.#e.selectSum$().pipe(k((e,t)=>B(e,t)))}}class an{#e;constructor(e){this.#e=e}getSum(){return this.#e.getValue().sum}selectSum$(){return this.#e.pipe(C(e=>e.sum))}setSum(e){this.#e.update(y("sum",e))}}class nn extends O{#e;#t;constructor({basketTaxesListRepository:e,messageStorageApi:t}){super(),this.#e=e,this.#t=t,this._setupEventListeners()}_setupEventListeners(){new q(this.#s,this.#t)}#s=({body:e})=>{const t=e?.taxes.list||[];this._setTaxes(t)};_setTaxes(e){this.#e.set(e)}get(){return this.#e.get()}select$(){return this.#e.select$().pipe(k((e,t)=>B(e,t)))}}const rn=({storeName:n="BasketTaxesListStore"}={})=>U({name:n},ye());class on{#e;constructor(e){this.#e=e}get(){return this.#e.query(ce())}select$(){return this.#e.pipe(be())}set(e){this.#e.update(fe(e))}}class ln extends O{constructor({basketLoyaltyService:e}){super(),this.moduleName="basketLoyaltyApi",this.#e=e}#e;getLoyaltyPointsAwarded(){return this.#e.getLoyaltyPointsAwarded()}selectLoyaltyPointsAwarded$(){return this.#e.selectLoyaltyPointsAwarded$()}getHasItemsPaidInLoyaltyPoints(){return this.#e.getHasItemsPaidInLoyaltyPoints()}selectHasItemsPaidInLoyaltyPoints$(){return this.#e.selectHasItemsPaidInLoyaltyPoints$()}getLoyaltyPointsCost(){return this.#e.getLoyaltyPointsCost()}selectLoyaltyPointsCost$(){return this.#e.selectLoyaltyPointsCost$()}getLoyaltyPointsExchangePrice(){return this.#e.getLoyaltyPointsExchangePrice()}selectLoyaltyPointsExchangePrice$(){return this.#e.selectLoyaltyPointsExchangePrice$()}}const cn=({storeName:n="BasketLoyaltyStore"}={})=>U({name:n},K({loyaltyPointsAwarded:null,hasItemsPaidInLoyaltyPoints:!1,loyaltyPointsCost:null,loyaltyPointsExchangePrice:null}));class dn{#e;constructor(e){this.#e=e}setLoyaltyPointsAwarded(e){this.#e.update(y("loyaltyPointsAwarded",e))}getLoyaltyPointsAwarded(){return this.#e.getValue().loyaltyPointsAwarded}selectLoyaltyPointsAwarded$(){return this.#e.pipe(C(e=>e.loyaltyPointsAwarded))}setHasItemsPaidInLoyaltyPoints(e){this.#e.update(y("hasItemsPaidInLoyaltyPoints",e))}getHasItemsPaidInLoyaltyPoints(){return this.#e.getValue().hasItemsPaidInLoyaltyPoints}selectHasItemsPaidInLoyaltyPoints$(){return this.#e.pipe(C(e=>e.hasItemsPaidInLoyaltyPoints))}setLoyaltyPointsCost(e){this.#e.update(y("loyaltyPointsCost",e))}getLoyaltyPointsCost(){return this.#e.getValue().loyaltyPointsCost}selectLoyaltyPointsCost$(){return this.#e.pipe(C(e=>e.loyaltyPointsCost))}setLoyaltyPointsExchangePrice(e){this.#e.update(y("loyaltyPointsExchangePrice",e))}getLoyaltyPointsExchangePrice(){return this.#e.getValue().loyaltyPointsExchangePrice}selectLoyaltyPointsExchangePrice$(){return this.#e.pipe(C(e=>e.loyaltyPointsExchangePrice))}}class hn extends O{#e;#t;constructor({basketLoyaltyRepository:e,messageStorageApi:t}){super(),this.#e=e,this.#t=t,this._setupEventListeners()}_setupEventListeners(){new q(this.#s,this.#t)}#s=({body:e})=>{e&&(this._setLoyaltyPointsAwarded(e.loyaltyPointsAwarded),this._setHasItemsPaidInLoyaltyPoints(e.hasItemsExchangedWithLoyaltyPoints),this._setLoyaltyPointsCost(e.loyaltyPointsCost),this._setLoyaltyPointsExchangePrice(e.loyaltyPointsExchangePrice))};_setLoyaltyPointsAwarded(e){this.#e.setLoyaltyPointsAwarded(e)}getLoyaltyPointsAwarded(){return this.#e.getLoyaltyPointsAwarded()}selectLoyaltyPointsAwarded$(){return this.#e.selectLoyaltyPointsAwarded$().pipe(k((e,t)=>B(e,t)))}_setHasItemsPaidInLoyaltyPoints(e){this.#e.setHasItemsPaidInLoyaltyPoints(e)}getHasItemsPaidInLoyaltyPoints(){return this.#e.getHasItemsPaidInLoyaltyPoints()}selectHasItemsPaidInLoyaltyPoints$(){return this.#e.selectHasItemsPaidInLoyaltyPoints$()}_setLoyaltyPointsCost(e){this.#e.setLoyaltyPointsCost(e)}getLoyaltyPointsCost(){return this.#e.getLoyaltyPointsCost()}selectLoyaltyPointsCost$(){return this.#e.selectLoyaltyPointsCost$().pipe(k((e,t)=>B(e,t)))}_setLoyaltyPointsExchangePrice(e){this.#e.setLoyaltyPointsExchangePrice(e)}getLoyaltyPointsExchangePrice(){return this.#e.getLoyaltyPointsExchangePrice()}selectLoyaltyPointsExchangePrice$(){return this.#e.selectLoyaltyPointsExchangePrice$().pipe(k((e,t)=>B(e,t)))}}var pn=Object.defineProperty,ks=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&pn(e,t,s),s};class Nt extends f{constructor(){super(),this.mode="basket",this._isValid=!0,this._confirmModal=P(),this._confirmModalId=`remove-all-products-confirm-modal-${v()}`,this._flashMessengerRef=P(),this._handleFlashMessages=(e,t)=>{if(e){this._flashMessengerApi.removeAllFlashMessages("basket-products");return}this._flashMessengerApi.addFlashMessage({content:this._translationsApi.translate(t),type:z.error,isCloseable:!1,timeout:0},"basket-products"),this._flashMessengerRef.value?.focus()},this._clearBasket=async()=>{await this._basketOverallApi.cleanBasket(),this._confirmModal.value?.close()},this._basketProductsApi=this.getApiSync("basketProductsApi"),this._basketOverallApi=this.getApiSync(H.api),this._translationsApi=this.getApiSync(J.api),this._flashMessengerApi=this.getApiSync(ae.api),this.isBasketFilled$=D([this._basketOverallApi.selectActions$(),this._basketProductsApi.selectBasketCount$()]).pipe(A(([e,t])=>t>0&&e.clean&&e.clean.method&&e.clean.href)),this._basketProductsApi.selectSectionValidation$().subscribe(({isValid:e,validationMessage:t})=>{e?this.classList.remove("basket-module_error"):(this.classList.add("basket-module_error"),this.scrollIntoView()),t&&this._handleFlashMessages(e,t)}),setTimeout(()=>this.eventBus.emit(new m(S.viewedBasket)))}static{this.moduleName="basket-products"}render(){return r` 335 <div class="basket-module__content"> 336 <flash-messenger 337 ${I(this._flashMessengerRef)} 338 class="d-block mb-xs-1" 339 name="basket-products" 340 tabindex="-1" 341 ></flash-messenger> 342 343 <header class="grid__row"> 344 <div class="grid__col grid__col_xs-12 grid__col_sm-grow"> 345 <h2 class="section-title section-title_s">${l("Products in the cart")}</h2> 346 <p><small>${l("All prices include VAT.")}</small></p> 347 </div> 348 349 ${g(this.mode==="basket",()=>r`${F(this.isBasketFilled$,r` <div class="grid__col grid__col_xs-12 grid__col_sm-auto mt-xs-2 mt-sm-0"> 350 <h-modal-opener 351 name="${this._confirmModalId}" 352 class="btn btn_outline btn_xs" 353 aria-label="${l("Remove all products from the cart")}" 354 > 355 <h-icon 356 icon-name="icon-trash" 357 css-classes="btn__icon btn__icon_left" 358 aria-hidden="true" 359 ></h-icon> 360 361 ${l("Remove all products")} 362 </h-modal-opener> 363 </div>`,d)}`,()=>r` ${F(this.isBasketFilled$,r` <div class="grid__col grid__col_xs-12 grid__col_sm-auto"> 364 <button 365 aria-label="${l("Edit products in your cart")}" 366 @click=${()=>{this.mode="basket"}} 367 class="link link_no-underline" 368 > 369 <h-icon 370 icon-name="icon-check-square" 371 css-classes="icon_link icon_link_left" 372 aria-hidden="true" 373 ></h-icon> 374 375 ${l("Edit")} 376 </button> 377 </div>`,d)}`)} 378 </header> 379 ${F(this.isBasketFilled$,r` <basket-products-list 380 .mode=${this.mode} 381 .products="${$(this._basketProductsApi.select$())}" 382 ></basket-products-list>`,r` <p class="align_center mt-xs-2"> 383 <h-icon 384 icon-name="icon-basket" 385 css-classes="icon_xxl" 386 aria-hidden="true" 387 ></h-icon> 388 </p> 389 <p class="align_center mb-xs-2">${l("Your cart is empty")}</p>`)} 390 </div> 391 392 <confirm-modal 393 ${I(this._confirmModal)} 394 id="${this._confirmModalId}" 395 hidden 396 header="${l("Clearing all products from the cart")}" 397 confirmText="${l("Clear all products")}" 398 cancelText="${l("Cancel")}" 399 @confirm="${this._clearBasket}" 400 > 401 <p slot>${l("Are you sure you want to clear all items from your shopping cart?")}</p> 402 </confirm-modal> 403 `}}ks([p()],Nt.prototype,"mode");ks([u()],Nt.prototype,"_isValid");var un=Object.defineProperty,mt=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&un(e,t,s),s};class De extends f{constructor(){super(),this.mode="basket",this.hasAdditionalInfo=!0,this.products=[],this._confirmModal=P(),this._currentProduct=null,this._listId=v(),this._confirmModalId=`remove-product-confirm-modal-${v()}`,this._mapEventToAction=e=>{const i=e.target.getAttribute("product-id"),s=this.products.find(o=>o.id===i),a=e.detail.value;if(!s)throw"No product found";return{product:s,quantity:a}},this._removeProduct=async()=>{this._currentProduct&&(await this._basketProductsApi.remove(this._currentProduct),this.products.length>1&&this._confirmModal.value?.close())},this._basketProductsApi=this.getApiSync("basketProductsApi"),this._setupQuantityChange()}static{this.moduleName="basket-products-list"}_setupQuantityChange(){ps(this,Pi.valueChanged).pipe(k(),oi(200),A(this._mapEventToAction)).subscribe(({product:i,quantity:s})=>{this._basketProductsApi.update(i,s)})}_hasSumLoyaltyPointsExchangePrice(e){return e!==null&&e.grossValue>0}render(){return r` 404 <div class="basket-products__list"> 405 ${this.products.map(e=>r` 406 <div 407 data-product-id="${e.productId}" 408 data-variant-id="${e.variantId}" 409 class="basket-product" 410 > 411 <div class="basket-product__image"> 412 <a 413 aria-hidden="true" 414 tabindex="-1" 415 class="basket-product__image-border" 416 href="${e.url}" 417 > 418 <img 419 src="${e.image.paths.webp}"
420 alt="${e.image.title}" 421 /> 422 </a> 423 </div> 424 <div class="basket-product__wrapper"> 425 <div class="basket-product__content"> 426 <div class="basket-product__info"> 427 <div class="basket-product__name"> 428 ${e.isExchangedWithLoyaltyPoints?r`<span class="tag tag_minimal mb-xs-1"> 429 ${l("Loyalty program <<basket product list tag>>")} 430 </span>`:d} 431 ${e.isBundle?r`<span class="tag tag_minimal mb-xs-1">${l("Bundle")}</span>`:d} 432 ${e.isDigital?r`<span class="tag tag_minimal mb-xs-1"> ${l("Digital product")} </span>`:d} 433 <h3> 434 <a 435 class="p basket-product__link" 436 href="${e.url}" 437 >${e.name}</a 438 > 439 </h3> 440 441 ${e.hasOptions?r` <ul class="basket-product__options"> 442 ${e.options.map(t=>r` <li 443 data-option-name="${t.name}" 444 data-option-value="${t.value}" 445 > 446 ${t.name}: <span class="font_semibold">${t.value}</span> 447 </li>`)} 448 </ul>`:d} 449 </div> 450 451 ${g(this.mode==="basket",()=>r` <div class="basket-product__actions"> 452 ${e.actions.changeQuantity?r` <h-input-stepper 453 product-id="${e.id}" 454 ${e.unit.isFloatingPoint?r`allowed-number-of-fraction-digits="3"`:d} 455 allowed-number-of-fraction-digits="${e.unit.isFloatingPoint?"3":"0"}" 456 class="input-stepper" 457 min="${e.unit.isFloatingPoint?"0.01":"1"}" 458 step="${e.package?e.package:"1"}" 459 round-to="${e.package}" 460 value="${e.quantity}" 461 control-id="product-quantity-${e.id}-${this._listId}" 462 > 463 <h-button-stepper 464 class="input-stepper__button" 465 type="decrement" 466 aria-label="${l("Remove {{ count }} {{ unit }} {{ product }}",{count:e.package||1,unit:e.unit.name,product:e.name})}" 467 > 468 <span 469 class="btn-icon btn-icon_outline btn-icon_join-right input-stepper__icon" 470 > 471 <h-icon 472 icon-name="icon-minus" 473 role="button" 474 size="xs" 475 clickable 476 aria-hidden="true" 477 css-classes="btn__icon" 478 ></h-icon> 479 </span> 480 </h-button-stepper> 481 482 <div class="input-stepper__display-container"> 483 <h-display-stepper 484 class="input-stepper__value" 485 aria-label="${l("Quantity of {{ product }}",{product:e.name})}" 486 ></h-display-stepper> 487 <sp
487an class="input-stepper__additional-content">${e.unit.name}</span> 488 </div> 489 490 <h-button-stepper 491 class="input-stepper__button input-stepper_increment" 492 type="increment" 493 aria-label="${l("Add {{ count }} {{ unit }} {{ product }}",{count:e.package||1,unit:e.unit.name,product:e.name})}" 494 > 495 <span class="btn-icon btn-icon_outline btn-icon_join-left input-stepper__icon"> 496 <h-icon 497 icon-name="icon-plus" 498 role="button" 499 size="xs" 500 clickable 501 aria-hidden="true" 502 css-classes="btn__icon" 503 ></h-icon> 504 </span> 505 </h-button-stepper> 506 </h-input-stepper>`:d} 507 ${e.actions.remove?r` <h-modal-opener 508 name="${this._confirmModalId}" 509 @click="${()=>{this._currentProduct=e}}" 510 @keydown="${t=>{t.key!=="Enter"&&t.key!==" "||(this._currentProduct=e)}}" 511 aria-label="${l("Remove")} ${e.name}" 512 class="link link_secondary remove-product__button" 513 > 514 ${l("Remove")} 515 </h-modal-opener>`:d} 516 </div>`,()=>r` <div class="basket-product__actions"> 517 <b class="font_semibold font_size-xs">${e.quantity} x ${e.unit.name}</b> 518 </div>`)} 519 </div> 520 521 ${this.hasAdditionalInfo?r` <div class="basket-product__additional-info"> 522 <p class="p_no-margin"> 523 ${l("Shipping time")}: 524 <strong class="font_semibold">${e.delivery?.name}</strong> 525 </p> 526 <p> 527 <add-to-favourites 528 class="link" 529 product-id=${e.productId} 530 variant-id=${e.variantId} 531 module-instance-id="test" 532 > 533 <span 534 aria-label="${l("Add to wishlist")}: ${e.name}" 535 slot="not-added" 536 > 537 ${l("Add to wishlist")} 538 </span>
539 <span 540 aria-label="${l("Remove from wishlist")}: ${e.name}" 541 slot="added" 542 hidden 543 > 544 ${l("Remove from wishlist")} 545 </span> 546 </add-to-favourites> 547 </p> 548 </div>`:d} 549 </div> 550 </div> 551 <ul class="basket-product__prices"> 552 ${e.isExchangedWithLoyaltyPoints?r` 553 <li class="basket-product__price price price_m price__value"> 554 <span class="font_semibold"> 555 ${e.sumLoyaltyPointsCost?.pointsFormatted}${this._hasSumLoyaltyPointsExchangePrice(e.sumLoyaltyPointsExchangePrice)?r` + ${e.sumLoyaltyPointsExchangePrice?.grossValueFormatted}`:d} 556 </span> 557 </li> 558 559 ${e.quantity>1?r`<li class="price price_xs"> 560 ${this._hasSumLoyaltyPointsExchangePrice(e.loyaltyPointsExchangePrice)?r`${e.quantity} x (${e.loyaltyPointsCost?.pointsFormatted} + 561 ${e.loyaltyPointsExchangePrice?.grossValueFormatted})`:r`${e.quantity} x ${e.loyaltyPointsCost?.pointsFormatted}`} 562 </li> `:d} 563 `:d} 564 ${e.isExchangedWithLoyaltyPoints?d:r` 565 <li class="price price_to-pay basket-product__price"> 566 <p class="sr-only"> 567 ${e.isSpecialOffer?l("Promotional price"):l("Price")} 568 ${e.sum.grossValueFormatted} 569 ${l("incl. {{ taxFormatted }} vat",{taxFormatted:e.sum.taxFormatted})} 570 </p> 571 572 ${e.isSpecialOffer?r` 573 <h-icon 574 css-classes="icon_promo price__special-offer-icon" 575 icon-name="icon-percent" 576 size="xs" 577 aria-hidden="true" 578 ></h-icon> 579 `:d} 580 <span 581 aria-hidden="true" 582 class="${ee({price__value:!0,price__value_special:e.isSpecialOffer,price__value_bold:!0})}" 583 >${e.sum.grossValueFormatted}</span 584 > 585 <span 586 class="vat-info" 587 aria-hidden="true" 588 > 589 ${l("incl. {{ taxFormatted }} vat",{taxFormatted:e.sum.taxFormatted})} 590 </span> 591 </li> 592 593 ${e.quantity>1?r` 594 <li class="price price_xs price_per-product"> 595 <p class="sr-only"> 596 ${l("Price per product")} ${e.price.grossValueFormatted} 597 </p>
598 <span aria-hidden="true"> 599 ${e.quantity} x ${e.price.grossValueFormatted} 600 </span> 601 </li> 602 `:d} 603 ${e.isSpecialOffer?r` <li class="price price_xs price_regular"> 604 <p class="price__label p_no-margin"> 605 ${l("Regular price")} : 606 607 <span class="price__value price__value_inactive"> 608 ${e.basePrice.grossValueFormatted} 609 </span> 610 </p> 611 </li> 612 <li class="price price_xs price_lowest"> 613 <p class="price__label p_no-margin"> 614 ${l("Lowest price")} : 615 616 <span class="price__value price__value_inactive p_no-margin"> 617 ${e.lowestHistoricalPriceInLast30Days.grossValueFormatted} 618 </span> 619 </p> 620 </li>`:d} 621 `} 622 </ul> 623 </div> 624 `)} 625 </div> 626 627 <confirm-modal 628 ${I(this._confirmModal)} 629 id="${this._confirmModalId}" 630 header="${l("Are you sure you want to remove the product from your cart?")}" 631 confirmText="${l("Remove product")}" 632 cancelText="${l("Cancel")}" 633 @confirm="${this._removeProduct}" 634 > 635 <div 636 class="grid__row grid__row_xs-vcenter" 637 slot 638 > 639 <div class="grid__col"> 640 <img 641 width="80" 642 src="${this._currentProduct?.image.paths.webp}" 643 alt="${this._currentProduct?.image.title}" 644 /> 645 </div> 646 <div class="grid__col">${this._currentProduct?.name}</div> 647 </div> 648 </confirm-modal> 649 `}}mt([p()],De.prototype,"mode");mt([p({type:Boolean,attribute:"has-additional-info"})],De.prototype,"hasAdditionalInfo");mt([p()],De.prototype,"products");mt([u()],De.prototype,"_currentProduct");const pe={basket:"basket",fullBasket:"fullBasket",checkout:"checkout"},ss="basket-summary__coupon",mn=/[\u200B-\u200D\uFEFF]/g;var _n=Object.defineProperty,Ue=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&_n(e,t,s),s};class Be extends f{constructor(){super(),this.mode=pe.basket,this.hasContent=!0,this.url="",this.basketUrl="",this._showTaxInfo=!1,this._basketPromotionsApi=this.getApiSync(ge.api),this._storefrontSettingsApi=this.getApiSync(L.api),this._basketOverallApi=this.getApiSync(H.api),this._storefrontSettingsApi.selectSkinSettings$().subscribe(e=>{this._showTaxInfo=e.showAdditionalTaxInfo==="1"}),this._hasAnyPromotions$=this._basketPromotionsApi.select$().pipe(A(e=>e.length>0)),this._hasAnyDiscounts$=D([this._basketPromotionsApi.selectHasPromotionCode$(),this._hasAnyPromotions$]).pipe(A(([e,t])=>e||t)),this._shouldDisplayBasketSummaryPrices$=this._hasAnyDiscounts$.pipe(A(e=>e||this._showTaxInfo))}static{this.moduleName="basket-summary"}render(){return r` 650 ${this.hasContent?r` 651 <div class="basket-module__content"> 652 <h2 class="section-title section-title_s mb-xs-2">${l("Summary")}
652</h2> 653 654 ${g(this._basketOverallApi.getActions().usePromoCode,()=>r`<div 655 class="basket-summary__coupon" 656 tabindex="-1" 657 > 658 <h3 class="font_semibold mb-xs-2">${l("Discount coupon")}</h3> 659 660 <basket-summary-coupon-codes></basket-summary-coupon-codes> 661 </div>`,()=>d)} 662 ${g(this.mode===pe.checkout||this.mode===pe.fullBasket,()=>r`<basket-summary-checkout-prices></basket-summary-checkout-prices>`,()=>r` ${F(this._shouldDisplayBasketSummaryPrices$,r`<basket-summary-basket-prices></basket-summary-basket-prices>`,d)}`)} 663 </div> 664 `:d} 665 ${g(this.mode===pe.basket||this.mode===pe.fullBasket,()=>r` 666 <basket-summary-basket-footer 667 basket-url="${this.basketUrl}" 668 url="${this.url}" 669 mode="${this.mode}" 670 > 671 </basket-summary-basket-footer> 672 `,()=>r`<basket-summary-checkout-footer></basket-summary-checkout-footer>`)} 673 `}}Ue([p()],Be.prototype,"mode");Ue([p()],Be.prototype,"hasContent");Ue([p()],Be.prototype,"url");Ue([p({type:String,attribute:"basket-url"})],Be.prototype,"basketUrl");Ue([u()],Be.prototype,"_showTaxInfo");var gn=Object.defineProperty,$s=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&gn(e,t,s),s};class Vt extends f{constructor(){super(),this.discounts=[],this.discountsSum=null,this._storefrontSettingsApi=this.getApiSync(L.api)}static{this.moduleName="basket-discounts-list"}render(){const e=document.querySelector("#iconsPath")?.href||"/assets/img/icons/symbol-defs.svg";return r`${g(this.discounts.length>0,()=>r` <h-accordion 674 lazy 675 class="basket-discounts-list" 676 > 677 <h-accordion-group> 678 <h-accordion-toggler class="accordion__toggler p_s mb-xs-1"> 679 <span> 680 ${l("All discounts")} 681 <svg class="icon accordion__toggler-icon accordion__toggler-icon_secondary"> 682 <use 683 href="${e}#icon-chevron-down" 684 xlink:href="${e}#icon-chevron-down" 685 ></use> 686 </svg> 687 </span> 688 689 <span> 690 ${g(this.discountsSum,()=>r` <span class="price__value price__value_special"> ${this.discountsSum?.grossValueFormatted} </span> `,()=>d)} 691 </span> 692 </h-accordion-toggler> 693 694 <h-accordion-content 695 ?is-dev-accordion-optimization-flag-enabled=${this._storefrontSettingsApi.isFeatureEnabled("dev_accordion_optimization")} 696 > 697 <ul class="price-list price-list_secondary price-list_s"> 698 ${this.discounts.map(t=>r` 699 <li class="price-list__item"> 700 <span class="price-list__label price_s"> 701 ${g(t.percentage,()=>r` 702 <span class="tag font_semibold tag_promotion"> -${t.percentage+"%"} </span> 703 `,()=>d)} 704 ${t.label} 705 </span> 706 <span class="price-list__value price__value price__value_special price_s"> 707 ${t.discount?.grossValueFormatted} 708 </span> 709 </li> 710 `)} 711 </ul> 712 </h-accordion-content> 713 </h-accordion-group> 714 </h-accordion>`)}`}}$s([p()],Vt.prototype,"discounts");$s([p()],Vt.prototype,"discountsSum");class E{constructor(e,t,i){this._subscription=null,this._host=e,this._source=t,this.value=i,this._host.addController(this)}hostConnected(){this._subscription=this._source.subscribe(e=>{this.value=e,this._host.requestUpdate()})}hostDisconnected(){this._subscription?.unsubscribe()}}class yn extends f{constructor(){super(),this._flashMessengerRef=P(),this._handleFlashMessages=(e,t)=>{if(e){this._flashMessengerApi.removeAllFlashMessages("shipping-chooser");return}this._flashMessengerApi.addFlashMessage({content:this._translationsApi.translate(t),type:z.error,isCloseable:!1,timeout:0},"shipping-chooser"),this._flashMessengerRef.value?.focus()},this._basketShippingsApi=this.getApiSync(Ce.api),this._basketOverallApi=this.getApiSync("basketOverallApi"),this._basketUpdaterApi=this.getApiSync(Mt.api),this._translationsApi=this.getApiSync(J.api),this._settingsApi=this.getApiSync(L.api),this._basketAddressesApi=this.getApiSync("basketAddressesApi"),this._flashMessengerApi=this.getApiSync(ae.api),this._basketUpdaterApi.refreshBasket(),this._canChangeShippingCountry$=D([this._basketOverallApi.selectActions$(),this._basketShippingsApi.selectAvailableShippingCountries$(),this._basketAddressesApi.selectShippingAddress$()]).pipe(A(([e,t,i])=>e.changeShippingCountry!==void 0&&t.length>1&&!this._basketAddressesApi.isAddressFilled(i))),this._deliveryTime$=this._basketOverallApi.selectDelivery$().pipe(A(e=>e.name)),this._basketShippingsApi.selectSectionValidation$().subscribe(({isValid:e,validationMessage:t})=>{e?this.classList.remove("basket-module_error"):(this.classList.add("basket-module_error"),this.scrollIntoView()),t&&this._handleFlashMessages(e,t)}),this._selectedShippingCountry=new E(this,this._basketShippingsApi.selectSelectedShippingCountry$())}static{this.moduleName="shipping-chooser"}render(){return r` <section class="basket-module__content"> 715 <div class="grid__row grid__row_xs-vcenter mb-xs-1"> 716 <div class="grid__col grid__col_xs-grow"> 717 <flash-messenger 718 ${I(this._flashMessengerRef)} 719 class="d-block mb-xs-1" 720 name="shipping-chooser" 721 tabindex="-1" 722 ></flash-messenger> 723 724 <h2 class="section-title section-title_s mb-xs-2">${l("Delivery")}</h2> 725 726 ${this._settingsApi.isFeatureEnabled("select_shipping_country_on_shipping_step")?r`<basket-shipping-country isShippingCountryChangeAvailable="true"></basket-shipping-country>`:r`${g(this._selectedShippingCountry.value,()=>r`<p class="font_size-s"> 727 <img 728 src="/assets/img/flags/${this._settingsApi.getCountryById(this._selectedShippingCountry.value.country.id)?.locale}.png" 729 alt="" 730 class="mr-xs-1" 731 />${this._selectedShippingCountry.value?.country.name} 732 ${F(this._canChangeShippingCountry$,r`<small class="d-block color_tertiary mt-xs-2" 733 >${l("To change the country, add a shipping address.")}</small 734 >`,d)} 735 </p>`,()=>d)}`} 736 </div> 737 </div> 738 739 <p class="font_size-s">${l("Shipping within")} <b class="font_semibold">${$(this._deliveryTime$)}</b></p> 740 741 <basket-shippings-list .shippings=${$(this._basketShippingsApi.select$())}></basket-shippings-list> 742 </section>`}}const bn={shippingSelected:"shippingSelected"},Ps={api:"nearestPickupPointsApi"};var fn=Object.defineProperty,Ge=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&fn(e,t,s),s};class xe extends f{constructor(){super(),this.shippings=[],this.isSimple=!1,this._nearestPickupPoints=[],this.focusedId="",this._basketShippingsApi=this.getApiSync(Ce.api),this._basketAddressApi=this.getApiSync("basketAddressesApi"),this._nearestPickupPointsApi=this.getApiSync(Ps.api),this.eventBus.on(S.shippingInfoAdded,()=>this.requestUpdate()),this._basketShippingsApi.selectSelectedShipping$().subscribe(async e=>{e&&this._nearestPickupPointsApi.hasNearestPickupPointStrategy()&&(this._nearestPickupPoints=await this._nearestPickupPointsApi.findNearestPickupPoints())}),this._basketAddressApi.selectBillingAddress$().subscribe(async e=>{e?.zipCode&&(this._nearestPickupPoints=await this._nearestPickupPointsApi.findNearestPickupPoints())})}static{this.moduleName="basket-shippings-list"}_setShipping(e,t){const i=e.target;this.focusedId=`shipping-${t.id}`,i instanceof HTMLInputElement&&i.name==="basket_shipping"&&(this._basketShippingsApi.setShipping(t),this.dispatchEvent(new CustomEvent(bn.shippingSelected,{bubbles:!0})),this._currentRadioId=i.id,this.eventBus.emit(new m(G.shippingChosenByUser)))}async updated(e){if(super.updated(e),e.has("shippings")&&!e.has("_nearestPickupPoints")&&this._currentRadioId){await this.updateComplete;const t=this.querySelector(`input#${this._currentRadioId}`);t&&t.focus()}}_renderDescription(e){const t=!!e.description,i=e.price.grossValue>0&&!!e.requiredBasketValueForFreeShipping;return!t&&!i?d:r` 743 <div slot="description"> 744 <p class="font_size-xs"> 745 ${g(i,()=>r`
746 <span class="color_main"> 747 ${l("Free delivery for orders over")} 748 <strong class="font_semibold"> ${e.requiredBasketValueForFreeShipping?.text} </strong> 749 </span> 750 `,()=>d)} 751 ${t?e.description:d} 752 </p> 753 </div> 754 `}render(){return r` 755 ${$e(this.shippings,e=>ms.encode(JSON.stringify(e)),e=>r` 756 <h-radio 757 class="${ee({"basket-shipping":!0,"basket-shipping_selected":e.isSelected})}" 758 controlId="${`shipping-${e.id}`}" 759 controlName="basket_shipping" 760 ?checked="${e.isSelected}" 761 .value="${e.id}" 762 @change="${t=>this._setShipping(t,e)}" 763 > 764 <h-radio-control aria-describedby="shipping-desc-${e.id}"></h-radio-control> 765 766 <h-radio-content class="basket-shipping__radio"> 767 <div 768 aria-label="${e.name}" 769 class="basket-shipping__header" 770 slot="label" 771 > 772 <span 773 aria-hidden="true" 774 class="basket-shipping__name" 775 >${e.name}</span 776 > 777 778 <div class="basket-shipping__summary"> 779 ${g(e.image,()=>r`<img 780 aria-hidden="true" 781 style="height: 30px" 782 src="${e.image}" 783 alt="${e.name}" 784 />`,()=>d)} 785 786 <strong 787 aria-hidden="true" 788 class="font_semibold" 789 > 790 ${e.price.grossValue?e.price.grossValueFormatted:r`<span class="basket-shipping__price_highlight">${l("Free")}</span>`} 791 </strong> 792 </div> 793 </div> 794 795 ${e.isSelected&&!this.isSimple?r` <div slot="description"> 796 ${g(e.description,()=>r`<span 797 class="font_size-xs" 798 id="shipping-desc-${e.id}" 799 >${e.description}</span 800 >`,()=>d)} 801 ${g(e.isPickupPointDelivery&&!this.isSimple,()=>r` 802 <div class="basket-shipping__pickup-point"> 803 ${g(e.pickupPoint,()=>r` 804 ${F(this._nearestPickupPointsApi.selectHasNearestPickupPointStrategy$(),r` <nearest-pickup-points 805 class="nearest-pickup-points" 806 .nearestPickupPoints=${this._nearestPickupPoints} 807 .shipping=${e} 808 .selectedPickupPoint=${e.pickupPoint} 809 @nearestPickupPointsSearch=${async t=>{this._basketAddressApi.setPickupPointData(t.detail.zipCode),this._nearestPickupPoints=await this._nearestPickupPointsApi.findNearestPickupPoints()||[]}} 810 @pickupPointSelected=${t=>{const i=t.detail.pickupPoint;this._basketShippingsApi.setPickupPoint(e,i)}} 811 class="d-block mb-xs-2" 812 ></nearest-pickup-points> 813 <button 814 @click=${()=>{this._basketShippingsApi.showPickupPointMap(e)}} 815 class="btn btn_s btn_outline" 816 > 817 <h-icon 818 icon-name="icon-map-pin" 819 css-classes="btn__icon btn__icon_left" 820 aria-hidden="true" 821 ></h-icon> 822 823 ${l("Choose delivery point")} 824 </button>`,r`<span class="font_size-xs color_main" 825 >${l("Choosen delivery point")}</span 826 > 827 828 <address class="basket-shipping__pickup-point-address"> 829 <p class="font_size-xs"> 830 <strong class="font_semibold"> ${e.pickupPoint?.code} </strong>, 831 ${e.pickupPoint?.address.street} 832 ${e.pickupPoint?.address.houseNumber}, 833 ${e.pickupPoint?.address.postalCode} 834 ${e.pickupPoint?.address.city}, 835 ${e.pickupPoint?.address.description} 836 </p> 837 838 <button 839 @click=${()=>{this._basketShippingsApi.showPickupPointMap(e)}} 840 class="btn btn_s btn_outline" 841 > 842 <h-icon 843 icon-name="icon-map-pin" 844 css-classes="btn__icon btn__icon_left" 845 aria-hidden="true" 846 ></h-icon> 847 848 ${l("Change delivery point")} 849 </button> 850 </address>`)} 851 `,()=>r` 852 ${F(this._nearestPickupPointsApi.selectHasNearestPickupPointStrategy$(),r`<nearest-pickup-points 853 class="nearest-pickup-points" 854 .nearestPickupPoints=${this._nearestPickupPoints} 855 .shipping=${e} 856 @nearestPickupPointsSearch=${async t=>{this._basketAddressApi.setPickupPointData(t.detail.zipCode),this._nearestPickupPoints=await this._nearestPickupPointsApi.findNearestPickupPoints()||[]}} 857 @pickupPointSelected=${t=>{const i=t.detail.pickupPoint;this._basketShippingsApi.setPickupPoint(e,i)}} 858 class="d-block mb-xs-2" 859 ></nearest-pickup-points>`,d)} 860 861 <button 862 @click=${()=>{this._basketShippingsApi.showPickupPointMap(e)}} 863 class="btn btn_s btn_outline" 864 aria-haspopup="dialog" 865 > 866 <h-icon 867 icon-name="icon-map-pin" 868 css-classes="btn__icon btn__icon_left" 869 aria-hidden="true" 870 ></h-icon> 871 872 ${l("Choose delivery point")} 873 </button> 874 `)} 875 </div> 876 `,()=>d)} 877 ${g(this._basketShippingsApi.shouldDisplayRemainingBasketValueForFreeShippingMessage(e),()=>r` ${g(this.isSimple,()=>d,()=>r` <div class="progress-bar mb-xs-1"> 878 <div 879 class="progress-bar__bar" 880 style="width: ${(e.requiredBasketValueForFreeShipping.float-e.remainingBasketValueForFreeShipping.float)*100/e.requiredBasketValueForFreeShipping.float}%" 881 ></div> 882 </div>`)} 883 884 <p class="font_size-xs color_main"> 885 ${l("Add products worth {{ remainingBasketValueForFreeShipping }} to qualify for free delivery.",{remainingBasketValueForFreeShipping:e.remainingBasketValueForFreeShipping.text})} 886 </p>`,()=>d)} 887 ${g(e.isSelected&&this._basketShippingsApi.getShippingInfo(e),()=>[...this._basketShippingsApi.getShippingInfo(e)].map(([,t])=>r`${_s(t)}`))} 888 </div>`:this._renderDescription(e)} 889 </h-radio-content> 890 </h-radio> 891 `)} 892 `}}Ge([p()],xe.prototype,"shippings");Ge([p({attribute:"is-simple",type:Boolean})],xe.prototype,"isSimple");Ge([u()],xe.prototype,"_currentRadioId");Ge([u()],xe.prototype,"_nearestPickupPoints");Ge([p({type:String})],xe.prototype,"focusedId");var Sn=Object.defineProperty,Cs=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&Sn(e,t,s),s};class Rt extends f{constructor(){super(),this.AUTOPAY_PAYMENT_CHANNEL_KEY="onlinePayment",this.AUTOPAY_POPULAR_SUBCHANNELS=["onlinePayment:1803","onlinePayment:1800","onlinePayment:1808","onlinePayment:1806"],this.P24_PAYMENT_CHANNEL_KEY="shoperP24",this.P24_POPULAR_SUBCHANNELS=["shoperP24:31","shoperP24:20","shoperP24:270","shoperP24:112"],this.payments=[],this.isOrderCoveredByGiftCards=!1,this._paymentsListModalRef=P(),this._basketPaymentsApi=this.getApiSync(Ie.api),this._basketShippingsApi=this.getApiSync(Ce.api),this._basketProductsApi=this.getApiSync("basketProductsApi"),this._settingsApi=this.getApiSync(L.api),this.eventBus.on(S.paymentInfoAdded,()=>this.requestUpdate()),setTimeout(()=>this.eventBus.emit(new m(S.beganCheckout)))}static{this.moduleName="basket-payments-list"}updated(e){e.has("payments")&&!this.isOrderCoveredByGiftCards&&this._ensurePaymentSelected()}_ensurePaymentSelected(){if(this._basketProductsApi.getBasketCount()===0)return;const e=this._getChannelsForList();if(e.length===0||e.some(s=>this._isPaymentOrSubPaymentSelected(s)))return;const i=e.find(s=>
892s.actions.selectChannel);i&&this._setPayment(i)}_getChannelsForModal(e){return this.payments.filter(i=>e.subChannels.includes(i.id))}_filterPopularSubchannelsForSelectedPayment(e,t,i){return e.filter(s=>t.subChannels.includes(s.id)).filter(s=>i.includes(s.channelKey)).sort((s,a)=>i.indexOf(s.channelKey)-i.indexOf(a.channelKey))}_getChannelsForPopular(e){return this._settingsApi.isFeatureEnabled("dev_payments_popular_subchannels")?e.channelKey===this.AUTOPAY_PAYMENT_CHANNEL_KEY?this._filterPopularSubchannelsForSelectedPayment(this.payments,e,this.AUTOPAY_POPULAR_SUBCHANNELS):e.channelKey===this.P24_PAYMENT_CHANNEL_KEY?this._filterPopularSubchannelsForSelectedPayment(this.payments,e,this.P24_POPULAR_SUBCHANNELS):[]:[]}_getChannelsForList(){return this.payments.filter(e=>e.isFeatured).sort((e,t)=>{const i=typeof e.integrationData=="object"&&e.integrationData!==null&&"pisChannelId"in e.integrationData&&!!e.integrationData.pisChannelId,s=typeof t.integrationData=="object"&&t.integrationData!==null&&"pisChannelId"in t.integrationData&&!!t.integrationData.pisChannelId;return Number(s)-Number(i)})}_getSelectedSubChannelForSelectedPayment(e){return this._getChannelsForModal(e).find(t=>t.isSelected)}_isPaymentOrSubPaymentSelected(e){return e.isSelected||e.subChannels.some(t=>this.payments.find(i=>i.id===t)?.isSelected)}_renderPaymentAdditionalInfo(e){return r` ${g(this._isPaymentOrSubPaymentSelected(e)&&this._basketPaymentsApi.getPaymentInfo(e),()=>[...this._basketPaymentsApi.getPaymentInfo(e)].map(([,t])=>r`${_s(t)}`))}`}_setPayment(e){this._basketPaymentsApi.setPayment(e),this.eventBus.emit(new m(G.paymentChosenByUser))}_getPaymentCtaLabel(e){return(e?.ctaPaymentLabel?.length??0)>0?e.ctaPaymentLabel:l("Select a bank")}render(){return r` 893 ${this._getChannelsForList().map(e=>r` 894 <h-radio 895 class="${ee({"basket-shipping":!0,"basket-shipping_selected":this._isPaymentOrSubPaymentSelected(e)})}" 896 controlId=${`payment-${e.id}-${e.paymentId}`} 897 controlName="basket_payment" 898 .checked=${this._isPaymentOrSubPaymentSelected(e)} 899 .value=${e.id} 900 @change=${t=>{t.target instanceof HTMLInputElement&&this._setPayment(e)}} 901 > 902 <h-radio-control aria-describedby="payment-desc-${e.id}-${e.paymentId}"></h-radio-control> 903 904 <h-radio-content class="basket-shipping__radio"> 905 <div 906 class="basket-shipping__header" 907 aria-label="${e.name}" 908 slot="label" 909 > 910 <span 911 aria-hidden="true" 912 class="basket-shipping__name" 913 >${e.name}</span 914 > 915 <div class="basket-shipping__summary"> 916 ${g(e.image,()=>r`<img 917 aria-hidden="true" 918 class="basket-shipping__image" 919 src="${e.image}" 920 alt="${e.name}" 921 />`,()=>d)} 922 ${g(this._basketShippingsApi.isEveryAvailablePaymentFree(),()=>d,()=>r`<strong 923 aria-hidden="true" 924 class="font_semibold" 925 > 926 ${this._basketShippingsApi.getPaymentCostForActiveShippingByPaymentId(e.paymentId)?.grossValue?this._basketShippingsApi.getPaymentCostForActiveShippingByPaymentId(e.paymentId)?.grossValueFormatted:r`<span class="color_secondary-500">${l("Free")}</span>`} 927 </strong> `)} 928 </div> 929 </div> 930 931 <div slot="description"> 932 ${g(e.description,()=>r` 933 <p 934 class="font_size-xs" 935 id="payment-desc-${e.id}-${e.paymentId}" 936 > 937 ${e.description} 938 </p> 939 `)} 940 ${g(e.subChannels.length>1&&this._isPaymentOrSubPaymentSelected(e),()=>r` 941 <payments-list-popular 942 .payments=${this._getChannelsForPopular(e)} 943 ></payments-list-popular> 944 <payments-list-modal 945 ${I(this._paymentsListModalRef)} 946 .payments=${this._getChannelsForModal(e)} 947 .ctaPaymentLabel=${e.ctaPaymentLabel??""} 948 ></payments-list-modal> 949 ${g(this._getSelectedSubChannelForSelectedPayment(e),()=>r` 950 <div class="color_main mb-xs-2"> 951 <p class="p_no-margin"> 952 ${l("Selected")}: 953 <b class="font_semibold"> 954 ${this._getSelectedSubChannelForSelectedPayment(e)?.name} 955 </b> 956 </p> 957 958 <button 959 @click=${()=>{this._paymentsListModalRef.value?.open()}} 960 class="btn btn_outline btn_s mt-xs-1" 961 > 962 ${l("Change payment bank")} 963 </button> 964 </div> 965 `,()=>r` <button 966 @click=${()=>{this._paymentsListModalRef.value?.open()}} 967 class="btn btn_primary btn_s" 968 > 969 ${this._getPaymentCtaLabel(e)} 970 </button>`)} 971 `,()=>d)} 972 ${this._renderPaymentAdditionalInfo(e)} 973 </div> 974 </h-radio-content> 975 </h-radio> 976 `)} 977 `}}Cs([p()],Rt.prototype,"payments");Cs([p()],Rt.prototype,"isOrderCoveredByGiftCards");var An=Object.defineProperty,vn=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&An(e,t,s),s};class Is extends f{constructor(){super(),this._subscriptionController=new Lt(this),this._isOrderCoveredByGiftCards=!1,this._flashMessengerRef=P(),this._handleFlashMessages=(e,t)=>{if(e){this._flashMessengerApi.removeAllFlashMessages("payment-chooser");return}this._flashMessengerApi.addFlashMessage({content:this._translationsApi.translate(t),type:z.error,isCloseable:!1,timeout:0},"payment-chooser"),this._flashMessengerRef.value?.focus()},this._basketPaymentsApi=this.getApiSync(Ie.api),this._translationsApi=this.getApiSync(J.api),this._flashMessengerApi=this.getApiSync(ae.api),this._settingsApi=this.getApiSync(L.api),this._basketOverallApi=this.getApiSync(H.api),this._isGiftCardsEnabled=this._settingsApi.isFeatureEnabled("dev_gift_cards"),this._isGiftCardsEnabled&&(this._basketGiftCardsApi=this.getApiSync(ne.api),this._setupPaymentChooserVisibility()),this._basketPaymentsApi.selectSectionValidation$().subscribe(({isValid:e,validationMessage:t})=>{e?this.classList.remove("basket-module_error"):(this.classList.add("basket-module_error"),this.scrollIntoView()),t&&this._handleFlashMessages(e,t)})}static{this.moduleName="payment-chooser"}_setupPaymentChooserVisibility(){if(!this._basketGiftCardsApi)return;
977const e=D([this._basketGiftCardsApi.selectHasAppliedGiftCards$(),this._basketOverallApi.selectSumToPay$()]);this._subscriptionController.subscribe(e,([t,i])=>{this._isOrderCoveredByGiftCards=t&&i.grossValue<=0,this._isOrderCoveredByGiftCards?_e.hide(this):_e.show(this)})}render(){return r`<section class="basket-module__content"> 978 <flash-messenger 979 ${I(this._flashMessengerRef)} 980 class="d-block mb-xs-1" 981 name="payment-chooser" 982 tabindex="-1" 983 ></flash-messenger> 984 985 <h2 class="section-title section-title_s mb-xs-2">${l("Payment")}</h2> 986 987 <basket-payments-list 988 .payments=${$(this._basketPaymentsApi.selectAvailable$())} 989 .isOrderCoveredByGiftCards=${this._isOrderCoveredByGiftCards} 990 ></basket-payments-list> 991 992 <p class="mt-xs-1"> 993 <h-icon 994 class="mr-xs-1 " 995 icon-name="icon-lock" 996 css-classes="icon_tertiary-color" 997 aria-hidden="true" 998 ></h-icon> 999 <small class="color_tertiary">${l("Payments comply with the latest security standards.")}</small> 1000 </p> 1001 </section>`}}vn([u()],Is.prototype,"_isOrderCoveredByGiftCards");const Z={consumerAndCompany:"0",consumerOnly:"1",companyOnly:"2"};var kn=Object.defineProperty,$n=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&kn(e,t,s),s};class ws extends f{constructor(){super(),this.addressMode=Z.consumerAndCompany,this._differentShippingAddressCheckboxRef=P(),this._differentShippingAddressCheckboxId=`different-shipping-${v()}`,this._billingAddressModalRef=P(),this._shippingAddressModalRef=P(),this._basketAddressFormTeaserRef=P(),this._flashMessengerRef=P(),this._handleFlashMessages=(i,s)=>{const a=["basket-addresses-1","basket-addresses-2","basket-addresses-3"];if(i){a.forEach(o=>{this._flashMessengerApi.removeAllFlashMessages(o)});return}a.forEach(o=>{this._flashMessengerApi.addFlashMessage({content:this._translationsApi.translate(s),type:z.error,isCloseable:!1,timeout:0},o)}),this._flashMessengerRef.value?.focus()},this._mapEventToAction=i=>{const s=i.target;return s.id===this._differentShippingAddressCheckboxId?s.checked:this._differentShippingAddressCheckboxRef.value?.checked||!1},this._dispatchBillingModalActionEvent=i=>{const s=new CustomEvent(i.type);this._basketAddressFormTeaserRef.value?.dispatchEvent(s)},this._authenticationApi=this.getApiSync(ds.api),this._basketAddressesApi=this.getApiSync("basketAddressesApi"),this._translationsApi=this.getApiSync(J.api),this._flashMessengerApi=this.getApiSync(ae.api),this._hasShippingAddress$=this._basketAddressesApi.selectShippingAddress$().pipe(A(i=>this._basketAddressesApi.isAddressFilled(i)));const e=this._basketAddressesApi.getBillingAddress()!==null&&(this._basketAddressesApi.isDifferentShippingAddressRequired()||!this._basketAddressesApi.isBillingAddressEqualShippingAddress()),t=ps(this,"change");this._differentShippingAddressVisibilityChange$=t.pipe(A(this._mapEventToAction)).pipe(us(e)),this._differentShippingAddressVisibilityChange$.pipe(k()).subscribe(i=>{!i&&e&&this._basketAddressesApi.setBillingAddressAsShippingAddress()}),this._isDifferentShippingAddressChecked$=D([this._basketAddressesApi.selectBillingAddress$(),this._basketAddressesApi.selectIsDifferentShippingAddressRequired$(),this._differentShippingAddressVisibilityChange$,this._basketAddressesApi.selectIsBillingAddressEqualShippingAddress$()]).pipe(A(([i,s,a,o])=>!!(i&&(!o||s)||a))),this._isDifferentShippingAddressDisabled$=D([this._basketAddressesApi.selectIsDifferentShippingAddressRequired$(),this._basketAddressesApi.selectBillingAddress$()]).pipe(A(([i,s])=>i||!s)),this._basketAddressesApi.selectSectionValidation$().subscribe(({isValid:i,validationMessage:s})=>{i?this.classList.remove("basket-module_error"):(this.classList.add("basket-module_error"),this.scrollIntoView()),s&&this._handleFlashMessages(i,s)})}static{this.moduleName="basket-addresses"}
1001_renderBillingAddress(){return r`<div class="basket-module__content basket-module__content_pb-0 basket-module__content_pl-0 basket-module__content_pr-0"> 1002 <h2 class="section-title section-title_s mb-xs-2 pl-xs-2 pr-xs-2">${l("Order information")}</h2> 1003 1004 ${this._renderStandardBillingAddress()} 1005 </div>`}_renderStandardBillingAddress(){return r` 1006 ${F(this._basketAddressesApi.selectShowBillingAddressCard$(),this._renderEditBillingAddressModal(),r`<div class="pl-xs-2 pr-xs-2 mb-xs-2"> 1007 <flash-messenger 1008 ${I(this._flashMessengerRef)} 1009 name="basket-addresses-2" 1010 tabindex="-1" 1011 ></flash-messenger> 1012 </div> 1013 <billing-address-standard 1014 .addressMode=${this.addressMode} 1015 .address=${$(this._basketAddressesApi.selectBillingAddress$())} 1016 .isLoggedIn=${$(this._authenticationApi.selectIsAuthorized$())} 1017 ></billing-address-standard>`)} 1018 `}_renderEditBillingAddressModal(){return r` 1019 <edit-billing-address-modal 1020 @open-modal="${()=>{this._billingAddressModalRef.value?.open()}}" 1021 ></edit-billing-address-modal> 1022 `}
1022_renderShippingAddress(){return r`<div class="control__additional-content control__additional-content_with-border"> 1023 ${this._renderStandardShippingAddress()} 1024 </div>`}_renderStandardShippingAddress(){return r` 1025 ${F(this._basketAddressesApi.selectShowShippingAddressCard$(),this._renderEditShippingAddressModal(),r` <shipping-address-standard 1026 .address=${$(this._basketAddressesApi.selectShippingAddress$())} 1027 ></shipping-address-standard>`)} 1028 `}_renderEditShippingAddressModal(){return r` 1029 <edit-shipping-address-modal 1030 @open-modal="${()=>{this._shippingAddressModalRef.value?.open()}}" 1031 ></edit-shipping-address-modal> 1032 `}_renderDifferentShippingAddressCheckbox(){return r` 1033 <h-checkbox 1034 ${I(this._differentShippingAddressCheckboxRef)} 1035 controlId=${this._differentShippingAddressCheckboxId} 1036 controlName=${this._differentShippingAddressCheckboxId} 1037 value="1" 1038 ?checked=${$(this._isDifferentShippingAddressChecked$)} 1039 ?disabled=${$(this._isDifferentShippingAddressDisabled$)} 1040 > 1041 <h-checkbox-control></h-checkbox-control> 1042 1043 <h-checkbox-content> 1044 <span slot="label"> ${l("Shipping to a different address")} </span> 1045 </h-checkbox-content> 1046 </h-checkbox> 1047 `}render(){return r` 1048 <div class="basket-addresses"> 1049 ${this._renderBillingAddress()} 1050 ${F(this._basketAddressesApi.selectIsDifferentShippingAddressAvailable$(),r`<div class="basket-module__content basket-module__content_secondary"> 1051 <div class="d-flex"> 1052 <h3 class="font_semibold">${l("Delivery details")}</h3> 1053 <h-icon 1054 css-classes="ml-xs-1" 1055 icon-name="icon-truck" 1056 aria-hidden="true" 1057 ></h-icon> 1058 </div> 1059 1060 <h-control class="mt-xs-1"> 1061 <h-control-content class="control"> 1062 <h-control-element class="control__element"> 1063 ${F(this._basketAddressesApi.selectBillingAddress$(),r` ${this._renderDifferentShippingAddressCheckbox()} `,r`<h-hint direction="top-left"> 1064 ${this._renderDifferentShippingAddressCheckbox()} 1065 1066 <h-hint-content> 1067 <p>${l("First, enter order information (above)")}</p> 1068 </h-hint-content> 1069 </h-hint>`)} 1070 </h-control-element> 1071 1072 ${F(this._isDifferentShippingAddressChecked$,this._renderShippingAddress(),d)} 1073 </h-control-content> 1074 </h-control> 1075 </div>`,d)} 1076 </div> 1077 1078 ${F(this._basketAddressesApi.selectShowBillingAddressCard$(),r`<billing-address-modal 1079 ${I(this._billingAddressModalRef)} 1080 .addressMode=${this.addressMode} 1081 .address=${$(this._basketAddressesApi.selectBillingAddress$())} 1082 .isLoggedIn=${$(this._authenticationApi.selectIsAuthorized$())} 1083 @open=${this._dispatchBillingModalActionEvent} 1084 @close=${this._dispatchBillingModalActionEvent} 1085 ></billing-address-modal>`,d)} 1086 ${F(this._basketAddressesApi.selectShowShippingAddressCard$(),r`<shipping-address-modal 1087 ${I(this._shippingAddressModalRef)} 1088 .address=${$(this._basketAddressesApi.selectShippingAddress$())} 1089 ></shipping-address-modal>`,d)} 1090 `}}$n([p({type:String,attribute:"address-mode"})],ws.prototype,"addressMode");var Pn=Object.defineProperty,Es=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&Pn(e,t,s),s};class Dt extends f{constructor(){super(...arguments),this.address=null,this.country=null}static{this.moduleName="address-card"}connectedCallback(){if(super.connectedCallback(),!this.address||!this.country)throw new Error("address or country attribute is missing")}render(){return!this.address||!this.country?d:r` 1091 <p class="p_overflow-wrap-anywhere"> 1092 <strong class="font_semibold"> 1093 <h-icon 1094 class="mr-xs-1" 1095 icon-name="icon-user" 1096 aria-hidden="true" 1097 ></h-icon 1098 >${this.address.firstName} ${this.address.lastName} 1099 ${this.address.companyName?r` (${this.address.companyName})`:d}</strong 1100 > 1101 </p> 1102 1103 ${this.address.isCompany?r` <p>${l("Tax ID")} ${this.address.taxId}</p>`:d} 1104 1105 <div class="mb-xs-2"> 1106 <p class="p_no-margin p_overflow-wrap-anywhere"> 1107 ${this.address.street}<br aria-hidden="true" />${this.address.zipCode} ${this.address.city} 1108 </p> 1109 <img 1110 class="mr-xs-1" 1111 src=${`/assets/img/flags/${this.country.locale}.png`} 1112 alt="" 1113 />
1114 <span>${l(this.country.name)}</span> 1115 </div> 1116 1117 <p class="p_no-margin p_overflow-wrap-anywhere">${this.address.phone}</p> 1118 <p class="p_overflow-wrap-anywhere">${this.address.email}</p> 1119 `}}Es([p({type:Object})],Dt.prototype,"address");Es([p({type:Object})],Dt.prototype,"country");const Ne={Valid:"valid",Invalid:"invalid",ValidationError:"validation_error"};class _t{async saveAddressForm(e){const t=await e(),i=this.processValidationResult(t);return i===Ne.Invalid?!1:i===Ne.ValidationError?{...t}:null}processValidationResult(e){return e===!1?Ne.Invalid:e==null?Ne.Valid:Ne.ValidationError}}var Cn=Object.defineProperty,qe=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&Cn(e,t,s),s};class Me extends f{constructor(){super(),this._modal=P(),this._form=P(),this.address=null,this.addressMode=Z.consumerAndCompany,this.isLoggedIn=!1,this._formErrors=null,this._isLoading=!0,this._cancel=async()=>{await this._modal.value?.close(),this._isLoading=!0},this._save=async e=>{this._formErrors=await this._addressController.saveAddressForm(async()=>this._form.value?.setBillingAddress(e)),this._formErrors===null&&this.close()},this._addressController=new _t}static{this.moduleName="billing-address-modal"}async open(){await this._modal.value?.open(),this._isLoading=!1,this._form.value?.focusFirstInput(),this.eventBus.emit(new m(G.billingAddressModalOpened,{modal:this,address:this.address}))}async close(){await this._modal.value?.close(),this._isLoading=!0}render(){return r` <h-modal 1120 ${I(this._modal)} 1121 hidden 1122 > 1123 <h-modal-header> 1124 <h2 class="font_semibold h2">${l("Order information")}</h2> 1125 <h-modal-close 1126 aria-label="${l("Close window")}" 1127 class="btn btn_icon" 1128 > 1129 <h-icon 1130 icon-name="icon-x" 1131 role="button" 1132 size="xl" 1133 clickable 1134 ></h-icon> 1135 </h-modal-close> 1136 </h-modal-header> 1137 <h-modal-body> 1138 <flash-messenger 1139 class="d-block mb-xs-2" 1140 name="billing-address-modal" 1141 ></flash-messenger> 1142 1143 ${g(this._isLoading,()=>r`<div class="loader"> 1144 <div class="loader__spinner loader__spinner"></div> 1145 </div>`,()=>r`<billing-address-form 1146 ${I(this._form)} 1147 .address=${this.address} 1148 .addressMode=${this.addressMode} 1149 .isLoggedIn=${this.isLoggedIn} 1150 .formErrors=${we.toJson(this._formErrors)} 1151 ></billing-address-form>`)} 1152 </h-modal-body> 1153 1154 <h-modal-footer> 1155 <button 1156 class="btn btn_secondary" 1157 @click=${this._cancel} 1158 > 1159 ${l("Cancel")} 1160 </button> 1161 <button 1162 class="btn btn_primary" 1163 @click=${this._save} 1164 > 1165 ${l("Save information")} 1166 </button> 1167 </h-modal-footer> 1168 </h-modal>`}}
1168qe([p()],Me.prototype,"address");qe([p()],Me.prototype,"addressMode");qe([p()],Me.prototype,"isLoggedIn");qe([u()],Me.prototype,"_formErrors");qe([u()],Me.prototype,"_isLoading");var In=Object.defineProperty,gt=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&In(e,t,s),s};class ze extends f{constructor(){super(),this._modal=P(),this._form=P(),this.address=null,this._formErrors=null,this._hasErrors=!1,this._isLoading=!0,this._cancel=async()=>{await this._modal.value?.close(),this._isLoading=!0},this._save=async e=>{this._formErrors=await this._addressController.saveAddressForm(async()=>this._form.value?.setShippingAddress(e)),this._formErrors===null&&this.close()},this._addressController=new _t}static{this.moduleName="shipping-address-modal"}async open(){await this._modal.value?.open(),this._isLoading=!1,this._form.value?.focusFirstInput(),this.eventBus.emit(new m(G.shippingAddressModalOpened,{modal:this,address:this.address}))}async close(){await this._modal.value?.close(),this._isLoading=!0}render(){return r` <h-modal 1169 ${I(this._modal)} 1170 hidden 1171 > 1172 <h-modal-header> 1173 <h2 class="font_semibold h2">${l("Order information")}</h2> 1174 <h-modal-close 1175 aria-label="${l("Close window")}" 1176 class="btn btn_icon" 1177 > 1178 <h-icon 1179 icon-name="icon-x" 1180 role="button" 1181 size="xl" 1182 clickable 1183 ></h-icon> 1184 </h-modal-close> 1185 </h-modal-header> 1186 <h-modal-body> 1187 <flash-messenger 1188 class="d-block mb-xs-2" 1189 name="shipping-address-modal" 1190 ></flash-messenger> 1191 1192 ${g(this._isLoading,()=>r`<div class="loader"> 1193 <div class="loader__spinner loader__spinner"></div> 1194 </div>`,()=>r`<shipping-address-form 1195 ${I(this._form)} 1196 .address=${this.address} 1197 .formErrors=${we.toJson(this._formErrors)} 1198 ></shipping-address-form>`)} 1199 </h-modal-body> 1200 1201 <h-modal-footer> 1202 <button 1203 class="btn btn_secondary" 1204 @click=${this._cancel} 1205 > 1206 ${l("Cancel")} 1207 </button> 1208 <button 1209 class="btn btn_primary" 1210 @click=${this._save} 1211 > 1212 ${l("Save information")} 1213 </button> 1214 </h-modal-footer> 1215 </h-modal>`}}gt([p()],ze.prototype,"address");gt([u()],ze.prototype,"_formErrors");gt([u()],ze.prototype,"_hasErrors");gt([u()],ze.prototype,"_isLoading");const Q="179";var wn=Object.defineProperty,X=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&wn(e,t,s),s};class W extends f{constructor(){super(),this.addressMode=Z.consumerAndCompany,this.address=null,this.isLoggedIn=!1,this.formErrors=null,this._reactiveFormRef=P(),this._postalCodeInputRef=P(),this._countrySelectRef=P(),this._formId=`form-${v()}`,this._emailId=`email-${v()}`,this._firstNameId=`first-name-${v()}`,this._lastNameId=`last-name-${v()}`,this._phoneId=`phone-${v()}`,this._countryId=`country-${v()}`,this._streetId=`street-${v()}`,this._postalCodeId=`postal-code-${v()}`,this._cityId=`city-${v()}`,this._taxId=`tax-${v()}`,this._companyName=`company-name-${v()}`,this._createUserAccountId=`create-user-account-${v()}`,this._allCountries=[],this._isCompany=!1,this._userEmail="",this._translations={},this._displayConsumerRadio=!1,this._displayCompanyRadio=!1,this._selectedCountryId=this.address?.countryId?String(this.address?.countryId):Q,this._isRegistrationEnabled=new It,this._isBuyingEnabledToUnregistered=new It,this._isRegistrationRequired=new It,this.setBillingAddress=async e=>{e.preventDefault();const t=await this.getFormValues();return t&&this.getFormState()!==Pe.validationFailed?this._basketAddressesApi.setBillingAddress({email:t.email,isCompany:this._isCompany,companyName:t.companyName,firstName:t.firstName,lastName:t.lastName,personalIdNumber:"",taxId:t.taxId,countryId:Number(t.countryId),city:t.city,postalCode:t.postalCode,street:t.street,street2:"",ph
1215one:t.phone,state:"",createUserAccount:t.createUserAccount==="1"}):!1},this.getFormValues=async()=>{const e=this.getFormService(),t=e.getFormControls();await e.validateControls({focusOnFirstInvalidField:!1});const i={};return t.forEach(s=>{s.type==="radio"?s.checked&&(i[s.name]=s.value):Ai.isDefined(s.value)&&(i[s.name]=s.value)}),i},this._storefrontSettings=this.getApiSync(L.api),this._basketAddressesApi=this.getApiSync("basketAddressesApi"),this._translationApi=this.getApiSync(J.api),this._orderApi=this.getApiSync(Re.api),this.getApi(hs.api).then(e=>{this._userApi=e,this._userApi.selectUser$().subscribe(t=>{t&&(this._userEmail=t.email)})}),this._setTranslations()}static{this.moduleName="billing-address-form"}_setTranslations(){const e="Only registered customers can place orders. {{ link }}Log in{{ linkEnd }} or create a new account by filling out this information.";this._translations[e]=this._translationApi.translate(e,{link:'<login-modal-opener class="link link_regular" tabindex="0" role="button">',linkEnd:"</login-modal-opener>",interpolation:{escapeValue:!1}})}connectedCallback(){super.connectedCallback();const e=this._storefrontSettings.getSkinSettings().locale.replace("_","-");this._allCountries=this._storefrontSettings.getCountries().map(t=>({value:String(t.id),content:this._translationApi.translate(t.name),selected:t.id==this.address?.countryId||!this.address&&t.id==179})).sort((t,i)=>t.content.localeCompare(i.content,e))}willUpdate(e){super.willUpdate(e),e.has("address")&&(this._selectedCountryId=this.address?.countryId?String(this.address.countryId):Q)}firstUpdated(e){super.firstUpdated(e),this._selectedCountryId=this.address?.countryId?String(this.address?.countryId):Q,this._orderApi.addOrderValidation(()=>document.querySelector("reactive-form")?.formService.getFormState()!==Pe.validationFailed,()=>{this.scrollIntoView()}),this._storefrontSettings.isFeatureEnabled("storefront_registration")?this._displayConsumerRadio=this._displayCompanyRadio=this.addressMode===Z.consumerAndCompany:(this._displayConsumerRadio=this.addressMode===Z.consumerAndCompany||this.addressMode===Z.consumerOnly,this._displayCompanyRadio=this.addressMode===Z.consumerAndCompany||this.addressMode===Z.companyOnly),this._isCompany=!!(this.address?.isCompany||this.addressMode===Z.companyOnly),this._basketAddressesApi.setIsCompany(this._isCompany),this._isRegistrationEnabled=this._storefrontSettings.selectSkinSettings$().pipe(A(({isRegistrationEnabled:t})=>t==="1"&&!this.isLoggedIn)),this._isBuyingEnabledToUnregistered=this._storefrontSettings.selectSkinSettings$().pipe(A(({isBuyingEnabledToUnregistered:t})=>t==="1"&&!this.isLoggedIn)),this._isRegistrationRequired=this._isBuyingEnabledToUnregistered.pipe(A(t=>!t))}updated(e){if(super.updated(e),this.formErrors){const t=we.fromJson(this.formErrors);if(t)for(const[i,s]of Object.entries(t))this.getFormService().updateFormControlByName(i,{errors:s})}}getFormService(){if(!this._reactiveFormRef.value)throw"No form found";return this._reactiveFormRef.value?.formService}getFormState(){return this.getFormService().getFormState()}async checkValidity(){try{return await this.getFormService().checkValidity()}catch{return!1}}focusFirstInput(){setTimeout(()=>{this._reactiveFormRef.value?.querySelector('input[type="text"]')?.focus()})}_renderMandatoryAccountCreationInfo(){return this._userApi?.getUser()?d:r` 1216 <div class="flash-message flash-message__info mb-xs-2"> 1217 <h-icon 1218 icon-name="icon-alert-triangle" 1219 css-classes="flash-message__icon" 1220 role="button" 1221 aria-hidden="true" 1222 ></h-icon> 1223 1224 <p> 1225 ${j(this._translations["Only registered customers can place orders. {{ link }}Log in{{ linkEnd }} or create a new account by filling out this information."])} 1226 </p> 1227 </div> 1228 `}_renderForm(){return r` <reactive-form ${I(this._reactiveFormRef)}> 1229 <form 1230 id=${this._formId} 1231 @submit=${this.setBillingAddress} 1232 > 1233 <div 1234 class="form__additional-info mt-xs-0" 1235 aria-hidden="true" 1236 > 1237 <i> 1238 ${l("Required fields are marked with")} -
1239 <span class="form__additional-info_secondary">*</span> 1240 </i> 1241 </div> 1242 1243 ${g(!this._storefrontSettings.isFeatureEnabled("storefront_registration")||this._displayCompanyRadio||this._displayConsumerRadio,()=>r` 1244 <control-connector 1245 requiredInGroup 1246 class="control control_row pt-xs-1" 1247 @change=${e=>{const t=e.target;t instanceof HTMLInputElement&&(this._isCompany=t.value==="true",this._basketAddressesApi.setIsCompany(this._isCompany))}} 1248 > 1249 ${g(this._displayConsumerRadio,()=>r`<h-control-content class="control__content_auto"> 1250 <h-control-element class="control__element"> 1251 <div class="radio-box"> 1252 <input 1253 type="radio" 1254 id="firstname1" 1255 name="isCompany" 1256 .checked=${!this._isCompany} 1257 value="false" 1258 class="radio-box__input" 1259 aria-label="${l("Consumer")}" 1260 /> 1261 1262 <label 1263 class="radio-box__label" 1264 for="firstname1" 1265 aria-hidden="true" 1266 > 1267 ${l("Consumer")} 1268 </label> 1269 </div> 1270 </h-control-element> 1271 1272 <control-errors></control-errors> 1273 </h-control-content>`,()=>d)} 1274 ${g(this._displayCompanyRadio,()=>r`<h-control-content class="control__content_auto"> 1275 <h-control-element class="control__element"> 1276 <div class="radio-box"> 1277 <input 1278 type="radio" 1279 id="firstname2" 1280 name="isCompany" 1281 .checked=${this._isCompany} 1282 value="true" 1283 class="radio-box__input" 1284 aria-label="${l("Company")}" 1285 /> 1286 1287 <label 1288 class="radio-box__label" 1289 for="firstname2" 1290 aria-hidden="true" 1291 > 1292 ${l("Company")} 1293 </label> 1294 </div> 1295 </h-control-element> 1296 1297 <control-errors></control-errors> 1298 </h-control-content>`,()=>d)} 1299 </control-connector> 1300 `)} 1301 1302 <control-connector 1303 min="3" 1304 email 1305 class="control" 1306 > 1307 <h-control> 1308 <h-control-label class="control__label"> 1309 <label 1310 class="label label_required" 1311 for=${this._emailId} 1312 >
1313 <span 1314 class="label__asterisk" 1315 aria-hidden="true" 1316 >*</span 1317 > 1318 ${l("E-mail address")} 1319 </label> 1320 </h-control-label> 1321 1322 <h-control-content class="control"> 1323 <h-control-element class="control__element"> 1324 <h-input 1325 controlId=${this._emailId} 1326 controlName="email" 1327 .value=${this.address?.email||this._userEmail} 1328 required 1329 > 1330 <h-input-control></h-input-control> 1331 </h-input> 1332 </h-control-element> 1333 1334 <control-errors></control-errors> 1335 </h-control-content> 1336 </h-control> 1337 </control-connector> 1338 1339 <control-connector 1340 required 1341 class="control" 1342 > 1343 <h-control> 1344 <h-control-label class="control__label"> 1345 <label 1346 class="label label_required" 1347 for=${this._firstNameId} 1348 > 1349 <span 1350 class="label__asterisk" 1351 aria-hidden="true" 1352 >*</span 1353 > 1354 ${l("First name")} 1355 </label> 1356 </h-control-label> 1357 1358 <h-control-content class="control"> 1359 <h-control-element class="control__element"> 1360 <h-input 1361 controlId=${this._firstNameId} 1362 controlName="firstName" 1363 .value=${this.address?.firstName} 1364 required 1365 > 1366 <h-input-control></h-input-control> 1367 </h-input> 1368 </h-control-element> 1369 1370 <control-errors></control-errors> 1371 </h-control-content> 1372 </h-control> 1373 </control-connector> 1374 1375 <control-connector 1376 required 1377 class="control" 1378 > 1379 <h-control> 1380 <h-control-label class="control__label"> 1381 <label 1382 class="label label_required" 1383 for=${this._lastNameId} 1384 > 1385 <span 1386 class="label__asterisk" 1387 aria-hidden="true" 1388 >*</span 1389 > 1390 ${l("Last name")} 1391 </label> 1392 </h-control-label> 1393 1394 <h-control-content class="control"> 1395 <h-control-element class="control__element"> 1396 <h-input 1397 controlId=${this._lastNameId} 1398 controlName="lastName" 1399 .value=${this.address?.lastName} 1400 required 1401 > 1402 <h-input-control></h-input-control> 1403 </h-input> 1404 </h-control-element> 1405 1406 <control-errors></control-errors> 1407 </h-control-content> 1408 </h-control> 1409 </control-connector> 1410 1411 ${g(this._isCompany,()=>r` <control-connector 1412 ?required=${this._isCompany} 1413 class="control" 1414 > 1415 <h-control> 1416 <h-control-label class="control__label"> 1417 <label 1418 class="label label_required" 1419 for=${this._taxId} 1420 >
1421 <span 1422 class="label__asterisk" 1423 aria-hidden="true" 1424 >*</span 1425 > 1426 ${l("Taxpayer Identification Number (TIN)")} 1427 </label> 1428 </h-control-label> 1429 1430 <h-control-content class="control"> 1431 <h-control-element class="control__element"> 1432 <h-input 1433 controlId=${this._taxId} 1434 controlName="taxId" 1435 .value=${this.address?.taxId} 1436 ?required=${this._isCompany} 1437 > 1438 <h-input-control></h-input-control> 1439 </h-input> 1440 </h-control-element> 1441 1442 <control-errors></control-errors> 1443 </h-control-content> 1444 </h-control> 1445 </control-connector> 1446 1447 <control-connector 1448 ?required=${this._isCompany} 1449 class="control" 1450 > 1451 <h-control> 1452 <h-control-label class="control__label"> 1453 <label 1454 class="label label_required" 1455 for=${this._companyName} 1456 > 1457 <span 1458 class="label__asterisk" 1459 aria-hidden="true" 1460 >*</span 1461 > 1462 ${l("Company name")} 1463 </label> 1464 </h-control-label> 1465 1466 <h-control-content class="control"> 1467 <h-control-element class="control__element"> 1468 <h-input 1469 controlId=${this._companyName} 1470 controlName="companyName" 1471 .value=${this.address?.companyName} 1472 ?required=${this._isCompany} 1473 > 1474 <h-input-control></h-input-control> 1475 </h-input> 1476 </h-control-element> 1477 1478 <control-errors></control-errors> 1479 </h-control-content> 1480 </h-control> 1481 </control-connector>`,()=>d)} 1482 1483 <control-connector 1484 required 1485 class="control" 1486 > 1487 <h-control> 1488 <h-control-label class="control__label"> 1489 <label 1490 class="label label_required" 1491 for=${this._phoneId} 1492 > 1493 <span 1494 class="label__asterisk" 1495 aria-hidden="true" 1496 >*</span 1497 > 1498 ${l("Phone number")} 1499 </label> 1500 </h-control-label> 1501 1502 <h-control-content class="control"> 1503 <h-control-element class="control__element"> 1504 <h-input 1505 controlId=${this._phoneId} 1506 controlName="phone" 1507 .value=${this.address?.phone} 1508 required 1509 > 1510 <h-input-control type="tel"></h-input-control> 1511 </h-input> 1512 </h-control-element> 1513 1514 <control-errors></control-errors> 1515 </h-control-content> 1516 </h-control> 1517 </control-connector> 1518 1519 <control-connector 1520 required 1521 class="control" 1522 > 1523 <h-control> 1524 <h-control-label class="control__label"> 1525 <label 1526 class="label label_required" 1527 for="${this._countryId}" 1528 id="${this._countryId}-label" 1529 >
1530 <span 1531 class="label__asterisk" 1532 aria-hidden="true" 1533 >*</span 1534 > 1535 ${l("Country")} 1536 </label> 1537 </h-control-label> 1538 1539 <h-control-content class="control"> 1540 <h-control-element class="control__element control__element_half"> 1541 <h-select 1542 @change=${e=>{const i=e.target?.selectedOptions?.[0]?.value;i&&(this._selectedCountryId=i),i===Q?this._postalCodeInputRef.value?.enableMask():this._postalCodeInputRef.value?.disableMask(),this._storefrontSettings.isFeatureEnabled("dev_storefront_address_form_save")&&this.getFormService()?.revalidateControlWhenReady(this._streetId)}} 1543 class="select" 1544 control-id=${this._countryId} 1545 control-name="countryId" 1546 no-deselect 1547 ${I(this._countrySelectRef)} 1548 .optionsList="${this._allCountries}" 1549 assistive-title-id="${this._countryId}-label" 1550 ?required=${this._storefrontSettings.isFeatureEnabled("dev_cached_select_options")} 1551 ?dev_cached_select_options=${this._storefrontSettings.isFeatureEnabled("dev_cached_select_options")} 1552 > 1553 <h-select-toggler 1554 class="select-toggler" 1555 aria-labelledby="${this._countryId}-label" 1556 > 1557 <span 1558 class="select-toggler__placeholder" 1559 slot="placeholder" 1560 >${l("Select")}</span 1561 > 1562 </h-select-toggler> 1563 </h-select> 1564 </h-control-element> 1565 1566 <control-errors></control-errors> 1567 </h-control-content> 1568 </h-control> 1569 </control-connector> 1570 1571 <control-connector 1572 ?streetWithNumber=${this._selectedCountryId===Q} 1573 ?required=${this._selectedCountryId!==Q} 1574 class="control" 1575 > 1576 <h-control> 1577 <h-control-label class="control__label"> 1578 <label 1579 class="label label_required" 1580 for=${this._streetId} 1581 > 1582 <span 1583 class="label__asterisk" 1584 aria-hidden="true" 1585 >*</span 1586 > 1587 ${l("Street name and house number")} 1588 </label> 1589 </h-control-label> 1590 1591 <h-control-content class="control"> 1592 <h-control-element class="control__element"> 1593 <h-input 1594 controlId=${this._streetId} 1595 controlName="street" 1596 .value=${this.address?.street} 1597 required 1598 > 1599 <h-input-control></h-input-control> 1600 </h-input> 1601 </h-control-element> 1602 1603 <control-errors></control-errors> 1604 </h-control-content> 1605 </h-control> 1606 </control-connector> 1607 1608 <control-connector 1609 required 1610 class="control" 1611 > 1612 <h-control> 1613 <h-control-label class="control__label"> 1614 <label 1615 class="label label_required" 1616 for=${this._postalCodeId} 1617 >
1618 <span 1619 class="label__asterisk" 1620 aria-hidden="true" 1621 >*</span 1622 > 1623 ${l("Postal code")} 1624 </label> 1625 </h-control-label> 1626 1627 <h-control-content class="control"> 1628 <h-control-element class="control__element control__element_quarter"> 1629 <h-input 1630 controlId=${this._postalCodeId} 1631 controlName="postalCode" 1632 .value=${this.address?.zipCode} 1633 required 1634 > 1635 <h-input-control 1636 @connected="${e=>{e.target===this._postalCodeInputRef.value&&setTimeout(()=>{this._selectedCountryId===Q?this._postalCodeInputRef.value?.enableMask():this._postalCodeInputRef.value?.disableMask()},50)}}" 1637 ${I(this._postalCodeInputRef)} 1638 mask="__-___" 1639 mask-disabled=${this._selectedCountryId!==Q||d} 1640 pattern="^(\\d{2})(-)(\\d{3})$" 1641 valid-pattern="00-000" 1642 ></h-input-control> 1643 </h-input> 1644 </h-control-element> 1645 1646 <control-errors></control-errors> 1647 </h-control-content> 1648 </h-control> 1649 </control-connector> 1650 1651 <control-connector 1652 required 1653 class="control" 1654 > 1655 <h-control> 1656 <h-control-label class="control__label"> 1657 <label 1658 class="label label_required" 1659 for=${this._cityId} 1660 > 1661 <span 1662 class="label__asterisk" 1663 aria-hidden="true" 1664 >*</span 1665 > 1666 ${l("City")} 1667 </label> 1668 </h-control-label> 1669 1670 <h-control-content class="control"> 1671 <h-control-element class="control__element"> 1672 <h-input 1673 controlId=${this._cityId} 1674 controlName="city" 1675 .value=${this.address?.city} 1676 required 1677 > 1678 <h-input-control></h-input-control> 1679 </h-input> 1680 </h-control-element> 1681 1682 <control-errors></control-errors> 1683 </h-control-content> 1684 </h-control> 1685 </control-connector> 1686 1687 ${F(this._isRegistrationEnabled,r` <control-connector 1688 class="control" 1689 ?required=${$(this._isRegistrationRequired)} 1690 > 1691 <h-control> 1692 <h-control-content class="control"> 1693 <h-control-element class="control__element"> 1694 <h-checkbox 1695 controlId=${this._createUserAccountId} 1696 controlName="createUserAccount" 1697 value="1" 1698 ?required=${$(this._isRegistrationRequired)} 1699 > 1700 <h-checkbox-control></h-checkbox-control> 1701 1702 <h-checkbox-content> 1703 ${F(this._isBuyingEnabledToUnregistered,r`<span slot="label">${l("I want to create an account in the store")}</span>`,r`
1704 <span 1705 slot="label" 1706 class="label_required" 1707 > 1708 <span 1709 class="label__asterisk" 1710 aria-hidden="true" 1711 >*</span 1712 > 1713 ${l("I want to create an account in the store")} 1714 </span> 1715 `)} 1716 1717 <div slot="description"> 1718 <p class="p_no-margin"> 1719 ${F(this._isBuyingEnabledToUnregistered,r`${l("Optional")}`,d)} 1720 </p> 1721 <p class="p_no-margin"> 1722 ${l("You will receive a link to create a password by e-mail.")} 1723 </p> 1724 </p> 1725 </h-checkbox-content> 1726 </h-checkbox> 1727 </h-control-element> 1728 1729 <control-errors></control-errors> 1730 </h-control-content> 1731 </h-control> 1732 </control-connector>`,d)} 1733 </form> 1734 </reactive-form>`}render(){return r` 1735 ${F(this._isBuyingEnabledToUnregistered,d,this._renderMandatoryAccountCreationInfo())} ${this._renderForm()} 1736 `}}X([p()],W.prototype,"addressMode");X([p()],W.prototype,"address");X([p()],W.prototype,"isLoggedIn");X([p({type:Object})],W.prototype,"formErrors");X([u()],W.prototype,"_allCountries");X([u()],W.prototype,"_isCompany");X([u()],W.prototype,"_userEmail");X([u()],W.prototype,"_translations");X([u()],W.prototype,"_displayConsumerRadio");X([u()],W.prototype,"_displayCompanyRadio");X([u()],W.prototype,"_selectedCountryId");var En=Object.defineProperty,yt=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&En(e,t,s),s};class He extends f{constructor(){super(),this.address=null,this.isLoggedIn=!1,this.formErrors=null,this._selectedCountryId=Q,this._reactiveFormRef=P(),this._postalCodeInputRef=P(),this._countrySelectRef=P(),this._formId=`form-${v()}`,this._firstNameId=`first-name-${v()}`,this._lastNameId=`last-name-${v()}`,this._phoneId=`phone-${v()}`,this._countryId=`country-${v()}`,this._streetId=`street-${v()}`,this._postalCodeId=`postal-code-${v()}`,this._cityId=`city-${v()}`,this._companyName=`company-name-${v()}`,this._getCountriesList$=()=>this._basketShippingsApi.selectAvailableShippingCountries$().pipe(A(e=>{const t=e.map(s=>({value:String(s.id),content:s.name,selected:String(s.id)===this._selectedCountryId}
1736));return!t.some(s=>s.selected)&&t.length>0&&(t[0].selected=!0,this._selectedCountryId=t[0].value),t})),this.setShippingAddress=async e=>{e.preventDefault();const t=await this.getFormValues();return t&&this.getFormState()!==Pe.validationFailed?this._basketAddressesApi.setShippingAddress({isCompany:!1,companyName:t.companyName,firstName:t.firstName,lastName:t.lastName,personalIdNumber:"",taxId:"",countryId:Number(t.countryId),city:t.city,postalCode:t.postalCode,street:t.street,street2:"",phone:t.phone,state:"",createUserAccount:!1}):!1},this.getFormValues=async()=>{const e=this.getFormService(),t=e.getFormControls();await e.validateControls({focusOnFirstInvalidField:!1});const i={};return t.forEach(s=>{s.value===null||s.value===void 0||(s.type==="radio"?s.checked&&(i[s.name]=s.value):i[s.name]=s.value)}),i},this._storefrontSettings=this.getApiSync(L.api),this._basketAddressesApi=this.getApiSync("basketAddressesApi"),this._basketShippingsApi=this.getApiSync(Ce.api),this._orderApi=this.getApiSync(Re.api)}static{this.moduleName="shipping-address-form"}firstUpdated(e){super.firstUpdated(e),this._selectedCountryId=this.address?.countryId?String(this.address?.countryId):this._selectedCountryId,this._orderApi.addOrderValidation(()=>document.querySelector("reactive-form")?.formService.getFormState()!==Pe.validationFailed,()=>{this.scrollIntoView()})}updated(e){if(super.updated(e),this.formErrors){const t=we.fromJson(this.formErrors);if(t)for(const[i,s]of Object.entries(t))this.getFormService().updateFormControlByName(i,{errors:s})}}getFormService(){if(!this._reactiveFormRef.value)throw"No form found";return this._reactiveFormRef.value?.formService}getFormState(){return this.getFormService().getFormState()}async checkValidity(){try{return await this.getFormService().checkValidity()}catch{return!1}}focusFirstInput(){setTimeout(()=>{this._reactiveFormRef.value?.querySelector('input[type="text"]')?.focus()})}render(){return r` <reactive-form ${I(this._reactiveFormRef)}> 1737 <form 1738 id=${this._formId} 1739 @submit=${this.setShippingAddress} 1740 > 1741 <div 1742 class="form__additional-info mt-xs-0" 1743 aria-hidden="true" 1744 > 1745 <i> 1746 ${l("Required fields are marked with")} - 1747 <span class="form__additional-info_secondary">*</span> 1748 </i> 1749 </div> 1750 1751 <control-connector 1752 required 1753 class="control" 1754 > 1755 <h-control> 1756 <h-control-label class="control__label"> 1757 <label 1758 class="label label_required" 1759 for=${this._firstNameId} 1760 > 1761 <span 1762 class="label__asterisk" 1763 aria-hidden="true" 1764 >*</span 1765 > 1766 ${l("First name")} 1767 </label> 1768 </h-control-label> 1769 1770 <h-control-content class="control"> 1771 <h-control-element class="control__element"> 1772 <h-input 1773 controlId=${this._firstNameId} 1774 controlName="firstName" 1775 .value=${this.address?.firstName} 1776 > 1777 <h-input-control></h-input-control> 1778 </h-input> 1779 </h-control-element> 1780 1781 <control-errors></control-errors> 1782 </h-control-content> 1783 </h-control> 1784 </control-connector> 1785 1786 <control-connector 1787 required 1788 class="control" 1789 > 1790 <h-control> 1791 <h-control-label class="control__label"> 1792 <label 1793 class="label label_required" 1794 for=${this._lastNameId} 1795 >
1796 <span 1797 class="label__asterisk" 1798 aria-hidden="true" 1799 >*</span 1800 > 1801 ${l("Last name")} 1802 </label> 1803 </h-control-label> 1804 1805 <h-control-content class="control"> 1806 <h-control-element class="control__element"> 1807 <h-input 1808 controlId=${this._lastNameId} 1809 controlName="lastName" 1810 .value=${this.address?.lastName} 1811 > 1812 <h-input-control></h-input-control> 1813 </h-input> 1814 </h-control-element> 1815 1816 <control-errors></control-errors> 1817 </h-control-content> 1818 </h-control> 1819 </control-connector> 1820 1821 <control-connector class="control"> 1822 <h-control> 1823 <h-control-label class="control__label"> 1824 <label 1825 class="label" 1826 for=${this._companyName} 1827 >${l("Company name")}</label 1828 > 1829 </h-control-label> 1830 1831 <h-control-content class="control"> 1832 <h-control-element class="control__element"> 1833 <h-input 1834 controlId=${this._companyName} 1835 controlName="companyName" 1836 .value=${this.address?.companyName} 1837 > 1838 <h-input-control></h-input-control> 1839 </h-input> 1840 </h-control-element> 1841 1842 <control-errors></control-errors> 1843 </h-control-content> 1844 </h-control> 1845 </control-connector> 1846 1847 <control-connector 1848 required 1849 class="control" 1850 > 1851 <h-control> 1852 <h-control-label class="control__label"> 1853 <label 1854 class="label label_required" 1855 for=${this._phoneId} 1856 > 1857 <span 1858 class="label__asterisk" 1859 aria-hidden="true" 1860 >*</span 1861 > 1862 ${l("Phone number")} 1863 </label> 1864 </h-control-label> 1865 1866 <h-control-content class="control"> 1867 <h-control-element class="control__element"> 1868 <h-input 1869 controlId=${this._phoneId} 1870 controlName="phone" 1871 .value=${this.address?.phone} 1872 > 1873 <h-input-control type="tel"></h-input-control> 1874 </h-input> 1875 </h-control-element> 1876 1877 <control-errors></control-errors> 1878 </h-control-content> 1879 </h-control> 1880 </control-connector> 1881 1882 <control-connector 1883 required 1884 class="control" 1885 > 1886 <h-control> 1887 <h-control-label class="control__label"> 1888 <label 1889 class="label label_required" 1890 for="${this._countryId}" 1891 id="${this._countryId}-label" 1892 >
1893 <span 1894 class="label__asterisk" 1895 aria-hidden="true" 1896 >*</span 1897 > 1898 ${l("Country")} 1899 </label> 1900 </h-control-label> 1901 1902 <h-control-content class="control"> 1903 <h-control-element class="control__element"> 1904 <shipping-address-country-select 1905 ${I(this._countrySelectRef)} 1906 @enableMask="${()=>{this._postalCodeInputRef.value?.enableMask()}}" 1907 @disableMask="${()=>{this._postalCodeInputRef.value?.disableMask()}}" 1908 @change="${()=>{const e=this._countrySelectRef.value?.getSelectedValue();e&&(this._selectedCountryId=e,this._storefrontSettings.isFeatureEnabled("dev_storefront_address_form_save")&&this.getFormService()?.revalidateControlWhenReady(this._streetId))}}" 1909 .address=${this.address} 1910 .countries="${$(this._getCountriesList$())}" 1911 aria-labelledby="${this._countryId}-label" 1912 ></shipping-address-country-select> 1913 </h-control-element> 1914 1915 <control-errors></control-errors> 1916 </h-control-content> 1917 </h-control> 1918 </control-connector> 1919 <control-connector 1920 ?streetWithNumber=${this._selectedCountryId===Q} 1921 ?required=${this._selectedCountryId!==Q} 1922 class="control" 1923 > 1924 <h-control> 1925 <h-control-label class="control__label"> 1926 <label 1927 class="label label_required" 1928 for=${this._streetId} 1929 > 1930 <span 1931 class="label__asterisk" 1932 aria-hidden="true" 1933 >*</span 1934 > 1935 ${l("Street name and house number")} 1936 </label> 1937 </h-control-label> 1938 1939 <h-control-content class="control"> 1940 <h-control-element class="control__element"> 1941 <h-input 1942 controlId=${this._streetId} 1943 controlName="street" 1944 .value=${this.address?.street} 1945 > 1946 <h-input-control></h-input-control> 1947 </h-input> 1948 </h-control-element> 1949 1950 <control-errors></control-errors> 1951 </h-control-content> 1952 </h-control> 1953 </control-connector> 1954 1955 <control-connector 1956 required 1957 class="control" 1958 > 1959 <h-control> 1960 <h-control-label class="control__label"> 1961 <label 1962 class="label label_required" 1963 for=${this._postalCodeId} 1964 > 1965 <span 1966 class="label__asterisk" 1967 aria-hidden="true" 1968 >*</span 1969 > 1970 ${l("Postal code")} 1971 </label> 1972 </h-control-label> 1973 1974 <h-control-content class="control"> 1975 <h-control-element class="control__element control__element_half"> 1976 <h-input 1977 controlId=${this._postalCodeId} 1978 controlName="postalCode" 1979 .value=${this.address?.zipCode} 1980 > 1981 <h-input-control 1982 @connected="${e=>{e.target===this._postalCodeInputRef.value&&setTimeout(()=>{this._countrySelectRef.value?.getSelectedValue?.()==="179"?this._postalCodeInputRef.value?.enableMask():this._postalCodeInputRef.value?.disableMask()},50)}}" 1983 ${I(this._postalCodeInputRef)} 1984 mask="__-___" 1985 mask-disabled=${this._countrySelectRef.value?.getSelectedValue?.()!=="179"||d} 1986 pattern="^(\\d{2})(-)(\\d{3})$" 1987 valid-pattern="00-000" 1988 ></h-input-control> 1989 </h-input> 1990 </h-control-element> 1991 1992 <control-errors></control-errors> 1993 </h-control-content> 1994 </h-control> 1995 </control-connector> 1996 1997 <control-connector 1998 required 1999 class="control" 2000 > 2001 <h-control> 2002 <h-control-label class="control__label"> 2003 <label 2004 class="label label_required" 2005 for=${this._cityId} 2006 >
2007 <span 2008 class="label__asterisk" 2009 aria-hidden="true" 2010 >*</span 2011 > 2012 ${l("City")} 2013 </label> 2014 </h-control-label> 2015 2016 <h-control-content class="control"> 2017 <h-control-element class="control__element"> 2018 <h-input 2019 controlId=${this._cityId} 2020 controlName="city" 2021 .value=${this.address?.city} 2022 > 2023 <h-input-control></h-input-control> 2024 </h-input> 2025 </h-control-element> 2026 2027 <control-errors></control-errors> 2028 </h-control-content> 2029 </h-control> 2030 </control-connector> 2031 </form> 2032 </reactive-form>`}}yt([p()],He.prototype,"address");yt([p()],He.prototype,"isLoggedIn");yt([p({type:Object})],He.prototype,"formErrors");yt([u()],He.prototype,"_selectedCountryId");var Bn=Object.defineProperty,xn=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&Bn(e,t,s),s};class Bs extends f{constructor(){super(...arguments),this._modal=P(),this.shippings=[],this._close=()=>{this.close()}}static{this.moduleName="shipping-list-modal"}connectedCallback(){super.connectedCallback(),window.addEventListener("shippingSelected",this._close)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("shippingSelected",this._close)}open(){this._modal.value?.open()}close(){this._modal.value?.close()}render(){return r`<h-modal 2033 ${I(this._modal)} 2034 hidden 2035 > 2036 <h-modal-header> 2037 <b class="font_semibold">${l("Select a delivery method")}</b> 2038 <h-modal-close 2039 aria-label="${l("Close window")}" 2040 class="btn btn_icon" 2041 > 2042 <h-icon 2043 icon-name="icon-x" 2044 role="button" 2045 size="xl" 2046 clickable 2047 ></h-icon> 2048 </h-modal-close> 2049 </h-modal-header> 2050 <h-modal-body> 2051 <div class="pb-xs-4"> 2052 <basket-shippings-list 2053 is-simple="true" 2054 .shippings=${this.shippings} 2055 ></basket-shippings-list> 2056 </div> 2057 </h-modal-body> 2058 </h-modal>`}}xn([p()],Bs.prototype,"shippings");const Mn="basket-additional-informations";class Fn{constructor({basketOverallApi:e}){this._changeComment$=new li,this._changeComment$.pipe(k(),A(t=>t.target?.value)).subscribe(async t=>{await e.setComment(t)})}changeComment(e){this._changeComment$.next(e)}}class Tn extends f{constructor(){super(),this._commentId=`comment-${v()}`,this._basketOverallApi=this.getApiSync(H.api),this._controller=new Fn({basketOverallApi:this._basketOverallApi})}static{this.moduleName=Mn}render(){return r` 2059 <h-control> 2060 <h-control-label class="control__label"> 2061 <label 2062 class="label" 2063 for=${this._commentId} 2064 >${l("Order notes")}</label 2065 > 2066 </h-control-label> 2067 2068 <h-control-content class="control"> 2069 <h-control-element class="control__element"> 2070 <h-textarea 2071 controlId=${this._commentId} 2072 controlName="comment" 2073 @change=${e=>this._controller.changeComment(e)} 2074 .value=${$(this._basketOverallApi.selectComment$())} 2075 > 2076 <h-textarea-control></h-textarea-control> 2077 </h-textarea> 2078 </h-control-element> 2079 2080 <control-errors></control-errors> 2081 </h-control-content> 2082 </h-control> 2083 `}}var On=Object.defineProperty,xs=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&On(e,t,s),s};class Ut extends f{constructor(){super(...arguments),this._modal=P(),this.payments=[],this.ctaPaymentLabel=""}static{this.moduleName="payments-list-modal"}open(){this._modal.value?.open()}close(){this._modal.value?.close()}
2083render(){return r`<h-modal 2084 class="modal-wrapper_l modal_payment-list" 2085 ${I(this._modal)} 2086 hidden 2087 > 2088 <h-modal-header> 2089 <h2 class="font_semibold h2"> 2090 ${g(this.ctaPaymentLabel.length>0,()=>r`${this.ctaPaymentLabel}`,()=>r`${l("Select payment bank or service")}`)} 2091 </h2> 2092 <h-modal-close 2093 aria-label="${l("Close window")}" 2094 class="btn btn_icon" 2095 > 2096 <h-icon 2097 icon-name="icon-x" 2098 role="button" 2099 size="xl" 2100 clickable 2101 ></h-icon> 2102 </h-modal-close> 2103 </h-modal-header> 2104 <h-modal-body> 2105 <payments-list-options 2106 .payments=${this.payments} 2107 .onPaymentSet=${()=>this.close()} 2108 ></payments-list-options> 2109 </h-modal-body> 2110 </h-modal>`}}xs([p()],Ut.prototype,"payments");xs([p()],Ut.prototype,"ctaPaymentLabel");var Ln=Object.defineProperty,Nn=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&Ln(e,t,s),s};class Ms extends f{constructor(){super(...arguments),this.payments=[]}static{this.moduleName="payments-list-popular"}render(){return r`<payments-list-options .payments=${this.payments}></payments-list-options>`}}Nn([p()],Ms.prototype,"payments");var Vn=Object.defineProperty,Fs=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&Vn(e,t,s),s};class Gt extends f{constructor(){super(),this.payments=[],this.onPaymentSet=()=>{},this._basketPaymentsApi=this.getApiSync(Ie.api)}static{this.moduleName="payments-list-options"}_setPayment(e){this._basketPaymentsApi.setPayment(e),this.eventBus.emit(new m(G.paymentChosenByUser)),this.onPaymentSet()}render(){return this.payments.length===0?d:r`<div class="payments-channels-list pb-xs-4"> 2111 ${this.payments.map(e=>r`<div 2112 @click=${()=>{this._setPayment(e)}} 2113 class="${ee({"payment-channel":!0,"payment-channel_selected":e.isSelected})}" 2114 > 2115 ${g(e.image,()=>r`<figure class="payment-channel__image"> 2116 <img 2117 alt="${e.name}" 2118 src="${e.image}" 2119 width="200" 2120 height="70" 2121 /> 2122 </figure> `,()=>r`<p>${e.name}</p>`)} 2123 </div>`)} 2124 </div>`}}Fs([p({attribute:!1})],Gt.prototype,"payments");Fs([p({attribute:!1})],Gt.prototype,"onPaymentSet");var Rn=Object.defineProperty,Ts=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&Rn(e,t,s),s};class qt extends f{constructor(){super(),this._additionalFields=[],this._flashMessengerRef=P(),this._isValid=!0,this._storefrontSettings=this.getApiSync(L.api),this._basketOverallApi=this.getApiSync(H.api),this._basketAddressesApi=this.getApiSync("basketAddressesApi"),this._basketAdditionalFieldsApi=this.getApiSync(cs.api),this._flashMessengerApi=this.getApiSync(ae.api),this._basketAdditionalFieldsApi.select$().pipe(A(t=>Object.values(t).reduce((s,a)=>[...s,...a],[]).sort((s,a)=>s.order-a.order))).subscribe(t=>{this._additionalFields=t}),this._canChangeAdditionalFields$=this._basketOverallApi.selectActions$().pipe(A(t=>t.changeAdditionalFields===void 0)),this._isCompany$=this._basketAddressesApi.selectIsCompany$(),this._isCompany$.subscribe(t=>{if(t||!this._storefrontSettings.isFeatureEnabled("dev_vat_eu_visibility_fix"))return;const i=this._additionalFields.find(s=>s instanceof Ze&&s.id==="vat_eu");i?.isChecked&&this._basketAdditionalFieldsApi.change(i.id,"0")}),this._basketAdditionalFieldsApi.selectSectionValidation$().subscribe(({isValid:t})=>{t?this.classList.remove("basket-module_error"):(this.classList.add("basket-module_error"),this.scrollIntoView()),this._isValid=t}),this._basketAdditionalFieldsApi.selectSectionValidation$().subscribe(({isValid:t,validationMessage:i})=>{if(!i)return;const s="basket-additional-fields";if(t){this._flashMessengerApi.removeAllFlashMessages(s);return}this._flashMessengerApi.addFlashMessage({content:i,type:z.error,isCloseable:!1,timeout:0},s),this._flashMessengerRef.value?.focus()})}static{this.moduleName="basket-additional-fields"}
2124_renderSelect(e){return r` 2125 <h-control class="control"> 2126 <h-control-label class="control__label"> 2127 <label 2128 class="${ee({label:!0,label_required:e.isRequired})}" 2129 for=${`additional_${e.id}`} 2130 id="additional_${e.id}-label" 2131 > 2132 ${e.isRequired?r`<span 2133 class="label__asterisk" 2134 aria-hidden="true" 2135 >*</span 2136 >`:d} 2137 ${j(e.description)} 2138 </label> 2139 </h-control-label> 2140 2141 <h-control-content class="control"> 2142 <h-control-element class="control__element"> 2143 <h-select 2144 class="select" 2145 @change=${t=>{const s=t.target.selectedOptions[0]?.value||null;this._basketAdditionalFieldsApi.change(e.id,s)}} 2146 control-id=${`additional_${e.id}`} 2147 control-name=${`additional_${e.id}`} 2148 ?disabled=${$(this._canChangeAdditionalFields$)} 2149 ?required=${e.isRequired} 2150 assistive-title-id="additional_${e.id}-label" 2151 > 2152 <h-select-toggler 2153 class="select-toggler" 2154 aria-labelledby="additional_${e.id}-label" 2155 > 2156 <span 2157 class="select-toggler__placeholder" 2158 slot="placeholder" 2159 >${l("Select")}</span 2160 > 2161 </h-select-toggler> 2162 2163 ${$e(e.options,t=>t.value,t=>r` <h-option 2164 slot="content" 2165 value=${t.value} 2166 id="additional_${e.id}_${t.value}" 2167 ?selected=${t.isSelected} 2168 > 2169 <h-option-content>${t.label}</h-option-content> 2170 </h-option>`)} 2171 </h-select> 2172 </h-control-element> 2173 </h-control-content> 2174 </h-control> 2175 `}_renderDescription(e){return r` <p class="font_size-s">${j(e.description)}</p>`}_renderCheckbox(e){return r` 2176 <h-control class="control"> 2177 <h-control-content class="control"> 2178 <h-control-element class="control__element"> 2179 <h-checkbox 2180 @change=${async t=>{if(t.isTrusted){const s=t.target.checked?"1":"0";await this._basketAdditionalFieldsApi.change(e.id,s)}}} 2181 controlId=${`additional_${e.id}`} 2182 controlName=${`additional_${e.id}`} 2183 ?checked=${e.isChecked} 2184 value="1" 2185 ?disabled=${$(this._canChangeAdditionalFields$)} 2186 ?required=${e.isRequired} 2187 > 2188 <h-checkbox-control></h-checkbox-control> 2189 2190 <h-checkbox-content> 2191 <span 2192 class="${ee({label_required:e.isRequired})}" 2193 slot="label" 2194 > 2195 ${e.isRequired?r`<span 2196 class="label__asterisk" 2197 aria-hidden="true" 2198 >*</span 2199 >`:d} 2200 ${j(e.description)} 2201 </span> 2202 </h-checkbox-content> 2203 </h-checkbox> 2204 </h-control-element> 2205 </h-control-content> 2206 </h-control> 2207 `}_renderCheckboxVatEU(e){return r` 2208 <h-control 2209 class="control" 2210 ?hidden=${$(this._isCompany$.pipe(A(t=>!t)))} 2211 > 2212 <h-control-content class="control"> 2213 <h-control-element class="control__element"> 2214 <h-checkbox 2215 @change=${async t=>{if(t.isTrusted){const s=t.target.checked?"1":"0";await this._basketAdditionalFieldsApi.change(e.id,s)}}} 2216 controlId=${`additional_${e.id}`} 2217 controlName=${`additional_${e.id}`} 2218 ?checked=${e.isChecked} 2219 value="1" 2220 ?disabled=${$(this._canChangeAdditionalFields$)} 2221 ?required=${e.isRequired} 2222 > 2223 <h-checkbox-control></h-checkbox-control> 2224 2225 <h-checkbox-content>
2226 <span 2227 class="${ee({label_required:e.isRequired})}" 2228 slot="label" 2229 > 2230 ${e.isRequired?r`<span 2231 class="label__asterisk" 2232 aria-hidden="true" 2233 >*</span 2234 >`:d} 2235 ${j(e.description)} 2236 </span> 2237 </h-checkbox-content> 2238 </h-checkbox> 2239 </h-control-element> 2240 </h-control-content> 2241 </h-control> 2242 `}_renderCheckboxNewsletter(e){return r` 2243 <h-control class="control"> 2244 <h-control-content class="control"> 2245 <h-control-element class="control__element"> 2246 <h-checkbox 2247 @change=${async t=>{if(t.isTrusted){const s=t.target.checked?"1":"0";await this._basketAdditionalFieldsApi.change(e.id,s)}}} 2248 controlId=${`additional_${e.id}`} 2249 controlName=${`additional_${e.id}`} 2250 ?checked=${e.isChecked} 2251 value="1" 2252 ?disabled=${$(this._canChangeAdditionalFields$)} 2253 ?required=${e.isRequired} 2254 > 2255 <h-checkbox-control></h-checkbox-control> 2256 2257 <h-checkbox-content> 2258 <span 2259 class="${ee({label_required:e.isRequired})}" 2260 slot="label" 2261 > 2262 ${e.isRequired?r`<span 2263 class="label__asterisk" 2264 aria-hidden="true" 2265 >*</span 2266 >`:d} 2267 ${j(e.label)} 2268 </span> 2269 2270 <span slot="description">${j(e.description)}</span> 2271 </h-checkbox-content> 2272 </h-checkbox> 2273 </h-control-element> 2274 </h-control-content> 2275 </h-control> 2276 `}_renderTextInput(e){return r` 2277 <h-control class="control"> 2278 <h-control-label class="control__label"> 2279 <label 2280 class="${ee({label:!0,label_required:e.isRequired})}" 2281 for=${`additional_${e.id}`} 2282 > 2283 ${e.isRequired?r`<span 2284 class="label__asterisk" 2285 aria-hidden="true" 2286 >*</span 2287 >`:d} 2288 ${j(e.description)} 2289 </label> 2290 </h-control-label> 2291 2292 <h-control-content class="control"> 2293 <h-control-element class="control__element"> 2294 <h-input 2295 @change=${t=>{if(t.isTrusted){const i=t.target;this._basketAdditionalFieldsApi.change(e.id,i.value)}}} 2296 controlId=${`additional_${e.id}`} 2297 controlName=${`additional_${e.id}`} 2298 value=${e.value} 2299 ?disabled=${$(this._canChangeAdditionalFields$)} 2300 > 2301 <h-input-control></h-input-control> 2302 </h-input> 2303 </h-control-element> 2304 </h-control-content> 2305 </h-control> 2306 `}_renderHiddenInput(e){return r` 2307 <h-input 2308 @change=${t=>{const i=t.target;this._basketAdditionalFieldsApi.change(e.id,i.value)}} 2309 type="hidden" 2310 controlId=${`additional_${e.id}`} 2311 controlName=${`additional_${e.id}`} 2312 value=${e.value} 2313 ?disabled=${$(this._canChangeAdditionalFields$)} 2314 > 2315 <h-input-control type="hidden"></h-input-control> 2316 </h-input> 2317 `}_renderFileInput(e){return r` <h-control class="control"> 2318 <h-control-label class="control__label"> 2319 <label 2320 class="${ee({label:!0,label_required:e.isRequired})}" 2321 for=${`additional_${e.id}`} 2322 > 2323 ${e.isRequired?r`<span 2324 class="label__asterisk" 2325 aria-hidden="true" 2326 >*</span 2327 >`:d} 2328 ${j(e.description)} 2329 </label> 2330 </h-control-label> 2331 2332 <h-control-content class="control"> 2333 <h-control-element class="control__element"> 2334 <h-file-picker 2335 @change=${async t=>{this._uploadFile(t,e)}} 2336 ?required=${e.isRequired} 2337 class="file-picker" 2338 control-id="${`additional_${e.id}`}" 2339 control-name="${`additional_${e.id}`}" 2340 label-text="${l("Upload file")}" 2341 files="" 2342 ></h-file-picker> 2343 </h-control-element> 2344 </h-control-content> 2345 </h-control>`}async _uploadFile(e,t){const i=e.target,{files:s}=i,a=s?s[0]:null;if(a){const o=await this._basketAdditionalFieldsApi.upload(t,a);o&&o.isError===!1&&this._basketAdditionalFieldsApi.change(t.id,{fileKey:o.fileKey,fileName:a.name})}else this._basketAdditionalFieldsApi.change(t.id,null)}_renderAdditionalField(e){return e instanceof mi?this._renderSelect(e):e instanceof _i?this._renderDescription(e):this._storefrontSettings.isFeatureEnabled("dev_vat_eu_visibility_fix")&&e.id==="vat_eu"&&e instanceof Ze?this._renderCheckboxVatEU(e):e.id==="newsletter"&&e instanceof Ze?this._renderCheckboxNewsletter(e):e instanceof Ze?this._renderCheckbox(e):e instanceof gi?this._renderTextInput(e):e instanceof yi?this._renderHiddenInput(e):e instanceof bi?this._renderFileInput(e):d}render(){return r` <div class="basket-module__content"> 2346 <flash-messenger 2347 ${I(this._flashMessengerRef)} 2348 class="d-block mb-xs-2" 2349 name="basket-additional-fields" 2350 tabindex="-1" 2351 ></flash-messenger> 2352 2353 <h2 class="section-title section-title_s mb-xs-2">${l("Consents and additional fields")}</h2> 2354 2355 <form class="form"> 2356 ${$e(this._additionalFields,e=>e.id,e=>this._renderAdditionalField(e))} 2357 </form> 2358 </div>`}}Ts([u()],qt.prototype,"_additionalFields");
2358Ts([u()],qt.prototype,"_isValid");var Dn=Object.defineProperty,R=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&Dn(e,t,s),s};class V extends f{constructor(){super(),this.url="",this._productName="",this._hasOptions=!1,this._options=[],this._productImage="",this._quantity=0,this._unit="",this._productPrice="",this._productVat="",this._productLikeAdded="",this._basketPositions=0,this._basketPricesSum="",this._hasSpecialOffer=!1,this._shouldDisplayProductVat=!1,this._shouldDisplayBasketVat=!1,this._isLoyalty=!1,this._isBundle=!1,this._modal=P(),this.eventBus.on(S.itemAddedToBasket,({body:e})=>{if(!e)return;const{addedItem:t,product:i,basket:s,showAddedModal:a}=e;!i||!a||(this.open(),this._productName=i.name,this._hasOptions=i?.hasOptions,this._options=i?.options,this._productImage=i.image.paths.webp,this._quantity=t.addedQuantity,this._unit=i.unit.name,this._productPrice=i.price.grossValueFormatted,this._productVat=i.price.taxFormatted,this._productLikeAdded=i.quantity.toString(),this._productLoyaltyPointsCost=i.loyaltyPointsCost?.pointsFormatted,this._productLoyaltyPointsExchangePrice=i.loyaltyPointsExchangePrice?.grossValueFormatted,this._basketPositions=s.products.positions,this._basketPricesSum=s.products.discountedSum?.grossValueFormatted||s.products.sum?.grossValueFormatted||"",this._basketLoyaltyPointsCost=s.loyaltyPointsCost?.pointsFormatted,this._hasSpecialOffer=i.isSpecialOffer,this._isLoyalty=i.isExchangedWithLoyaltyPoints,this._shouldDisplayProductVat=i.isExchangedWithLoyaltyPoints&&!!i.loyaltyPointsExchangePrice||!i.isExchangedWithLoyaltyPoints,this._shouldDisplayBasketVat=s.sum.grossValue>0,this._isBundle=i.isBundle)})}static{this.moduleName="added-to-basket-modal"}open(){this._modal.value?.open()}render(){return r` 2359 <h-modal 2360 ${I(this._modal)} 2361 id="after_added_to_basket" 2362 class="added-to-basket-modal__container" 2363 > 2364 <h-modal-header> 2365 <h2 class="modal__title">${l("Added to cart")}</h2> 2366 2367 <h-modal-close 2368 aria-label="${l("Close window")}" 2369 class="btn btn_icon" 2370 > 2371 <h-icon 2372 icon-name="icon-x" 2373 role="button" 2374 size="xl" 2375 clickable 2376 ></h-icon> 2377 </h-modal-close> 2378 </h-modal-header> 2379 <h-modal-body class="added-to-basket-modal__h-modal-paddings"> 2380 <figure class="align_center"> 2381 <img 2382 class="added-to-basket-modal_preview-image" 2383 src=${this._productImage} 2384 alt="" 2385 width="" 2386 /> 2387 </figure> 2388 <div class="d-flex added-to-basket-modal__generic_wrap"> 2389 <span class="mr-xs-1 font_semibold added-to-basket-modal_quantity-badge" 2390 >${this._quantity} ${this._isBundle?"x":d} ${this._unit}</span 2391 > 2392 <p class="font_semibold added-to-basket-modal_product-name">${this._productName}</p> 2393 </div> 2394 2395 ${this._hasOptions?r` <ul class="added-to-basket-modal__options"> 2396 ${this._options.map(e=>r` <li 2397 data-option-name="${e.name}" 2398 data-option-value="${e.value}" 2399 > 2400 ${e.name}: <span class="font_semibold">${e.value}</span> 2401 </li>`)} 2402 </ul>`:d} 2403 ${this._isLoyalty?r` 2404 <div class="tag tag_quaternary mb-xs-2"> 2405 <span class="overline overline_s mb-xs-0 color_secondary"> ${l("loyalty program")} </span> 2406 </div> 2407 `:d} 2408 <p>
2409 <span class="sr-only">${l("Price")}</span> 2410 <span class="price__value font_semibold"> 2411 ${this._productLoyaltyPointsCost?this._productLoyaltyPointsCost:this._productPrice} 2412 ${this._productLoyaltyPointsExchangePrice?`+ ${this._productLoyaltyPointsExchangePrice}`:d} 2413 </span> 2414 ${this._shouldDisplayProductVat?r` 2415 <span 2416 class="vat-info" 2417 aria-label="${l("incl.")} ${this._productVat} VAT" 2418 > 2419 <span aria-hidden="true">${l("incl.")}</span> 2420 <span aria-hidden="true">${this._productVat}</span> 2421 <span aria-hidden="true">VAT</span> 2422 </span> 2423 `:d} 2424 </p> 2425 2426 <div class="d-flex p-all-xs-1 added-to-basket-modal_quantity-summary"> 2427 <p class="added-to-basket-modal__generic_reset-bottom-margins added-to-basket-modal__generic_margin-right"> 2428 ${l("Quantity of this product in the basket")}: 2429 <span class="font_semibold">${this._productLikeAdded} ${this._unit}</span> 2430 </p> 2431 </div> 2432 2433 <div 2434 class="separator" 2435 aria-hidden="true" 2436 ></div> 2437 2438 <p class="added-to-basket-modal__customized-paragraph"> 2439 ${l("Total items in cart")}: <span class="font_semibold">${this._basketPositions}</span> 2440 </p> 2441 2442 <p class="added-to-basket-modal__customized-paragraph"> 2443 ${l("Cart value")}: 2444 ${this._basketLoyaltyPointsCost?r`<span class="font_semibold">${this._basketLoyaltyPointsCost}.</span> +`:d} 2445 <span class="font_semibold">${this._basketPricesSum}</span> 2446 ${this._shouldDisplayBasketVat?r`${l("incl. VAT")} `:d} 2447 </p> 2448 </h-modal-body> 2449 <h-modal-footer class="grid grid__col grid__col_xs-vcenter grid__col_xs-hcenter added-to-basket-modal__h-modal-paddings"> 2450 <a 2451 href="${this.url}" 2452 class="btn btn_primary mb-sm-2 btn_full-width added-to-basket-modal_button" 2453 >${l("Go to shopping cart")}</a 2454 > 2455 <h-modal-close class="full-width"> 2456 <button class="btn btn_secondary btn_full-width added-to-basket-modal_button">${l("Keep browsing")}</button> 2457 </h-modal-close> 2458 </h-modal-footer> 2459 </h-modal> 2460 `}}R([p({type:String})],V.prototype,"url");R([u()],V.prototype,"_productName");R([u()],V.prototype,"_hasOptions");R([u()],V.prototype,"_options");R([u()],V.prototype,"_productImage");R([u()],V.prototype,"_quantity");R([u()],V.prototype,"_unit");R([u()],V.prototype,"_productPrice");R([u()],V.prototype,"_productVat");R([u()],V.prototype,"_productLikeAdded");R([u()],V.prototype,"_productLoyaltyPointsCost");R([u()],V.prototype,"_productLoyaltyPointsExchangePrice");R([u()],V.prototype,"_basketPositions");R([u()],V.prototype,"_basketPricesSum");R([u()],V.prototype,"_basketLoyaltyPointsCost");R([u()],V.prototype,"_hasSpecialOffer");R([u()],V.prototype,"_shouldDisplayProductVat");R([u()],V.prototype,"_shouldDisplayBasketVat");R([u()],V.prototype,"_isLoyalty");R([u()],V.prototype,"_isBundle");var Un=Object.defineProperty,Ke=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&Un(e,t,s),s};class Fe extends f{constructor(){super(),this.basketUrl="",this.basketDeliveryPaymentUrl="",this.isWithValue=!1,this.moduleInstanceId="",this.isSheet=!1,this._dropdown=P(),this._sheet=P(),this._confirmModal=P(),this._confirmModalId=`remove-all-products-confirm-modal-${v()}`,this._cleanBasket=async()=>{await this._basketOverallApi.cleanBasket(),this._confirmModal.value?.close(),window.dispatchEvent(new Event("resize"))},this._basketProductsApi=this.getApiSync("basketProductsApi"),this._basketOverallApi=this.getApiSync(H.api),this.isBasketFilled$=D([this._basketOverallApi.selectActions$(),this._basketProductsApi.selectBasketCount$()]).pipe(A(([e,t])=>t>0&&e.clean&&e.clean.method&&e.clean.href)),this._discountSum=new E(this,this._basketProductsApi.selectDiscountedSum$()),this.firstElementChild&&_e.remove(this.firstElementChild)}static{this.moduleName="basket-preview"}connectedCallback(){super.connectedCallback(),this.isSheet?this.addEventListener("opened",()=>{this.eventBus.emit(new m(G.basketPreviewOpened,{sheet:this}))}):this.addEventListener("showed",()=>{this.eventBus.emit(new m(G.basketPreviewOpened,{dropdown:this}))})}
2460_renderToggler(){return r`<div class="labeled-icon"> 2461 <div 2462 class="indicator" 2463 data-value="${$(this._basketProductsApi.selectBasketCount$())}" 2464 > 2465 <h-icon 2466 icon-name="icon-basket" 2467 css-classes="labeled-icon__icon" 2468 aria-hidden="true" 2469 ></h-icon> 2470 </div> 2471 2472 <div class="labeled-icon__signature font_bold"> 2473 ${g(this.isWithValue,()=>r`${this._discountSum.value?.grossValueFormatted}`,()=>r`${l("Cart")}`)} 2474 </div> 2475 </div>`}_renderBasketPreviewDropdownHeader(){return r` 2476 <div class="grid__col grid__col_xs-12 grid__col_sm-grow mb-xs-2"> 2477 <h2 class="section-title section-title_s">${l("Products in the cart")}</h2> 2478 </div> 2479 `}_renderBasketPreviewSheetHeader(){return r` 2480 <h2 class="section-title section-title_s">${l("Products in the cart")}</h2> 2481 <h-sheet-close class="btn btn_icon"> 2482 <span class="sr-only">${l("Close window")}</span> 2483 <h-icon 2484 icon-name="icon-x" 2485 aria-hidden="true" 2486 ></h-icon> 2487 </h-sheet-close> 2488 `}
2488_renderBasketPreview(){return r`<div 2489 class="grid__row ${this.isSheet?"grid__row_xs-hright grid__row_sm-hright grid__row_lg-hright grid__row_xxl-hright":""}" 2490 > 2491 ${this.isSheet?d:this._renderBasketPreviewDropdownHeader()} 2492 <div class="grid__col grid__col_xs-12 grid__col_sm-auto"> 2493 <h-modal-opener 2494 name="${this._confirmModalId}" 2495 @click=${()=>{this.isSheet?this._sheet.value?.close():this._dropdown.value?.hide()}} 2496 class="btn btn_outline btn_xs" 2497 aria-label="${l("Remove all products from the cart")}" 2498 > 2499 <h-icon 2500 icon-name="icon-trash" 2501 css-classes="btn__icon btn__icon_left" 2502 ></h-icon> 2503 2504 ${l("Clear")} 2505 </h-modal-opener> 2506 </div> 2507 </div> 2508 2509 <basket-products-list 2510 .mode="basket" 2511 .hasAdditionalInfo="${!1}" 2512 .products="${$(this._basketProductsApi.select$())}" 2513 ></basket-products-list> 2514 2515 <basket-summary 2516 .hasContent="${!1}" 2517 url="${this.basketDeliveryPaymentUrl}" 2518 basket-url="${this.basketUrl}" 2519 ></basket-summary>`}_renderEmptyBasket(){return r`<div class="grid__row grid__row_xs-vcenter"> 2520 <div class="grid__col"> 2521 <h-icon 2522 icon-name="icon-basket" 2523 css-classes="icon_xxl" 2524 aria-hidden="true" 2525 ></h-icon> 2526 </div> 2527 <div class="grid__col"> 2528 <h2 2529 class="p align_center" 2530 tabindex="0" 2531 > 2532 ${l("Your cart is empty")} 2533 </h2> 2534 </div> 2535 </div>`}_renderConfirmModal(){return r`<confirm-modal 2536 id="${this._confirmModalId}" 2537 hidden 2538 ${I(this._confirmModal)} 2539 header="${l("Clearing all products from the cart")}" 2540 confirmText="${l("Clear all products")}" 2541 cancelText="${l("Cancel")}" 2542 @confirm="${this._cleanBasket}" 2543 > 2544 <p slot>${l("Are you sure you want to clear all items from your shopping cart?")}</p> 2545 </confirm-modal>`}_renderSheet(){return r` 2546 <h-sheet-opener 2547 name="basket-preview-sheet-${this.moduleInstanceId}" 2548 aria-label="${l("Products in the cart")}: ${$(this._basketProductsApi.selectBasketCount$())}, ${l("Sum")}: ${this._discountSum.value?.grossValueFormatted}, ${l("See details")}" 2549 >${this._renderToggler()}</h-sheet-opener 2550 > 2551 2552 <h-sheet 2553 id="basket-preview-sheet-${this.moduleInstanceId}" 2554 ${I(this._sheet)} 2555 hidden 2556 > 2557 <h-sheet-header> ${this._renderBasketPreviewSheetHeader()} </h-sheet-header> 2558 2559 <h-sheet-body> 2560 <div class="basket-preview"> 2561 ${F(this.isBasketFilled$,this._renderBasketPreview(),this._renderEmptyBasket())} 2562 </div> 2563 </h-sheet-body> 2564 </h-sheet> 2565 2566 ${this._renderConfirmModal()} 2567 `}_renderDropdown(){return r` 2568 <h-dropdown 2569 name="basket-preview" 2570 direction="bottom-right" 2571 ${I(this._dropdown)} 2572 > 2573 <h-dropdown-toggler 2574 name="basket-preview-${this.moduleInstanceId}" 2575 aria-label="${l("Products in the cart")}: ${$(this._basketProductsApi.selectBasketCount$())}, ${l("Sum")}: ${this._discountSum.value?.grossValueFormatted}, ${l("See details")}" 2576 >${this._renderToggler()}</h-dropdown-toggler 2577 > 2578 2579 <h-dropdown-content name="basket-preview-${this.moduleInstanceId}"> 2580 <div class="basket-preview"> 2581 ${F(this.isBasketFilled$,this._renderBasketPreview(),this._renderEmptyBasket())} 2582 </div> 2583 </h-dropdown-content> 2584 </h-dropdown> 2585 2586 ${this._renderConfirmModal()} 2587 `}render(){return this.isSheet?this._renderSheet():this._renderDropdown()}}Ke([p({type:String,attribute:"basket-url"})],Fe.prototype,"basketUrl");Ke([p({type:String,attribute:"basket-delivery-payment-url"})],Fe.prototype,"basketDeliveryPaymentUrl");Ke([p({type:Boolean,attribute:"is-with-value"})],Fe.prototype,"isWithValue");Ke([p({type:Number,attribute:"module-instance-id"})],Fe.prototype,"moduleInstanceId");Ke([p({type:Boolean,attribute:"sheet"})],Fe.prototype,"isSheet");var Gn=Object.defineProperty,qn=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&Gn(e,t,s),s};class Os extends f{constructor(){super(),this.isShippingCountryChangeAvailable=!1,this._selectCountryId=`delivery-country-${v()}`,this._basketShippingsApi=this.getApiSync(Ce.api),this._translationApi=this.getApiSync(J.api),this._storefrontSettings=this.getApiSync(L.api)}static{this.moduleName="basket-shipping-country"}async connectedCallback(){super.connectedCallback()}getCountries$(){return this._basketShippingsApi.selectAvailableShippingCountries$().pipe(A(e=>e.map(t=>({value:String(t.id),content:this._translationApi.translate(t.name),selected:this._basketShippingsApi.getSelectedShippingCountry()?.country.id===t.id}))))}render(){return r`${g(this.isShippingCountryChangeAvailable,()=>r` <h-control class="mb-xs-2"> 2588 <h-control-label class="control__label"> 2589 <label 2590 class="label" 2591 for=${this._selectCountryId} 2592 id="${this._selectCountryId}-label" 2593 >${l("Country of delivery")}</label 2594 > 2595 </h-control-label> 2596 2597 <h-control-content class="control"> 2598 <h-control-element class="control__element control__element_half"> 2599 <h-select 2600 class="select" 2601 control-id=${this._selectCountryId} 2602 control-name="delivery_country" 2603 no-deselect 2604 .optionsList="${$(this.getCountries$())}" 2605 @change="${e=>{const t=e.target;t.selectedOptions[0]&&this._basketShippingsApi.setCountry(Number(t.selectedOptions[0].value))}}" 2606 assistive-title-id="${this._selectCountryId}-label" 2607 > 2608 <h-select-toggler 2609 class="select-toggler" 2610 aria-labelledby="${this._selectCountryId}-label" 2611 >
2612 <span 2613 class="select-toggler__placeholder" 2614 slot="placeholder" 2615 >${l("Select")}</span 2616 > 2617 </h-select-toggler> 2618 </h-select> 2619 </h-control-element> 2620 2621 <control-errors></control-errors> 2622 </h-control-content> 2623 </h-control>`,()=>r`<div class="font_size-s mb-xs-2"> 2624 <p class="p_no-margin">${l("Country of delivery")}</p> 2625 2626 <b class="font_semibold">${l(this._basketShippingsApi.getAvailableShippingCountries()[0]?.name)}</b> 2627 </div>`)}`}}qn([p()],Os.prototype,"isShippingCountryChangeAvailable");const is={enableMask:"enableMask",disableMask:"disableMask"};var zn=Object.defineProperty,bt=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&zn(e,t,s),s};class We extends f{constructor(){super(),this.countries=[],this.address=null,this.ariaLabelledBy="",this.selectedCountryId="",this._countryId=`country-${v()}`,this._select=P(),this._settingsApi=this.getApiSync(L.api)}static{this.moduleName="shipping-address-country-select"}firstUpdated(e){super.firstUpdated(e),this.selectedCountryId=this.getSelectedValue()??""}getSelectedValue(){return this._select.value?.selectedOptions[0]?.value}render(){return r` <h-select 2628 ${I(this._select)} 2629 @showed=${()=>{this._select.value?.assignSlots()}} 2630 @change=${e=>{const t=e.target,i=t.selectedOptions[0]?.value;i&&(this.selectedCountryId=i),t&&i==="179"?this.dispatchEvent(new CustomEvent(is.enableMask)):this.dispatchEvent(new CustomEvent(is.disableMask))}} 2631 class="select" 2632 control-id=${this._countryId} 2633 control-name="countryId" 2634 no-deselect 2635 .optionsList="${this.countries}" 2636 assistive-title-id="${this.ariaLabelledBy}" 2637 aria-disabled="${this._settingsApi.isFeatureEnabled("select_shipping_country_on_shipping_step")}" 2638 .disabled=${this._settingsApi.isFeatureEnabled("select_shipping_country_on_shipping_step")} 2639 ?required=${this._settingsApi.isFeatureEnabled("dev_cached_select_options")} 2640 ?dev_cached_select_options=${this._settingsApi.isFeatureEnabled("dev_cached_select_options")} 2641 > 2642 <h-select-toggler 2643 class="select-toggler" 2644 aria-labelledby="${this.ariaLabelledBy}" 2645 > 2646 <span 2647 class="select-toggler__placeholder" 2648 slot="placeholder" 2649 >${l("Select")}</span 2650 > 2651 </h-select-toggler> 2652 2653 ${$e(this.countries,e=>e.id,e=>r` <h-option 2654 slot="content" 2655 value=${e.id} 2656 id="${this._countryId}-${e.id}" 2657 ?selected=${e.id==this.address?.countryId} 2658 > 2659 <h-option-content>${e.name}</h-option-content> 2660 </h-option>`)} 2661 </h-select>`}}bt([p()],We.prototype,"countries");bt([p({type:Object})],We.prototype,"address");bt([p({type:String,attribute:"aria-labelledby"})],We.prototype,"ariaLabelledBy");bt([p({type:String,reflect:!0})],We.prototype,"selectedCountryId");const Hn=({storeName:n="BasketShippingsCountriesStore"}={})=>U({name:n},ye());class Kn{#e;constructor(e){this.#e=e}get(){return this.#e.query(ce())}select$(){return this.#e.pipe(be())}set(e){this.#e.update(fe(e))}}class Wn extends O{#e;#t;constructor({basketShippingsCountriesRepository:e,messageStorageApi:t}){super(),this.#e=e,this.#t=t,this._setupEventListeners()}_setupEventListeners(){new q(this.#s,this.#t)}#s=({body:e})=>{const t=e?.countries||[];this._setCountries(t)};_setCountries(e){this.#e.set(e)}get(){return this.#e.get()}select$(){return this.#e.select$().pipe(k((e,t)=>B(e,t)))}}class jn extends de{constructor({basketOrderService:e}){super(),this.moduleName=Re.api,this.#e=e}#e;async order(){return this.#e.order()}isOrderInProgress(){return this.#e.isOrderInProgress()}selectOrderInProgress$(){return this.#e.selectOrderInProgress$()}isOrderQueued(){return this.#e.isOrderQueued()}selectIsOrderQueued$(){return this.#e.selectIsOrderQueued$()}addOrderValidation(e,t){this.#e.addOrderValidation(e,t)}}class Qn extends O{#e;#t;#s;#a;#n;#r;constructor({basketHttpApi:e,flashMessengerApi:t,translationsApi:i,basketOverallApi:s,basketOrderRepository:a,basketUpdaterApi:o}){super(),this.#e=e,this.#s=i,this.#t=t,this.#a=s,this.#n=a,this.#r=o}async order(){const e=this.#a.getActions().placeOrder;try{const{response:t}=this.#e.placeOrder(e),{data:i}=await t;if(i.isPlaced)return i;this.#r.emitUpdateBasketEvent(i)}catch(t){this._handleUnexpectedError(t)}finally{setTimeout(()=>{this.#n.setIsOrderInProgress(!1)},200)}}_handleUnexpectedError(e){throw console.error(e),this.#t.addFlashMessage({type:"error",content:this.#s.translate("An unexpected error occurred")}),this.eventBus.emit(new m(S.unexpectedError)),e}}class Yn extends O{#e;#t;#s;#a;#n;#r;#o;#i;#l;#c;constructor({basketHttpApi:e,flashMessengerApi:t,pageManagerApi:i,translationsApi:s,settingsApi:a,storeFactoryApi:o,basketOverallApi:c,basketOrderRepository:h,basketUpdaterApi:_}){super(),this.#e=e,this.#s=i,this.#a=s,this.#t=t,this.#n=a,this.#r=o,this.#o=c,this.#i=h,this.#l=_,this._isRememberOrderQueueEnabled()&&(this._setupSessionStore(),this._resumeRememberedOrderQueue())}async order(){const e=this.#o.getActions().queueOrder;try{const{response:t}=this.#e.queueOrder(e),{data:i}=await t;if(!i.isSuccess){this.#l.emitUpdateBasketEvent(i),this.#i.setIsOrderInProgress(!1);return}if(i._links.checkStatus){if(this.#i.setIsOrderQueued(!0),this._isRememberOrderQueueEnabled()){const s=this._setOrderCheckStatusUrl(i._links.checkStatus.href);if(s){this._getQueueStatus(s);return}this.#i.setIsOrderQueued(!1),this.#i.setIsOrderInProgress(!1),this._handleUnexpectedError("Order queue returned invali
2661d check status URL.");return}this._getQueueStatus(i._links.checkStatus.href);return}this.#i.setIsOrderQueued(!1),this.#i.setIsOrderInProgress(!1),this._handleUnexpectedError("Order queue did not return a check status URL.")}catch(t){this._removeOrderCheckStatusUrl(),this.#i.setIsOrderQueued(!1),this.#i.setIsOrderInProgress(!1),this._handleUnexpectedError(t)}}async _getQueueStatus(e){try{const{response:t}=this.#e.getQueueStatus(e),{data:i}=await t,{status:s,_links:a}=i;if(s===$t.done){this._removeOrderCheckStatusUrl(),this.eventBus.emit(new m(S.orderPlaced)),this.#i.setIsOrderInProgress(!1),this.#i.setIsOrderQueued(!1),this.#s.visit(a.showOrder.href);return}if(s===$t.error){this._removeOrderCheckStatusUrl(),this.#i.setIsOrderInProgress(!1),this.#i.setIsOrderQueued(!1),this.#s.visit(window.location.href);return}if(s===$t.pending){this.#i.setIsOrderInProgress(!0),this.#i.setIsOrderQueued(!0),setTimeout(()=>{this._getQueueStatus(e)},1e3);return}this._removeOrderCheckStatusUrl(),this.#i.setIsOrderInProgress(!1),this.#i.setIsOrderQueued(!1),console.error(`Unknown order queue status: "${s}"`),this.#s.visit(window.location.href)}catch(t){this._removeOrderCheckStatusUrl(),this.#i.setIsOrderQueued(!1),this.#i.setIsOrderInProgress(!1),this._handleUnexpectedError(t)}}_isRememberOrderQueueEnabled(){return this.#n.isFeatureEnabled("dev_remember_order_queue")}_setupSessionStore(){this.#c=this.#r.getStore(tt),this.#c||(this.#c=this.#r.createStore("session",tt))}_resumeRememberedOrderQueue(){const e=this._getRememberedOrderCheckStatusUrl();e&&(this.#i.setIsOrderQueued(!0),this.#i.setIsOrderInProgress(!0),this._getQueueStatus(e))}_normalizeOrderCheckStatusUrl(e){try{const t=new URL(e,window.location.origin),i=t.origin===window.location.origin,s=Zs.test(t.pathname),a=t.hash!=="";return!i||!s||a?null:`${t.pathname}${t.search}`}catch{return null}}_isOrderCheckStatusUrlExpired(e){if(!e)return!0;const t=parseInt(e,10);return Number.isNaN(t)?!0:Date.now()-t>Xs}_getRememberedOrderCheckStatusUrl(){const e=this.#c?.get(Pt),t=this.#c?.get(Ct);if(!e||this._isOrderCheckStatusUrlExpired(t))return this._removeOrderCheckStatusUrl(),null;const i=this._normalizeOrderCheckStatusUrl(e);return i||(this._removeOrderCheckStatusUrl(),null)}_setOrderCheckStatusUrl(e){const t=this._normalizeOrderCheckStatusUrl(e);return t?(this.#c?.set(Pt,t),this.#c?.set(Ct,String(Date.now())),t):(this._removeOrderCheckStatusUrl(),null)}_removeOrderCheckStatusUrl(){this._isRememberOrderQueueEnabled()&&(this.#c?.remove(Pt),this.#c?.remove(Ct))}_handleUnexpectedError(e){throw console.error(e),this.#t.addFlashMessage({type:"error",content:this.#a.translate("An unexpected error occurred")}),this.eventBus.emit(new m(S.unexpectedError)),e}}class Jn extends O{#e;#t;#s;#a;#n;#r;#o;#i;#l;constructor({basketHttpApi:e,flashMessengerApi:t,pageManagerApi:i,translationsApi:s,settingsApi:a,storeFactoryApi:o,basketOverallApi:c,basketOrderRepository:h,basketCustomValidation:_,basketUpdaterApi:b}){super(),this.#e=e,this.#s=i,this.#a=s,this.#t=t,this.#n=c,this.#r=h,this.#o=_,this.#i=b,this.#l=new Yn({basketHttpApi:this.#e,flashMessengerApi:this.#t,pageManagerApi:this.#s,translationsApi:this.#a,settingsApi:a,storeFactoryApi:o,basketOverallApi:this.#n,basketOrderRepository:this.#r,basketUpdaterApi:this.#i})}async order(){const e=this.#n.getActions().queueOrder,t=this.#n.getActions().queueOrder||this.#n.getActions().placeOrder;if(this.#o.run())return;if(!t){this._validateSections();return}return this.#r.setIsOrderInProgress(!0),await(e?this.#l:new Qn({basketHttpApi:this.#e,flashMessengerApi:this.#t,translationsApi:this.#a,basketOverallApi:this.#n,basketOrderRepository:this.#r,basketUpdaterApi:this.#i})).order()}isOrderInProgress(){return this.#r.getIsOrderInProgress()}selectOrderInProgress$(){return this.#r.selectIsOrderInProgress$()}isOrderQueued(){return this.#r.getIsOrderQueued()}selectIsOrderQueued$(){return this.#r.selectIsOrderQueued$()}addOrderValidation(e,t){this.#o.addOrderValidation(e,t)}_validateSections(){for(const[e,t]of Object.entries(this.#n.getInvalidSections()))this.eventBus.emit(new m(`invalidSection.${e}`,t))}}const Xn=({storeName:n="BasketOrderStore"}={})=>U({name:n},K({isOrderInProgress:!1,isOrderQueued:!1}));class Zn{#e;constructor(e){this.#e=e}setIsOrderInProgress(e){this.#e.update(y("isOrderInProgress",e))}getIsOrderInProgress(){return this.#e.getValue().isOrderInProgress}selectIsOrderInProgress$(){return this.#e.pipe(C(e=>e.isOrderInProgress))}setIsOrderQueued(e){this.#e.update(y("isOrderQueued",e))}getIsOrderQueued(){return this.#e.getValue().isOrderQueued}selectIsOrderQueued$(){return this.#e.pipe(C(e=>e.isOrderQueued))}}class as{#e={};addTemplate(e,t){if(typeof t!="string"&&!(t instanceof HTMLTemplateElement))throw new Error("Template must be a id of template tag or an instance of HTMLTemplateElement");typeof t=="string"&&this._addTemplateInfoFromId(e,t),t instanceof HTMLTemplateElement&&this._addTemplate(e,t)}getTemplate(e){return this.#e[e]}_addTemplate(e,t){this.#e[e]||(this.#e[e]=new Map),this.#e[e].set(t.id,t)}_addTemplateInfoFromId(e,t){const i=document.getElementById(t);i&&this._addTemplate(e,i)}}var er=Object.defineProperty,tr=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&er(e,t,s),s};class Ls extends f{constructor(){super(),this._loyaltyPointsAwardedSubscription=void 0,this._basketLoyaltyApi=this.getApiSync("basketLoyaltyApi"),this._loyaltyPoints=new E(this,this._basketLoyaltyApi.selectLoyaltyPointsAwarded$())}static{this.moduleName="loyalty-awarded-points-sum"}disconnectedCallback(){super.disconnectedCallback(),this._loyaltyPointsAwardedSubscription?.unsubscribe()}render(){return r`${this._loyaltyPoints.value?.points}`}}tr([u()],Ls.prototype,"_loyaltyPoints");const sr="js__product-in-basket-count";var ir=Object.defineProperty,Ns=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);
2661return s&&ir(e,t,s),s};class zt extends f{constructor(){super(),this.variantId$=new ve(0),this.selectedOptions$=new ve([]),this._checkProductInBasket$=null,new wi(e=>this._updateVariantId(e))}static{this.moduleName="product-in-basket"}connectedCallback(){super.connectedCallback(),this.variantId$.next(this.variantId);const e=this.getApiSync("basketProductsApi");this._checkProductInBasket$=D([this.variantId$,this.selectedOptions$,e.select$()]).subscribe(([t,i,s])=>this._update(s,t,i))}disconnectedCallback(){super.disconnectedCallback(),this._checkProductInBasket$&&this._checkProductInBasket$.unsubscribe()}_update(e,t,i){const s=e.find(a=>{const o=a.options.map(c=>c.value);return a.productId===this.productId&&a.variantId===t&&B(o.sort(),i.sort())});s?(_e.show(this),this._updateProductQuantityInBasket(s.quantity)):_e.hide(this)}_updateProductQuantityInBasket(e){this.querySelectorAll(`.${sr}`).forEach(t=>t.textContent=e.toString())}_updateVariantId({body:e}){!e?.productId||e.productId!==this.productId||(this.variantId$.next(e.stockId),this.selectedOptions$.next(e.optionValues?.map(t=>t.userValue)||[]))}}Ns([p({type:Number,attribute:"product-id"})],zt.prototype,"productId");Ns([p({type:Number,attribute:"variant-id"})],zt.prototype,"variantId");class ar extends f{constructor(){super(),this._reactiveFormRef=P(),this._formId=`form-${v()}`,this._couponId=`coupon-${v()}`,this._$basketCouponContainer=null,this._addPromotionCode=async e=>{e.preventDefault();const t=this._getFormService();let i=t.getFormControl(this._couponId);if(i&&typeof i.value=="string"){const a=i.value.replace(mn,"").trim();t.setFormControlValue(this._couponId,a)}if(await t.validateControls(),i=t.getFormControl(this._couponId),!i||this._getFormState()===Pe.validationFailed)return;await this._basketPromotionsApi.add(i.value)&&this._$basketCouponContainer?.focus()},this._removePromotionCode=async()=>{await this._basketPromotionsApi.remove(),this._$basketCouponContainer?.focus()},this._basketOverallApi=this.getApiSync(H.api),this._basketPromotionsApi=this.getApiSync(ge.api),this._settingsApi=this.getApiSync(L.api),this._isDevGiftCardsFlagEnabled=this._settingsApi.isFeatureEnabled("dev_gift_cards"),this._basketActions=new E(this,this._basketOverallApi.selectActions$()),this._promotionCode=new E(this,this._basketPromotionsApi.selectPromotionCode$())}static{this.moduleName="basket-summary-coupon-codes"}connectedCallback(){super.connectedCallback(),this._$basketCouponContainer||(this._$basketCouponContainer=this.closest(`.${ss}`)||document.querySelector(`.${ss}`))}_getFormState(){return this._getFormService().getFormState()}_getFormService(){if(!this._reactiveFormRef.value)throw"No form found";return this._reactiveFormRef.value?.formService}render(){return super.render(),r` 2662 <div class="control__additional-content"> 2663 ${this._promotionCode.value?r`<div> 2664 <span class="d-block mb-xs-1 tag tag_l font_semibold font_size-s mb-xs-1 basket-summary__coupon-code"> 2665 ${this._promotionCode.value?.code} 2666 </span> 2667 <span class="d-block mb-xs-1 font_size-s font_semibold color_primary">${this._promotionCode.value?.label}</span> 2668 ${this._promotionCode.value?.description?r` 2669 <span class="d-block mb-xs-1 font_size-xs color_secondary"> 2670 ${this._promotionCode.value?.description} 2671 </span> 2672 `:d} 2673 </div> 2674 2675 ${this._basketActions.value?.removePromoCode!==void 0?r` <button 2676 type="submit" 2677 class="btn btn_outline btn_xs" 2678 @click=${this._removePromotionCode} 2679 > 2680 ${l("Remove code from order")} 2681 </button>`:d} `:r` 2682 <reactive-form ${I(this._reactiveFormRef)}> 2683 <h-control-label class="control__label"> 2684 <label 2685 class="label" 2686 for=${this._couponId} 2687 >${l(this._isDevGiftCardsFlagEnabled?"Enter a discount coupon":"Coupon code")}</label 2688 > 2689 </h-control-label> 2690 2691 <form 2692 class="d-flex" 2693 id=${this._formId} 2694 @submit=${this._addPromotionCode} 2695 > 2696 <control-connector 2697 required 2698 errorMessage=${this._isDevGiftCardsFlagEnabled?l("The field is required"):d} 2699 class="control control_no-margin mr-xs-1" 2700 validationMode="${gs.change}" 2701 > 2702 <h-control> 2703 <h-control-content class="control"> 2704 <h-control-element class="control__element"> 2705 <h-input 2706 controlId=${this._couponId} 2707 controlName="coupon" 2708 > 2709 <h-input-control></h-input-control> 2710 </h-input> 2711 </h-control-element> 2712 2713 <control-errors></control-errors> 2714 </h-control-content> 2715 </h-control> 2716 </control-connector> 2717 2718 <button 2719 type="submit" 2720 class="btn btn_secondary" 2721 @click=${this._addPromotionCode} 2722 > 2723 ${l("Activate")} 2724 </button> 2725 </form> 2726 </reactive-form> 2727 `} 2728 </div> 2729 `}}var nr=Object.defineProperty,Vs=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);
2729return s&&nr(e,t,s),s};class Ht extends f{constructor(){super(),this._showTaxInfo=!1,this._showGrossPrices=!1,this._renderPrices=()=>this._showTaxInfo?r` 2730 <h-accordion lazy> 2731 <h-accordion-group> 2732 <h-accordion-toggler class="accordion__toggler p_s mb-xs-1"> 2733 <span> 2734 ${l("Products (with VAT)")} 2735 <svg class="icon accordion__toggler-icon accordion__toggler-icon_secondary"> 2736 <use 2737 href="/assets/img/icons/symbol-defs.svg#icon-chevron-down" 2738 xlink:href="/assets/img/icons/symbol-defs.svg#icon-chevron-down" 2739 ></use> 2740 </svg> 2741 </span> 2742 2743 <span> ${this._productsSum.value?.grossValueFormatted} </span> 2744 </h-accordion-toggler> 2745 2746 <h-accordion-content 2747 ?is-dev-accordion-optimization-flag-enabled=${this._storefrontSettingsApi.isFeatureEnabled("is-dev-accordion-optimization-flag-enabled")} 2748 > 2749 <ul class="price-list price-list_secondary price-list_s"> 2750 <li class="price-list__item"> 2751 <span class="price-list__label price_s"> ${l("Products (without VAT)")} </span> 2752 <span class="price-list__value price__value price_s"> ${this._productsSum.value?.netValueFormatted} </span> 2753 </li> 2754 2755 ${g(this._taxes.value&&this._taxes.value.length>1,()=>r` ${this._taxes.value?.map(e=>r` <li class="price_s price-list__item"> 2756 <span class="price__label price-list__label"> 2757 ${l("{{ taxPercent }} VAT",{taxPercent:`${e.name}%`})} 2758 </span> 2759 <span class="price__value price-list__value">${e.sum.text}</span> 2760 </li>`)}`,()=>r` <li class="price_s price-list__item"> 2761 <span class="price__label price-list__label"> 2762 ${l("{{ taxPercent }} VAT",{taxPercent:`${this._productsSum.value?.taxFormatted}`})} 2763 </span> 2764 <span class="price__value price-list__value"> ${this._productsSum.value?.taxValueFormatted} </span> 2765 </li>`)} 2766 </ul> 2767 </h-accordion-content> 2768 </h-accordion-group> 2769 </h-accordion> 2770 `:this._showGrossPrices?r` 2771 <li class="price-list__item"> 2772 <span class="price-list__label">${l("Products")}</span> 2773 <span class="price-list__value">${this._productsSum.value?.grossValueFormatted}</span> 2774 </li> 2775 `:r` 2776 <li class="price-list__item"> 2777 <span class="price-list__label">${l("Products (without VAT)")}</span> 2778 <span class="price-list__value">${this._productsSum.value?.netValueFormatted}</span> 2779 </li> 2780 `,this._basketProductsApi=this.getApiSync("basketProductsApi"),this._basketPromotionsApi=this.getApiSync(ge.api),this._basketTaxesApi=this.getApiSync("basketTaxesApi"),this._storefrontSettingsApi=this.getApiSync(L.api),this._storefrontSettingsApi.selectSkinSettings$().subscribe(e=>{this._showTaxInfo=e.showAdditionalTaxInfo==="1",this._showGrossPrices=e.showGrossPrices==="1"}),this._productsSum=new E(this,this._basketProductsApi.selectSum$()),this._taxes=new E(this,this._basketTaxesApi.select$()),this._promotions=new E(this,this._basketPromotionsApi.select$())}static{this.moduleName="basket-summary-basket-prices"}render(){return super.render(),r` 2781 <div class="basket-summary__prices"> 2782 <h3 class="font_semibold mb-xs-2">${l("Product summary")}
2782</h3> 2783 <ul class="price-list price-list_s mb-xs-0 color_secondary"> 2784 ${this._renderPrices()} 2785 ${g(this._promotions.value&&this._promotions.value?.length>0,()=>r` <li> 2786 <basket-discounts-list 2787 .discounts="${$(this._basketPromotionsApi.select$())}" 2788 .discountsSum="${$(this._basketPromotionsApi.selectDiscountsSum$())}" 2789 ></basket-discounts-list> 2790 </li>`,()=>d)} 2791 </ul> 2792 </div> 2793 `}}Vs([u()],Ht.prototype,"_showTaxInfo");Vs([u()],Ht.prototype,"_showGrossPrices");var rr=Object.defineProperty,ft=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&rr(e,t,s),s};class je extends f{constructor(){super(),this.url="",this.basketUrl="",this.mode=pe.basket,this._showNetPrices=!1,this._renderPriceList=()=>r` 2794 <ul class="price-list"> 2795 <li class="price-list__item"> 2796 <span class="price-list__label">${l("Subtotal")}</span> 2797 <span class="price-list__value price price_m"> 2798 ${g(this._hasPromotionCode.value||this._promotions.value&&this._promotions.value.length>0,()=>r` 2799 <p class="p p_no-margin price__value"> 2800 <strong class="p_l p_no-margin font_semibold price__value_special"> 2801 ${this._productsDiscountedSum.value?.grossValueFormatted} 2802 </strong> 2803 ${this._showNetPrices?l("with VAT"):d} 2804 </p> 2805 `,()=>r` 2806 <strong class="d-block p_l p_no-margin font_semibold price__value"> 2807 ${this._productsDiscountedSum.value?.grossValueFormatted} 2808 ${this._showNetPrices?l("with VAT"):d} 2809 </strong> 2810 `)} 2811 <p class="p_s p_no-margin color_tertiary"> 2812 ${this._showNetPrices?r`${this._productsDiscountedSum.value?.netValueFormatted} ${l("without VAT")}`:r`${l("Includes VAT")}`} 2813 </p> 2814 </span> 2815 </li> 2816 2817 ${F(this._basketLoyaltyApi.selectHasItemsPaidInLoyaltyPoints$(),r` 2818 <li class="price-list__item"> 2819 <span class="price-list__label">${l("Products in the loyalty program")}</span> 2820 <span class="price-list__value font_semibold"> 2821 ${this._loyaltyPointsCost.value?.pointsFormatted} 2822 ${this._loyaltyPointsExchangePrice.value?`+ ${this._loyaltyPointsExchangePrice.value.grossValueFormatted}`:""} 2823 </span> 2824 </li> 2825 `,d)} 2826 </ul> 2827 `,this._basketOverallApi=this.getApiSync(H.api),this._basketProductsApi=this.getApiSync("basketProductsApi"),this._basketPromotionsApi=this.getApiSync(ge.api),this._basketLoyaltyApi=this.getApiSync("basketLoyaltyApi"),this._storefrontSettingsApi=this.getApiSync(L.api),this._storefrontSettingsApi.selectSkinSettings$().subscribe(e=>{this._showNetPrices=e.showNetPrices==="1"}),this._totalSum=new E(this,this._basketOverallApi.selectSum$()),this._productsDiscountedSum=new E(this,this._basketProductsApi.selectDiscountedSum$()),this._productsSum=new E(this,this._basketProductsApi.selectSum$()),this._promotions=new E(this,this._basketPromotionsApi.select$()),this._hasPromotionCode=new E(this,this._basketPromotionsApi.selectHasPromotionCode$()),this._loyaltyPointsCost=new E(this,this._basketLoyaltyApi.selectLoyaltyPointsCost$()),this._loyaltyPointsExchangePrice=new E(this,this._basketLoyaltyApi.selectLoyaltyPointsExchangePrice$())}static{this.moduleName="basket-summary-basket-footer"}
2827_fullBasketRenderPriceList(){return r`<ul class="price-list"> 2828 <li class="price-list__item"> 2829 <span class="price-list__label">${l("Total")}</span> 2830 <span class="price-list__value price price_m"> 2831 ${g(this._hasPromotionCode.value||this._promotions.value&&this._promotions.value.length>0,()=>r` 2832 <p class="p p_no-margin price__value"> 2833 <strong class="p_l font_semibold price__value_special"> ${this._totalSum.value?.grossValueFormatted} </strong> 2834 ${this._showNetPrices?l("with VAT"):d} 2835 </p> 2836 `,()=>r` 2837 <strong class="d-block p_l font_semibold price__value"> 2838 ${this._totalSum.value?.grossValueFormatted} ${this._showNetPrices?l("with VAT"):d} 2839 </strong> 2840 `)} 2841 <p class="p_s p_no-margin color_tertiary"> 2842 ${this._showNetPrices?r`${this._totalSum.value?.netValueFormatted} ${l("without VAT")}`:r`${l("Includes VAT")}`} 2843 </p> 2844 </span> 2845 </li> 2846 </ul>`}render(){return super.render(),r` 2847 <div class="basket-module__content basket-module__content_secondary"> 2848 <footer class="basket-summary__footer"> 2849 ${g(this.mode===pe.fullBasket,()=>this._fullBasketRenderPriceList(),()=>r`${this._renderPriceList()} 2850 <p> 2851 <small>${l("Delivery cost in the next step.")}</small> 2852 </p>`)} 2853 2854 <p> 2855 <a 2856 href=${this.url} 2857 class="btn btn_primary btn_full-width" 2858 aria-label="${l("Next step: choosing shipping and payment")}" 2859 > 2860 <h-icon 2861 icon-name="icon-truck" 2862 css-classes="btn__icon btn__icon_left" 2863 aria-hidden="true" 2864 ></h-icon> 2865 2866 ${l("Delivery and payment")}</a 2867 > 2868 </p> 2869 2870 ${g(this.basketUrl,()=>r`<p> 2871 <a 2872 href=${this.basketUrl} 2873 class="btn btn_outline btn_full-width" 2874 > 2875 ${l("View products in the cart")}</a 2876 > 2877 </p>`,()=>d)} 2878 ${g(this._storefrontSettingsApi.getInpostPayWidgetSettings()&&this._storefrontSettingsApi.getInpostPayWidgetSettings()?.showInBasket,()=>r`${g(this._storefrontSettingsApi.getInpostPayWidgetSettings()?.merchantClientId,()=>this._storefrontSettingsApi.isFeatureEnabled("dev_inpost_pay_button")?r` <inpost-pay-button binding-place="${Ci.BASKET_SUMMARY}"></inpost-pay-button> `:r`<inpost-izi-button 2879 data-v2 2880 variation="${this._storefrontSettingsApi.getInpostPayWidgetSettings()?.buttonVariant=="secondary"?"secondary":"primary"} ${this._storefrontSettingsApi.getInpostPayWidgetSettings()?.isDarkMode?"dark":""} ${this._storefrontSettingsApi.getInpostPayWidgetSettings()?.frameStyle}" 2881 binding_place="BASKET_SUMMARY" 2882 > 2883 </inpost-izi-button>`,()=>d)}`,()=>d)} 2884 </footer> 2885 </div> 2886 `}}ft([p()],je.prototype,"url");ft([p({type:String,attribute:"basket-url"})],je.prototype,"basketUrl");ft([p()],je.prototype,"mode");ft([u()],je.prototype,"_showNetPrices");var or=Object.defineProperty,Rs=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&or(e,t,s),s};class Kt extends f{constructor(){super(),this._showTaxInfo=!1,this._showGrossPrices=!1,this._renderPrices=()=>{const e=document.querySelector("#iconsPath")?.href||"/assets/img/icons/symbol-defs.svg";return this._showTaxInfo?r` 2887 <h-accordion lazy> 2888 <h-accordion-group> 2889 <h-accordion-toggler class="accordion__toggler p_s mb-xs-1">
2890 <span> 2891 ${l("Products (with VAT)")} 2892 <svg class="icon accordion__toggler-icon accordion__toggler-icon_secondary"> 2893 <use 2894 href="${e}#icon-chevron-down" 2895 xlink:href="${e}#icon-chevron-down" 2896 ></use> 2897 </svg> 2898 </span> 2899 2900 <span> ${this._productsSum.value?.grossValueFormatted} </span> 2901 </h-accordion-toggler> 2902 2903 <h-accordion-content 2904 ?is-dev-accordion-optimization-flag-enabled=${this._storefrontSettingsApi.isFeatureEnabled("is-dev-accordion-optimization-flag-enabled")} 2905 > 2906 <ul class="price-list price-list_secondary price-list_s"> 2907 <li class="price-list__item"> 2908 <span class="price-list__label price_s"> ${l("Products (without VAT)")} </span> 2909 <span class="price-list__value price__value price_s"> ${this._productsSum.value?.netValueFormatted} </span> 2910 </li> 2911 2912 ${g(this._taxes.value&&this._taxes.value.length>1,()=>r` ${this._taxes.value?.map(t=>r` <li class="price_s price-list__item"> 2913 <span class="price__label price-list__label"> 2914 ${l("{{ taxPercent }} VAT",{taxPercent:`${t.name}%`})} 2915 </span> 2916 <span class="price__value price-list__value">${t.sum.text}</span> 2917 </li>`)}`,()=>r` <li class="price_s price-list__item"> 2918 <span class="price__label price-list__label"> 2919 ${l("{{ taxPercent }} VAT",{taxPercent:`${this._productsSum.value?.taxFormatted}`})} 2920 </span> 2921 <span class="price__value price-list__value"> ${this._productsSum.value?.taxValueFormatted} </span> 2922 </li>`)} 2923 </ul> 2924 </h-accordion-content> 2925 </h-accordion-group> 2926 </h-accordion> 2927 `:this._showGrossPrices?r` 2928 <li class="price-list__item"> 2929 <span class="price-list__label">${l("Products")}</span> 2930 <span class="price-list__value">${this._productsSum.value?.grossValueFormatted}</span> 2931 </li> 2932 `:r` 2933 <li class="price-list__item"> 2934 <span class="price-list__label">${l("Products (without VAT)")}</span> 2935 <span class="price-list__value">${this._productsSum.value?.netValueFormatted}</span> 2936 </li> 2937 `},this._renderShippingTaxValue=()=>{const e=this._selectedShipping.value?.price;if(!e)return d;const t=e.grossValue===0?"":e.taxFormatted;return t&&this._showTaxInfo?r` 2938 ${l("Delivery (with {{ taxPercent }} VAT)",{taxPercent:t})} 2939 `:r`${l("Delivery")}`},this._renderPaymentTaxValue=()=>{const e=this._paymentCost.value;if(!e)return d;const t=e.grossValue===0?"":e.taxFormatted;return t&&this._showTaxInfo?r` 2940 ${l("Payment method (with {{ taxPercent }} VAT)",{taxPercent:t})} 2941 `:r`${l("Payment method")}`},this._basketProductsApi=this.getApiSync("basketProductsApi"),this._basketPromotionsApi=this.getApiSync(ge.api),this._basketTaxesApi=this.getApiSync("basketTaxesApi"),this._basketShippingsApi=this.getApiSync("basketShippingsApi"),this._basketLoyaltyApi=this.getApiSync("basketLoyaltyApi"),this._basketPaymentsApi=this.getApiSync(Ie.api),this._storefrontSettingsApi=this.getApiSync(L.api),this._isGiftCardsEnabled=this._storefrontSettingsApi.isFeatureEnabled("dev_gift_cards"),this._isGiftCardsEnabled&&(this._basketGiftCardsApi=this.getApiSync(ne.api),this._hasAppliedGiftCards=new E(this,this._basketGiftCardsApi.selectHasAppliedGiftCards$(
2941))),this._storefrontSettingsApi.selectSkinSettings$().subscribe(e=>{this._showTaxInfo=e.showAdditionalTaxInfo==="1",this._showGrossPrices=e.showGrossPrices==="1"}),this._productsSum=new E(this,this._basketProductsApi.selectSum$()),this._taxes=new E(this,this._basketTaxesApi.select$()),this._selectedShipping=new E(this,this._basketShippingsApi.selectSelectedShipping$()),this._promotions=new E(this,this._basketPromotionsApi.select$()),this._selectedPayment=new E(this,this._basketPaymentsApi.selectSelectedPayment$()),this._paymentCost=new E(this,this._basketPaymentsApi.selectActivePaymentCost$()),this._loyaltyPointsCost=new E(this,this._basketLoyaltyApi.selectLoyaltyPointsCost$()),this._loyaltyPointsExchangePrice=new E(this,this._basketLoyaltyApi.selectLoyaltyPointsExchangePrice$())}static{this.moduleName="basket-summary-checkout-prices"}render(){return super.render(),r` 2942 <div class="basket-summary__prices"> 2943 <h3 class="font_semibold mb-xs-2">${l("Order value")}</h3> 2944 <ul class="price-list price-list_s"> 2945 ${this._renderPrices()} 2946 ${g(this._promotions.value&&this._promotions.value.length>0,()=>r` <li> 2947 <basket-discounts-list 2948 .discounts="${$(this._basketPromotionsApi.select$())}" 2949 .discountsSum="${$(this._basketPromotionsApi.selectDiscountsSum$())}" 2950 ></basket-discounts-list> 2951 </li>`,()=>d)} 2952 ${F(this._basketLoyaltyApi.selectHasItemsPaidInLoyaltyPoints$(),r` 2953 <li class="price-list__item"> 2954 <span class="price-list__label">${l("Products in the loyalty program")}</span> 2955 <div class="price-list__value"> 2956 <p class="p_no-margin">${this._loyaltyPointsCost.value?.pointsFormatted}</p> 2957 <p class="p_no-margin">${this._loyaltyPointsExchangePrice.value?`+ ${this._loyaltyPointsExchangePrice.value.grossValueFormatted}`:""}</p> 2958 </p> 2959 </li> 2960 `,d)} 2961 2962 <li class="price price_s price-list__item"> 2963 <div class="price__label price-list__label"> 2964 <p class="p_no-margin">${this._renderShippingTaxValue()}</p> 2965 <small class="color_secondary"> ${this._selectedShipping.value?.name} </small> 2966 </div> 2967 2968 <span 2969 class=" 2970 price__value 2971 price-list__value 2972 ${this._selectedShipping.value&&this._selectedShipping.value?.price.grossValue==0?"price__value_special":""} 2973 " 2974 > 2975 ${this._selectedShipping.value&&this._selectedShipping.value?.price.grossValue>0?this._selectedShipping.value.price.grossValueFormatted:l("Free")} 2976 </span> 2977 </li> 2978 2979 ${this._paymentCost.value&&this._paymentCost.value?.grossValue>0?r` 2980 <li class="price price_s price-list__item"> 2981 <div class="price__label price-list__label"> 2982 ${this._renderPaymentTaxValue()} 2983 <small class="color_secondary"> ${this._selectedPayment.value?.name} </small> 2984 </div> 2985 2986 <span class="price__value price-list__value"> ${this._paymentCost.value.grossValueFormatted} </span> 2987 </li> 2988 `:d} 2989 ${g(this._isGiftCardsEnabled&&!!this._hasAppliedGiftCards?.value,()=>r` <li><basket-gift-cards-discounts-list></basket-gift-cards-discounts-list></li>`,()=>d)} 2990 </ul> 2991 </div> 2992 `}}Rs([u()],Kt.prototype,"_showTaxInfo");Rs([u()],Kt.prototype,"_showGrossPrices");class lr extends f{constructor(){super(),this._flashMessengerRef=P(),this._handleFlashMessages=(e,t)=>{if(e){this._flashMessengerApi.removeAllFlashMessages("basket-summary-checkout-footer");return}this._flashMessengerApi.addFlashMessage({content:this._translationsApi.translate(t),type:z.error,isCloseable:!1,timeout:0},"basket-summary-checkout-footer")},this._basketOverallApi=this.getApiSync(H.api),this._translationsApi=this.getApiSync(J.api),this._flashMessengerApi=this.getApiSync(ae.api),this._val
2992idationMessage=new E(this,this._basketOverallApi.selectSectionValidation$()),this._basketOverallApi.selectSectionValidation$().subscribe(({isValid:e,validationMessage:t})=>{e?this.classList.remove("basket-module_error"):(this.classList.add("basket-module_error"),this.scrollIntoView()),t&&this._handleFlashMessages(e,t)})}static{this.moduleName="basket-summary-checkout-footer"}render(){return super.render(),r` 2993 <div class="basket-module__content basket-module__content_secondary"> 2994 <footer class="basket-summary__footer"> 2995 <flash-messenger 2996 ${I(this._flashMessengerRef)} 2997 class="d-block mb-xs-1" 2998 name="basket-summary-checkout-footer" 2999 tabindex="-1" 3000 ></flash-messenger> 3001 3002 <total-and-pay></total-and-pay> 3003 </footer> 3004 </div> 3005 `}}var cr=Object.defineProperty,Qe=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&cr(e,t,s),s};class Te extends f{constructor(){super(),this._checkoutButton=r``,this._loyaltyPointsAwardInfo="",this._loginInfo="",this._canBuyWhileUnregistered=!1,this._showNetPrices=!1,this._basketOverallApi=this.getApiSync(H.api),this._basketPromotionsApi=this.getApiSync(ge.api),this._basketLoyaltyApi=this.getApiSync("basketLoyaltyApi"),this._basketPaymentsApi=this.getApiSync(Ie.api),this._translationApi=this.getApiSync(J.api),this._authenticationApi=this.getApiSync(ds.api),this._storefrontSettingsApi=this.getApiSync(L.api),this._basketOrderApi=this.getApiSync(Re.api),this._storefrontSettingsApi.selectSkinSettings$().subscribe(e=>{this._canBuyWhileUnregistered=e.isBuyingEnabledToUnregistered==="1",this._showNetPrices=e.showNetPrices==="1"}),this._totalSum=new E(this,this._storefrontSettingsApi.isFeatureEnabled("dev_gift_cards")?this._basketOverallApi.selectSumToPay$():this._basketOverallApi.selectSum$()),this._promotions=new E(this,this._basketPromotionsApi.select$()),this._hasPromotionCode=new E(this,this._basketPromotionsApi.selectHasPromotionCode$()),this._loyaltyPointsAwarded=new E(this,this._basketLoyaltyApi.selectLoyaltyPointsAwarded$()),this._basketPaymentsApi.selectSelectedPayment$().subscribe(async e=>{const t=this._basketPaymentsApi.getPaymentChannelStrategy(e?.channelKey);this._checkoutButton=await t.getPaymentButton()}),this._basketLoyaltyApi.selectLoyaltyPointsAwarded$().pipe(A(e=>e&&e.points)).subscribe(e=>{this._loyaltyPointsAwardInfo=this._translationApi.translate("For this order, you will receive {{ points }}",{points:`<strong>${e} ${this._translationApi.translate("loyalty points")}</strong>`,interpolation:{escapeValue:!1}})}),this._loginInfo=this._translationApi.translate("{{ login }} or {{ register }} to continue.",{login:`<login-modal-opener class="link link_regular">${this._translationApi.translate("Log in")}</login-modal-opener>`,register:`<register-modal-opener class="link link_regular">${this._translationApi.translate("register an account")}</register-modal-opener>`,interpolation:{escapeValue:!1}})}static{this.moduleName="total-and-pay"}render(){return r` 3006 <ul class="price-list"> 3007 <li class="price-list__item"> 3008 <span class="price-list__label">${l("Total")}</span> 3009 <span class="price-list__value price price_m"> 3010 ${g(this._hasPromotionCode.value||this._promotions.value&&this._promotions.value.length>0,()=>r` 3011 <p class="p p_no-margin price__value"> 3012 <strong class="p_l font_semibold price__value_special"> 3013 ${this._totalSum.value?.grossValueFormatted} 3014 </strong> 3015 ${this._showNetPrices?l("with VAT"):d} 3016 </p> 3017 `,()=>r` 3018 <strong class="d-block p_l font_semibold price__value"> 3019 ${this._totalSum.value?.grossValueFormatted} ${this._showNetPrices?l("with VAT"):d} 3020 </strong> 3021 `)} 3022 <p class="p_s p_no-margin color_tertiary"> 3023 ${this._showNetPrices?r`${this._totalSum.value?.netValueFormatted} ${l("without VAT")}`:r`${l("Includes VAT")}`} 3024 </p> 3025 </span> 3026 </li> 3027 </ul> 3028 3029 ${F(this._basketOrderApi.selectOrderInProgress$(),r`<div> 3030 <div class="btn btn_primary btn_full-width"> 3031 <div class="loader"> 3032 <div class="loader__spinner loader__spinner_xs"></div> 3033 </div> 3034 </div> 3035 </div>`,r` ${this._checkoutButton} `)} 3036 ${!this._canBuyWhileUnregistered&&!this._authenticationApi.isAuthorized()?r` <p class="p_xs p_no-margin mt-xs-1">${j(this._loginInfo)}</p> `:d} 3037 ${g(this._loyaltyPointsAwarded.value&&this._loyaltyPointsAwarded.value.points>0,()=>r` <p class="p_xs color_secondary mt-xs-2">${j(this._loyaltyPointsAwardInfo)}</p> `,()=>d)} 3038 `}}Qe([u()],Te.prototype,"_checkoutButton");Qe([u()],Te.prototype,"_loyaltyPointsAwardInfo");Qe([u()],Te.prototype,"_loginInfo");Qe([u()],Te.prototype,"_canBuyWhileUnregistered");Qe([u()],Te.prototype,"_showNetPrices");class dr extends f{constructor(){super(...arguments),this._teaserButtonRef=P(),this._handleTeaserButtonAria=e=>{this._teaserButtonRef.value?.setAttribute("aria-expanded",e.type==="open"?"true":"false")}}static{this.moduleName="basket-address-form-teaser"}connectedCallback(){super.connectedCallback(),this.addEventListener("open",this._handleTeaserButtonAria),this.addEventListener("close",this._handleTeaserButtonAria)}render(){return r` 3039 <div class="basket-addresses__form-teaser"> 3040 <div 3041 inert 3042 role="presentation" 3043 class="basket-addresses__form-teaser-blur" 3044 > 3045 <h-control class="control control_row pt-xs-1">
3046 <h-control-content class="control__content_auto"> 3047 <h-control-element class="control__element"> 3048 <div class="radio-box"> 3049 <input 3050 type="radio" 3051 checked 3052 value="false" 3053 class="radio-box__input" 3054 tabindex="-1" 3055 /> 3056 3057 <label class="radio-box__label"> ${l("Consumer")} </label> 3058 </div> 3059 </h-control-element> 3060 </h-control-content> 3061 3062 <h-control-content class="control__content_auto"> 3063 <h-control-element class="control__element"> 3064 <div class="radio-box"> 3065 <input 3066 type="radio" 3067 value="false" 3068 class="radio-box__input" 3069 tabindex="-1" 3070 /> 3071 3072 <label class="radio-box__label"> ${l("Company")} </label> 3073 </div> 3074 </h-control-element> 3075 </h-control-content></h-control 3076 > 3077 3078 <h-control class="control"> 3079 <h-control-label class="control__label"> 3080 <label class="label label_required"> 3081 <span class="label__asterisk" aria-hidden="true">*</span> 3082 ${l("E-mail address")} 3083 </label> 3084 </h-control-label> 3085 3086 <h-control-content class="control"> 3087 <h-control-element class="control__element"> 3088 <div class="input"> 3089 <div class="input__control"> 3090 <input 3091 type="text" 3092 tabindex="-1" 3093 /> 3094 </div> 3095 </div> 3096 </h-control-element> 3097 </h-control-content> 3098 </h-control> 3099 3100 <h-control class="control"> 3101 <h-control-label class="control__label"> 3102 <label class="label label_required"> 3103 <span class="label__asterisk" aria-hidden="true">*</span> 3104 ${l("First name")} 3105 </label> 3106 </h-control-label> 3107 3108 <h-control-content class="control"> 3109 <h-control-element class="control__element"> 3110 <div class="input"> 3111 <div class="input__control"> 3112 <input 3113 type="text" 3114 tabindex="-1" 3115 /> 3116 </div> 3117 </div> 3118 </h-control-element> 3119 </h-control-content> 3120 </h-control> 3121 3122 <h-control class="control"> 3123 <h-control-label class="control__label"> 3124 <label class="label label_required"> 3125 <span class="label__asterisk" aria-hidden="true">*</span> 3126 ${l("Last name")} 3127 </label> 3128 </h-control-label> 3129 3130 <h-control-content class="control"> 3131 <h-control-element class="control__element"> 3132 <div class="input">
3133 <div class="input__control"> 3134 <input 3135 type="text" 3136 tabindex="-1" 3137 /> 3138 </div> 3139 </div> 3140 </h-control-element> 3141 </h-control-content> 3142 </h-control> 3143 </div> 3144 3145 <button 3146 ${I(this._teaserButtonRef)} 3147 aria-haspopup="dialog" 3148 aria-expanded="false" 3149 class="btn btn_primary basket-addresses__form-teaser-btn" 3150 aria-label="${l("Open the Order information form")}" 3151 > 3152 <h-icon 3153 icon-name="icon-user" 3154 css-classes="btn__icon btn__icon_left" 3155 aria-hidden="true" 3156 ></h-icon> 3157 ${l("Add order information")} 3158 </button> 3159 </div> 3160 `}}class hr{constructor({httpApi:e,basketAddressesApi:t}){this.API_BASE_URL="//api-shipx-pl.easypack24.net/v1/points",this.PICKUP_POINTS_LIMIT=5,this.#e=e,this.#t=t}static{this.strategyName="inpost"}#e;#t;async findNearestPickupPoints(){const e=this.#t.getPickupPointData()?.zipCode??this.#t.getBillingAddress()?.zipCode;if(!e)return[];try{const t=await this._fetchPickupPoints(e);return this._processPickupPointsResponse(t)}catch(t){return console.error("Error fetching pickup points:",t),[]}}async _fetchPickupPoints(e){const t=`${this.API_BASE_URL}?relative_post_code=${e}&limit=${this.PICKUP_POINTS_LIMIT}`;return this.#e.fetch({method:"get",url:t})?.response||null}_processPickupPointsResponse(e){if(!e||e.status!==200)return[];const t=new re;return e.data.items?.map(i=>t.inpostToModel(i))||[]}}class pr{execute(){return hr}}class ur{constructor({httpApi:e,basketAddressesApi:t,integrationData:i}){this.API_BASE_URL="//mapa.apaczka.pl/access_points/fetch",this.PICKUP_POINTS_LIMIT=5,this.#e=e,this.#t=t,this.#s=i.appId,this.#a=i.pickupPointTypes}static{this.strategyName="inpost"}#e;#t;#s;#a;async findNearestPickupPoints(){const e=this.#t.getPickupPointData()?.zipCode??this.#t.getBillingAddress()?.zipCode;if(!e)return[];try{const t=await this._fetchPickupPoints(e);return this._processPickupPointsResponse(t)}catch(t){return console.error("Error fetching pickup points:",t),[]}}async _fetchPickupPoints(e){const t=`${this.API_BASE_URL}`;return this.#e.fetch({method:"post",url:t,data:{app_id:this.#s,startRow:0,endRow:this.PICKUP_POINTS_LIMIT,operationType:"fetch",orderBy:"foreign_access_point_id",data:{operator:"and",criteria:[{field:"is_active",operator:"=",value:"1"},{field:"services_receiver",operator:"=",value:!0},{field:"country_code",operator:"=",value:"PL"},{field:"supplier",operator:"in",value:this.#a},{operator:"or",criteria:[{field:"foreign_access_point_id",operator:"like",value:e},{field:"name",operator:"like",value:e},{field:"street",operator:"like",value:e},{field:"house_number",operator:"like",value:e},{field:"city",operator:"like",value:e},{field:"postal_code",operator:"like",value:e}]}]}}})?.response||null}_processPickupPointsResponse(e){if(!e||e.status!==200)return[];const t=new re;return e.data.data?.map(i=>t.shoperDeliveryToModel({...i,street:`${i.street}${i.house_number?` ${i.house_number}`:""}`}))||[]}}class mr{execute(){return ur}}class _r{constructor({httpApi:e,basketAddressesApi:t,basketShippingsApi:i}){this.API_BASE_URL="/console/plugin/execute/plugin/InPostInternational-Points/act/points",this.#e=e,this.#t=t,this.#s=i}static{this.strategyName="inpostInternational"}#e;#t;#s;async findNearestPickupPoints(){const e=this.#t.getPickupPointData()?.zipCode??this.#t.getBillingAddress()?.zipCode,t=this.#s.getSelectedShippingCountry()?.country.isocode;if(!e||!t)return[];try{const i=await this._fetchPickupPoints(e,t);return this._processPickupPointsResponse(i)}catch(i){return console.error("Error fetching pickup points:",i),[]}}async _fetchPickupPoints(e,t){const i=new URLSearchParams;i.append("countryCode",t),i.append("postalCode",e);const s=`${this.API_BASE_URL}?countryCode=${t}&postalCode=${e}`;return this.#e.fetch({method:"get",url:s,headers:{"Content-Type":"application/x-www-form-urlencoded"},data:i})?.response||null}_processPickupPointsResponse(e){if(!e||e.status!==200||!e.data.length)return[];const t=new re;return e.data?.map(i=>t.inpostInternationalToModel(i))||[]}}class gr{execute(){return _r}}const ns={inpost:pr,ShoperShipment:mr,InPostInternational:gr};class yr extends O{#e;#t;#s;#a=new Ft;#n=null;#r=new ve(!1);constructor({httpApi:e,basketShippingsApi:t,basketAddressesApi:i}){super(),this.#e=e,this.#t=i,this.#s=t,t.selectSelectedShipping$().subscribe(s=>{s&&this.setNearestPickupPointsStrategy(s)})}getNearestPickupPointsStrategy(){return this.#n}hasNearestPickupPointStrategy(){return this.#r.getValue()}selectHasNearestPickupPointStrategy$(){return this.#r.asObservable().pipe(k())}setNearestPickupPointsStrategy(e){let t=e.shippingKey;if(t==="parcelLocker"){const a=e.integrationData;a.nearestPickupPointsShippingKey&&(t=a.nearestPickupPointsShippingKey)}if(!this._isStrategyAvailable(t)||!e.isPickupPointDelivery)return this._clearPickupPointService(),null;const i=this._getUniqueShippingName(t,e.id);this._ensureStrategyExists(t,i);const s=this._createPickupPointStrategy(e.integrationData);return this._updateServiceState(s),s}_isStrategyAvailable(e){return!!ns[e]}_getUniqueShippingName(e,t){return`${e}_${t}`}_ensureStrategyExists(e,t){this.#a.has(t)||this.#a.add(t,new ns[e]),this.#a.setCurrent(t)}_createPickupPointStrategy(e){const t=this.#a.execute(null);return new t({httpApi:this.#e,basketAddressesApi:this.#t,basketShippingsApi:this.#s,integrationData:e})}_updateServiceState(e){this.#r.next(!0),this.#n=e}_clearPickupPointService(){this.#r.next(!1),this.#n=null}async findNearestPickupPoints(){return this.#n?this.#n.findNearestPickupPoints():[]}}class br extends de{constructor({nearestPickupPointsService:e}){super(),this.moduleName=Ps.api,this.#e=e}#e;getNearestPickupPointsStrategy(){return this.#e.getNearestPickupPointsStrategy()}hasNearestPickupPointStrategy(){return this.#e.hasNearestPickupPointStrategy()}selectHasNearestPickupPointStrategy$(){return this.#e.selectHasNearestPickupPointStrategy$()}setNearestPickupPointsStrategy(e){return this.#e.setNearestPickupPointsStrategy(e)}async findNearestPickupPoints(){return this.#e.findNearestPickupPoints()}}var fr=Object.defineProperty,Oe=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&fr(e,t,s),s};class Ae extends f{constructor(){super(...arguments),this.selectedPickupPoint=null,this.nearestPickupPoints=[],this._isSelectedPointOnList=!1,this._showErrorFlag=!1,this.focusedId="",this._nearestPickupPointZipCodeId=`nearear-pickup-point-zip-code-${v()}`,this._debouncedSearch=Tt(async e=>{e&&e.trim().length>0&&(this.emitCustomEvent("nearestPickupPointsSearch",{bubbles:!0,detail:{zipCode:e}}),this._showErrorFlag=!0)},300)}static{this.moduleName="nearest-pickup-points"}_setPickupPoint(e,t){const i=e.target;this.focusedId=`nearest-pickup-point-${t.code}`,i instanceof HTMLInputElement&&i.name==="nearest_pickup_point"&&this.emitCustomEvent("pickupPointSelected",{bubbles:!0,detail:{pickupPoint:t}})}_handleInputChange(e){const t=e.target;this._debouncedSearch(t.value)}async updated(e){super.updated(e),this._isSelectedPointOnList=this.nearestPickupPoints.some(i=>i.code===this.selectedPickupPoint?.code);const t=`nearest-pickup-point-${this.selectedPickupPoint?.code}`;if(e.has("selectedPickupPoint")&&t){await this.updateComplete;const i=this.querySelector(`input#${t}`);i&&i.focus()}}
3160render(){return r`<h-control-label class="control__label"> 3161 <label 3162 class="label" 3163 for="${this._nearestPickupPointZipCodeId}" 3164 >${l("Choose a delivery point near you")}</label 3165 > 3166 </h-control-label> 3167 3168 <h-control> 3169 <h-control-content class="control"> 3170 <h-control-element class="control__element"> 3171 <h-input 3172 controlId="${this._nearestPickupPointZipCodeId}" 3173 controlName="nearest_pickup_point_zip_code" 3174 placeholder=${l("Enter your postal code")} 3175 @keyup="${e=>this._handleInputChange(e)}" 3176 > 3177 <h-input-control></h-input-control> 3178 3179 <h-icon 3180 icon-name="icon-search" 3181 aria-hidden="true" 3182 ></h-icon> 3183 </h-input> 3184 </h-control-element> 3185 </h-control-content> 3186 </h-control> 3187 3188 <div role="radiogroup"> 3189 ${g(this._showErrorFlag&&this.nearestPickupPoints.length<=0,()=>r`<div class="flash-message flash-message__error mb-xs-2"> 3190 <h-icon 3191 icon-name="icon-alert-triangle" 3192 css-classes="flash-message__icon" 3193 role="button" 3194 aria-hidden="true" 3195 ></h-icon> 3196 3197 <p>${l("No items match your search. Check if your data is correct.")}</p> 3198 </div>`,()=>d)} 3199 ${$e(this.nearestPickupPoints,e=>ms.encode(JSON.stringify(e)),e=>r` 3200 <h-radio 3201 controlId="${`nearest-pickup-point-${e.code}`}" 3202 controlName="nearest_pickup_point" 3203 class="basket-shipping__pickup-point-address nearest-pickup-points__point" 3204 .value="${e.code}" 3205 @change="${t=>this._setPickupPoint(t,e)}" 3206 ?checked="${this.selectedPickupPoint?.code===e.code}" 3207 > 3208 <h-radio-control 3209 aria-describedby="${e?.description?`${e.code}-description`:""}" 3210 ></h-radio-control> 3211 3212 <h-radio-content class="nearest-pickup-points__radio"> 3213 <div class="nearest-pickup-points__header" slot="label"> 3214 <p class="font_size-xs p_no-margin"> 3215 <strong class="font_semibold"> ${e?.code} </strong>, ${e?.street} 3216 ${e?.houseNumber}, ${e?.postalCode} ${e?.city} 3217 <span class="sr-only">${e?.description}</span> 3218 </p> 3219 3220 <p 3221 class="font_size-xs nearest-pickup-points__description" 3222 id="${e.code}-description" 3223 slot="description" 3224 aria-hidden="true" 3225 > 3226 ${e?.description} 3227 </p> 3228 </div> 3229 </h-radio-content> 3230 </h-radio> 3231 `)} 3232 ${g(this._isSelectedPointOnList||!this.selectedPickupPoint,()=>d,()=>r`<h-radio 3233 controlId="${`nearest-pickup-point-${this.selectedPickupPoint?.code}`}" 3234 controlName="nearest_pickup_point" 3235 class="basket-shipping__pickup-point-address nearest-pickup-points__point" 3236 .value="${this.selectedPickupPoint?.code}" 3237 ?checked="${!0}" 3238 > 3239 <h-radio-control 3240 aria-describedby="${this.selectedPickupPoint?.address.description?`${this.selectedPickupPoint?.code}-description`:""}" 3241 ></h-radio-control> 3242 3243 <h-radio-content class="nearest-pickup-points__radio"> 3244 <div class="nearest-pickup-points__header" slot="label"> 3245 <p class="font_size-xs p_no-margin"> 3246 <strong class="font_semibold"> ${this.selectedPickupPoint?.code} </strong>, 3247 ${this.selectedPickupPoint?.address.street} ${this.selectedPickupPoint?.address.houseNumber}, 3248 ${this.selectedPickupPoint?.address.postalCode} ${this.selectedPickupPoint?.address.city}
3249 <span class="sr-only">${this.selectedPickupPoint?.address.description}</span> 3250 </p> 3251 </div> 3252 3253 <p 3254 class="font_size-xs nearest-pickup-points__description" 3255 id="${this.selectedPickupPoint?.code}-description" 3256 slot="description" 3257 aria-hidden="true" 3258 > 3259 ${this.selectedPickupPoint?.address.description} 3260 </p> 3261 </h-radio-content> 3262 </h-radio>`)} 3263 </div> 3264 3265 <p class="nearest-pickup-points__separator">${l("or")}</p>`}}Oe([p()],Ae.prototype,"shipping");Oe([p()],Ae.prototype,"selectedPickupPoint");Oe([p()],Ae.prototype,"nearestPickupPoints");Oe([u()],Ae.prototype,"_isSelectedPointOnList");Oe([u()],Ae.prototype,"_showErrorFlag");Oe([p({type:String})],Ae.prototype,"focusedId");class Sr{#e=[];addOrderValidation(e,t){this.#e.push({isValid:e,callback:t})}run(){const e=this.#e.find(t=>!t.isValid());return e?(e.callback(),!0):!1}}var Ar=Object.defineProperty,St=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&Ar(e,t,s),s};class Ye extends f{constructor(){super(),this._form=P(),this.address=null,this.addressMode=Z.consumerAndCompany,this.isLoggedIn=!1,this._formErrors=null,this._debouncedHandleAddressFormChange=Tt(async()=>{await this._form.value?.checkValidity()&&(this._formErrors=await this._addressController.saveAddressForm(async()=>this._form.value?.setBillingAddress(new Event("change"))))},300),this._addressController=new _t,this._storefrontSettings=this.getApiSync(L.api)}static{this.moduleName="billing-address-standard"}connectedCallback(){super.connectedCallback(),this._storefrontSettings.isFeatureEnabled("dev_storefront_address_form_save")?this.addEventListener("change",this._debouncedHandleAddressFormChange):this.addEventListener("focusout",this._handleAddressFormFocusOut.bind(this))}disconnectedCallback(){super.disconnectedCallback(),this._storefrontSettings.isFeatureEnabled("dev_storefront_address_form_save")&&this._debouncedHandleAddressFormChange?.cancel()}async _handleAddressFormFocusOut(e){const t=e.relatedTarget;setTimeout(async()=>{const i=t?.closest("h-dropdown-content");this._form.value?.contains(t)||this._form.value?.contains(document.activeElement)||i||(this._formErrors=await this._addressController.saveAddressForm(async()=>this._form.value?.setBillingAddress(e)))},100)}render(){return r` 3266 <div class="basket-module__content basket-module__content_pt-0"> 3267 <flash-messenger 3268 class="d-block mb-xs-2" 3269 name="billing-address-standard" 3270 ></flash-messenger> 3271 3272 <billing-address-form 3273 ${I(this._form)} 3274 .address=${this.address} 3275 .addressMode=${this.addressMode} 3276 .isLoggedIn=${this.isLoggedIn} 3277 .formErrors=${we.toJson(this._formErrors)} 3278 ></billing-address-form> 3279 </div> 3280 `}}St([p()],Ye.prototype,"address");St([p()],Ye.prototype,"addressMode");St([p()],Ye.prototype,"isLoggedIn");St([u()],Ye.prototype,"_formErrors");var vr=Object.defineProperty,Ds=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&vr(e,t,s),s};class Wt extends f{constructor(){super(),this._form=P(),this.address=null,this._formErrors=null,this._debouncedHandleAddressFormChange=Tt(async()=>{await this._form.value?.checkValidity()&&(this._formErrors=await this._addressController.saveAddressForm(async()=>this._form.value?.setShippingAddress(new Event("change"))))},300),this._addressController=new _t,this._storefrontSettings=this.getApiSync(L.api)}static{this.moduleName="shipping-address-standard"}connectedCallback(){super.connectedCallback(),this._storefrontSettings.isFeatureEnabled("dev_storefront_address_form_save")?this.addEventListener("change",this._debouncedHandleAddressFormChange):this.addEventListener("focusout",this._handleAddressFormFocusOut.bind(this))}disconnectedCallback(){super.disconnectedCallback(),this._storefrontSettings.isFeatureEnabled("dev_storefront_address_form_save")&&this._debouncedHandleAddressFormChange?.cancel()}async _handleAddressFormFocusOut(e){const t=e.relatedTarget;setTimeout(async()=>{const i=t?.closest("h-dropdown-content");this._form.value?.contains(t)||this._form.value?.contains(document.activeElement)||i||(this._formErrors=await this._addressController.saveAddressForm(async()=>this._form.value?.setShippingAddress(e)))},100)}render(){return r` <flash-messenger 3281 class="d-block mb-xs-2" 3282 name="shipping-address-standard" 3283 ></flash-messenger> 3284 <shipping-address-form 3285 ${I(this._form)} 3286 .address=${this.address} 3287 .formErrors=${we.toJson(this._formErrors)} 3288 ></shipping-address-form>`}}Ds([p()],Wt.prototype,"address");Ds([u()],Wt.prototype,"_formErrors");class kr extends f{static{this.moduleName="edit-billing-address-modal"}constructor(){super(),this._basketAddressesApi=this.getApiSync("basketAddressesApi"),this._settingsApi=this.getApiSync(L.api),this._billingCountry$=this._basketAddressesApi.selectBillingAddress$().pipe(A(e=>{if(e){const t=e.country,i=e.countryId;return t?this._settingsApi.getCountryByCode(t):i?this._settingsApi.getCountryById(i):null}return null}))}connectedCallback(){super.connectedCallback()}
3288render(){return r`<div class="pl-xs-2 pr-xs-2 mb-xs-2"> 3289 <flash-messenger name="basket-addresses-1"></flash-messenger> 3290 </div> 3291 3292 <div class="pl-xs-2 pr-xs-2"> 3293 <h3 class="font_semibold mb-xs-2">${l("Buyer's details")}</h3> 3294 3295 <address class="address-card mb-xs-2"> 3296 <address-card 3297 .address=${$(this._basketAddressesApi.selectBillingAddress$())} 3298 .country=${$(this._billingCountry$)} 3299 ></address-card> 3300 3301 <button 3302 aria-haspopup="dialog" 3303 aria-label="${l("Edit buyer details")}" 3304 @click=${()=>{this.emitCustomEvent("open-modal",{bubbles:!0})}} 3305 class="link link_no-underline mt-xs-1" 3306 > 3307 <h-icon 3308 css-classes="mr-xs-1 icon_link icon_link_left" 3309 icon-name="icon-edit" 3310 aria-hidden="true" 3311 ></h-icon> 3312 ${l("Edit")} 3313 </button> 3314 </address> 3315 </div>`}}class $r extends f{static{this.moduleName="edit-shipping-address-modal"}constructor(){super(),this._basketAddressesApi=this.getApiSync("basketAddressesApi"),this._settingsApi=this.getApiSync(L.api),this._shippingCountry$=this._basketAddressesApi.selectShippingAddress$().pipe(A(e=>{if(e){const t=e.country,i=e.countryId;return t?this._settingsApi.getCountryByCode(t):i?this._settingsApi.getCountryById(i):null}return null}))}render(){return r` <header class="font_size-s mb-xs-1"> 3316 <b class="font_semibold">${l("Delivery address")}</b> 3317 </header> 3318 <address class="address-card"> 3319 <address-card 3320 .address=${$(this._basketAddressesApi.selectShippingAddress$())} 3321 .country=${$(this._shippingCountry$)} 3322 ></address-card> 3323 3324 <button 3325 aria-haspopup="dialog" 3326 aria-label="${l("Edit shipping address")}" 3327 @click=${()=>{this.emitCustomEvent("open-modal",{bubbles:!0})}} 3328 class="link link_no-underline mt-xs-1" 3329 > 3330 <h-icon 3331 css-classes="mr-xs-1 icon_link icon_link_left" 3332 icon-name="icon-edit" 3333 aria-hidden="true" 3334 ></h-icon> 3335 ${l("Edit")} 3336 </button> 3337 </address>`}}class Pr extends f{constructor(){super(),this._modal=P(),this._showModal=e=>{ie.nextTick(()=>{e?this._modal.value?.open():this._modal.value?.close()})},this._preventConsentModalFromClosingOnEscape=e=>{e.key==="Escape"&&e.stopImmediatePropagation()},this._preventConsentModalFromClosingOnBackdropClick=e=>{e.stopImmediatePropagation()},this._basketOrderApi=this.getApiSync(Re.api)}static{this.moduleName="modal-order-queued"}connectedCallback(){super.connectedCallback(),this._sub=this._basketOrderApi.selectIsOrderQueued$().subscribe(this._showModal),document.addEventListener("keydown",this._preventConsentModalFromClosingOnEscape),document.addEventListener(Ve.clicked,this._preventConsentModalFromClosingOnBackdropClick)}disconnectedCallback(){super.disconnectedCallback(),this._sub.unsubscribe(),document.removeEventListener("keydown",this._preventConsentModalFromClosingOnEscape),document.removeEventListener(Ve.clicked,this._preventConsentModalFromClosingOnBackdropClick)}render(){return r`<h-modal 3338 ${I(this._modal)} 3339 class="modal-wrapper_s modal_queue" 3340 > 3341 <h-modal-header class="modal__header_center"> 3342 <h2 class="font_semibold h2">${l("Your order is being processed")}</h2> 3343 </h-modal-header> 3344 <h-modal-body> 3345 <p class="font_size-s text-align-center"> 3346 ${l("Due to high demand, it may take a little longer. Thank you for your patience and trust
3346!")} 3347 </p> 3348 3349 <div 3350 class="loader mt-xs-4 mb-xs-4" 3351 role="progressbar" 3352 aria-busy="true" 3353 > 3354 <div class="loader__spinner loader__spinner_l"></div> 3355 </div> 3356 3357 <p class="text-align-center mt-xs-2 mb-xs-4">${l("Don't leave this page")}</p> 3358 </h-modal-body> 3359 </h-modal>`}}const Cr=({storeName:n="BasketUpdaterStore"}={})=>U({name:n},K({isCreateBasketQueued:!1}));class Ir{#e;constructor(e){this.#e=e}setIsCreateBasketInProgress(e){this.#e.update(y("isCreateBasketQueued",e))}getIsCreateBasketInProgress(){return this.#e.getValue().isCreateBasketQueued}selectIsCreateInProgress$(){return this.#e.pipe(C(e=>e.isCreateBasketQueued))}}class wr extends f{constructor(){super(),this._modal=P(),this._showModal=e=>{ie.nextTick(()=>{e?this._modal.value?.open():this._modal.value?.close()})},this._preventConsentModalFromClosingOnEscape=e=>{e.key==="Escape"&&e.stopImmediatePropagation()},this._preventConsentModalFromClosingOnBackdropClick=e=>{e.stopImmediatePropagation()},this._basketUpdaterApi=this.getApiSync(Mt.api)}static{this.moduleName="modal-create-basket-queued"}connectedCallback(){super.connectedCallback(),this._sub=this._basketUpdaterApi.selectIsBasketCreateInProgress$().subscribe(this._showModal),document.addEventListener("keydown",this._preventConsentModalFromClosingOnEscape),document.addEventListener(Ve.clicked,this._preventConsentModalFromClosingOnBackdropClick)}disconnectedCallback(){super.disconnectedCallback(),this._sub.unsubscribe(),document.removeEventListener("keydown",this._preventConsentModalFromClosingOnEscape),document.removeEventListener(Ve.clicked,this._preventConsentModalFromClosingOnBackdropClick)}render(){return r`<h-modal 3360 ${I(this._modal)} 3361 class="modal_queue modal-wrapper_s" 3362 > 3363 <h-modal-header class="modal__header_center"> 3364 <h2 class="font_semibold h2">${l("Please wait, adding product...")}</h2> 3365 </h-modal-header> 3366 <h-modal-body> 3367 <p class="font_size-s text-align-center"> 3368 ${l("Adding the product to your cart will take a moment due to high demand. Please do not refresh the page.")} 3369 </p> 3370 3371 <div 3372 class="loader mt-xs-4 mb-xs-4" 3373 role="progressbar" 3374 aria-busy="true" 3375 > 3376 <div class="loader__spinner loader__spinner_l"></div> 3377 </div> 3378 </h-modal-body> 3379 </h-modal>`}}class Er extends O{constructor({basketGiftCardsService:e}){super(),this.moduleName=ne.api,this.#e=e}#e;addGiftCard(e){return this.#e.addGiftCard(e)}removeGiftCard(e){return this.#e.removeGiftCard(e)}getGiftCards(){return this.#e.getGiftCards()}getGiftCardById(e){return this.#e.getGiftCardById(e)}getGiftCardByCode(e){return this.#e.getGiftCardByCode(e)}
3379selectGiftCards$(){return this.#e.selectGiftCards$()}getCount(){return this.#e.getCount()}selectCount$(){return this.#e.selectCount$()}getSum(){return this.#e.getSum()}selectSum$(){return this.#e.selectSum$()}getIsApplying(){return this.#e.getIsApplying()}selectIsApplying$(){return this.#e.selectIsApplying$()}hasAppliedGiftCards(){return this.#e.hasAppliedGiftCards()}selectHasAppliedGiftCards$(){return this.#e.selectHasAppliedGiftCards$()}}const Br=({storeName:n="BasketGiftCardsStore"}={})=>U({name:n},ye(),K({count:0,sum:null,isApplying:!1}));class xr{#e;constructor(e){this.#e=e}setGiftCards(e){this.#e.update(fe(e))}getGiftCards(){return this.#e.query(ce())}getGiftCardById(e){return this.#e.query(di(e))}getGiftCardByCode(e){return this.#e.query(ce()).find(t=>t.code===e)}selectGiftCards$(){return this.#e.pipe(be())}setCount(e){this.#e.update(y("count",e))}getCount(){return this.#e.getValue().count}selectCount$(){return this.#e.pipe(C(e=>e.count))}setSum(e){this.#e.update(y("sum",e))}getSum(){return this.#e.getValue().sum}selectSum$(){return this.#e.pipe(C(e=>e.sum))}setIsApplying(e){this.#e.update(y("isApplying",e))}getIsApplying(){return this.#e.getValue().isApplying}selectIsApplying$(){return this.#e.pipe(C(e=>e.isApplying))}}class Mr extends O{#e;#t;#s;#a;#n;#r;#o;constructor({basketGiftCardsRepository:e,basketHttpApi:t,basketUpdaterApi:i,basketOverallApi:s,messageStorageApi:a,flashMessengerApi:o,translationsApi:c}){super(),this.#e=e,this.#t=t,this.#s=i,this.#a=s,this.#n=a,this.#r=o,this.#o=c,this._setupEventListeners()}_setupEventListeners(){new q(this.#i,this.#n)}#i=({body:e})=>{e?.giftCards&&(this.#e.setGiftCards(e.giftCards.list),this.#e.setCount(e.giftCards.count),this.#e.setSum(e.giftCards.sum))};async addGiftCard(e){const t=this.#a.getActions().addGiftCard;if(!t)throw new Error("Adding gift cards is not allowed");this.#e.setIsApplying(!0);try{const{response:i}=this.#t.addGiftCard(t,e),{data:s}=await i;return this.#s.emitUpdateBasketEvent(s),!s.flashMessages.some(a=>a.isError)}catch(i){return i.response?.status===xt.notFound||i.response?.status===xt.tooManyRequests?(this.#s.emitUpdateBasketEvent(i.response.data),!1):(this._handleUnexpectedError(i),!1)}finally{this.#e.setIsApplying(!1)}}async removeGiftCard(e){try{const{response:t}=this.#t.removeGiftCard(e.removeAction),{data:i}=await t;return this.#s.emitUpdateBasketEvent(i),!i.flashMessages.some(s=>s.isError)}catch(t){return this._handleUnexpectedError(t),!1}}getGiftCards(){return this.#e.getGiftCards()}getGiftCardById(e){return this.#e.getGiftCardById(e)}getGiftCardByCode(e){return this.#e.getGiftCardByCode(e)}
3379selectGiftCards$(){return this.#e.selectGiftCards$().pipe(k((e,t)=>B(e,t)))}getCount(){return this.#e.getCount()}selectCount$(){return this.#e.selectCount$().pipe(k())}getSum(){return this.#e.getSum()}selectSum$(){return this.#e.selectSum$().pipe(k((e,t)=>B(e,t)))}getIsApplying(){return this.#e.getIsApplying()}selectIsApplying$(){return this.#e.selectIsApplying$()}hasAppliedGiftCards(){return this.#e.getGiftCards().length>0}selectHasAppliedGiftCards$(){return this.#e.selectGiftCards$().pipe(A(e=>e.length>0),k())}_handleUnexpectedError(e){console.error(e),this.#r.addFlashMessage({type:"error",content:this.#o.translate("An unexpected error occurred")}),this.eventBus.emit(new m(S.unexpectedError))}}var Fr=Object.defineProperty,At=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&Fr(e,t,s),s};class Je extends f{constructor(){super(),this._headerId=`gift-cards-header-${v()}`,this._subscriptionController=new Lt(this),this._sectionRef=P(),this._isAvailable=!1,this._isContentExpanded=!1,this._isGiftCardFormVisible=!1,this._isDevGiftCardsPaymentCheckFlagEnabled=!1,this._handleFormReady=e=>{e.target.focusInput()},this._storefrontSettingsApi=this.getApiSync(L.api),this._basketGiftCardsApi=this.getApiSync(ne.api),this._basketOverallApi=this.getApiSync(H.api),this._isDevGiftCardsPaymentCheckFlagEnabled=this._storefrontSettingsApi.isFeatureEnabled("dev_gift_cards_payment_check"),this._isAvailable=!!this._basketOverallApi.getActions().addGiftCard,this._isContentExpanded=this._basketGiftCardsApi.hasAppliedGiftCards(),this._isDevGiftCardsPaymentCheckFlagEnabled&&this._initAvailabilityHandler(),this._canAddAnotherCard$=D([this._basketGiftCardsApi.selectHasAppliedGiftCards$(),this._basketOverallApi.selectSumToPay$()]).pipe(A(([e,t])=>e&&(t?.grossValue??0)>0)),this._initGiftCardsCountHandler()}static{this.moduleName="gift-cards"}_initAvailabilityHandler(){const e=this._basketOverallApi.selectActions$().pipe(A(t=>!!t.addGiftCard));this._subscriptionController.subscribe(e,t=>{this._isAvailable=t,this._isAvailable?this.classList.add("module","basket-module"):this.classList.remove("module","basket-module")})}_initGiftCardsCountHandler(){const e=this._basketGiftCardsApi.selectCount$().pipe(us(this._basketGiftCardsApi.getCount()),ci());this._subscriptionController.subscribe(e,([t,i])=>{i>t&&(this._isGiftCardFormVisible=!1),i===0&&t>0?this._focusSection():this._focusGiftCardsList()})}_focusSection(){requestAnimationFrame(()=>{this._sectionRef.value?.focus()})}_focusGiftCardsList(){requestAnimationFrame(()=>{this.querySelector(".basket-gift-cards__list")?.focus()})}render(){return!this._isAvailable&&this._isDevGiftCardsPaymentCheckFlagEnabled?d:r`<section 3380 ${I(this._sectionRef)} 3381 class="basket-module__content basket-gift-cards" 3382 aria-labelledby="${this._headerId}" 3383 tabindex="-1" 3384 > 3385 <header class="grid__row"> 3386 <div class="grid__col grid__col_xs-12 grid__col_sm-grow "> 3387 <h2 3388 id="${this._headerId}" 3389 class="section-title section-title_s" 3390 > 3391 ${l("Gift card")} 3392 </h2> 3393 </div> 3394 <div class="grid__col grid__col_xs-12 grid__col_sm-auto d-flex"> 3395 ${F(this._basketGiftCardsApi.selectHasAppliedGiftCards$(),d,r`<button 3396 type="button" 3397 aria-expanded="${this._isContentExpanded}" 3398 class="basket-gift-cards__action-button" 3399 @click=${()=>this._isContentExpanded=!this._isContentExpanded} 3400 > 3401 ${l(this._isContentExpanded?"Cancel":"Add card")} 3402 </button>`)} 3403 </div> 3404 </header> 3405 ${g(this._isContentExpanded,()=>r` 3406 ${F(this._basketGiftCardsApi.selectHasAppliedGiftCards$(),r` 3407 <gift-cards-list></gift-cards-list> 3408 ${g(!this._isGiftCardFormVisible,()=>F(this._canAddAnotherCard$,r`<button 3409 type="button" 3410 class="basket-gift-cards__action-button basket-gift-cards__action-button_left" 3411 @click=${()=>{this._isGiftCardFormVisible=!0}} 3412 > 3413 <h-icon 3414 icon-name="icon-plus" 3415 aria-hidden="true" 3416 ></h-icon> 3417 ${l("Add another card")} 3418 </button>`,d),()=>r`<gift-cards-form @gift-cards-form-ready=${this._handleFormReady}></gift-cards-form>`)} 3419 <gift-cards-alerts></gift-cards-alerts> 3420 `,r`<gift-cards-form></gift-cards-form>`)} 3421 `)} 3422 </section>`}}At([u()],Je.prototype,"_isAvailable");At([u()],Je.prototype,"_isContentExpanded");At([u()],Je.prototype,"_isGiftCardFormVisible");At([u()],Je.prototype,"_isDevGiftCardsPaymentCheckFlagEnabled");class Tr extends f{static{this.moduleName="gift-cards-list"}constructor(){super(),this._basketGiftCardsApi=this.getApiSync(ne.api),this._giftCards=new E(this,this._basketGiftCardsApi.selectGiftCards$(
3422))}render(){return r`${F(this._basketGiftCardsApi.selectHasAppliedGiftCards$(),r` 3423 <ul 3424 class="basket-gift-cards__list" 3425 aria-label="${l("Gift cards list")}" 3426 tabindex="-1" 3427 > 3428 ${$e(this._giftCards.value??[],e=>e.id,e=>r`<li class="basket-gift-cards__list-item-wrapper"> 3429 <gift-cards-list-item .giftCard=${e}></gift-cards-list-item> 3430 </li>`)} 3431 </ul> 3432 `,d)}`}}var Or=Object.defineProperty,Lr=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&Or(e,t,s),s};class Us extends f{constructor(){super(),this._currentAlertId=null,this._removeGiftCard=async()=>{await this._basketGiftCardsApi.removeGiftCard(this.giftCard)},this._basketGiftCardsApi=this.getApiSync(ne.api),this._flashMessengerApi=this.getApiSync(ae.api),this._translationsApi=this.getApiSync(J.api),this._storefrontSettingsApi=this.getApiSync(L.api)}static{this.moduleName="gift-cards-list-item"}get _flashMessengerContainerName(){return`gift-card-item-${this.giftCard.id}`}get _locale(){return this._storefrontSettingsApi.getLocales().locale.replace("_","-")}updated(e){if(!e.has("giftCard"))return;const t=e.get("giftCard"),i=(t?.isOneTimeUse??!1)&&(t?.remainingBalance.grossValue??0)>0,s=this.giftCard.isOneTimeUse&&this.giftCard.remainingBalance.grossValue>0;i!==s&&(this._currentAlertId&&(this._flashMessengerApi.removeFlashMessage(this._currentAlertId,this._flashMessengerContainerName),this._currentAlertId=null),s&&(this._currentAlertId=this._flashMessengerApi.addFlashMessage({content:this._translationsApi.translate("This is a single-use card. You can use it for only one transaction. Any unused funds will be forfeited."),type:z.warning,isCloseable:!1,timeout:0},this._flashMessengerContainerName)))}disconnectedCallback(){this._currentAlertId&&(this._flashMessengerApi.removeFlashMessage(this._currentAlertId,this._flashMessengerContainerName),this._currentAlertId=null),super.disconnectedCallback?.()}_renderExpirationDate(){return this.giftCard.expirationDate?r`<time datetime="${this.giftCard.expirationDate.toISOString()}" 3433 >${vi.toLocaleDate(this.giftCard.expirationDate,this._locale)}</time 3434 >`:l("No expiration date")}render(){return r` 3435 <div class="basket-gift-cards__list-item"> 3436 <picture> 3437 <img 3438 class="basket-gift-cards__image" 3439 src="${this.giftCard.image.paths.original}" 3440 alt="${l("Gift card")} ${this.giftCard.truncatedCode}" 3441 /> 3442 </picture> 3443 <div class="basket-gift-cards__info"> 3444 <span class="basket-gift-cards__description-line basket-gift-cards__description-line_main" 3445 >${l("Last characters of the card code:")} ${this.giftCard.truncatedCode}</span 3446 > 3447 <span class="basket-gift-cards__description-line ">${l("Expiration date:")} ${this._renderExpirationDate()}</span> 3448 <span class="basket-gift-cards__description-line" 3449 >${l("Remaining balance on the card:")} ${this.giftCard.balance.grossValueFormatted}</span 3450 > 3451 </div> 3452 <button 3453 type="button" 3454 class="basket-gift-cards__action-button" 3455 @click=${this._removeGiftCard} 3456 > 3457 ${l("Remove")} 3458 </button> 3459 </div> 3460 <flash-messenger name="${this._flashMessengerContainerName}"></flash-messenger> 3461 `}}Lr([p({attribute:!1})],Us.prototype,"giftCard");class me{constructor({host:e,formRef:t,basketGiftCardsApi:i,giftCardInputId:s}){this.addGiftCard=async a=>{a.preventDefault();const o=this.getFormService(),c=o.getFormControl(this.#a);if(await o.validateControls(),!c||this.getFormState()===Pe.validationFailed)return;const h=me.normalizeGiftCardCode(c.value);await this.#s.addGiftCard(h)&&o.hasFormControl(this.#a)&&o.updateFormControl(this.#a,{value:""})},this.removeGiftCard=async a=>{await this.#s.removeGiftCard(a)},this.#e=e,this.#t=t,this.#s=i,this.#a=s,this.#e.addController(this)}#e;#t;#s;#a;static normalizeGiftCardCode(e){return e.replace(Ii,"").toUpperCase()}hostConnected(){}getFormState(){return this.getFormService().getFormState()}getFormService(){if(!this.#t.value)throw"No form found";return this.#t.value.formService}}const rs=4,Et=" ";class Nr{constructor({host:e,inputId:t}){this.#s=null,this._handleInput=i=>{const s=i.target,a=s.value,o=s.selectionStart??0,c=this._formatCode(a);if(c!==a){s.value=c;const h=this._calculateCursorPosition(a,c,o);s.setSelectionRange(h,h)}},this._handlePaste=i=>{const s=i.target,a=i.clipboardData;if(!a)return;const o=a.getData("text");if(!o)return;i.preventDefault();const c=s.selectionStart??0,h=s.selectionEnd??0,_=s.value,b=_.slice(0,c),w=_.slice(h),M=b+o+w,x=this._formatCode(M);s.value=x;const N=me.normalizeGiftCardCode(o),Le=me.normalizeGiftCardCode(b).length+N.length;let Xe=0,oe=0;for(let le=0;le<x.length;le++)if(x[le]!==Et&&(Xe++,Xe>
3461=Le)){oe=le+1;break}s.setSelectionRange(oe,oe),s.dispatchEvent(new Event("input",{bubbles:!0}))},this.#e=e,this.#t=t,this.#e.addController(this)}#e;#t;#s;hostConnected(){}hostUpdated(){this._attachEventListeners()}hostDisconnected(){this._removeEventListeners()}_formatCode(e){const t=me.normalizeGiftCardCode(e),i=[];for(let s=0;s<t.length;s+=rs)i.push(t.slice(s,s+rs));return i.join(Et)}_calculateCursorPosition(e,t,i){const s=e.slice(0,i),a=me.normalizeGiftCardCode(s).length;let o=0,c=0;for(let h=0;h<t.length;h++)if(t[h]!==Et){if(o++,o>a)break;c=h+1}return c}_attachEventListeners(){if(this.#s)return;const e=this.#e;this.#s=e.querySelector?.(`#${this.#t}`),this.#s&&(this.#s.addEventListener("input",this._handleInput),this.#s.addEventListener("paste",this._handlePaste))}_removeEventListeners(){this.#s&&(this.#s.removeEventListener("input",this._handleInput),this.#s.removeEventListener("paste",this._handlePaste),this.#s=null)}}class Vr extends f{constructor(){super(),this._reactiveFormRef=P(),this._formId=`form-gift-card-${v()}`,this._giftCardInputId=`gift-card-${v()}`,this._addGiftCard=async e=>{await this._formController.addGiftCard(e)},this._basketGiftCardsApi=this.getApiSync(ne.api),this._formController=new me({host:this,formRef:this._reactiveFormRef,basketGiftCardsApi:this._basketGiftCardsApi,giftCardInputId:this._giftCardInputId}),this._formatterController=new Nr({host:this,inputId:this._giftCardInputId})}static{this.moduleName="gift-cards-form"}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("gift-cards-form-ready",{bubbles:!0,composed:!0}))}async focusInput(){await this.updateComplete,this.querySelector(`#${this._giftCardInputId}`)?.focus()}render(){return r` 3462 <div class="control__additional-content"> 3463 <reactive-form ${I(this._reactiveFormRef)}> 3464 <h-control-label class="control__label"> 3465 <label 3466 class="label" 3467 for=${this._giftCardInputId} 3468 >${l("Enter the card code")}</label 3469 > 3470 </h-control-label> 3471 3472 <form 3473 class="d-flex" 3474 id=${this._formId} 3475 @submit=${this._addGiftCard} 3476 > 3477 <control-connector 3478 required 3479 errorMessage=${l("The field is required")} 3480 validationNameLabel=${void 0} 3481 validationMode="${gs.change}" 3482 class="control control_no-margin mr-xs-1" 3483 > 3484 <h-control> 3485 <h-control-content class="control"> 3486 <h-control-element class="control__element"> 3487 <h-input 3488 controlId=${this._giftCardInputId} 3489 controlName="gift_card_code" 3490 > 3491 <h-input-control></h-input-control> 3492 </h-input> 3493 </h-control-element> 3494 3495 <control-errors></control-errors> 3496 </h-control-content> 3497 </h-control> 3498 </control-connector> 3499 3500 <button 3501 type="submit" 3502 class="btn btn_secondary" 3503 ?disabled=${$(this._basketGiftCardsApi.selectIsApplying$())} 3504 @click=${this._addGiftCard} 3505 > 3506 ${l("Apply")} 3507 </button> 3508 </form> 3509 </reactive-form> 3510 </div> 3511 `}}const Bt="gift-cards-alerts";class Rr extends f{constructor(){super(),this._subscriptionController=new Lt(this),this._currentAlertId=null,this._basketGiftCardsApi=this.getApiSync(ne.api),this._flashMessengerApi=this.getApiSync(ae.api),this._translationsApi=this.getApiSync(J.api),this._basketOverallApi=this.getApiSync(H.api),this._setupAlerts()}static{this.moduleName="gift-cards-alerts"}_setupAlerts(){const e=D([this._basketGiftCardsApi.selectHasAppliedGiftCards$(
3511),this._basketOverallApi.selectSumToPay$()]).pipe(A(([t,i])=>this._resolveAlertMessage(t,i.grossValue,i.grossValueFormatted)));this._subscriptionController.subscribe(e,t=>{this._currentAlertId&&this._flashMessengerApi.removeFlashMessage(this._currentAlertId,Bt),this._currentAlertId=t?this._flashMessengerApi.addFlashMessage(t,Bt):null})}_resolveAlertMessage(e,t,i){return e?t>0?{content:this._translationsApi.translate("Amount remaining to be paid: {{ grossValue }}. Please choose a payment method.",{grossValue:i}),type:z.info,isCloseable:!1,timeout:0}:{content:this._translationsApi.translate("The card covers the entire order. Amount to pay: {{ grossValue }}.",{grossValue:i}),type:z.success,isCloseable:!1,timeout:0}:null}render(){return r`<flash-messenger name="${Bt}"></flash-messenger>`}}class Dr extends f{static{this.moduleName="basket-gift-cards-discounts-list"}constructor(){super(),this._storefrontSettingsApi=this.getApiSync(L.api),this._isGiftCardsEnabled=this._storefrontSettingsApi.isFeatureEnabled("dev_gift_cards"),this._isGiftCardsEnabled&&(this._basketGiftCardsApi=this.getApiSync(ne.api),this._giftCards=new E(this,this._basketGiftCardsApi.selectGiftCards$(
3511)),this._giftCardsSum=new E(this,this._basketGiftCardsApi.selectSum$()))}_renderGiftCardsList(){return this._giftCards?.value?r` 3512 ${this._giftCards.value.map(e=>r` 3513 <li class="price-list__item"> 3514 <span class="sr-only" 3515 >${l("Gift card ending with {{ code }}, {{ price }} paid",{code:e.truncatedCode,price:e.payWithCard.grossValueFormatted})}</span 3516 > 3517 <span 3518 class="price-list__label price_s" 3519 aria-hidden="true" 3520 >...${e.truncatedCode}</span 3521 > 3522 <span 3523 class="price-list__value price__value price__value_special price_s" 3524 aria-hidden="true" 3525 > 3526 ${e.payWithCard.grossValueFormatted} 3527 </span> 3528 </li> 3529 `)} 3530 `:d}_renderGiftCardsSum(){return this._giftCardsSum?.value?r` <span class="price__value price__value_special"> ${this._giftCardsSum.value.grossValueFormatted} </span> `:d}render(){const e=document.querySelector("#iconsPath")?.href||"/assets/img/icons/symbol-defs.svg";return r`${g(this._giftCards?.value&&this._giftCards.value.length>0,()=>r` 3531 <h-accordion 3532 lazy 3533 class="basket-discounts-list" 3534 > 3535 <h-accordion-group> 3536 <h-accordion-toggler class="accordion__toggler p_s mb-xs-1"> 3537 <span> 3538 ${l("Gift cards")} 3539 <svg 3540 class="icon accordion__toggler-icon accordion__toggler-icon_secondary" 3541 aria-hidden="true" 3542 > 3543 <use 3544 href="${e}#icon-chevron-down" 3545 xlink:href="${e}#icon-chevron-down" 3546 ></use> 3547 </svg> 3548 </span> 3549 3550 <span>${this._renderGiftCardsSum()}</span> 3551 </h-accordion-toggler> 3552 3553 <h-accordion-content 3554 ?is-dev-accordion-optimization-flag-enabled=${this._storefrontSettingsApi.isFeatureEnabled("dev_accordion_optimization")} 3555 > 3556 <ul 3557 class="price-list price-list_secondary price-list_s" 3558 aria-label="${l("Gift cards list")}" 3559 > 3560 ${this._renderGiftCardsList()} 3561 </ul> 3562 </h-accordion-content> 3563 </h-accordion-group> 3564 </h-accordion> 3565 `)}`}}class fo extends ei{static{this.featureName=os.feature}async init(){const e=this.getApiSync(ti),t=this.getApiSync(si),i=await this.getApi(L.api),s=await this.getApi(ae.api),a=await this.getApi(J.api),o=await this.getApi(hs.api),c=this.getApiSync(ii),h=await this.getApi(ai.api),_=new Ni({httpApi:t}),b=Cr(),w=new Ir(b),M=new Ri({basketHttpApi:_,flashMessengerApi:s,settingsApi:i,storeFactoryApi:c,translationsApi:a,basketUpdaterRepository:w}),x=new Di({basketUpdaterService:M}),N=this._createBasketOverallApi(e,_,x,s,a),se=this._createBasketOrderApi(_,s,h,a,i,c,N,x),Le=this._createProductsBasketApi(e,_,x,s,a),Xe=this._createBasketPromotionsApi(e,_,x,s,a,N),oe=this._createBasketShippingsApi(e,_,x,s,a,N,i,c),le=this._createBasketAddressesApi(e,_,x,oe,s,a,o,N,i),Gs=this._createBasketPaymentsApi(e,_,x,oe,N,s,a,i,se,le,h,c),qs=new yr({httpApi:t,basketShippingsApi:oe,basketAddressesApi:le}),zs=new br({nearestPickupPointsService:qs}),Hs=this._createBasketTaxesApi(e),Ks=this._createBasketLoyaltyApi(e),jt=i.isFeatureEnabled("dev_gift_cards")?this._createBasketGiftCardsApi(_,x,N,e,s,a):void 0,Ws=this._createBasketAdditionalFieldsApi(e,_,N,x);return this.eventBus.emit(new m(S.initialized)),{cores:[{type:ni.api,instance:[x,Le,Xe,Gs,oe,le,N,Hs,Ks,Ws,se,zs,...jt?[jt]:[]]},{type:ri,instance:[Nt,De,Ht,je,Kt,lr,ar,Be,Vt,yn,xe,Is,Rt,ws,dr,Dt,Me,ze,W,He,Ye,Wt,kr,$r,Bs,Tn,Ut,Ms,Gt,qt,V,Fe,Os,We,Ls,zt,Te,Ae,Pr,wr,...i.isFeatureEnabled("dev_gift_cards")?[Je,Tr,Us,Vr,Rr,Dr]:[]]}]}}_createProductsBasketApi(e,t,i,s,a){const o=Bi(),c=new xi(o),h=new Ei({basketProductsListRepository:c,basketHttpApi:t,basketUpdaterApi:i,messageStorageApi:e,flashMessengerApi:s,translationsApi:a}),_=Fi(),b=new Ti(_),w=new Oi({basketProductsSummaryRepository:b,messageStorageApi:e});return new Li({basketProductsListService:h,basketProductsSummaryService:w})}_createBasketPromotionsApi(e,t,i,s,a,o){const c=Ui(),h=new qi(c),_=new Gi({basketPromotionsListRepository:h,basketHttpApi:t,basketUpdaterApi:i,messageStorageApi:e,flashMessengerApi:s,translationsApi:a,basketOverallApi:o}),b=ji(),w=new Ki(b),M=new Hi({basketPromotionsSummaryRepository:w,messageStorageApi:e});return new zi({basketPromotionListService:_,basketPromotionSummaryService:M})}_createBasketPaymentsApi(e,t,i,s,a,o,c,h,_,b,w,M){const x=ga(),N=new ya(x),se=new Va({basketPaymentsListRepository:N,basketHttpApi:t,basketUpdaterApi:i,messageStorageApi:e,basketShippingsApi:s,basketOverallApi:a,flashMessengerApi:o,translationsApi:c,settingsApi:h,basketOrderApi:_,basketAddressesApi:b,pageManagerApi:w,templateHolder:new as,storeFactoryApi:M});return new _a({basketPaymentsListService:se})}_createBasketShippingsApi(e,t,i,s,a,o,c,h){const _=ma(),b=new ua(_),w=new pa({basketShippingsListRepository:b,basketHttpApi:t,basketUpdaterApi:i,messageStorageApi:e,flashMessengerApi:s,translationsApi:a,basketOverallApi:o,templateHolder:new as,settingsApi:c,storeFactoryApi:h}),M=Hn(),x=new Kn(M),N=new Wn({basketShippingsCountriesRepository:x,messageStorageApi:e});return new Qi({basketShippingsListService:w,basketShippingsCountriesService:N})}_createBasketAddressesApi(e,t,i,s,a,o,c,h,_){const b=Ra(),w=new Da(b),M=new za({basketAddressesRepository:w,basketHttpApi:t,basketUpdaterApi:i,messageStorageApi:e,basketShippingsApi:s,flashMessengerApi:a,translationsApi:o,userApi:c,basketOverallApi:h,settingsApi:_});return new Ha({basketAddressesService:M})}_createBasketAdditionalFieldsApi(e,t,i,s){const a=Ka(),o=new Wa(a),c=new ja({basketAdditionalFieldsRepository:o,messageStorageApi:e,basketOverallApi:i,basketHttpApi:t,basketUpdaterApi:s});return new Qa({basketAdditionalFieldsService:c})}_createBasketOverallApi(e,t,i,s,a){const o=Ya(),c=new Ja(o),h=new Xa({basketOverallRepository:c,basketHttpApi:t,basketUpdaterApi:i,messageStorageApi:e,flashMessengerApi:s,translationsApi:a});return new Za({basketOverallService:h})}_createBasketTaxesApi(e){const t=tn(),i=new an(t),s=new sn({basketTaxesSummaryRepository:i,messageStorageApi:e}),a=rn(),o=new on(a),c=new nn({basketTaxesListRepository:o,messageStorageApi:e});return new en({basketTaxesSummaryService:s,basketTaxesListService:c})}_createBasketLoyaltyApi(e){const t=cn(),i=new dn(t),s=new hn({basketLoyaltyRepository:i,messageStorageApi:e});return new ln({basketLoyaltyService:s})}_createBasketOrderApi(e,t,i,s,a,o,c,h){const _=Xn(),b=new Zn(_),w=new Sr,M=new Jn({basketHttpApi:e,flashMessengerApi:t,pageManagerApi:i,translationsApi:s,settingsApi:a,storeFactoryApi:o,basketOverallApi:c,basketOrderRepository:b,basketCustomValidation:w,basketUpdaterApi:h});return new jn({basketOrderService:M})}_createBasketGiftCardsApi(e,t,i,s,a,o){const c=Br(),h=new xr(c),_=new Mr({basketG
3565iftCardsRepository:h,basketHttpApi:e,basketUpdaterApi:t,basketOverallApi:i,messageStorageApi:s,flashMessengerApi:a,translationsApi:o});return new Er({basketGiftCardsService:_})}}export{fo as BasketInitializer};
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.