@wayke-se/ecom-web 1.5.0-beta.4 → 1.5.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +36 -36
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +51 -51
- package/dist/index.mjs.map +2 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",version:"1.5.0-beta.
|
|
1
|
+
import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",version:"1.5.0-beta.5",description:"Wayke Ecom Web",module:"dist/index.mjs",main:"dist/index.js",types:"dist/index.d.ts",homepage:"https://github.com/wayke-se/wayke-ecom-web",scripts:{start:"node ./esbuild/start.js",clip:"node ./esbuild/clip-ui.js && node ./clip-ui/start.js",build:"npm run clean && node ./esbuild/lib.js && node ./esbuild/cdn.js",clean:"rimraf build && rimraf dist && rimraf dist-cdn",test:"npm run lint && npm run typecheck",typecheck:"tsc -noEmit","typecheck:watch":"tsc -noEmit -watch",lint:"eslint --ext .ts,.js 'src'","lint:fix":"eslint --ext .ts,.js 'src' --fix",stylelint:"stylelint '**/*.scss'",prepare:"husky install"},author:"Wayke",license:"ISC",devDependencies:{"@ourstudio/clip-ui":"^0.0.11","@types/marked":"^4.3.0","@types/node":"^17.0.18","@types/object-path":"^0.11.1","@types/sanitize-html":"^2.6.2","@typescript-eslint/eslint-plugin":"^5.12.0","@typescript-eslint/parser":"^5.12.0",esbuild:"^0.15.10","esbuild-sass-plugin":"2.3.3",eslint:"^8.9.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0",husky:"^8.0.1","npm-dts":"^1.3.11",prettier:"^2.5.1",rimraf:"^5.0.1",stylelint:"^15.2.0","stylelint-config-prettier-scss":"^1.0.0","stylelint-config-standard-scss":"^9.0.0",typescript:"^5.1.3"},dependencies:{"@wayke-se/ecom":"^4.4.0-beta.5",marked:"^4.3.0","object-path":"^0.11.8",redux:"^4.1.2","sanitize-html":"^2.7.0"},files:["dist"]};import{createStore as Vc}from"redux";import{DrivingDistance as Bc,PaymentType as ni}from"@wayke-se/ecom";var tt=(o,i)=>o!==void 0&&i!==void 0?JSON.stringify(o).localeCompare(JSON.stringify(i))===0:o===i;var _e=o=>({costs:o.getCosts(),fees:o.getFees(),interests:o.getInterests(),durationSpec:o.getDurationSpec(),downPaymentSpec:o.getDownPaymentSpec(),residualValueSpec:o.getResidualValueSpec(),totalResidualValue:o.getTotalResidualValue(),publicURL:o.getPublicURL(),shouldUseCreditScoring:o.shouldUseCreditScoring(),financialProductCode:o.getFinancialProductCode(),price:o.getPrice(),creditAmount:o.getCreditAmount(),hasPrivacyPolicy:o.hasPrivacyPolicy(),privacyPolicyUrl:o.getPrivacyPolicyUrl()}),Vo=o=>({status:o.getStatus(),hasPendingSigning:o.hasPendingSigning(),hintCode:o.getHintCode(),signingMessage:o.getSigningMessage(),shouldRenewSigning:o.shouldRenewSigning(),isSigned:o.isSigned(),address:void 0,pendingScoring:o.hasPendingScoring(),isScored:o.isScored(),hasScoringError:o.hasScoringError(),scoringId:o.getScoringId(),recommendation:o.getRecommendation(),decision:o.getDecision(),isAccepted:o.isAccepted()}),Le=o=>({orderVehicle:o.getOrderVehicle(),accessories:o.getAccessories(),requiresDealerSelection:o.requiresDealerSelection(),dealerSites:o.getDealerSites(),paymentOptions:o.getPaymentOptions().map(e=>({...e,loanDetails:e.loanDetails?_e(e.loanDetails):void 0})),deliveryOptions:o.getDeliveryOptions(),insuranceOption:o.getInsuranceOption(),orderConditions:o.getOrderConditions(),orderReturnConditions:o.getOrderReturnConditions(),conditionsPdfUri:o.getConditionsPdfUri(),contactInformation:o.getContactInformation(),allowsTradeIn:o.allowsTradeIn(),isUnavailable:o.isUnavailable(),isPaymentRequired:o.isPaymentRequired()}),Go=o=>({vehicle:o.getVehicle()});var st="RESET",qo=o=>i=>i({type:st,id:o}),ot="SET_ORDER",Oe=(o,i)=>e=>e({type:ot,order:o,vehicle:i}),it="SET_ID",Wo=o=>i=>i({type:it,id:o}),at="SET_CONTACT_EMAIL_AND_PHONE",Yo=o=>i=>i({type:at,value:o}),nt="SET_SOCIAL_ID_AND_ADDRESS",Ko=(o,i,e)=>t=>t({type:nt,socialId:o,address:i,lastStage:e}),rt="SET_HOME_DELIVERY",zo=(o,i)=>e=>e({type:rt,homeDelivery:o,lastStage:i}),ct="SET_DEALER",Qo=(o,i)=>e=>e({type:ct,dealer:o,lastStage:i}),lt="INIT_TRADE_IN",jo=o=>i=>i({type:lt,lastStage:o}),dt="SET_TRADE_IN",Se=(o,i,e)=>t=>t({type:dt,lastStage:o,tradeIn:i,tradeInVehicle:e}),mt="SET_FINANCIAL",Jo=(o,i)=>e=>e({type:mt,paymentType:o,lastStage:i}),pt="SET_PAYMENT_LOOKUP_RESPONSE",Xo=o=>i=>i({type:pt,paymentLookupResponse:_e(o)}),ut="SET_DRIVING_DISTANCE",Zo=o=>i=>i({type:ut,drivingDistance:o}),ht="COMPLETE_STAGE",j=o=>i=>i({type:ht,lastStage:o}),kt="SET_OR_REMOVE_INSURANCE",le=o=>i=>i({type:kt,insurance:o}),yt="SET_OR_REMOVE_INSURANCE_ADDONS",ei=(o,i)=>e=>e({type:yt,insurance:o,insuranceAddons:i}),vt="SET_OR_REMOVE_FREE_INSURANCE",ti=o=>i=>i({type:vt,freeInsurance:o}),Et="SET_OR_REMOVE_ACCESSORY",si=o=>i=>i({type:Et,accessory:o}),It="GO_TO",L=(o,i,e)=>t=>t({type:It,view:o,index:i,subStage:e}),ft="SET_STAGES",oi=o=>i=>i({type:ft,stages:o}),gt="SET_CREATED_ORDER_ID",ii=(o,i)=>e=>e({type:gt,id:o,payment:i}),_t="SET_CREDIT_ASSESSMENT_RESPONSE",de=(o,i)=>e=>e({type:_t,caseId:o,creditAssessmentResponse:i}),St="SET_STATE",ai=o=>i=>i({type:St,state:o});var Fc={};var ri={view:"preview",stage:1,subStage:1},ci={id:"",topNavigation:{...ri},navigation:{...ri},customer:{email:"",phone:"",givenName:"",surname:"",socialId:""},homeDelivery:!1,accessories:[],drivingDistance:Bc.Between0And1000,...Fc},ie=(o,i)=>i?{view:"summary",stage:1,subStage:1}:{view:"main",stage:o+1,subStage:1},ae=(o,i)=>i.view==="main"?o.stage<i.stage?i:v.topNavigation:{...o,stage:o.stage+1},wt=o=>o&&o?.length===1&&o?.[0].type===ni.Cash?ni.Cash:void 0,v,Nt,Uc=(o=ci,i)=>{let e,t;switch(v={...o},i.type){case st:return{...ci,id:i.id};case ft:return{...v,stages:i.stages};case it:return{...v,id:i.id};case ot:return{...o,order:i.order,paymentType:wt(i.order?.paymentOptions),vehicle:{...i.order.orderVehicle,...i.vehicle||{}}};case at:let s={...v,customer:{...o.customer,email:i.value.email,phone:i.value.phone},navigation:{view:"main",stage:o.navigation.stage,subStage:2}};return delete s.wantTradeIn,delete s.tradeIn,delete s.tradeInVehicle,s.paymentType=wt(o.order?.paymentOptions),delete s.paymentLookupResponse,delete s.insurance,delete s.insuranceAddOns,delete s.freeInsurance,delete s.dealer,s.accessories=[],s;case nt:return e=ie(v.navigation.stage,i.lastStage),t=ae(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,address:i.address,customer:{...o.customer,socialId:i.socialId}},v;case ct:return e=ie(o.navigation.stage,i.lastStage),t={...e},v={...o,navigation:e,topNavigation:t,dealer:i.dealer},delete v.wantTradeIn,delete v.tradeIn,delete v.tradeInVehicle,v.paymentType=wt(o.order?.paymentOptions),delete v.paymentLookupResponse,delete v.insurance,delete v.insuranceAddOns,delete v.freeInsurance,v.accessories=[],v;case rt:return e=ie(o.navigation.stage,i.lastStage),t=ae(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,homeDelivery:i.homeDelivery},v;case lt:return e={view:"main",stage:o.navigation.stage,subStage:1},t=ae(v.topNavigation,e),v={...o,navigation:e,wantTradeIn:!0,topNavigation:t,tradeIn:o.tradeIn||{registrationNumber:"",mileage:"",description:""}},v;case dt:return e=ie(o.navigation.stage,i.lastStage),t=ae(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,wantTradeIn:!!i.tradeIn,tradeIn:i.tradeIn,tradeInVehicle:i.tradeInVehicle},v;case mt:return e=ie(o.navigation.stage,i.lastStage),t=ae(v.topNavigation,e),{...v,navigation:e,topNavigation:t,paymentType:i.paymentType};case pt:return{...v,paymentLookupResponse:i.paymentLookupResponse};case ut:return{...v,drivingDistance:i.drivingDistance};case ht:return e=ie(o.navigation.stage,i.lastStage),t=ae(v.topNavigation,e),v={...o,navigation:e,topNavigation:t},v;case yt:return v.insurance=i.insurance,v.insuranceAddOns={insurance:i.insurance.name,addOns:i.insuranceAddons},v;case kt:return tt(v.insurance,i.insurance)?v.insurance=void 0:v.insurance=i.insurance,v.insuranceAddOns?.insurance&&(v.insuranceAddOns=void 0),v;case vt:return tt(v.freeInsurance,i.freeInsurance)?v.freeInsurance=void 0:v.freeInsurance=i.freeInsurance,v;case Et:return Nt=v.accessories.findIndex(a=>a.id===i.accessory.id),v.accessories=[...v.accessories],Nt>-1?v.accessories.splice(Nt,1):v.accessories.push(i.accessory),{...v,accessories:[...v.accessories]};case It:return{...o,navigation:{view:i.view,stage:i.index||1,subStage:i.subStage||1}};case gt:return i.payment?e={view:"main",stage:o.navigation.stage,subStage:2}:e=ie(o.navigation.stage,!0),t=ae(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,createdOrderId:i.id,payment:i.payment},v;case _t:return{...v,caseId:i.caseId,creditAssessmentResponse:i.creditAssessmentResponse};case St:return{...i.state};default:return o}},li=Uc;var di=()=>Vc(li);var Me=(o,i)=>{if(!i)return o;let e=new URL(o);return`${i}${e.pathname}`};var Gc=o=>o.toString().replace(/\s/g,""),qc=(o,i)=>{if(!i)return o;let e=Math.pow(10,i);return(Math.round(o*e)/e).toFixed(i)},k=(o,i)=>{if(o===void 0)return"???";let e=qc(o,i?.decimals!==void 0?i.decimals:0);return`${i?.prefix?`${i.prefix}`:""}${Gc(e).replace(/\B(?=(\d{3})+(?!\d))/g," ")}${i?.postfix?` ${i.postfix}`:""}`},Wc=(o,i)=>{let e=o.split(" "),t=i.split(" ").map(s=>s.toLowerCase());return e.filter(s=>!t.includes(s.toLowerCase())).join(" ")},me=o=>{if(!!o)return Wc(o.shortDescription||"",o.title||"")};var Yc=({vehicle:o,order:i,meta:e,cdnMedia:t})=>{let s=o?.imageUrls,a=o?.title,n=k(o?.price||NaN),l=i?.contactInformation?.name;return`
|
|
2
2
|
<div class="waykeecom-product-card">
|
|
3
3
|
${s?.length?`
|
|
4
4
|
<div class="waykeecom-product-card__media">
|
|
@@ -14,7 +14,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
14
14
|
${l}
|
|
15
15
|
</div>
|
|
16
16
|
<div class="waykeecom-product-card__heading" aria-label="Modell">
|
|
17
|
-
<span class="waykeecom-product-card__title">${a}</span> ${
|
|
17
|
+
<span class="waykeecom-product-card__title">${a}</span> ${me(o)}
|
|
18
18
|
</div>
|
|
19
19
|
<div class="waykeecom-product-card__footer">
|
|
20
20
|
<div class="waykeecom-product-card__price" aria-label="Pris">${n} kr</div>
|
|
@@ -163,7 +163,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
163
163
|
<div class="waykeecom-overflow-grid__list-wrapper">
|
|
164
164
|
<ul class="waykeecom-overflow-grid__list" id="${this.props.id}"></ul>
|
|
165
165
|
</div>
|
|
166
|
-
`,this.overflowElement=this.node.querySelector(`#${this.props.id}`)||void 0,this.overflowElement?.addEventListener("scroll",()=>this.scrollHandler()),this.contexts.left=new Mt(this.node.querySelector(`#${e}`),{direction:"left",hide:!0,onClick:()=>this.onPrev()}),this.contexts.right=new Mt(this.node.querySelector(`#${t}`),{direction:"right",hide:!0,onClick:()=>this.onNext()}),setTimeout(()=>{let{itemWidth:s,scrollLeft:a,overflowElementScrollWidth:n}=Ei(this.overflowElement),l=a+s,c=n===a&&l>=n;this.contexts.right?.hide(c)},50)}},
|
|
166
|
+
`,this.overflowElement=this.node.querySelector(`#${this.props.id}`)||void 0,this.overflowElement?.addEventListener("scroll",()=>this.scrollHandler()),this.contexts.left=new Mt(this.node.querySelector(`#${e}`),{direction:"left",hide:!0,onClick:()=>this.onPrev()}),this.contexts.right=new Mt(this.node.querySelector(`#${t}`),{direction:"right",hide:!0,onClick:()=>this.onNext()}),setTimeout(()=>{let{itemWidth:s,scrollLeft:a,overflowElementScrollWidth:n}=Ei(this.overflowElement),l=a+s,c=n===a&&l>=n;this.contexts.right?.hide(c)},50)}},pe=xt;var Pt=class extends r{constructor(e,t){super(e);this.props=t,this.render()}isDisabled(){return this.props.disabled}disabled(e){this.props.disabled!==e&&(this.props.disabled=e,this.render())}loading(e){this.props.loading!==e&&(this.props.loading=e,this.props.disabled=e,this.render())}render(){let{id:e,disabled:t,loading:s,selected:a,fullSize:n,onClick:l}=this.props,c=a?"Vald":"L\xE4gg till",m=["waykeecom-button",n?"waykeecom-button--full-width":"waykeecom-button--size-small"];a?m.push("waykeecom-button--success"):m.push("waykeecom-button--action-alt");let u=a?'<path d="M12.3 3.3 6 9.6 3.7 7.3c-.4-.4-1-.4-1.4 0-.4.4-.4 1 0 1.4l3 3c.4.4 1 .4 1.4 0l7-7c.4-.4.4-1 0-1.4-.4-.4-1-.4-1.4 0z"/>':'<path d="M14 7v2H9v5H7V9H2V7h5V2h2v5h5z" />';this.node.innerHTML=`
|
|
167
167
|
<button
|
|
168
168
|
type="button"
|
|
169
169
|
${e?`id="${e}"`:""}
|
|
@@ -184,7 +184,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
184
184
|
<span class="waykeecom-button__content">${c}</span>
|
|
185
185
|
${s?`<span class="waykeecom-button__content">${C({type:"inline"})}</div>`:""}
|
|
186
186
|
</button>
|
|
187
|
-
`,l&&this.node.querySelector("button")?.addEventListener("click",l)}},
|
|
187
|
+
`,l&&this.node.querySelector("button")?.addEventListener("click",l)}},X=Pt;var $t=class extends r{constructor(e,t){super(e);this.props=t,this.render()}disabled(e){this.props.disabled=!e,this.render()}render(){let{title:e,id:t,disabled:s,onClick:a}=this.props;this.node.innerHTML=`
|
|
188
188
|
<button
|
|
189
189
|
${t?`id="${t}"`:""}
|
|
190
190
|
title="${e}"
|
|
@@ -215,11 +215,11 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
215
215
|
</div>
|
|
216
216
|
<div class="waykeecom-tile__footer" id="${y}"></div>
|
|
217
217
|
</div>
|
|
218
|
-
`,h&&new B(this.node.querySelector(`#${p}`),{title:"L\xE4s mer",onClick:()=>h()}),new
|
|
218
|
+
`,h&&new B(this.node.querySelector(`#${p}`),{title:"L\xE4s mer",onClick:()=>h()}),new X(this.node.querySelector(`#${y}`),{selected:m,onClick:()=>u()})}},ue=Ht;var W=()=>{b();let o=document.getElementById("wayke-ecom-modal-body");o&&o.firstElementChild.setAttribute("hidden","");let i=document.createElement("div");return i.className="waykeecom-portal",o?.appendChild(i),i},b=()=>{let o=document.getElementById("wayke-ecom-modal-body");o&&o.firstElementChild.removeAttribute("hidden"),o?.childNodes.forEach((i,e)=>{e>0&&i.remove()})};var Bt=class extends r{constructor(e,t){super(e);this.props=t,this.render()}render(){let{title:e,id:t,onClick:s}=this.props;this.node.innerHTML=`
|
|
219
219
|
<button type="button" id="${t}" title="${e}" class="waykeecom-button waykeecom-button--full-width waykeecom-button--action-clear">
|
|
220
220
|
${e}
|
|
221
221
|
</button>
|
|
222
|
-
`,s&&this.node.querySelector("button")?.addEventListener("click",s)}},
|
|
222
|
+
`,s&&this.node.querySelector("button")?.addEventListener("click",s)}},Z=Bt;var Ft=class extends r{constructor(e,t){super(e);this.props=t,this.render()}disabled(e){this.props.disabled=!e,this.render()}render(){let{title:e,id:t,disabled:s,onClick:a}=this.props;this.node.innerHTML=`
|
|
223
223
|
<button
|
|
224
224
|
${t?`id="${t}"`:""}
|
|
225
225
|
title="${e}"
|
|
@@ -238,7 +238,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
238
238
|
</span>
|
|
239
239
|
<span class="waykeecom-link__content">${e}</span>
|
|
240
240
|
</button>
|
|
241
|
-
`,a&&this.node.querySelector("button")?.addEventListener("click",a)}},
|
|
241
|
+
`,a&&this.node.querySelector("button")?.addEventListener("click",a)}},ne=Ft;var F=()=>{let o=document.getElementById(Ne),i=document.getElementById(`${Ne}-dialog`);o&&(o.scrollTop=0),i&&(i.scrollTop=0)};var Ut=class extends r{constructor(e,t){super(e);this.props=t,this.render()}hide(e){this.props.hide!==e&&(this.props.hide=e,this.render())}render(){if(this.props.hide){this.node.innerHTML="";return}let{title:e,dataIcon:t,path:s}=this.props.direction==="left"?{title:"Visa f\xF6reg\xE5ende bild",dataIcon:"Chevron left",path:'<path d="m5.4 7 5.2-5 1 1-5.2 5 5.2 5-1.1 1-5.2-5-1-1 1.1-1z" />'}:{title:"Visa n\xE4sta bild",dataIcon:"Chevron right",path:'<path d="m10.5 9-5.2 5-1-1 5.2-5-5.2-5 1.1-1 5.2 5 1 1-1.1 1z" />'};this.node.innerHTML=`
|
|
242
242
|
<button type="button" title="${e}" class="waykeecom-icon-button">
|
|
243
243
|
<svg
|
|
244
244
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -295,7 +295,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
295
295
|
<div class="waykeecom-stack waykeecom-stack--1" id="${Si}"></div>
|
|
296
296
|
<div class="waykeecom-stack waykeecom-stack--1" id="${_i}"></div>
|
|
297
297
|
</div>
|
|
298
|
-
`,new fi(this.node.querySelector(`#${wi}`),{id:`gallery-${e.id}`,media:l.map((y,f)=>({url:y.url,alt:`Bild ${f+1}`})),onGalleryImagePaging:()=>this.onGalleryImagePaging()}),new
|
|
298
|
+
`,new fi(this.node.querySelector(`#${wi}`),{id:`gallery-${e.id}`,media:l.map((y,f)=>({url:y.url,alt:`Bild ${f+1}`})),onGalleryImagePaging:()=>this.onGalleryImagePaging()}),new ne(this.node.querySelector(`#${gi}`),{title:"Tillbaka",onClick:()=>a()}),new Z(this.node.querySelector(`#${_i}`),{title:"Tillbaka",onClick:()=>a()}),new X(this.node.querySelector(`#${Si}`),{selected:t,fullSize:!0,onClick:()=>s()}),F()}},Ni=qt;var Wt=class extends r{constructor(e,t){super(e);this.displayInfo=!1;this.exposureTracked=!1;this.props=t,g(this.props.store,"accessories",(s,a)=>{s.some(n=>n.id===this.props.accessory.id)!==a.some(n=>n.id===this.props.accessory.id)&&this.render()}),this.render()}onInfoOpen(){let{accessory:e}=this.props;d("MAIN","ACCESSORY_INFORMATION_OPEN","ACCESSORY",{id:e.id,label:e.name}),this.displayInfo=!0,this.render()}onInfoClose(){let{accessory:e}=this.props;d("MAIN","ACCESSORY_INFORMATION_CLOSE","ACCESSORY",{id:e.id,label:e.name}),this.displayInfo=!1,b(),this.render(),this.node.parentElement?.scrollIntoView()}onClick(){let{store:e,accessory:t}=this.props,a=e.getState().accessories.findIndex(n=>n.id===t.id)>-1;d("MAIN",a?"ACCESSORY_UNSELECTED":"ACCESSORY_SELECTED","ACCESSORY",{id:t.id,label:t.name}),si(this.props.accessory)(this.props.store.dispatch)}trackExposure(){let{accessory:e}=this.props;this.exposureTracked=!0,d("MAIN","ACCESSORY_EXPOSURE","ACCESSORY",{id:e.id,label:e.name})}render(){let{store:e,accessory:t,key:s}=this.props,n=e.getState().accessories.findIndex(l=>l.id===t.id)>-1;this.displayInfo&&new Ni(W(),{accessory:t,selected:n,onClick:()=>{this.onInfoClose(),this.onClick()},onClose:()=>this.onInfoClose()}),new ue(this.node,{id:t.id,title:t.name,description:t.shortDescription,logo:t.logoUrl,image:t.media?.[0]?.url,price:k(t.price,{postfix:"kr"}),selected:n,onClick:()=>this.onClick(),onInfo:()=>this.onInfoOpen(),inViewPort:this.exposureTracked?void 0:()=>this.trackExposure()},s)}},Ai=Wt;var Yt=class extends r{constructor(e,t){super(e);this.props=t,this.render()}render(){let{accessories:e,store:t}=this.props,s=new pe(this.node,{id:"accessories-list",onClick:()=>d("MAIN","ACCESSORY_ARROWS","ACCESSORY")}),{overflowElement:a}=s;a&&(a.innerHTML="",e.forEach((n,l)=>new Ai(a,{store:t,accessory:n,key:`accessory-${n.id}-${l}`})))}},Ti=Yt;var Ri="button-accessories-proceed",Ci=`${Ri}-node`,ml="button-accessories-skip",Di=`${ml}-node`,bi="accessory-grid-list-node",Kt=class extends r{constructor(e,t){super(e);this.props=t,g(this.props.store,"navigation",()=>{this.render()}),this.render()}onProceed(){j(this.props.lastStage)(this.props.store.dispatch)}onEdit(){d("MAIN","ACCESSORY_EDIT","ACCESSORY"),L("main",this.props.index)(this.props.store.dispatch)}render(){let{store:e,index:t}=this.props,s=e.getState(),a=s.topNavigation.stage>t,n=s.navigation.stage===t;n&&d("MAIN","ACCESSORY_ACTIVE","ACCESSORY");let l=O(this.node,{completed:a,title:"Tillbeh\xF6r",active:n,id:"accessories"}),c=document.createElement("div");if(s.navigation.stage>t||a&&s.navigation.stage!==t)new z(l,{keyValueList:s.accessories.length?s.accessories.map(m=>({key:m.name,image:m.media[0]?{src:`${m.media[0].url}?w=32&h=32`,srcSet:`${m.media[0].url}?w=64&h=64 2x`,alt:m.name}:void 0,value:k(m.price,{postfix:"kr"})})):[{key:"Tillbeh\xF6r",value:"Inga valda"}],changeButtonTitle:"\xC4ndra tillbeh\xF6r",onEdit:s.createdOrderId?void 0:()=>this.onEdit()});else if(s.navigation.stage===t){let m=s.order?.accessories||[];c.innerHTML=`
|
|
299
299
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
300
300
|
<div class="waykeecom-stack waykeecom-stack--2">
|
|
301
301
|
<h4 class="waykeecom-heading waykeecom-heading--4">Vill du k\xF6pa till ett tillbeh\xF6r till din nya bil?</h4>
|
|
@@ -311,7 +311,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
311
311
|
<div class="waykeecom-stack waykeecom-stack--1" id="${Ci}"></div>
|
|
312
312
|
<div class="waykeecom-stack waykeecom-stack--1" id="${Di}"></div>
|
|
313
313
|
</div>
|
|
314
|
-
`,new Ti(c.querySelector(`#${bi}`),{store:e,accessories:m}),new S(c.querySelector(`#${Ci}`),{id:Ri,title:"G\xE5 vidare",onClick:()=>this.onProceed()}),new q(c.querySelector(`#${Di}`),{title:"Hoppa \xF6ver detta steg",onClick:()=>this.onProceed()})}l.appendChild(c),s.navigation.stage===t&&l.parentElement?.scrollIntoView()}},Li=Kt;var Oi="waykeecom-input-error",zt=class extends r{constructor(e,t){super(e);this.props=t,this.render()}setError(e){this.props.error=e,this.render()}render(){let{error:e,errorMessage:t}=this.props,s=this.node.querySelector(`.${Oi}`);if(s)e||s.remove();else if(e){let a=document.createElement("div");a.className=Oi,a.setAttribute("role","alert"),a.innerHTML=t,this.node.appendChild(a)}}},
|
|
314
|
+
`,new Ti(c.querySelector(`#${bi}`),{store:e,accessories:m}),new S(c.querySelector(`#${Ci}`),{id:Ri,title:"G\xE5 vidare",onClick:()=>this.onProceed()}),new q(c.querySelector(`#${Di}`),{title:"Hoppa \xF6ver detta steg",onClick:()=>this.onProceed()})}l.appendChild(c),s.navigation.stage===t&&l.parentElement?.scrollIntoView()}},Li=Kt;var Oi="waykeecom-input-error",zt=class extends r{constructor(e,t){super(e);this.props=t,this.render()}setError(e){this.props.error=e,this.render()}render(){let{error:e,errorMessage:t}=this.props,s=this.node.querySelector(`.${Oi}`);if(s)e||s.remove();else if(e){let a=document.createElement("div");a.className=Oi,a.setAttribute("role","alert"),a.innerHTML=t,this.node.appendChild(a)}}},ee=zt;var Qt=class extends r{constructor(e,t){super(e);this.props=t,this.render()}render(){let{id:e,title:t,value:s,name:a,checked:n,meta:l,description:c,disabled:m,onClick:u}=this.props;this.node.innerHTML=`
|
|
315
315
|
<div class="waykeecom-input-selection" role="radio">
|
|
316
316
|
<input
|
|
317
317
|
type="radio"
|
|
@@ -358,12 +358,12 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
358
358
|
<path d="M8 0C3.6 0 0 3.6 0 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14c-3.3 0-6-2.7-6-6s2.7-6 6-6 6 2.7 6 6-2.7 6-6 6zm-1.4-3.8h1.9V12H6.6v-1.8zm3.8-3.4c0 1-.5 1.5-1.4 2l-.4.3c-.3.1-.3.2-.3.4v.1H6.7v-.3c0-.6.1-.9.8-1.3l.7-.4c.3-.2.6-.4.6-.8s-.3-.7-.7-.7c-.5 0-.8.3-.8.8v.3H5.7v-.4c0-1.2.8-2 2.3-2 1.5 0 2.4.7 2.4 2z" />
|
|
359
359
|
</svg>
|
|
360
360
|
</button>
|
|
361
|
-
`;a.querySelector("button")?.addEventListener("click",()=>this.onClick()),t||this.node.appendChild(a)}}},
|
|
361
|
+
`;a.querySelector("button")?.addEventListener("click",()=>this.onClick()),t||this.node.appendChild(a)}}},te=jt;var Jt=class extends r{constructor(e,t){super(e);this.contexts={};this.props=t,this.render()}updateBorder(){let e=this.node.querySelector(".waykeecom-input-text");e&&(this.props.error?e?.classList.add("waykeecom-input-text--has-error"):e?.classList.remove("waykeecom-input-text--has-error"))}setError(e){this.props.error=e,this.updateBorder(),this.contexts.error?.setError(e)}render(){let{title:e,options:t,name:s,checked:a,error:n,errorMessage:l,information:c,onClick:m,onClickInformation:u}=this.props;this.node.innerHTML=`
|
|
362
362
|
<fieldset class="waykeecom-input-group" role="radiogroup" aria-required="true">
|
|
363
363
|
${e?`<legend class="waykeecom-input-label"><div class="waykeecom-input-label__label">${e}</div></legend>`:""}
|
|
364
364
|
${t.map(h=>`<div class="waykeecom-input-group__item" id="${h.id}-node"></div>`).join("")}
|
|
365
365
|
</fieldset>
|
|
366
|
-
`,this.updateBorder(),l&&(this.contexts.error=new
|
|
366
|
+
`,this.updateBorder(),l&&(this.contexts.error=new ee(this.node,{error:n,errorMessage:l})),t.forEach(h=>new Ae(this.node.querySelector(`#${h.id}-node`),{id:h.id,name:s,title:h.title||h.value,value:h.value,checked:a===h.value,description:h.description,meta:h.meta,onClick:p=>m(p)})),c&&new te(this.node.querySelector(".waykeecom-input-label"),{information:c,onClickInformation:u})}},Y=Jt;var pl=({tone:o,children:i})=>`
|
|
367
367
|
<div class="waykeecom-alert ${o?`waykeecom-alert--${o}`:""}" role="alert">
|
|
368
368
|
<div class="waykeecom-alert__icon">
|
|
369
369
|
<div class="waykeecom-alert__icon-badge">
|
|
@@ -413,7 +413,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
413
413
|
</div>
|
|
414
414
|
</div>
|
|
415
415
|
</div>
|
|
416
|
-
</div>`}});new Y(u.querySelector(`#${$i}`),{checked:this.selectedDealer,name:"dealer",options:h,onClick:p=>this.onChange(p)}),this.contexts.proceedButton=new S(u.querySelector(`#${Pi}`),{title:"G\xE5 vidare",id:Hi,disabled:!this.selectedDealer,onClick:()=>this.onProceed()})}t.stage===n&&u.parentElement?.scrollIntoView()}},Bi=Xt;var
|
|
416
|
+
</div>`}});new Y(u.querySelector(`#${$i}`),{checked:this.selectedDealer,name:"dealer",options:h,onClick:p=>this.onChange(p)}),this.contexts.proceedButton=new S(u.querySelector(`#${Pi}`),{title:"G\xE5 vidare",id:Hi,disabled:!this.selectedDealer,onClick:()=>this.onProceed()})}t.stage===n&&u.parentElement?.scrollIntoView()}},Bi=Xt;var se=o=>o.length<2?o:o.length===2?`${o.substring(0,1)}***`:o.length===3?`${o.substring(0,2)}***`:`${o.substring(0,3)}***`,Ue=o=>`${o.substring(0,o.length-4)}****`;var Zt=class extends r{constructor(e,t){super(e);this.contexts={};this.props=t,this.render()}updateBorder(){let e=this.node.querySelector(".waykeecom-input-text");e&&(this.props.error?e?.classList.add("waykeecom-input-text--has-error"):e?.classList.remove("waykeecom-input-text--has-error"))}setError(e,t){this.props.error=e,t&&(this.props.errorMessage=t),this.updateBorder(),this.contexts.error?.setError(e)}render(){let{id:e,title:t,type:s,name:a,value:n,autocomplete:l,placeholder:c,unit:m,error:u,errorMessage:h,information:p,pattern:y,inputmode:f,onChange:_,onBlur:D,onClickInformation:x}=this.props;this.node.innerHTML=`
|
|
417
417
|
<div class="waykeecom-input-label">
|
|
418
418
|
<label for="${e}" class="waykeecom-input-label__label">${t}</label>
|
|
419
419
|
</div>
|
|
@@ -432,7 +432,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
432
432
|
/>
|
|
433
433
|
${m?`<div class="waykeecom-input-text__unit">${m}</div>`:""}
|
|
434
434
|
</div>
|
|
435
|
-
`,this.updateBorder(),h&&(this.contexts.error=new
|
|
435
|
+
`,this.updateBorder(),h&&(this.contexts.error=new ee(this.node,{error:u,errorMessage:h})),p&&new te(this.node.querySelector(".waykeecom-input-label"),{information:p,onClickInformation:x});let G=this.node.querySelector("input");G&&(_&&G.addEventListener("input",_),D&&G.addEventListener("blur",D))}},R=Zt;var Fi=/\S+@\S+\.\S+/,Ui=/^[0-9\-\+\(\)\ ]+$/,Vi=/^[0-9\ \-]+$/,Gi=/^(19|20)(\d{6}(-|\s)\d{4}|(?!19|20)\d{10})$/,qi=/[a-zA-Z]{3}\d{2}(d||[a-zA-Z]){1}/,Ve=/\D/g;var A={requiredEmail:o=>Fi.test(o),requiredTelephone:o=>Ui.test(o),requiredSsn:o=>Gi.test(o),requiredSsnOver18:o=>{if(A.requiredSsn(o)){let e=o.replace(Ve,"").slice(0,8),t=`${e.slice(0,4)}-${e.slice(4,6)}-${e.slice(6,8)}`;return new Date(new Date().valueOf()-new Date(t).valueOf()).getFullYear()-1970>17}return!1},requiredZip:o=>Vi.test(o),requiredNumberOrStringNumberInRange:(o,i,e)=>{let t=parseInt(o.toString(),10);return isNaN(t)?!1:t>=i&&t<=e},requiredNumber:o=>o!=null&&!Number.isNaN(+o),optionalNumber:o=>o==null||!Number.isNaN(+o),requiredRegistrationNumber:o=>{if(!o)return!1;let i=o.replace(" ",""),e=i.length===6,t=qi.test(i);return e&&t},requiredMileage:o=>A.requiredNumberOrStringNumberInRange(o||"",0,8e4),optionalString:o=>!!o||!o,requiredCondition:o=>["VeryGood","Good","Ok"].includes(o||""),requiredAssessmentMaritalStatus:o=>["married","single"].includes(o||""),requiredAssessmentEmplyment:o=>["other","retired","fullTimeEmployed","student","temporarilyEmployed","selfEmployed"].includes(o||""),requiredHousingType:o=>["singleFamily","condominium","apartment"].includes(o||"")};var Wi="contact-email-node",hl="contact-email",Yi="contact-phone-node",kl="contact-phone",Ki="contact-proceed-node",yl="contact-proceed",Ge={email:A.requiredEmail,phone:A.requiredTelephone},vl=o=>{let i={email:o?.email||"",phone:o?.phone||""};return{value:i,validation:{email:Ge.email(i.email),phone:Ge.phone(i.phone)},interact:{email:!1,phone:!1}}},es=class extends r{constructor(e,t){super(e,{htmlTag:"div",className:"waykeecom-stack waykeecom-stack--2"});this.contexts={};this.props=t;let s=this.props.store.getState();this.state=vl(s.customer),this.render()}onChange(e){let t=e.currentTarget,s=t.name,a=t.value;this.state.value[s]=a,this.state.validation[s]=Ge[s](a),this.updateUiError(s),this.updateProceedButton()}onBlur(e){let s=e.currentTarget.name;this.state.interact[s]=!0,this.state.validation[s]=Ge[s](this.state.value[s]),this.updateUiError(s),this.updateProceedButton()}updateUiError(e){this.contexts[e]?.setError(this.state.interact[e]&&!this.state.validation[e])}updateProceedButton(){this.contexts.button?.disabled(!this.state.validation.email||!this.state.validation.phone)}onProceed(){d("MAIN","CUSTOMER_EMAIL_AND_PHONE_SET","CUSTOMER_EMAIL_AND_PHONE"),Yo({email:this.state.value.email.trim(),phone:this.state.value.phone.trim()})(this.props.store.dispatch)}render(){if(this.props.store.getState().navigation.subStage>1){let t=[{key:"E-post",value:this.state.value.email},{key:"Telefonnummer",value:this.state.value.phone}];this.node.innerHTML=`
|
|
436
436
|
<div class="waykeecom-stack waykeecom-stack--2">
|
|
437
437
|
<ul class="waykeecom-key-value-list">
|
|
438
438
|
${t.map(s=>E(s)).join("")}
|
|
@@ -465,7 +465,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
465
465
|
</div>
|
|
466
466
|
<span class="waykeecom-disclaimer__text">${this.props.text}</span>
|
|
467
467
|
</div>
|
|
468
|
-
`}},
|
|
468
|
+
`}},he=ts;import{customers as Qi}from"@wayke-se/ecom";var ji=o=>{let i=Qi.newAddressLookupRequest().forCustomer(o).build();return Qi.lookupAddress(i)};var Ji=(o,i)=>o?i:"";var ss="contact-socialId-node",qe="contact-socialId",El="contact-social-id-info",Il=`${qe}-proceed`,Xi=`${qe}-proceed-node`,Zi=`${qe}-disclaimer-node`,os={socialId:A.requiredSsnOver18},fl=o=>{let i={socialId:o?.socialId||""};return{value:i,validation:{socialId:os.socialId(i.socialId)},interact:{socialId:!1}}},is=class extends r{constructor(e,t){super(e,{htmlTag:"div",className:"waykeecom-stack waykeecom-stack--2"});this.requestError=!1;this.contexts={};this.props=t;let s=this.props.store.getState();this.state=fl(s.customer),this.render()}async onFetchAddress(){let{store:e,lastStage:t}=this.props;this.requestError=!1,this.render();try{d("MAIN","CUSTOMER_ADDRESS_BY_SSN_REQUESTED","CUSTOMER_ADDRESS"),this.contexts.buttonFetch?.loading(!0);let s=await ji(this.state.value.socialId);d("MAIN","CUSTOMER_ADDRESS_BY_SSN_SUCCEEDED","CUSTOMER_ADDRESS");let a=s.getAddress();Ko(this.state.value.socialId.replace(Ve,""),a,t)(e.dispatch),d("MAIN","CUSTOMER_ADDRESS_SET","CUSTOMER_ADDRESS")}catch{this.requestError=!0,d("MAIN","CUSTOMER_ADDRESS_BY_SSN_FAILED","CUSTOMER_ADDRESS")}finally{this.contexts.buttonFetch?.loading(!1),this.render()}}onChange(e){let t=e.currentTarget,s=t.name,a=t.value;this.state.value[s]=a,this.state.validation[s]=os[s](a),this.updateUiError(s),this.updateProceedButton()}onBlur(e){let s=e.currentTarget.name;this.state.interact[s]=!0,this.state.validation[s]=os[s](this.state.value[s]),this.updateUiError(s),this.updateProceedButton()}updateUiError(e){this.contexts[e]?.setError(this.state.interact[e]&&!this.state.validation[e])}updateProceedButton(){this.contexts.buttonFetch?.disabled(!this.state.validation.socialId)}render(){let e="https://www.wayke.se/trygghet-naer-det-kommer-till-dina-personuppgifter";this.node.innerHTML=`
|
|
469
469
|
<div class="waykeecom-stack waykeecom-stack--2">
|
|
470
470
|
<hr class="waykeecom-separator" />
|
|
471
471
|
</div>
|
|
@@ -498,13 +498,13 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
498
498
|
<div class="waykeecom-stack waykeecom-stack--2" id="${Zi}"></div>
|
|
499
499
|
</div>
|
|
500
500
|
</div>
|
|
501
|
-
`,this.contexts.socialId=new R(this.node.querySelector(`#${ss}`),{title:"Personnummer",value:this.state.value.socialId,id:qe,error:this.state.interact.socialId&&!this.state.validation.socialId,errorMessage:"Ange personnummer i formatet \xC5\xC5\xC5\xC5MMDD-XXXX. M\xE5ste vara \xF6ver 18 \xE5r.",name:"socialId",placeholder:"\xC5\xC5\xC5\xC5MMDD-XXXX",pattern:"[0-9]*",inputmode:"numeric",onChange:t=>this.onChange(t),onBlur:t=>this.onBlur(t)}),Object.keys(this.state.value).forEach(t=>this.updateUiError(t)),this.contexts.buttonFetch=new S(this.node.querySelector(`#${Xi}`),{title:"H\xE4mta uppgifter",id:Il,disabled:!this.state.validation.socialId,onClick:()=>this.onFetchAddress()}),new
|
|
501
|
+
`,this.contexts.socialId=new R(this.node.querySelector(`#${ss}`),{title:"Personnummer",value:this.state.value.socialId,id:qe,error:this.state.interact.socialId&&!this.state.validation.socialId,errorMessage:"Ange personnummer i formatet \xC5\xC5\xC5\xC5MMDD-XXXX. M\xE5ste vara \xF6ver 18 \xE5r.",name:"socialId",placeholder:"\xC5\xC5\xC5\xC5MMDD-XXXX",pattern:"[0-9]*",inputmode:"numeric",onChange:t=>this.onChange(t),onBlur:t=>this.onBlur(t)}),Object.keys(this.state.value).forEach(t=>this.updateUiError(t)),this.contexts.buttonFetch=new S(this.node.querySelector(`#${Xi}`),{title:"H\xE4mta uppgifter",id:Il,disabled:!this.state.validation.socialId,onClick:()=>this.onFetchAddress()}),new he(this.node.querySelector(`#${Zi}`),{text:`Dina personuppgifter behandlas och sparas i enlighet med v\xE5r <a href="${e}" title="personuppgiftspolicy" target="_blank" rel="noopener noreferrer" class="waykeecom-link">personuppgiftspolicy</a>.`}),this.updateProceedButton()}},ea=is;var as=class extends r{constructor(e,t){super(e,{htmlTag:"div",className:"waykeecom-stack waykeecom-stack--2"});this.props=t;let s=this.props.store.getState();this.state=s.customer,this.render()}render(){let{store:e,lastStage:t}=this.props;if(e.getState().navigation.subStage>2){let a=[{key:"Personnummer",value:this.state.socialId}];this.node.innerHTML=`
|
|
502
502
|
<div class="waykeecom-stack waykeecom-stack--2">
|
|
503
503
|
<ul class="waykeecom-key-value-list">
|
|
504
504
|
${a.map(n=>E(n)).join("")}
|
|
505
505
|
</ul>
|
|
506
506
|
</div>
|
|
507
|
-
`}else this.node.innerHTML="",new ea(this.node,{store:e,lastStage:t})}},ta=as;var ns=class extends r{constructor(e,t){super(e);this.props=t,g(this.props.store,"navigation",()=>{this.render()}),this.render()}onChange(){d("MAIN","CUSTOMER_EDIT","CUSTOMER_EMAIL_AND_PHONE"),L("main",this.props.index)(this.props.store.dispatch)}render(){let{store:e,index:t,lastStage:s}=this.props,a=this.props.store.getState(),n=a.topNavigation.stage>t,l=a.navigation.stage===t&&!a.createdOrderId;l&&d("MAIN","CUSTOMER_ACTIVE",a.navigation.subStage===1?"CUSTOMER_EMAIL_AND_PHONE":"CUSTOMER_ADDRESS");let c=O(this.node,{completed:n,title:"Dina uppgifter",active:l,id:"customer"});c.innerHTML="";let m=document.createElement("div");m.className="waykeecom-stack waykeecom-stack--2";let u=document.createElement("div");if(u.className="waykeecom-stack waykeecom-stack--2",a.navigation.stage>t||n&&a.navigation.stage!==t){let h=[{key:"E-post",value:a.customer.email},{key:"Telefonnummer",value:a.customer.phone},{key:"Personnummer",value:Ue(a.customer.socialId)},...a.address?[{key:"Namn",value:`${
|
|
507
|
+
`}else this.node.innerHTML="",new ea(this.node,{store:e,lastStage:t})}},ta=as;var ns=class extends r{constructor(e,t){super(e);this.props=t,g(this.props.store,"navigation",()=>{this.render()}),this.render()}onChange(){d("MAIN","CUSTOMER_EDIT","CUSTOMER_EMAIL_AND_PHONE"),L("main",this.props.index)(this.props.store.dispatch)}render(){let{store:e,index:t,lastStage:s}=this.props,a=this.props.store.getState(),n=a.topNavigation.stage>t,l=a.navigation.stage===t&&!a.createdOrderId;l&&d("MAIN","CUSTOMER_ACTIVE",a.navigation.subStage===1?"CUSTOMER_EMAIL_AND_PHONE":"CUSTOMER_ADDRESS");let c=O(this.node,{completed:n,title:"Dina uppgifter",active:l,id:"customer"});c.innerHTML="";let m=document.createElement("div");m.className="waykeecom-stack waykeecom-stack--2";let u=document.createElement("div");if(u.className="waykeecom-stack waykeecom-stack--2",a.navigation.stage>t||n&&a.navigation.stage!==t){let h=[{key:"E-post",value:a.customer.email},{key:"Telefonnummer",value:a.customer.phone},{key:"Personnummer",value:Ue(a.customer.socialId)},...a.address?[{key:"Namn",value:`${se(a.address.givenName)} ${se(a.address.surname)}`},{key:"Adress",value:a.address.street},{key:"Postnummer",value:a.address.postalCode},{key:"Stad",value:a.address.city}]:[]];new z(c,{keyValueList:h,changeButtonTitle:"\xC4ndra dina uppgifter",onEdit:a.createdOrderId?void 0:()=>this.onChange()})}else a.navigation.stage===t&&(new zi(c,{store:e}),a.navigation.subStage>1&&new ta(c,{store:e,lastStage:s}));a.navigation.stage===t&&c.parentElement?.scrollIntoView()}},sa=ns;import{DeliveryType as ia}from"@wayke-se/ecom";var gl=(o,i)=>{if(!!o)return o.unit==="m"&&i.unit==="km"?Math.round(o.value/1e3):o.unit==="km"&&i.unit==="m"?o.value*1e3:o.value},oa=(o,i)=>{let e=gl(o,i);if(!!e&&!!i.unitPrice)return i.startupCost+i.unitPrice*e};var ca="radio-home-delivery-true",aa=`${ca}-node`,la="radio-home-delivery-false",na=`${la}-node`,da="button-home-delivery-proceed",ra=`${da}-node`,rs=class extends r{constructor(e,t){super(e);this.props=t,g(this.props.store,"navigation",()=>{this.render()});let s=this.props.store.getState();this.homeDelivery=s.homeDelivery,this.render()}onChange(e){let s=e.currentTarget.value==="true";this.homeDelivery=s,d("MAIN",this.homeDelivery?"DELIVERY_HOME_SELECTED":"DELIVERY_DEALER_SELECTED","DELIVERY")}onProceed(){zo(this.homeDelivery,this.props.lastStage)(this.props.store.dispatch),d("MAIN",this.homeDelivery?"DELIVERY_HOME_SET":"DELIVERY_DEALER_SET","DELIVERY")}onEdit(){d("MAIN","DELIVERY_EDIT","DELIVERY"),L("main",this.props.index)(this.props.store.dispatch)}render(){let{store:e,index:t}=this.props,s=e.getState();if(!s.order)throw"Missing order...";let a=s.order.contactInformation;if(!a)throw"Missing dealer contact information";let n=s.topNavigation.stage>t,l=s.navigation.stage===t;l&&d("MAIN","DELIVERY_ACTIVE","DELIVERY");let c=O(this.node,{completed:n,title:"Leverans",active:l,id:"delivery"});if(s.navigation.stage>t||n&&s.navigation.stage!==t)new z(c,{keyValueList:[{key:"Leveranss\xE4tt",value:s.homeDelivery?"Hemleverans":"H\xE4mta hos handlaren"}],changeButtonTitle:"\xC4ndra leveranss\xE4tt",onEdit:s.createdOrderId?void 0:()=>this.onEdit()});else if(s.navigation.stage===t){let m=document.createElement("div");m.innerHTML=`
|
|
508
508
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
509
509
|
<h4 class="waykeecom-heading waykeecom-heading--4">Hur vill du ha din bil levererad?</h4>
|
|
510
510
|
<div class="waykeecom-content">
|
|
@@ -544,7 +544,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
544
544
|
</div>
|
|
545
545
|
`,meta:`<div class="waykeecom-text waykeecom-text--font-bold">${y===0?"Gratis":k(y,{postfix:"kr"})}</div>`,checked:!this.homeDelivery,onClick:x=>this.onChange(x)});break;case ia.Delivery:let f=s.address?.distance?.value||0,_=h.unitPrice||0,D=f>_;new Ae(m.querySelector(`#${aa}`),{id:la,name:"homeDelivery",title:"Hemleverans",value:"true",disabled:D,description:`<div class="waykeecom-box">
|
|
546
546
|
<div class="waykeecom-stack waykeecom-stack--2">Till din folkbokf\xF6ringsadress</div>
|
|
547
|
-
${D?`<div class="waykeecom-stack waykeecom-stack--2">${I({tone:"info",children:"Tyv\xE4rr kan vi inte erbjuda hemleverans till din adress."})}</div>`:""}</div>`,meta:`<div class="waykeecom-text waykeecom-text--font-bold">${D?"-":k(y,{postfix:"kr"})}</div>`,checked:this.homeDelivery,onClick:x=>this.onChange(x)});break;default:break}}),new S(m.querySelector(`#${ra}`),{title:"G\xE5 vidare",id:da,onClick:()=>this.onProceed()}),c.appendChild(m),s.navigation.stage===t&&c.parentElement?.scrollIntoView()}}},ma=rs;import{PaymentType as $}from"@wayke-se/ecom";import{DrivingDistance as Te}from"@wayke-se/ecom";var
|
|
547
|
+
${D?`<div class="waykeecom-stack waykeecom-stack--2">${I({tone:"info",children:"Tyv\xE4rr kan vi inte erbjuda hemleverans till din adress."})}</div>`:""}</div>`,meta:`<div class="waykeecom-text waykeecom-text--font-bold">${D?"-":k(y,{postfix:"kr"})}</div>`,checked:this.homeDelivery,onClick:x=>this.onChange(x)});break;default:break}}),new S(m.querySelector(`#${ra}`),{title:"G\xE5 vidare",id:da,onClick:()=>this.onProceed()}),c.appendChild(m),s.navigation.stage===t&&c.parentElement?.scrollIntoView()}}},ma=rs;import{PaymentType as $}from"@wayke-se/ecom";import{DrivingDistance as Te}from"@wayke-se/ecom";var ke={bankid:"https://cdn.wayke.se/public-assets/bankid-logo.svg",illustrations:{payment:"https://cdn.wayke.se/public-assets/payment.svg"}},ye={["VeryGood"]:"Mycket bra",["Good"]:"Bra",["Ok"]:"Ok"},Q={[Te.Between0And1000]:"0\u20131000 mil",[Te.Between1000And1500]:"1000\u20131500 mil",[Te.Between1500And2000]:"1500\u20132000 mil",[Te.Between2000And2500]:"2000\u20132500 mil",[Te.Over2500]:"2500+ mil"};var Sl=(o,i)=>i?Math.round(o/i)*i:o,cs=class extends r{constructor(e,t){super(e);this.contexts={};this.props=t,this.value=t.value,this.min=t.min,this.max=t.max,this.isDisabled=t.disabled,this.inputFieldValue=this.value,this.rangeSpan=this.max-this.min,this.currentValueInPercentage=parseInt((100*((this.value-this.min)/this.rangeSpan)).toString(),10),this.render()}update(e,t,s){this.value=e,this.inputFieldValue=e,this.min=t,this.max=s,this.rangeSpan=s-t,this.isDisabled=!this.rangeSpan;let a=parseInt((100*((this.value-t)/this.rangeSpan)).toString(),10);this.currentValueInPercentage=isNaN(a)?0:a,this.render()}disabled(e){this.isDisabled!==e&&(this.isDisabled=e,this.render())}onOpenInformation(){let e=this.node.querySelector(".input-label__foldout");e&&(e.style.display="")}onChange(e){let t=e.currentTarget;this.inputFieldValue=t.valueAsNumber}onBlur(e){let t=this.inputFieldValue;if(!isNaN(t)&&t>=this.min&&t<=this.max){let s=Sl(t,this.props.step);this.value=s,this.props.onChange&&e.currentTarget&&(e.currentTarget.value=s.toString(),this.props.onChange(e)),this.inputFieldValue=this.value,this.currentValueInPercentage=parseInt((100*((this.value-this.min)/this.rangeSpan)).toString(),10),this.render()}else this.inputFieldValue=this.value,this.updateInputField()}onFocus(e){let t=e.currentTarget;t.value=this.value.toString()}onInput(e){let t=e.currentTarget;this.value=parseInt(t.value,10),this.inputFieldValue=this.value,this.currentValueInPercentage=parseInt((100*((this.value-this.min)/this.rangeSpan)).toString(),10),this.updateInputField(),this.updateRangeSliderColor(t)}updateRangeSliderColor(e){let t=e||this.node.querySelector(`#${this.props.id}`);t&&t.style.setProperty("--percentage",`${this.currentValueInPercentage}%`)}updateInputField(){let e=this.node.querySelector(`#${this.props.id}-input`);e&&(e.value=this.inputFieldValue.toString())}render(){let{title:e,step:t,name:s,id:a,information:n,unit:l,onChange:c,onClickInformation:m}=this.props,u=this.min!==this.max;if(this.node.innerHTML=`
|
|
548
548
|
<div class="waykeecom-input-label">
|
|
549
549
|
<label for="${a}" class="waykeecom-input-label__label">${e}</label>
|
|
550
550
|
</div>
|
|
@@ -585,7 +585,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
585
585
|
</div>
|
|
586
586
|
`:""}
|
|
587
587
|
</div>
|
|
588
|
-
`,n&&new
|
|
588
|
+
`,n&&new te(this.node.querySelector(".waykeecom-input-label"),{information:n,onClickInformation:m}),u){this.contexts.rangeSlider=this.node.querySelector(`#${a}`)||void 0,this.contexts.rangeSlider&&(c&&this.contexts.rangeSlider.addEventListener("change",c),this.contexts.rangeSlider.addEventListener("input",p=>this.onInput(p)),this.updateRangeSliderColor(this.contexts.rangeSlider));let h=this.node.querySelector(`#${a}-input`);h&&(h.addEventListener("change",p=>this.onChange(p)),h.addEventListener("blur",p=>this.onBlur(p)))}}},We=cs;import{payments as pa}from"@wayke-se/ecom";var ua=({vehicleId:o,dealerId:i,downPayment:e,duration:t,residual:s})=>{let a=pa.newLookupRequest().forVehicle(o).withDownPayment(e).withDuration(t);return s!==void 0&&a.withResidualValue(s),i!==void 0&&a.forDealer(i),pa.lookupPayment(a.build())};import{AuthMethod as fe,Employment as re,MaritalStatus as Je,PaymentType as Va,HousingType as J}from"@wayke-se/ecom";var ls=class extends r{constructor(e,t){super(e,t.append?{htmlTag:"div",className:"waykeecom-accordion"}:void 0);this.props=t,this.render()}render(){let{title:e,description:t,onClick:s}=this.props,a=`
|
|
589
589
|
<input
|
|
590
590
|
type="checkbox"
|
|
591
591
|
id="${this.props.id}"
|
|
@@ -608,7 +608,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
608
608
|
<div class="waykeecom-accordion__body">${t}</div>
|
|
609
609
|
`;this.props.append&&(this.node.innerHTML=a),this.node.innerHTML=`
|
|
610
610
|
${a}
|
|
611
|
-
`,s&&this.node.querySelector("input")?.addEventListener("click",()=>s())}},Ye=ls;import{AuthMethod as U}from"@wayke-se/ecom";var
|
|
611
|
+
`,s&&this.node.querySelector("input")?.addEventListener("click",()=>s())}},Ye=ls;import{AuthMethod as U}from"@wayke-se/ecom";var ve=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);var ds=class extends r{constructor(e,t){super(e);this.props=t,this.render()}render(){let{qrCode:e,errorMessage:t}=this.props;if(t){this.node.innerHTML=I({tone:"error",children:t});return}this.node.innerHTML=`
|
|
612
612
|
${e?`
|
|
613
613
|
<div class="waykeecom-stack waykeecom-stack--4">
|
|
614
614
|
<div class="waykeecom-align waykeecom-align--center">
|
|
@@ -636,14 +636,14 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
636
636
|
</span>
|
|
637
637
|
<span class="waykeecom-button__content">${e}</span>
|
|
638
638
|
</button>
|
|
639
|
-
`,n&&this.node.querySelector("button")?.addEventListener("click",n)}},
|
|
639
|
+
`,n&&this.node.querySelector("button")?.addEventListener("click",n)}},Ee=ms;var ps=class extends r{constructor(e,t){super(e);this.props=t,this.render()}render(){let{autoLaunchUrl:e,errorMessage:t}=this.props;if(t){this.node.innerHTML=I({tone:"error",children:t});return}this.node.innerHTML=`
|
|
640
640
|
<div class="waykeecom-stack waykeecom-stack--4">
|
|
641
641
|
<div class="waykeecom-align waykeecom-align--center">
|
|
642
|
-
<img src="${
|
|
642
|
+
<img src="${ke.bankid}" alt="BankID logotyp" class="waykeecom-image" style="width: 130px" />
|
|
643
643
|
</div>
|
|
644
644
|
</div>
|
|
645
645
|
<div class="waykeecom-stack waykeecom-stack--4">${C()}</div>
|
|
646
|
-
`,new
|
|
646
|
+
`,new Ee(this.node,{title:"\xD6ppna BankID",disabled:!e,onClick:()=>{window.open(e,"_blank"),this.props.onClick&&this.props.onClick()},htmlNodesettings:{htmlTag:"div",className:"waykeecom-stack waykeecom-stack--4"}})}},ka=ps;var ya="bankid-start-node",wl="bankid-start",Ea="bankid-abort",va=`${Ea}-node`,us="bankid-auth-method-node",hs=class extends r{constructor(e,t){super(e);this.props=t,setTimeout(()=>{ve()?this.props.onStart(U.SameDevice):this.props.onStart(U.QrCode)},1),this.render(),F()}update(e,t){switch(this.props.errorMessage=void 0,this.props.method=e,e){case U.QrCode:this.props.autoLaunchUrl=void 0,this.props.qrCode=t||this.props.qrCode;break;case U.SameDevice:this.props.qrCode=void 0,this.props.autoLaunchUrl=t||this.props.autoLaunchUrl;break;default:break}this.render()}setErrorMessage(e){this.props.errorMessage=e,this.render()}setInfo(e){e!==this.props.info&&(this.props.info=e,this.render())}setTitle(e){e!==this.props.title&&(this.props.title=e,this.render())}setDescription(e){e!==this.props.description&&(this.props.description=e,this.render())}setFinalizing(e){e!==this.props.finalizing&&(this.props.finalizing=e,this.render())}render(){let{qrCode:e,autoLaunchUrl:t,method:s,errorMessage:a,descriptionQrCode:n,descriptionSameDevice:l,info:c,title:m,description:u,finalizing:h,onStart:p,onAbort:y}=this.props,f=m||(s===U.QrCode?"\xD6ppna BankID och scanna QR-koden":"Skriv in din s\xE4kerhetskod i BankID-appen"),_=u||(s===U.QrCode?n:l);if(this.node.innerHTML=`
|
|
647
647
|
<div class="waykeecom-text waykeecom-text--align-center">
|
|
648
648
|
<div class="waykeecom-stack waykeecom-stack--4" id="">
|
|
649
649
|
<h4 class="waykeecom-heading waykeecom-heading--4">${f}</h4>
|
|
@@ -669,7 +669,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
669
669
|
${this.props.text}
|
|
670
670
|
</div>
|
|
671
671
|
</div>
|
|
672
|
-
`}},
|
|
672
|
+
`}},Ie=ks;import{creditAssessment as Nl}from"@wayke-se/ecom";var Ce=o=>Nl.cancelSigning(o);import{creditAssessment as Al}from"@wayke-se/ecom";var Ia=o=>Al.getStatus(o);import{creditAssessment as Tl}from"@wayke-se/ecom";var fa=o=>Tl.newCase(o);import{creditAssessment as Cl}from"@wayke-se/ecom";var ga=o=>Cl.signCase(o);import{CreditAssessmentRecommendation as Ba}from"@wayke-se/ecom";import{CreditAssessmentRecommendation as bl}from"@wayke-se/ecom";import{CreditAssessmentRecommendation as _a,PaymentType as Dl}from"@wayke-se/ecom";var ys=class extends r{constructor(e,t){super(e);this.props=t,this.render()}render(){let{store:e,decision:t}=this.props,s=e.getState(),{order:a}=s,n=a?.paymentOptions.find(c=>c.type===Dl.Loan),l=a?.contactInformation;t===_a.Approve?this.node.innerHTML=`
|
|
673
673
|
${I({tone:"success",children:`
|
|
674
674
|
<div class="waykeecom-content waykeecom-content--inherit-size">
|
|
675
675
|
<p class="waykeecom-content__p"><string>Grattis! Din l\xE5neans\xF6kan har beviljats av ${n?.name}.</strong></p>
|
|
@@ -692,19 +692,19 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
692
692
|
<p class="waykeecom-content__p">Har du fr\xE5gor under tiden? Kontakta ${l?.name} p\xE5 tel ${l?.phone}.</p>
|
|
693
693
|
</div>
|
|
694
694
|
`})}
|
|
695
|
-
`}},
|
|
695
|
+
`}},oe=ys;var Rl="assessment-approved-result",Sa=`${Rl}-node`,Aa="assessment-approved-proceed",wa=`${Aa}-node`,Ta="assessment-approved-abort",Na=`${Ta}-node`,vs=class extends r{constructor(e,t){super(e);this.props=t,this.render()}render(){let{store:e,onProceed:t,onGoBack:s}=this.props;this.node.innerHTML=`
|
|
696
696
|
<div class="waykeecom-stack waykeecom-stack--4" id="${Sa}"></div>
|
|
697
697
|
<div class="waykeecom-stack waykeecom-stack--4">
|
|
698
698
|
<div class="waykeecom-stack waykeecom-stack--2" id="${wa}"></div>
|
|
699
699
|
<div class="waykeecom-stack waykeecom-stack--2" id="${Na}"></div>
|
|
700
700
|
</div>
|
|
701
|
-
`,new
|
|
701
|
+
`,new oe(this.node.querySelector(`#${Sa}`),{store:e,decision:bl.Approve}),new S(this.node.querySelector(`#${wa}`),{title:"G\xE5 vidare",id:Aa,onClick:()=>t()}),new B(this.node.querySelector(`#${Na}`),{title:"Avbryt",id:Ta,onClick:()=>s()})}},Ca=vs;import{CreditAssessmentRecommendation as Ll}from"@wayke-se/ecom";var Ol="assessment-assess-manually-result",Da=`${Ol}-node`,La="assessment-assess-manually-proceed",ba=`${La}-node`,Oa="assessment-assess-manually-abort",Ra=`${Oa}-node`,Es=class extends r{constructor(e,t){super(e);this.props=t,this.render()}render(){let{store:e,onProceed:t,onGoBack:s}=this.props;this.node.innerHTML=`
|
|
702
702
|
<div class="waykeecom-stack waykeecom-stack--4" id="${Da}"></div>
|
|
703
703
|
<div class="waykeecom-stack waykeecom-stack--4">
|
|
704
704
|
<div class="waykeecom-stack waykeecom-stack--1" id="${ba}"></div>
|
|
705
705
|
<div class="waykeecom-stack waykeecom-stack--1" id="${Ra}"></div>
|
|
706
706
|
</div>
|
|
707
|
-
`,new
|
|
707
|
+
`,new oe(this.node.querySelector(`#${Da}`),{store:e,decision:Ll.AssessManually}),new S(this.node.querySelector(`#${ba}`),{title:"G\xE5 vidare",id:La,onClick:()=>t()}),new Z(this.node.querySelector(`#${Ra}`),{title:"Avbryt",id:Oa,onClick:()=>s()})}},Ma=Es;import{CreditAssessmentRecommendation as Ml}from"@wayke-se/ecom";var Is=class extends r{constructor(e,t){super(e);this.props=t,this.render()}isDisabled(){return this.props.disabled}disabled(e){this.props.disabled!==e&&(this.props.disabled=e,this.render())}loading(e){this.props.loading!==e&&(this.props.loading=e,this.props.disabled=e,this.render())}render(){let{title:e,id:t,disabled:s,loading:a,onClick:n}=this.props;this.node.innerHTML=`
|
|
708
708
|
<button
|
|
709
709
|
type="button"
|
|
710
710
|
${t?`id="${t}"`:""}
|
|
@@ -721,7 +721,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
721
721
|
`,n&&this.node.querySelector("button")?.addEventListener("click",n)}},ze=Is;var xl="assessment-rejected-result",xa=`${xl}-node`,$a="assessment-rejected-abort",Pa=`${$a}-node`,fs=class extends r{constructor(e,t){super(e);this.props=t,this.render()}render(){let{store:e,onGoBack:t}=this.props;this.node.innerHTML=`
|
|
722
722
|
<div class="waykeecom-stack waykeecom-stack--4" id="${xa}"></div>
|
|
723
723
|
<div class="waykeecom-stack waykeecom-stack--4" id="${Pa}"></div>
|
|
724
|
-
`,new
|
|
724
|
+
`,new oe(this.node.querySelector(`#${xa}`),{store:e,decision:Ml.Reject}),new ze(this.node.querySelector(`#${Pa}`),{title:"G\xE5 tillbaka",id:$a,onClick:()=>t()})}},Ha=fs;var gs=class extends r{constructor(e,t){super(e);this.props=t,this.render()}render(){let{store:e,creditAssessmentResponse:t,onProceed:s,onGoBack:a}=this.props,n=t.recommendation;n===Ba.Approve?new Ca(this.node,{store:e,onProceed:()=>s(),onGoBack:()=>a()}):n===Ba.AssessManually?new Ma(this.node,{store:e,onProceed:()=>s(),onGoBack:()=>a()}):new Ha(this.node,{store:e,onGoBack:()=>a()})}},Fa=gs;var Pl=o=>{let i=o>0,e=o%12===0;if(!i||!e)throw new TypeError("Invalid months for creating creidt assessment term");return`${o}months`},Ua=Pl;var Qe={},De=(o,i)=>{Qe[o]=i},_s=()=>{Object.keys(Qe).forEach(o=>{clearInterval(Qe[o]),delete Qe[o]})};import{creditAssessment as $l}from"@wayke-se/ecom";var Ss=o=>$l.decline(o);var ws=class extends r{constructor(e,t){super(e);this.contexts={};this.props=t,this.render()}updateBorder(){let e=this.node.querySelector(".waykeecom-input-text");e&&(this.props.error?e?.classList.add("waykeecom-input-text--has-error"):e?.classList.remove("waykeecom-input-text--has-error"))}setError(e,t){this.props.error=e,t&&(this.props.errorMessage=t),this.updateBorder(),this.contexts.error?.setError(e)}render(){let{id:e,options:t,value:s,name:a,title:n,error:l,errorMessage:c,onChange:m}=this.props;this.node.innerHTML=`
|
|
725
725
|
<div class="waykeecom-input-label">
|
|
726
726
|
<label for="wayke-estimated-mileage" class="waykeecom-input-label__label">${n}</label>
|
|
727
727
|
</div>
|
|
@@ -733,7 +733,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
733
733
|
>
|
|
734
734
|
${t.map(u=>`<option value="${u.value}" ${u.value===s?'selected="selected"':""}>${u.title||u.value}</option>`).join("")}
|
|
735
735
|
</select>
|
|
736
|
-
`,this.updateBorder(),c&&(this.contexts.error=new Z(this.node,{error:l,errorMessage:c})),this.node.querySelector("select")?.addEventListener("change",u=>m(u))}},je=ws;var Hl="credit-assessment-martial-status",Ga=`${Hl}-node`,Ts="credit-assessment-income",Ns=`${Ts}-node`,Bl="credit-assessment-employment",qa=`${Bl}-node`,Fl="credit-assessment-household-children",Wa=`${Fl}-node`,sn="credit-assessment-housing-cost",Ya=`${sn}-node`,on="credit-assessment-debt-specification-card-credit",Ka=`${on}-node`,an="credit-assessment-debt-specification-car-loan",za=`${an}-node`,nn="credit-assessment-debt-specification-collateral",Qa=`${nn}-node`,rn="credit-assessment-debt-specification-leasing-fees",ja=`${rn}-node`,cn="credit-assessment-debt-specification-private-loan",Ja=`${cn}-node`,Ul="credit-assessment-housing-type",Xa=`${Ul}-node`,ln="credit-assessment-perform-application",As=`${ln}-node`,Za="disclaimer-node",en="disclaimer-safe-node",tn="why-description-node",M={maritalStatus:A.requiredAssessmentMaritalStatus,income:A.requiredNumber,employment:A.requiredAssessmentEmplyment,householdChildren:A.requiredNumber,housingCost:A.requiredNumber,"debtSpecification.cardCredits":A.optionalNumber,"debtSpecification.carLoan":A.optionalNumber,"debtSpecification.collateral":A.optionalNumber,"debtSpecification.leasingFees":A.optionalNumber,"debtSpecification.privateLoan":A.optionalNumber,housingType:A.requiredHousingType},Vl={maritalStatus:Je.Married,income:5e4,employment:ne.FullTimeEmployed,householdChildren:0,housingCost:2e3,debtSpecification:{cardCredits:0,carLoan:0,collateral:0,leasingFees:0,privateLoan:0},housingType:fe.Apartment},Gl=()=>location.hostname==="localhost"?{...Vl}:void 0,ql=o=>{let i={maritalStatus:o?.maritalStatus||"",income:o?.income.toString()||"",employment:o?.employment.toString()||"",householdChildren:o?.householdChildren.toString()||"",housingCost:o?.housingCost.toString()||"","debtSpecification.cardCredits":o?.debtSpecification.cardCredits.toString()||"","debtSpecification.carLoan":o?.debtSpecification.carLoan.toString()||"","debtSpecification.collateral":o?.debtSpecification.collateral.toString()||"","debtSpecification.leasingFees":o?.debtSpecification.leasingFees.toString()||"","debtSpecification.privateLoan":o?.debtSpecification.privateLoan.toString()||"",housingType:o?.housingType.toString()||""};return{value:i,validation:{maritalStatus:M.maritalStatus(i.maritalStatus),income:M.income(i.income),employment:M.employment(i.employment),householdChildren:M.householdChildren(i.householdChildren),housingCost:M.housingCost(i.housingCost),"debtSpecification.cardCredits":M["debtSpecification.cardCredits"](i["debtSpecification.cardCredits"]),"debtSpecification.carLoan":M["debtSpecification.carLoan"](i["debtSpecification.carLoan"]),"debtSpecification.collateral":M["debtSpecification.collateral"](i["debtSpecification.collateral"]),"debtSpecification.leasingFees":M["debtSpecification.leasingFees"](i["debtSpecification.leasingFees"]),"debtSpecification.privateLoan":M["debtSpecification.privateLoan"](i["debtSpecification.privateLoan"]),housingType:M.housingType(i.housingType)},interact:{maritalStatus:!1,income:!1,employment:!1,householdChildren:!1,housingCost:!1,"debtSpecification.cardCredits":!1,"debtSpecification.carLoan":!1,"debtSpecification.collateral":!1,"debtSpecification.leasingFees":!1,"debtSpecification.privateLoan":!1,housingType:!1}}},Cs=class extends r{constructor(e,t){super(e);this.view=1;this.contexts={};this.bankidError=!1;this.signed=!1;this.props=t,this.state=ql(Gl()),this.render()}onChange(e){let t=e.currentTarget,s=t.name,a=t.value;this.state.value[s]=a,this.state.validation[s]=M[s](a),this.updateUiError(s),this.updateProceedButton()}onBlur(e){let s=e.currentTarget.name;this.state.interact[s]=!0,this.state.validation[s]=M[s](this.state.value[s]),this.updateUiError(s),this.updateProceedButton()}onChangeSelect(e){let t=e.currentTarget,s=t.name,a=t.value;this.state.value[s]=a,this.state.validation[s]=M[s](a),this.updateProceedButton()}onChangeRadio(e){let t=e.currentTarget,s=t.name,a=t.value;this.state.value[s]=a,this.state.validation[s]=M[s](a),s==="housingType"&&(t.value===fe.SingleFamily&&(this.state.value.housingCost="0",this.state.validation.housingCost=M.housingCost(this.state.value.housingCost),this.render()),this.render()),this.updateProceedButton()}updateUiError(e){this.contexts[e]?.setError(this.state.interact[e]&&!this.state.validation[e])}updateProceedButton(){this.contexts.performApplicationButton?.disabled(!this.state.validation.maritalStatus||!this.state.validation.income||!this.state.validation.employment||!this.state.validation.householdChildren||!this.state.validation.housingCost||!this.state.validation["debtSpecification.cardCredits"]||!this.state.validation["debtSpecification.carLoan"]||!this.state.validation["debtSpecification.collateral"]||!this.state.validation["debtSpecification.leasingFees"]||!this.state.validation["debtSpecification.privateLoan"]||!this.state.validation.housingType)}async onAbort(){d("MAIN","FINANCIAL_CREDIT_SCORING_ABORTED","FINANCIAL_CREDIT_SCORING");let{store:e}=this.props;this.view=1,this.bankidStatusInterval&&clearInterval(this.bankidStatusInterval);let t=e.getState().caseId;t&&(await Ce(t),await Ss(t),le()(e.dispatch)),b(),this.creditAssessmentResponse=void 0,this.render(!0)}bankIdStatus(e,t,s=!1){s||d("MAIN",t===Ie.SameDevice?"FINANCIAL_CREDIT_SCORING_BANKID_STATUS_SAME_DEVICE_REQUESTED":"FINANCIAL_CREDIT_SCORING_BANKID_STATUS_QR_REQUESTED","FINANCIAL_CREDIT_SCORING");let a=this.props.store.getState().order?.paymentOptions.find(n=>n.type===Va.Loan);this.bankidStatusInterval=setInterval(async()=>{try{let n=await Ia(e),l=n.getStatus();if(!this.signed&&l==="signed"&&(d("MAIN",t===Ie.SameDevice?"FINANCIAL_CREDIT_SCORING_BANKID_STATUS_SAME_DEVICE_SUCCEEDED":"FINANCIAL_CREDIT_SCORING_BANKID_STATUS_QR_SUCCEEDED","FINANCIAL_CREDIT_SCORING"),this.signed=!0,this.contexts.bankId?.setTitle(`V\xE4ntar p\xE5 ${a?.name}...`),this.contexts.bankId?.setDescription(`H\xE4mtar uppgifter fr\xE5n ${a?.name}. V\xE4nta kvar det kan ta n\xE5gra sekunder.`),this.contexts.bankId?.setFinalizing(!0),d("MAIN","FINANCIAL_CREDIT_SCORING_SIGNING_SIGNED","FINANCIAL_CREDIT_SCORING")),l==="signingFailed"){clearInterval(this.bankidStatusInterval),this.contexts.bankId?.setFinalizing(!1),this.contexts.bankId?.setErrorMessage("Ett fel uppstod");return}if(n.isScored()?(d("MAIN","FINANCIAL_CREDIT_SCORING_SIGNING_SCORED","FINANCIAL_CREDIT_SCORING"),this.bankidStatusInterval&&clearInterval(this.bankidStatusInterval),this.view=3,this.creditAssessmentResponse=Vo(n),le(e,this.creditAssessmentResponse)(this.props.store.dispatch),b(),this.render()):n.hasScoringError()&&(clearInterval(this.bankidStatusInterval),this.contexts.bankId?.setFinalizing(!1),this.contexts.bankId?.setErrorMessage("Ett fel uppstod")),!this.signed&&t===Ie.QrCode){let c=n.getQrCode();this.contexts.bankId?.update(t,c)}}catch{clearInterval(this.bankidStatusInterval),this.contexts.bankId?.setFinalizing(!1),this.contexts.bankId?.setErrorMessage("Det gick inte att h\xE4mta status kring nuvanrade BankId signering")}},1e3),De("bankidStatusInterval-credit",this.bankidStatusInterval)}async onStartBankIdAuth(e,t=!1){let s=this.props.store.getState().caseId;if(!s)throw"Missing caseID";this.bankidStatusInterval&&clearInterval(this.bankidStatusInterval);try{t||d("MAIN","FINANCIAL_CREDIT_SCORING_BANKID_INIT_REQUESTED","FINANCIAL_CREDIT_SCORING"),this.contexts.bankId?.update(e);let a=await ga({caseId:s,method:e});if(t||d("MAIN","FINANCIAL_CREDIT_SCORING_BANKID_INIT_SUCCEEDED","FINANCIAL_CREDIT_SCORING"),this.bankIdStatus(s,e,t),e===Ie.SameDevice){let n=a.getAutoLaunchUrl();this.contexts.bankId?.update(e,n)}else{let n=a.getQrCode();this.contexts.bankId?.update(e,n)}}catch{d("MAIN","FINANCIAL_CREDIT_SCORING_BANKID_INIT_FAILED","FINANCIAL_CREDIT_SCORING"),this.bankidStatusInterval&&clearInterval(this.bankidStatusInterval),this.bankidError=!0,this.view=1,b(),this.render(!0)}}async startBankId(e){let{store:t}=this.props;this.caseError=void 0,this.bankidError=!1,this.signed=!1;let s=t.getState().caseId;if(this.bankidStatusInterval&&(clearInterval(this.bankidStatusInterval),s&&(await Ce(s),await Ss(s),le()(t.dispatch))),s){let a=await this.newCreditAssessmentCase();le(a)(t.dispatch),this.onStartBankIdAuth(e)}else try{d("MAIN","FINANCIAL_CREDIT_SCORING_CREATE_CASE_REQUESTED","FINANCIAL_CREDIT_SCORING");let a=await this.newCreditAssessmentCase();d("MAIN","FINANCIAL_CREDIT_SCORING_CREATE_CASE_SUCCEEDED","FINANCIAL_CREDIT_SCORING"),a&&(le(a)(t.dispatch),this.onStartBankIdAuth(e))}catch{d("MAIN","FINANCIAL_CREDIT_SCORING_CREATE_CASE_FAILED","FINANCIAL_CREDIT_SCORING")}}async newCreditAssessmentCase(){try{let{store:e,loan:t,paymentLookupResponse:s}=this.props;this.contexts.performApplicationButton?.disabled(!0);let{customer:a}=e.getState(),{monthlyCost:n}=s.costs,{interest:l}=s.interests,c=s.downPaymentSpec.current,m=s.durationSpec.current,u=s.creditAmount,h=s.price,p=s.financialProductCode,y={employment:this.state.value.employment,householdChildren:parseInt(this.state.value.householdChildren,10),housingCost:parseInt(this.state.value.housingCost||"0",10),housingType:this.state.value.housingType,income:parseInt(this.state.value.income||"0",10),maritalStatus:this.state.value.maritalStatus,debtSpecification:{cardCredits:parseInt(this.state.value["debtSpecification.cardCredits"]||"0",10),carLoan:parseInt(this.state.value["debtSpecification.carLoan"]||"0",10),collateral:parseInt(this.state.value["debtSpecification.collateral"]||"0",10),leasingFees:parseInt(this.state.value["debtSpecification.leasingFees"]||"0",10),privateLoan:parseInt(this.state.value["debtSpecification.privateLoan"]||"0",10)}},f={customer:{...a},householdEconomy:y,externalId:t.externalId,loan:{downPayment:c,interestRate:l,credit:u,financialProductId:p,monthlyCost:n,price:h,term:Ua(m)}};return(await fa(f)).caseId}catch(e){this.bankidStatusInterval&&clearInterval(this.bankidStatusInterval),this.caseError=e?.message||"",this.view=1,this.render(!0);return}finally{this.contexts.performApplicationButton?.disabled(!1)}}render(e){let{store:t,paymentLookupResponse:s,onProceed:a}=this.props,n=ye(),{order:l}=t.getState(),c=l?.paymentOptions.find(h=>h.type===Va.Loan),m=s.creditAmount,u=l?.contactInformation?.name;if(this.view===3&&this.creditAssessmentResponse)new Fa(W(),{store:t,creditAssessmentResponse:this.creditAssessmentResponse,onProceed:()=>{b(),a()},onGoBack:()=>this.onAbort()});else if(this.view===2)this.contexts.bankId=new Ke(W(),{method:n?Ie.SameDevice:Ie.QrCode,descriptionQrCode:"F\xF6r att h\xE4mta dina uppgifter, starta din BankID applikation p\xE5 din andra enhet.",descriptionSameDevice:"F\xF6r att h\xE4mta dina uppgifter, starta din BankID-applikation.",onAbort:()=>this.onAbort(),onStart:h=>this.startBankId(h)}),F();else{this.node.innerHTML=`
|
|
736
|
+
`,this.updateBorder(),c&&(this.contexts.error=new ee(this.node,{error:l,errorMessage:c})),this.node.querySelector("select")?.addEventListener("change",u=>m(u))}},je=ws;var Hl="credit-assessment-martial-status",Ga=`${Hl}-node`,Ts="credit-assessment-income",Ns=`${Ts}-node`,Bl="credit-assessment-employment",qa=`${Bl}-node`,Fl="credit-assessment-household-children",Wa=`${Fl}-node`,sn="credit-assessment-housing-cost",Ya=`${sn}-node`,on="credit-assessment-debt-specification-card-credit",Ka=`${on}-node`,an="credit-assessment-debt-specification-car-loan",za=`${an}-node`,nn="credit-assessment-debt-specification-collateral",Qa=`${nn}-node`,rn="credit-assessment-debt-specification-leasing-fees",ja=`${rn}-node`,cn="credit-assessment-debt-specification-private-loan",Ja=`${cn}-node`,Ul="credit-assessment-housing-type",Xa=`${Ul}-node`,ln="credit-assessment-perform-application",As=`${ln}-node`,Za="disclaimer-node",en="disclaimer-safe-node",tn="why-description-node",M={maritalStatus:A.requiredAssessmentMaritalStatus,income:A.requiredNumber,employment:A.requiredAssessmentEmplyment,householdChildren:A.requiredNumber,housingCost:A.requiredNumber,"debtSpecification.cardCredits":A.optionalNumber,"debtSpecification.carLoan":A.optionalNumber,"debtSpecification.collateral":A.optionalNumber,"debtSpecification.leasingFees":A.optionalNumber,"debtSpecification.privateLoan":A.optionalNumber,housingType:A.requiredHousingType},Vl={maritalStatus:Je.Married,income:5e4,employment:re.FullTimeEmployed,householdChildren:0,housingCost:2e3,debtSpecification:{cardCredits:0,carLoan:0,collateral:0,leasingFees:0,privateLoan:0},housingType:J.Apartment},Gl=()=>location.hostname==="localhost"?{...Vl}:void 0,ql=o=>{let i={maritalStatus:o?.maritalStatus||"",income:o?.income.toString()||"",employment:o?.employment.toString()||"",householdChildren:o?.householdChildren.toString()||"",housingCost:o?.housingCost.toString()||"","debtSpecification.cardCredits":o?.debtSpecification.cardCredits.toString()||"","debtSpecification.carLoan":o?.debtSpecification.carLoan.toString()||"","debtSpecification.collateral":o?.debtSpecification.collateral.toString()||"","debtSpecification.leasingFees":o?.debtSpecification.leasingFees.toString()||"","debtSpecification.privateLoan":o?.debtSpecification.privateLoan.toString()||"",housingType:o?.housingType.toString()||""};return{value:i,validation:{maritalStatus:M.maritalStatus(i.maritalStatus),income:M.income(i.income),employment:M.employment(i.employment),householdChildren:M.householdChildren(i.householdChildren),housingCost:M.housingCost(i.housingCost),"debtSpecification.cardCredits":M["debtSpecification.cardCredits"](i["debtSpecification.cardCredits"]),"debtSpecification.carLoan":M["debtSpecification.carLoan"](i["debtSpecification.carLoan"]),"debtSpecification.collateral":M["debtSpecification.collateral"](i["debtSpecification.collateral"]),"debtSpecification.leasingFees":M["debtSpecification.leasingFees"](i["debtSpecification.leasingFees"]),"debtSpecification.privateLoan":M["debtSpecification.privateLoan"](i["debtSpecification.privateLoan"]),housingType:M.housingType(i.housingType)},interact:{maritalStatus:!1,income:!1,employment:!1,householdChildren:!1,housingCost:!1,"debtSpecification.cardCredits":!1,"debtSpecification.carLoan":!1,"debtSpecification.collateral":!1,"debtSpecification.leasingFees":!1,"debtSpecification.privateLoan":!1,housingType:!1}}},Cs=class extends r{constructor(e,t){super(e);this.view=1;this.contexts={};this.bankidError=!1;this.signed=!1;this.props=t,this.state=ql(Gl()),this.render()}onChange(e){let t=e.currentTarget,s=t.name,a=t.value;this.state.value[s]=a,this.state.validation[s]=M[s](a),this.updateUiError(s),this.updateProceedButton()}onBlur(e){let s=e.currentTarget.name;this.state.interact[s]=!0,this.state.validation[s]=M[s](this.state.value[s]),this.updateUiError(s),this.updateProceedButton()}onChangeSelect(e){let t=e.currentTarget,s=t.name,a=t.value;this.state.value[s]=a,this.state.validation[s]=M[s](a),this.updateProceedButton()}onChangeRadio(e){let t=e.currentTarget,s=t.name,a=t.value;this.state.value[s]=a,this.state.validation[s]=M[s](a),s==="housingType"&&(t.value===J.SingleFamily&&(this.state.value.housingCost="0",this.state.validation.housingCost=M.housingCost(this.state.value.housingCost)),this.render()),this.updateProceedButton()}updateUiError(e){this.contexts[e]?.setError(this.state.interact[e]&&!this.state.validation[e])}updateProceedButton(){this.contexts.performApplicationButton?.disabled(!this.state.validation.maritalStatus||!this.state.validation.income||!this.state.validation.employment||!this.state.validation.householdChildren||!this.state.validation.housingCost||!this.state.validation["debtSpecification.cardCredits"]||!this.state.validation["debtSpecification.carLoan"]||!this.state.validation["debtSpecification.collateral"]||!this.state.validation["debtSpecification.leasingFees"]||!this.state.validation["debtSpecification.privateLoan"]||!this.state.validation.housingType)}async onAbort(){d("MAIN","FINANCIAL_CREDIT_SCORING_ABORTED","FINANCIAL_CREDIT_SCORING");let{store:e}=this.props;this.view=1,this.bankidStatusInterval&&clearInterval(this.bankidStatusInterval);let t=e.getState().caseId;t&&(await Ce(t),await Ss(t),de()(e.dispatch)),b(),this.creditAssessmentResponse=void 0,this.render(!0)}bankIdStatus(e,t,s=!1){s||d("MAIN",t===fe.SameDevice?"FINANCIAL_CREDIT_SCORING_BANKID_STATUS_SAME_DEVICE_REQUESTED":"FINANCIAL_CREDIT_SCORING_BANKID_STATUS_QR_REQUESTED","FINANCIAL_CREDIT_SCORING");let a=this.props.store.getState().order?.paymentOptions.find(n=>n.type===Va.Loan);this.bankidStatusInterval=setInterval(async()=>{try{let n=await Ia(e),l=n.getStatus();if(!this.signed&&l==="signed"&&(d("MAIN",t===fe.SameDevice?"FINANCIAL_CREDIT_SCORING_BANKID_STATUS_SAME_DEVICE_SUCCEEDED":"FINANCIAL_CREDIT_SCORING_BANKID_STATUS_QR_SUCCEEDED","FINANCIAL_CREDIT_SCORING"),this.signed=!0,this.contexts.bankId?.setTitle(`V\xE4ntar p\xE5 ${a?.name}...`),this.contexts.bankId?.setDescription(`H\xE4mtar uppgifter fr\xE5n ${a?.name}. V\xE4nta kvar det kan ta n\xE5gra sekunder.`),this.contexts.bankId?.setFinalizing(!0),d("MAIN","FINANCIAL_CREDIT_SCORING_SIGNING_SIGNED","FINANCIAL_CREDIT_SCORING")),l==="signingFailed"){clearInterval(this.bankidStatusInterval),this.contexts.bankId?.setFinalizing(!1),this.contexts.bankId?.setErrorMessage("Ett fel uppstod");return}if(n.isScored()?(d("MAIN","FINANCIAL_CREDIT_SCORING_SIGNING_SCORED","FINANCIAL_CREDIT_SCORING"),this.bankidStatusInterval&&clearInterval(this.bankidStatusInterval),this.view=3,this.creditAssessmentResponse=Vo(n),de(e,this.creditAssessmentResponse)(this.props.store.dispatch),b(),this.render()):n.hasScoringError()&&(clearInterval(this.bankidStatusInterval),this.contexts.bankId?.setFinalizing(!1),this.contexts.bankId?.setErrorMessage("Ett fel uppstod")),!this.signed&&t===fe.QrCode){let c=n.getQrCode();this.contexts.bankId?.update(t,c)}}catch{clearInterval(this.bankidStatusInterval),this.contexts.bankId?.setFinalizing(!1),this.contexts.bankId?.setErrorMessage("Det gick inte att h\xE4mta status kring nuvanrade BankId signering")}},1e3),De("bankidStatusInterval-credit",this.bankidStatusInterval)}async onStartBankIdAuth(e,t=!1){let s=this.props.store.getState().caseId;if(!s)throw"Missing caseID";this.bankidStatusInterval&&clearInterval(this.bankidStatusInterval);try{t||d("MAIN","FINANCIAL_CREDIT_SCORING_BANKID_INIT_REQUESTED","FINANCIAL_CREDIT_SCORING"),this.contexts.bankId?.update(e);let a=await ga({caseId:s,method:e});if(t||d("MAIN","FINANCIAL_CREDIT_SCORING_BANKID_INIT_SUCCEEDED","FINANCIAL_CREDIT_SCORING"),this.bankIdStatus(s,e,t),e===fe.SameDevice){let n=a.getAutoLaunchUrl();this.contexts.bankId?.update(e,n)}else{let n=a.getQrCode();this.contexts.bankId?.update(e,n)}}catch{d("MAIN","FINANCIAL_CREDIT_SCORING_BANKID_INIT_FAILED","FINANCIAL_CREDIT_SCORING"),this.bankidStatusInterval&&clearInterval(this.bankidStatusInterval),this.bankidError=!0,this.view=1,b(),this.render(!0)}}async startBankId(e){let{store:t}=this.props;this.caseError=void 0,this.bankidError=!1,this.signed=!1;let s=t.getState().caseId;if(this.bankidStatusInterval&&(clearInterval(this.bankidStatusInterval),s&&(await Ce(s),await Ss(s),de()(t.dispatch))),s){let a=await this.newCreditAssessmentCase();de(a)(t.dispatch),this.onStartBankIdAuth(e)}else try{d("MAIN","FINANCIAL_CREDIT_SCORING_CREATE_CASE_REQUESTED","FINANCIAL_CREDIT_SCORING");let a=await this.newCreditAssessmentCase();d("MAIN","FINANCIAL_CREDIT_SCORING_CREATE_CASE_SUCCEEDED","FINANCIAL_CREDIT_SCORING"),a&&(de(a)(t.dispatch),this.onStartBankIdAuth(e))}catch{d("MAIN","FINANCIAL_CREDIT_SCORING_CREATE_CASE_FAILED","FINANCIAL_CREDIT_SCORING")}}async newCreditAssessmentCase(){try{let{store:e,loan:t,paymentLookupResponse:s}=this.props;this.contexts.performApplicationButton?.disabled(!0);let{customer:a}=e.getState(),{monthlyCost:n}=s.costs,{interest:l}=s.interests,c=s.downPaymentSpec.current,m=s.durationSpec.current,u=s.creditAmount,h=s.price,p=s.financialProductCode,y={employment:this.state.value.employment,householdChildren:parseInt(this.state.value.householdChildren,10),housingCost:parseInt(this.state.value.housingCost||"0",10),housingType:this.state.value.housingType,income:parseInt(this.state.value.income||"0",10),maritalStatus:this.state.value.maritalStatus,debtSpecification:{cardCredits:parseInt(this.state.value["debtSpecification.cardCredits"]||"0",10),carLoan:parseInt(this.state.value["debtSpecification.carLoan"]||"0",10),collateral:parseInt(this.state.value["debtSpecification.collateral"]||"0",10),leasingFees:parseInt(this.state.value["debtSpecification.leasingFees"]||"0",10),privateLoan:parseInt(this.state.value["debtSpecification.privateLoan"]||"0",10)}},f={customer:{...a},householdEconomy:y,externalId:t.externalId,loan:{downPayment:c,interestRate:l,credit:u,financialProductId:p,monthlyCost:n,price:h,term:Ua(m)}};return(await fa(f)).caseId}catch(e){this.bankidStatusInterval&&clearInterval(this.bankidStatusInterval),this.caseError=e?.message||"",this.view=1,this.render(!0);return}finally{this.contexts.performApplicationButton?.disabled(!1)}}render(e){let{store:t,paymentLookupResponse:s,onProceed:a}=this.props,n=ve(),{order:l}=t.getState(),c=l?.paymentOptions.find(h=>h.type===Va.Loan),m=s.creditAmount,u=l?.contactInformation?.name;if(this.view===3&&this.creditAssessmentResponse)new Fa(W(),{store:t,creditAssessmentResponse:this.creditAssessmentResponse,onProceed:()=>{b(),a()},onGoBack:()=>this.onAbort()});else if(this.view===2)this.contexts.bankId=new Ke(W(),{method:n?fe.SameDevice:fe.QrCode,descriptionQrCode:"F\xF6r att h\xE4mta dina uppgifter, starta din BankID applikation p\xE5 din andra enhet.",descriptionSameDevice:"F\xF6r att h\xE4mta dina uppgifter, starta din BankID-applikation.",onAbort:()=>this.onAbort(),onStart:h=>this.startBankId(h)}),F();else{this.node.innerHTML=`
|
|
737
737
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
738
738
|
<h5 class="waykeecom-heading waykeecom-heading--4">L\xE5neans\xF6kan</h5>
|
|
739
739
|
<div class="waykeecom-content">
|
|
@@ -781,7 +781,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
781
781
|
<div class="waykeecom-stack waykeecom-stack--2" id="${Xa}"></div>
|
|
782
782
|
</div>
|
|
783
783
|
|
|
784
|
-
${this.state.value.housingType!==
|
|
784
|
+
${this.state.value.housingType!==J.SingleFamily?`
|
|
785
785
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
786
786
|
<div class="waykeecom-stack waykeecom-stack--2">
|
|
787
787
|
<h5 class="waykeecom-heading waykeecom-heading--4 waykeecom-no-margin">Boendekostnad</h5>
|
|
@@ -842,17 +842,17 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
842
842
|
<div class="waykeecom-stack waykeecom-stack--1" id="${en}"></div>
|
|
843
843
|
</div>
|
|
844
844
|
</div>
|
|
845
|
-
`,this.contexts.maritalStatus=new Y(this.node.querySelector(`#${Ga}`),{title:"Civilst\xE5nd",checked:this.state.value.maritalStatus,name:"maritalStatus",options:[{id:`maritalStatus-${1}`,value:Je.Married,title:"Gift/partnerskap"},{id:`maritalStatus-${2}`,value:Je.CommonLaw,title:"Sambo"},{id:`maritalStatus-${3}`,value:Je.Single,title:"Ensamst\xE5ende"}],onClick:p=>this.onChangeRadio(p)}),this.contexts.income=new R(this.node.querySelector(`#${Ns}`),{title:"Inkomst per m\xE5nad f\xF6re skatt",value:this.state.value.income,id:Ts,error:this.state.interact.income&&!this.state.validation.income,errorMessage:"Ange din inkomst per \xE5r f\xF6re skatt",name:"income",autocomplete:"off",unit:"kr",placeholder:"",type:"number",onChange:p=>this.onChange(p),onBlur:p=>this.onBlur(p)}),this.contexts.employment=new Y(this.node.querySelector(`#${qa}`),{title:"Syssels\xE4ttning",checked:this.state.value.employment,name:"employment",options:[{id:`employment-${1}`,value:
|
|
845
|
+
`,this.contexts.maritalStatus=new Y(this.node.querySelector(`#${Ga}`),{title:"Civilst\xE5nd",checked:this.state.value.maritalStatus,name:"maritalStatus",options:[{id:`maritalStatus-${1}`,value:Je.Married,title:"Gift/partnerskap"},{id:`maritalStatus-${2}`,value:Je.CommonLaw,title:"Sambo"},{id:`maritalStatus-${3}`,value:Je.Single,title:"Ensamst\xE5ende"}],onClick:p=>this.onChangeRadio(p)}),this.contexts.income=new R(this.node.querySelector(`#${Ns}`),{title:"Inkomst per m\xE5nad f\xF6re skatt",value:this.state.value.income,id:Ts,error:this.state.interact.income&&!this.state.validation.income,errorMessage:"Ange din inkomst per \xE5r f\xF6re skatt",name:"income",autocomplete:"off",unit:"kr",placeholder:"",type:"number",onChange:p=>this.onChange(p),onBlur:p=>this.onBlur(p)}),this.contexts.employment=new Y(this.node.querySelector(`#${qa}`),{title:"Syssels\xE4ttning",checked:this.state.value.employment,name:"employment",options:[{id:`employment-${1}`,value:re.FullTimeEmployed,title:"Fast eller tillsvidareanst\xE4lld"},{id:`employment-${2}`,value:re.TemporarilyEmployed,title:"Visstidsanst\xE4lld"},{id:`employment-${3}`,value:re.SelfEmployed,title:"Egen f\xF6retagare"},{id:`employment-${4}`,value:re.Retired,title:"Pension\xE4r"},{id:`employment-${5}`,value:re.Student,title:"Student"},{id:`employment-${6}`,value:re.Other,title:"Annan"}],onClick:p=>this.onChangeRadio(p)}),this.contexts.housingType=new Y(this.node.querySelector(`#${Xa}`),{title:"Boendeform",checked:this.state.value.housingType,name:"housingType",options:[{id:`housingType-${1}`,value:J.SingleFamily,title:"Villa"},{id:`housingType-${2}`,value:J.Condominium,title:"Bostadsr\xE4tt"},{id:`housingType-${3}`,value:J.Apartment,title:"Hyresr\xE4tt"}],onClick:p=>this.onChangeRadio(p)}),this.contexts.income=new R(this.node.querySelector(`#${Ns}`),{title:"Inkomst per m\xE5nad f\xF6re skatt",value:this.state.value.income,id:Ts,error:this.state.interact.income&&!this.state.validation.income,errorMessage:"Ange din inkomst per \xE5r f\xF6re skatt",name:"income",autocomplete:"off",placeholder:"",unit:"kr",type:"number",information:`
|
|
846
846
|
<div class="waykeecom-content waykeecom-content--inherit-size">
|
|
847
847
|
<p class="waykeecom-content__p"><span class="waykeecom-text waykeecom-text--font-medium">Inkomst per m\xE5nad f\xF6re skatt</span></p>
|
|
848
848
|
<p class="waykeecom-content__p">L\xF6n och/eller pension, inte bidrag eller studiel\xE5n.</p>
|
|
849
849
|
</div>
|
|
850
|
-
`,onChange:p=>this.onChange(p),onBlur:p=>this.onBlur(p)}),this.contexts.householdChildren=new je(this.node.querySelector(`#${Wa}`),{title:"Antal barn under 18 \xE5r",value:this.state.value.householdChildren,name:"householdChildren",options:[{value:"0"},{value:"1"},{value:"2"},{value:"3"},{value:"4"},{value:"5"},{value:"6"},{value:"7"},{value:"8"},{value:"9"},{value:"10",title:"10 eller fler"}],onChange:p=>this.onChangeSelect(p)});let h=this.node.querySelector(`#${Ya}`);h&&(this.contexts.housingCost=new R(h,{title:"Boendekostnad",value:this.state.value.housingCost,id:sn,error:this.state.interact.housingCost&&!this.state.validation.housingCost,errorMessage:"Ange boendekostnader per m\xE5nad",name:"housingCost",autocomplete:"off",placeholder:"",unit:"kr",type:"number",information
|
|
850
|
+
`,onChange:p=>this.onChange(p),onBlur:p=>this.onBlur(p)}),this.contexts.householdChildren=new je(this.node.querySelector(`#${Wa}`),{title:"Antal barn under 18 \xE5r",value:this.state.value.householdChildren,name:"householdChildren",options:[{value:"0"},{value:"1"},{value:"2"},{value:"3"},{value:"4"},{value:"5"},{value:"6"},{value:"7"},{value:"8"},{value:"9"},{value:"10",title:"10 eller fler"}],onChange:p=>this.onChangeSelect(p)});let h=this.node.querySelector(`#${Ya}`);h&&(this.contexts.housingCost=new R(h,{title:this.state.value.housingType===J.Condominium?"Min del av m\xE5nadsavgiften":this.state.value.housingType===J.Apartment?"Min del av m\xE5nadshyran":"Boendekostnad",value:this.state.value.housingCost,id:sn,error:this.state.interact.housingCost&&!this.state.validation.housingCost,errorMessage:"Ange boendekostnader per m\xE5nad",name:"housingCost",autocomplete:"off",placeholder:"",unit:"kr",type:"number",information:this.state.value.housingType===J.Condominium?`
|
|
851
851
|
<div class="waykeecom-content waykeecom-content--inherit-size">
|
|
852
|
-
<p class="waykeecom-content__p"><span class="waykeecom-text waykeecom-text--font-medium">
|
|
852
|
+
<p class="waykeecom-content__p"><span class="waykeecom-text waykeecom-text--font-medium">Min del av m\xE5nadsavgiften</span></p>
|
|
853
853
|
<p class="waykeecom-content__p">Exklusive r\xE4nta och amortering</p>
|
|
854
854
|
</div>
|
|
855
|
-
|
|
855
|
+
`:void 0,onChange:p=>this.onChange(p),onBlur:p=>this.onBlur(p),onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_HOUSEHOLD_DEBT_INFORMATION_TOGGLE","FINANCIAL")}})),this.contexts["debtSpecification.cardCredits"]=new R(this.node.querySelector(`#${Ka}`),{title:"Kortkrediter",value:this.state.value["debtSpecification.cardCredits"],id:on,error:this.state.interact["debtSpecification.cardCredits"]&&!this.state.validation["debtSpecification.cardCredits"],errorMessage:"Ange kortkrediter eller l\xE4mna tomt",name:"debtSpecification.cardCredits",autocomplete:"off",placeholder:"",unit:"kr",type:"number",information:`
|
|
856
856
|
<div class="waykeecom-content waykeecom-content--inherit-size">
|
|
857
857
|
<p class="waykeecom-content__p"><span class="waykeecom-text waykeecom-text--font-medium">Kortkrediter</span></p>
|
|
858
858
|
<p class="waykeecom-content__p">Total skuld</p>
|
|
@@ -877,7 +877,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
877
877
|
<p class="waykeecom-content__p"><span class="waykeecom-text waykeecom-text--font-medium">Privatl\xE5n (ej bol\xE5n)</span></p>
|
|
878
878
|
<p class="waykeecom-content__p">Total skuld, t.ex. blancol\xE5n och sms-l\xE5n</p>
|
|
879
879
|
</div>
|
|
880
|
-
`,onChange:p=>this.onChange(p),onBlur:p=>this.onBlur(p),onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_DEBT_SPECIFICATION_PRIVATE_LOAN_INFORMATION_TOGGLE","FINANCIAL")}}),this.contexts.performApplicationButton=new
|
|
880
|
+
`,onChange:p=>this.onChange(p),onBlur:p=>this.onBlur(p),onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_DEBT_SPECIFICATION_PRIVATE_LOAN_INFORMATION_TOGGLE","FINANCIAL")}}),this.contexts.performApplicationButton=new Ee(this.node.querySelector(`#${As}`),{title:"Genomf\xF6r l\xE5neans\xF6kan",id:ln,disabled:!(this.state.validation.maritalStatus&&this.state.validation.income&&this.state.validation.employment&&this.state.validation.householdChildren&&this.state.validation.housingCost),onClick:()=>{this.view=2,this.render()}}),new Ie(this.node.querySelector(`#${Za}`),{text:`Genom att klicka p\xE5 \u201DGenomf\xF6r l\xE5neans\xF6kan\u201D godk\xE4nner jag att ${c?.name} g\xF6r en kreditupplysning p\xE5 mig baserat p\xE5 informationen ovan och jag bekr\xE4ftar att jag l\xE4st <a href="#" title="" target="_blank" rel="noopener noreferrer" class="waykeecom-link">${c?.name} dataskyddspolicy</a>.`}),new he(this.node.querySelector(`#${en}`),{text:"Dina uppgifter lagras och sparas s\xE4kert."}),new Ye(this.node.querySelector(`#${tn}`),{id:"accordion-why-description",title:`
|
|
881
881
|
<div class="waykeecom-hstack waykeecom-hstack--align-center waykeecom-hstack--spacing-1">
|
|
882
882
|
<div class="waykeecom-hstack__item waykeecom-hstack__item--no-shrink" aria-hidden="true">
|
|
883
883
|
<div class="waykeecom-icon-backdrop waykeecom-icon-backdrop--info-alt">
|
|
@@ -908,7 +908,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
908
908
|
/>
|
|
909
909
|
</svg>
|
|
910
910
|
<div class="waykeecom-pie-chart__overlay">
|
|
911
|
-
<img src="${
|
|
911
|
+
<img src="${ke.illustrations.payment}" alt="Illustration av betalning" class="waykeecom-pie-chart__illustration" />
|
|
912
912
|
</div>
|
|
913
913
|
</div>
|
|
914
914
|
`}},mn=Ds;var bs=class extends r{constructor(e,t){super(e);this.props=t,this.render()}update(e){this.props=e,this.render()}render(){let{downPayment:e,creditAmount:t,downPaymentPercentage:s,creditAmountPercentage:a}=this.props;this.node.innerHTML=`
|
|
@@ -1077,7 +1077,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
1077
1077
|
<button type="button" title="\xC4ndra finansiering" class="waykeecom-link">\xC4ndra</button>
|
|
1078
1078
|
</div>
|
|
1079
1079
|
</div>
|
|
1080
|
-
`,x&&new
|
|
1080
|
+
`,x&&new oe(this.node.querySelector(`#${Ln}`),{store:e,decision:x})}else this.node.innerHTML=`
|
|
1081
1081
|
<div class="waykeecom-stack waykeecom-stack--1">
|
|
1082
1082
|
<ul class="waykeecom-key-value-list">
|
|
1083
1083
|
${E({key:"Finansiering",value:t===Rn.Cash?"Kontant":"Privatleasing"})}
|
|
@@ -1092,7 +1092,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
1092
1092
|
`:""}
|
|
1093
1093
|
`;n&&this.node.querySelector("button")?.addEventListener("click",()=>n())}},On=Ps;var Hn="button-financial-proceed",Mn=`${Hn}-node`,jl="financial-option",xn=`${jl}-node`,Jl="financial-option-second",Pn=`${Jl}-node`,Xl="radio-financial-cash",Zl="radio-financial-loan",ed="radio-financial-lease",$n="payment-node",$s=class extends r{constructor(e,t){super(e);this.props=t,g(this.props.store,"navigation",()=>{let n=this.props.store.getState();this.paymentType=n.paymentType,this.render()});let s=this.props.store.getState(),{paymentType:a}=s;this.paymentType=a,this.render()}onChange(e){let s=e.currentTarget.value;switch(this.paymentType=s,this.render(!0),this.paymentType){case $.Cash:d("MAIN","FINANCIAL_CASH_SELECTED","FINANCIAL");break;case $.Lease:d("MAIN","FINANCIAL_LEASE_SELECTED","FINANCIAL");case $.Loan:d("MAIN","FINANCIAL_LOAN_SELECTED","FINANCIAL");default:break}}onProceed(){if(this.paymentType){switch(this.paymentType){case $.Cash:d("MAIN","FINANCIAL_CASH_SET","FINANCIAL");break;case $.Lease:d("MAIN","FINANCIAL_LEASE_SET","FINANCIAL");case $.Loan:d("MAIN","FINANCIAL_LOAN_SET","FINANCIAL");default:break}Jo(this.paymentType,this.props.lastStage)(this.props.store.dispatch)}}onEdit(){d("MAIN","FINANCIAL_EDIT","FINANCIAL"),L("main",this.props.index)(this.props.store.dispatch)}render(e){let t=this.props.store.getState(),{id:s,order:a,paymentLookupResponse:n}=t;if(!a)throw"No order available";let l=a.paymentOptions,c=t.topNavigation.stage>this.props.index,m=O(this.node,{completed:c,title:"\xC4gandeform",active:t.navigation.stage===this.props.index,id:"financial"}),u=document.createElement("div");if((t.navigation.stage>this.props.index||c&&t.navigation.stage!==this.props.index)&&this.paymentType){let h=l.find(p=>p.type===$.Loan);new On(m,{store:this.props.store,loan:h,paymentType:this.paymentType,paymentLookupResponse:n||h?.loanDetails,onEdit:t.createdOrderId?void 0:()=>this.onEdit()})}else if(t.navigation.stage===this.props.index){let h=t.order?.orderVehicle,p=l.find(P=>P.type===$.Cash),y=l.find(P=>P.type===$.Loan),f=l.find(P=>P.type===$.Lease);u.innerHTML=`
|
|
1094
1094
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1095
|
-
<h4 class="waykeecom-heading waykeecom-heading--4 waykeecom-no-margin">Hur vill du finansiera din ${h?.title} ${
|
|
1095
|
+
<h4 class="waykeecom-heading waykeecom-heading--4 waykeecom-no-margin">Hur vill du finansiera din ${h?.title} ${me(h)}?</h4>
|
|
1096
1096
|
</div>
|
|
1097
1097
|
|
|
1098
1098
|
${p||y?`<div class="waykeecom-stack waykeecom-stack--3" id="${xn}"></div>`:""}
|
|
@@ -1119,7 +1119,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
1119
1119
|
<li class="waykeecom-content__li">
|
|
1120
1120
|
<div>
|
|
1121
1121
|
<span class="waykeecom-text waykeecom-text--valign-middle">L\xE5neans\xF6kan online med BankID </span>
|
|
1122
|
-
<img src="${
|
|
1122
|
+
<img src="${ke.bankid}" alt="BankID logotyp" class="waykeecom-image waykeecom-image--inline" aria-hidden="true" />
|
|
1123
1123
|
<span class="waykeecom-text waykeecom-text--valign-middle"> \u2013 svar direkt!</span>
|
|
1124
1124
|
</div>
|
|
1125
1125
|
</li>
|
|
@@ -1230,7 +1230,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
1230
1230
|
<div class="waykeecom-stack waykeecom-stack--1" id="${Vs}"></div>
|
|
1231
1231
|
<div class="waykeecom-stack waykeecom-stack--1" id="${qn}"></div>
|
|
1232
1232
|
</div>
|
|
1233
|
-
`,new
|
|
1233
|
+
`,new ne(this.node.querySelector(`#${Us}`),{title:"Tillbaka",onClick:()=>s()}),u?.length){let p=this.node.querySelector(`#${Wn}`);u.forEach(y=>{let f=new Gn(p);this.contexts.checkboxes[y.name]=new Xe(f.render(),{id:y.name,name:y.name,title:y.title,meta:`<div class="waykeecom-text waykeecom-text--font-bold">${k(y.monthlyPrice,{postfix:"kr/m\xE5n"})}</div>`,description:`<div class="waykeecom-text waykeecom-text--tone-alt">${y.description}</div>`,append:!0,value:y.name,checked:this.addons.findIndex(_=>_.name===y.name)>-1,onClick:_=>this.onClick(_)})})}if(m?.length){let p=this.node.querySelector(`#${Yn}`);m.forEach(y=>new Ye(p,{id:y.name,title:y.name,description:y.description,append:!0}))}new ne(this.node.querySelector(`#${Us}`),{title:"Tillbaka",onClick:()=>s()}),new Z(this.node.querySelector(`#${qn}`),{title:"Tillbaka",onClick:()=>s()}),t?this.contexts.updateButton=new Vn(this.node.querySelector(`#${Vs}`),{title:t?"Uppdatera":"V\xE4lj",disabled:t?!h:void 0,onClick:()=>this.onUpdate()}):this.contexts.updateButton=new X(this.node.querySelector(`#${Vs}`),{selected:!1,fullSize:!0,disabled:t?!h:void 0,onClick:()=>this.onUpdate()}),F()}},Kn=ge;var Gs=class extends r{constructor(e,t){super(e);this.displayInfo=!1;this.props=t,g(this.props.store,"insurance",()=>{this.render()}),this.render()}onInfoOpen(){d("MAIN","INSURANCE_INFORMATION_TOGGLE","INSURANCE_IF"),this.displayInfo=!0,this.render()}onInfoClose(){d("MAIN","INSURANCE_INFORMATION_TOGGLE","INSURANCE_IF"),this.displayInfo=!1,b(),this.render(),this.node.parentElement?.scrollIntoView()}onClick(){let{insurance:e}=this.props.store.getState();!e||e&&this.props.insurance.name!==e.name?d("MAIN","INSURANCE_SELECTED","INSURANCE_IF"):d("MAIN","INSURANCE_UNSELECTED","INSURANCE_IF"),le(this.props.insurance)(this.props.store.dispatch)}render(){let{store:e,insurance:t,key:s}=this.props,a=e.getState(),n=a.order?.insuranceOption?.logo,l=a.insuranceAddOns?.insurance===t.name?a.insuranceAddOns.addOns.map(m=>({key:m?.title,value:k(m?.monthlyPrice,{postfix:"kr/m\xE5n"})})):void 0,c=a.insurance?JSON.stringify(a.insurance).localeCompare(JSON.stringify(t))===0:!1;this.displayInfo&&new Kn(W(),{store:this.props.store,insurance:t,selected:c,onClose:()=>this.onInfoClose()}),new ue(this.node,{logo:n,selected:c,id:s,title:t.name,description:t.description,price:k(t.price,{postfix:"kr/m\xE5n"}),priceDetails:l,onClick:()=>this.onClick(),onInfo:()=>this.onInfoOpen()},s)}},zn=Gs;var qs=class extends r{constructor(e,t){super(e);this.props=t,this.render()}render(){let{store:e,insurances:t}=this.props,s=new pe(this.node,{id:"insurance-list",onClick:()=>d("MAIN","INSURANCE_ARROW","INSURANCE_IF")}),{overflowElement:a}=s;a&&(a.innerHTML="",t.forEach((n,l)=>new zn(a,{store:e,insurance:n,key:`insurance-${l}`})))}},Qn=qs;var Ws="insurance-grid-list-node",td="button-insurances-proceed",jn=`${Ws}-node`,er="button-insurances-skip",Jn=`${er}-node`,tr="button-insurance-edit-driving-distance",Xn=`${tr}-node`,Zn={},Ys=class extends r{constructor(e,t){super(e);this.requestError=!1;this.contexts={listners:[]};this.props=t;let s=g(this.props.store,"drivingDistance",()=>{this.fetchInsurance()});this.contexts.listners.push(s);let a=g(this.props.store,"customer.socialId",()=>{this.fetchInsurance()});this.contexts.listners.push(a);let n=g(this.props.store,"insurance",()=>{this.contexts.buttonProceed?.disabled(!this.props.store.getState().insurance)});this.contexts.listners.push(n),this.fetchInsurance(),this.render()}fetchInsurance(){this.props.store.getState().customer.socialId&&this.getInsurances()}async getInsurances(){let e=this.props.store.getState();this.requestError=!1,this.render();let t=`${e.customer.socialId}-${e.id}-${e.drivingDistance}`,s=Zn[t];if(d("MAIN","INSURANCE_GET_INSURANCES_REQUESTED","INSURANCE_IF"),s){this.insurances=s,d("MAIN","INSURANCE_GET_INSURANCES_SUCCEEDED","INSURANCE_IF"),this.render();return}try{let a=await Un(this.props.store,e.drivingDistance);d("MAIN","INSURANCE_GET_INSURANCES_SUCCEEDED","INSURANCE_IF"),this.insurances=a.getInsuranceOptions(),Zn[t]=this.insurances}catch{d("MAIN","INSURANCE_GET_INSURANCES_FAILED","INSURANCE_IF"),this.requestError=!0}finally{this.render()}}onEditDrivingDistance(){this.contexts.listners.forEach(e=>e?.()),this.props.onEdit()}onProceed(){j(this.props.lastStage)(this.props.store.dispatch)}onSkipInsurances(){d("MAIN","INSURANCE_SKIPPED","INSURANCE_IF"),le()(this.props.store.dispatch),j(this.props.lastStage)(this.props.store.dispatch)}render(){let{store:e}=this.props,t=e.getState(),{insurance:s,drivingDistance:a}=t;this.node.innerHTML=`
|
|
1234
1234
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1235
1235
|
<h4 class="waykeecom-heading waykeecom-heading--4">Vill du teckna en f\xF6rs\xE4kring p\xE5 din nya bil?</h4>
|
|
1236
1236
|
<div class="waykeecom-content">
|
|
@@ -1270,7 +1270,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
1270
1270
|
<div class="waykeecom-stack waykeecom-stack--1" id="${rr}"></div>
|
|
1271
1271
|
<div class="waykeecom-stack waykeecom-stack--1" id="${nr}"></div>
|
|
1272
1272
|
</div>
|
|
1273
|
-
`,new je(this.node.querySelector(`#${or}`),{id:cr,title:"Visa f\xF6rs\xE4kringar",name:"distance",value:a.drivingDistance,options:[{value:H.Between0And1000,title:Q[H.Between0And1000]},{value:H.Between1000And1500,title:Q[H.Between1000And1500]},{value:H.Between1500And2000,title:Q[H.Between1500And2000]},{value:H.Between2000And2500,title:Q[H.Between2000And2500]},{value:H.Over2500,title:Q[H.Over2500]}],onChange:c=>this.onChangeDistance(c)}),new S(this.node.querySelector(`#${ar}`),{id:zs,title:"Visa f\xF6rs\xE4kringar",onClick:()=>this.onShowInsurances()});let l=this.node.querySelector(`#${ir}`);l&&(l.innerHTML=I({tone:"info",children:`Vi \xE4r anknutna f\xF6rs\xE4kringsf\xF6rmedlare till ${n}, If Skadef\xF6rs\xE4kring. F\xF6rs\xE4kringsgivare \xE4r If Skadef\xF6rs\xE4kring (publ). Vad detta inneb\xE4r kan du l\xE4sa mer om p\xE5 f\xF6rs\xE4kringsf\xF6rmedlarens hemsida.`})),new
|
|
1273
|
+
`,new je(this.node.querySelector(`#${or}`),{id:cr,title:"Visa f\xF6rs\xE4kringar",name:"distance",value:a.drivingDistance,options:[{value:H.Between0And1000,title:Q[H.Between0And1000]},{value:H.Between1000And1500,title:Q[H.Between1000And1500]},{value:H.Between1500And2000,title:Q[H.Between1500And2000]},{value:H.Between2000And2500,title:Q[H.Between2000And2500]},{value:H.Over2500,title:Q[H.Over2500]}],onChange:c=>this.onChangeDistance(c)}),new S(this.node.querySelector(`#${ar}`),{id:zs,title:"Visa f\xF6rs\xE4kringar",onClick:()=>this.onShowInsurances()});let l=this.node.querySelector(`#${ir}`);l&&(l.innerHTML=I({tone:"info",children:`Vi \xE4r anknutna f\xF6rs\xE4kringsf\xF6rmedlare till ${n}, If Skadef\xF6rs\xE4kring. F\xF6rs\xE4kringsgivare \xE4r If Skadef\xF6rs\xE4kring (publ). Vad detta inneb\xE4r kan du l\xE4sa mer om p\xE5 f\xF6rs\xE4kringsf\xF6rmedlarens hemsida.`})),new Ie(this.node.querySelector(`#${nr}`),{text:`Genom att du klickar p\xE5 Visa f\xF6rs\xE4kringar s\xE5 godk\xE4nner du att vi skickar dina uppgifter vidare till ${n} f\xF6r att de ska kunna ge dig ett pris p\xE5 f\xF6rs\xE4kring. Hur de hanterar dina personuppgifter kan du l\xE4sa om p\xE5 deras hemsida.`}),new q(this.node.querySelector(`#${rr}`),{id:lr,title:"Hoppa \xF6ver detta steg",onClick:()=>s()})}}},dr=Ks;var mr="insurance-button-top-left-node",pr="insurance-button-bottom-left-node",ur="insurance-add-remove-node",Qs=class extends r{constructor(e,t){super(e);this.props=t,this.render()}render(){let{freeInsurance:e,selected:t,onClose:s,onClick:a}=this.props,{title:n,description:l,logo:c,longDescription:m}=e;this.node.innerHTML=`
|
|
1274
1274
|
<div class="waykeecom-nav-banner" id="${mr}"></div>
|
|
1275
1275
|
|
|
1276
1276
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
@@ -1304,7 +1304,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
1304
1304
|
<div class="waykeecom-stack waykeecom-stack--1" id="${ur}"></div>
|
|
1305
1305
|
<div class="waykeecom-stack waykeecom-stack--1" id="${pr}"></div>
|
|
1306
1306
|
</div>
|
|
1307
|
-
`,new
|
|
1307
|
+
`,new ne(this.node.querySelector(`#${mr}`),{title:"Tillbaka",onClick:()=>s()}),new Z(this.node.querySelector(`#${pr}`),{title:"Tillbaka",onClick:()=>s()}),new X(this.node.querySelector(`#${ur}`),{selected:t,fullSize:!0,onClick:()=>a()}),F()}},hr=Qs;var js=class extends r{constructor(e,t){super(e);this.displayInfo=!1;this.props=t,g(this.props.store,"freeInsurance",()=>{this.render()}),this.render()}onInfoOpen(){d("MAIN","INSURANCE_INFORMATION_TOGGLE","INSURANCE"),this.displayInfo=!0,this.render()}onInfoClose(){d("MAIN","INSURANCE_INFORMATION_TOGGLE","INSURANCE"),this.displayInfo=!1,b(),this.render(),this.node.parentElement?.scrollIntoView()}onClick(){let{freeInsurance:e}=this.props.store.getState();e&&this.props.freeInsurance!==e?d("MAIN","INSURANCE_SELECTED","INSURANCE"):d("MAIN","INSURANCE_UNSELECTED","INSURANCE"),ti(this.props.freeInsurance)(this.props.store.dispatch)}render(){let{store:e,freeInsurance:t,key:s}=this.props,a=e.getState(),n=a.order?.insuranceOption?.logo,l=a.freeInsurance?JSON.stringify(a.freeInsurance).localeCompare(JSON.stringify(this.props.freeInsurance))===0:!1;this.displayInfo&&new hr(W(),{freeInsurance:t,selected:l,onClick:()=>{this.onInfoClose(),this.onClick()},onClose:()=>this.onInfoClose()}),new ue(this.node,{logo:n,id:s,title:t.title,description:t.description,price:"Gratis",selected:l,onClick:()=>this.onClick(),onInfo:()=>this.onInfoOpen()},s)}},kr=js;var Js=class extends r{constructor(e,t){super(e);this.props=t,this.render()}render(){let{store:e,insurances:t}=this.props,s=new pe(this.node,{id:"insurance-list",onClick:()=>d("MAIN","INSURANCE_ARROW","INSURANCE")}),{overflowElement:a}=s;a&&(a.innerHTML="",t.forEach((n,l)=>new kr(a,{store:e,freeInsurance:n,key:`insurance-${l}`})))}},yr=Js;var Xs="insurance-grid-list-node",sd="button-insurances-proceed",vr=`${Xs}-node`,od="button-insurances-skip",id=`${od}-node`,Zs=class extends r{constructor(e,t){super(e);this.props=t,this.render()}onProceed(){let{freeInsurance:e}=this.props.store.getState();j(this.props.lastStage)(this.props.store.dispatch),d("MAIN",e?"INSURANCE_SET":"INSURANCE_SKIPPED","INSURANCE")}render(){let{store:e,insurance:t}=this.props;this.node.innerHTML=`
|
|
1308
1308
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1309
1309
|
<h4 class="waykeecom-heading waykeecom-heading--4">Vill du teckna en f\xF6rs\xE4kring p\xE5 din nya bil?</h4>
|
|
1310
1310
|
<div class="waykeecom-content">
|
|
@@ -1316,7 +1316,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
1316
1316
|
<div class="waykeecom-stack waykeecom-stack--1" id="${vr}"></div>
|
|
1317
1317
|
<div class="waykeecom-stack waykeecom-stack--1" id="${id}"></div>
|
|
1318
1318
|
</div>
|
|
1319
|
-
`,new yr(this.node.querySelector(`#${Xs}`),{store:e,insurances:[t]}),new S(this.node.querySelector(`#${vr}`),{id:sd,title:"G\xE5 vidare",onClick:()=>this.onProceed()})}},Er=Zs;var eo=class extends r{constructor(e,t){super(e);this.props=t,g(this.props.store,"navigation",()=>{this.render()}),this.render()}getStep(){let{order:e}=this.props.store.getState();return e?.insuranceOption?.institute==="IF"?"INSURANCE_IF":"INSURANCE"}onSkipInsurances(){
|
|
1319
|
+
`,new yr(this.node.querySelector(`#${Xs}`),{store:e,insurances:[t]}),new S(this.node.querySelector(`#${vr}`),{id:sd,title:"G\xE5 vidare",onClick:()=>this.onProceed()})}},Er=Zs;var eo=class extends r{constructor(e,t){super(e);this.props=t,g(this.props.store,"navigation",()=>{this.render()}),this.render()}getStep(){let{order:e}=this.props.store.getState();return e?.insuranceOption?.institute==="IF"?"INSURANCE_IF":"INSURANCE"}onSkipInsurances(){le()(this.props.store.dispatch),j(this.props.lastStage)(this.props.store.dispatch),d("MAIN","INSURANCE_SKIPPED",this.getStep())}onEdit(){d("MAIN","INSURANCE_EDIT",this.getStep()),L("main",this.props.index)(this.props.store.dispatch)}render(){let{store:e,index:t,lastStage:s}=this.props,a=e.getState(),n=a.topNavigation.stage>t,l=a.navigation.stage===t;l&&d("MAIN","INSURANCE_ACTIVE",this.getStep());let c=O(this.node,{completed:n,title:"F\xF6rs\xE4kring",active:l,id:"insurance"});if(a.navigation.stage>t||n&&a.navigation.stage!==t){let m=[];a.insurance?(m.push({key:"Uppskattad k\xF6rstr\xE4cka",value:Q[a.drivingDistance]}),m.push({key:a.insurance.name,value:k(a.insurance.price,{postfix:"kr/m\xE5n"})}),a.insuranceAddOns?.insurance===a.insurance.name&&a.insuranceAddOns.addOns.forEach(u=>m.push({key:u.title,value:k(u.monthlyPrice,{postfix:"kr/m\xE5n"})}))):a.freeInsurance?m.push({key:"F\xF6rs\xE4kring",value:a.freeInsurance.title}):m.push({key:"F\xF6rs\xE4kring",value:"Ingen"}),new z(c,{keyValueList:m,changeButtonTitle:"\xC4ndra f\xF6rs\xE4kring",onEdit:a.createdOrderId?void 0:()=>this.onEdit()})}else if(a.navigation.stage===t){let m=a.order?.insuranceOption;if(!m)throw"Missing insurance";switch(m?.institute){case"IF":new dr(c,{store:e,lastStage:s,onSkip:()=>this.onSkipInsurances()});break;default:new Er(c,{store:e,lastStage:s,insurance:m});break}}a.navigation.stage===t&&c.parentElement?.scrollIntoView()}},Ir=eo;import{vehicles as fr}from"@wayke-se/ecom";var gr=o=>{let i=fr.newLookupRequest().withRegistrationNumber(o.registrationNumber).withMileage(parseInt(o.mileage,10)).withCondition(o.condition);return fr.lookupVehicle(i.build())};var to=class extends r{constructor(e,t){super(e);this.contexts={};this.props=t,this.render()}setError(e){this.contexts.error?.setError(e)}render(){let{title:e,value:t,name:s,id:a,error:n,errorMessage:l,placeholder:c,information:m,autocomplete:u,onChange:h,onBlur:p}=this.props;this.node.innerHTML=`
|
|
1320
1320
|
<div class="waykeecom-input-label">
|
|
1321
1321
|
<label for="${a}" class="waykeecom-input-label__label">${e}</label>
|
|
1322
1322
|
</div>
|
|
@@ -1327,7 +1327,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
1327
1327
|
${c?`placeholder="${c}"`:""}
|
|
1328
1328
|
class="waykeecom-textarea"
|
|
1329
1329
|
>${t}</textarea>
|
|
1330
|
-
`,l&&(this.contexts.error=new
|
|
1330
|
+
`,l&&(this.contexts.error=new ee(this.node,{error:n,errorMessage:l})),m&&new te(this.node.querySelector(".waykeecom-input-label"),{information:m});let y=this.node.querySelector("textarea");y&&(h&&y.addEventListener("input",h),p&&y.addEventListener("blur",p))}},_r=to;var br="trade-in-registrationNumber",Sr=`${br}-node`,Rr="trade-in-mileage",wr=`${Rr}-node`,Lr="trade-in-description",Nr=`${Lr}-node`,ad="trade-in-condition",Ar=`${ad}-node`,Or="trade-in-fetch",Tr=`${Or}-node`,nd="trade-in-proceed",Cr=`${nd}-node`,so="button-trade-in-no",Ze=`${so}-node`,Mr="button-trade-in-change",Dr=`${Mr}-node`,ce={registrationNumber:A.requiredRegistrationNumber,mileage:A.requiredMileage,description:A.optionalString,condition:A.requiredCondition},rd=[{id:`radio-${"VeryGood"}`,value:"VeryGood",title:"Mycket bra skick",description:`
|
|
1331
1331
|
<div class="waykeecom-box">
|
|
1332
1332
|
<div class="waykeecom-content waykeecom-content--inherit-size">
|
|
1333
1333
|
<ul class="waykeecom-content__ul">
|
|
@@ -1354,7 +1354,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
1354
1354
|
<li class="waykeecom-content__li">D\xE4ck som beh\xF6ver bytas (m\xF6nsterdjup under 3 mm)</li>
|
|
1355
1355
|
</ul>
|
|
1356
1356
|
</div>
|
|
1357
|
-
</div>`}],cd=o=>{let i={registrationNumber:o?.registrationNumber||"",mileage:o?.mileage||"",description:o?.description||"",condition:o?.condition};return{value:i,validation:{registrationNumber:
|
|
1357
|
+
</div>`}],cd=o=>{let i={registrationNumber:o?.registrationNumber||"",mileage:o?.mileage||"",description:o?.description||"",condition:o?.condition};return{value:i,validation:{registrationNumber:ce.registrationNumber(i.registrationNumber),mileage:ce.mileage(i.mileage),description:ce.description(i.description),condition:ce.condition(i.condition)},interact:{registrationNumber:!1,mileage:!1,description:!1,condition:!1}}},oo=class extends r{constructor(e,t){super(e);this.contexts={};this.requestError=!1;this.props=t;let s=this.props.store.getState();this.state=cd(s.tradeIn),this.render()}async onFetchVehicle(){this.requestError=!1,this.render();try{if(d("MAIN","TRADE_IN_VALUATION_REQUESTED","TRADE_IN_DETAILS"),this.contexts.buttonFetch?.loading(!0),this.state.validation.registrationNumber&&this.state.validation.mileage&&this.state.validation.description&&this.state.validation.condition){let e=this.state.value,t=await gr(e),s=Go(t);this.response=s,this.render(),d("MAIN","TRADE_IN_VALUATION_SUCCEEDED","TRADE_IN_DETAILS")}}catch{this.requestError=!0,this.render(),d("MAIN","TRADE_IN_VALUATION_FAILED","TRADE_IN_DETAILS")}finally{this.contexts.buttonFetch?.loading(!1)}}onEdit(){this.response=void 0,this.render(),d("MAIN","TRADE_IN_SKIPPED","TRADE_IN_DETAILS")}onProceed(){if(this.response){let e=this.response.vehicle,t=this.state.value;Se(this.props.lastStage,t,e)(this.props.store.dispatch),d("MAIN","TRADE_IN_SET","TRADE_IN_DETAILS")}}onChangeRadio(e){let t=e.currentTarget,s=t.name,a=t.value;switch(this.state.value[s]=a,this.state.validation[s]=ce[s](a),this.updateProceedButton(),a){case"VeryGood":d("MAIN","TRADE_IN_CONDITION_VERY_GOOD_SELECTED","TRADE_IN_DETAILS");break;case"Good":d("MAIN","TRADE_IN_CONDITION_GOOD_SELECTED","TRADE_IN_DETAILS");break;case"Ok":d("MAIN","TRADE_IN_CONDITION_OK_SELECTED","TRADE_IN_DETAILS");break;default:break}}onChange(e){let t=e.currentTarget,s=t.name;s==="registrationNumber"&&(t.value=t.value.toUpperCase());let a=t.value;this.state.value[s]=a,this.state.validation[s]=ce[s](a),this.updateUiError(s),this.updateProceedButton()}onBlur(e){let s=e.currentTarget.name;this.state.interact[s]=!0,this.state.validation[s]=ce[s](this.state.value[s]),this.updateUiError(s),this.updateProceedButton()}updateUiError(e){this.contexts[e]?.setError(this.state.interact[e]&&!this.state.validation[e])}updateProceedButton(){this.contexts.buttonFetch?.disabled(!(this.state.validation.registrationNumber&&this.state.validation.mileage&&this.state.validation.description&&this.state.validation.condition))}onNoTradeIn(){Se(this.props.lastStage)(this.props.store.dispatch),d("MAIN","TRADE_IN_SELECTED","TRADE_IN_DETAILS")}render(){if(this.response){let e=[],t=this.response.vehicle;e.push({key:"Miltal",value:`${this.state.value.mileage} mil`}),this.state.value.description&&e.push({key:"Beskrivning",value:`${this.state.value.description}`}),this.state.value.condition&&e.push({key:"Bilens skick",value:ye[this.state.value.condition]}),this.node.innerHTML=`
|
|
1358
1358
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1359
1359
|
<div class="waykeecom-balloon">
|
|
1360
1360
|
<div class="waykeecom-stack waykeecom-stack--05">
|
|
@@ -1417,7 +1417,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
1417
1417
|
<circle cx="11" cy="10" r="5.5" stroke="#FFF500" stroke-linejoin="round" stroke-dasharray="1 2"/>
|
|
1418
1418
|
<path d="M10.6707 21.692c1.392 0 2.04.564 2.28.996h1.644c-.264-1.08-1.248-2.364-3.924-2.364-2.028 0-3.408.912-3.408 2.436 0 1.536 1.2 2.34 2.904 2.508l1.512.156c.876.108 1.476.372 1.476 1.188 0 .684-.684 1.176-1.98 1.176-1.56 0-2.244-.72-2.472-1.26h-1.716c.336 1.224 1.404 2.628 4.188 2.628 2.412 0 3.624-1.116 3.624-2.652 0-1.8-1.308-2.448-3.012-2.616-.576-.06-.972-.108-1.5-.156-.888-.108-1.392-.444-1.392-1.02 0-.624.612-1.02 1.776-1.02Z" fill="#fff"/>
|
|
1419
1419
|
</svg>
|
|
1420
|
-
`,onChange:e=>this.onChange(e),onBlur:e=>this.onBlur(e)}),this.contexts.mileage=new R(this.node.querySelector(`#${wr}`),{title:"Miltal",value:this.state.value.mileage,id:Rr,error:this.state.interact.mileage&&!this.state.validation.mileage,errorMessage:"Ett miltal mellan 0 till 80 000 mil m\xE5ste anges",name:"mileage",autocomplete:"off",placeholder:"Ange bilens miltal",unit:"mil",pattern:"[0-9]*",inputmode:"numeric",onChange:e=>this.onChange(e),onBlur:e=>this.onBlur(e)}),this.contexts.description=new _r(this.node.querySelector(`#${Nr}`),{title:"Beskrivning (valfritt)",value:this.state.value.description,id:Lr,error:this.state.interact.description&&!this.state.validation.description,errorMessage:"????",name:"description",autocomplete:"off",placeholder:"Beskriv bilen",onChange:e=>this.onChange(e),onBlur:e=>this.onBlur(e)}),new Y(this.node.querySelector(`#${Ar}`),{title:"Bilens skick",checked:this.state.value.condition,name:"condition",options:rd,onClick:e=>this.onChangeRadio(e)}),this.contexts.buttonFetch=new S(this.node.querySelector(`#${Tr}`),{title:"H\xE4mta uppskattat v\xE4rde",id:Or,disabled:!(this.state.validation.registrationNumber&&this.state.validation.mileage&&this.state.validation.condition),onClick:()=>this.onFetchVehicle()}),new q(this.node.querySelector(`#${Ze}`),{id:so,title:"Hoppa \xF6ver detta steg",onClick:()=>this.onNoTradeIn()})}},xr=oo;var Hr="button-trade-in-yes",Pr=`${Hr}-node`,Br="button-trade-in-no",$r=`${Br}-node`,ao="button-trade-in-change",io=`${ao}-node`,no=class extends r{constructor(e,t){super(e);this.props=t,g(this.props.store,"navigation",()=>{this.render()}),this.render()}onEdit(){d("MAIN","TRADE_IN_EDIT","TRADE_IN"),L("main",this.props.index)(this.props.store.dispatch)}onYesTradeIn(){d("MAIN","TRADE_IN_SELECTED","TRADE_IN"),jo(this.props.lastStage)(this.props.store.dispatch)}onNoTradeIn(){d("MAIN","TRADE_IN_SKIPPED","TRADE_IN"),Se(this.props.lastStage)(this.props.store.dispatch)}render(){let{store:e,index:t,lastStage:s}=this.props,a=this.props.store.getState();if(!a.order?.allowsTradeIn)return;let n=a.topNavigation.stage>t,l=a.navigation.stage===t;l&&d("MAIN","TRADE_IN_ACTIVE",a.navigation.subStage===1?"TRADE_IN":"TRADE_IN_DETAILS");let c=O(this.node,{title:"Inbytesbil",active:l,completed:n,id:"trade-in"});c.innerHTML="";let m=document.createElement("div");if(a.navigation.stage>t||n&&a.navigation.stage!==t){let u=[];a.tradeIn&&a.tradeInVehicle?(u.push({key:"Miltal",value:`${a.tradeIn.mileage} mil`}),a.tradeIn.description&&u.push({key:"Beskrivning",value:`${a.tradeIn.description}`}),a.tradeIn.condition&&u.push({key:"Bilens skick",value:
|
|
1420
|
+
`,onChange:e=>this.onChange(e),onBlur:e=>this.onBlur(e)}),this.contexts.mileage=new R(this.node.querySelector(`#${wr}`),{title:"Miltal",value:this.state.value.mileage,id:Rr,error:this.state.interact.mileage&&!this.state.validation.mileage,errorMessage:"Ett miltal mellan 0 till 80 000 mil m\xE5ste anges",name:"mileage",autocomplete:"off",placeholder:"Ange bilens miltal",unit:"mil",pattern:"[0-9]*",inputmode:"numeric",onChange:e=>this.onChange(e),onBlur:e=>this.onBlur(e)}),this.contexts.description=new _r(this.node.querySelector(`#${Nr}`),{title:"Beskrivning (valfritt)",value:this.state.value.description,id:Lr,error:this.state.interact.description&&!this.state.validation.description,errorMessage:"????",name:"description",autocomplete:"off",placeholder:"Beskriv bilen",onChange:e=>this.onChange(e),onBlur:e=>this.onBlur(e)}),new Y(this.node.querySelector(`#${Ar}`),{title:"Bilens skick",checked:this.state.value.condition,name:"condition",options:rd,onClick:e=>this.onChangeRadio(e)}),this.contexts.buttonFetch=new S(this.node.querySelector(`#${Tr}`),{title:"H\xE4mta uppskattat v\xE4rde",id:Or,disabled:!(this.state.validation.registrationNumber&&this.state.validation.mileage&&this.state.validation.condition),onClick:()=>this.onFetchVehicle()}),new q(this.node.querySelector(`#${Ze}`),{id:so,title:"Hoppa \xF6ver detta steg",onClick:()=>this.onNoTradeIn()})}},xr=oo;var Hr="button-trade-in-yes",Pr=`${Hr}-node`,Br="button-trade-in-no",$r=`${Br}-node`,ao="button-trade-in-change",io=`${ao}-node`,no=class extends r{constructor(e,t){super(e);this.props=t,g(this.props.store,"navigation",()=>{this.render()}),this.render()}onEdit(){d("MAIN","TRADE_IN_EDIT","TRADE_IN"),L("main",this.props.index)(this.props.store.dispatch)}onYesTradeIn(){d("MAIN","TRADE_IN_SELECTED","TRADE_IN"),jo(this.props.lastStage)(this.props.store.dispatch)}onNoTradeIn(){d("MAIN","TRADE_IN_SKIPPED","TRADE_IN"),Se(this.props.lastStage)(this.props.store.dispatch)}render(){let{store:e,index:t,lastStage:s}=this.props,a=this.props.store.getState();if(!a.order?.allowsTradeIn)return;let n=a.topNavigation.stage>t,l=a.navigation.stage===t;l&&d("MAIN","TRADE_IN_ACTIVE",a.navigation.subStage===1?"TRADE_IN":"TRADE_IN_DETAILS");let c=O(this.node,{title:"Inbytesbil",active:l,completed:n,id:"trade-in"});c.innerHTML="";let m=document.createElement("div");if(a.navigation.stage>t||n&&a.navigation.stage!==t){let u=[];a.tradeIn&&a.tradeInVehicle?(u.push({key:"Miltal",value:`${a.tradeIn.mileage} mil`}),a.tradeIn.description&&u.push({key:"Beskrivning",value:`${a.tradeIn.description}`}),a.tradeIn.condition&&u.push({key:"Bilens skick",value:ye[a.tradeIn.condition]}),m.innerHTML=`
|
|
1421
1421
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1422
1422
|
<div class="waykeecom-balloon">
|
|
1423
1423
|
<div class="waykeecom-stack waykeecom-stack--05">
|
|
@@ -1503,7 +1503,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
1503
1503
|
<div class="waykeecom-preview-card__body">
|
|
1504
1504
|
<div class="waykeecom-preview-card__seller">${n}</div>
|
|
1505
1505
|
<div class="waykeecom-preview-card__heading">
|
|
1506
|
-
<span class="waykeecom-preview-card__title">${s}</span> ${
|
|
1506
|
+
<span class="waykeecom-preview-card__title">${s}</span> ${me(o)}
|
|
1507
1507
|
</div>
|
|
1508
1508
|
<div class="waykeecom-preview-card__footer">
|
|
1509
1509
|
<div class="waykeecom-preview-card__price">${a} kr</div>
|
|
@@ -1527,7 +1527,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
1527
1527
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1528
1528
|
<div id="payment-menu" style="padding: 24px;border: 1px solid #ececeb;"></div>
|
|
1529
1529
|
</div>
|
|
1530
|
-
`}},zr=lo;import{AuthMethod as K}from"@wayke-se/ecom";import{bankid as Qr}from"@wayke-se/ecom";var jr=o=>{let i=Qr.newAuthRequest().withMethod(o).build();return Qr.auth(i)};import{bankid as Jr}from"@wayke-se/ecom";var mo=o=>{let i=Jr.newCollectRequest().withOrderRef(o).build();return Jr.collect(i)};import{customers as md,DeliveryType as Xr,orders as be,PaymentType as po,vehicles as pd}from"@wayke-se/ecom";var Zr=o=>{let i=o.getState();if(!i.address)throw"Missing address";if(!i.paymentType)throw"Missing paymentType";if(!i.vehicle)throw"Missing vehicle";let e=md.newCustomer().withAddress(i.address).withPersonalNumber(i.customer.socialId).withEmail(i.customer.email).withPhoneNumber(i.customer.phone).build(),t=be.newPayment().withType(i.paymentType);if(i.paymentType===po.Loan){let m=i.order?.paymentOptions.find(_=>_.type===po.Loan),u=i.paymentLookupResponse||m?.loanDetails,h=u?.durationSpec.current,p=u?.downPaymentSpec.current,y=u?.residualValueSpec?.current,f=i.order?.paymentOptions.find(_=>_.type===po.Loan)?.externalId;if(t.withDuration(h).withDownPayment(Math.round(p)),y&&t.withResidualValue(y),f&&t.withExternalId(f),i.creditAssessmentResponse){let _=i.creditAssessmentResponse.scoringId,D=i.creditAssessmentResponse.recommendation,x=i.creditAssessmentResponse.decision,G=u?.financialProductCode;if(!_||!D||!x||!G)throw"Missing credit assessment data";let P=be.newCreditAssessment().withScoreId(_).withFinancialProductCode(G).withRecommendation(D).withDecision(x).build();t.withCreditAssessment(P)}}let s=t.build(),a=new URLSearchParams(window.location.search);a.set("wayke-ecom-web-id",i.id);let n=`${window.location.origin}${window.location.pathname}?${a.toString()}${window.location.hash}`;a.set("wayke-ecom-web-payment","true");let l=`${window.location.origin}${window.location.pathname}?${a.toString()}${window.location.hash}`,c=be.newCreateRequest().forVehicle(i.id).withCustomer(e).withPayment(s).withUrls(n,l).withDeliveryType(i.homeDelivery?Xr.Delivery:Xr.Pickup);if(i.insurance){let m=be.newInsurance().withDrivingDistance(i.drivingDistance);i.insuranceAddOns?.addOns.length&&i.insuranceAddOns.insurance===i.insurance.name&&m.withAddOns(i.insuranceAddOns.addOns.map(h=>h.name));let u=m.build();c.withInsurance(u)}else i.freeInsurance&&c.withInsurance({});if(i.accessories.length&&c.withAccessories(i.accessories),i.tradeIn&&i.tradeInVehicle&&i.tradeIn.condition){let m=pd.newVehicleTrade().forVehicle(i.tradeIn.registrationNumber).withMileage(parseInt(i.tradeIn.mileage,10)).withCondition(i.tradeIn.condition).withComment(i.tradeIn.description).build();c.withTradeIn(m)}return be.create(c.build())};import{creditAssessment as ud}from"@wayke-se/ecom";var ec=o=>ud.accept(o);import{bankid as tc}from"@wayke-se/ecom";var sc=o=>{let i=tc.newQrCodeRequest().withOrderRef(o).build();return tc.qrcode(i)};var rc="confirm-conditions",oc=`${rc}-node`,ic="bankid-start-node",hd="bankid-start",ac="address-disclaimer-policy-node",nc="address-disclaimer-reservation-node",uo=class extends r{constructor(e,t){super(e,{htmlTag:"div",className:"waykeecom-stack waykeecom-stack--2"});this.view=1;this.contexts={};this.ageError=!1;this.requestError=!1;this.socialIdNotMatchingError=!1;this.notAvailable=!1;this.confirmConditions=!1;this.bankidRequestRef=void 0;this.bankidStatus=async e=>{try{let t=await mo(e);this.handleBankidStatusResponse(t,K.QrCode)}catch{this.clearIntervals(),this.contexts.bankId?.setErrorMessage("Det gick inte att h\xE4mta status kring nuvanrade BankId signering.")}};this.qrCode=async e=>{try{let s=(await sc(e)).getQrCode();this.contexts.bankId?.update(K.QrCode,s)}catch{this.clearIntervals(),this.contexts.bankId?.setErrorMessage("Det gick inte att h\xE4mta ny QR-kod f\xF6r BankId signering.")}};this.props=t,this.ageError=!1,this.render()}addWindowEvents(){this.removeWindowEvents(),window.addEventListener("focus",()=>this.onFocus())}removeWindowEvents(){window.removeEventListener("focus",()=>this.onFocus())}clearIntervals(){clearInterval(this.bankidQrCodeInterval),clearInterval(this.bankidStatusInterval)}async onFocus(){clearTimeout(this.focusTimeout),this.focusTimeout=setTimeout(async()=>{if(this.bankidRequestRef?.method===K.SameDevice)try{let e=await mo(this.bankidRequestRef.reference);this.handleBankidStatusResponse(e,this.bankidRequestRef.method)}catch{this.clearIntervals(),this.contexts.bankId?.setErrorMessage("Det gick inte att h\xE4mta status kring nuvanrade BankId signering.")}},500)}onSameDeviceClick(){this.addWindowEvents()}setBankidRequestRef(e,t){this.bankidRequestRef={reference:e,method:t}}clearBankidRequestRef(){this.bankidRequestRef=void 0}async acceptCreditAssessment(){let{caseId:e}=this.props.store.getState();if(e)try{d("MAIN","CONFIRMATION_ACCEPT_CREDIT_ASSESSMENT_REQUEST","CONFIRMATION"),await ec(e),d("MAIN","CONFIRMATION_ACCEPT_CREDIT_ASSESSMENT_SUCCEEDED","CONFIRMATION")}catch{d("MAIN","CONFIRMATION_ACCEPT_CREDIT_ASSESSMENT_FAILED","CONFIRMATION")}}async onCreateOrder(){let{store:e}=this.props;this.notAvailable=!1,this.requestError=!1;try{d("MAIN","CONFIRMATION_CREATE_ORDER_REQUESTED","CONFIRMATION");let{order:t}=e.getState(),s=await Zr(e);d("MAIN","CONFIRMATION_CREATE_ORDER_SUCCEEDED","CONFIRMATION"),t?.isPaymentRequired&&b();let n=s.getPayment();ii(s.getOrderNumber(),n)(e.dispatch),this.acceptCreditAssessment()}catch(t){let s=t;this.view=1,d("MAIN","CONFIRMATION_CREATE_ORDER_FAILED","CONFIRMATION"),s.message==="The vehicle is not available for purchase"?(this.requestError=!1,this.notAvailable=!0):(this.notAvailable=!1,this.requestError=!0),b(),this.render()}}async handleBankidStatusResponse(e,t){if(e.isCompleted()){this.removeWindowEvents(),this.clearBankidRequestRef(),this.clearIntervals();let s=e.getAddress(),a=e.getPersonalNumber();if(s&&a){let n=this.props.store.getState();if(A.requiredSsnOver18(a)){if(n.customer.socialId!==a){d("MAIN",t===K.SameDevice?"CONFIRMATION_BANKID_STATUS_SAME_DEVICE_SUCCEEDED_SSN_MISSMATCH":"CONFIRMATION_BANKID_STATUS_QR_SUCCEEDED_SSN_MISSMATCH","CONFIRMATION"),this.view=1,this.socialIdNotMatchingError=!0,b(),this.render();return}}else{d("MAIN",t===K.SameDevice?"CONFIRMATION_BANKID_STATUS_SAME_DEVICE_SUCCEEDED_NOT_OVER_18":"CONFIRMATION_BANKID_STATUS_QR_SUCCEEDED_NOT_OVER_18","CONFIRMATION"),this.view=1,this.ageError=!0,b(),this.render();return}d("MAIN",t===K.SameDevice?"CONFIRMATION_BANKID_STATUS_SAME_DEVICE_SUCCEEDED":"CONFIRMATION_BANKID_STATUS_QR_SUCCEEDED","CONFIRMATION"),this.contexts.bankId?.setDescription("Verifiering klar, ordern skapas nu..."),await this.onCreateOrder()}}}async startBankidSameDevice(e,t,s=!1){s||d("MAIN","CONFIRMATION_BANKID_STATUS_SAME_DEVICE_REQUESTED","CONFIRMATION");try{this.setBankidRequestRef(t,K.SameDevice);let a=e.getAutoLaunchUrl();this.contexts.bankId?.update(K.SameDevice,a)}catch(a){this.removeWindowEvents(),this.clearBankidRequestRef();let n=a;this.contexts.bankId?.setErrorMessage(`Error: ${n.message}`)}}async startBankidWithQr(e,t=!1){t||d("MAIN","CONFIRMATION_BANKID_STATUS_QR_REQUESTED","CONFIRMATION"),this.bankidStatusInterval=setInterval(()=>{this.bankidStatus(e)},2e3),De("bankidStatusInterval",this.bankidStatusInterval),this.qrCode(e),this.bankidQrCodeInterval=setInterval(async()=>{this.qrCode(e)},1e3),De("bankidQrCodeInterval",this.bankidQrCodeInterval)}async onStartBankIdAuth(e,t=!1){this.clearIntervals();try{t||d("MAIN","CONFIRMATION_BANKID_INIT_REQUESTED","CONFIRMATION"),this.contexts.bankId?.update(e),this.contexts.buttonLinkToggle?.disabled(!0);let s=await jr(e);t||d("MAIN","CONFIRMATION_BANKID_INIT_SUCCEEDED","CONFIRMATION");let a=s.getOrderRef();e===K.QrCode?this.startBankidWithQr(a,t):this.startBankidSameDevice(s,a,t)}catch{d("MAIN","CONFIRMATION_BANKID_INIT_FAILED","CONFIRMATION"),this.contexts.bankId?.setErrorMessage("Det gick tyv\xE4rr inte att initiera BankId. V\xE4nligen f\xF6rs\xF6k igen.")}finally{this.contexts.buttonLinkToggle?.disabled(!1)}}onAbort(){this.clearBankidRequestRef(),this.removeWindowEvents(),this.clearIntervals(),d("MAIN","CONFIRMATION_BANKID_ABORTED","CONFIRMATION"),this.view=1,b(),this.render()}onCheckbox(e){let t=e.currentTarget;this.confirmConditions=t.checked,this.contexts.confirmConditions?.checked(this.confirmConditions),this.contexts.startBankid?.disabled(!this.confirmConditions)}render(){let e=
|
|
1530
|
+
`}},zr=lo;import{AuthMethod as K}from"@wayke-se/ecom";import{bankid as Qr}from"@wayke-se/ecom";var jr=o=>{let i=Qr.newAuthRequest().withMethod(o).build();return Qr.auth(i)};import{bankid as Jr}from"@wayke-se/ecom";var mo=o=>{let i=Jr.newCollectRequest().withOrderRef(o).build();return Jr.collect(i)};import{customers as md,DeliveryType as Xr,orders as be,PaymentType as po,vehicles as pd}from"@wayke-se/ecom";var Zr=o=>{let i=o.getState();if(!i.address)throw"Missing address";if(!i.paymentType)throw"Missing paymentType";if(!i.vehicle)throw"Missing vehicle";let e=md.newCustomer().withAddress(i.address).withPersonalNumber(i.customer.socialId).withEmail(i.customer.email).withPhoneNumber(i.customer.phone).build(),t=be.newPayment().withType(i.paymentType);if(i.paymentType===po.Loan){let m=i.order?.paymentOptions.find(_=>_.type===po.Loan),u=i.paymentLookupResponse||m?.loanDetails,h=u?.durationSpec.current,p=u?.downPaymentSpec.current,y=u?.residualValueSpec?.current,f=i.order?.paymentOptions.find(_=>_.type===po.Loan)?.externalId;if(t.withDuration(h).withDownPayment(Math.round(p)),y&&t.withResidualValue(y),f&&t.withExternalId(f),i.creditAssessmentResponse){let _=i.creditAssessmentResponse.scoringId,D=i.creditAssessmentResponse.recommendation,x=i.creditAssessmentResponse.decision,G=u?.financialProductCode;if(!_||!D||!x||!G)throw"Missing credit assessment data";let P=be.newCreditAssessment().withScoreId(_).withFinancialProductCode(G).withRecommendation(D).withDecision(x).build();t.withCreditAssessment(P)}}let s=t.build(),a=new URLSearchParams(window.location.search);a.set("wayke-ecom-web-id",i.id);let n=`${window.location.origin}${window.location.pathname}?${a.toString()}${window.location.hash}`;a.set("wayke-ecom-web-payment","true");let l=`${window.location.origin}${window.location.pathname}?${a.toString()}${window.location.hash}`,c=be.newCreateRequest().forVehicle(i.id).withCustomer(e).withPayment(s).withUrls(n,l).withDeliveryType(i.homeDelivery?Xr.Delivery:Xr.Pickup);if(i.insurance){let m=be.newInsurance().withDrivingDistance(i.drivingDistance);i.insuranceAddOns?.addOns.length&&i.insuranceAddOns.insurance===i.insurance.name&&m.withAddOns(i.insuranceAddOns.addOns.map(h=>h.name));let u=m.build();c.withInsurance(u)}else i.freeInsurance&&c.withInsurance({});if(i.accessories.length&&c.withAccessories(i.accessories),i.tradeIn&&i.tradeInVehicle&&i.tradeIn.condition){let m=pd.newVehicleTrade().forVehicle(i.tradeIn.registrationNumber).withMileage(parseInt(i.tradeIn.mileage,10)).withCondition(i.tradeIn.condition).withComment(i.tradeIn.description).build();c.withTradeIn(m)}return be.create(c.build())};import{creditAssessment as ud}from"@wayke-se/ecom";var ec=o=>ud.accept(o);import{bankid as tc}from"@wayke-se/ecom";var sc=o=>{let i=tc.newQrCodeRequest().withOrderRef(o).build();return tc.qrcode(i)};var rc="confirm-conditions",oc=`${rc}-node`,ic="bankid-start-node",hd="bankid-start",ac="address-disclaimer-policy-node",nc="address-disclaimer-reservation-node",uo=class extends r{constructor(e,t){super(e,{htmlTag:"div",className:"waykeecom-stack waykeecom-stack--2"});this.view=1;this.contexts={};this.ageError=!1;this.requestError=!1;this.socialIdNotMatchingError=!1;this.notAvailable=!1;this.confirmConditions=!1;this.bankidRequestRef=void 0;this.bankidStatus=async e=>{try{let t=await mo(e);this.handleBankidStatusResponse(t,K.QrCode)}catch{this.clearIntervals(),this.contexts.bankId?.setErrorMessage("Det gick inte att h\xE4mta status kring nuvanrade BankId signering.")}};this.qrCode=async e=>{try{let s=(await sc(e)).getQrCode();this.contexts.bankId?.update(K.QrCode,s)}catch{this.clearIntervals(),this.contexts.bankId?.setErrorMessage("Det gick inte att h\xE4mta ny QR-kod f\xF6r BankId signering.")}};this.props=t,this.ageError=!1,this.render()}addWindowEvents(){this.removeWindowEvents(),window.addEventListener("focus",()=>this.onFocus())}removeWindowEvents(){window.removeEventListener("focus",()=>this.onFocus())}clearIntervals(){clearInterval(this.bankidQrCodeInterval),clearInterval(this.bankidStatusInterval)}async onFocus(){clearTimeout(this.focusTimeout),this.focusTimeout=setTimeout(async()=>{if(this.bankidRequestRef?.method===K.SameDevice)try{let e=await mo(this.bankidRequestRef.reference);this.handleBankidStatusResponse(e,this.bankidRequestRef.method)}catch{this.clearIntervals(),this.contexts.bankId?.setErrorMessage("Det gick inte att h\xE4mta status kring nuvanrade BankId signering.")}},500)}onSameDeviceClick(){this.addWindowEvents()}setBankidRequestRef(e,t){this.bankidRequestRef={reference:e,method:t}}clearBankidRequestRef(){this.bankidRequestRef=void 0}async acceptCreditAssessment(){let{caseId:e}=this.props.store.getState();if(e)try{d("MAIN","CONFIRMATION_ACCEPT_CREDIT_ASSESSMENT_REQUEST","CONFIRMATION"),await ec(e),d("MAIN","CONFIRMATION_ACCEPT_CREDIT_ASSESSMENT_SUCCEEDED","CONFIRMATION")}catch{d("MAIN","CONFIRMATION_ACCEPT_CREDIT_ASSESSMENT_FAILED","CONFIRMATION")}}async onCreateOrder(){let{store:e}=this.props;this.notAvailable=!1,this.requestError=!1;try{d("MAIN","CONFIRMATION_CREATE_ORDER_REQUESTED","CONFIRMATION");let{order:t}=e.getState(),s=await Zr(e);d("MAIN","CONFIRMATION_CREATE_ORDER_SUCCEEDED","CONFIRMATION"),t?.isPaymentRequired&&b();let n=s.getPayment();ii(s.getOrderNumber(),n)(e.dispatch),this.acceptCreditAssessment()}catch(t){let s=t;this.view=1,d("MAIN","CONFIRMATION_CREATE_ORDER_FAILED","CONFIRMATION"),s.message==="The vehicle is not available for purchase"?(this.requestError=!1,this.notAvailable=!0):(this.notAvailable=!1,this.requestError=!0),b(),this.render()}}async handleBankidStatusResponse(e,t){if(e.isCompleted()){this.removeWindowEvents(),this.clearBankidRequestRef(),this.clearIntervals();let s=e.getAddress(),a=e.getPersonalNumber();if(s&&a){let n=this.props.store.getState();if(A.requiredSsnOver18(a)){if(n.customer.socialId!==a){d("MAIN",t===K.SameDevice?"CONFIRMATION_BANKID_STATUS_SAME_DEVICE_SUCCEEDED_SSN_MISSMATCH":"CONFIRMATION_BANKID_STATUS_QR_SUCCEEDED_SSN_MISSMATCH","CONFIRMATION"),this.view=1,this.socialIdNotMatchingError=!0,b(),this.render();return}}else{d("MAIN",t===K.SameDevice?"CONFIRMATION_BANKID_STATUS_SAME_DEVICE_SUCCEEDED_NOT_OVER_18":"CONFIRMATION_BANKID_STATUS_QR_SUCCEEDED_NOT_OVER_18","CONFIRMATION"),this.view=1,this.ageError=!0,b(),this.render();return}d("MAIN",t===K.SameDevice?"CONFIRMATION_BANKID_STATUS_SAME_DEVICE_SUCCEEDED":"CONFIRMATION_BANKID_STATUS_QR_SUCCEEDED","CONFIRMATION"),this.contexts.bankId?.setDescription("Verifiering klar, ordern skapas nu..."),await this.onCreateOrder()}}}async startBankidSameDevice(e,t,s=!1){s||d("MAIN","CONFIRMATION_BANKID_STATUS_SAME_DEVICE_REQUESTED","CONFIRMATION");try{this.setBankidRequestRef(t,K.SameDevice);let a=e.getAutoLaunchUrl();this.contexts.bankId?.update(K.SameDevice,a)}catch(a){this.removeWindowEvents(),this.clearBankidRequestRef();let n=a;this.contexts.bankId?.setErrorMessage(`Error: ${n.message}`)}}async startBankidWithQr(e,t=!1){t||d("MAIN","CONFIRMATION_BANKID_STATUS_QR_REQUESTED","CONFIRMATION"),this.bankidStatusInterval=setInterval(()=>{this.bankidStatus(e)},2e3),De("bankidStatusInterval",this.bankidStatusInterval),this.qrCode(e),this.bankidQrCodeInterval=setInterval(async()=>{this.qrCode(e)},1e3),De("bankidQrCodeInterval",this.bankidQrCodeInterval)}async onStartBankIdAuth(e,t=!1){this.clearIntervals();try{t||d("MAIN","CONFIRMATION_BANKID_INIT_REQUESTED","CONFIRMATION"),this.contexts.bankId?.update(e),this.contexts.buttonLinkToggle?.disabled(!0);let s=await jr(e);t||d("MAIN","CONFIRMATION_BANKID_INIT_SUCCEEDED","CONFIRMATION");let a=s.getOrderRef();e===K.QrCode?this.startBankidWithQr(a,t):this.startBankidSameDevice(s,a,t)}catch{d("MAIN","CONFIRMATION_BANKID_INIT_FAILED","CONFIRMATION"),this.contexts.bankId?.setErrorMessage("Det gick tyv\xE4rr inte att initiera BankId. V\xE4nligen f\xF6rs\xF6k igen.")}finally{this.contexts.buttonLinkToggle?.disabled(!1)}}onAbort(){this.clearBankidRequestRef(),this.removeWindowEvents(),this.clearIntervals(),d("MAIN","CONFIRMATION_BANKID_ABORTED","CONFIRMATION"),this.view=1,b(),this.render()}onCheckbox(e){let t=e.currentTarget;this.confirmConditions=t.checked,this.contexts.confirmConditions?.checked(this.confirmConditions),this.contexts.startBankid?.disabled(!this.confirmConditions)}render(){let e=ve(),{navigation:t,order:s,insurance:a}=this.props.store.getState();if(this.view===2)this.contexts.bankId=new Ke(W(),{method:e?K.SameDevice:K.QrCode,descriptionQrCode:"F\xF6r att verifiera din identitet, starta din BankID applikation p\xE5 din andra enhet.",descriptionSameDevice:"F\xF6r att verifiera din identitet, starta din BankID-applikation.",onAbort:()=>this.onAbort(),onStart:n=>this.onStartBankIdAuth(n),onSameDeviceClick:()=>this.onSameDeviceClick()});else{let n=s?.contactInformation?.name,l=s?.conditionsPdfUri,c="https://www.wayke.se/trygghet-naer-det-kommer-till-dina-personuppgifter";this.node.innerHTML=`
|
|
1531
1531
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1532
1532
|
<h4 class="waykeecom-heading waykeecom-heading--4">Strax klart!</h4>
|
|
1533
1533
|
<div class="waykeecom-content">
|
|
@@ -1558,7 +1558,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
1558
1558
|
<div class="waykeecom-stack waykeecom-stack--1" id="${nc}"></div>
|
|
1559
1559
|
</div>
|
|
1560
1560
|
</div>
|
|
1561
|
-
`,this.contexts.confirmConditions=new Xe(this.node.querySelector(`#${oc}`),{checked:this.confirmConditions,id:rc,disabled:this.notAvailable,name:"confirmConditions",title:`<div>Jag godk\xE4nner <a href="${l}" title="" target="_blank" rel="noopener noreferrer" class="waykeecom-link">k\xF6pvillkor och villkor f\xF6r \xE5ngerr\xE4tt</a>${a?' <span class="waykeecom-text waykeecom-text--margin-left">samt har tagit del av information kring f\xF6rs\xE4kringsf\xF6rmedling</span>':""}.</div>`,value:"confirmConditions",onClick:m=>this.onCheckbox(m)}),this.contexts.startBankid=new
|
|
1561
|
+
`,this.contexts.confirmConditions=new Xe(this.node.querySelector(`#${oc}`),{checked:this.confirmConditions,id:rc,disabled:this.notAvailable,name:"confirmConditions",title:`<div>Jag godk\xE4nner <a href="${l}" title="" target="_blank" rel="noopener noreferrer" class="waykeecom-link">k\xF6pvillkor och villkor f\xF6r \xE5ngerr\xE4tt</a>${a?' <span class="waykeecom-text waykeecom-text--margin-left">samt har tagit del av information kring f\xF6rs\xE4kringsf\xF6rmedling</span>':""}.</div>`,value:"confirmConditions",onClick:m=>this.onCheckbox(m)}),this.contexts.startBankid=new Ee(this.node.querySelector(`#${ic}`),{title:"Reservera bilen",id:hd,disabled:!this.confirmConditions||this.notAvailable,onClick:()=>{this.view=2,this.render()}}),new he(this.node.querySelector(`#${ac}`),{text:`Dina personuppgifter behandlas och sparas i enlighet med v\xE5r <a href="${c}" title="personuppgiftspolicy" target="_blank" rel="noopener noreferrer" class="waykeecom-link">personuppgiftspolicy</a>.`}),new Ie(this.node.querySelector(`#${nc}`),{text:"Vi reserverar oss f\xF6r eventuell \xE4ndring i tillg\xE5ngen av utbjudna bilar."}),t.stage===this.props.index&&this.node.parentElement?.scrollIntoView()}}},cc=uo;var ho=class extends r{constructor(e,t){super(e);this.view=1;this.props=t,g(this.props.store,"navigation",()=>{this.render()}),this.render()}render(){let{store:e,index:t}=this.props,{topNavigation:s,navigation:a,order:n}=e.getState(),l=s.stage>t,c=O(this.node,{completed:l,title:n?.isPaymentRequired?"Betalning":"Slutf\xF6r ordern",id:"confirmation",active:a.stage===t});a.stage===t&&(a.subStage===2?new zr(c,{store:e}):new cc(c,{lastStage:!0,index:t,store:this.props.store}),c.parentElement?.scrollIntoView())}},lc=ho;var ko=class extends r{constructor(e,t){super(e);this.props=t,g(this.props.store,"navigation.view",s=>{s===2&&this.render()}),this.render(),this.node.scrollTop=0}render(){let{store:e,cdnMedia:t}=this.props,s=e.getState(),{order:a,stages:n}=s;if(!a)throw"No order available";this.node.innerHTML="";let l=document.createElement("div");this.node.appendChild(l);let c=document.createElement("aside");c.className="waykeecom-cart",c.setAttribute("aria-label","Fordonsinformation"),c.innerHTML=Yr({vehicle:s.vehicle,order:s.order,cdnMedia:t}),l.appendChild(c);let m=document.createElement("div");m.className="waykeecom-stepper",l.appendChild(m);let u=n?.length;n?.forEach((h,p)=>new et[h.name].component(m,{store:e,index:p+1,lastStage:!1})),new lc(m,{store:e,index:(u||0)+1,lastStage:!0})}},dc=ko;var yo=class extends r{constructor(i){super(i,{htmlTag:"div",className:"waykeecom-stack waykeecom-stack--4"})}},V=yo;var vo=class extends V{constructor(e,t){super(e);this.props=t,this.render()}render(){let{store:e}=this.props,t=e.getState(),{order:s,tradeIn:a,tradeInVehicle:n}=t;!s?.allowsTradeIn||(this.node.innerHTML=`
|
|
1562
1562
|
<div class="waykeecom-stack waykeecom-stack--4">
|
|
1563
1563
|
<div class="waykeecom-stack waykeecom-stack--2">
|
|
1564
1564
|
<h4 class="waykeecom-heading waykeecom-heading--4 waykeecom-no-margin">Inbytesbil</h4>
|
|
@@ -1581,7 +1581,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
1581
1581
|
<ul class="waykeecom-key-value-list">
|
|
1582
1582
|
${E({key:"Miltal",value:`${a.mileage} mil`})}
|
|
1583
1583
|
${E({key:"Beskrivning",value:`${a.description}`})}
|
|
1584
|
-
${E({key:"Bilens skick",value:
|
|
1584
|
+
${E({key:"Bilens skick",value:ye[a.condition]})}
|
|
1585
1585
|
${E({key:"Ungef\xE4rligt v\xE4rde",value:`~ ${k(n.valuation,{postfix:"kr"})}`})}
|
|
1586
1586
|
</ul>
|
|
1587
1587
|
</div>
|
|
@@ -1705,10 +1705,10 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
1705
1705
|
<div class="waykeecom-stack waykeecom-stack--2">
|
|
1706
1706
|
<div class="waykeecom-stack waykeecom-stack--1">
|
|
1707
1707
|
<ul class="waykeecom-key-value-list">
|
|
1708
|
-
${E({key:"F\xF6r- och efternamn",value:`${
|
|
1708
|
+
${E({key:"F\xF6r- och efternamn",value:`${se(t.address?.givenName||"")} ${se(t.address?.surname||"")}`})}
|
|
1709
1709
|
${E({key:"Personnummer",value:Ue(t.customer.socialId)})}
|
|
1710
1710
|
${E({key:"Adress",value:`
|
|
1711
|
-
${
|
|
1711
|
+
${se(t.address?.givenName||"")} ${se(t.address?.surname||"")}<br />${t.address?.street}<br />${t.address?.postalCode} ${t.address?.city}
|
|
1712
1712
|
`})}
|
|
1713
1713
|
${E({key:"E-post",value:t.customer.email})}
|
|
1714
1714
|
${E({key:"Telefonnummer",value:t.customer.phone})}
|