PageSourceSearch

https://www.granngarden.se/dist/Component.ProductCampaignDisplay.403a3695.js

js granngarden.se collected 2026-09-24 18:17:55 UTC 6,536 bytes, 1 lines download raw bytes

1"use strict";(self.fkaWebpackJsonp=self.fkaWebpackJsonp||[]).push([[2305,8661],{3165:(t,e,r)=>{var a;r.d(e,{U:()=>a}),function(t){t[t.None=0]="None",t[t.InventoryInStock=1]="InventoryInStock",t[t.InventoryNotInStock=2]="InventoryNotInStock",t[t.ContactSales=3]="ContactSales",t[t.ForcedPurchaseButton=4]="ForcedPurchaseButton",t[t.StoreOnly=5]="StoreOnly",t[t.TemporarilyOutOfStock=12]="TemporarilyOutOfStock",t[t.OutOfWebStock=13]="OutOfWebStock",t[t.OrderAndBuyInStore=14]="OrderAndBuyInStore"}(a||(a={}))},5862:(t,e,r)=>{var a;r.d(e,{l:()=>a}),function(t){t[t.None=0]="None",t[t.Product=1]="Product",t[t.Cart=2]="Cart"}(a||(a={}))},8011:(t,e,r)=>{r.d(e,{l:()=>c});var a=r(641),n=r(762),s=r(8857),i=r(9635);const c=(0,a.pM)({props:{productNumber:{type:String,required:!0},initialCampaigns:Array},computed:{price(){const{$store:t,productNumber:e}=this;return t&&(0,i.RP)(t).find((t=>t.productNumber===e))},campaigns(){const{$store:t,productNumber:e,price:r,initialCampaigns:a}=this;if(Array.isArray(a))return a;const s=r?.variantNumber||e;return t?(0,n.cv)(t)[s]:null},campaignsQueueStatus(){const{$store:t,productNumber:e}=this;if(!t||!e)return null;const r=(0,n.Qf)(t);return Object.prototype.hasOwnProperty.call(r,e)?r[e]:null},campaignsIsFetching(){return(0,s.h8)(this.campaignsQueueStatus)&&!this.campaigns},campaignsHasFailed(){return this.campaignsQueueStatus===s.an.Failed&&!this.campaigns},campaignsIsEmpty(){return this.campaignsQueueStatus===s.an.Fetched&&!this.campaigns}},methods:{fetchCampaigns(){const{$store:t,price:e,campaigns:r}=this;t&&e&&!r&&(0,n.U7)(t,[e.variantNumber||e.productNumber])}},watch:{price(){this.fetchCampaigns()}},mounted(){this.fetchCampaigns()}})},9240:(t,e,r)=>{r.r(e),r.d(e,{default:()=>Q});var a=r(641),n=r(33),s=r(3751);const i={key:0,class:"product-campaign-display__loading"},c=["alt"],o={class:"product-campaign-display__wrapper"},u={class:"product-campaign-display__heading"},p={key:0},l={key:1},d={key:2},m={class:"product-campaign-display__list"},h={class:"product-campaign-display__product"},g=["href"],f=["src","alt"],y={key:0,class:"product-campaign-display__delimiter"},b=["aria-label","onClick","disabled"];var C=r(8221),N=r.n(C),k=r(8011),I=r(4324),S=r(7985),O=r(5052),v=r(6998),_=r(5862),P=r(5094),E=r(9590),F=r(3165);const w=(0,a.pM)({name:"ProductCampaignDisplay",mixins:[(0,I.m)(),k.l],components:{Icon:O.A},props:{apiUrl:String,product:Object,salesPhoneNumber:String},data:()=>({response:null,fetching:!1,buying:!1}),computed:{filteredCampaigns(){if(!this.campaigns)return[];const t=this.campaigns.filter((t=>"PerfectPartner"===t.campaignType||"Bundle"===t.campaignType));if(0===t.length)return[];const[e]=t;return[e]},productNumbers(){return this.filteredCampaigns.map((t=>t.productsInTheSameOffer??new Array)).reduce(((t,e)=>t.concat(e)),[]).filter(((t,e,r)=>r.indexOf(t)===e)).join(",")},campaignInventories(){return this.productNumber&&this.productNumbers&&this.$store?(0,E.xy)(this.$store):null},contactSales(){if(!this.campaignInventories||0===Object.keys(this.campaignInventories).length)return!1;return Object.entries(this.campaignInventories).filter((t=>t[1].availabilityInfo.availabilityStatus===F.U.ContactSales&&(this.productNumbers.includes(t[0])||t[0]===this.productNumber))).length>0}},watch:{filteredCampaigns(){this.debouncedFetchProducts()},productNumbers(){if(this.productNumber&&this.productNumbers&&this.$store){const t=`${this.productNumber},${this.productNumbers}`;(0,E.DQ)(this.$store,t.split(","))}}},methods:{async buy(t){const e=this.filteredCampaigns[t];if(!e)return;const r=[{lineId:"",productNumber:e.productNumber,quantity:1}];e.productsInTheSameOffer&&e.productsInTheSameOffer.forEach((t=>{r.push({lineId:"",productNumber:t,quantity:1})})),this.buying=!0,await(0,v.kM)(this.$store,{items:r,addingToCart:!0,recommendations:_.l.None,listName:e?.label,listIndex:t}),this.buying=!1},products(t){if(!this.product)return[];const e=this?.filteredCampaigns?.[t].productsInTheSameOffer;if(!e)return[];const r=[this.product];return e.forEach((t=>{const e=this.response?.products?.find((e=>e.productNumber===t));e&&r.push(e)})),r},storeOnly(t){return this.products(t).filter((t=>!1===t.isBuyableOnline)).length>0},async fetchProducts(){const{apiUrl:t,productNumbers:e}=this;if(t&&e)try{this.fetching=!0;const r=await S.A.get(t,{query:{productNumbers:e}}),a=await r.json();this.response=a}catch(t){P.z(t)}finally{this.fetching=!1}},debouncedFetchProducts(){}},created(){this.debouncedFetchProducts=N()(this.fetchProducts,500)}});const Q=(0,r(6262).A)(w,[["render",function(t,e,r,C,N,k){const I=(0,a.g2)("Icon");return(0,a.uX)(),(0,a.CE)("div",null,[t.fetching?((0,a.uX)(),(0,a.CE)("p",i,[(0,a.Lk)("img",{src:"/UI/Icons/loading.svg",alt:t.translate("fetchingCampaignProducts")},null,8,c)])):(0,a.Q3)("",!0),((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(t.filteredCampaigns,((e,r)=>(0,a.bo)(((0,a.uX)(),(0,a.CE)("section",{key:e.label+r,class:(0,n.C4)(["product-campaign-display",{"product-campaign-display--portrait":e.productsInTheSameOffer&&e.productsInTheSameOffer.length>1}])},[(0,a.Lk)("div",o,[(0,a.Lk)("h2",u,[(0,a.eW)((0,n.v_)(e.label)+" ",1),t.storeOnly(r)&&!t.contactSales?((0,a.uX)(),(0,a.CE)("span",p,(0,n.v_)(t.translate("storeOnly")),1)):(0,a.Q3)("",!0),t.contactSales?((0,a.uX)(),(0,a.CE)("span",l,(0,n.v_)(t.salesPhoneNumber),1)):(0,a.Q3)("",!0),e.formattedEndDate?((0,a.uX)(),(0,a.CE)("span",d,(0,n.v_)(t.translateFormat([e.formattedEndDate],"endDate")),1)):(0,a.Q3)("",!0)]),(0,a.Lk)("ul",m,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(t.products(r),((t,e)=>((0,a.uX)(),(0,a.CE)("li",{key:t.productNumber,class:"product-campaign-display__item"},[(0,a.Lk)("article",h,[(0,a.Lk)("a",{href:t.link,class:"product-campaign-display__link"}
1,[(0,a.Lk)("img",{src:t.image||"/UI/placeholder-product.svg",alt:t.name,width:"80",height:"80",loading:"lazy",class:"product-campaign-display__image"},null,8,f)],8,g)]),0===e?((0,a.uX)(),(0,a.CE)("div",y)):(0,a.Q3)("",!0)])))),128))]),t.storeOnly(r)||t.contactSales?(0,a.Q3)("",!0):((0,a.uX)(),(0,a.CE)("button",{key:0,type:"button",class:(0,n.C4)(["product-campaign-display__buy button button--small",{"button--loading":t.buying}]),"aria-label":e.formattedOfferPrice?t.translateFormat([e.formattedOfferPrice],"buyPackageFor"):void 0,onClick:(0,s.D$)((e=>t.buy(r)),["prevent"]),disabled:t.buying},[(0,a.eW)((0,n.v_)(e.formattedOfferPrice||t.translate("buy"))+" ",1),(0,a.bF)(I,{width:"24",height:"22",icon:"cart-arrow-down"})],10,b))])],2)),[[s.aG,!t.fetching&&t.filteredCampaigns.length>=1]]))),128))])}]])}}]);

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.