@wayke-se/ecom-web 1.5.1-beta.6 → 1.5.1

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.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.1-beta.6",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.7",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",jo=(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",zo=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",z=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",x=(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`
1
+ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",version:"1.5.1",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",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",jo=(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",zo=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",z=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",R=(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">
@@ -215,7 +215,7 @@ 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 X(this.node.querySelector(`#${y}`),{selected:m,onClick:()=>u()})}},ue=Ht;var q=()=>{R();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},R=()=>{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=`
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 q=()=>{L();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},L=()=>{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>
@@ -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 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,R(),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(q(),{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(){z(this.props.lastStage)(this.props.store.dispatch)}onEdit(){d("MAIN","ACCESSORY_EDIT","ACCESSORY"),x("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=P(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 K(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=`
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,L(),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(q(),{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(){z(this.props.lastStage)(this.props.store.dispatch)}onEdit(){d("MAIN","ACCESSORY_EDIT","ACCESSORY"),R("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=P(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 K(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>
@@ -381,7 +381,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
381
381
  ${i}
382
382
  </div>
383
383
  </div>
384
- `,I=pl;var Hi="button-central-storage-proceed",Pi=`${Hi}-node`,ul="central-storage-branch",$i=`${ul}-node`,Xt=class extends r{constructor(e,t){super(e);this.requestError=!1;this.contexts={};this.props=t,g(this.props.store,"navigation",()=>{this.render()}),this.selectedDealer=this.props.store.getState().dealer,this.render()}async updateOrder(e){this.requestError&&(this.requestError=!1,this.render());let{id:t,vehicle:s}=this.props.store.getState();try{this.contexts.proceedButton?.loading(!0);let a=await Pe(t,e);d("MAIN","CENTRAL_STORAGE_SET","CENTRAL_STORAGE"),Oe(Le(a),s),Qo(e,this.props.lastStage)(this.props.store.dispatch),this.contexts.proceedButton?.loading(!1)}catch{this.contexts.proceedButton?.loading(!1),this.requestError=!0,this.render()}}onChange(e){let s=e.currentTarget.value;this.selectedDealer=s,this.contexts.proceedButton?.disabled(!1),d("MAIN","CENTRAL_STORAGE_SELECTED","CENTRAL_STORAGE")}onEdit(){d("MAIN","CENTRAL_STORAGE_EDIT","CENTRAL_STORAGE"),x("main",this.props.index)(this.props.store.dispatch)}onProceed(){this.selectedDealer&&this.updateOrder(this.selectedDealer)}render(){let{order:e,navigation:t,topNavigation:s,createdOrderId:a}=this.props.store.getState(),{index:n}=this.props,l=e?.dealerSites||[],c=s.stage>n,m=t.stage===n;m&&d("MAIN","CENTRAL_STORAGE_ACTIVE","CENTRAL_STORAGE");let u=P(this.node,{completed:c,active:m,title:"Centrallager",id:"central-storage"});if((t.stage>n||c&&t.stage!==n)&&this.selectedDealer){let h=l.find(p=>p.id===this.selectedDealer);new K(u,{keyValueList:[{key:"Val av anl\xE4ggning",value:h?.name||""}],changeButtonTitle:"\xC4ndra",onEdit:a?void 0:()=>this.onEdit()})}else if(t.stage===n){u.innerHTML=`
384
+ `,I=pl;var Hi="button-central-storage-proceed",Pi=`${Hi}-node`,ul="central-storage-branch",$i=`${ul}-node`,Xt=class extends r{constructor(e,t){super(e);this.requestError=!1;this.contexts={};this.props=t,g(this.props.store,"navigation",()=>{this.render()}),this.selectedDealer=this.props.store.getState().dealer,this.render()}async updateOrder(e){this.requestError&&(this.requestError=!1,this.render());let{id:t,vehicle:s}=this.props.store.getState();try{this.contexts.proceedButton?.loading(!0);let a=await Pe(t,e);d("MAIN","CENTRAL_STORAGE_SET","CENTRAL_STORAGE"),Oe(Le(a),s),Qo(e,this.props.lastStage)(this.props.store.dispatch),this.contexts.proceedButton?.loading(!1)}catch{this.contexts.proceedButton?.loading(!1),this.requestError=!0,this.render()}}onChange(e){let s=e.currentTarget.value;this.selectedDealer=s,this.contexts.proceedButton?.disabled(!1),d("MAIN","CENTRAL_STORAGE_SELECTED","CENTRAL_STORAGE")}onEdit(){d("MAIN","CENTRAL_STORAGE_EDIT","CENTRAL_STORAGE"),R("main",this.props.index)(this.props.store.dispatch)}onProceed(){this.selectedDealer&&this.updateOrder(this.selectedDealer)}render(){let{order:e,navigation:t,topNavigation:s,createdOrderId:a}=this.props.store.getState(),{index:n}=this.props,l=e?.dealerSites||[],c=s.stage>n,m=t.stage===n;m&&d("MAIN","CENTRAL_STORAGE_ACTIVE","CENTRAL_STORAGE");let u=P(this.node,{completed:c,active:m,title:"Centrallager",id:"central-storage"});if((t.stage>n||c&&t.stage!==n)&&this.selectedDealer){let h=l.find(p=>p.id===this.selectedDealer);new K(u,{keyValueList:[{key:"Val av anl\xE4ggning",value:h?.name||""}],changeButtonTitle:"\xC4ndra",onEdit:a?void 0:()=>this.onEdit()})}else if(t.stage===n){u.innerHTML=`
385
385
  <div class="waykeecom-stack waykeecom-stack--3">
386
386
  <h4 class="waykeecom-heading waykeecom-heading--4">Vilken anl\xE4ggning vill du k\xF6pa ifr\xE5n?</h4>
387
387
  <div class="waykeecom-content">
@@ -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 W(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,min:n,value:l,autocomplete:c,placeholder:m,unit:u,error:h,errorMessage:p,information:y,pattern:f,inputmode:_,onChange:D,onBlur:M,onClickInformation:Q}=this.props;this.node.innerHTML=`
416
+ </div>`}});new W(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,min:n,value:l,autocomplete:c,placeholder:m,unit:u,error:h,errorMessage:p,information:y,pattern:f,inputmode:_,onChange:D,onBlur:x,onClickInformation:Q}=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>
@@ -433,13 +433,19 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
433
433
  />
434
434
  ${u?`<div class="waykeecom-input-text__unit">${u}</div>`:""}
435
435
  </div>
436
- `,this.updateBorder(),p&&(this.contexts.error=new ee(this.node,{error:h,errorMessage:p})),y&&new te(this.node.querySelector(".waykeecom-input-label"),{information:y,onClickInformation:Q});let b=this.node.querySelector("input");b&&(D&&b.addEventListener("input",D),M&&b.addEventListener("blur",M))}},L=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),requiredNumberGreaterOrEqualThanZero:o=>{if(o==null)return!1;let i=parseInt(o.toString(),10);return!Number.isNaN(i)&&i>=0},optionalNumberGreaterOrEqualThanZero:o=>{if(o==null||typeof o=="string"&&!o)return!0;let i=parseInt(o.toString(),10);return!Number.isNaN(i)&&i>=0},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","commonLaw"].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
+ `,this.updateBorder(),p&&(this.contexts.error=new ee(this.node,{error:h,errorMessage:p})),y&&new te(this.node.querySelector(".waykeecom-input-label"),{information:y,onClickInformation:Q});let b=this.node.querySelector("input");b&&(D&&b.addEventListener("input",D),x&&b.addEventListener("blur",x))}},O=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),requiredNumberGreaterOrEqualThanZero:o=>{if(o==null)return!1;let i=parseInt(o.toString(),10);return!Number.isNaN(i)&&i>=0},optionalNumberGreaterOrEqualThanZero:o=>{if(o==null||typeof o=="string"&&!o)return!0;let i=parseInt(o.toString(),10);return!Number.isNaN(i)&&i>=0},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","commonLaw"].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)}onChangeContacts(){d("MAIN","CUSTOMER_EDIT","CUSTOMER_EMAIL_AND_PHONE"),R("main",1)(this.props.store.dispatch)}render(){let e=this.props.store.getState().navigation.subStage;if(e>1){let t=[{key:"E-post",value:this.state.value.email},{key:"Telefonnummer",value:this.state.value.phone}];this.node.innerHTML=`
437
437
  <div class="waykeecom-stack waykeecom-stack--2">
438
438
  <ul class="waykeecom-key-value-list">
439
439
  ${t.map(s=>E(s)).join("")}
440
440
  </ul>
441
441
  </div>
442
- `}else this.node.innerHTML=`
442
+ `,e<=2&&(this.node.innerHTML+=`
443
+ <div class="waykeecom-stack waykeecom-stack--2">
444
+ <div class="waykeecom-align waykeecom-align--end">
445
+ <button type="button" title="\xC4ndra dina uppgifter" class="waykeecom-link" id="change-contacts">\xC4ndra</button>
446
+ </div>
447
+ </div>
448
+ `)}else this.node.innerHTML=`
443
449
  <div class="waykeecom-stack waykeecom-stack--3">
444
450
  <h4 class="waykeecom-heading waykeecom-heading--4">Kontaktuppgifter</h4>
445
451
  <div class="waykeecom-content">
@@ -452,7 +458,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
452
458
  <div class="waykeecom-stack waykeecom-stack--2" id="${Yi}"></div>
453
459
  </div>
454
460
  <div class="waykeecom-stack waykeecom-stack--3" id="${Ki}"></div>
455
- `,this.contexts.email=new L(this.node.querySelector(`#${Wi}`),{title:"E-post",value:this.state.value.email,id:hl,error:this.state.interact.email&&!this.state.validation.email,errorMessage:"En giltig e-postadress m\xE5ste anges",name:"email",autocomplete:"email",placeholder:"Ange din e-postadress",onChange:t=>this.onChange(t),onBlur:t=>this.onBlur(t)}),this.contexts.phone=new L(this.node.querySelector(`#${Yi}`),{title:"Telefonnummer",value:this.state.value.phone,id:kl,error:this.state.interact.phone&&!this.state.validation.phone,errorMessage:"Ange ditt telefonnummer",name:"phone",autocomplete:"tel",placeholder:"Ange ditt telefonnummer",onChange:t=>this.onChange(t),onBlur:t=>this.onBlur(t)}),this.contexts.button=new S(this.node.querySelector(`#${Ki}`),{title:"G\xE5 vidare",id:yl,disabled:!(this.state.validation.email&&this.state.validation.phone),onClick:()=>this.onProceed()})}},ji=es;var ts=class extends r{constructor(e,t){super(e);this.props=t,this.render()}render(){this.node.innerHTML=`
461
+ `,this.contexts.email=new O(this.node.querySelector(`#${Wi}`),{title:"E-post",value:this.state.value.email,id:hl,error:this.state.interact.email&&!this.state.validation.email,errorMessage:"En giltig e-postadress m\xE5ste anges",name:"email",autocomplete:"email",placeholder:"Ange din e-postadress",onChange:t=>this.onChange(t),onBlur:t=>this.onBlur(t)}),this.contexts.phone=new O(this.node.querySelector(`#${Yi}`),{title:"Telefonnummer",value:this.state.value.phone,id:kl,error:this.state.interact.phone&&!this.state.validation.phone,errorMessage:"Ange ditt telefonnummer",name:"phone",autocomplete:"tel",placeholder:"Ange ditt telefonnummer",onChange:t=>this.onChange(t),onBlur:t=>this.onBlur(t)}),this.contexts.button=new S(this.node.querySelector(`#${Ki}`),{title:"G\xE5 vidare",id:yl,disabled:!(this.state.validation.email&&this.state.validation.phone),onClick:()=>this.onProceed()});this.node.querySelector("#change-contacts")?.addEventListener("click",()=>this.onChangeContacts())}},ji=es;var ts=class extends r{constructor(e,t){super(e);this.props=t,this.render()}render(){this.node.innerHTML=`
456
462
  <div class="waykeecom-disclaimer">
457
463
  <div class="waykeecom-disclaimer__icon" aria-hidden="true">
458
464
  <svg
@@ -499,13 +505,13 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
499
505
  <div class="waykeecom-stack waykeecom-stack--2" id="${Zi}"></div>
500
506
  </div>
501
507
  </div>
502
- `,this.contexts.socialId=new L(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=`
508
+ `,this.contexts.socialId=new O(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=`
503
509
  <div class="waykeecom-stack waykeecom-stack--2">
504
510
  <ul class="waykeecom-key-value-list">
505
511
  ${a.map(n=>E(n)).join("")}
506
512
  </ul>
507
513
  </div>
508
- `}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"),x("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=P(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 K(c,{keyValueList:h,changeButtonTitle:"\xC4ndra dina uppgifter",onEdit:a.createdOrderId?void 0:()=>this.onChange()})}else a.navigation.stage===t&&(new ji(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(){jo(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"),x("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=P(this.node,{completed:n,title:"Leverans",active:l,id:"delivery"});if(s.navigation.stage>t||n&&s.navigation.stage!==t)new K(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=`
514
+ `}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"),R("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=P(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 K(c,{keyValueList:h,changeButtonTitle:"\xC4ndra dina uppgifter",onEdit:a.createdOrderId?void 0:()=>this.onChange()})}else a.navigation.stage===t&&(new ji(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(){jo(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"),R("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=P(this.node,{completed:n,title:"Leverans",active:l,id:"delivery"});if(s.navigation.stage>t||n&&s.navigation.stage!==t)new K(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=`
509
515
  <div class="waykeecom-stack waykeecom-stack--3">
510
516
  <h4 class="waykeecom-heading waykeecom-heading--4">Hur vill du ha din bil levererad?</h4>
511
517
  <div class="waykeecom-content">
@@ -543,9 +549,9 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
543
549
  </div>
544
550
  </div>
545
551
  </div>
546
- `,meta:`<div class="waykeecom-text waykeecom-text--font-bold">${y===0?"Gratis":k(y,{postfix:"kr"})}</div>`,checked:!this.homeDelivery,onClick:M=>this.onChange(M)});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">
552
+ `,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">
547
553
  <div class="waykeecom-stack waykeecom-stack--2">Till din folkbokf\xF6ringsadress</div>
548
- ${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:M=>this.onChange(M)});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"},j={[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=`
554
+ ${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"},j={[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=`
549
555
  <div class="waykeecom-input-label">
550
556
  <label for="${a}" class="waykeecom-input-label__label">${e}</label>
551
557
  </div>
@@ -738,7 +744,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
738
744
  ${u.value===s?'selected="selected"':""}
739
745
  >${u.title||u.value}</option>`).join("")}
740
746
  </select>
741
- `,this.updateBorder(),c&&(this.contexts.error=new ee(this.node,{error:l,errorMessage:c})),this.node.querySelector("select")?.addEventListener("change",u=>m(u))}},ze=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",ja=`${an}-node`,nn="credit-assessment-debt-specification-collateral",Qa=`${nn}-node`,rn="credit-assessment-debt-specification-leasing-fees",za=`${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",O={maritalStatus:A.requiredAssessmentMaritalStatus,income:A.requiredNumberGreaterOrEqualThanZero,employment:A.requiredAssessmentEmplyment,householdChildren:A.requiredNumberGreaterOrEqualThanZero,housingCost:A.requiredNumberGreaterOrEqualThanZero,"debtSpecification.cardCredits":A.optionalNumberGreaterOrEqualThanZero,"debtSpecification.vehicleLoan":A.optionalNumberGreaterOrEqualThanZero,"debtSpecification.collateral":A.optionalNumberGreaterOrEqualThanZero,"debtSpecification.leasingFees":A.optionalNumberGreaterOrEqualThanZero,"debtSpecification.privateLoan":A.optionalNumberGreaterOrEqualThanZero,housingType:A.requiredHousingType},Vl={maritalStatus:Je.Married,income:5e4,employment:re.FullTimeEmployed,householdChildren:-1,housingCost:2e3,debtSpecification:{cardCredits:0,vehicleLoan: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()||"-1",housingCost:o?.housingCost.toString()||"","debtSpecification.cardCredits":o?.debtSpecification.cardCredits.toString()||"","debtSpecification.vehicleLoan":o?.debtSpecification.vehicleLoan.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:O.maritalStatus(i.maritalStatus),income:O.income(i.income),employment:O.employment(i.employment),householdChildren:O.householdChildren(i.householdChildren),housingCost:O.housingCost(i.housingCost),"debtSpecification.cardCredits":O["debtSpecification.cardCredits"](i["debtSpecification.cardCredits"]),"debtSpecification.vehicleLoan":O["debtSpecification.vehicleLoan"](i["debtSpecification.vehicleLoan"]),"debtSpecification.collateral":O["debtSpecification.collateral"](i["debtSpecification.collateral"]),"debtSpecification.leasingFees":O["debtSpecification.leasingFees"](i["debtSpecification.leasingFees"]),"debtSpecification.privateLoan":O["debtSpecification.privateLoan"](i["debtSpecification.privateLoan"]),housingType:O.housingType(i.housingType)},interact:{maritalStatus:!1,income:!1,employment:!1,householdChildren:!1,housingCost:!1,"debtSpecification.cardCredits":!1,"debtSpecification.vehicleLoan":!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]=O[s](a),this.updateUiError(s),this.updateProceedButton()}onBlur(e){let s=e.currentTarget.name;this.state.interact[s]=!0,this.state.validation[s]=O[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]=O[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]=O[s](a),s==="housingType"&&(t.value===J.SingleFamily?(this.state.value.housingCost="0",this.state.validation.housingCost=O.housingCost(this.state.value.housingCost)):(this.state.value.housingCost="",this.state.validation.housingCost=O.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.vehicleLoan"]||!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)),R(),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),R(),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,R(),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),vehicleLoan:parseInt(this.state.value["debtSpecification.vehicleLoan"]||"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(q(),{store:t,creditAssessmentResponse:this.creditAssessmentResponse,onProceed:()=>{R(),a()},onGoBack:()=>this.onAbort()});else if(this.view===2)this.contexts.bankId=new Ke(q(),{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=`
747
+ `,this.updateBorder(),c&&(this.contexts.error=new ee(this.node,{error:l,errorMessage:c})),this.node.querySelector("select")?.addEventListener("change",u=>m(u))}},ze=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",ja=`${an}-node`,nn="credit-assessment-debt-specification-collateral",Qa=`${nn}-node`,rn="credit-assessment-debt-specification-leasing-fees",za=`${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.requiredNumberGreaterOrEqualThanZero,employment:A.requiredAssessmentEmplyment,householdChildren:A.requiredNumberGreaterOrEqualThanZero,housingCost:A.requiredNumberGreaterOrEqualThanZero,"debtSpecification.cardCredits":A.optionalNumberGreaterOrEqualThanZero,"debtSpecification.vehicleLoan":A.optionalNumberGreaterOrEqualThanZero,"debtSpecification.collateral":A.optionalNumberGreaterOrEqualThanZero,"debtSpecification.leasingFees":A.optionalNumberGreaterOrEqualThanZero,"debtSpecification.privateLoan":A.optionalNumberGreaterOrEqualThanZero,housingType:A.requiredHousingType},Vl={maritalStatus:Je.Married,income:5e4,employment:re.FullTimeEmployed,householdChildren:-1,housingCost:2e3,debtSpecification:{cardCredits:0,vehicleLoan: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()||"-1",housingCost:o?.housingCost.toString()||"","debtSpecification.cardCredits":o?.debtSpecification.cardCredits.toString()||"","debtSpecification.vehicleLoan":o?.debtSpecification.vehicleLoan.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.vehicleLoan":M["debtSpecification.vehicleLoan"](i["debtSpecification.vehicleLoan"]),"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.vehicleLoan":!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.state.value.housingCost="",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.vehicleLoan"]||!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)),L(),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),L(),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,L(),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),vehicleLoan:parseInt(this.state.value["debtSpecification.vehicleLoan"]||"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(q(),{store:t,creditAssessmentResponse:this.creditAssessmentResponse,onProceed:()=>{L(),a()},onGoBack:()=>this.onAbort()});else if(this.view===2)this.contexts.bankId=new Ke(q(),{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=`
742
748
  <div class="waykeecom-stack waykeecom-stack--3">
743
749
  <h5 class="waykeecom-heading waykeecom-heading--4">L\xE5neans\xF6kan</h5>
744
750
  <div class="waykeecom-content">
@@ -847,37 +853,37 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
847
853
  <div class="waykeecom-stack waykeecom-stack--1" id="${en}"></div>
848
854
  </div>
849
855
  </div>
850
- `,this.contexts.maritalStatus=new W(this.node.querySelector(`#${Ga}`),{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 L(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 W(this.node.querySelector(`#${qa}`),{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 W(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 L(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:`
856
+ `,this.contexts.maritalStatus=new W(this.node.querySelector(`#${Ga}`),{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 O(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 W(this.node.querySelector(`#${qa}`),{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 W(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 O(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:`
851
857
  <div class="waykeecom-content waykeecom-content--inherit-size">
852
858
  <p class="waykeecom-content__p"><span class="waykeecom-text waykeecom-text--font-medium">Inkomst per m\xE5nad f\xF6re skatt</span></p>
853
859
  <p class="waykeecom-content__p">L\xF6n och/eller pension, inte bidrag eller studiel\xE5n.</p>
854
860
  </div>
855
- `,onChange:p=>this.onChange(p),onBlur:p=>this.onBlur(p)}),this.contexts.householdChildren=new ze(this.node.querySelector(`#${Wa}`),{title:"Antal barn under 18 \xE5r",value:this.state.value.householdChildren,name:"householdChildren",error:this.state.interact.householdChildren&&!this.state.validation.householdChildren,errorMessage:"V\xE4lj antal barn",options:[{value:"-1",title:"V\xE4lj antal barn",disabled:!0},{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 L(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",min:0,information:this.state.value.housingType===J.Condominium?`
861
+ `,onChange:p=>this.onChange(p),onBlur:p=>this.onBlur(p)}),this.contexts.householdChildren=new ze(this.node.querySelector(`#${Wa}`),{title:"Antal barn under 18 \xE5r",value:this.state.value.householdChildren,name:"householdChildren",error:this.state.interact.householdChildren&&!this.state.validation.householdChildren,errorMessage:"V\xE4lj antal barn",options:[{value:"-1",title:"V\xE4lj antal barn",disabled:!0},{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 O(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",min:0,information:this.state.value.housingType===J.Condominium?`
856
862
  <div class="waykeecom-content waykeecom-content--inherit-size">
857
863
  <p class="waykeecom-content__p"><span class="waykeecom-text waykeecom-text--font-medium">Min del av m\xE5nadsavgiften</span></p>
858
864
  <p class="waykeecom-content__p">Exklusive r\xE4nta och amortering</p>
859
865
  </div>
860
- `: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 L(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",min:0,information:`
866
+ `: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 O(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",min:0,information:`
861
867
  <div class="waykeecom-content waykeecom-content--inherit-size">
862
868
  <p class="waykeecom-content__p"><span class="waykeecom-text waykeecom-text--font-medium">Kortkrediter</span></p>
863
869
  <p class="waykeecom-content__p">Total skuld</p>
864
870
  </div>
865
- `,onChange:p=>this.onChange(p),onBlur:p=>this.onBlur(p),onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_DEBT_SPECIFICATION_CARD_CREDIT_INFORMATION_TOGGLE","FINANCIAL")}}),this.contexts["debtSpecification.vehicleLoan"]=new L(this.node.querySelector(`#${ja}`),{title:"Bill\xE5n",value:this.state.value["debtSpecification.vehicleLoan"],id:an,error:this.state.interact["debtSpecification.vehicleLoan"]&&!this.state.validation["debtSpecification.vehicleLoan"],errorMessage:"Ange bill\xE5n eller l\xE4mna tomt",name:"debtSpecification.vehicleLoan",autocomplete:"off",placeholder:"",unit:"kr",type:"number",min:0,information:`
871
+ `,onChange:p=>this.onChange(p),onBlur:p=>this.onBlur(p),onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_DEBT_SPECIFICATION_CARD_CREDIT_INFORMATION_TOGGLE","FINANCIAL")}}),this.contexts["debtSpecification.vehicleLoan"]=new O(this.node.querySelector(`#${ja}`),{title:"Bill\xE5n",value:this.state.value["debtSpecification.vehicleLoan"],id:an,error:this.state.interact["debtSpecification.vehicleLoan"]&&!this.state.validation["debtSpecification.vehicleLoan"],errorMessage:"Ange bill\xE5n eller l\xE4mna tomt",name:"debtSpecification.vehicleLoan",autocomplete:"off",placeholder:"",unit:"kr",type:"number",min:0,information:`
866
872
  <div class="waykeecom-content waykeecom-content--inherit-size">
867
873
  <p class="waykeecom-content__p"><span class="waykeecom-text waykeecom-text--font-medium">Bill\xE5n</span></p>
868
874
  <p class="waykeecom-content__p">Total skuld. Ange inte skuld f\xF6r bil som ska ers\xE4ttas.</p>
869
875
  </div>
870
- `,onChange:p=>this.onChange(p),onBlur:p=>this.onBlur(p),onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_DEBT_SPECIFICATION_CAR_LOAN_INFORMATION_TOGGLE","FINANCIAL")}}),this.contexts["debtSpecification.collateral"]=new L(this.node.querySelector(`#${Qa}`),{title:"Borgens\xE5tagande ",value:this.state.value["debtSpecification.collateral"],id:nn,error:this.state.interact["debtSpecification.collateral"]&&!this.state.validation["debtSpecification.collateral"],errorMessage:"Ange borgens\xE5tagande eller l\xE4mna tomt",name:"debtSpecification.collateral",autocomplete:"off",placeholder:"",unit:"kr",type:"number",min:0,information:`
876
+ `,onChange:p=>this.onChange(p),onBlur:p=>this.onBlur(p),onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_DEBT_SPECIFICATION_CAR_LOAN_INFORMATION_TOGGLE","FINANCIAL")}}),this.contexts["debtSpecification.collateral"]=new O(this.node.querySelector(`#${Qa}`),{title:"Borgens\xE5tagande ",value:this.state.value["debtSpecification.collateral"],id:nn,error:this.state.interact["debtSpecification.collateral"]&&!this.state.validation["debtSpecification.collateral"],errorMessage:"Ange borgens\xE5tagande eller l\xE4mna tomt",name:"debtSpecification.collateral",autocomplete:"off",placeholder:"",unit:"kr",type:"number",min:0,information:`
871
877
  <div class="waykeecom-content waykeecom-content--inherit-size">
872
878
  <p class="waykeecom-content__p"><span class="waykeecom-text waykeecom-text--font-medium">Borgens\xE5tagande</span></p>
873
879
  <p class="waykeecom-content__p">Totalt belopp.</p>
874
880
  </div>
875
- `,onChange:p=>this.onChange(p),onBlur:p=>this.onBlur(p),onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_DEBT_SPECIFICATION_COLLATERAL_INFORMATION_TOGGLE","FINANCIAL")}}),this.contexts["debtSpecification.leasingFees"]=new L(this.node.querySelector(`#${za}`),{title:"Billeasing ",value:this.state.value["debtSpecification.leasingFees"],id:rn,error:this.state.interact["debtSpecification.leasingFees"]&&!this.state.validation["debtSpecification.leasingFees"],errorMessage:"Ang billeasingkostnader eller l\xE4mna tomt",name:"debtSpecification.leasingFees",autocomplete:"off",placeholder:"",unit:"kr",type:"number",min:0,information:`
881
+ `,onChange:p=>this.onChange(p),onBlur:p=>this.onBlur(p),onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_DEBT_SPECIFICATION_COLLATERAL_INFORMATION_TOGGLE","FINANCIAL")}}),this.contexts["debtSpecification.leasingFees"]=new O(this.node.querySelector(`#${za}`),{title:"Billeasing ",value:this.state.value["debtSpecification.leasingFees"],id:rn,error:this.state.interact["debtSpecification.leasingFees"]&&!this.state.validation["debtSpecification.leasingFees"],errorMessage:"Ang billeasingkostnader eller l\xE4mna tomt",name:"debtSpecification.leasingFees",autocomplete:"off",placeholder:"",unit:"kr",type:"number",min:0,information:`
876
882
  <div class="waykeecom-content waykeecom-content--inherit-size">
877
883
  <p class="waykeecom-content__p"><span class="waykeecom-text waykeecom-text--font-medium">Billeasing</span></p>
878
884
  <p class="waykeecom-content__p">Ange inte m\xE5nadskostnad f\xF6r bil som skall ers\xE4ttas</p>
879
885
  </div>
880
- `,onChange:p=>this.onChange(p),onBlur:p=>this.onBlur(p),onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_DEBT_SPECIFICATION_LEASING_FEES_INFORMATION_TOGGLE","FINANCIAL")}}),this.contexts["debtSpecification.privateLoan"]=new L(this.node.querySelector(`#${Ja}`),{title:"Privatl\xE5n (ej bol\xE5n och CSN)",value:this.state.value["debtSpecification.privateLoan"],id:cn,error:this.state.interact["debtSpecification.privateLoan"]&&!this.state.validation["debtSpecification.privateLoan"],errorMessage:"Ange privatl\xE5n eller l\xE4mna tomt",name:"debtSpecification.privateLoan",autocomplete:"off",placeholder:"",unit:"kr",type:"number",min:0,information:`
886
+ `,onChange:p=>this.onChange(p),onBlur:p=>this.onBlur(p),onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_DEBT_SPECIFICATION_LEASING_FEES_INFORMATION_TOGGLE","FINANCIAL")}}),this.contexts["debtSpecification.privateLoan"]=new O(this.node.querySelector(`#${Ja}`),{title:"Privatl\xE5n (ej bol\xE5n och CSN)",value:this.state.value["debtSpecification.privateLoan"],id:cn,error:this.state.interact["debtSpecification.privateLoan"]&&!this.state.validation["debtSpecification.privateLoan"],errorMessage:"Ange privatl\xE5n eller l\xE4mna tomt",name:"debtSpecification.privateLoan",autocomplete:"off",placeholder:"",unit:"kr",type:"number",min:0,information:`
881
887
  <div class="waykeecom-content waykeecom-content--inherit-size">
882
888
  <p class="waykeecom-content__p"><span class="waykeecom-text waykeecom-text--font-medium">Privatl\xE5n (ej bol\xE5n och CSN)</span></p>
883
889
  <p class="waykeecom-content__p">Total skuld, t.ex. blancol\xE5n och sms-l\xE5n</p>
@@ -1059,14 +1065,14 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
1059
1065
  <p class="waykeecom-content__p">Kontantinsatsen \xE4r en del av bilens pris som du betalar med egna pengar. Den beh\xF6ver vara minst 20% av priset p\xE5 bilen. Kontantinsatsen betalar du senare i samband med avtalsskrivning hos ${n}.</p>
1060
1066
  <p class="waykeecom-content__p">Ifall du har en inbytesbil kan du betala kontantinsatsen med den. Detta kommer du \xF6verens om tillsammans med ${n} vid avtalsskrivning. </p>
1061
1067
  </div>
1062
- `,onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_DOWNPAYMENT_INFORMATION_TOGGLE","FINANCIAL")}}),this.contexts.duration=new We(this.node.querySelector(`#${Sn}`),{title:"Avbetalning",value:this.paymentState.duration.current,id:Yl,name:"duration",onChange:c=>this.onChange(c),min:this.paymentState.duration.min,max:this.paymentState.duration.max,step:this.paymentState.duration.step,unit:"m\xE5n"}),this.paymentState.residual&&(this.contexts.residual=new We(this.node.querySelector(`#${wn}`),{title:"Restv\xE4rde",value:parseInt(`${this.paymentState.residual.current*100}`,10),id:Kl,name:"residual",onChange:c=>this.onChange(c),min:parseInt(`${this.paymentState.residual.min*100}`,10),max:parseInt(`${this.paymentState.residual.max*100}`,10),step:parseInt(`${this.paymentState.residual.step*100}`,10),unit:"%"})),this.contexts.errorAlert=new gn(this.node.querySelector(`#${Cn}`),{}),this.contexts.loanDetails=new fn(this.node.querySelector(`#${Nn}`),{loan:t,paymentLookupResponse:this.paymentLookupResponse}),l?new dn(this.node.querySelector(`#${An}`),{store:e,loan:t,paymentLookupResponse:this.paymentLookupResponse,onProceed:()=>s()}):this.contexts.proceedButton=new S(this.node.querySelector(`#${Tn}`),{title:"G\xE5 vidare",id:Dn,onClick:()=>s()})}},bn=xs;import{PaymentType as Rn}from"@wayke-se/ecom";var Ql="credit-assessment-result",Ln=`${Ql}-node`,Ps=class extends r{constructor(e,t){super(e,{htmlTag:"div"});this.props=t,this.render()}render(){let{store:e,paymentType:t,loan:s,paymentLookupResponse:a,onEdit:n}=this.props,l=s?.loanDetails;if(t===Rn.Loan){let c=this.props.store.getState(),m=a||l;if(!l||!m)throw"Missing loan";let u=m.downPaymentSpec.current,h=m.creditAmount,p=m.durationSpec.current,{interest:y,effectiveInterest:f}=m.interests,{monthlyCost:_}=m.costs,D=[{key:"Kontantinsats",value:k(u,{postfix:"kr"})},{key:"L\xE5nebelopp",value:k(h,{postfix:"kr"})},{key:"Avbetalningsperoid",value:`${p} m\xE5n`},{key:"M\xE5nadskostnad f\xF6r l\xE5net",value:k(_,{postfix:"kr*"})}],M=c.creditAssessmentResponse?.recommendation,Q=`*Ber\xE4knat p\xE5 ${k(y*100,{decimals:2})} % r\xE4nta (effektivt ${k(f*100,{decimals:2})} %). Den r\xE4nta du f\xE5r s\xE4tts vid avtalskrivning.`;this.node.innerHTML=`
1068
+ `,onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_DOWNPAYMENT_INFORMATION_TOGGLE","FINANCIAL")}}),this.contexts.duration=new We(this.node.querySelector(`#${Sn}`),{title:"Avbetalning",value:this.paymentState.duration.current,id:Yl,name:"duration",onChange:c=>this.onChange(c),min:this.paymentState.duration.min,max:this.paymentState.duration.max,step:this.paymentState.duration.step,unit:"m\xE5n"}),this.paymentState.residual&&(this.contexts.residual=new We(this.node.querySelector(`#${wn}`),{title:"Restv\xE4rde",value:parseInt(`${this.paymentState.residual.current*100}`,10),id:Kl,name:"residual",onChange:c=>this.onChange(c),min:parseInt(`${this.paymentState.residual.min*100}`,10),max:parseInt(`${this.paymentState.residual.max*100}`,10),step:parseInt(`${this.paymentState.residual.step*100}`,10),unit:"%"})),this.contexts.errorAlert=new gn(this.node.querySelector(`#${Cn}`),{}),this.contexts.loanDetails=new fn(this.node.querySelector(`#${Nn}`),{loan:t,paymentLookupResponse:this.paymentLookupResponse}),l?new dn(this.node.querySelector(`#${An}`),{store:e,loan:t,paymentLookupResponse:this.paymentLookupResponse,onProceed:()=>s()}):this.contexts.proceedButton=new S(this.node.querySelector(`#${Tn}`),{title:"G\xE5 vidare",id:Dn,onClick:()=>s()})}},bn=xs;import{PaymentType as Rn}from"@wayke-se/ecom";var Ql="credit-assessment-result",Ln=`${Ql}-node`,Ps=class extends r{constructor(e,t){super(e,{htmlTag:"div"});this.props=t,this.render()}render(){let{store:e,paymentType:t,loan:s,paymentLookupResponse:a,onEdit:n}=this.props,l=s?.loanDetails;if(t===Rn.Loan){let c=this.props.store.getState(),m=a||l;if(!l||!m)throw"Missing loan";let u=m.downPaymentSpec.current,h=m.creditAmount,p=m.durationSpec.current,{interest:y,effectiveInterest:f}=m.interests,{monthlyCost:_}=m.costs,D=[{key:"Kontantinsats",value:k(u,{postfix:"kr"})},{key:"L\xE5nebelopp",value:k(h,{postfix:"kr"})},{key:"Avbetalningsperoid",value:`${p} m\xE5n`},{key:"M\xE5nadskostnad f\xF6r l\xE5net",value:k(_,{postfix:"kr*"})}],x=c.creditAssessmentResponse?.recommendation,Q=`*Ber\xE4knat p\xE5 ${k(y*100,{decimals:2})} % r\xE4nta (effektivt ${k(f*100,{decimals:2})} %). Den r\xE4nta du f\xE5r s\xE4tts vid avtalskrivning.`;this.node.innerHTML=`
1063
1069
  <div class="waykeecom-stack waykeecom-stack--2">
1064
1070
  <h4 class="waykeecom-heading waykeecom-heading--4">Bill\xE5n</h4>
1065
1071
  <div class="waykeecom-content">
1066
1072
  <p class="waykeecom-content__p">Ordern \xE4r snart klar, h\xE4r ser du ditt l\xE5nebesked:</p>
1067
1073
  </div>
1068
1074
  </div>
1069
- ${M?`<div class="waykeecom-stack waykeecom-stack--2" id="${Ln}"></div>`:""}
1075
+ ${x?`<div class="waykeecom-stack waykeecom-stack--2" id="${Ln}"></div>`:""}
1070
1076
  <div class="waykeecom-stack waykeecom-stack--2">
1071
1077
  <div class="waykeecom-stack waykeecom-stack--1">
1072
1078
  <ul class="waykeecom-key-value-list">
@@ -1082,7 +1088,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
1082
1088
  <button type="button" title="\xC4ndra finansiering" class="waykeecom-link">\xC4ndra</button>
1083
1089
  </div>
1084
1090
  </div>
1085
- `,M&&new oe(this.node.querySelector(`#${Ln}`),{store:e,decision:M})}else this.node.innerHTML=`
1091
+ `,x&&new oe(this.node.querySelector(`#${Ln}`),{store:e,decision:x})}else this.node.innerHTML=`
1086
1092
  <div class="waykeecom-stack waykeecom-stack--1">
1087
1093
  <ul class="waykeecom-key-value-list">
1088
1094
  ${E({key:"Finansiering",value:t===Rn.Cash?"Kontant":"Privatleasing"})}
@@ -1095,7 +1101,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
1095
1101
  </div>
1096
1102
  </div>
1097
1103
  `:""}
1098
- `;n&&this.node.querySelector("button")?.addEventListener("click",()=>n())}},On=Ps;var Hn="button-financial-proceed",Mn=`${Hn}-node`,zl="financial-option",xn=`${zl}-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"),x("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=P(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(b=>b.type===$.Cash),y=l.find(b=>b.type===$.Loan),f=l.find(b=>b.type===$.Lease);u.innerHTML=`
1104
+ `;n&&this.node.querySelector("button")?.addEventListener("click",()=>n())}},On=Ps;var Hn="button-financial-proceed",Mn=`${Hn}-node`,zl="financial-option",xn=`${zl}-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"),R("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=P(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(b=>b.type===$.Cash),y=l.find(b=>b.type===$.Loan),f=l.find(b=>b.type===$.Lease);u.innerHTML=`
1099
1105
  <div class="waykeecom-stack waykeecom-stack--3">
1100
1106
  <h4 class="waykeecom-heading waykeecom-heading--4 waykeecom-no-margin">Hur vill du finansiera din ${h?.title} ${me(h)}?</h4>
1101
1107
  </div>
@@ -1144,11 +1150,11 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
1144
1150
  <div class="waykeecom-content waykeecom-content--inherit-size">
1145
1151
  <p class="waykeecom-content__p">Du k\xF6per bilen och \xE4ger den sj\xE4lv, antingen genom att betala hela bilen med egna medel eller genom ett bill\xE5n. Du ansvarar sj\xE4lv f\xF6r f\xF6rs\xE4ljningen av bilen och v\xE4ljer s\xE5klart helt fritt n\xE4r den ska \xE4ga rum.</p>
1146
1152
  </div>
1147
- `,options:D,onClick:b=>this.onChange(b),onClickInformation:()=>{d("MAIN","FINANCIAL_INFORMATION_TOGGLE","FINANCIAL")}});let M=[];f&&(M.push({id:ed,title:"Privatleasing",value:$.Lease,meta:`<div class="waykeecom-text waykeecom-text--font-bold">Fr\xE5n ${k(f?.price,{postfix:f.unit})}</div>`}),new W(u.querySelector(`#${Pn}`),{title:"Leasa bilen",checked:this.paymentType,name:"paymentType",information:`
1153
+ `,options:D,onClick:b=>this.onChange(b),onClickInformation:()=>{d("MAIN","FINANCIAL_INFORMATION_TOGGLE","FINANCIAL")}});let x=[];f&&(x.push({id:ed,title:"Privatleasing",value:$.Lease,meta:`<div class="waykeecom-text waykeecom-text--font-bold">Fr\xE5n ${k(f?.price,{postfix:f.unit})}</div>`}),new W(u.querySelector(`#${Pn}`),{title:"Leasa bilen",checked:this.paymentType,name:"paymentType",information:`
1148
1154
  <div class="waykeecom-content waykeecom-content--inherit-size">
1149
1155
  <p class="waykeecom-content__p">N\xE4r du privatleasar en bil \xE4ger du den inte sj\xE4lv utan betalar en m\xE5nadsavgift under en avtalad tid och som t\xE4cker en viss k\xF6rstr\xE4cka och andra avtalade tj\xE4nster.</p>
1150
1156
  </div>
1151
- `,options:M,onClick:b=>this.onChange(b)}));let Q=u.querySelector(`#${$n}`);Q&&(y&&this.paymentType===$.Loan?new bn(Q,{store:this.props.store,loan:y,vehicleId:s,paymentLookupResponse:n,onProceed:()=>this.onProceed()}):new S(u.querySelector(`#${Mn}`),{title:"G\xE5 vidare",id:Hn,disabled:!this.paymentType,onClick:()=>this.onProceed()}))}!e&&t.navigation.stage===this.props.index&&m.parentElement?.scrollIntoView()}},Bn=$s;import{DrivingDistance as H}from"@wayke-se/ecom";import{insurances as Fn}from"@wayke-se/ecom";var Un=(o,i)=>{let e=o.getState();if(!e.id)throw"No id";let t=Fn.newInsuranceOptionsRequest().forCustomer(e.customer.socialId).forVehicle(e.id).withDrivingDistance(i);return Fn.getOptions(t.build())};var Hs=class extends r{constructor(e,t){super(e,t.append?{htmlTag:"div",className:"waykeecom-input-selection",attributes:[{key:"role",value:"checkbox"}]}:void 0);this.props=t,this.render()}checked(e){this.props.checked!==e&&(this.props.checked=e,this.render())}disabled(e){this.props.disabled!==e&&(this.props.disabled=e,this.render())}render(){let{id:e,title:t,value:s,name:a,checked:n,meta:l,description:c,append:m,disabled:u,onClick:h}=this.props,p=`
1157
+ `,options:x,onClick:b=>this.onChange(b)}));let Q=u.querySelector(`#${$n}`);Q&&(y&&this.paymentType===$.Loan?new bn(Q,{store:this.props.store,loan:y,vehicleId:s,paymentLookupResponse:n,onProceed:()=>this.onProceed()}):new S(u.querySelector(`#${Mn}`),{title:"G\xE5 vidare",id:Hn,disabled:!this.paymentType,onClick:()=>this.onProceed()}))}!e&&t.navigation.stage===this.props.index&&m.parentElement?.scrollIntoView()}},Bn=$s;import{DrivingDistance as H}from"@wayke-se/ecom";import{insurances as Fn}from"@wayke-se/ecom";var Un=(o,i)=>{let e=o.getState();if(!e.id)throw"No id";let t=Fn.newInsuranceOptionsRequest().forCustomer(e.customer.socialId).forVehicle(e.id).withDrivingDistance(i);return Fn.getOptions(t.build())};var Hs=class extends r{constructor(e,t){super(e,t.append?{htmlTag:"div",className:"waykeecom-input-selection",attributes:[{key:"role",value:"checkbox"}]}:void 0);this.props=t,this.render()}checked(e){this.props.checked!==e&&(this.props.checked=e,this.render())}disabled(e){this.props.disabled!==e&&(this.props.disabled=e,this.render())}render(){let{id:e,title:t,value:s,name:a,checked:n,meta:l,description:c,append:m,disabled:u,onClick:h}=this.props,p=`
1152
1158
  <input
1153
1159
  type="checkbox"
1154
1160
  id="${e}"
@@ -1228,7 +1234,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
1228
1234
  <div class="waykeecom-stack waykeecom-stack--1" id="${Vs}"></div>
1229
1235
  <div class="waykeecom-stack waykeecom-stack--1" id="${qn}"></div>
1230
1236
  </div>
1231
- `,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,R(),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(q(),{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)}},jn=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 jn(a,{store:e,insurance:n,key:`insurance-${l}`})))}},Qn=qs;var Ws="insurance-grid-list-node",td="button-insurances-proceed",zn=`${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(){z(this.props.lastStage)(this.props.store.dispatch)}onSkipInsurances(){d("MAIN","INSURANCE_SKIPPED","INSURANCE_IF"),le()(this.props.store.dispatch),z(this.props.lastStage)(this.props.store.dispatch)}render(){let{store:e}=this.props,t=e.getState(),{insurance:s,drivingDistance:a}=t;this.node.innerHTML=`
1237
+ `,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,L(),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(q(),{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)}},jn=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 jn(a,{store:e,insurance:n,key:`insurance-${l}`})))}},Qn=qs;var Ws="insurance-grid-list-node",td="button-insurances-proceed",zn=`${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(){z(this.props.lastStage)(this.props.store.dispatch)}onSkipInsurances(){d("MAIN","INSURANCE_SKIPPED","INSURANCE_IF"),le()(this.props.store.dispatch),z(this.props.lastStage)(this.props.store.dispatch)}render(){let{store:e}=this.props,t=e.getState(),{insurance:s,drivingDistance:a}=t;this.node.innerHTML=`
1232
1238
  <div class="waykeecom-stack waykeecom-stack--3">
1233
1239
  <h4 class="waykeecom-heading waykeecom-heading--4">Vill du teckna en f\xF6rs\xE4kring p\xE5 din nya bil?</h4>
1234
1240
  <div class="waykeecom-content">
@@ -1302,7 +1308,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
1302
1308
  <div class="waykeecom-stack waykeecom-stack--1" id="${ur}"></div>
1303
1309
  <div class="waykeecom-stack waykeecom-stack--1" id="${pr}"></div>
1304
1310
  </div>
1305
- `,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 zs=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,R(),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(q(),{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=zs;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();z(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=`
1311
+ `,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 zs=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,L(),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(q(),{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=zs;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();z(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=`
1306
1312
  <div class="waykeecom-stack waykeecom-stack--3">
1307
1313
  <h4 class="waykeecom-heading waykeecom-heading--4">Vill du teckna en f\xF6rs\xE4kring p\xE5 din nya bil?</h4>
1308
1314
  <div class="waykeecom-content">
@@ -1314,7 +1320,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
1314
1320
  <div class="waykeecom-stack waykeecom-stack--1" id="${vr}"></div>
1315
1321
  <div class="waykeecom-stack waykeecom-stack--1" id="${id}"></div>
1316
1322
  </div>
1317
- `,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),z(this.props.lastStage)(this.props.store.dispatch),d("MAIN","INSURANCE_SKIPPED",this.getStep())}onEdit(){d("MAIN","INSURANCE_EDIT",this.getStep()),x("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=P(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:j[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 K(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=`
1323
+ `,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),z(this.props.lastStage)(this.props.store.dispatch),d("MAIN","INSURANCE_SKIPPED",this.getStep())}onEdit(){d("MAIN","INSURANCE_EDIT",this.getStep()),R("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=P(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:j[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 K(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=`
1318
1324
  <div class="waykeecom-input-label">
1319
1325
  <label for="${a}" class="waykeecom-input-label__label">${e}</label>
1320
1326
  </div>
@@ -1409,13 +1415,13 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
1409
1415
  <div class="waykeecom-stack waykeecom-stack--1" id="${Tr}"></div>
1410
1416
  <div class="waykeecom-stack waykeecom-stack--1" id="${Ze}"></div>
1411
1417
  </div>
1412
- `,this.contexts.registrationNumber=new L(this.node.querySelector(`#${Sr}`),{title:"Registreringsnummer",value:this.state.value.registrationNumber,id:br,error:this.state.interact.registrationNumber&&!this.state.validation.registrationNumber,errorMessage:"Ett giltig registreringsnummer i formatet ABC123 eller ABC12A m\xE5ste anges",name:"registrationNumber",autocomplete:"off",placeholder:"Ange registreringsnummer",unit:`
1418
+ `,this.contexts.registrationNumber=new O(this.node.querySelector(`#${Sr}`),{title:"Registreringsnummer",value:this.state.value.registrationNumber,id:br,error:this.state.interact.registrationNumber&&!this.state.validation.registrationNumber,errorMessage:"Ett giltig registreringsnummer i formatet ABC123 eller ABC12A m\xE5ste anges",name:"registrationNumber",autocomplete:"off",placeholder:"Ange registreringsnummer",unit:`
1413
1419
  <svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 34" class="waykeecom-input-text__unit-regnr-icon" aria-hidden="true">
1414
1420
  <rect width="22" height="34" rx="1" fill="#458BDD"/>
1415
1421
  <circle cx="11" cy="10" r="5.5" stroke="#FFF500" stroke-linejoin="round" stroke-dasharray="1 2"/>
1416
1422
  <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"/>
1417
1423
  </svg>
1418
- `,onChange:e=>this.onChange(e),onBlur:e=>this.onBlur(e)}),this.contexts.mileage=new L(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 W(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 G(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"),x("main",this.props.index)(this.props.store.dispatch)}onYesTradeIn(){d("MAIN","TRADE_IN_SELECTED","TRADE_IN"),zo(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=P(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=`
1424
+ `,onChange:e=>this.onChange(e),onBlur:e=>this.onBlur(e)}),this.contexts.mileage=new O(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 W(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 G(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"),R("main",this.props.index)(this.props.store.dispatch)}onYesTradeIn(){d("MAIN","TRADE_IN_SELECTED","TRADE_IN"),zo(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=P(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=`
1419
1425
  <div class="waykeecom-stack waykeecom-stack--3">
1420
1426
  <div class="waykeecom-balloon">
1421
1427
  <div class="waykeecom-stack waykeecom-stack--05">
@@ -1479,7 +1485,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
1479
1485
  <ul class="waykeecom-checklist" aria-label="F\xF6rdelar med att k\xF6pa bilen online hos oss">
1480
1486
  ${this.props.checklistItems.map(e=>` <li class="waykeecom-checklist__item">${e}</li>`).join("")}
1481
1487
  </ul>
1482
- `}},Ur=ro;var qr="preview-proceed",Vr=`${qr}-node`,ld="preview-checklist",Gr=`${ld}-node`,co=class extends r{constructor(e,t){super(e);this.contexts={};this.requestError=!1;this.props=t,this.init(),this.render()}async init(){this.requestError=!1,this.render();let e=this.props.store.getState();try{this.contexts.buttonProceed?.disabled(!0);let t=await Pe(e.id),s=Le(t),a=[];this.props.stageOrderList.forEach(n=>{n==="centralStorage"&&!s.requiresDealerSelection||n==="tradeIn"&&!s.allowsTradeIn||n==="insurance"&&!s.insuranceOption||n==="accessories"&&!s.accessories.length||a.push(et[n])}),oi(a)(this.props.store.dispatch),Oe(s,this.props.vehicle)(this.props.store.dispatch),this.render()}catch(t){throw this.requestError=!0,this.render(),t}}onProceed(){d("PREVIEW","PREVIEW_PROCEED"),x("main")(this.props.store.dispatch)}render(){let{store:e,cdnMedia:t}=this.props,s=e.getState();if(!s.order){this.node.innerHTML=`
1488
+ `}},Ur=ro;var qr="preview-proceed",Vr=`${qr}-node`,ld="preview-checklist",Gr=`${ld}-node`,co=class extends r{constructor(e,t){super(e);this.contexts={};this.requestError=!1;this.props=t,this.init(),this.render()}async init(){this.requestError=!1,this.render();let e=this.props.store.getState();try{this.contexts.buttonProceed?.disabled(!0);let t=await Pe(e.id),s=Le(t),a=[];this.props.stageOrderList.forEach(n=>{n==="centralStorage"&&!s.requiresDealerSelection||n==="tradeIn"&&!s.allowsTradeIn||n==="insurance"&&!s.insuranceOption||n==="accessories"&&!s.accessories.length||a.push(et[n])}),oi(a)(this.props.store.dispatch),Oe(s,this.props.vehicle)(this.props.store.dispatch),this.render()}catch(t){throw this.requestError=!0,this.render(),t}}onProceed(){d("PREVIEW","PREVIEW_PROCEED"),R("main")(this.props.store.dispatch)}render(){let{store:e,cdnMedia:t}=this.props,s=e.getState();if(!s.order){this.node.innerHTML=`
1483
1489
  ${this.requestError?I({tone:"error",children:"Ett fel uppstod och det gick inte att initiera modulen. F\xF6rs\xF6k igen."}):C()}
1484
1490
  `;return}this.node.innerHTML=`
1485
1491
  <div class="waykeecom-stack waykeecom-stack--3">
@@ -1525,7 +1531,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
1525
1531
  <div class="waykeecom-stack waykeecom-stack--3">
1526
1532
  <div id="payment-menu" style="padding: 24px;border: 1px solid #ececeb;"></div>
1527
1533
  </div>
1528
- `}},jr=lo;import{AuthMethod as Y}from"@wayke-se/ecom";import{bankid as Qr}from"@wayke-se/ecom";var zr=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,M=i.creditAssessmentResponse.decision,Q=u?.financialProductCode;if(!_||!D||!M||!Q)throw"Missing credit assessment data";let b=be.newCreditAssessment().withScoreId(_).withFinancialProductCode(Q).withRecommendation(D).withDecision(M).build();t.withCreditAssessment(b)}}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,Y.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(Y.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===Y.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&&R();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),R(),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===Y.SameDevice?"CONFIRMATION_BANKID_STATUS_SAME_DEVICE_SUCCEEDED_SSN_MISSMATCH":"CONFIRMATION_BANKID_STATUS_QR_SUCCEEDED_SSN_MISSMATCH","CONFIRMATION"),this.view=1,this.socialIdNotMatchingError=!0,R(),this.render();return}}else{d("MAIN",t===Y.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,R(),this.render();return}d("MAIN",t===Y.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,Y.SameDevice);let a=e.getAutoLaunchUrl();this.contexts.bankId?.update(Y.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 zr(e);t||d("MAIN","CONFIRMATION_BANKID_INIT_SUCCEEDED","CONFIRMATION");let a=s.getOrderRef();e===Y.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,R(),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(q(),{method:e?Y.SameDevice:Y.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=`
1534
+ `}},jr=lo;import{AuthMethod as Y}from"@wayke-se/ecom";import{bankid as Qr}from"@wayke-se/ecom";var zr=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,Q=u?.financialProductCode;if(!_||!D||!x||!Q)throw"Missing credit assessment data";let b=be.newCreditAssessment().withScoreId(_).withFinancialProductCode(Q).withRecommendation(D).withDecision(x).build();t.withCreditAssessment(b)}}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,Y.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(Y.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===Y.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&&L();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),L(),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===Y.SameDevice?"CONFIRMATION_BANKID_STATUS_SAME_DEVICE_SUCCEEDED_SSN_MISSMATCH":"CONFIRMATION_BANKID_STATUS_QR_SUCCEEDED_SSN_MISSMATCH","CONFIRMATION"),this.view=1,this.socialIdNotMatchingError=!0,L(),this.render();return}}else{d("MAIN",t===Y.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,L(),this.render();return}d("MAIN",t===Y.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,Y.SameDevice);let a=e.getAutoLaunchUrl();this.contexts.bankId?.update(Y.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 zr(e);t||d("MAIN","CONFIRMATION_BANKID_INIT_SUCCEEDED","CONFIRMATION");let a=s.getOrderRef();e===Y.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,L(),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(q(),{method:e?Y.SameDevice:Y.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=`
1529
1535
  <div class="waykeecom-stack waykeecom-stack--3">
1530
1536
  <h4 class="waykeecom-heading waykeecom-heading--4">Strax klart!</h4>
1531
1537
  <div class="waykeecom-content">