@wayke-se/ecom-web 1.5.1-beta.1 → 1.5.1-beta.3

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.d.ts CHANGED
@@ -953,6 +953,7 @@ declare module '@wayke-se/ecom-web/src/Components/Input/InputSelect' {
953
953
  export interface SelectItem {
954
954
  value: string;
955
955
  title?: string;
956
+ disabled?: boolean;
956
957
  }
957
958
  interface InputSelectProps {
958
959
  readonly title: string;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";(()=>{var Yc=Object.create;var Jo=Object.defineProperty;var Kc=Object.getOwnPropertyDescriptor;var Qc=Object.getOwnPropertyNames;var zc=Object.getPrototypeOf,jc=Object.prototype.hasOwnProperty;var f=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(i,e)=>(typeof require<"u"?require:i)[e]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+s+'" is not supported')});var Jc=(s,i,e,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of Qc(i))!jc.call(s,o)&&o!==e&&Jo(s,o,{get:()=>i[o],enumerable:!(t=Kc(i,o))||t.enumerable});return s};var Xc=(s,i,e)=>(e=s!=null?Yc(zc(s)):{},Jc(i||!s||!s.__esModule?Jo(e,"default",{value:s,enumerable:!0}):e,s));var Fc=f("@wayke-se/ecom");var Xo={name:"@wayke-se/ecom-web",version:"1.5.1-beta.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-beta.5",marked:"^4.3.0","object-path":"^0.11.8",redux:"^4.1.2","sanitize-html":"^2.7.0"},files:["dist"]};var fi=f("redux");var Ae=f("@wayke-se/ecom");var ot=(s,i)=>s!==void 0&&i!==void 0?JSON.stringify(s).localeCompare(JSON.stringify(i))===0:s===i;var we=s=>({costs:s.getCosts(),fees:s.getFees(),interests:s.getInterests(),durationSpec:s.getDurationSpec(),downPaymentSpec:s.getDownPaymentSpec(),residualValueSpec:s.getResidualValueSpec(),totalResidualValue:s.getTotalResidualValue(),publicURL:s.getPublicURL(),shouldUseCreditScoring:s.shouldUseCreditScoring(),financialProductCode:s.getFinancialProductCode(),price:s.getPrice(),creditAmount:s.getCreditAmount(),hasPrivacyPolicy:s.hasPrivacyPolicy(),privacyPolicyUrl:s.getPrivacyPolicyUrl()}),Zo=s=>({status:s.getStatus(),hasPendingSigning:s.hasPendingSigning(),hintCode:s.getHintCode(),signingMessage:s.getSigningMessage(),shouldRenewSigning:s.shouldRenewSigning(),isSigned:s.isSigned(),address:void 0,pendingScoring:s.hasPendingScoring(),isScored:s.isScored(),hasScoringError:s.hasScoringError(),scoringId:s.getScoringId(),recommendation:s.getRecommendation(),decision:s.getDecision(),isAccepted:s.isAccepted()}),Me=s=>({orderVehicle:s.getOrderVehicle(),accessories:s.getAccessories(),requiresDealerSelection:s.requiresDealerSelection(),dealerSites:s.getDealerSites(),paymentOptions:s.getPaymentOptions().map(e=>({...e,loanDetails:e.loanDetails?we(e.loanDetails):void 0})),deliveryOptions:s.getDeliveryOptions(),insuranceOption:s.getInsuranceOption(),orderConditions:s.getOrderConditions(),orderReturnConditions:s.getOrderReturnConditions(),conditionsPdfUri:s.getConditionsPdfUri(),contactInformation:s.getContactInformation(),allowsTradeIn:s.allowsTradeIn(),isUnavailable:s.isUnavailable(),isPaymentRequired:s.isPaymentRequired()}),ei=s=>({vehicle:s.getVehicle()});var it="RESET",ti=s=>i=>i({type:it,id:s}),at="SET_ORDER",xe=(s,i)=>e=>e({type:at,order:s,vehicle:i}),nt="SET_ID",si=s=>i=>i({type:nt,id:s}),rt="SET_CONTACT_EMAIL_AND_PHONE",oi=s=>i=>i({type:rt,value:s}),ct="SET_SOCIAL_ID_AND_ADDRESS",ii=(s,i,e)=>t=>t({type:ct,socialId:s,address:i,lastStage:e}),lt="SET_HOME_DELIVERY",ai=(s,i)=>e=>e({type:lt,homeDelivery:s,lastStage:i}),dt="SET_DEALER",ni=(s,i)=>e=>e({type:dt,dealer:s,lastStage:i}),mt="INIT_TRADE_IN",ri=s=>i=>i({type:mt,lastStage:s}),pt="SET_TRADE_IN",Ne=(s,i,e)=>t=>t({type:pt,lastStage:s,tradeIn:i,tradeInVehicle:e}),ut="SET_FINANCIAL",ci=(s,i)=>e=>e({type:ut,paymentType:s,lastStage:i}),ht="SET_PAYMENT_LOOKUP_RESPONSE",li=s=>i=>i({type:ht,paymentLookupResponse:we(s)}),kt="SET_DRIVING_DISTANCE",di=s=>i=>i({type:kt,drivingDistance:s}),yt="COMPLETE_STAGE",Z=s=>i=>i({type:yt,lastStage:s}),vt="SET_OR_REMOVE_INSURANCE",de=s=>i=>i({type:vt,insurance:s}),Et="SET_OR_REMOVE_INSURANCE_ADDONS",mi=(s,i)=>e=>e({type:Et,insurance:s,insuranceAddons:i}),It="SET_OR_REMOVE_FREE_INSURANCE",pi=s=>i=>i({type:It,freeInsurance:s}),ft="SET_OR_REMOVE_ACCESSORY",ui=s=>i=>i({type:ft,accessory:s}),gt="GO_TO",$=(s,i,e)=>t=>t({type:gt,view:s,index:i,subStage:e}),_t="SET_STAGES",hi=s=>i=>i({type:_t,stages:s}),St="SET_CREATED_ORDER_ID",ki=(s,i)=>e=>e({type:St,id:s,payment:i}),wt="SET_CREDIT_ASSESSMENT_RESPONSE",me=(s,i)=>e=>e({type:wt,caseId:s,creditAssessmentResponse:i}),Nt="SET_STATE",yi=s=>i=>i({type:Nt,state:s});var el={};var vi={view:"preview",stage:1,subStage:1},Ei={id:"",topNavigation:{...vi},navigation:{...vi},customer:{email:"",phone:"",givenName:"",surname:"",socialId:""},homeDelivery:!1,accessories:[],drivingDistance:Ae.DrivingDistance.Between0And1000,...el},ne=(s,i)=>i?{view:"summary",stage:1,subStage:1}:{view:"main",stage:s+1,subStage:1},re=(s,i)=>i.view==="main"?s.stage<i.stage?i:v.topNavigation:{...s,stage:s.stage+1},At=s=>s&&s?.length===1&&s?.[0].type===Ae.PaymentType.Cash?Ae.PaymentType.Cash:void 0,v,Tt,tl=(s=Ei,i)=>{let e,t;switch(v={...s},i.type){case it:return{...Ei,id:i.id};case _t:return{...v,stages:i.stages};case nt:return{...v,id:i.id};case at:return{...s,order:i.order,paymentType:At(i.order?.paymentOptions),vehicle:{...i.order.orderVehicle,...i.vehicle||{}}};case rt:let o={...v,customer:{...s.customer,email:i.value.email,phone:i.value.phone},navigation:{view:"main",stage:s.navigation.stage,subStage:2}};return delete o.wantTradeIn,delete o.tradeIn,delete o.tradeInVehicle,o.paymentType=At(s.order?.paymentOptions),delete o.paymentLookupResponse,delete o.insurance,delete o.insuranceAddOns,delete o.freeInsurance,delete o.dealer,o.accessories=[],o;case ct:return e=ne(v.navigation.stage,i.lastStage),t=re(v.topNavigation,e),v={...s,navigation:e,topNavigation:t,address:i.address,customer:{...s.customer,socialId:i.socialId}},v;case dt:return e=ne(s.navigation.stage,i.lastStage),t={...e},v={...s,navigation:e,topNavigation:t,dealer:i.dealer},delete v.wantTradeIn,delete v.tradeIn,delete v.tradeInVehicle,v.paymentType=At(s.order?.paymentOptions),delete v.paymentLookupResponse,delete v.insurance,delete v.insuranceAddOns,delete v.freeInsurance,v.accessories=[],v;case lt:return e=ne(s.navigation.stage,i.lastStage),t=re(v.topNavigation,e),v={...s,navigation:e,topNavigation:t,homeDelivery:i.homeDelivery},v;case mt:return e={view:"main",stage:s.navigation.stage,subStage:1},t=re(v.topNavigation,e),v={...s,navigation:e,wantTradeIn:!0,topNavigation:t,tradeIn:s.tradeIn||{registrationNumber:"",mileage:"",description:""}},v;case pt:return e=ne(s.navigation.stage,i.lastStage),t=re(v.topNavigation,e),v={...s,navigation:e,topNavigation:t,wantTradeIn:!!i.tradeIn,tradeIn:i.tradeIn,tradeInVehicle:i.tradeInVehicle},v;case ut:return e=ne(s.navigation.stage,i.lastStage),t=re(v.topNavigation,e),{...v,navigation:e,topNavigation:t,paymentType:i.paymentType};case ht:return{...v,paymentLookupResponse:i.paymentLookupResponse};case kt:return{...v,drivingDistance:i.drivingDistance};case yt:return e=ne(s.navigation.stage,i.lastStage),t=re(v.topNavigation,e),v={...s,navigation:e,topNavigation:t},v;case Et:return v.insurance=i.insurance,v.insuranceAddOns={insurance:i.insurance.name,addOns:i.insuranceAddons},v;case vt:return ot(v.insurance,i.insurance)?v.insurance=void 0:v.insurance=i.insurance,v.insuranceAddOns?.insurance&&(v.insuranceAddOns=void 0),v;case It:return ot(v.freeInsurance,i.freeInsurance)?v.freeInsurance=void 0:v.freeInsurance=i.freeInsurance,v;case ft:return Tt=v.accessories.findIndex(a=>a.id===i.accessory.id),v.accessories=[...v.accessories],Tt>-1?v.accessories.splice(Tt,1):v.accessories.push(i.accessory),{...v,accessories:[...v.accessories]};case gt:return{...s,navigation:{view:i.view,stage:i.index||1,subStage:i.subStage||1}};case St:return i.payment?e={view:"main",stage:s.navigation.stage,subStage:2}:e=ne(s.navigation.stage,!0),t=re(v.topNavigation,e),v={...s,navigation:e,topNavigation:t,createdOrderId:i.id,payment:i.payment},v;case wt:return{...v,caseId:i.caseId,creditAssessmentResponse:i.creditAssessmentResponse};case Nt:return{...i.state};default:return s}},Ii=tl;var gi=()=>(0,fi.createStore)(Ii);var Pe=(s,i)=>{if(!i)return s;let e=new URL(s);return`${i}${e.pathname}`};var sl=s=>s.toString().replace(/\s/g,""),ol=(s,i)=>{if(!i)return s;let e=Math.pow(10,i);return(Math.round(s*e)/e).toFixed(i)},k=(s,i)=>{if(s===void 0)return"???";let e=ol(s,i?.decimals!==void 0?i.decimals:0);return`${i?.prefix?`${i.prefix}`:""}${sl(e).replace(/\B(?=(\d{3})+(?!\d))/g," ")}${i?.postfix?` ${i.postfix}`:""}`},il=(s,i)=>{let e=s.split(" "),t=i.split(" ").map(o=>o.toLowerCase());return e.filter(o=>!t.includes(o.toLowerCase())).join(" ")},pe=s=>{if(!!s)return il(s.shortDescription||"",s.title||"")};var al=({vehicle:s,order:i,meta:e,cdnMedia:t})=>{let o=s?.imageUrls,a=s?.title,n=k(s?.price||NaN),l=i?.contactInformation?.name;return`
1
+ "use strict";(()=>{var Yc=Object.create;var Jo=Object.defineProperty;var Kc=Object.getOwnPropertyDescriptor;var Qc=Object.getOwnPropertyNames;var zc=Object.getPrototypeOf,jc=Object.prototype.hasOwnProperty;var f=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(i,e)=>(typeof require<"u"?require:i)[e]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+s+'" is not supported')});var Jc=(s,i,e,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of Qc(i))!jc.call(s,o)&&o!==e&&Jo(s,o,{get:()=>i[o],enumerable:!(t=Kc(i,o))||t.enumerable});return s};var Xc=(s,i,e)=>(e=s!=null?Yc(zc(s)):{},Jc(i||!s||!s.__esModule?Jo(e,"default",{value:s,enumerable:!0}):e,s));var Fc=f("@wayke-se/ecom");var Xo={name:"@wayke-se/ecom-web",version:"1.5.1-beta.3",description:"Wayke Ecom Web",module:"dist/index.mjs",main:"dist/index.js",types:"dist/index.d.ts",homepage:"https://github.com/wayke-se/wayke-ecom-web",scripts:{start:"node ./esbuild/start.js",clip:"node ./esbuild/clip-ui.js && node ./clip-ui/start.js",build:"npm run clean && node ./esbuild/lib.js && node ./esbuild/cdn.js",clean:"rimraf build && rimraf dist && rimraf dist-cdn",test:"npm run lint && npm run typecheck",typecheck:"tsc -noEmit","typecheck:watch":"tsc -noEmit -watch",lint:"eslint --ext .ts,.js 'src'","lint:fix":"eslint --ext .ts,.js 'src' --fix",stylelint:"stylelint '**/*.scss'",prepare:"husky install"},author:"Wayke",license:"ISC",devDependencies:{"@ourstudio/clip-ui":"^0.0.11","@types/marked":"^4.3.0","@types/node":"^17.0.18","@types/object-path":"^0.11.1","@types/sanitize-html":"^2.6.2","@typescript-eslint/eslint-plugin":"^5.12.0","@typescript-eslint/parser":"^5.12.0",esbuild:"^0.15.10","esbuild-sass-plugin":"2.3.3",eslint:"^8.9.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0",husky:"^8.0.1","npm-dts":"^1.3.11",prettier:"^2.5.1",rimraf:"^5.0.1",stylelint:"^15.2.0","stylelint-config-prettier-scss":"^1.0.0","stylelint-config-standard-scss":"^9.0.0",typescript:"^5.1.3"},dependencies:{"@wayke-se/ecom":"^4.4.0-beta.5",marked:"^4.3.0","object-path":"^0.11.8",redux:"^4.1.2","sanitize-html":"^2.7.0"},files:["dist"]};var fi=f("redux");var Ae=f("@wayke-se/ecom");var ot=(s,i)=>s!==void 0&&i!==void 0?JSON.stringify(s).localeCompare(JSON.stringify(i))===0:s===i;var we=s=>({costs:s.getCosts(),fees:s.getFees(),interests:s.getInterests(),durationSpec:s.getDurationSpec(),downPaymentSpec:s.getDownPaymentSpec(),residualValueSpec:s.getResidualValueSpec(),totalResidualValue:s.getTotalResidualValue(),publicURL:s.getPublicURL(),shouldUseCreditScoring:s.shouldUseCreditScoring(),financialProductCode:s.getFinancialProductCode(),price:s.getPrice(),creditAmount:s.getCreditAmount(),hasPrivacyPolicy:s.hasPrivacyPolicy(),privacyPolicyUrl:s.getPrivacyPolicyUrl()}),Zo=s=>({status:s.getStatus(),hasPendingSigning:s.hasPendingSigning(),hintCode:s.getHintCode(),signingMessage:s.getSigningMessage(),shouldRenewSigning:s.shouldRenewSigning(),isSigned:s.isSigned(),address:void 0,pendingScoring:s.hasPendingScoring(),isScored:s.isScored(),hasScoringError:s.hasScoringError(),scoringId:s.getScoringId(),recommendation:s.getRecommendation(),decision:s.getDecision(),isAccepted:s.isAccepted()}),Me=s=>({orderVehicle:s.getOrderVehicle(),accessories:s.getAccessories(),requiresDealerSelection:s.requiresDealerSelection(),dealerSites:s.getDealerSites(),paymentOptions:s.getPaymentOptions().map(e=>({...e,loanDetails:e.loanDetails?we(e.loanDetails):void 0})),deliveryOptions:s.getDeliveryOptions(),insuranceOption:s.getInsuranceOption(),orderConditions:s.getOrderConditions(),orderReturnConditions:s.getOrderReturnConditions(),conditionsPdfUri:s.getConditionsPdfUri(),contactInformation:s.getContactInformation(),allowsTradeIn:s.allowsTradeIn(),isUnavailable:s.isUnavailable(),isPaymentRequired:s.isPaymentRequired()}),ei=s=>({vehicle:s.getVehicle()});var it="RESET",ti=s=>i=>i({type:it,id:s}),at="SET_ORDER",xe=(s,i)=>e=>e({type:at,order:s,vehicle:i}),nt="SET_ID",si=s=>i=>i({type:nt,id:s}),rt="SET_CONTACT_EMAIL_AND_PHONE",oi=s=>i=>i({type:rt,value:s}),ct="SET_SOCIAL_ID_AND_ADDRESS",ii=(s,i,e)=>t=>t({type:ct,socialId:s,address:i,lastStage:e}),lt="SET_HOME_DELIVERY",ai=(s,i)=>e=>e({type:lt,homeDelivery:s,lastStage:i}),dt="SET_DEALER",ni=(s,i)=>e=>e({type:dt,dealer:s,lastStage:i}),mt="INIT_TRADE_IN",ri=s=>i=>i({type:mt,lastStage:s}),pt="SET_TRADE_IN",Ne=(s,i,e)=>t=>t({type:pt,lastStage:s,tradeIn:i,tradeInVehicle:e}),ut="SET_FINANCIAL",ci=(s,i)=>e=>e({type:ut,paymentType:s,lastStage:i}),ht="SET_PAYMENT_LOOKUP_RESPONSE",li=s=>i=>i({type:ht,paymentLookupResponse:we(s)}),kt="SET_DRIVING_DISTANCE",di=s=>i=>i({type:kt,drivingDistance:s}),yt="COMPLETE_STAGE",Z=s=>i=>i({type:yt,lastStage:s}),vt="SET_OR_REMOVE_INSURANCE",de=s=>i=>i({type:vt,insurance:s}),Et="SET_OR_REMOVE_INSURANCE_ADDONS",mi=(s,i)=>e=>e({type:Et,insurance:s,insuranceAddons:i}),It="SET_OR_REMOVE_FREE_INSURANCE",pi=s=>i=>i({type:It,freeInsurance:s}),ft="SET_OR_REMOVE_ACCESSORY",ui=s=>i=>i({type:ft,accessory:s}),gt="GO_TO",H=(s,i,e)=>t=>t({type:gt,view:s,index:i,subStage:e}),_t="SET_STAGES",hi=s=>i=>i({type:_t,stages:s}),St="SET_CREATED_ORDER_ID",ki=(s,i)=>e=>e({type:St,id:s,payment:i}),wt="SET_CREDIT_ASSESSMENT_RESPONSE",me=(s,i)=>e=>e({type:wt,caseId:s,creditAssessmentResponse:i}),Nt="SET_STATE",yi=s=>i=>i({type:Nt,state:s});var el={};var vi={view:"preview",stage:1,subStage:1},Ei={id:"",topNavigation:{...vi},navigation:{...vi},customer:{email:"",phone:"",givenName:"",surname:"",socialId:""},homeDelivery:!1,accessories:[],drivingDistance:Ae.DrivingDistance.Between0And1000,...el},ne=(s,i)=>i?{view:"summary",stage:1,subStage:1}:{view:"main",stage:s+1,subStage:1},re=(s,i)=>i.view==="main"?s.stage<i.stage?i:v.topNavigation:{...s,stage:s.stage+1},At=s=>s&&s?.length===1&&s?.[0].type===Ae.PaymentType.Cash?Ae.PaymentType.Cash:void 0,v,Tt,tl=(s=Ei,i)=>{let e,t;switch(v={...s},i.type){case it:return{...Ei,id:i.id};case _t:return{...v,stages:i.stages};case nt:return{...v,id:i.id};case at:return{...s,order:i.order,paymentType:At(i.order?.paymentOptions),vehicle:{...i.order.orderVehicle,...i.vehicle||{}}};case rt:let o={...v,customer:{...s.customer,email:i.value.email,phone:i.value.phone},navigation:{view:"main",stage:s.navigation.stage,subStage:2}};return delete o.wantTradeIn,delete o.tradeIn,delete o.tradeInVehicle,o.paymentType=At(s.order?.paymentOptions),delete o.paymentLookupResponse,delete o.insurance,delete o.insuranceAddOns,delete o.freeInsurance,delete o.dealer,o.accessories=[],o;case ct:return e=ne(v.navigation.stage,i.lastStage),t=re(v.topNavigation,e),v={...s,navigation:e,topNavigation:t,address:i.address,customer:{...s.customer,socialId:i.socialId}},v;case dt:return e=ne(s.navigation.stage,i.lastStage),t={...e},v={...s,navigation:e,topNavigation:t,dealer:i.dealer},delete v.wantTradeIn,delete v.tradeIn,delete v.tradeInVehicle,v.paymentType=At(s.order?.paymentOptions),delete v.paymentLookupResponse,delete v.insurance,delete v.insuranceAddOns,delete v.freeInsurance,v.accessories=[],v;case lt:return e=ne(s.navigation.stage,i.lastStage),t=re(v.topNavigation,e),v={...s,navigation:e,topNavigation:t,homeDelivery:i.homeDelivery},v;case mt:return e={view:"main",stage:s.navigation.stage,subStage:1},t=re(v.topNavigation,e),v={...s,navigation:e,wantTradeIn:!0,topNavigation:t,tradeIn:s.tradeIn||{registrationNumber:"",mileage:"",description:""}},v;case pt:return e=ne(s.navigation.stage,i.lastStage),t=re(v.topNavigation,e),v={...s,navigation:e,topNavigation:t,wantTradeIn:!!i.tradeIn,tradeIn:i.tradeIn,tradeInVehicle:i.tradeInVehicle},v;case ut:return e=ne(s.navigation.stage,i.lastStage),t=re(v.topNavigation,e),{...v,navigation:e,topNavigation:t,paymentType:i.paymentType};case ht:return{...v,paymentLookupResponse:i.paymentLookupResponse};case kt:return{...v,drivingDistance:i.drivingDistance};case yt:return e=ne(s.navigation.stage,i.lastStage),t=re(v.topNavigation,e),v={...s,navigation:e,topNavigation:t},v;case Et:return v.insurance=i.insurance,v.insuranceAddOns={insurance:i.insurance.name,addOns:i.insuranceAddons},v;case vt:return ot(v.insurance,i.insurance)?v.insurance=void 0:v.insurance=i.insurance,v.insuranceAddOns?.insurance&&(v.insuranceAddOns=void 0),v;case It:return ot(v.freeInsurance,i.freeInsurance)?v.freeInsurance=void 0:v.freeInsurance=i.freeInsurance,v;case ft:return Tt=v.accessories.findIndex(a=>a.id===i.accessory.id),v.accessories=[...v.accessories],Tt>-1?v.accessories.splice(Tt,1):v.accessories.push(i.accessory),{...v,accessories:[...v.accessories]};case gt:return{...s,navigation:{view:i.view,stage:i.index||1,subStage:i.subStage||1}};case St:return i.payment?e={view:"main",stage:s.navigation.stage,subStage:2}:e=ne(s.navigation.stage,!0),t=re(v.topNavigation,e),v={...s,navigation:e,topNavigation:t,createdOrderId:i.id,payment:i.payment},v;case wt:return{...v,caseId:i.caseId,creditAssessmentResponse:i.creditAssessmentResponse};case Nt:return{...i.state};default:return s}},Ii=tl;var gi=()=>(0,fi.createStore)(Ii);var Pe=(s,i)=>{if(!i)return s;let e=new URL(s);return`${i}${e.pathname}`};var sl=s=>s.toString().replace(/\s/g,""),ol=(s,i)=>{if(!i)return s;let e=Math.pow(10,i);return(Math.round(s*e)/e).toFixed(i)},k=(s,i)=>{if(s===void 0)return"???";let e=ol(s,i?.decimals!==void 0?i.decimals:0);return`${i?.prefix?`${i.prefix}`:""}${sl(e).replace(/\B(?=(\d{3})+(?!\d))/g," ")}${i?.postfix?` ${i.postfix}`:""}`},il=(s,i)=>{let e=s.split(" "),t=i.split(" ").map(o=>o.toLowerCase());return e.filter(o=>!t.includes(o.toLowerCase())).join(" ")},pe=s=>{if(!!s)return il(s.shortDescription||"",s.title||"")};var al=({vehicle:s,order:i,meta:e,cdnMedia:t})=>{let o=s?.imageUrls,a=s?.title,n=k(s?.price||NaN),l=i?.contactInformation?.name;return`
2
2
  <div class="waykeecom-product-card">
3
3
  ${o?.length?`
4
4
  <div class="waykeecom-product-card__media">
@@ -146,7 +146,7 @@
146
146
  </h3>
147
147
  </header>
148
148
  <div class="waykeecom-stepper__body"></div>
149
- `,n||s.appendChild(l);let m=l.querySelector(".waykeecom-stepper__body");if(!m)throw"Err no element";return m},H=vl;var Ve=[],Ai=s=>{Ve.push(s)},Ti=s=>{let i=Ve.findIndex(e=>e===s);i>-1&&Ve.splice(i,1)},Ot=[],Te=()=>Ot[Ot.length-1],El=(s,i,e,t)=>{Ot.push({view:s,ecomEvent:i,currentStep:e}),Ve.forEach(o=>o(s,i,e,t))},d=El;var Mt=class extends r{constructor(e,t){super(e);this.props=t,this.render()}hide(e){this.props.hide!==e&&(this.props.hide=e,this.render())}render(){if(this.props.hide){this.node.innerHTML="";return}let{title:e,dataIcon:t,path:o}=this.props.direction==="left"?{title:"Visa f\xF6reg\xE5ende",dataIcon:"Chevron left",path:'<path d="m5.4 7 5.2-5 1 1-5.2 5 5.2 5-1.1 1-5.2-5-1-1 1.1-1z" />'}:{title:"Visa n\xE4sta",dataIcon:"Chevron right",path:'<path d="m10.5 9-5.2 5-1-1 5.2-5-5.2-5 1.1-1 5.2 5 1 1-1.1 1z" />'};this.node.innerHTML=`
149
+ `,n||s.appendChild(l);let m=l.querySelector(".waykeecom-stepper__body");if(!m)throw"Err no element";return m},B=vl;var Ve=[],Ai=s=>{Ve.push(s)},Ti=s=>{let i=Ve.findIndex(e=>e===s);i>-1&&Ve.splice(i,1)},Ot=[],Te=()=>Ot[Ot.length-1],El=(s,i,e,t)=>{Ot.push({view:s,ecomEvent:i,currentStep:e}),Ve.forEach(o=>o(s,i,e,t))},d=El;var Mt=class extends r{constructor(e,t){super(e);this.props=t,this.render()}hide(e){this.props.hide!==e&&(this.props.hide=e,this.render())}render(){if(this.props.hide){this.node.innerHTML="";return}let{title:e,dataIcon:t,path:o}=this.props.direction==="left"?{title:"Visa f\xF6reg\xE5ende",dataIcon:"Chevron left",path:'<path d="m5.4 7 5.2-5 1 1-5.2 5 5.2 5-1.1 1-5.2-5-1-1 1.1-1z" />'}:{title:"Visa n\xE4sta",dataIcon:"Chevron right",path:'<path d="m10.5 9-5.2 5-1-1 5.2-5-5.2-5 1.1-1 5.2 5 1 1-1.1 1z" />'};this.node.innerHTML=`
150
150
  <button type="button" title="${e}" class="waykeecom-icon-button">
151
151
  <svg
152
152
  xmlns="http://www.w3.org/2000/svg"
@@ -295,7 +295,7 @@
295
295
  <div class="waykeecom-stack waykeecom-stack--1" id="${Mi}"></div>
296
296
  <div class="waykeecom-stack waykeecom-stack--1" id="${Oi}"></div>
297
297
  </div>
298
- `,new bi(this.node.querySelector(`#${xi}`),{id:`gallery-${e.id}`,media:l.map((y,g)=>({url:y.url,alt:`Bild ${g+1}`})),onGalleryImagePaging:()=>this.onGalleryImagePaging()}),new ce(this.node.querySelector(`#${Li}`),{title:"Tillbaka",onClick:()=>a()}),new te(this.node.querySelector(`#${Oi}`),{title:"Tillbaka",onClick:()=>a()}),new ee(this.node.querySelector(`#${Mi}`),{selected:t,fullSize:!0,onClick:()=>o()}),G()}},Pi=Wt;var Yt=class extends r{constructor(e,t){super(e);this.displayInfo=!1;this.exposureTracked=!1;this.props=t,_(this.props.store,"accessories",(o,a)=>{o.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,O(),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}),ui(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:o}=this.props,n=e.getState().accessories.findIndex(l=>l.id===t.id)>-1;this.displayInfo&&new Pi(Q(),{accessory:t,selected:n,onClick:()=>{this.onInfoClose(),this.onClick()},onClose:()=>this.onInfoClose()}),new he(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()},o)}},$i=Yt;var Kt=class extends r{constructor(e,t){super(e);this.props=t,this.render()}render(){let{accessories:e,store:t}=this.props,o=new ue(this.node,{id:"accessories-list",onClick:()=>d("MAIN","ACCESSORY_ARROWS","ACCESSORY")}),{overflowElement:a}=o;a&&(a.innerHTML="",e.forEach((n,l)=>new $i(a,{store:t,accessory:n,key:`accessory-${n.id}-${l}`})))}},Hi=Kt;var Vi="button-accessories-proceed",Bi=`${Vi}-node`,Sl="button-accessories-skip",Fi=`${Sl}-node`,Ui="accessory-grid-list-node",Qt=class extends r{constructor(e,t){super(e);this.props=t,_(this.props.store,"navigation",()=>{this.render()}),this.render()}onProceed(){Z(this.props.lastStage)(this.props.store.dispatch)}onEdit(){d("MAIN","ACCESSORY_EDIT","ACCESSORY"),$("main",this.props.index)(this.props.store.dispatch)}render(){let{store:e,index:t}=this.props,o=e.getState(),a=o.topNavigation.stage>t,n=o.navigation.stage===t;n&&d("MAIN","ACCESSORY_ACTIVE","ACCESSORY");let l=H(this.node,{completed:a,title:"Tillbeh\xF6r",active:n,id:"accessories"}),c=document.createElement("div");if(o.navigation.stage>t||a&&o.navigation.stage!==t)new j(l,{keyValueList:o.accessories.length?o.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:o.createdOrderId?void 0:()=>this.onEdit()});else if(o.navigation.stage===t){let m=o.order?.accessories||[];c.innerHTML=`
298
+ `,new bi(this.node.querySelector(`#${xi}`),{id:`gallery-${e.id}`,media:l.map((y,g)=>({url:y.url,alt:`Bild ${g+1}`})),onGalleryImagePaging:()=>this.onGalleryImagePaging()}),new ce(this.node.querySelector(`#${Li}`),{title:"Tillbaka",onClick:()=>a()}),new te(this.node.querySelector(`#${Oi}`),{title:"Tillbaka",onClick:()=>a()}),new ee(this.node.querySelector(`#${Mi}`),{selected:t,fullSize:!0,onClick:()=>o()}),G()}},Pi=Wt;var Yt=class extends r{constructor(e,t){super(e);this.displayInfo=!1;this.exposureTracked=!1;this.props=t,_(this.props.store,"accessories",(o,a)=>{o.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,O(),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}),ui(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:o}=this.props,n=e.getState().accessories.findIndex(l=>l.id===t.id)>-1;this.displayInfo&&new Pi(Q(),{accessory:t,selected:n,onClick:()=>{this.onInfoClose(),this.onClick()},onClose:()=>this.onInfoClose()}),new he(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()},o)}},$i=Yt;var Kt=class extends r{constructor(e,t){super(e);this.props=t,this.render()}render(){let{accessories:e,store:t}=this.props,o=new ue(this.node,{id:"accessories-list",onClick:()=>d("MAIN","ACCESSORY_ARROWS","ACCESSORY")}),{overflowElement:a}=o;a&&(a.innerHTML="",e.forEach((n,l)=>new $i(a,{store:t,accessory:n,key:`accessory-${n.id}-${l}`})))}},Hi=Kt;var Vi="button-accessories-proceed",Bi=`${Vi}-node`,Sl="button-accessories-skip",Fi=`${Sl}-node`,Ui="accessory-grid-list-node",Qt=class extends r{constructor(e,t){super(e);this.props=t,_(this.props.store,"navigation",()=>{this.render()}),this.render()}onProceed(){Z(this.props.lastStage)(this.props.store.dispatch)}onEdit(){d("MAIN","ACCESSORY_EDIT","ACCESSORY"),H("main",this.props.index)(this.props.store.dispatch)}render(){let{store:e,index:t}=this.props,o=e.getState(),a=o.topNavigation.stage>t,n=o.navigation.stage===t;n&&d("MAIN","ACCESSORY_ACTIVE","ACCESSORY");let l=B(this.node,{completed:a,title:"Tillbeh\xF6r",active:n,id:"accessories"}),c=document.createElement("div");if(o.navigation.stage>t||a&&o.navigation.stage!==t)new j(l,{keyValueList:o.accessories.length?o.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:o.createdOrderId?void 0:()=>this.onEdit()});else if(o.navigation.stage===t){let m=o.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 @@
381
381
  ${i}
382
382
  </div>
383
383
  </div>
384
- `,I=wl;var zi="button-central-storage-proceed",Ki=`${zi}-node`,Nl="central-storage-branch",Qi=`${Nl}-node`,Zt=class extends r{constructor(e,t){super(e);this.requestError=!1;this.contexts={};this.props=t,_(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:o}=this.props.store.getState();try{this.contexts.proceedButton?.loading(!0);let a=await Be(t,e);d("MAIN","CENTRAL_STORAGE_SET","CENTRAL_STORAGE"),xe(Me(a),o),ni(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 o=e.currentTarget.value;this.selectedDealer=o,this.contexts.proceedButton?.disabled(!1),d("MAIN","CENTRAL_STORAGE_SELECTED","CENTRAL_STORAGE")}onEdit(){d("MAIN","CENTRAL_STORAGE_EDIT","CENTRAL_STORAGE"),$("main",this.props.index)(this.props.store.dispatch)}onProceed(){this.selectedDealer&&this.updateOrder(this.selectedDealer)}render(){let{order:e,navigation:t,topNavigation:o,createdOrderId:a}=this.props.store.getState(),{index:n}=this.props,l=e?.dealerSites||[],c=o.stage>n,m=t.stage===n;m&&d("MAIN","CENTRAL_STORAGE_ACTIVE","CENTRAL_STORAGE");let u=H(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 j(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=wl;var zi="button-central-storage-proceed",Ki=`${zi}-node`,Nl="central-storage-branch",Qi=`${Nl}-node`,Zt=class extends r{constructor(e,t){super(e);this.requestError=!1;this.contexts={};this.props=t,_(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:o}=this.props.store.getState();try{this.contexts.proceedButton?.loading(!0);let a=await Be(t,e);d("MAIN","CENTRAL_STORAGE_SET","CENTRAL_STORAGE"),xe(Me(a),o),ni(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 o=e.currentTarget.value;this.selectedDealer=o,this.contexts.proceedButton?.disabled(!1),d("MAIN","CENTRAL_STORAGE_SELECTED","CENTRAL_STORAGE")}onEdit(){d("MAIN","CENTRAL_STORAGE_EDIT","CENTRAL_STORAGE"),H("main",this.props.index)(this.props.store.dispatch)}onProceed(){this.selectedDealer&&this.updateOrder(this.selectedDealer)}render(){let{order:e,navigation:t,topNavigation:o,createdOrderId:a}=this.props.store.getState(),{index:n}=this.props,l=e?.dealerSites||[],c=o.stage>n,m=t.stage===n;m&&d("MAIN","CENTRAL_STORAGE_ACTIVE","CENTRAL_STORAGE");let u=B(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 j(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 @@
413
413
  </div>
414
414
  </div>
415
415
  </div>
416
- </div>`}});new z(u.querySelector(`#${Qi}`),{checked:this.selectedDealer,name:"dealer",options:h,onClick:p=>this.onChange(p)}),this.contexts.proceedButton=new N(u.querySelector(`#${Ki}`),{title:"G\xE5 vidare",id:zi,disabled:!this.selectedDealer,onClick:()=>this.onProceed()})}t.stage===n&&u.parentElement?.scrollIntoView()}},ji=Zt;var ie=s=>s.length<2?s:s.length===2?`${s.substring(0,1)}***`:s.length===3?`${s.substring(0,2)}***`:`${s.substring(0,3)}***`,qe=s=>`${s.substring(0,s.length-4)}****`;var es=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:o,name:a,min:n,value:l,autocomplete:c,placeholder:m,unit:u,error:h,errorMessage:p,information:y,pattern:g,inputmode:w,onChange:R,onBlur:P,onClickInformation:X}=this.props;this.node.innerHTML=`
416
+ </div>`}});new z(u.querySelector(`#${Qi}`),{checked:this.selectedDealer,name:"dealer",options:h,onClick:p=>this.onChange(p)}),this.contexts.proceedButton=new N(u.querySelector(`#${Ki}`),{title:"G\xE5 vidare",id:zi,disabled:!this.selectedDealer,onClick:()=>this.onProceed()})}t.stage===n&&u.parentElement?.scrollIntoView()}},ji=Zt;var ie=s=>s.length<2?s:s.length===2?`${s.substring(0,1)}***`:s.length===3?`${s.substring(0,2)}***`:`${s.substring(0,3)}***`,qe=s=>`${s.substring(0,s.length-4)}****`;var es=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:o,name:a,min:n,value:l,autocomplete:c,placeholder:m,unit:u,error:h,errorMessage:p,information:y,pattern:g,inputmode:w,onChange:R,onBlur:$,onClickInformation:X}=this.props;this.node.innerHTML=`
417
417
  <div class="waykeecom-input-label">
418
418
  <label for="${e}" class="waykeecom-input-label__label">${t}</label>
419
419
  </div>
@@ -433,7 +433,7 @@
433
433
  />
434
434
  ${u?`<div class="waykeecom-input-text__unit">${u}</div>`:""}
435
435
  </div>
436
- `,this.updateBorder(),p&&(this.contexts.error=new se(this.node,{error:h,errorMessage:p})),y&&new oe(this.node.querySelector(".waykeecom-input-label"),{information:y,onClickInformation:X});let L=this.node.querySelector("input");L&&(R&&L.addEventListener("input",R),P&&L.addEventListener("blur",P))}},M=es;var Ji=/\S+@\S+\.\S+/,Xi=/^[0-9\-\+\(\)\ ]+$/,Zi=/^[0-9\ \-]+$/,ea=/^(19|20)(\d{6}(-|\s)\d{4}|(?!19|20)\d{10})$/,ta=/[a-zA-Z]{3}\d{2}(d||[a-zA-Z]){1}/,We=/\D/g;var C={requiredEmail:s=>Ji.test(s),requiredTelephone:s=>Xi.test(s),requiredSsn:s=>ea.test(s),requiredSsnOver18:s=>{if(C.requiredSsn(s)){let e=s.replace(We,"").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:s=>Zi.test(s),requiredNumberOrStringNumberInRange:(s,i,e)=>{let t=parseInt(s.toString(),10);return isNaN(t)?!1:t>=i&&t<=e},requiredNumber:s=>s!=null&&!Number.isNaN(+s),requiredNumberGreaterOrEqualThanZero:s=>{if(s==null)return!1;let i=parseInt(s.toString(),10);return!Number.isNaN(i)&&i>=0},optionalNumberGreaterOrEqualThanZero:s=>{if(s==null||typeof s=="string"&&!s)return!0;let i=parseInt(s.toString(),10);return!Number.isNaN(i)&&i>=0},optionalNumber:s=>s==null||!Number.isNaN(+s),requiredRegistrationNumber:s=>{if(!s)return!1;let i=s.replace(" ",""),e=i.length===6,t=ta.test(i);return e&&t},requiredMileage:s=>C.requiredNumberOrStringNumberInRange(s||"",0,8e4),optionalString:s=>!!s||!s,requiredCondition:s=>["VeryGood","Good","Ok"].includes(s||""),requiredAssessmentMaritalStatus:s=>["married","single","commonLaw"].includes(s||""),requiredAssessmentEmplyment:s=>["other","retired","fullTimeEmployed","student","temporarilyEmployed","selfEmployed"].includes(s||""),requiredHousingType:s=>["singleFamily","condominium","apartment"].includes(s||"")};var sa="contact-email-node",Al="contact-email",oa="contact-phone-node",Tl="contact-phone",ia="contact-proceed-node",Cl="contact-proceed",Ye={email:C.requiredEmail,phone:C.requiredTelephone},Dl=s=>{let i={email:s?.email||"",phone:s?.phone||""};return{value:i,validation:{email:Ye.email(i.email),phone:Ye.phone(i.phone)},interact:{email:!1,phone:!1}}},ts=class extends r{constructor(e,t){super(e,{htmlTag:"div",className:"waykeecom-stack waykeecom-stack--2"});this.contexts={};this.props=t;let o=this.props.store.getState();this.state=Dl(o.customer),this.render()}onChange(e){let t=e.currentTarget,o=t.name,a=t.value;this.state.value[o]=a,this.state.validation[o]=Ye[o](a),this.updateUiError(o),this.updateProceedButton()}onBlur(e){let o=e.currentTarget.name;this.state.interact[o]=!0,this.state.validation[o]=Ye[o](this.state.value[o]),this.updateUiError(o),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"),oi({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 se(this.node,{error:h,errorMessage:p})),y&&new oe(this.node.querySelector(".waykeecom-input-label"),{information:y,onClickInformation:X});let L=this.node.querySelector("input");L&&(R&&L.addEventListener("input",R),$&&L.addEventListener("blur",$))}},M=es;var Ji=/\S+@\S+\.\S+/,Xi=/^[0-9\-\+\(\)\ ]+$/,Zi=/^[0-9\ \-]+$/,ea=/^(19|20)(\d{6}(-|\s)\d{4}|(?!19|20)\d{10})$/,ta=/[a-zA-Z]{3}\d{2}(d||[a-zA-Z]){1}/,We=/\D/g;var C={requiredEmail:s=>Ji.test(s),requiredTelephone:s=>Xi.test(s),requiredSsn:s=>ea.test(s),requiredSsnOver18:s=>{if(C.requiredSsn(s)){let e=s.replace(We,"").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:s=>Zi.test(s),requiredNumberOrStringNumberInRange:(s,i,e)=>{let t=parseInt(s.toString(),10);return isNaN(t)?!1:t>=i&&t<=e},requiredNumber:s=>s!=null&&!Number.isNaN(+s),requiredNumberGreaterOrEqualThanZero:s=>{if(s==null)return!1;let i=parseInt(s.toString(),10);return!Number.isNaN(i)&&i>=0},optionalNumberGreaterOrEqualThanZero:s=>{if(s==null||typeof s=="string"&&!s)return!0;let i=parseInt(s.toString(),10);return!Number.isNaN(i)&&i>=0},optionalNumber:s=>s==null||!Number.isNaN(+s),requiredRegistrationNumber:s=>{if(!s)return!1;let i=s.replace(" ",""),e=i.length===6,t=ta.test(i);return e&&t},requiredMileage:s=>C.requiredNumberOrStringNumberInRange(s||"",0,8e4),optionalString:s=>!!s||!s,requiredCondition:s=>["VeryGood","Good","Ok"].includes(s||""),requiredAssessmentMaritalStatus:s=>["married","single","commonLaw"].includes(s||""),requiredAssessmentEmplyment:s=>["other","retired","fullTimeEmployed","student","temporarilyEmployed","selfEmployed"].includes(s||""),requiredHousingType:s=>["singleFamily","condominium","apartment"].includes(s||"")};var sa="contact-email-node",Al="contact-email",oa="contact-phone-node",Tl="contact-phone",ia="contact-proceed-node",Cl="contact-proceed",Ye={email:C.requiredEmail,phone:C.requiredTelephone},Dl=s=>{let i={email:s?.email||"",phone:s?.phone||""};return{value:i,validation:{email:Ye.email(i.email),phone:Ye.phone(i.phone)},interact:{email:!1,phone:!1}}},ts=class extends r{constructor(e,t){super(e,{htmlTag:"div",className:"waykeecom-stack waykeecom-stack--2"});this.contexts={};this.props=t;let o=this.props.store.getState();this.state=Dl(o.customer),this.render()}onChange(e){let t=e.currentTarget,o=t.name,a=t.value;this.state.value[o]=a,this.state.validation[o]=Ye[o](a),this.updateUiError(o),this.updateProceedButton()}onBlur(e){let o=e.currentTarget.name;this.state.interact[o]=!0,this.state.validation[o]=Ye[o](this.state.value[o]),this.updateUiError(o),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"),oi({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=`
437
437
  <div class="waykeecom-stack waykeecom-stack--2">
438
438
  <ul class="waykeecom-key-value-list">
439
439
  ${t.map(o=>E(o)).join("")}
@@ -505,7 +505,7 @@
505
505
  ${a.map(n=>E(n)).join("")}
506
506
  </ul>
507
507
  </div>
508
- `}else this.node.innerHTML="",new da(this.node,{store:e,lastStage:t})}},ma=rs;var cs=class extends r{constructor(e,t){super(e);this.props=t,_(this.props.store,"navigation",()=>{this.render()}),this.render()}onChange(){d("MAIN","CUSTOMER_EDIT","CUSTOMER_EMAIL_AND_PHONE"),$("main",this.props.index)(this.props.store.dispatch)}render(){let{store:e,index:t,lastStage:o}=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=H(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:qe(a.customer.socialId)},...a.address?[{key:"Namn",value:`${ie(a.address.givenName)} ${ie(a.address.surname)}`},{key:"Adress",value:a.address.street},{key:"Postnummer",value:a.address.postalCode},{key:"Stad",value:a.address.city}]:[]];new j(c,{keyValueList:h,changeButtonTitle:"\xC4ndra dina uppgifter",onEdit:a.createdOrderId?void 0:()=>this.onChange()})}else a.navigation.stage===t&&(new aa(c,{store:e}),a.navigation.subStage>1&&new ma(c,{store:e,lastStage:o}));a.navigation.stage===t&&c.parentElement?.scrollIntoView()}},pa=cs;var ls=f("@wayke-se/ecom");var Ol=(s,i)=>{if(!!s)return s.unit==="m"&&i.unit==="km"?Math.round(s.value/1e3):s.unit==="km"&&i.unit==="m"?s.value*1e3:s.value},ua=(s,i)=>{let e=Ol(s,i);if(!!e&&!!i.unitPrice)return i.startupCost+i.unitPrice*e};var va="radio-home-delivery-true",ha=`${va}-node`,Ea="radio-home-delivery-false",ka=`${Ea}-node`,Ia="button-home-delivery-proceed",ya=`${Ia}-node`,ds=class extends r{constructor(e,t){super(e);this.props=t,_(this.props.store,"navigation",()=>{this.render()});let o=this.props.store.getState();this.homeDelivery=o.homeDelivery,this.render()}onChange(e){let o=e.currentTarget.value==="true";this.homeDelivery=o,d("MAIN",this.homeDelivery?"DELIVERY_HOME_SELECTED":"DELIVERY_DEALER_SELECTED","DELIVERY")}onProceed(){ai(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"),$("main",this.props.index)(this.props.store.dispatch)}render(){let{store:e,index:t}=this.props,o=e.getState();if(!o.order)throw"Missing order...";let a=o.order.contactInformation;if(!a)throw"Missing dealer contact information";let n=o.topNavigation.stage>t,l=o.navigation.stage===t;l&&d("MAIN","DELIVERY_ACTIVE","DELIVERY");let c=H(this.node,{completed:n,title:"Leverans",active:l,id:"delivery"});if(o.navigation.stage>t||n&&o.navigation.stage!==t)new j(c,{keyValueList:[{key:"Leveranss\xE4tt",value:o.homeDelivery?"Hemleverans":"H\xE4mta hos handlaren"}],changeButtonTitle:"\xC4ndra leveranss\xE4tt",onEdit:o.createdOrderId?void 0:()=>this.onEdit()});else if(o.navigation.stage===t){let m=document.createElement("div");m.innerHTML=`
508
+ `}else this.node.innerHTML="",new da(this.node,{store:e,lastStage:t})}},ma=rs;var cs=class extends r{constructor(e,t){super(e);this.props=t,_(this.props.store,"navigation",()=>{this.render()}),this.render()}onChange(){d("MAIN","CUSTOMER_EDIT","CUSTOMER_EMAIL_AND_PHONE"),H("main",this.props.index)(this.props.store.dispatch)}render(){let{store:e,index:t,lastStage:o}=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=B(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:qe(a.customer.socialId)},...a.address?[{key:"Namn",value:`${ie(a.address.givenName)} ${ie(a.address.surname)}`},{key:"Adress",value:a.address.street},{key:"Postnummer",value:a.address.postalCode},{key:"Stad",value:a.address.city}]:[]];new j(c,{keyValueList:h,changeButtonTitle:"\xC4ndra dina uppgifter",onEdit:a.createdOrderId?void 0:()=>this.onChange()})}else a.navigation.stage===t&&(new aa(c,{store:e}),a.navigation.subStage>1&&new ma(c,{store:e,lastStage:o}));a.navigation.stage===t&&c.parentElement?.scrollIntoView()}},pa=cs;var ls=f("@wayke-se/ecom");var Ol=(s,i)=>{if(!!s)return s.unit==="m"&&i.unit==="km"?Math.round(s.value/1e3):s.unit==="km"&&i.unit==="m"?s.value*1e3:s.value},ua=(s,i)=>{let e=Ol(s,i);if(!!e&&!!i.unitPrice)return i.startupCost+i.unitPrice*e};var va="radio-home-delivery-true",ha=`${va}-node`,Ea="radio-home-delivery-false",ka=`${Ea}-node`,Ia="button-home-delivery-proceed",ya=`${Ia}-node`,ds=class extends r{constructor(e,t){super(e);this.props=t,_(this.props.store,"navigation",()=>{this.render()});let o=this.props.store.getState();this.homeDelivery=o.homeDelivery,this.render()}onChange(e){let o=e.currentTarget.value==="true";this.homeDelivery=o,d("MAIN",this.homeDelivery?"DELIVERY_HOME_SELECTED":"DELIVERY_DEALER_SELECTED","DELIVERY")}onProceed(){ai(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"),H("main",this.props.index)(this.props.store.dispatch)}render(){let{store:e,index:t}=this.props,o=e.getState();if(!o.order)throw"Missing order...";let a=o.order.contactInformation;if(!a)throw"Missing dealer contact information";let n=o.topNavigation.stage>t,l=o.navigation.stage===t;l&&d("MAIN","DELIVERY_ACTIVE","DELIVERY");let c=B(this.node,{completed:n,title:"Leverans",active:l,id:"delivery"});if(o.navigation.stage>t||n&&o.navigation.stage!==t)new j(c,{keyValueList:[{key:"Leveranss\xE4tt",value:o.homeDelivery?"Hemleverans":"H\xE4mta hos handlaren"}],changeButtonTitle:"\xC4ndra leveranss\xE4tt",onEdit:o.createdOrderId?void 0:()=>this.onEdit()});else if(o.navigation.stage===t){let m=document.createElement("div");m.innerHTML=`
509
509
  <div class="waykeecom-stack waykeecom-stack--3">
510
510
  <h4 class="waykeecom-heading waykeecom-heading--4">Hur vill du ha din bil levererad?</h4>
511
511
  <div class="waykeecom-content">
@@ -543,9 +543,9 @@
543
543
  </div>
544
544
  </div>
545
545
  </div>
546
- `,meta:`<div class="waykeecom-text waykeecom-text--font-bold">${y===0?"Gratis":k(y,{postfix:"kr"})}</div>`,checked:!this.homeDelivery,onClick:P=>this.onChange(P)});break;case ls.DeliveryType.Delivery:let g=o.address?.distance?.value||0,w=h.unitPrice||0,R=g>w;new be(m.querySelector(`#${ha}`),{id:Ea,name:"homeDelivery",title:"Hemleverans",value:"true",disabled:R,description:`<div class="waykeecom-box">
546
+ `,meta:`<div class="waykeecom-text waykeecom-text--font-bold">${y===0?"Gratis":k(y,{postfix:"kr"})}</div>`,checked:!this.homeDelivery,onClick:$=>this.onChange($)});break;case ls.DeliveryType.Delivery:let g=o.address?.distance?.value||0,w=h.unitPrice||0,R=g>w;new be(m.querySelector(`#${ha}`),{id:Ea,name:"homeDelivery",title:"Hemleverans",value:"true",disabled:R,description:`<div class="waykeecom-box">
547
547
  <div class="waykeecom-stack waykeecom-stack--2">Till din folkbokf\xF6ringsadress</div>
548
- ${R?`<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">${R?"-":k(y,{postfix:"kr"})}</div>`,checked:this.homeDelivery,onClick:P=>this.onChange(P)});break;default:break}}),new N(m.querySelector(`#${ya}`),{title:"G\xE5 vidare",id:Ia,onClick:()=>this.onProceed()}),c.appendChild(m),o.navigation.stage===t&&c.parentElement?.scrollIntoView()}}},fa=ds;var F=f("@wayke-se/ecom");var ye=f("@wayke-se/ecom");var ve={bankid:"https://cdn.wayke.se/public-assets/bankid-logo.svg",illustrations:{payment:"https://cdn.wayke.se/public-assets/payment.svg"}},Ee={["VeryGood"]:"Mycket bra",["Good"]:"Bra",["Ok"]:"Ok"},J={[ye.DrivingDistance.Between0And1000]:"0\u20131000 mil",[ye.DrivingDistance.Between1000And1500]:"1000\u20131500 mil",[ye.DrivingDistance.Between1500And2000]:"1500\u20132000 mil",[ye.DrivingDistance.Between2000And2500]:"2000\u20132500 mil",[ye.DrivingDistance.Over2500]:"2500+ mil"};var xl=(s,i)=>i?Math.round(s/i)*i:s,ms=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,o){this.value=e,this.inputFieldValue=e,this.min=t,this.max=o,this.rangeSpan=o-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 o=xl(t,this.props.step);this.value=o,this.props.onChange&&e.currentTarget&&(e.currentTarget.value=o.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:o,id:a,information:n,unit:l,onChange:c,onClickInformation:m}=this.props,u=this.min!==this.max;if(this.node.innerHTML=`
548
+ ${R?`<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">${R?"-":k(y,{postfix:"kr"})}</div>`,checked:this.homeDelivery,onClick:$=>this.onChange($)});break;default:break}}),new N(m.querySelector(`#${ya}`),{title:"G\xE5 vidare",id:Ia,onClick:()=>this.onProceed()}),c.appendChild(m),o.navigation.stage===t&&c.parentElement?.scrollIntoView()}}},fa=ds;var F=f("@wayke-se/ecom");var ye=f("@wayke-se/ecom");var ve={bankid:"https://cdn.wayke.se/public-assets/bankid-logo.svg",illustrations:{payment:"https://cdn.wayke.se/public-assets/payment.svg"}},Ee={["VeryGood"]:"Mycket bra",["Good"]:"Bra",["Ok"]:"Ok"},J={[ye.DrivingDistance.Between0And1000]:"0\u20131000 mil",[ye.DrivingDistance.Between1000And1500]:"1000\u20131500 mil",[ye.DrivingDistance.Between1500And2000]:"1500\u20132000 mil",[ye.DrivingDistance.Between2000And2500]:"2000\u20132500 mil",[ye.DrivingDistance.Over2500]:"2500+ mil"};var xl=(s,i)=>i?Math.round(s/i)*i:s,ms=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,o){this.value=e,this.inputFieldValue=e,this.min=t,this.max=o,this.rangeSpan=o-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 o=xl(t,this.props.step);this.value=o,this.props.onChange&&e.currentTarget&&(e.currentTarget.value=o.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:o,id:a,information:n,unit:l,onChange:c,onClickInformation:m}=this.props,u=this.min!==this.max;if(this.node.innerHTML=`
549
549
  <div class="waykeecom-input-label">
550
550
  <label for="${a}" class="waykeecom-input-label__label">${e}</label>
551
551
  </div>
@@ -732,9 +732,13 @@
732
732
  ${a?`name="${a}"`:""}
733
733
  ${e?`id="${e}"`:""}
734
734
  >
735
- ${t.map(u=>`<option value="${u.value}" ${u.value===o?'selected="selected"':""}>${u.title||u.value}</option>`).join("")}
735
+ ${t.map(u=>`<option
736
+ value="${u.value}"
737
+ ${u.disabled?"disabled":""}
738
+ ${u.value===o?'selected="selected"':""}
739
+ >${u.title||u.value}</option>`).join("")}
736
740
  </select>
737
- `,this.updateBorder(),c&&(this.contexts.error=new se(this.node,{error:l,errorMessage:c})),this.node.querySelector("select")?.addEventListener("change",u=>m(u))}},Ze=Ds;var Ul="credit-assessment-martial-status",sn=`${Ul}-node`,Ls="credit-assessment-income",bs=`${Ls}-node`,Vl="credit-assessment-employment",on=`${Vl}-node`,Gl="credit-assessment-household-children",an=`${Gl}-node`,yn="credit-assessment-housing-cost",nn=`${yn}-node`,vn="credit-assessment-debt-specification-card-credit",rn=`${vn}-node`,En="credit-assessment-debt-specification-car-loan",cn=`${En}-node`,In="credit-assessment-debt-specification-collateral",ln=`${In}-node`,fn="credit-assessment-debt-specification-leasing-fees",dn=`${fn}-node`,gn="credit-assessment-debt-specification-private-loan",mn=`${gn}-node`,ql="credit-assessment-housing-type",pn=`${ql}-node`,_n="credit-assessment-perform-application",Rs=`${_n}-node`,un="disclaimer-node",hn="disclaimer-safe-node",kn="why-description-node",B={maritalStatus:C.requiredAssessmentMaritalStatus,income:C.requiredNumberGreaterOrEqualThanZero,employment:C.requiredAssessmentEmplyment,householdChildren:C.requiredNumberGreaterOrEqualThanZero,housingCost:C.requiredNumberGreaterOrEqualThanZero,"debtSpecification.cardCredits":C.optionalNumberGreaterOrEqualThanZero,"debtSpecification.carLoan":C.optionalNumberGreaterOrEqualThanZero,"debtSpecification.collateral":C.optionalNumberGreaterOrEqualThanZero,"debtSpecification.leasingFees":C.optionalNumberGreaterOrEqualThanZero,"debtSpecification.privateLoan":C.optionalNumberGreaterOrEqualThanZero,housingType:C.requiredHousingType},Wl={maritalStatus:S.MaritalStatus.Married,income:5e4,employment:S.Employment.FullTimeEmployed,householdChildren:0,housingCost:2e3,debtSpecification:{cardCredits:0,carLoan:0,collateral:0,leasingFees:0,privateLoan:0},housingType:S.HousingType.Apartment},Yl=()=>location.hostname==="localhost"?{...Wl}:void 0,Kl=s=>{let i={maritalStatus:s?.maritalStatus||"",income:s?.income.toString()||"",employment:s?.employment.toString()||"",householdChildren:s?.householdChildren.toString()||"",housingCost:s?.housingCost.toString()||"","debtSpecification.cardCredits":s?.debtSpecification.cardCredits.toString()||"","debtSpecification.carLoan":s?.debtSpecification.carLoan.toString()||"","debtSpecification.collateral":s?.debtSpecification.collateral.toString()||"","debtSpecification.leasingFees":s?.debtSpecification.leasingFees.toString()||"","debtSpecification.privateLoan":s?.debtSpecification.privateLoan.toString()||"",housingType:s?.housingType.toString()||""};return{value:i,validation:{maritalStatus:B.maritalStatus(i.maritalStatus),income:B.income(i.income),employment:B.employment(i.employment),householdChildren:B.householdChildren(i.householdChildren),housingCost:B.housingCost(i.housingCost),"debtSpecification.cardCredits":B["debtSpecification.cardCredits"](i["debtSpecification.cardCredits"]),"debtSpecification.carLoan":B["debtSpecification.carLoan"](i["debtSpecification.carLoan"]),"debtSpecification.collateral":B["debtSpecification.collateral"](i["debtSpecification.collateral"]),"debtSpecification.leasingFees":B["debtSpecification.leasingFees"](i["debtSpecification.leasingFees"]),"debtSpecification.privateLoan":B["debtSpecification.privateLoan"](i["debtSpecification.privateLoan"]),housingType:B.housingType(i.housingType)},interact:{maritalStatus:!1,income:!1,employment:!1,householdChildren:!1,housingCost:!1,"debtSpecification.cardCredits":!1,"debtSpecification.carLoan":!1,"debtSpecification.collateral":!1,"debtSpecification.leasingFees":!1,"debtSpecification.privateLoan":!1,housingType:!1}}},Os=class extends r{constructor(e,t){super(e);this.view=1;this.contexts={};this.bankidError=!1;this.signed=!1;this.props=t,this.state=Kl(Yl()),this.render()}onChange(e){let t=e.currentTarget,o=t.name,a=t.value;this.state.value[o]=a,this.state.validation[o]=B[o](a),this.updateUiError(o),this.updateProceedButton()}onBlur(e){let o=e.currentTarget.name;this.state.interact[o]=!0,this.state.validation[o]=B[o](this.state.value[o]),this.updateUiError(o),this.updateProceedButton()}onChangeSelect(e){let t=e.currentTarget,o=t.name,a=t.value;this.state.value[o]=a,this.state.validation[o]=B[o](a),this.updateProceedButton()}onChangeRadio(e){let t=e.currentTarget,o=t.name,a=t.value;this.state.value[o]=a,this.state.validation[o]=B[o](a),o==="housingType"&&(t.value===S.HousingType.SingleFamily&&(this.state.value.housingCost="0",this.state.validation.housingCost=B.housingCost(this.state.value.housingCost)),this.render()),this.updateProceedButton()}updateUiError(e){this.contexts[e]?.setError(this.state.interact[e]&&!this.state.validation[e])}updateProceedButton(){this.contexts.performApplicationButton?.disabled(!this.state.validation.maritalStatus||!this.state.validation.income||!this.state.validation.employment||!this.state.validation.householdChildren||!this.state.validation.housingCost||!this.state.validation["debtSpecification.cardCredits"]||!this.state.validation["debtSpecification.carLoan"]||!this.state.validation["debtSpecification.collateral"]||!this.state.validation["debtSpecification.leasingFees"]||!this.state.validation["debtSpecification.privateLoan"]||!this.state.validation.housingType)}async onAbort(){d("MAIN","FINANCIAL_CREDIT_SCORING_ABORTED","FINANCIAL_CREDIT_SCORING");let{store:e}=this.props;this.view=1,this.bankidStatusInterval&&clearInterval(this.bankidStatusInterval);let t=e.getState().caseId;t&&(await Re(t),await Cs(t),me()(e.dispatch)),O(),this.creditAssessmentResponse=void 0,this.render(!0)}bankIdStatus(e,t,o=!1){o||d("MAIN",t===S.AuthMethod.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===S.PaymentType.Loan);this.bankidStatusInterval=setInterval(async()=>{try{let n=await Da(e),l=n.getStatus();if(!this.signed&&l==="signed"&&(d("MAIN",t===S.AuthMethod.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=Zo(n),me(e,this.creditAssessmentResponse)(this.props.store.dispatch),O(),this.render()):n.hasScoringError()&&(clearInterval(this.bankidStatusInterval),this.contexts.bankId?.setFinalizing(!1),this.contexts.bankId?.setErrorMessage("Ett fel uppstod")),!this.signed&&t===S.AuthMethod.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),Oe("bankidStatusInterval-credit",this.bankidStatusInterval)}async onStartBankIdAuth(e,t=!1){let o=this.props.store.getState().caseId;if(!o)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 Oa({caseId:o,method:e});if(t||d("MAIN","FINANCIAL_CREDIT_SCORING_BANKID_INIT_SUCCEEDED","FINANCIAL_CREDIT_SCORING"),this.bankIdStatus(o,e,t),e===S.AuthMethod.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,O(),this.render(!0)}}async startBankId(e){let{store:t}=this.props;this.caseError=void 0,this.bankidError=!1,this.signed=!1;let o=t.getState().caseId;if(this.bankidStatusInterval&&(clearInterval(this.bankidStatusInterval),o&&(await Re(o),await Cs(o),me()(t.dispatch))),o){let a=await this.newCreditAssessmentCase();me(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&&(me(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:o}=this.props;this.contexts.performApplicationButton?.disabled(!0);let{customer:a}=e.getState(),{monthlyCost:n}=o.costs,{interest:l}=o.interests,c=o.downPaymentSpec.current,m=o.durationSpec.current,u=o.creditAmount,h=o.price,p=o.financialProductCode,y={employment:this.state.value.employment,householdChildren:parseInt(this.state.value.householdChildren,10),housingCost:parseInt(this.state.value.housingCost||"0",10),housingType:this.state.value.housingType,income:parseInt(this.state.value.income||"0",10),maritalStatus:this.state.value.maritalStatus,debtSpecification:{cardCredits:parseInt(this.state.value["debtSpecification.cardCredits"]||"0",10),carLoan:parseInt(this.state.value["debtSpecification.carLoan"]||"0",10),collateral:parseInt(this.state.value["debtSpecification.collateral"]||"0",10),leasingFees:parseInt(this.state.value["debtSpecification.leasingFees"]||"0",10),privateLoan:parseInt(this.state.value["debtSpecification.privateLoan"]||"0",10)}},g={customer:{...a},householdEconomy:y,externalId:t.externalId,loan:{downPayment:c,interestRate:l,credit:u,financialProductId:p,monthlyCost:n,price:h,term:en(m)}};return(await Ra(g)).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:o,onProceed:a}=this.props,n=Ie(),{order:l}=t.getState(),c=l?.paymentOptions.find(h=>h.type===S.PaymentType.Loan),m=o.creditAmount,u=l?.contactInformation?.name;if(this.view===3&&this.creditAssessmentResponse)new Za(Q(),{store:t,creditAssessmentResponse:this.creditAssessmentResponse,onProceed:()=>{O(),a()},onGoBack:()=>this.onAbort()});else if(this.view===2)this.contexts.bankId=new je(Q(),{method:n?S.AuthMethod.SameDevice:S.AuthMethod.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)}),G();else{this.node.innerHTML=`
741
+ `,this.updateBorder(),c&&(this.contexts.error=new se(this.node,{error:l,errorMessage:c})),this.node.querySelector("select")?.addEventListener("change",u=>m(u))}},Ze=Ds;var Ul="credit-assessment-martial-status",sn=`${Ul}-node`,Ls="credit-assessment-income",bs=`${Ls}-node`,Vl="credit-assessment-employment",on=`${Vl}-node`,Gl="credit-assessment-household-children",an=`${Gl}-node`,yn="credit-assessment-housing-cost",nn=`${yn}-node`,vn="credit-assessment-debt-specification-card-credit",rn=`${vn}-node`,En="credit-assessment-debt-specification-car-loan",cn=`${En}-node`,In="credit-assessment-debt-specification-collateral",ln=`${In}-node`,fn="credit-assessment-debt-specification-leasing-fees",dn=`${fn}-node`,gn="credit-assessment-debt-specification-private-loan",mn=`${gn}-node`,ql="credit-assessment-housing-type",pn=`${ql}-node`,_n="credit-assessment-perform-application",Rs=`${_n}-node`,un="disclaimer-node",hn="disclaimer-safe-node",kn="why-description-node",x={maritalStatus:C.requiredAssessmentMaritalStatus,income:C.requiredNumberGreaterOrEqualThanZero,employment:C.requiredAssessmentEmplyment,householdChildren:C.requiredNumberGreaterOrEqualThanZero,housingCost:C.requiredNumberGreaterOrEqualThanZero,"debtSpecification.cardCredits":C.optionalNumberGreaterOrEqualThanZero,"debtSpecification.carLoan":C.optionalNumberGreaterOrEqualThanZero,"debtSpecification.collateral":C.optionalNumberGreaterOrEqualThanZero,"debtSpecification.leasingFees":C.optionalNumberGreaterOrEqualThanZero,"debtSpecification.privateLoan":C.optionalNumberGreaterOrEqualThanZero,housingType:C.requiredHousingType},Wl={maritalStatus:S.MaritalStatus.Married,income:5e4,employment:S.Employment.FullTimeEmployed,householdChildren:-1,housingCost:2e3,debtSpecification:{cardCredits:0,carLoan:0,collateral:0,leasingFees:0,privateLoan:0},housingType:S.HousingType.Apartment},Yl=()=>location.hostname==="localhost"?{...Wl}:void 0,Kl=s=>{let i={maritalStatus:s?.maritalStatus||"",income:s?.income.toString()||"",employment:s?.employment.toString()||"",householdChildren:s?.householdChildren.toString()||"-1",housingCost:s?.housingCost.toString()||"","debtSpecification.cardCredits":s?.debtSpecification.cardCredits.toString()||"","debtSpecification.carLoan":s?.debtSpecification.carLoan.toString()||"","debtSpecification.collateral":s?.debtSpecification.collateral.toString()||"","debtSpecification.leasingFees":s?.debtSpecification.leasingFees.toString()||"","debtSpecification.privateLoan":s?.debtSpecification.privateLoan.toString()||"",housingType:s?.housingType.toString()||""};return{value:i,validation:{maritalStatus:x.maritalStatus(i.maritalStatus),income:x.income(i.income),employment:x.employment(i.employment),householdChildren:x.householdChildren(i.householdChildren),housingCost:x.housingCost(i.housingCost),"debtSpecification.cardCredits":x["debtSpecification.cardCredits"](i["debtSpecification.cardCredits"]),"debtSpecification.carLoan":x["debtSpecification.carLoan"](i["debtSpecification.carLoan"]),"debtSpecification.collateral":x["debtSpecification.collateral"](i["debtSpecification.collateral"]),"debtSpecification.leasingFees":x["debtSpecification.leasingFees"](i["debtSpecification.leasingFees"]),"debtSpecification.privateLoan":x["debtSpecification.privateLoan"](i["debtSpecification.privateLoan"]),housingType:x.housingType(i.housingType)},interact:{maritalStatus:!1,income:!1,employment:!1,householdChildren:!1,housingCost:!1,"debtSpecification.cardCredits":!1,"debtSpecification.carLoan":!1,"debtSpecification.collateral":!1,"debtSpecification.leasingFees":!1,"debtSpecification.privateLoan":!1,housingType:!1}}},Os=class extends r{constructor(e,t){super(e);this.view=1;this.contexts={};this.bankidError=!1;this.signed=!1;this.props=t,this.state=Kl(Yl()),this.render()}onChange(e){let t=e.currentTarget,o=t.name,a=t.value;this.state.value[o]=a,this.state.validation[o]=x[o](a),this.updateUiError(o),this.updateProceedButton()}onBlur(e){let o=e.currentTarget.name;this.state.interact[o]=!0,this.state.validation[o]=x[o](this.state.value[o]),this.updateUiError(o),this.updateProceedButton()}onChangeSelect(e){let t=e.currentTarget,o=t.name,a=t.value;this.state.value[o]=a,this.state.validation[o]=x[o](a),this.updateProceedButton()}onChangeRadio(e){let t=e.currentTarget,o=t.name,a=t.value;this.state.value[o]=a,this.state.validation[o]=x[o](a),o==="housingType"&&(t.value===S.HousingType.SingleFamily?(this.state.value.housingCost="0",this.state.validation.housingCost=x.housingCost(this.state.value.housingCost)):(this.state.value.housingCost="",this.state.validation.housingCost=x.housingCost(this.state.value.housingCost)),this.render()),this.updateProceedButton()}updateUiError(e){this.contexts[e]?.setError(this.state.interact[e]&&!this.state.validation[e])}updateProceedButton(){this.contexts.performApplicationButton?.disabled(!this.state.validation.maritalStatus||!this.state.validation.income||!this.state.validation.employment||!this.state.validation.householdChildren||!this.state.validation.housingCost||!this.state.validation["debtSpecification.cardCredits"]||!this.state.validation["debtSpecification.carLoan"]||!this.state.validation["debtSpecification.collateral"]||!this.state.validation["debtSpecification.leasingFees"]||!this.state.validation["debtSpecification.privateLoan"]||!this.state.validation.housingType)}async onAbort(){d("MAIN","FINANCIAL_CREDIT_SCORING_ABORTED","FINANCIAL_CREDIT_SCORING");let{store:e}=this.props;this.view=1,this.bankidStatusInterval&&clearInterval(this.bankidStatusInterval);let t=e.getState().caseId;t&&(await Re(t),await Cs(t),me()(e.dispatch)),O(),this.creditAssessmentResponse=void 0,this.render(!0)}bankIdStatus(e,t,o=!1){o||d("MAIN",t===S.AuthMethod.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===S.PaymentType.Loan);this.bankidStatusInterval=setInterval(async()=>{try{let n=await Da(e),l=n.getStatus();if(!this.signed&&l==="signed"&&(d("MAIN",t===S.AuthMethod.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=Zo(n),me(e,this.creditAssessmentResponse)(this.props.store.dispatch),O(),this.render()):n.hasScoringError()&&(clearInterval(this.bankidStatusInterval),this.contexts.bankId?.setFinalizing(!1),this.contexts.bankId?.setErrorMessage("Ett fel uppstod")),!this.signed&&t===S.AuthMethod.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),Oe("bankidStatusInterval-credit",this.bankidStatusInterval)}async onStartBankIdAuth(e,t=!1){let o=this.props.store.getState().caseId;if(!o)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 Oa({caseId:o,method:e});if(t||d("MAIN","FINANCIAL_CREDIT_SCORING_BANKID_INIT_SUCCEEDED","FINANCIAL_CREDIT_SCORING"),this.bankIdStatus(o,e,t),e===S.AuthMethod.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,O(),this.render(!0)}}async startBankId(e){let{store:t}=this.props;this.caseError=void 0,this.bankidError=!1,this.signed=!1;let o=t.getState().caseId;if(this.bankidStatusInterval&&(clearInterval(this.bankidStatusInterval),o&&(await Re(o),await Cs(o),me()(t.dispatch))),o){let a=await this.newCreditAssessmentCase();me(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&&(me(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:o}=this.props;this.contexts.performApplicationButton?.disabled(!0);let{customer:a}=e.getState(),{monthlyCost:n}=o.costs,{interest:l}=o.interests,c=o.downPaymentSpec.current,m=o.durationSpec.current,u=o.creditAmount,h=o.price,p=o.financialProductCode,y={employment:this.state.value.employment,householdChildren:parseInt(this.state.value.householdChildren,10),housingCost:parseInt(this.state.value.housingCost||"0",10),housingType:this.state.value.housingType,income:parseInt(this.state.value.income||"0",10),maritalStatus:this.state.value.maritalStatus,debtSpecification:{cardCredits:parseInt(this.state.value["debtSpecification.cardCredits"]||"0",10),carLoan:parseInt(this.state.value["debtSpecification.carLoan"]||"0",10),collateral:parseInt(this.state.value["debtSpecification.collateral"]||"0",10),leasingFees:parseInt(this.state.value["debtSpecification.leasingFees"]||"0",10),privateLoan:parseInt(this.state.value["debtSpecification.privateLoan"]||"0",10)}},g={customer:{...a},householdEconomy:y,externalId:t.externalId,loan:{downPayment:c,interestRate:l,credit:u,financialProductId:p,monthlyCost:n,price:h,term:en(m)}};return(await Ra(g)).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:o,onProceed:a}=this.props,n=Ie(),{order:l}=t.getState(),c=l?.paymentOptions.find(h=>h.type===S.PaymentType.Loan),m=o.creditAmount,u=l?.contactInformation?.name;if(this.view===3&&this.creditAssessmentResponse)new Za(Q(),{store:t,creditAssessmentResponse:this.creditAssessmentResponse,onProceed:()=>{O(),a()},onGoBack:()=>this.onAbort()});else if(this.view===2)this.contexts.bankId=new je(Q(),{method:n?S.AuthMethod.SameDevice:S.AuthMethod.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)}),G();else{this.node.innerHTML=`
738
742
  <div class="waykeecom-stack waykeecom-stack--3">
739
743
  <h5 class="waykeecom-heading waykeecom-heading--4">L\xE5neans\xF6kan</h5>
740
744
  <div class="waykeecom-content">
@@ -843,12 +847,12 @@
843
847
  <div class="waykeecom-stack waykeecom-stack--1" id="${hn}"></div>
844
848
  </div>
845
849
  </div>
846
- `,this.contexts.maritalStatus=new z(this.node.querySelector(`#${sn}`),{title:"Civilst\xE5nd",checked:this.state.value.maritalStatus,name:"maritalStatus",options:[{id:`maritalStatus-${1}`,value:S.MaritalStatus.Married,title:"Gift/partnerskap"},{id:`maritalStatus-${2}`,value:S.MaritalStatus.CommonLaw,title:"Sambo"},{id:`maritalStatus-${3}`,value:S.MaritalStatus.Single,title:"Ensamst\xE5ende"}],onClick:p=>this.onChangeRadio(p)}),this.contexts.income=new M(this.node.querySelector(`#${bs}`),{title:"Inkomst per m\xE5nad f\xF6re skatt",value:this.state.value.income,id:Ls,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 z(this.node.querySelector(`#${on}`),{title:"Syssels\xE4ttning",checked:this.state.value.employment,name:"employment",options:[{id:`employment-${1}`,value:S.Employment.FullTimeEmployed,title:"Fast eller tillsvidareanst\xE4lld"},{id:`employment-${2}`,value:S.Employment.TemporarilyEmployed,title:"Visstidsanst\xE4lld"},{id:`employment-${3}`,value:S.Employment.SelfEmployed,title:"Egen f\xF6retagare"},{id:`employment-${4}`,value:S.Employment.Retired,title:"Pension\xE4r"},{id:`employment-${5}`,value:S.Employment.Student,title:"Student"},{id:`employment-${6}`,value:S.Employment.Other,title:"Annan"}],onClick:p=>this.onChangeRadio(p)}),this.contexts.housingType=new z(this.node.querySelector(`#${pn}`),{title:"Boendeform",checked:this.state.value.housingType,name:"housingType",options:[{id:`housingType-${1}`,value:S.HousingType.SingleFamily,title:"Villa"},{id:`housingType-${2}`,value:S.HousingType.Condominium,title:"Bostadsr\xE4tt"},{id:`housingType-${3}`,value:S.HousingType.Apartment,title:"Hyresr\xE4tt"}],onClick:p=>this.onChangeRadio(p)}),this.contexts.income=new M(this.node.querySelector(`#${bs}`),{title:"Inkomst per m\xE5nad f\xF6re skatt",value:this.state.value.income,id:Ls,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:`
850
+ `,this.contexts.maritalStatus=new z(this.node.querySelector(`#${sn}`),{checked:this.state.value.maritalStatus,name:"maritalStatus",options:[{id:`maritalStatus-${1}`,value:S.MaritalStatus.Married,title:"Gift/partnerskap"},{id:`maritalStatus-${2}`,value:S.MaritalStatus.CommonLaw,title:"Sambo"},{id:`maritalStatus-${3}`,value:S.MaritalStatus.Single,title:"Ensamst\xE5ende"}],onClick:p=>this.onChangeRadio(p)}),this.contexts.income=new M(this.node.querySelector(`#${bs}`),{title:"Inkomst per m\xE5nad f\xF6re skatt",value:this.state.value.income,id:Ls,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 z(this.node.querySelector(`#${on}`),{checked:this.state.value.employment,name:"employment",options:[{id:`employment-${1}`,value:S.Employment.FullTimeEmployed,title:"Fast eller tillsvidareanst\xE4lld"},{id:`employment-${2}`,value:S.Employment.TemporarilyEmployed,title:"Visstidsanst\xE4lld"},{id:`employment-${3}`,value:S.Employment.SelfEmployed,title:"Egen f\xF6retagare"},{id:`employment-${4}`,value:S.Employment.Retired,title:"Pension\xE4r"},{id:`employment-${5}`,value:S.Employment.Student,title:"Student"},{id:`employment-${6}`,value:S.Employment.Other,title:"Annan"}],onClick:p=>this.onChangeRadio(p)}),this.contexts.housingType=new z(this.node.querySelector(`#${pn}`),{title:"Boendeform",checked:this.state.value.housingType,name:"housingType",options:[{id:`housingType-${1}`,value:S.HousingType.SingleFamily,title:"Villa"},{id:`housingType-${2}`,value:S.HousingType.Condominium,title:"Bostadsr\xE4tt"},{id:`housingType-${3}`,value:S.HousingType.Apartment,title:"Hyresr\xE4tt"}],onClick:p=>this.onChangeRadio(p)}),this.contexts.income=new M(this.node.querySelector(`#${bs}`),{title:"Inkomst per m\xE5nad f\xF6re skatt",value:this.state.value.income,id:Ls,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:`
847
851
  <div class="waykeecom-content waykeecom-content--inherit-size">
848
852
  <p class="waykeecom-content__p"><span class="waykeecom-text waykeecom-text--font-medium">Inkomst per m\xE5nad f\xF6re skatt</span></p>
849
853
  <p class="waykeecom-content__p">L\xF6n och/eller pension, inte bidrag eller studiel\xE5n.</p>
850
854
  </div>
851
- `,onChange:p=>this.onChange(p),onBlur:p=>this.onBlur(p)}),this.contexts.householdChildren=new Ze(this.node.querySelector(`#${an}`),{title:"Antal barn under 18 \xE5r",value:this.state.value.householdChildren,name:"householdChildren",options:[{value:"0"},{value:"1"},{value:"2"},{value:"3"},{value:"4"},{value:"5"},{value:"6"},{value:"7"},{value:"8"},{value:"9"},{value:"10",title:"10 eller fler"}],onChange:p=>this.onChangeSelect(p)});let h=this.node.querySelector(`#${nn}`);h&&(this.contexts.housingCost=new M(h,{title:this.state.value.housingType===S.HousingType.Condominium?"Min del av m\xE5nadsavgiften":this.state.value.housingType===S.HousingType.Apartment?"Min del av m\xE5nadshyran":"Boendekostnad",value:this.state.value.housingCost,id:yn,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===S.HousingType.Condominium?`
855
+ `,onChange:p=>this.onChange(p),onBlur:p=>this.onBlur(p)}),this.contexts.householdChildren=new Ze(this.node.querySelector(`#${an}`),{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(`#${nn}`);h&&(this.contexts.housingCost=new M(h,{title:this.state.value.housingType===S.HousingType.Condominium?"Min del av m\xE5nadsavgiften":this.state.value.housingType===S.HousingType.Apartment?"Min del av m\xE5nadshyran":"Boendekostnad",value:this.state.value.housingCost,id:yn,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===S.HousingType.Condominium?`
852
856
  <div class="waykeecom-content waykeecom-content--inherit-size">
853
857
  <p class="waykeecom-content__p"><span class="waykeecom-text waykeecom-text--font-medium">Min del av m\xE5nadsavgiften</span></p>
854
858
  <p class="waykeecom-content__p">Exklusive r\xE4nta och amortering</p>
@@ -1055,14 +1059,14 @@
1055
1059
  <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>
1056
1060
  <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>
1057
1061
  </div>
1058
- `,onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_DOWNPAYMENT_INFORMATION_TOGGLE","FINANCIAL")}}),this.contexts.duration=new Qe(this.node.querySelector(`#${Pn}`),{title:"Avbetalning",value:this.paymentState.duration.current,id:zl,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 Qe(this.node.querySelector(`#${$n}`),{title:"Restv\xE4rde",value:parseInt(`${this.paymentState.residual.current*100}`,10),id:jl,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 Mn(this.node.querySelector(`#${Un}`),{}),this.contexts.loanDetails=new On(this.node.querySelector(`#${Hn}`),{loan:t,paymentLookupResponse:this.paymentLookupResponse}),l?new Sn(this.node.querySelector(`#${Bn}`),{store:e,loan:t,paymentLookupResponse:this.paymentLookupResponse,onProceed:()=>o()}):this.contexts.proceedButton=new N(this.node.querySelector(`#${Fn}`),{title:"G\xE5 vidare",id:Vn,onClick:()=>o()})}},Gn=Fs;var Us=f("@wayke-se/ecom");var Xl="credit-assessment-result",qn=`${Xl}-node`,Vs=class extends r{constructor(e,t){super(e,{htmlTag:"div"});this.props=t,this.render()}render(){let{store:e,paymentType:t,loan:o,paymentLookupResponse:a,onEdit:n}=this.props,l=o?.loanDetails;if(t===Us.PaymentType.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:g}=m.interests,{monthlyCost:w}=m.costs,R=[{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(w,{postfix:"kr*"})}],P=c.creditAssessmentResponse?.recommendation,X=`*Ber\xE4knat p\xE5 ${k(y*100,{decimals:2})} % r\xE4nta (effektivt ${k(g*100,{decimals:2})} %). Den r\xE4nta du f\xE5r s\xE4tts vid avtalskrivning.`;this.node.innerHTML=`
1062
+ `,onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_DOWNPAYMENT_INFORMATION_TOGGLE","FINANCIAL")}}),this.contexts.duration=new Qe(this.node.querySelector(`#${Pn}`),{title:"Avbetalning",value:this.paymentState.duration.current,id:zl,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 Qe(this.node.querySelector(`#${$n}`),{title:"Restv\xE4rde",value:parseInt(`${this.paymentState.residual.current*100}`,10),id:jl,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 Mn(this.node.querySelector(`#${Un}`),{}),this.contexts.loanDetails=new On(this.node.querySelector(`#${Hn}`),{loan:t,paymentLookupResponse:this.paymentLookupResponse}),l?new Sn(this.node.querySelector(`#${Bn}`),{store:e,loan:t,paymentLookupResponse:this.paymentLookupResponse,onProceed:()=>o()}):this.contexts.proceedButton=new N(this.node.querySelector(`#${Fn}`),{title:"G\xE5 vidare",id:Vn,onClick:()=>o()})}},Gn=Fs;var Us=f("@wayke-se/ecom");var Xl="credit-assessment-result",qn=`${Xl}-node`,Vs=class extends r{constructor(e,t){super(e,{htmlTag:"div"});this.props=t,this.render()}render(){let{store:e,paymentType:t,loan:o,paymentLookupResponse:a,onEdit:n}=this.props,l=o?.loanDetails;if(t===Us.PaymentType.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:g}=m.interests,{monthlyCost:w}=m.costs,R=[{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(w,{postfix:"kr*"})}],$=c.creditAssessmentResponse?.recommendation,X=`*Ber\xE4knat p\xE5 ${k(y*100,{decimals:2})} % r\xE4nta (effektivt ${k(g*100,{decimals:2})} %). Den r\xE4nta du f\xE5r s\xE4tts vid avtalskrivning.`;this.node.innerHTML=`
1059
1063
  <div class="waykeecom-stack waykeecom-stack--2">
1060
1064
  <h4 class="waykeecom-heading waykeecom-heading--4">Bill\xE5n</h4>
1061
1065
  <div class="waykeecom-content">
1062
1066
  <p class="waykeecom-content__p">Ordern \xE4r snart klar, h\xE4r ser du ditt l\xE5nebesked:</p>
1063
1067
  </div>
1064
1068
  </div>
1065
- ${P?`<div class="waykeecom-stack waykeecom-stack--2" id="${qn}"></div>`:""}
1069
+ ${$?`<div class="waykeecom-stack waykeecom-stack--2" id="${qn}"></div>`:""}
1066
1070
  <div class="waykeecom-stack waykeecom-stack--2">
1067
1071
  <div class="waykeecom-stack waykeecom-stack--1">
1068
1072
  <ul class="waykeecom-key-value-list">
@@ -1078,7 +1082,7 @@
1078
1082
  <button type="button" title="\xC4ndra finansiering" class="waykeecom-link">\xC4ndra</button>
1079
1083
  </div>
1080
1084
  </div>
1081
- `,P&&new ae(this.node.querySelector(`#${qn}`),{store:e,decision:P})}else this.node.innerHTML=`
1085
+ `,$&&new ae(this.node.querySelector(`#${qn}`),{store:e,decision:$})}else this.node.innerHTML=`
1082
1086
  <div class="waykeecom-stack waykeecom-stack--1">
1083
1087
  <ul class="waykeecom-key-value-list">
1084
1088
  ${E({key:"Finansiering",value:t===Us.PaymentType.Cash?"Kontant":"Privatleasing"})}
@@ -1091,7 +1095,7 @@
1091
1095
  </div>
1092
1096
  </div>
1093
1097
  `:""}
1094
- `;n&&this.node.querySelector("button")?.addEventListener("click",()=>n())}},Wn=Vs;var jn="button-financial-proceed",Yn=`${jn}-node`,Zl="financial-option",Kn=`${Zl}-node`,ed="financial-option-second",Qn=`${ed}-node`,td="radio-financial-cash",sd="radio-financial-loan",od="radio-financial-lease",zn="payment-node",Gs=class extends r{constructor(e,t){super(e);this.props=t,_(this.props.store,"navigation",()=>{let n=this.props.store.getState();this.paymentType=n.paymentType,this.render()});let o=this.props.store.getState(),{paymentType:a}=o;this.paymentType=a,this.render()}onChange(e){let o=e.currentTarget.value;switch(this.paymentType=o,this.render(!0),this.paymentType){case F.PaymentType.Cash:d("MAIN","FINANCIAL_CASH_SELECTED","FINANCIAL");break;case F.PaymentType.Lease:d("MAIN","FINANCIAL_LEASE_SELECTED","FINANCIAL");case F.PaymentType.Loan:d("MAIN","FINANCIAL_LOAN_SELECTED","FINANCIAL");default:break}}onProceed(){if(this.paymentType){switch(this.paymentType){case F.PaymentType.Cash:d("MAIN","FINANCIAL_CASH_SET","FINANCIAL");break;case F.PaymentType.Lease:d("MAIN","FINANCIAL_LEASE_SET","FINANCIAL");case F.PaymentType.Loan:d("MAIN","FINANCIAL_LOAN_SET","FINANCIAL");default:break}ci(this.paymentType,this.props.lastStage)(this.props.store.dispatch)}}onEdit(){d("MAIN","FINANCIAL_EDIT","FINANCIAL"),$("main",this.props.index)(this.props.store.dispatch)}render(e){let t=this.props.store.getState(),{id:o,order:a,paymentLookupResponse:n}=t;if(!a)throw"No order available";let l=a.paymentOptions,c=t.topNavigation.stage>this.props.index,m=H(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===F.PaymentType.Loan);new Wn(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(L=>L.type===F.PaymentType.Cash),y=l.find(L=>L.type===F.PaymentType.Loan),g=l.find(L=>L.type===F.PaymentType.Lease);u.innerHTML=`
1098
+ `;n&&this.node.querySelector("button")?.addEventListener("click",()=>n())}},Wn=Vs;var jn="button-financial-proceed",Yn=`${jn}-node`,Zl="financial-option",Kn=`${Zl}-node`,ed="financial-option-second",Qn=`${ed}-node`,td="radio-financial-cash",sd="radio-financial-loan",od="radio-financial-lease",zn="payment-node",Gs=class extends r{constructor(e,t){super(e);this.props=t,_(this.props.store,"navigation",()=>{let n=this.props.store.getState();this.paymentType=n.paymentType,this.render()});let o=this.props.store.getState(),{paymentType:a}=o;this.paymentType=a,this.render()}onChange(e){let o=e.currentTarget.value;switch(this.paymentType=o,this.render(!0),this.paymentType){case F.PaymentType.Cash:d("MAIN","FINANCIAL_CASH_SELECTED","FINANCIAL");break;case F.PaymentType.Lease:d("MAIN","FINANCIAL_LEASE_SELECTED","FINANCIAL");case F.PaymentType.Loan:d("MAIN","FINANCIAL_LOAN_SELECTED","FINANCIAL");default:break}}onProceed(){if(this.paymentType){switch(this.paymentType){case F.PaymentType.Cash:d("MAIN","FINANCIAL_CASH_SET","FINANCIAL");break;case F.PaymentType.Lease:d("MAIN","FINANCIAL_LEASE_SET","FINANCIAL");case F.PaymentType.Loan:d("MAIN","FINANCIAL_LOAN_SET","FINANCIAL");default:break}ci(this.paymentType,this.props.lastStage)(this.props.store.dispatch)}}onEdit(){d("MAIN","FINANCIAL_EDIT","FINANCIAL"),H("main",this.props.index)(this.props.store.dispatch)}render(e){let t=this.props.store.getState(),{id:o,order:a,paymentLookupResponse:n}=t;if(!a)throw"No order available";let l=a.paymentOptions,c=t.topNavigation.stage>this.props.index,m=B(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===F.PaymentType.Loan);new Wn(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(L=>L.type===F.PaymentType.Cash),y=l.find(L=>L.type===F.PaymentType.Loan),g=l.find(L=>L.type===F.PaymentType.Lease);u.innerHTML=`
1095
1099
  <div class="waykeecom-stack waykeecom-stack--3">
1096
1100
  <h4 class="waykeecom-heading waykeecom-heading--4 waykeecom-no-margin">Hur vill du finansiera din ${h?.title} ${pe(h)}?</h4>
1097
1101
  </div>
@@ -1140,11 +1144,11 @@
1140
1144
  <div class="waykeecom-content waykeecom-content--inherit-size">
1141
1145
  <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>
1142
1146
  </div>
1143
- `,options:R,onClick:L=>this.onChange(L),onClickInformation:()=>{d("MAIN","FINANCIAL_INFORMATION_TOGGLE","FINANCIAL")}});let P=[];g&&(P.push({id:od,title:"Privatleasing",value:F.PaymentType.Lease,meta:`<div class="waykeecom-text waykeecom-text--font-bold">Fr\xE5n ${k(g?.price,{postfix:g.unit})}</div>`}),new z(u.querySelector(`#${Qn}`),{title:"Leasa bilen",checked:this.paymentType,name:"paymentType",information:`
1147
+ `,options:R,onClick:L=>this.onChange(L),onClickInformation:()=>{d("MAIN","FINANCIAL_INFORMATION_TOGGLE","FINANCIAL")}});let $=[];g&&($.push({id:od,title:"Privatleasing",value:F.PaymentType.Lease,meta:`<div class="waykeecom-text waykeecom-text--font-bold">Fr\xE5n ${k(g?.price,{postfix:g.unit})}</div>`}),new z(u.querySelector(`#${Qn}`),{title:"Leasa bilen",checked:this.paymentType,name:"paymentType",information:`
1144
1148
  <div class="waykeecom-content waykeecom-content--inherit-size">
1145
1149
  <p class="waykeecom-content__p">Du st\xE5r inte som \xE4gare p\xE5 bilen utan betalar en avtalad m\xE5nadsavgift d\xE4r det mesta ing\xE5r. N\xE4r avtalstiden g\xE5r ut \xE4r det bara att l\xE4mna tillbaka bilen till bilhandlaren.</p>
1146
1150
  </div>
1147
- `,options:P,onClick:L=>this.onChange(L)}));let X=u.querySelector(`#${zn}`);X&&(y&&this.paymentType===F.PaymentType.Loan?new Gn(X,{store:this.props.store,loan:y,vehicleId:o,paymentLookupResponse:n,onProceed:()=>this.onProceed()}):new N(u.querySelector(`#${Yn}`),{title:"G\xE5 vidare",id:jn,disabled:!this.paymentType,onClick:()=>this.onProceed()}))}!e&&t.navigation.stage===this.props.index&&m.parentElement?.scrollIntoView()}},Jn=Gs;var U=f("@wayke-se/ecom");var qs=f("@wayke-se/ecom"),Xn=(s,i)=>{let e=s.getState();if(!e.id)throw"No id";let t=qs.insurances.newInsuranceOptionsRequest().forCustomer(e.customer.socialId).forVehicle(e.id).withDrivingDistance(i);return qs.insurances.getOptions(t.build())};var Ws=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:o,name:a,checked:n,meta:l,description:c,append:m,disabled:u,onClick:h}=this.props,p=`
1151
+ `,options:$,onClick:L=>this.onChange(L)}));let X=u.querySelector(`#${zn}`);X&&(y&&this.paymentType===F.PaymentType.Loan?new Gn(X,{store:this.props.store,loan:y,vehicleId:o,paymentLookupResponse:n,onProceed:()=>this.onProceed()}):new N(u.querySelector(`#${Yn}`),{title:"G\xE5 vidare",id:jn,disabled:!this.paymentType,onClick:()=>this.onProceed()}))}!e&&t.navigation.stage===this.props.index&&m.parentElement?.scrollIntoView()}},Jn=Gs;var U=f("@wayke-se/ecom");var qs=f("@wayke-se/ecom"),Xn=(s,i)=>{let e=s.getState();if(!e.id)throw"No id";let t=qs.insurances.newInsuranceOptionsRequest().forCustomer(e.customer.socialId).forVehicle(e.id).withDrivingDistance(i);return qs.insurances.getOptions(t.build())};var Ws=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:o,name:a,checked:n,meta:l,description:c,append:m,disabled:u,onClick:h}=this.props,p=`
1148
1152
  <input
1149
1153
  type="checkbox"
1150
1154
  id="${e}"
@@ -1310,7 +1314,7 @@
1310
1314
  <div class="waykeecom-stack waykeecom-stack--1" id="${Cr}"></div>
1311
1315
  <div class="waykeecom-stack waykeecom-stack--1" id="${rd}"></div>
1312
1316
  </div>
1313
- `,new Tr(this.node.querySelector(`#${ao}`),{store:e,insurances:[t]}),new N(this.node.querySelector(`#${Cr}`),{id:ad,title:"G\xE5 vidare",onClick:()=>this.onProceed()})}},Dr=no;var ro=class extends r{constructor(e,t){super(e);this.props=t,_(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(){de()(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()),$("main",this.props.index)(this.props.store.dispatch)}render(){let{store:e,index:t,lastStage:o}=this.props,a=e.getState(),n=a.topNavigation.stage>t,l=a.navigation.stage===t;l&&d("MAIN","INSURANCE_ACTIVE",this.getStep());let c=H(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 j(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 gr(c,{store:e,lastStage:o,onSkip:()=>this.onSkipInsurances()});break;default:new Dr(c,{store:e,lastStage:o,insurance:m});break}}a.navigation.stage===t&&c.parentElement?.scrollIntoView()}},br=ro;var co=f("@wayke-se/ecom"),Rr=s=>{let i=co.vehicles.newLookupRequest().withRegistrationNumber(s.registrationNumber).withMileage(parseInt(s.mileage,10)).withCondition(s.condition);return co.vehicles.lookupVehicle(i.build())};var lo=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:o,id:a,error:n,errorMessage:l,placeholder:c,information:m,autocomplete:u,onChange:h,onBlur:p}=this.props;this.node.innerHTML=`
1317
+ `,new Tr(this.node.querySelector(`#${ao}`),{store:e,insurances:[t]}),new N(this.node.querySelector(`#${Cr}`),{id:ad,title:"G\xE5 vidare",onClick:()=>this.onProceed()})}},Dr=no;var ro=class extends r{constructor(e,t){super(e);this.props=t,_(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(){de()(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()),H("main",this.props.index)(this.props.store.dispatch)}render(){let{store:e,index:t,lastStage:o}=this.props,a=e.getState(),n=a.topNavigation.stage>t,l=a.navigation.stage===t;l&&d("MAIN","INSURANCE_ACTIVE",this.getStep());let c=B(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 j(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 gr(c,{store:e,lastStage:o,onSkip:()=>this.onSkipInsurances()});break;default:new Dr(c,{store:e,lastStage:o,insurance:m});break}}a.navigation.stage===t&&c.parentElement?.scrollIntoView()}},br=ro;var co=f("@wayke-se/ecom"),Rr=s=>{let i=co.vehicles.newLookupRequest().withRegistrationNumber(s.registrationNumber).withMileage(parseInt(s.mileage,10)).withCondition(s.condition);return co.vehicles.lookupVehicle(i.build())};var lo=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:o,id:a,error:n,errorMessage:l,placeholder:c,information:m,autocomplete:u,onChange:h,onBlur:p}=this.props;this.node.innerHTML=`
1314
1318
  <div class="waykeecom-input-label">
1315
1319
  <label for="${a}" class="waykeecom-input-label__label">${e}</label>
1316
1320
  </div>
@@ -1411,7 +1415,7 @@
1411
1415
  <circle cx="11" cy="10" r="5.5" stroke="#FFF500" stroke-linejoin="round" stroke-dasharray="1 2"/>
1412
1416
  <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"/>
1413
1417
  </svg>
1414
- `,onChange:e=>this.onChange(e),onBlur:e=>this.onBlur(e)}),this.contexts.mileage=new M(this.node.querySelector(`#${Mr}`),{title:"Miltal",value:this.state.value.mileage,id:Ur,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 Lr(this.node.querySelector(`#${xr}`),{title:"Beskrivning (valfritt)",value:this.state.value.description,id:Vr,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 z(this.node.querySelector(`#${Pr}`),{title:"Bilens skick",checked:this.state.value.condition,name:"condition",options:dd,onClick:e=>this.onChangeRadio(e)}),this.contexts.buttonFetch=new N(this.node.querySelector(`#${$r}`),{title:"H\xE4mta uppskattat v\xE4rde",id:Gr,disabled:!(this.state.validation.registrationNumber&&this.state.validation.mileage&&this.state.validation.condition),onClick:()=>this.onFetchVehicle()}),new K(this.node.querySelector(`#${tt}`),{id:mo,title:"Hoppa \xF6ver detta steg",onClick:()=>this.onNoTradeIn()})}},Wr=po;var Qr="button-trade-in-yes",Yr=`${Qr}-node`,zr="button-trade-in-no",Kr=`${zr}-node`,ho="button-trade-in-change",uo=`${ho}-node`,ko=class extends r{constructor(e,t){super(e);this.props=t,_(this.props.store,"navigation",()=>{this.render()}),this.render()}onEdit(){d("MAIN","TRADE_IN_EDIT","TRADE_IN"),$("main",this.props.index)(this.props.store.dispatch)}onYesTradeIn(){d("MAIN","TRADE_IN_SELECTED","TRADE_IN"),ri(this.props.lastStage)(this.props.store.dispatch)}onNoTradeIn(){d("MAIN","TRADE_IN_SKIPPED","TRADE_IN"),Ne(this.props.lastStage)(this.props.store.dispatch)}render(){let{store:e,index:t,lastStage:o}=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=H(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:Ee[a.tradeIn.condition]}),m.innerHTML=`
1418
+ `,onChange:e=>this.onChange(e),onBlur:e=>this.onBlur(e)}),this.contexts.mileage=new M(this.node.querySelector(`#${Mr}`),{title:"Miltal",value:this.state.value.mileage,id:Ur,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 Lr(this.node.querySelector(`#${xr}`),{title:"Beskrivning (valfritt)",value:this.state.value.description,id:Vr,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 z(this.node.querySelector(`#${Pr}`),{title:"Bilens skick",checked:this.state.value.condition,name:"condition",options:dd,onClick:e=>this.onChangeRadio(e)}),this.contexts.buttonFetch=new N(this.node.querySelector(`#${$r}`),{title:"H\xE4mta uppskattat v\xE4rde",id:Gr,disabled:!(this.state.validation.registrationNumber&&this.state.validation.mileage&&this.state.validation.condition),onClick:()=>this.onFetchVehicle()}),new K(this.node.querySelector(`#${tt}`),{id:mo,title:"Hoppa \xF6ver detta steg",onClick:()=>this.onNoTradeIn()})}},Wr=po;var Qr="button-trade-in-yes",Yr=`${Qr}-node`,zr="button-trade-in-no",Kr=`${zr}-node`,ho="button-trade-in-change",uo=`${ho}-node`,ko=class extends r{constructor(e,t){super(e);this.props=t,_(this.props.store,"navigation",()=>{this.render()}),this.render()}onEdit(){d("MAIN","TRADE_IN_EDIT","TRADE_IN"),H("main",this.props.index)(this.props.store.dispatch)}onYesTradeIn(){d("MAIN","TRADE_IN_SELECTED","TRADE_IN"),ri(this.props.lastStage)(this.props.store.dispatch)}onNoTradeIn(){d("MAIN","TRADE_IN_SKIPPED","TRADE_IN"),Ne(this.props.lastStage)(this.props.store.dispatch)}render(){let{store:e,index:t,lastStage:o}=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=B(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:Ee[a.tradeIn.condition]}),m.innerHTML=`
1415
1419
  <div class="waykeecom-stack waykeecom-stack--3">
1416
1420
  <div class="waykeecom-balloon">
1417
1421
  <div class="waykeecom-stack waykeecom-stack--05">
@@ -1475,7 +1479,7 @@
1475
1479
  <ul class="waykeecom-checklist" aria-label="F\xF6rdelar med att k\xF6pa bilen online hos oss">
1476
1480
  ${this.props.checklistItems.map(e=>` <li class="waykeecom-checklist__item">${e}</li>`).join("")}
1477
1481
  </ul>
1478
- `}},Jr=yo;var ec="preview-proceed",Xr=`${ec}-node`,pd="preview-checklist",Zr=`${pd}-node`,vo=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 Be(e.id),o=Me(t),a=[];this.props.stageOrderList.forEach(n=>{n==="centralStorage"&&!o.requiresDealerSelection||n==="tradeIn"&&!o.allowsTradeIn||n==="insurance"&&!o.insuranceOption||n==="accessories"&&!o.accessories.length||a.push(st[n])}),hi(a)(this.props.store.dispatch),xe(o,this.props.vehicle)(this.props.store.dispatch),this.render()}catch(t){throw this.requestError=!0,this.render(),t}}onProceed(){d("PREVIEW","PREVIEW_PROCEED"),$("main")(this.props.store.dispatch)}render(){let{store:e,cdnMedia:t}=this.props,o=e.getState();if(!o.order){this.node.innerHTML=`
1482
+ `}},Jr=yo;var ec="preview-proceed",Xr=`${ec}-node`,pd="preview-checklist",Zr=`${pd}-node`,vo=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 Be(e.id),o=Me(t),a=[];this.props.stageOrderList.forEach(n=>{n==="centralStorage"&&!o.requiresDealerSelection||n==="tradeIn"&&!o.allowsTradeIn||n==="insurance"&&!o.insuranceOption||n==="accessories"&&!o.accessories.length||a.push(st[n])}),hi(a)(this.props.store.dispatch),xe(o,this.props.vehicle)(this.props.store.dispatch),this.render()}catch(t){throw this.requestError=!0,this.render(),t}}onProceed(){d("PREVIEW","PREVIEW_PROCEED"),H("main")(this.props.store.dispatch)}render(){let{store:e,cdnMedia:t}=this.props,o=e.getState();if(!o.order){this.node.innerHTML=`
1479
1483
  ${this.requestError?I({tone:"error",children:"Ett fel uppstod och det gick inte att initiera modulen. F\xF6rs\xF6k igen."}):b()}
1480
1484
  `;return}this.node.innerHTML=`
1481
1485
  <div class="waykeecom-stack waykeecom-stack--3">
@@ -1521,7 +1525,7 @@
1521
1525
  <div class="waykeecom-stack waykeecom-stack--3">
1522
1526
  <div id="payment-menu" style="padding: 24px;border: 1px solid #ececeb;"></div>
1523
1527
  </div>
1524
- `}},ic=Eo;var W=f("@wayke-se/ecom");var Io=f("@wayke-se/ecom"),ac=s=>{let i=Io.bankid.newAuthRequest().withMethod(s).build();return Io.bankid.auth(i)};var fo=f("@wayke-se/ecom"),go=s=>{let i=fo.bankid.newCollectRequest().withOrderRef(s).build();return fo.bankid.collect(i)};var x=f("@wayke-se/ecom"),nc=s=>{let i=s.getState();if(!i.address)throw"Missing address";if(!i.paymentType)throw"Missing paymentType";if(!i.vehicle)throw"Missing vehicle";let e=x.customers.newCustomer().withAddress(i.address).withPersonalNumber(i.customer.socialId).withEmail(i.customer.email).withPhoneNumber(i.customer.phone).build(),t=x.orders.newPayment().withType(i.paymentType);if(i.paymentType===x.PaymentType.Loan){let m=i.order?.paymentOptions.find(w=>w.type===x.PaymentType.Loan),u=i.paymentLookupResponse||m?.loanDetails,h=u?.durationSpec.current,p=u?.downPaymentSpec.current,y=u?.residualValueSpec?.current,g=i.order?.paymentOptions.find(w=>w.type===x.PaymentType.Loan)?.externalId;if(t.withDuration(h).withDownPayment(Math.round(p)),y&&t.withResidualValue(y),g&&t.withExternalId(g),i.creditAssessmentResponse){let w=i.creditAssessmentResponse.scoringId,R=i.creditAssessmentResponse.recommendation,P=i.creditAssessmentResponse.decision,X=u?.financialProductCode;if(!w||!R||!P||!X)throw"Missing credit assessment data";let L=x.orders.newCreditAssessment().withScoreId(w).withFinancialProductCode(X).withRecommendation(R).withDecision(P).build();t.withCreditAssessment(L)}}let o=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=x.orders.newCreateRequest().forVehicle(i.id).withCustomer(e).withPayment(o).withUrls(n,l).withDeliveryType(i.homeDelivery?x.DeliveryType.Delivery:x.DeliveryType.Pickup);if(i.insurance){let m=x.orders.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=x.vehicles.newVehicleTrade().forVehicle(i.tradeIn.registrationNumber).withMileage(parseInt(i.tradeIn.mileage,10)).withCondition(i.tradeIn.condition).withComment(i.tradeIn.description).build();c.withTradeIn(m)}return x.orders.create(c.build())};var rc=f("@wayke-se/ecom"),cc=s=>rc.creditAssessment.accept(s);var _o=f("@wayke-se/ecom"),lc=s=>{let i=_o.bankid.newQrCodeRequest().withOrderRef(s).build();return _o.bankid.qrcode(i)};var hc="confirm-conditions",dc=`${hc}-node`,mc="bankid-start-node",hd="bankid-start",pc="address-disclaimer-policy-node",uc="address-disclaimer-reservation-node",So=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 go(e);this.handleBankidStatusResponse(t,W.AuthMethod.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 o=(await lc(e)).getQrCode();this.contexts.bankId?.update(W.AuthMethod.QrCode,o)}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===W.AuthMethod.SameDevice)try{let e=await go(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 cc(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(),o=await nc(e);d("MAIN","CONFIRMATION_CREATE_ORDER_SUCCEEDED","CONFIRMATION"),t?.isPaymentRequired&&O();let n=o.getPayment();ki(o.getOrderNumber(),n)(e.dispatch),this.acceptCreditAssessment()}catch(t){let o=t;this.view=1,d("MAIN","CONFIRMATION_CREATE_ORDER_FAILED","CONFIRMATION"),o.message==="The vehicle is not available for purchase"?(this.requestError=!1,this.notAvailable=!0):(this.notAvailable=!1,this.requestError=!0),O(),this.render()}}async handleBankidStatusResponse(e,t){if(e.isCompleted()){this.removeWindowEvents(),this.clearBankidRequestRef(),this.clearIntervals();let o=e.getAddress(),a=e.getPersonalNumber();if(o&&a){let n=this.props.store.getState();if(C.requiredSsnOver18(a)){if(n.customer.socialId!==a){d("MAIN",t===W.AuthMethod.SameDevice?"CONFIRMATION_BANKID_STATUS_SAME_DEVICE_SUCCEEDED_SSN_MISSMATCH":"CONFIRMATION_BANKID_STATUS_QR_SUCCEEDED_SSN_MISSMATCH","CONFIRMATION"),this.view=1,this.socialIdNotMatchingError=!0,O(),this.render();return}}else{d("MAIN",t===W.AuthMethod.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,O(),this.render();return}d("MAIN",t===W.AuthMethod.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,o=!1){o||d("MAIN","CONFIRMATION_BANKID_STATUS_SAME_DEVICE_REQUESTED","CONFIRMATION");try{this.setBankidRequestRef(t,W.AuthMethod.SameDevice);let a=e.getAutoLaunchUrl();this.contexts.bankId?.update(W.AuthMethod.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),Oe("bankidStatusInterval",this.bankidStatusInterval),this.qrCode(e),this.bankidQrCodeInterval=setInterval(async()=>{this.qrCode(e)},1e3),Oe("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 o=await ac(e);t||d("MAIN","CONFIRMATION_BANKID_INIT_SUCCEEDED","CONFIRMATION");let a=o.getOrderRef();e===W.AuthMethod.QrCode?this.startBankidWithQr(a,t):this.startBankidSameDevice(o,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,O(),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=Ie(),{navigation:t,order:o,insurance:a}=this.props.store.getState();if(this.view===2)this.contexts.bankId=new je(Q(),{method:e?W.AuthMethod.SameDevice:W.AuthMethod.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=o?.contactInformation?.name,l=o?.conditionsPdfUri,c="https://www.wayke.se/trygghet-naer-det-kommer-till-dina-personuppgifter";this.node.innerHTML=`
1528
+ `}},ic=Eo;var W=f("@wayke-se/ecom");var Io=f("@wayke-se/ecom"),ac=s=>{let i=Io.bankid.newAuthRequest().withMethod(s).build();return Io.bankid.auth(i)};var fo=f("@wayke-se/ecom"),go=s=>{let i=fo.bankid.newCollectRequest().withOrderRef(s).build();return fo.bankid.collect(i)};var P=f("@wayke-se/ecom"),nc=s=>{let i=s.getState();if(!i.address)throw"Missing address";if(!i.paymentType)throw"Missing paymentType";if(!i.vehicle)throw"Missing vehicle";let e=P.customers.newCustomer().withAddress(i.address).withPersonalNumber(i.customer.socialId).withEmail(i.customer.email).withPhoneNumber(i.customer.phone).build(),t=P.orders.newPayment().withType(i.paymentType);if(i.paymentType===P.PaymentType.Loan){let m=i.order?.paymentOptions.find(w=>w.type===P.PaymentType.Loan),u=i.paymentLookupResponse||m?.loanDetails,h=u?.durationSpec.current,p=u?.downPaymentSpec.current,y=u?.residualValueSpec?.current,g=i.order?.paymentOptions.find(w=>w.type===P.PaymentType.Loan)?.externalId;if(t.withDuration(h).withDownPayment(Math.round(p)),y&&t.withResidualValue(y),g&&t.withExternalId(g),i.creditAssessmentResponse){let w=i.creditAssessmentResponse.scoringId,R=i.creditAssessmentResponse.recommendation,$=i.creditAssessmentResponse.decision,X=u?.financialProductCode;if(!w||!R||!$||!X)throw"Missing credit assessment data";let L=P.orders.newCreditAssessment().withScoreId(w).withFinancialProductCode(X).withRecommendation(R).withDecision($).build();t.withCreditAssessment(L)}}let o=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=P.orders.newCreateRequest().forVehicle(i.id).withCustomer(e).withPayment(o).withUrls(n,l).withDeliveryType(i.homeDelivery?P.DeliveryType.Delivery:P.DeliveryType.Pickup);if(i.insurance){let m=P.orders.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=P.vehicles.newVehicleTrade().forVehicle(i.tradeIn.registrationNumber).withMileage(parseInt(i.tradeIn.mileage,10)).withCondition(i.tradeIn.condition).withComment(i.tradeIn.description).build();c.withTradeIn(m)}return P.orders.create(c.build())};var rc=f("@wayke-se/ecom"),cc=s=>rc.creditAssessment.accept(s);var _o=f("@wayke-se/ecom"),lc=s=>{let i=_o.bankid.newQrCodeRequest().withOrderRef(s).build();return _o.bankid.qrcode(i)};var hc="confirm-conditions",dc=`${hc}-node`,mc="bankid-start-node",hd="bankid-start",pc="address-disclaimer-policy-node",uc="address-disclaimer-reservation-node",So=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 go(e);this.handleBankidStatusResponse(t,W.AuthMethod.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 o=(await lc(e)).getQrCode();this.contexts.bankId?.update(W.AuthMethod.QrCode,o)}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===W.AuthMethod.SameDevice)try{let e=await go(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 cc(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(),o=await nc(e);d("MAIN","CONFIRMATION_CREATE_ORDER_SUCCEEDED","CONFIRMATION"),t?.isPaymentRequired&&O();let n=o.getPayment();ki(o.getOrderNumber(),n)(e.dispatch),this.acceptCreditAssessment()}catch(t){let o=t;this.view=1,d("MAIN","CONFIRMATION_CREATE_ORDER_FAILED","CONFIRMATION"),o.message==="The vehicle is not available for purchase"?(this.requestError=!1,this.notAvailable=!0):(this.notAvailable=!1,this.requestError=!0),O(),this.render()}}async handleBankidStatusResponse(e,t){if(e.isCompleted()){this.removeWindowEvents(),this.clearBankidRequestRef(),this.clearIntervals();let o=e.getAddress(),a=e.getPersonalNumber();if(o&&a){let n=this.props.store.getState();if(C.requiredSsnOver18(a)){if(n.customer.socialId!==a){d("MAIN",t===W.AuthMethod.SameDevice?"CONFIRMATION_BANKID_STATUS_SAME_DEVICE_SUCCEEDED_SSN_MISSMATCH":"CONFIRMATION_BANKID_STATUS_QR_SUCCEEDED_SSN_MISSMATCH","CONFIRMATION"),this.view=1,this.socialIdNotMatchingError=!0,O(),this.render();return}}else{d("MAIN",t===W.AuthMethod.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,O(),this.render();return}d("MAIN",t===W.AuthMethod.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,o=!1){o||d("MAIN","CONFIRMATION_BANKID_STATUS_SAME_DEVICE_REQUESTED","CONFIRMATION");try{this.setBankidRequestRef(t,W.AuthMethod.SameDevice);let a=e.getAutoLaunchUrl();this.contexts.bankId?.update(W.AuthMethod.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),Oe("bankidStatusInterval",this.bankidStatusInterval),this.qrCode(e),this.bankidQrCodeInterval=setInterval(async()=>{this.qrCode(e)},1e3),Oe("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 o=await ac(e);t||d("MAIN","CONFIRMATION_BANKID_INIT_SUCCEEDED","CONFIRMATION");let a=o.getOrderRef();e===W.AuthMethod.QrCode?this.startBankidWithQr(a,t):this.startBankidSameDevice(o,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,O(),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=Ie(),{navigation:t,order:o,insurance:a}=this.props.store.getState();if(this.view===2)this.contexts.bankId=new je(Q(),{method:e?W.AuthMethod.SameDevice:W.AuthMethod.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=o?.contactInformation?.name,l=o?.conditionsPdfUri,c="https://www.wayke.se/trygghet-naer-det-kommer-till-dina-personuppgifter";this.node.innerHTML=`
1525
1529
  <div class="waykeecom-stack waykeecom-stack--3">
1526
1530
  <h4 class="waykeecom-heading waykeecom-heading--4">Strax klart!</h4>
1527
1531
  <div class="waykeecom-content">
@@ -1552,7 +1556,7 @@
1552
1556
  <div class="waykeecom-stack waykeecom-stack--1" id="${uc}"></div>
1553
1557
  </div>
1554
1558
  </div>
1555
- `,this.contexts.confirmConditions=new et(this.node.querySelector(`#${dc}`),{checked:this.confirmConditions,id:hc,disabled:this.notAvailable,name:"confirmConditions",title:`<div>Jag godk\xE4nner <a href="${l}" title="" target="_blank" rel="noopener noreferrer" class="waykeecom-link">k\xF6pvillkor och villkor f\xF6r \xE5ngerr\xE4tt</a>${a?' <span class="waykeecom-text waykeecom-text--margin-left">samt har tagit del av information kring f\xF6rs\xE4kringsf\xF6rmedling</span>':""}.</div>`,value:"confirmConditions",onClick:m=>this.onCheckbox(m)}),this.contexts.startBankid=new fe(this.node.querySelector(`#${mc}`),{title:"Reservera bilen",id:hd,disabled:!this.confirmConditions||this.notAvailable,onClick:()=>{this.view=2,this.render()}}),new ke(this.node.querySelector(`#${pc}`),{text:`Dina personuppgifter behandlas och sparas i enlighet med v\xE5r <a href="${c}" title="personuppgiftspolicy" target="_blank" rel="noopener noreferrer" class="waykeecom-link">personuppgiftspolicy</a>.`}),new ge(this.node.querySelector(`#${uc}`),{text:"Vi reserverar oss f\xF6r eventuell \xE4ndring i tillg\xE5ngen av utbjudna bilar."}),t.stage===this.props.index&&this.node.parentElement?.scrollIntoView()}}},kc=So;var wo=class extends r{constructor(e,t){super(e);this.view=1;this.props=t,_(this.props.store,"navigation",()=>{this.render()}),this.render()}render(){let{store:e,index:t}=this.props,{topNavigation:o,navigation:a,order:n}=e.getState(),l=o.stage>t,c=H(this.node,{completed:l,title:n?.isPaymentRequired?"Betalning":"Slutf\xF6r ordern",id:"confirmation",active:a.stage===t});a.stage===t&&(a.subStage===2?new ic(c,{store:e}):new kc(c,{lastStage:!0,index:t,store:this.props.store}),c.parentElement?.scrollIntoView())}},yc=wo;var No=class extends r{constructor(e,t){super(e);this.props=t,_(this.props.store,"navigation.view",o=>{o===2&&this.render()}),this.render(),this.node.scrollTop=0}render(){let{store:e,cdnMedia:t}=this.props,o=e.getState(),{order:a,stages:n}=o;if(!a)throw"No order available";this.node.innerHTML="";let l=document.createElement("div");this.node.appendChild(l);let c=document.createElement("aside");c.className="waykeecom-cart",c.setAttribute("aria-label","Fordonsinformation"),c.innerHTML=sc({vehicle:o.vehicle,order:o.order,cdnMedia:t}),l.appendChild(c);let m=document.createElement("div");m.className="waykeecom-stepper",l.appendChild(m);let u=n?.length;n?.forEach((h,p)=>new st[h.name].component(m,{store:e,index:p+1,lastStage:!1})),new yc(m,{store:e,index:(u||0)+1,lastStage:!0})}},vc=No;var Ao=class extends r{constructor(i){super(i,{htmlTag:"div",className:"waykeecom-stack waykeecom-stack--4"})}},Y=Ao;var To=class extends Y{constructor(e,t){super(e);this.props=t,this.render()}render(){let{store:e}=this.props,t=e.getState(),{order:o,tradeIn:a,tradeInVehicle:n}=t;!o?.allowsTradeIn||(this.node.innerHTML=`
1559
+ `,this.contexts.confirmConditions=new et(this.node.querySelector(`#${dc}`),{checked:this.confirmConditions,id:hc,disabled:this.notAvailable,name:"confirmConditions",title:`<div>Jag godk\xE4nner <a href="${l}" title="" target="_blank" rel="noopener noreferrer" class="waykeecom-link">k\xF6pvillkor och villkor f\xF6r \xE5ngerr\xE4tt</a>${a?' <span class="waykeecom-text waykeecom-text--margin-left">samt har tagit del av information kring f\xF6rs\xE4kringsf\xF6rmedling</span>':""}.</div>`,value:"confirmConditions",onClick:m=>this.onCheckbox(m)}),this.contexts.startBankid=new fe(this.node.querySelector(`#${mc}`),{title:"Reservera bilen",id:hd,disabled:!this.confirmConditions||this.notAvailable,onClick:()=>{this.view=2,this.render()}}),new ke(this.node.querySelector(`#${pc}`),{text:`Dina personuppgifter behandlas och sparas i enlighet med v\xE5r <a href="${c}" title="personuppgiftspolicy" target="_blank" rel="noopener noreferrer" class="waykeecom-link">personuppgiftspolicy</a>.`}),new ge(this.node.querySelector(`#${uc}`),{text:"Vi reserverar oss f\xF6r eventuell \xE4ndring i tillg\xE5ngen av utbjudna bilar."}),t.stage===this.props.index&&this.node.parentElement?.scrollIntoView()}}},kc=So;var wo=class extends r{constructor(e,t){super(e);this.view=1;this.props=t,_(this.props.store,"navigation",()=>{this.render()}),this.render()}render(){let{store:e,index:t}=this.props,{topNavigation:o,navigation:a,order:n}=e.getState(),l=o.stage>t,c=B(this.node,{completed:l,title:n?.isPaymentRequired?"Betalning":"Slutf\xF6r ordern",id:"confirmation",active:a.stage===t});a.stage===t&&(a.subStage===2?new ic(c,{store:e}):new kc(c,{lastStage:!0,index:t,store:this.props.store}),c.parentElement?.scrollIntoView())}},yc=wo;var No=class extends r{constructor(e,t){super(e);this.props=t,_(this.props.store,"navigation.view",o=>{o===2&&this.render()}),this.render(),this.node.scrollTop=0}render(){let{store:e,cdnMedia:t}=this.props,o=e.getState(),{order:a,stages:n}=o;if(!a)throw"No order available";this.node.innerHTML="";let l=document.createElement("div");this.node.appendChild(l);let c=document.createElement("aside");c.className="waykeecom-cart",c.setAttribute("aria-label","Fordonsinformation"),c.innerHTML=sc({vehicle:o.vehicle,order:o.order,cdnMedia:t}),l.appendChild(c);let m=document.createElement("div");m.className="waykeecom-stepper",l.appendChild(m);let u=n?.length;n?.forEach((h,p)=>new st[h.name].component(m,{store:e,index:p+1,lastStage:!1})),new yc(m,{store:e,index:(u||0)+1,lastStage:!0})}},vc=No;var Ao=class extends r{constructor(i){super(i,{htmlTag:"div",className:"waykeecom-stack waykeecom-stack--4"})}},Y=Ao;var To=class extends Y{constructor(e,t){super(e);this.props=t,this.render()}render(){let{store:e}=this.props,t=e.getState(),{order:o,tradeIn:a,tradeInVehicle:n}=t;!o?.allowsTradeIn||(this.node.innerHTML=`
1556
1560
  <div class="waykeecom-stack waykeecom-stack--4">
1557
1561
  <div class="waykeecom-stack waykeecom-stack--2">
1558
1562
  <h4 class="waykeecom-heading waykeecom-heading--4 waykeecom-no-margin">Inbytesbil</h4>