PageSourceSearch

https://www.granngarden.se/dist/472.474eb20b.js

js granngarden.se collected 2026-09-24 18:18:02 UTC 14,877 bytes, 1 lines download raw bytes

1"use strict";(self.fkaWebpackJsonp=self.fkaWebpackJsonp||[]).push([[472,8728],{5607:(e,t,l)=>{var a;l.d(t,{M:()=>a}),function(e){e[e.Warning=0]="Warning",e[e.Alert=1]="Alert",e[e.Info=2]="Info",e[e.Freight=3]="Freight",e[e.Pall=4]="Pall"}(a||(a={}))},472:(e,t,l)=>{l.r(t),l.d(t,{default:()=>J});var a=l(641),i=l(33),n=l(3751);const r={class:"checkout-delivery"},o={class:"checkout-delivery__header"},s={class:"h3 checkout-delivery__title"},u={key:0,class:"checkout-delivery__message"},c={class:"checkout-delivery__search"},d=["placeholder","aria-invalid"],p={for:"zipCode"},v=["aria-label"],I={key:0,role:"alert",id:"zipcode-error",class:"checkout-delivery__error"},h={class:"checkout-delivery__fetching"},_={key:0,class:"checkout-delivery__freight-cost"},g={key:2,class:"checkout-delivery__input checkout-delivery__input--goods-mark input",ref:"goodsMarkRef"},y={class:"input__label",for:"DeliveryGoodsMark"},C={key:0,role:"alert"};var f=l(953),O=l(8221),k=l.n(O),m=l(2543);const b=(0,a.pM)({name:"InputHidden",props:{name:{type:String,required:!0},value:{type:Object,default:()=>({})}},setup(e){const t=(l,i)=>{return null===l?[]:"object"==typeof l?(0,m.flatMapDeep)(l,((e,l)=>t(e,[...i,l]))):(0,a.h)("input",{type:"hidden",name:e.name+(n=i,n.length?"["+n.join("][")+"]":""),value:null!=l?String(l):""});var n};return()=>t(e.value,[])}}),E={class:"unifaun-widget"},D={ref:"widgetRef"},S={key:0};const R=(0,a.pM)({name:"UnifaunWidget",props:{deliveryOptions:{type:Object,required:!0},debug:{type:Boolean,default:!1}},emits:["resultCallback"],setup(e,{emit:t}){const{deliveryOptions:l}=(0,f.QW)(e),i=(0,f.KR)(null),n=(0,f.KR)(null),r=(0,f.KR)({}),o=e=>{r.value=e,t("resultCallback",e)};return(0,a.sV)((()=>{void 0!==window.nShiftCheckoutWidget?i.value&&(n.value=window.nShiftCheckoutWidget.createWidget(i.value,{widgetVersion:"2",selectFirstAvailableOption:!1,resultCallback:o}),n.value.install(),l.value&&n.value.updateOptions(l.value)):console.error("nShiftCheckoutWidget is not defined. Requires nShift Checkout widget script to be loaded before component is initialized")})),(0,a.wB)(l,(e=>{n.value&&"function"==typeof n.value.updateOptions&&n.value.updateOptions(e)})),{widgetRef:i,unifaunWidgetResult:r}}});var N=l(6262);const M=(0,N.A)(R,[["render",function(e,t,l,n,r,o){return(0,a.uX)(),(0,a.CE)("div",E,[(0,a.Lk)("div",D,null,512),e.debug?((0,a.uX)(),(0,a.CE)("pre",S,"            "+(0,i.v_)(JSON.stringify(e.unifaunWidgetResult,null,2))+"\n        ",1)):(0,a.Q3)("",!0)])}]]);var F=l(7258);const A={class:"feedback__header"},P={class:"feedback__icon"},T={key:0},L=["aria-label"],w={class:"feedback__message"};var W,V,Z=l(5052);!function(e){e[e.Warning=0]="Warning",e[e.Alert=1]="Alert",e[e.Info=2]="Info",e[e.Freight=3]="Freight"}(W||(W={})),function(e){e[e.None=0]="None",e[e.Top=1]="Top",e[e.Bottom=2]="Bottom"}(V||(V={}));var G=l(4324);const z=(0,a.pM)({name:"FeedbackComponent",mixins:[(0,G.m)()],components:{Icon:Z.A},props:{title:String,type:{type:Number,default:W.Alert},message:String,isClosable:{type:Boolean,default:!1},direction:{type:Number,default:V.None}},data:()=>({isClosed:!1}),computed:{level(){switch(this.type){case W.Warning:return"warning";case W.Info:return"info";default:case W.Alert:return"alert";case W.Freight:return"freight"}},directionClass(){switch(this.direction){case V.Top:return"feedback--direction-top";case V.Bottom:return"feedback--direction-bottom";default:return""}},icon(){return"info"===this.level?"warning":"freight"===this.level?"box-open-full":this.level}},methods:{handleCloseClick(){this.isClosed=!0}}}),B=(0,N.A)(z,[["render",function(e,t,l,r,o,s){const u=(0,a.g2)("Icon");return(0,a.bo)(((0,a.uX)(),(0,a.CE)("div",{class:(0,i.C4)(["feedback",`feedback--${e.level} ${e.directionClass}`])},[(0,a.Lk)("div",A,[(0,a.Lk)("div",P,[(0,a.bF)(u,{icon:e.icon},null,8,["icon"])]),e.title?((0,a.uX)(),(0,a.CE)("h2",T,(0,i.v_)(e.title),1)):(0,a.Q3)("",!0),e.isClosable?((0,a.uX)(),(0,a.CE)("button",{key:1,onClick:t[0]||(t[0]=(...t)=>e.handleCloseClick&&e.handleCloseClick(...t)),"aria-label":e.translate("close"),class:"feedback__button",type:"button"},t[1]||(t[1]=[(0,a.Lk)("img",{src:"/UI/Icons/cross.svg","aria-hidden":"true",alt:"",width:"16",height:"16"},null,-1)]),8,L)):(0,a.Q3)("",!0)]),(0,a.Lk)("div",w,(0,i.v_)(e.message),1)],2)),[[n.aG,!e.isClosed]])}]]);var K,Y,U=l(7985),X=l(2649),Q=l(5094),j=l(5607);!function(e){e[e.Consumer=0]="Consumer",e[e.Company=1]="Company"}(K||(K={})),function(e){e.DELIVERY_OPTION_MISSING="deliveryOptionMissing",e.ZIP_CODE_MISSING="zipCodeMissing",e.ZIP_CODE_INVALID_FORMAT="zipCodeInvalidFormat",e.NO_DELIVERY_OPTIONS_FOUND_FOR_ZIP="noDeliveryOptionsFoundForZip"}(Y||(Y={}));const x=/[!"#¤%&\/()=?`+^¨,.*'@$€{§[£}~;|:]/g;function q(e){return(e||"").replace(/\s+/g,"")}function H(e){return e?e.match(/[^0-9]/g)?{isValid:!1,errorType:Y.ZIP_CODE_INVALID_FORMAT}:e.length<5?{isValid:!1,errorType:Y.ZIP_CODE_MISSING}:{isValid:!0,errorType:null}:{isValid:!1,errorType:Y.ZIP_CODE_MISSING}}const $=(0,a.pM)({name:"ShippingOptions",mixins:[(0,G.m)()],components:{Alert:F.default,Icon:Z.A,Feedback:B,UnifaunWidget:M,InputHidden:b},props:{deliveryAction:{type:String,default:""},deliveryOptionSelectedAction:{type:String,default:""}
1,customerType:{type:Number,default:K.Consumer},initialDeliveryOptions:{type:Object,default:null},initialZipCode:{type:String,default:""},showFreightCostDisclaimer:{type:Boolean,default:!1},deliveryMessageHeading:{type:String,default:""},deliveryMessage:{type:String,default:""},lang:{type:Object,required:!1},errorMessages:{type:Object,default:()=>({deliveryOptionMissing:"",zipCodeMissing:"",zipCodeInvalidFormat:"",noDeliveryOptionsFoundForZip:""})}},emits:{"set-submit-disabled":e=>!0,"update:show-delivery-error":e=>!0},setup(e,{emit:t,expose:l}){const{initialZipCode:i,initialDeliveryOptions:n,deliveryAction:r,deliveryOptionSelectedAction:o,customerType:s}=(0,f.QW)(e),u=(0,f.KR)(null),c=(0,f.KR)(null),d=(0,f.KR)(null),p=(0,f.KR)(null),v=(0,f.KR)(!1),I=(0,f.KR)(!1),h=(0,f.KR)(""),_=(0,f.KR)(i.value||""),g=(0,f.KR)(n.value??null),y=(0,f.KR)({}),C=(0,f.KR)(!1),O=(0,f.KR)(""),m=(0,a.EW)((()=>q(_.value))),b=(0,a.EW)((()=>(g.value?.options?.length??0)>0)),E=(0,a.EW)((()=>H(m.value).errorType===Y.ZIP_CODE_INVALID_FORMAT?Y.ZIP_CODE_INVALID_FORMAT:null)),D=(0,a.EW)((()=>p.value?p.value:E.value)),S=(0,a.EW)((()=>D.value===Y.NO_DELIVERY_OPTIONS_FOUND_FOR_ZIP||v.value&&!b.value&&5===m.value.length&&null===D.value?e.errorMessages.noDeliveryOptionsFoundForZip.replace("{0}",m.value):function(e,t){switch(e){case Y.ZIP_CODE_MISSING:return t.zipCodeMissing;case Y.ZIP_CODE_INVALID_FORMAT:return t.zipCodeInvalidFormat;case Y.DELIVERY_OPTION_MISSING:return t.deliveryOptionMissing;case Y.NO_DELIVERY_OPTIONS_FOUND_FOR_ZIP:return t.noDeliveryOptionsFoundForZip;default:return""}}(D.value,e.errorMessages))),R=(0,a.EW)((()=>D.value===Y.ZIP_CODE_MISSING||D.value===Y.ZIP_CODE_INVALID_FORMAT||D.value===Y.NO_DELIVERY_OPTIONS_FOUND_FOR_ZIP||!(!v.value||b.value||I.value||5!==m.value.length||null!==D.value))),N=(0,a.EW)((()=>!I.value&&(g.value?.options?.length??0)>0)),M=(0,a.EW)((()=>s.value===K.Company)),F=(e,t=!1)=>{p.value=e,t&&e!==Y.DELIVERY_OPTION_MISSING&&(0,a.dY)((()=>{c.value?.scrollIntoView({behavior:"smooth",block:"center"}),c.value?.focus()}))},A=e=>{e&&p.value!==e||(p.value=null)},P=k()((async e=>{e&&e.preventDefault();const t=m.value,l=H(t);if(l.isValid||!l.errorType){I.value=!0;try{const e=await U.A.post(r.value||"",{zipCode:t});e.ok&&(A(Y.ZIP_CODE_MISSING),g.value=await e.json(),v.value=!0)}catch(e){v.value=!0,g.value=null,Q.z(e)}I.value=!1}else F(l.errorType,!0)}),350),T=(e,t)=>{if(e?.length&&t)for(const l of e){if(l.optionId===t||l.id===t)return l;const e=T(l.subOptions,t);if(e)return e}};(0,a.wB)(y,(()=>{(async()=>{try{const t=(e=y.value).optionId||e.selectedOptionId||e.optionIds?.[e.optionIds.length-1],l=T(g.value?.options,t),a=((e,t)=>{const l=t.pickupPointId||t.agent;if(e?.pickupPoints?.length&&l)return e.pickupPoints.find((e=>e.pickupPointId===l||e.quickId===l))})(l,y.value);if(l){const e=await U.A.post(o.value,{deliveryAgentName:a?.name||"",deliveryOptionName:l.title||l.name});if(e.ok){const t=await e.json();X.V(t)}}}catch(e){Q.z(e)}var e})(),y.value.valid&&b.value&&A(Y.DELIVERY_OPTION_MISSING)})),(0,a.wB)(h,(e=>{const l=function(e){const t=e.match(x);return t?{hasSpecialCharacters:!0,specialCharacters:t.join("")}:{hasSpecialCharacters:!1,specialCharacters:""}}(e);C.value=l.hasSpecialCharacters,O.value=l.specialCharacters,l.hasSpecialCharacters?t("set-submit-disabled",!0):(t("set-submit-disabled",!1),A(Y.DELIVERY_OPTION_MISSING))})),(0,a.wB)(_,(e=>{const t=q(e),l=H(t);A(Y.NO_DELIVERY_OPTIONS_FOUND_FOR_ZIP),l.errorType!==Y.ZIP_CODE_INVALID_FORMAT?(A(Y.ZIP_CODE_INVALID_FORMAT),!function(e){return 5===e.length}(t)?g.value=null:P(),D.value===Y.DELIVERY_OPTION_MISSING&&A(Y.DELIVERY_OPTION_MISSING),v.value=!1):g.value=null})),(0,a.sV)((()=>{_.value&&P()}));const L=()=>(()=>{const e=H(m.value);return!e.isValid&&e.errorType?(F(e.errorType,!0),!1):v.value&&!b.value&&5===m.value.length?(F(Y.NO_DELIVERY_OPTIONS_FOUND_FOR_ZIP,!0),!1):b.value?(A(Y.ZIP_CODE_MISSING),!!y.value?.valid||(F(Y.DELIVERY_OPTION_MISSING,!0),Q.z("No delivery method selected"),!1)):(F(Y.DELIVERY_OPTION_MISSING,!0),!1)})();l({handleFormSubmit:L});const w=(0,a.EW)((()=>D.value===Y.DELIVERY_OPTION_MISSING&&5===m.value.length&&b.value));(0,a.wB)(w,(e=>{t("update:show-delivery-error",e)}));const Z=(0,a.EW)((()=>D.value===Y.ZIP_CODE_INVALID_FORMAT||(!(!v.value||b.value||I.value||5!==m.value.length)||!!p.value&&!!S.value)));return{goodsMarkRef:u,zipCodeInputRef:c,deliveryErrorRef:d,hasInputError:R,activeError:D,activeErrorMessage:S,searchComplete:v,hasDeliveryOptions:b,fetchingDeliveryOptions:I,deliveryGoodsMark:h,zipCode:_,sanitizedZipCode:m,deliveryOptions:g,unifau
1nWidgetResult:y,hasSpecialCharacters:C,specialCharacters:O,showDeliveryOptions:N,isB2BCustomer:M,AlertComponentType:j.M,FeedbackComponentType:W,FeedbackDirectionType:V,resultCallback:e=>{y.value=e},formatZipCodeWithSpace:e=>{e.target instanceof HTMLInputElement&&(_.value=function(e){const t=e.replace(/\s+/g,"");return t.length>3?t.slice(0,3)+" "+t.slice(3):t}(e.target.value))},debouncedPostalCodeLookUp:P,handleFormSubmit:L,ValidationErrorType:Y,showDeliveryError:w,showZipCodeError:Z}}}),J=(0,N.A)($,[["render",function(e,t,l,f,O,k){const m=(0,a.g2)("Feedback"),b=(0,a.g2)("Icon"),E=(0,a.g2)("Alert"),D=(0,a.g2)("unifaun-widget"),S=(0,a.g2)("InputHidden");return(0,a.uX)(),(0,a.CE)("div",r,[(0,a.Lk)("div",o,[(0,a.Lk)("h2",s,(0,i.v_)(e.translate("findDeliveryOptions")),1)]),e.deliveryMessage?((0,a.uX)(),(0,a.CE)("div",u,[(0,a.bF)(m,{type:e.FeedbackComponentType.Warning,message:e.deliveryMessage,title:e.deliveryMessageHeading,isClosable:!0,direction:e.FeedbackDirectionType.Bottom,lang:e.translate("alert")},null,8,["type","message","title","direction","lang"])])):(0,a.Q3)("",!0),(0,a.Lk)("div",c,[(0,a.Lk)("div",{class:(0,i.C4)(["checkout-delivery__input input",{"input--error":e.hasInputError}])},[(0,a.bo)((0,a.Lk)("input",{ref:"zipCodeInputRef","onUpdate:modelValue":t[0]||(t[0]=t=>e.zipCode=t),class:"search input__input",id:"zipCode",name:"zipCode",required:"",placeholder:e.translate("zipCodeOrCity"),type:"search",numeric:"",inputmode:"numeric",pattern:"[ \\d]+",maxlength:"6",onInput:t[1]||(t[1]=(...t)=>e.formatZipCodeWithSpace&&e.formatZipCodeWithSpace(...t)),"aria-invalid":!!e.activeError},null,40,d),[[n.Jo,e.zipCode]]),(0,a.Lk)("label",p,(0,i.v_)(e.translate("zipCodeOrCity")),1),(0,a.Lk)("button",{class:"checkout-delivery__submit",type:"button",onClick:t[2]||(t[2]=(0,n.D$)(((...t)=>e.debouncedPostalCodeLookUp&&e.debouncedPostalCodeLookUp(...t)),["prevent"])),"aria-label":e.translate("search")},[(0,a.bF)(b,{icon:"magnifying-glass","aria-hidden":!0,width:"24",height:"24"})],8,v)],2),e.showZipCodeError?((0,a.uX)(),(0,a.CE)("p",I,(0,i.v_)(e.activeErrorMessage),1)):(0,a.Q3)("",!0),(0,a.bo)((0,a.Lk)("div",h,t[4]||(t[4]=[(0,a.Lk)("img",{src:"/UI/Icons/loading.svg",alt:""},null,-1)]),512),[[n.aG,e.fetchingDeliveryOptions]]),e.showDeliveryOptions&&e.deliveryOptions?((0,a.uX)(),(0,a.CE)(a.FK,{key:1},[e.showFreightCostDisclaimer?((0,a.uX)(),(0,a.CE)("p",_,[(0,a.bF)(E,{type:e.AlertComponentType.Info,message:e.translate("extraFreightCostWillBeAdded"),lang:e.translate("alert")},null,8,["type","message","lang"])])):(0,a.Q3)("",!0),(0,a.bF)(D,{deliveryOptions:e.deliveryOptions,onResultCallback:e.resultCallback},null,8,["deliveryOptions","onResultCallback"]),(0,a.bF)(S,{name:"unifaunWidgetResult",value:e.unifaunWidgetResult},null,8,["value"])],64)):(0,a.Q3)("",!0),e.showDeliveryOptions&&e.isB2BCustomer?((0,a.uX)(),(0,a.CE)("div",g,[(0,a.bo)((0,a.Lk)("input",{"onUpdate:modelValue":t[3]||(t[3]=t=>e.deliveryGoodsMark=t),id:"DeliveryGoodsMark",name:"goodsMark",maxlength:"30",type:"text",class:"input__input"},null,512),[[n.Jo,e.deliveryGoodsMark]]),(0,a.Lk)("label",y,(0,i.v_)(e.translate("deliveryGoodsMark")),1),e.hasSpecialCharacters?((0,a.uX)(),(0,a.CE)("p",C,(0,i.v_)(e.translateFormat([e.specialCharacters],"containsSpecialNumber")),1)):(0,a.Q3)("",!0)],512)):(0,a.Q3)("",!0)])])}]])},7258:(e,t,l)=>{l.r(t),l.d(t,{default:()=>I});var a=l(641),i=l(33),n=l(3751);const r={class:"alert__icon"},o={class:"alert__message"},s=["aria-label"];var u=l(953),c=l(5052),d=l(5607),p=l(4324);const v=(0,a.pM)({name:"AlertComponent",components:{Icon:c.A},mixins:[(0,p.m)()],props:{type:{type:Number,default:d.M.Alert},message:String,isClosable:{type:Boolean,default:!1},outline:{type:Boolean,default:!0},showIcon:{type:Boolean,default:!0},isRoleAlert:{type:Boolean,default:!1}},setup(e){const t=(0,u.KR)(!1),l=(0,u.KR)(null),i=()=>{e.isRoleAlert&&l.value&&l.value.setAttribute("role","alert")};(0,a.wB)((()=>e.isRoleAlert),i);const n=(0,a.EW)((()=>{switch(e.type){case d.M.Warning:return"warning";case d.M.Info:return"info";case d.M.Freight:return"freight";case d.M.Pall:return"pall";default:return"alert"}})),r=(0,a.EW)((()=>"info"===n.value?"warning":"freight"===n.value?"check-circle":"pall"===n.value?"pall":n.value));return{isClosed:t,level:n,icon:r,handleCloseClick:()=>{t.value=!0},addRoleAlertAttr:i}}});const I=(0,l(6262).A)(v,[["render",function(e,t,l,u,c,d){const p=(0,a.g2)("Icon"),v=(0,a.g2)("icon");return(0,a.bo)(((0,a.uX)(),(0,a.CE)("div",{class:(0,i.C4)(["alert",`alert--${e.level} ${!e.showIcon&&"alert--no-icon"}`]),ref:"alertRef"},[(0,a.Lk)("div",r,[e.showIcon?((0,a.uX)(),(0,a.Wv)(p,{key:0,icon:e.icon},null,8,["icon"])):(0,a.Q3)("",!0)]),(0,a.Lk)("span",o,[(0,a.eW)((0,i.v_)(e.message)+" ",1),e.isClosable?((0,a.uX)(),(0,a.CE)("button",{key:0,onClick:t[0]||(t[0]=(...t)=>e.handleCloseClick&&e.handleCloseClick(...t)),"aria-label":e.translate("close"),class:"alert__button",type:"button"},[(0,a.bF)(v,{icon:"cross-small-black",width:"16",height:"16","aria-hidden":!0})],8,s)):(0,a.Q3)("",!0)])],2)),[[n.aG,!e.isClosed]])}]])}}]);

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.