1import{i as Y}from"./chunk-7KJDRMG6.js";import{e as X}from"./chunk-QRUFIIZG.js";import{H as W}from"./chunk-N5PKFMYL.js";import"./chunk-FW3XOGNQ.js";import{ha as J,ma as K,pa as Q}from"./chunk-4FGNIY73.js";import{Dc as z,Qa as j,V as O,mb as q,qa as R}from"./chunk-4EAGKMR4.js";import"./chunk-VCYNJ5CM.js";import"./chunk-ULYM7PTS.js";import{W as L,ha as M,ka as H}from"./chunk-FR6I7CXG.js";import{$ as h,Ba as F,C as E,D as w,Da as N,Dc as u,Fc as s,Hc as $,Ic as y,Jc as D,Kc as P,Lc as d,Mc as r,Na as f,Nc as x,Od as m,Pd as C,Q as g,Tb as n,Wa as G,Wc as V,Xa as k,a as S,b as B,bd as A,dd as c,lc as U,sd as p,td as v,u as T,ud as b}from"./chunk-TUD7QO6V.js";function ee(t,a){if(t&1&&(d(0,"div",14)(1,"span"),p(2),r()()),t&2){let e=c(2).$implicit;n(2),v(e.formattedBundlePriceDifferenceValue)}}function te(t,a){if(t&1&&(d(0,"div",4)(1,"div",13)(2,"span"),p(3),m(4,"cxTranslate"),m(5,"uppercase"),r()(),u(6,ee,3,1,"div",14),r()),t&2){let e=c().$implicit,i=c(3);n(3),v(C(5,4,C(4,2,"productDetails.crossSellBundle"))),n(3),s(i.checkIfAllProductsHavePrice(e)?6:-1)}}function ie(t,a){t&1&&(d(0,"div",5),x(1,"div",15),d(2,"div",13)(3,"span"),p(4),m(5,"cxTranslate"),r()()()),t&2&&(n(4),v(C(5,1,"productDetails.productSet")))}function ne(t,a){if(t&1&&(d(0,"div",16),x(1,"span",19),r()),t&2){let e=c().$implicit,i=c(3);P("ngClass",e.product.code!==i.code?"icon":"no-icon")}}function oe(t,a){if(t&1&&(d(0,"span"),p(1),r()),t&2){let e=c(2).$implicit;n(),b(" ",e.fullPrice.formatedFullPrice?e.fullPrice.formatedFullPrice:e.fullPrice.formattedValue," ")}}function de(t,a){if(t&1&&(d(0,"div",26)(1,"div",28),u(2,oe,2,1,"span"),r(),d(3,"div",11)(4,"span"),p(5),r()()()),t&2){let e=c().$implicit;n(2),s(e.fullPrice&&e.price.value<e.fullPrice.value?2:-1),n(3),v(e.price.formattedValue)}}function re(t,a){if(t&1){let e=V();d(0,"div",7),u(1,ne,2,1,"div",16),d(2,"div",17),A("click",function(){let o=G(e).$implicit,l=c(3),_=c();return k(_.goToBundledProductPdp(l,o.product.url))}),d(3,"div",18),x(4,"span",19),r(),d(5,"div",20)(6,"div",21),x(7,"cx-media",22),r(),d(8,"div",23)(9,"div",24),p(10),r(),d(11,"div",25),p(12),r()(),u(13,de,6,2,"div",26),r(),x(14,"div",27),r()()}if(t&2){let e=a.$implicit,i=a.$index,o=c().$implicit,l=c(2);n(),s(i<o.bundleInfo.length?1:-1),n(),P("ngClass",l.price||l.ggPrice?"isPurchasable":"isNotPurchasable"),n(),P("ngClass",e.product.code!==l.code?"icon-mobile":"no-icon-mobile"),n(4),P("container",e.product.images),n(3),v(e.product.mainCategoryName),n(2),b(" ",e.product.modelMark?e.product.modelMark:e.product.name," "),n(),s(e.price?13:-1)}}function le(t,a){if(t&1&&(d(0,"div",28),p(1),r()),t&2){let e=c(2).$implicit;n(),b(" ",e.fullPrice.formattedValue," ")}}function ce(t,a){if(t&1&&(d(0,"div",10),u(1,le,2,1,"div",28),r()),t&2){let e=c().$implicit,i=c(3);n(),s(i.checkIfAllProductsHavePrice(e)?1:-1)}}function ae(t,a){if(t&1&&(d(0,"div",11),p(1),r()),t&2){let e=c().$implicit;n(),v(e.price.formattedValue)}}function ue(t,a){if(t&1){let e=V();d(0,"button",29),A("click",function(){G(e);let o=c().$implicit,l=c(3);return k(l.addBundleToCart(o))}),p(1),m(2,"cxTranslate"),r()}t&2&&(n(),b(" ",C(2,1,"addToCart.addToCart")," "))}function se(t,a){t&1&&(d(0,"button",30),p(1),m(2,"cxTranslate"),r()),t&2&&(n(),b(" ",C(2,1,"addToCart.outOfStock")," "))}function pe(t,a){if(t&1&&u(0,se,3,3,"button",30),t&2){let e=c().$implicit;s(e.price?0:-1)}}function _e(t,a){if(t&1&&(d(0,"div",2)(1,"div",3),u(2,te,7,6,"div",4)(3,ie,6,3,"div",5),d(4,"div",6),y(5,re,15,7,"div",7,$),r(),d(7,"div",8)(8,"div",9),p(9),m(10,"uppercase"),r(),u(11,ce,2,1,"div",10),u(12,ae,2,1,"div",11),u(13,ue,3,3,"button",12)(14,pe,1,1),r()()()),t&2){let e=a.$implicit,i=c(2),o=c();n(2),s(i.price||i.ggPrice?2:3),n(3),D(e.bundleInfo),n(4),v(C(10,5,e.name)),n(2),s(e.fullPrice&&e.fullPrice.formattedValue?11:-1),n(),s(e.price?12:-1),n(),s(e.price&&!o.checkIfBundleOutOfStock(e.code)?13:14)}}function me(t,a){t&1&&(d(0,"div",1),y(1,_e,15,7,"div",2,$),r()),t&2&&(n(),D(a.bundleGroup))}function Ce(t,a){if(t&1&&(d(0,"div",0),u(1,me,3,0,"div",1),m(2,"async"),r()),t&2){let e,i=c();n(),s((e=C(2,1,i.sortedBundles$))?1:-1,e)}}var Ee=(()=>{class t{constructor(){this.eventService=f(R),this.userIdService=f(j),this.activeCartService=f(W),this.bundleService=f(Y),this.currentProductService=f(K),this.routingService=f(q),this.launchDialogService=f(J),this.numberOfEntriesBeforeAdd=0,this.product$=this.currentProductService.getProduct().pipe(g(O)),this.bundles$=this.product$.pipe(g(O),F(e=>{this.bundleGroups=e.bundles?.bundleGroup}),E(e=>e.bundles)),this.sortedBundles$=w([this.product$,this.bundles$]).pipe(g(([e,i])=>!!e&&!!i),E(([e,i])=>B(S({},i),{bundleGroup:i.bundleGroup?.map(o=>B(S({},o),{bundleInfo:[...o.bundleInfo].sort((l,_)=>l.product.code===e.code?-1:_.product.code===e.code?1:0)}))})),F(e=>{this.bundleGroups=e.bundleGroup}))}calculateTotalPrice(e){return e.bundleInfo.reduce((o,l)=>o+(l.price?.value||0),0).toFixed(2)}calculateTotalFullPrice(e){return e.bundleInfo.reduce((o,l)=>o+(l.fullPrice?.value||0),0).toFixed(2)}calculatePriceDifference(e){let{price:{value:i,currencyIso:o,formattedValue:l},fullPrice:{value:_}}=e;if(i===void 0||_===void 0)return null;let I=l?.split(" ")[0],Z=_-i;return`${I} ${Z.toFixed(2)}`}checkIfAllProductsHavePrice(e){return e.bundleInfo.every(i=>!!i.price)&&e.bundleInfo.every(i=>!!i.fullPrice)}addBundleToCart(e){this.bundleId=e.code,this.bundleGroupName=e.n
1ame;let i;this.userIdService.getUserId().subscribe(l=>i=l).unsubscribe();let o;this.bundleService.requireLoadedCart().pipe(N(this.userIdService.getUserId()),h(1)).subscribe(([l,_])=>{i=i||_,this.activeCartId=X(l,i),this.currentUserId=_,this.activeCartService.getEntries().pipe(h(1)).subscribe(I=>{this.numberOfEntriesBeforeAdd=I.length,this.openModal(),this.bundleService.addBundleToCart(this.activeCartId,i,e)})})}openModal(){let e={cart$:this.activeCartService.getActive(),loaded$:this.activeCartService.isStable(),entries$:this.bundleService.getLastBundleEntry(this.activeCartId,this.bundleId).pipe(h(1)),numberOfEntriesBeforeAdd:this.numberOfEntriesBeforeAdd,bundleId:this.bundleId,bundleGroupName:this.bundleGroupName,activeCartId:this.activeCartId,currentUserId:this.currentUserId},i=this.launchDialogService.openDialog("ADD_BUNDLE_TO_CART",void 0,void 0,e);i&&i?.pipe(h(1)).subscribe()}goToBundledProductPdp(e,i){(e.price||e.ggPrice)&&this.routingService.go(i)}checkIfBundleOutOfStock(e){return(this.bundleGroups?.find(o=>o.code===e)).bundleInfo.some(o=>o.product.stock&&o.product.stock.stockLevelStatus=="outOfStock")}getPurchasableForBundle(e){let i=this.bundleGroups?.find(o=>o.code===e);return i&&i.bundleInfo.some(o=>!o.fullPrice)?T(!1):T(!0)}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=U({type:t,selectors:[["app-product-bundles"]],decls:2,vars:3,consts:[[1,"product-bundles"],[1,"bundle-container"],[1,"bundle"],[1,"flex-container"],[1,"purchasable-column"],[1,"notPurchasable"],[1,"info-column"],[1,"info-column-item"],[1,"price-column"],[1,"bundle-name"],[1,"full-price-container"],[1,"price"],[1,"btn-hisense"],[1,"text"],[1,"price-difference"],[1,"notPurchasable_icon"],[1,"item-block","item-block-icon",3,"ngClass"],[1,"media-container","item-block",3,"click","ngClass"],[3,"ngClass"],[1,"icon-plus",2,"width","30px","height","30px","position","relative","top","70px"],[1,"media-and-info"],[1,"product-media"],[3,"container"],[1,"model_and_category"],[1,"category-name"],[1,"model-mark"],[1,"price-container"],[1,"media-blank"],[1,"full-price-value"],[1,"btn-hisense",3,"click"],["disabled","",1,"btn-hisense","btn-bundle-out-of-stock"]],template:function(i,o){if(i&1&&(u(0,Ce,3,3,"div",0),m(1,"async")),i&2){let l;s((l=C(1,1,o.product$))?0:-1,l)}},dependencies:[L,Q,M,H,z],encapsulation:2})}}return t})();export{Ee as GgProductBundlesComponent}; 2//# sourceMappingURL=chunk-2COSVRZK.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.