@wayke-se/ecom-web 1.7.5 → 1.7.6
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/README.md +2 -2
- package/dist/index.cjs +336 -376
- package/dist/index.cjs.map +4 -4
- package/dist/index.css +1 -1
- package/dist/index.css.map +3 -3
- package/dist/index.d.ts +20 -9
- package/dist/index.mjs +306 -346
- package/dist/index.mjs.map +4 -4
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{config as
|
|
1
|
+
import{config as fd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",version:"1.7.6",description:"Wayke Ecom Web",type:"module",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:"npx @biomejs/biome check","lint:fix":"npx @biomejs/biome check --write",stylelint:"stylelint '**/*.scss'",prepare:"husky"},author:"Wayke",license:"ISC",devDependencies:{"@biomejs/biome":"^1.9.3","@ourstudio/clip-ui":"^0.0.11","@types/node":"^22.7.6","@types/object-path":"^0.11.1","@types/sanitize-html":"^2.6.2","@types/showdown":"^2.0.6","@typescript-eslint/eslint-plugin":"^8.9.0","@typescript-eslint/parser":"^8.9.0",esbuild:"^0.24.0","esbuild-sass-plugin":"^3.2.0",husky:"^9.0.11","npm-dts":"^1.3.11",rimraf:"^6.0.1",stylelint:"^16.2.1","stylelint-config-prettier-scss":"^1.0.0","stylelint-config-standard-scss":"^13.0.0",typescript:"^5.1.3"},dependencies:{"@wayke-se/ecom":"^4.5.0","object-path":"^0.11.8",redux:"^5.0.1","sanitize-html":"^2.7.0",showdown:"^2.1.0"},files:["dist"]};var we=a=>({costs:a.getCosts(),fees:a.getFees(),interests:a.getInterests(),durationSpec:a.getDurationSpec(),downPaymentSpec:a.getDownPaymentSpec(),residualValueSpec:a.getResidualValueSpec(),totalResidualValue:a.getTotalResidualValue(),publicURL:a.getPublicURL(),shouldUseCreditScoring:a.shouldUseCreditScoring(),financialProductCode:a.getFinancialProductCode(),price:a.getPrice(),creditAmount:a.getCreditAmount(),hasPrivacyPolicy:a.hasPrivacyPolicy(),privacyPolicyUrl:a.getPrivacyPolicyUrl(),moneyLaunderingInformationURL:a.getMoneyLaunderingInformationURL(),financialOptionId:a.getFinancialOptionId()}),Jo=a=>({status:a.getStatus(),hasPendingSigning:a.hasPendingSigning(),hintCode:a.getHintCode(),signingMessage:a.getSigningMessage(),shouldRenewSigning:a.shouldRenewSigning(),isSigned:a.isSigned(),address:void 0,pendingScoring:a.hasPendingScoring(),isScored:a.isScored(),hasScoringError:a.hasScoringError(),scoringId:a.getScoringId(),recommendation:a.getRecommendation(),decision:a.getDecision(),isAccepted:a.isAccepted()}),Fe=a=>({orderVehicle:a.getOrderVehicle(),accessories:a.getAccessories(),requiresDealerSelection:a.requiresDealerSelection(),dealerSites:a.getDealerSites(),paymentOptions:a.getPaymentOptions().map(e=>({...e,loanDetails:e.loanDetails?we(e.loanDetails):void 0})),deliveryOptions:a.getDeliveryOptions(),insuranceOption:a.getInsuranceOption(),orderConditions:a.getOrderConditions(),orderReturnConditions:a.getOrderReturnConditions(),conditionsPdfUri:a.getConditionsPdfUri(),contactInformation:a.getContactInformation(),allowsTradeIn:a.allowsTradeIn(),isUnavailable:a.isUnavailable(),isPaymentRequired:a.isPaymentRequired()}),jo=a=>({vehicle:a.getVehicle()});var at="RESET",Po=a=>t=>t({type:at,id:a}),st="SET_ORDER",Le=(a,t)=>e=>e({type:st,order:a,vehicle:t}),nt="SET_ID",$o=a=>t=>t({type:nt,id:a}),rt="SET_CONTACT_EMAIL_AND_PHONE",Ko=a=>t=>t({type:rt,value:a}),ct="SET_SOCIAL_ID_AND_ADDRESS",qo=(a,t,e)=>i=>i({type:ct,socialId:a,address:t,lastStage:e}),lt="SET_HOME_DELIVERY",ea=(a,t)=>e=>e({type:lt,homeDelivery:a,lastStage:t}),dt="SET_DEALER",ta=(a,t)=>e=>e({type:dt,dealer:a,lastStage:t}),mt="INIT_TRADE_IN",ia=a=>t=>t({type:mt,lastStage:a}),pt="SET_TRADE_IN",Ne=(a,t,e)=>i=>i({type:pt,lastStage:a,tradeIn:t,tradeInVehicle:e}),gt="SET_FINANCIAL",oa=(a,t)=>e=>e({type:gt,paymentType:a,lastStage:t}),It="SET_PAYMENT_LOOKUP_RESPONSE",aa=a=>t=>t({type:It,paymentLookupResponse:we(a)}),ut="RESET_PAYMENT_LOOKUP_RESPONSE",sa=()=>a=>a({type:ut}),bt="SET_DRIVING_DISTANCE",na=a=>t=>t({type:bt,drivingDistance:a}),yt="COMPLETE_STAGE",$=a=>t=>t({type:yt,lastStage:a}),ht="SET_OR_REMOVE_INSURANCE",me=a=>t=>t({type:ht,insurance:a}),kt="SET_OR_REMOVE_INSURANCE_ADDONS",ra=(a,t)=>e=>e({type:kt,insurance:a,insuranceAddons:t}),Ct="SET_OR_REMOVE_FREE_INSURANCE",ca=a=>t=>t({type:Ct,freeInsurance:a}),At="SET_OR_REMOVE_ACCESSORY",la=a=>t=>t({type:At,accessory:a}),vt="GO_TO",S=(a,t,e)=>i=>i({type:vt,view:a,index:t,subStage:e}),wt="SET_STAGES",da=a=>t=>t({type:wt,stages:a}),Nt="SET_CREATED_ORDER_ID",ma=(a,t)=>e=>e({type:Nt,id:a,payment:t}),Gt="SET_CREDIT_ASSESSMENT_RESPONSE",pe=(a,t)=>e=>e({type:Gt,caseId:a,creditAssessmentResponse:t}),ft="SET_STATE",pa=a=>t=>t({type:ft,state:a});import{createStore as Pc}from"redux";import{DrivingDistance as zc,PaymentType as ga}from"@wayke-se/ecom";var xt=(a,t)=>a!==void 0&&t!==void 0?JSON.stringify(a).localeCompare(JSON.stringify(t))===0:a===t;var Jc={};var Ia={view:"preview",stage:1,subStage:1},ua={id:"",topNavigation:{...Ia},navigation:{...Ia},customer:{email:"",phone:"",givenName:"",surname:"",socialId:""},homeDelivery:!1,accessories:[],drivingDistance:zc.Between0And1000,...Jc},ne=(a,t)=>t?{view:"summary",stage:1,subStage:1}:{view:"main",stage:a+1,subStage:1},re=(a,t)=>t.view==="main"?a.stage<t.stage?t:b.topNavigation:{...a,stage:a.stage+1},Bt=a=>a&&a?.length===1&&a?.[0].type===ga.Cash?ga.Cash:void 0,b,Et,jc=(a=ua,t)=>{let e,i;switch(b={...a},t.type){case at:return{...ua,id:t.id};case wt:return{...b,stages:t.stages};case nt:return{...b,id:t.id};case st:return{...a,order:t.order,paymentType:Bt(t.order?.paymentOptions),vehicle:{...t.order.orderVehicle,...t.vehicle||{}}};case rt:let o={...b,customer:{...a.customer,email:t.value.email,phone:t.value.phone},navigation:{view:"main",stage:a.navigation.stage,subStage:2}};return delete o.wantTradeIn,delete o.tradeIn,delete o.tradeInVehicle,o.paymentType=Bt(a.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(b.navigation.stage,t.lastStage),i=re(b.topNavigation,e),b={...a,navigation:e,topNavigation:i,address:t.address,customer:{...a.customer,socialId:t.socialId}},b;case dt:return e=ne(a.navigation.stage,t.lastStage),i={...e},b={...a,navigation:e,topNavigation:i,dealer:t.dealer},delete b.wantTradeIn,delete b.tradeIn,delete b.tradeInVehicle,b.paymentType=Bt(a.order?.paymentOptions),delete b.paymentLookupResponse,delete b.insurance,delete b.insuranceAddOns,delete b.freeInsurance,b.accessories=[],b;case lt:return e=ne(a.navigation.stage,t.lastStage),i=re(b.topNavigation,e),b={...a,navigation:e,topNavigation:i,homeDelivery:t.homeDelivery},b;case mt:return e={view:"main",stage:a.navigation.stage,subStage:1},i=re(b.topNavigation,e),b={...a,navigation:e,wantTradeIn:!0,topNavigation:i,tradeIn:a.tradeIn||{registrationNumber:"",mileage:"",description:""}},b;case pt:return e=ne(a.navigation.stage,t.lastStage),i=re(b.topNavigation,e),b={...a,navigation:e,topNavigation:i,wantTradeIn:!!t.tradeIn,tradeIn:t.tradeIn,tradeInVehicle:t.tradeInVehicle},b;case gt:return e=ne(a.navigation.stage,t.lastStage),i=re(b.topNavigation,e),{...b,navigation:e,topNavigation:i,paymentType:t.paymentType};case ut:return{...b,paymentLookupResponse:void 0};case It:return{...b,paymentLookupResponse:t.paymentLookupResponse};case bt:return{...b,drivingDistance:t.drivingDistance};case yt:return e=ne(a.navigation.stage,t.lastStage),i=re(b.topNavigation,e),b={...a,navigation:e,topNavigation:i},b;case kt:return b.insurance=t.insurance,b.insuranceAddOns={insurance:t.insurance.name,addOns:t.insuranceAddons},b;case ht:return xt(b.insurance,t.insurance)?b.insurance=void 0:b.insurance=t.insurance,b.insuranceAddOns?.insurance&&(b.insuranceAddOns=void 0),b;case Ct:return xt(b.freeInsurance,t.freeInsurance)?b.freeInsurance=void 0:b.freeInsurance=t.freeInsurance,b;case At:return Et=b.accessories.findIndex(s=>s.id===t.accessory.id),b.accessories=[...b.accessories],Et>-1?b.accessories.splice(Et,1):b.accessories.push(t.accessory),{...b,accessories:[...b.accessories]};case vt:return{...a,navigation:{view:t.view,stage:t.index||1,subStage:t.subStage||1}};case Nt:return t.payment?e={view:"main",stage:a.navigation.stage,subStage:2}:e=ne(a.navigation.stage,!0),i=re(b.topNavigation,e),b={...a,navigation:e,topNavigation:i,createdOrderId:t.id,payment:t.payment},b;case Gt:return{...b,caseId:t.caseId,creditAssessmentResponse:t.creditAssessmentResponse};case ft:return{...t.state};default:return a}},ba=jc;var ya=()=>Pc(ba);function ha(a){a.addEventListener("keydown",t=>{if(t.key==="Tab"){let i=a.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex]:not([tabindex="-1"])');if(i.length===0)return;let o=i[0],s=i[i.length-1];t.shiftKey?document.activeElement===o&&(t.preventDefault(),s.focus()):document.activeElement===s&&(t.preventDefault(),o.focus())}})}var Rt=class{constructor(t,e){if(!t)throw"Missing element";if(!e){this.element=t,this.node=t;return}this.element=t;let i=e.id?this.element.querySelector(`#${e.id}`):void 0;if(i)i.className=e.className||"",e.attributes?.forEach(o=>{i.setAttribute(o.key,o.value)}),this.node=i;else{let o=document.createElement(e.htmlTag);e.id&&(o.id=e.id),o.className=e.className||"",e.attributes?.forEach(s=>{o.setAttribute(s.key,s.value)}),t.appendChild(o),this.node=o}}},r=Rt;var St=class extends r{constructor(t,{id:e}){super(t,{htmlTag:"div",className:"waykeecom-modal__body",id:e})}},ka=St;var Ot=class extends r{constructor(t,{id:e}){super(t,{htmlTag:"div",className:"waykeecom-modal__center",id:e})}},Ca=Ot;var Ft=class extends r{constructor(t,e){super(t),this.props=e,this.render()}render(){let{title:t,id:e,onClick:i}=this.props;this.node.innerHTML=`
|
|
2
2
|
<button
|
|
3
3
|
title="${t}"
|
|
4
4
|
${e?`id="${e}"`:""}
|
|
@@ -14,7 +14,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
14
14
|
<path d="M9.1 8l5.9 5.9-1.1 1.1L8 9.1 2.1 15 1 13.9 6.9 8 1 2.1 2.1 1 8 6.9 13.9 1 15 2.1 9.1 8z" />
|
|
15
15
|
</svg>
|
|
16
16
|
</button>
|
|
17
|
-
`,i&&this.node.querySelector("button")?.addEventListener("click",i)}},
|
|
17
|
+
`,i&&this.node.querySelector("button")?.addEventListener("click",i)}},Aa=Ft;var Lt=class extends r{constructor(e,i){super(e,{htmlTag:"div",className:"waykeecom-modal__close",id:i.id});this.handleKeydown=e=>{e.key==="Escape"&&this.props.onClose&&this.props.onClose()};this.props=i,this.render(),this.props.onClose&&window.addEventListener("keydown",this.handleKeydown)}render(){let{onClose:e}=this.props;this.node.innerHTML="",e&&new Aa(this.node,{title:"St\xE4ng modalen",onClick:()=>e()})}},va=Lt;var Xt=class extends r{constructor(t,{id:e}){super(t,{htmlTag:"div",className:"waykeecom-modal__container",id:e})}},wa=Xt;var _t=class extends r{constructor(t,{id:e}){super(t,{htmlTag:"div",className:"waykeecom-modal__dialog",id:e})}},Na=_t;var Tt=class extends r{constructor(t,e){super(t,{htmlTag:"footer",className:"waykeecom-modal__footer",id:e.id}),this.props=e,this.render()}render(){this.node.innerHTML=`
|
|
18
18
|
<div class="waykeecom-hstack waykeecom-hstack--spacing-1 waykeecom-hstack--align-center">
|
|
19
19
|
<div class="waykeecom-hstack__item waykeecom-hstack__item--no-shrink">
|
|
20
20
|
<svg class="waykeecom-modal__footer-logo" viewBox="0 0 185.57 109.13" preserveAspectRatio="xMinYMid" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
@@ -40,7 +40,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
40
40
|
Powered by <a href="https://www.wayke.se/" title="G\xE5 till wayke.se" target="_blank" rel="noopener noreferer" class="waykeecom-link waykeecom-link--no-external-icon waykeecom-link--current-color waykeecom-link--underline">Wayke</a>
|
|
41
41
|
</div>
|
|
42
42
|
</div>
|
|
43
|
-
`}},
|
|
43
|
+
`}},Ga=Tt;var Wt=class extends r{constructor(t,e){super(t,{htmlTag:"header",className:"waykeecom-modal__header",id:e.id}),this.props=e,this.render()}render(){let{title:t,logo:e,logoX2:i,onClose:o}=this.props;this.node.innerHTML=`
|
|
44
44
|
<div class="waykeecom-header">
|
|
45
45
|
<div class="waykeecom-header__logo">
|
|
46
46
|
<h2 class="waykeecom-no-margin">
|
|
@@ -100,12 +100,12 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
100
100
|
</h2>
|
|
101
101
|
</div>
|
|
102
102
|
</div>
|
|
103
|
-
`,o&&this.node.querySelectorAll("button").forEach(s=>{s.addEventListener("click",()=>o())})}},
|
|
103
|
+
`,o&&this.node.querySelectorAll("button").forEach(s=>{s.addEventListener("click",()=>o())})}},fa=Wt;var Zt=class extends r{constructor(t,e){super(t,{htmlTag:"div",className:"waykeecom-modal",attributes:[{key:"role",value:"dialog"},{key:"aria-modal",value:"true"},{key:"aria-labelledby",value:"wayke-ecom-title"}],id:e.id}),this.props=e,this.content=this.render(),ha(this.node)}render(){let{title:t,id:e,onClose:i}=this.props,o=new wa(this.node,{id:`${e}-container`}),s=new Ca(o.node,{id:`${e}-center`}),n=new Na(s.node,{id:`${e}-dialog`});new va(n.node,{id:`${e}-close`,onClose:i}),new fa(n.node,{title:t,logo:this.props.logo,logoX2:this.props.logoX2,onClose:i,id:`${e}-header`});let l=new ka(n.node,{id:`${e}-body`});return new Ga(n.node,{id:`${e}-footer`}),l.node}},Vt=Zt;import{creditAssessment as $c}from"@wayke-se/ecom";var Ge=a=>$c.cancelSigning(a);import{get as xa}from"object-path";var Kc=(a,t)=>a===t,qc=(a,t,e)=>{let i=e||Kc,o=xa(a(),t);return s=>()=>{let n=xa(a(),t);if(!i(o,n)){let l=o;o=n,s(n,l,t)}}},Ba=[],el=a=>(Ba.push(a),a),Ea=()=>Ba.forEach(a=>a()),tl=(a,t,e,i)=>{let o=qc(a.getState,t);if(i)a.subscribe(o(e));else return el(a.subscribe(o(e)))},A=tl;var Xe=[],Ra=a=>{Xe.push(a)},Sa=a=>{let t=Xe.findIndex(e=>e===a);t>-1&&Xe.splice(t,1)},Ut=[],fe=()=>Ut[Ut.length-1],il=(a,t,e,i)=>{Ut.push({view:a,ecomEvent:t,currentStep:e}),Xe.forEach(o=>o(a,t,e,i))},d=il;var _e={},xe=(a,t)=>{_e[a]=t},Dt=()=>{Object.keys(_e).forEach(a=>{clearInterval(_e[a]),delete _e[a]})};var Qt=()=>{let a=document.documentElement.clientWidth/100;document.documentElement.style.setProperty("--waykeecom-vw",`${a}px`)},Oa=()=>(Qt(),window.addEventListener("resize",Qt),()=>window.removeEventListener("resize",Qt));var ol=a=>{switch(a){case"inline":return"waykeecom-loader--inline-block";default:return""}},al=a=>{let t=["waykeecom-loader"],e=ol(a?.type);return e&&t.push(e),`
|
|
104
104
|
<div class="${t.join(" ")}" role="status">
|
|
105
105
|
<div class="waykeecom-loader__spinner" aria-hidden="true"></div>
|
|
106
106
|
<div class="waykeecom-sr-only">Laddar...</div>
|
|
107
107
|
</div>
|
|
108
|
-
`},R=
|
|
108
|
+
`},R=al;var Yt=class extends r{constructor(t,e){super(t),this.props=e,this.render()}isDisabled(){return this.props.disabled}disabled(t){this.props.disabled!==t&&(this.props.disabled=t,this.render())}loading(t){this.props.loading!==t&&(this.props.loading=t,this.props.disabled=t,this.render())}render(){let{title:t,id:e,disabled:i,loading:o,onClick:s}=this.props;this.node.innerHTML=`
|
|
109
109
|
<button
|
|
110
110
|
type="button"
|
|
111
111
|
${e?`id="${e}"`:""}
|
|
@@ -119,7 +119,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
119
119
|
${R({type:"inline"})}
|
|
120
120
|
</span>`:""}
|
|
121
121
|
</button>
|
|
122
|
-
`,s&&this.node.querySelector("button")?.addEventListener("click",s)}},Te=Yt;var Ht=class extends
|
|
122
|
+
`,s&&this.node.querySelector("button")?.addEventListener("click",s)}},Te=Yt;var Ht=class extends r{constructor(t,e){super(t),this.props=e,this.render()}isDisabled(){return this.props.disabled}disabled(t){this.props.disabled!==t&&(this.props.disabled=t,this.render())}loading(t){this.props.loading!==t&&(this.props.loading=t,this.props.disabled=t,this.render())}render(){let{title:t,id:e,disabled:i,loading:o,onClick:s}=this.props;this.node.innerHTML=`
|
|
123
123
|
<button
|
|
124
124
|
type="button"
|
|
125
125
|
${e?`id="${e}"`:""}
|
|
@@ -133,7 +133,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
133
133
|
${R({type:"inline"})}
|
|
134
134
|
</span>`:""}
|
|
135
135
|
</button>
|
|
136
|
-
`,s&&this.node.querySelector("button")?.addEventListener("click",s)}},
|
|
136
|
+
`,s&&this.node.querySelector("button")?.addEventListener("click",s)}},Fa=Ht;var La="confirm-close-node",Xa="abort-close-node",Mt=class extends r{constructor(t,e){super(t),this.props=e,this.render()}render(){let{onConfirmClose:t,onAbortClose:e}=this.props;this.node.innerHTML=`
|
|
137
137
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
138
138
|
<div class="waykeecom-stack waykeecom-stack--2">
|
|
139
139
|
<div class="waykeecom-hstack waykeecom-hstack--spacing-2 waykeecom-hstack--align-center">
|
|
@@ -161,27 +161,28 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
161
161
|
</div>
|
|
162
162
|
</div>
|
|
163
163
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
164
|
-
<div class="waykeecom-stack waykeecom-stack--1" id="${
|
|
165
|
-
<div class="waykeecom-stack waykeecom-stack--1" id="${
|
|
164
|
+
<div class="waykeecom-stack waykeecom-stack--1" id="${Xa}"></div>
|
|
165
|
+
<div class="waykeecom-stack waykeecom-stack--1" id="${La}"></div>
|
|
166
166
|
</div>
|
|
167
|
-
`,new Te(this.node.querySelector(`#${
|
|
167
|
+
`,new Te(this.node.querySelector(`#${Xa}`),{title:"Forts\xE4tt min order",onClick:()=>e()}),new Fa(this.node.querySelector(`#${La}`),{title:"Avbryt min order",onClick:()=>t()})}},_a=Mt;var We=(a,t)=>{if(!t)return a;let e=new URL(a);return`${t}${e.pathname}`};var sl=a=>a.toString().replace(/\s/g,""),nl=(a,t)=>{if(!t)return a;let e=Math.pow(10,t);return(Math.round(a*e)/e).toFixed(t)},u=(a,t)=>{if(a===void 0)return"???";let e=nl(a,t?.decimals!==void 0?t.decimals:0);return`${t?.prefix?`${t.prefix}`:""}${sl(e).replace(/\B(?=(\d{3})+(?!\d))/g," ")}${t?.postfix?` ${t.postfix}`:""}`},rl=(a,t)=>{let e=a.split(" "),i=t.split(" ").map(o=>o.toLowerCase());return e.filter(o=>!i.includes(o.toLowerCase())).join(" ")},ge=a=>{if(a)return rl(a.shortDescription||"",a.title||"")};var cl=({vehicle:a,order:t,cdnMedia:e})=>{let i=a?.imageUrls?.[0],o=a?.title,s=u(a?.price||NaN),n=t?.contactInformation?.name;return`
|
|
168
168
|
<div class="waykeecom-preview-card">
|
|
169
169
|
${i?`
|
|
170
170
|
<div class="waykeecom-preview-card__media">
|
|
171
|
-
<img src="${
|
|
171
|
+
<img src="${We(i,e)}?spec=200x&format=webp" alt="" class="waykeecom-preview-card__image" />
|
|
172
172
|
</div>
|
|
173
173
|
`:""}
|
|
174
|
-
<
|
|
175
|
-
<
|
|
176
|
-
<
|
|
174
|
+
<dl class="waykeecom-preview-card__body">
|
|
175
|
+
<dt class="waykeecom-sr-only">S\xE4ljare</dt>
|
|
176
|
+
<dd class="waykeecom-preview-card__seller">${n}</dd>
|
|
177
|
+
<dt class="waykeecom-sr-only">Modell</dt>
|
|
178
|
+
<dd class="waykeecom-preview-card__heading">
|
|
177
179
|
<span class="waykeecom-preview-card__title">${o}</span> ${ge(a)}
|
|
178
|
-
</
|
|
179
|
-
<
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
</div>
|
|
180
|
+
</dd>
|
|
181
|
+
<dt class="waykeecom-sr-only">Pris</dt>
|
|
182
|
+
<dd class="waykeecom-preview-card__price">${s} kr</dd>
|
|
183
|
+
</dl>
|
|
183
184
|
</div>
|
|
184
|
-
`},
|
|
185
|
+
`},Ta=cl;var zt=class extends r{constructor(t,e){super(t),this.props=e,this.render()}isDisabled(){return this.props.disabled}disabled(t){this.props.disabled!==t&&(this.props.disabled=t,this.render())}loading(t){this.props.loading!==t&&(this.props.loading=t,this.props.disabled=t,this.render())}render(){let{title:t,id:e,disabled:i,loading:o,onClick:s}=this.props;this.node.innerHTML=`
|
|
185
186
|
<button
|
|
186
187
|
type="button"
|
|
187
188
|
${e?`id="${e}"`:""}
|
|
@@ -202,7 +203,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
202
203
|
</svg>`}
|
|
203
204
|
</span>
|
|
204
205
|
</button>
|
|
205
|
-
`,s&&this.node.querySelector("button")?.addEventListener("click",s)}},v=
|
|
206
|
+
`,s&&this.node.querySelector("button")?.addEventListener("click",s)}},v=zt;var Jt=class extends r{constructor(t,e){super(t),this.props=e,this.render()}render(){let{title:t,id:e,onClick:i}=this.props;this.node.innerHTML=`
|
|
206
207
|
<button
|
|
207
208
|
type="button"
|
|
208
209
|
${e?`id="${e}"`:""}
|
|
@@ -221,7 +222,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
221
222
|
</span>
|
|
222
223
|
<span class="waykeecom-button__content">${t}</span>
|
|
223
224
|
</button>
|
|
224
|
-
`,i&&this.node.querySelector("button")?.addEventListener("click",i)}},
|
|
225
|
+
`,i&&this.node.querySelector("button")?.addEventListener("click",i)}},Y=Jt;var ll=({key:a,value:t,image:e})=>`
|
|
225
226
|
<li class="waykeecom-key-value-list__item">
|
|
226
227
|
${e?`<div class="waykeecom-key-value-list__key">
|
|
227
228
|
<img src="${e.src}" ${e.srcSet?`srcSet="${e.srcSet}"`:""} alt="${e.alt}" class="waykeecom-key-value-list__key-image" />
|
|
@@ -229,7 +230,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
229
230
|
</div>`:`<div class="waykeecom-key-value-list__key">${a}</div>`}
|
|
230
231
|
<div class="waykeecom-key-value-list__value">${t}</div>
|
|
231
232
|
</li>
|
|
232
|
-
`,h=
|
|
233
|
+
`,h=ll;var jt=class extends r{constructor(t,e){super(t,{htmlTag:"div"}),this.props=e,this.render()}render(){let{keyValueList:t,changeButtonTitle:e,onEdit:i}=this.props;this.node.innerHTML=`
|
|
233
234
|
<div class="waykeecom-stack waykeecom-stack--1">
|
|
234
235
|
<ul class="waykeecom-key-value-list">
|
|
235
236
|
${t.map(o=>h({key:o.key,image:o.image,value:o.value})).join("")}
|
|
@@ -242,7 +243,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
242
243
|
</div>
|
|
243
244
|
</div>
|
|
244
245
|
`:""}
|
|
245
|
-
`,i&&this.node.querySelector("button")?.addEventListener("click",()=>i())}},
|
|
246
|
+
`,i&&this.node.querySelector("button")?.addEventListener("click",()=>i())}},j=jt;var dl=(a,t)=>{let{title:e,active:i,completed:o,id:s}=t,n=document.getElementById(s),l=n||document.createElement("li");n||l.setAttribute("id",s);let c=["waykeecom-stepper__item"];l.removeAttribute("aria-current"),l.removeAttribute("aria-disabled"),i?(c.push("waykeecom-stepper__item--is-active"),l.setAttribute("aria-current","step")):o?c.push("waykeecom-stepper__item--is-complete"):(c.push("waykeecom-stepper__item--is-disabled"),l.setAttribute("aria-disabled","true")),l.className=c.join(" "),l.innerHTML=`
|
|
246
247
|
<header class="waykeecom-stepper__header">
|
|
247
248
|
<div class="waykeecom-stepper__icon" aria-hidden="true">
|
|
248
249
|
<div class="waykeecom-icon-backdrop waykeecom-icon-backdrop--success">
|
|
@@ -257,14 +258,15 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
257
258
|
</div>
|
|
258
259
|
</div>
|
|
259
260
|
<h3 class="waykeecom-heading waykeecom-heading--3 waykeecom-no-margin">
|
|
260
|
-
<span class="waykeecom-stepper__stage"
|
|
261
|
-
Steg
|
|
261
|
+
<span class="waykeecom-stepper__stage">
|
|
262
|
+
Steg ${t.index} \u2013
|
|
262
263
|
</span>
|
|
263
264
|
${e}
|
|
265
|
+
${o?'<span class="waykeecom-sr-only">(F\xE4rdigst\xE4llt)</span>':""}
|
|
264
266
|
</h3>
|
|
265
267
|
</header>
|
|
266
268
|
<div class="waykeecom-stepper__body"></div>
|
|
267
|
-
`,n||a.appendChild(l);let m=l.querySelector(".waykeecom-stepper__body");if(!m)throw"Err no element";return m},
|
|
269
|
+
`,n||a.appendChild(l);let m=l.querySelector(".waykeecom-stepper__body");if(!m)throw"Err no element";return m},X=dl;var Pt=class extends r{constructor(t,e){super(t),this.props=e,this.render()}hide(t){this.props.hide!==t&&(this.props.hide=t,this.render())}render(){if(this.props.hide){this.node.innerHTML="";return}let{title:t,dataIcon:e,path:i}=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=`
|
|
268
270
|
<button type="button" title="${t}" class="waykeecom-icon-button">
|
|
269
271
|
<svg
|
|
270
272
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -275,19 +277,19 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
275
277
|
${i}
|
|
276
278
|
</svg>
|
|
277
279
|
</button>
|
|
278
|
-
`,this.node.querySelector("button")?.addEventListener("click",()=>this.props.onClick())}},$t=Pt;var
|
|
280
|
+
`,this.node.querySelector("button")?.addEventListener("click",()=>this.props.onClick())}},$t=Pt;var Wa=a=>{let t=a?.children?.[0]?.clientWidth||0,e=a?.scrollWidth||0,i=a?.scrollLeft||0,o=a?.offsetWidth||0,s=e-o;return{itemWidth:t,scrollWidth:e,scrollLeft:i,overflowElementWidth:o,overflowElementScrollWidth:s}},Kt=class extends r{constructor(e,i){super(e,{htmlTag:"div",className:"waykeecom-overflow-grid"});this.contexts={};this.props=i,this.render()}onPrev(){this.props.onClick&&this.props.onClick();let e=this.overflowElement;if(e){let i=e.children?.[0]?.clientWidth||0,o=e.scrollLeft||0;if(o>0){this.contexts.right?.hide(!1);let s=o-i;e.scroll({left:s,behavior:"smooth"}),s<=0&&this.contexts.left?.hide(!0)}}}onNext(){this.props.onClick&&this.props.onClick();let e=this.overflowElement;if(e){let{itemWidth:i,scrollLeft:o,overflowElementScrollWidth:s}=Wa(e);if(s!==o){this.contexts.left?.hide(!1);let n=o+i;e.scroll({left:n,behavior:"smooth"}),n>=s&&this.contexts.right?.hide(!0)}}}scrollHandler(){clearTimeout(this.timeout),this.timeout=setTimeout(()=>{let e=this.overflowElement;if(e){let i=e.scrollWidth||0;if(i<=e.offsetWidth)return;let o=e.scrollLeft||0;this.contexts.left?.hide(o<=0);let s=e.offsetWidth||0,n=i-s;this.contexts.right?.hide(n===o)}},50)}render(){let e=`${this.props.id}-prev`,i=`${this.props.id}-next`;this.node.innerHTML=`
|
|
279
281
|
<div class="waykeecom-overflow-grid__nav waykeecom-overflow-grid__nav--prev" id="${e}"></div>
|
|
280
282
|
<div class="waykeecom-overflow-grid__nav waykeecom-overflow-grid__nav--next" id="${i}"></div>
|
|
281
283
|
<div class="waykeecom-overflow-grid__list-wrapper">
|
|
282
284
|
<ul class="waykeecom-overflow-grid__list" id="${this.props.id}"></ul>
|
|
283
285
|
</div>
|
|
284
|
-
`,this.overflowElement=this.node.querySelector(`#${this.props.id}`)||void 0,this.overflowElement?.addEventListener("scroll",()=>this.scrollHandler()),this.contexts.left=new $t(this.node.querySelector(`#${e}`),{direction:"left",hide:!0,onClick:()=>this.onPrev()}),this.contexts.right=new $t(this.node.querySelector(`#${i}`),{direction:"right",hide:!0,onClick:()=>this.onNext()}),setTimeout(()=>{let{itemWidth:o,scrollLeft:s,overflowElementScrollWidth:n}=
|
|
286
|
+
`,this.overflowElement=this.node.querySelector(`#${this.props.id}`)||void 0,this.overflowElement?.addEventListener("scroll",()=>this.scrollHandler()),this.contexts.left=new $t(this.node.querySelector(`#${e}`),{direction:"left",hide:!0,onClick:()=>this.onPrev()}),this.contexts.right=new $t(this.node.querySelector(`#${i}`),{direction:"right",hide:!0,onClick:()=>this.onNext()}),setTimeout(()=>{let{itemWidth:o,scrollLeft:s,overflowElementScrollWidth:n}=Wa(this.overflowElement),l=s+o,c=n===s&&l>=n;this.contexts.right?.hide(c)},50)}},Ie=Kt;var qt=class extends r{constructor(t,e){super(t),this.props=e,this.render()}isDisabled(){return this.props.disabled}disabled(t){this.props.disabled!==t&&(this.props.disabled=t,this.render())}loading(t){this.props.loading!==t&&(this.props.loading=t,this.props.disabled=t,this.render())}render(){let{id:t,disabled:e,loading:i,selected:o,fullSize:s,onClick:n}=this.props,l=o?"Vald":"L\xE4gg till",c=["waykeecom-button",s?"waykeecom-button--full-width":"waykeecom-button--size-small"];o?c.push("waykeecom-button--success"):c.push("waykeecom-button--action-alt");let m=o?'<path d="M12.3 3.3 6 9.6 3.7 7.3c-.4-.4-1-.4-1.4 0-.4.4-.4 1 0 1.4l3 3c.4.4 1 .4 1.4 0l7-7c.4-.4.4-1 0-1.4-.4-.4-1-.4-1.4 0z"/>':'<path d="M14 7v2H9v5H7V9H2V7h5V2h2v5h5z" />';this.node.innerHTML=`
|
|
285
287
|
<button
|
|
286
288
|
type="button"
|
|
287
289
|
${t?`id="${t}"`:""}
|
|
288
290
|
title="${l}"
|
|
289
291
|
${e&&'disabled=""'}
|
|
290
|
-
class="${
|
|
292
|
+
class="${c.join(" ")}"
|
|
291
293
|
>
|
|
292
294
|
<span class="waykeecom-button__content">
|
|
293
295
|
<svg
|
|
@@ -302,7 +304,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
302
304
|
<span class="waykeecom-button__content">${l}</span>
|
|
303
305
|
${i?`<span class="waykeecom-button__content">${R({type:"inline"})}</div>`:""}
|
|
304
306
|
</button>
|
|
305
|
-
`,n&&this.node.querySelector("button")?.addEventListener("click",n)}},
|
|
307
|
+
`,n&&this.node.querySelector("button")?.addEventListener("click",n)}},q=qt;var ei=class extends r{constructor(t,e){super(t),this.props=e,this.render()}disabled(t){this.props.disabled=!t,this.render()}render(){let{title:t,id:e,disabled:i,onClick:o}=this.props;this.node.innerHTML=`
|
|
306
308
|
<button
|
|
307
309
|
${e?`id="${e}"`:""}
|
|
308
310
|
title="${t}"
|
|
@@ -311,7 +313,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
311
313
|
>
|
|
312
314
|
${t}
|
|
313
315
|
</button>
|
|
314
|
-
`,o&&this.node.querySelector("button")?.addEventListener("click",o)}},
|
|
316
|
+
`,o&&this.node.querySelector("button")?.addEventListener("click",o)}},Z=ei;var ml="button-add-remove",pl=`${ml}-node`,gl="read-more",Il=`${gl}-node`,ti=class extends r{constructor(e,i,o){super(e,{htmlTag:"li",className:"waykeecom-overflow-grid__item",id:o});this.hasBeenInViewPort=!1;this.props=i,this.render(),this.attachInViewportTrigger()}attachInViewportTrigger(){this.props.inViewPort&&!this.hasBeenInViewPort&&new IntersectionObserver(i=>{if(!this.hasBeenInViewPort)for(let o of i)o.intersectionRatio===1&&(this.hasBeenInViewPort=!0,this.props.inViewPort&&this.props.inViewPort())},{threshold:[1]}).observe(this.node)}render(){let{id:e,title:i,image:o,logo:s,price:n,priceDetails:l,description:c,selected:m,onClick:p,onInfo:y}=this.props,I=e&&y?`${Il}-${e}`:void 0,k=e?`${pl}-${e}`:void 0;this.node.innerHTML=`
|
|
315
317
|
<div class="waykeecom-tile">
|
|
316
318
|
${o?`<img src="${o}" alt="${i}" class="waykeecom-tile__hero" />`:""}
|
|
317
319
|
<div class="waykeecom-tile__body">
|
|
@@ -326,14 +328,14 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
326
328
|
<div class="waykeecom-tile__price">${n}</div>
|
|
327
329
|
${l?.length?`<div class="waykeecom-tile__price-disclaimer">+ ${l.map(g=>`${g.key} (${g.value})`).join(", ")}</div>`:""}
|
|
328
330
|
<div class="waykeecom-tile__description">
|
|
329
|
-
${
|
|
331
|
+
${c||""}
|
|
330
332
|
</div>
|
|
331
333
|
${I?`
|
|
332
334
|
<div class="waykeecom-tile__read-more" id="${I}"></div>`:""}
|
|
333
335
|
</div>
|
|
334
336
|
<div class="waykeecom-tile__footer" id="${k}"></div>
|
|
335
337
|
</div>
|
|
336
|
-
`,
|
|
338
|
+
`,y&&new Z(this.node.querySelector(`#${I}`),{title:"L\xE4s mer",onClick:()=>y()}),new q(this.node.querySelector(`#${k}`),{selected:m,onClick:()=>p()})}},ue=ti;var H=()=>{O();let a=document.getElementById("wayke-ecom-modal-body");a&&a.firstElementChild.setAttribute("hidden","");let t=document.createElement("div");return t.className="waykeecom-portal",a?.appendChild(t),t},O=()=>{let a=document.getElementById("wayke-ecom-modal-body");a&&a.firstElementChild.removeAttribute("hidden"),a?.childNodes.forEach((t,e)=>{e>0&&t.remove()})};var ii=class extends r{constructor(t,e){super(t),this.props=e,this.render()}disabled(t){this.props.disabled=!t,this.render()}render(){let{title:t,id:e,disabled:i,onClick:o}=this.props;this.node.innerHTML=`
|
|
337
339
|
<button
|
|
338
340
|
${e?`id="${e}"`:""}
|
|
339
341
|
title="${t}"
|
|
@@ -352,11 +354,11 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
352
354
|
</span>
|
|
353
355
|
<span class="waykeecom-link__content">${t}</span>
|
|
354
356
|
</button>
|
|
355
|
-
`,o&&this.node.querySelector("button")?.addEventListener("click",o)}},
|
|
357
|
+
`,o&&this.node.querySelector("button")?.addEventListener("click",o)}},ce=ii;var oi=class extends r{constructor(t,e){super(t),this.props=e,this.render()}render(){let{title:t,id:e,onClick:i}=this.props;this.node.innerHTML=`
|
|
356
358
|
<button type="button" id="${e}" title="${t}" class="waykeecom-button waykeecom-button--full-width waykeecom-button--action-clear">
|
|
357
359
|
${t}
|
|
358
360
|
</button>
|
|
359
|
-
`,i&&this.node.querySelector("button")?.addEventListener("click",i)}},
|
|
361
|
+
`,i&&this.node.querySelector("button")?.addEventListener("click",i)}},ee=oi;var ai=class extends r{constructor(t,e){super(t),this.props=e,this.render()}hide(t){this.props.hide!==t&&(this.props.hide=t,this.render())}render(){if(this.props.hide){this.node.innerHTML="";return}let{title:t,dataIcon:e,path:i}=this.props.direction==="left"?{title:"Visa f\xF6reg\xE5ende bild",dataIcon:"Chevron left",path:'<path d="m5.4 7 5.2-5 1 1-5.2 5 5.2 5-1.1 1-5.2-5-1-1 1.1-1z" />'}:{title:"Visa n\xE4sta bild",dataIcon:"Chevron right",path:'<path d="m10.5 9-5.2 5-1-1 5.2-5-5.2-5 1.1-1 5.2 5 1 1-1.1 1z" />'};this.node.innerHTML=`
|
|
360
362
|
<button type="button" title="${t}" class="waykeecom-icon-button">
|
|
361
363
|
<svg
|
|
362
364
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -367,7 +369,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
367
369
|
${i}
|
|
368
370
|
</svg>
|
|
369
371
|
</button>
|
|
370
|
-
`,this.node.querySelector("button")?.addEventListener("click",()=>this.props.onClick())}},si=ai;var
|
|
372
|
+
`,this.node.querySelector("button")?.addEventListener("click",()=>this.props.onClick())}},si=ai;var Za=a=>{let t=a?.children?.[0]?.clientWidth||0,e=a?.scrollWidth||0,i=a?.scrollLeft||0,o=a?.offsetWidth||0,s=e-o;return{itemWidth:t,scrollWidth:e,scrollLeft:i,overflowElementWidth:o,overflowElementScrollWidth:s}},ni=class extends r{constructor(e,i){super(e,{htmlTag:"div",className:"waykeecom-overflow-gallery"});this.contexts={};this.props=i,this.render()}onPrev(){let e=this.contexts.overflowElement;if(e){let i=e?.clientWidth||0,o=e.scrollLeft||0;if(o>0){this.contexts.right?.hide(!1);let s=o-i;e.scroll({left:s,behavior:"smooth"}),s<=0&&this.contexts.left?.hide(!0),this.props.onGalleryImagePaging&&this.props.onGalleryImagePaging()}}}onNext(){let e=this.contexts.overflowElement;if(e){let{itemWidth:i,scrollLeft:o,overflowElementScrollWidth:s}=Za(e);if(s!==o){this.contexts.left?.hide(!1);let n=o+i;e.scroll({left:n,behavior:"smooth"}),n>=s&&this.contexts.right?.hide(!0),this.props.onGalleryImagePaging&&this.props.onGalleryImagePaging()}}}scrollHandler(){clearTimeout(this.timeout),this.timeout=setTimeout(()=>{let e=this.contexts.overflowElement;if(e){let i=e.scrollWidth||0;if(i<=e.offsetWidth)return;let o=e.scrollLeft||0;this.contexts.left?.hide(o<=0);let s=e.offsetWidth||0,n=i-s;this.contexts.right?.hide(n===o)}},50)}render(){let e=`${this.props.id}-prev`,i=`${this.props.id}-next`;this.node.innerHTML=`
|
|
371
373
|
<div class="waykeecom-overflow-gallery__nav waykeecom-overflow-gallery__nav--prev" id="${e}"></div>
|
|
372
374
|
<div class="waykeecom-overflow-gallery__nav waykeecom-overflow-gallery__nav--next" id="${i}"></div>
|
|
373
375
|
<ul class="waykeecom-overflow-gallery__list" id="${this.props.id}">
|
|
@@ -377,8 +379,8 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
377
379
|
</li>
|
|
378
380
|
`).join("")}
|
|
379
381
|
</ul>
|
|
380
|
-
`,this.contexts.overflowElement=this.node.querySelector(`#${this.props.id}`)||void 0,this.contexts.overflowElement?.addEventListener("scroll",()=>this.scrollHandler()),this.contexts.left=new si(this.node.querySelector(`#${e}`),{direction:"left",hide:!0,onClick:()=>this.onPrev()}),this.contexts.right=new si(this.node.querySelector(`#${i}`),{direction:"right",hide:!0,onClick:()=>this.onNext()}),setTimeout(()=>{let{itemWidth:o,scrollLeft:s,overflowElementScrollWidth:n}=
|
|
381
|
-
<div class="waykeecom-nav-banner" id="${
|
|
382
|
+
`,this.contexts.overflowElement=this.node.querySelector(`#${this.props.id}`)||void 0,this.contexts.overflowElement?.addEventListener("scroll",()=>this.scrollHandler()),this.contexts.left=new si(this.node.querySelector(`#${e}`),{direction:"left",hide:!0,onClick:()=>this.onPrev()}),this.contexts.right=new si(this.node.querySelector(`#${i}`),{direction:"right",hide:!0,onClick:()=>this.onNext()}),setTimeout(()=>{let{itemWidth:o,scrollLeft:s,overflowElementScrollWidth:n}=Za(this.contexts.overflowElement),l=s+o,c=n===s&&l>=n;this.contexts.right?.hide(c)},50)}},Va=ni;import Ze from"sanitize-html";import ul from"showdown";var bl=new ul.Converter({openLinksInNewWindow:!0}),Ve=a=>Ze(bl.makeHtml(a||""),{allowedTags:[...Ze.defaults.allowedTags,"img"],allowedAttributes:{...Ze.defaults.allowedAttributes,img:["src","srcset","alt","title","width","height","loading"]},selfClosing:[...Ze.defaults.selfClosing,"img"]});var V=()=>{let a=document.getElementById(Be),t=document.getElementById(`${Be}-dialog`);a&&(a.scrollTop=0),t&&(t.scrollTop=0)};var Ua="accessory-button-top-left-node",Da="accessory-button-bottom-left-node",Qa="accessory-add-remove-node",Ya="accessory-gallery-node",ri=class extends r{constructor(t,e){super(t),this.props=e,this.render()}onGalleryImagePaging(){let{accessory:t}=this.props;d("MAIN","ACCESSORY_INFORMATION_GALLERY_IMAGE_PAGING","ACCESSORY",{id:t.id,label:t.name})}render(){let{accessory:t,selected:e,onClick:i,onClose:o}=this.props,{name:s,media:n,logoUrl:l,price:c,shortDescription:m,longDescription:p,salePrice:y}=t;this.node.innerHTML=`
|
|
383
|
+
<div class="waykeecom-nav-banner" id="${Ua}"></div>
|
|
382
384
|
|
|
383
385
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
384
386
|
|
|
@@ -394,10 +396,10 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
394
396
|
</div>
|
|
395
397
|
|
|
396
398
|
</div>
|
|
397
|
-
<div class="waykeecom-stack waykeecom-stack--3" id="${
|
|
399
|
+
<div class="waykeecom-stack waykeecom-stack--3" id="${Ya}"></div>
|
|
398
400
|
|
|
399
401
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
400
|
-
${
|
|
402
|
+
${y?`<div class="waykeecom-text waykeecom-text--font-bold">${u(y,{postfix:"kr"})}<span class="waykeecom-text waykeecom-text--tone-alt waykeecom-text--line-through"> (${u(c,{postfix:"kr"})})</span></div>`:`<div class="waykeecom-text waykeecom-text--font-bold">${u(c,{postfix:"kr"})}</div>`}
|
|
401
403
|
</div>
|
|
402
404
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
403
405
|
<div class="waykeecom-content waykeecom-text waykeecom-text--font-medium">
|
|
@@ -410,10 +412,10 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
410
412
|
</div>
|
|
411
413
|
</div>
|
|
412
414
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
413
|
-
<div class="waykeecom-stack waykeecom-stack--1" id="${
|
|
414
|
-
<div class="waykeecom-stack waykeecom-stack--1" id="${
|
|
415
|
+
<div class="waykeecom-stack waykeecom-stack--1" id="${Qa}"></div>
|
|
416
|
+
<div class="waykeecom-stack waykeecom-stack--1" id="${Da}"></div>
|
|
415
417
|
</div>
|
|
416
|
-
`,new
|
|
418
|
+
`,new Va(this.node.querySelector(`#${Ya}`),{id:`gallery-${t.id}`,media:n.map((I,k)=>({url:I.url,alt:`Bild ${k+1}`})),onGalleryImagePaging:()=>this.onGalleryImagePaging()}),new ce(this.node.querySelector(`#${Ua}`),{title:"Tillbaka",onClick:()=>o()}),new ee(this.node.querySelector(`#${Da}`),{title:"Tillbaka",onClick:()=>o()}),new q(this.node.querySelector(`#${Qa}`),{selected:e,fullSize:!0,onClick:()=>i()}),V()}},Ha=ri;var ci=class extends r{constructor(e,i){super(e);this.displayInfo=!1;this.exposureTracked=!1;this.props=i,A(this.props.store,"accessories",(o,s)=>{o.some(n=>n.id===this.props.accessory.id)!==s.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:i}=this.props,s=e.getState().accessories.findIndex(n=>n.id===i.id)>-1;d("MAIN",s?"ACCESSORY_UNSELECTED":"ACCESSORY_SELECTED","ACCESSORY",{id:i.id,label:i.name}),la(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:i,key:o}=this.props,n=e.getState().accessories.findIndex(l=>l.id===i.id)>-1;this.displayInfo&&new Ha(H(),{accessory:i,selected:n,onClick:()=>{this.onInfoClose(),this.onClick()},onClose:()=>this.onInfoClose()}),new ue(this.node,{id:i.id,title:i.name,description:i.shortDescription,logo:i.logoUrl,image:i.media?.[0]?.url,price:u(i.price,{postfix:"kr"}),selected:n,onClick:()=>this.onClick(),onInfo:()=>this.onInfoOpen(),inViewPort:this.exposureTracked?void 0:()=>this.trackExposure()},o)}},Ma=ci;var li=class extends r{constructor(t,e){super(t),this.props=e,this.render()}render(){let{accessories:t,store:e}=this.props,i=new Ie(this.node,{id:"accessories-list",onClick:()=>d("MAIN","ACCESSORY_ARROWS","ACCESSORY")}),{overflowElement:o}=i;o&&(o.innerHTML="",t.forEach((s,n)=>new Ma(o,{store:e,accessory:s,key:`accessory-${s.id}-${n}`})))}},za=li;var $a="button-accessories-proceed",Ja=`${$a}-node`,yl="button-accessories-skip",ja=`${yl}-node`,Pa="accessory-grid-list-node",di=class extends r{constructor(t,e){super(t),this.props=e,A(this.props.store,"navigation",()=>{this.render()}),this.render()}onProceed(){$(this.props.lastStage)(this.props.store.dispatch)}onEdit(){d("MAIN","ACCESSORY_EDIT","ACCESSORY"),S("main",this.props.index)(this.props.store.dispatch)}render(){let{store:t,index:e}=this.props,i=t.getState(),o=i.topNavigation.stage>e,s=i.navigation.stage===e;s&&d("MAIN","ACCESSORY_ACTIVE","ACCESSORY");let n=X(this.node,{completed:o,title:"Tillbeh\xF6r",active:s,id:"accessories",index:e}),l=document.createElement("div");if(i.navigation.stage>e||o&&i.navigation.stage!==e)new j(n,{keyValueList:i.accessories.length?i.accessories.map(c=>({key:c.name,image:c.media[0]?{src:`${c.media[0].url}?w=32&h=32`,srcSet:`${c.media[0].url}?w=64&h=64 2x`,alt:c.name}:void 0,value:u(c.price,{postfix:"kr"})})):[{key:"Tillbeh\xF6r",value:"Inga valda"}],changeButtonTitle:"\xC4ndra tillbeh\xF6r",onEdit:i.createdOrderId?void 0:()=>this.onEdit()});else if(i.navigation.stage===e){let c=i.order?.accessories||[];l.innerHTML=`
|
|
417
419
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
418
420
|
<div class="waykeecom-stack waykeecom-stack--2">
|
|
419
421
|
<h4 class="waykeecom-heading waykeecom-heading--4">Vill du k\xF6pa till ett tillbeh\xF6r till din nya bil?</h4>
|
|
@@ -423,13 +425,13 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
423
425
|
</div>
|
|
424
426
|
</div>
|
|
425
427
|
|
|
426
|
-
<div class="waykeecom-stack waykeecom-stack--3" id="${
|
|
428
|
+
<div class="waykeecom-stack waykeecom-stack--3" id="${Pa}"></div>
|
|
427
429
|
|
|
428
430
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
429
|
-
<div class="waykeecom-stack waykeecom-stack--1" id="${
|
|
430
|
-
<div class="waykeecom-stack waykeecom-stack--1" id="${
|
|
431
|
+
<div class="waykeecom-stack waykeecom-stack--1" id="${Ja}"></div>
|
|
432
|
+
<div class="waykeecom-stack waykeecom-stack--1" id="${ja}"></div>
|
|
431
433
|
</div>
|
|
432
|
-
`,new
|
|
434
|
+
`,new za(l.querySelector(`#${Pa}`),{store:t,accessories:c}),new v(l.querySelector(`#${Ja}`),{id:$a,title:"G\xE5 vidare",onClick:()=>this.onProceed()}),new Y(l.querySelector(`#${ja}`),{title:"Hoppa \xF6ver detta steg",onClick:()=>this.onProceed()})}n.appendChild(l),i.navigation.stage===e&&n.parentElement?.scrollIntoView()}},Ka=di;var qa="waykeecom-input-error",mi=class extends r{constructor(t,e){super(t),this.props=e,this.render()}setError(t){this.props.error=t,this.render()}render(){let{error:t,errorMessage:e}=this.props,i=this.node.querySelector(`.${qa}`);if(i)t||i.remove();else if(t){let o=document.createElement("div");o.className=qa,o.setAttribute("aria-live","assertive"),o.innerHTML=e,this.node.appendChild(o),this.props.id&&(o.id=this.props.id)}}},te=mi;var es="waykeecom-input-label__help",ts="waykeecom-input-label__foldout",pi=class extends r{constructor(e,i){super(e);this.open=!1;this.props=i,this.render()}onClick(){this.open=!this.open,this.props.onClickInformation&&this.props.onClickInformation(this.open),this.render()}render(){let{information:e}=this.props;if(e){let i=this.node.querySelector(`.${es}`),o=this.node.querySelector(`.${ts}`),s=i||document.createElement("div");if(i||(s.className=es),this.open){s.innerHTML=`
|
|
433
435
|
<button class="waykeecom-input-label__help-btn" title="Vad betyder detta?">
|
|
434
436
|
<span class="waykeecom-sr-only">St\xE4ng hj\xE4lp</span>
|
|
435
437
|
<svg
|
|
@@ -442,7 +444,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
442
444
|
<path d="M8 0C3.6 0 0 3.6 0 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14c-3.3 0-6-2.7-6-6s2.7-6 6-6 6 2.7 6 6-2.7 6-6 6zm3.5-8.1L9.4 8l2.1 2.1-1.4 1.4L8 9.4l-2.1 2.1-1.4-1.4L6.6 8 4.5 5.9l1.4-1.4L8 6.6l2.1-2.1 1.4 1.4z" />
|
|
443
445
|
</svg>
|
|
444
446
|
</button>
|
|
445
|
-
`;let n=document.createElement("div");n.className=
|
|
447
|
+
`;let n=document.createElement("div");n.className=ts,n.innerHTML=e,s.parentNode?.appendChild(n)}else o?.remove(),s.innerHTML=`
|
|
446
448
|
<button class="waykeecom-input-label__help-btn" title="Vad betyder detta?">
|
|
447
449
|
<span class="waykeecom-sr-only">Visa hj\xE4lp</span>
|
|
448
450
|
<svg
|
|
@@ -455,7 +457,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
455
457
|
<path d="M8 0C3.6 0 0 3.6 0 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14c-3.3 0-6-2.7-6-6s2.7-6 6-6 6 2.7 6 6-2.7 6-6 6zm-1.4-3.8h1.9V12H6.6v-1.8zm3.8-3.4c0 1-.5 1.5-1.4 2l-.4.3c-.3.1-.3.2-.3.4v.1H6.7v-.3c0-.6.1-.9.8-1.3l.7-.4c.3-.2.6-.4.6-.8s-.3-.7-.7-.7c-.5 0-.8.3-.8.8v.3H5.7v-.4c0-1.2.8-2 2.3-2 1.5 0 2.4.7 2.4 2z" />
|
|
456
458
|
</svg>
|
|
457
459
|
</button>
|
|
458
|
-
`;s.querySelector("button")?.addEventListener("click",()=>this.onClick()),i||this.node.appendChild(s)}}},
|
|
460
|
+
`;s.querySelector("button")?.addEventListener("click",()=>this.onClick()),i||this.node.appendChild(s)}}},ie=pi;var gi=class extends r{constructor(t,e){super(t),this.props=e,this.render()}render(){let{id:t,title:e,value:i,name:o,checked:s,meta:n,description:l,disabled:c,onClick:m}=this.props;this.node.innerHTML=`
|
|
459
461
|
<div class="waykeecom-input-selection" role="radio">
|
|
460
462
|
<input
|
|
461
463
|
type="radio"
|
|
@@ -463,7 +465,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
463
465
|
value="${i}"
|
|
464
466
|
name="${o}"
|
|
465
467
|
${s?'checked="true"':""}
|
|
466
|
-
${
|
|
468
|
+
${c?'disabled=""':""}
|
|
467
469
|
class="waykeecom-input-selection__input"
|
|
468
470
|
/>
|
|
469
471
|
<div class="waykeecom-input-selection__header">
|
|
@@ -476,14 +478,14 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
476
478
|
</label>
|
|
477
479
|
`:""}
|
|
478
480
|
</div>
|
|
479
|
-
`;let p=this.node.querySelector(`#${t}`);p&&m&&p.addEventListener("click",m)}},Ee=gi;var Ii=class extends
|
|
481
|
+
`;let p=this.node.querySelector(`#${t}`);p&&m&&p.addEventListener("click",m)}},Ee=gi;var Ii=class extends r{constructor(e,i){super(e);this.contexts={};this.props=i,this.render()}updateBorder(){let e=this.node.querySelector(".waykeecom-input-text");e&&(this.props.error?e?.classList.add("waykeecom-input-text--has-error"):e?.classList.remove("waykeecom-input-text--has-error"))}setError(e){this.props.error=e,this.updateBorder(),this.contexts.error?.setError(e)}render(){let{title:e,options:i,name:o,checked:s,error:n,errorMessage:l,information:c,footer:m,onClick:p,onClickInformation:y}=this.props;this.node.innerHTML=`
|
|
480
482
|
<fieldset class="waykeecom-input-group" role="radiogroup" aria-required="true">
|
|
481
483
|
${e?`<legend class="waykeecom-input-label"><div class="waykeecom-input-label__label">${e}</div></legend>`:""}
|
|
482
484
|
${i.map(I=>`<div class="waykeecom-input-group__item" id="${I.id}-node"></div>`).join("")}
|
|
483
485
|
${m?`<div class="waykeecom-input-group__footer">${m}</div>`:""}
|
|
484
486
|
</fieldset>
|
|
485
|
-
`,this.updateBorder(),l&&(this.contexts.error=new
|
|
486
|
-
<div class="waykeecom-alert ${a?`waykeecom-alert--${a}`:""}" role="alert">
|
|
487
|
+
`,this.updateBorder(),l&&(this.contexts.error=new te(this.node,{error:n,errorMessage:l})),i.forEach(I=>new Ee(this.node.querySelector(`#${I.id}-node`),{id:I.id,name:o,title:I.title||I.value,value:I.value,checked:s===I.value,description:I.description,meta:I.meta,onClick:k=>p(k)})),c&&new ie(this.node.querySelector(".waykeecom-input-label"),{information:c,onClickInformation:y})}},M=Ii;import{orders as ui}from"@wayke-se/ecom";var Ue=(a,t)=>{let e=t?ui.newOptionsRequest().forVehicle(a).forDealer(t):ui.newOptionsRequest().forVehicle(a);return ui.getOptions(e.build())};var hl=({tone:a,children:t,polite:e})=>`
|
|
488
|
+
<div class="waykeecom-alert ${a?`waykeecom-alert--${a}`:""}" role="${e?"status":"alert"}" ${e?'aria-live="polite"':""}>
|
|
487
489
|
<div class="waykeecom-alert__icon">
|
|
488
490
|
<div class="waykeecom-alert__icon-badge">
|
|
489
491
|
<svg
|
|
@@ -500,7 +502,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
500
502
|
${t}
|
|
501
503
|
</div>
|
|
502
504
|
</div>
|
|
503
|
-
`,C=
|
|
505
|
+
`,C=hl;var as="button-central-storage-proceed",is=`${as}-node`,kl="central-storage-branch",os=`${kl}-node`,bi=class extends r{constructor(e,i){super(e);this.requestError=!1;this.contexts={};this.props=i,A(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:i,vehicle:o}=this.props.store.getState();try{this.contexts.proceedButton?.loading(!0);let s=await Ue(i,e);d("MAIN","CENTRAL_STORAGE_SET","CENTRAL_STORAGE"),Le(Fe(s),o),ta(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"),S("main",this.props.index)(this.props.store.dispatch)}onProceed(){this.selectedDealer&&this.updateOrder(this.selectedDealer)}render(){let{order:e,navigation:i,topNavigation:o,createdOrderId:s}=this.props.store.getState(),{index:n}=this.props,l=e?.dealerSites||[],c=o.stage>n,m=i.stage===n;m&&d("MAIN","CENTRAL_STORAGE_ACTIVE","CENTRAL_STORAGE");let p=X(this.node,{completed:c,active:m,title:"Centrallager",id:"central-storage",index:n});if((i.stage>n||c&&i.stage!==n)&&this.selectedDealer){let y=l.find(I=>I.id===this.selectedDealer);new j(p,{keyValueList:[{key:"Val av anl\xE4ggning",value:y?.name||""}],changeButtonTitle:"\xC4ndra",onEdit:s?void 0:()=>this.onEdit()})}else if(i.stage===n){p.innerHTML=`
|
|
504
506
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
505
507
|
<h4 class="waykeecom-heading waykeecom-heading--4">Vilken anl\xE4ggning vill du k\xF6pa ifr\xE5n?</h4>
|
|
506
508
|
<div class="waykeecom-content">
|
|
@@ -508,12 +510,12 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
508
510
|
</div>
|
|
509
511
|
</div>
|
|
510
512
|
|
|
511
|
-
<div class="waykeecom-stack waykeecom-stack--3" id="${
|
|
513
|
+
<div class="waykeecom-stack waykeecom-stack--3" id="${os}"></div>
|
|
512
514
|
|
|
513
515
|
${this.requestError?`<div class="waykeecom-stack waykeecom-stack--3">${C({tone:"error",children:"Ett fel uppstod och det gick inte att v\xE4lja ovanst\xE5ende anl\xE4ggning. F\xF6rs\xF6k igen."})}</div>`:""}
|
|
514
516
|
|
|
515
|
-
<div class="waykeecom-stack waykeecom-stack--3" id="${
|
|
516
|
-
`;let
|
|
517
|
+
<div class="waykeecom-stack waykeecom-stack--3" id="${is}"></div>
|
|
518
|
+
`;let y=l.map(I=>{let k=!I.location?.address||!I.location?.city?"Adress saknas":`${I.location?.address}, ${I.location?.city}`;return{id:`central-storage-${I.id}`,value:I.id,title:I.name,description:`
|
|
517
519
|
<div class="waykeecom-box">
|
|
518
520
|
<div class="waykeecom-icon-content">
|
|
519
521
|
<div class="waykeecom-icon-content__icon">
|
|
@@ -532,7 +534,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
532
534
|
</div>
|
|
533
535
|
</div>
|
|
534
536
|
</div>
|
|
535
|
-
</div>`}});new
|
|
537
|
+
</div>`}});new M(p.querySelector(`#${os}`),{checked:this.selectedDealer,name:"dealer",options:y,onClick:I=>this.onChange(I)}),this.contexts.proceedButton=new v(p.querySelector(`#${is}`),{title:"G\xE5 vidare",id:as,disabled:!this.selectedDealer,onClick:()=>this.onProceed()})}i.stage===n&&p.parentElement?.scrollIntoView()}},ss=bi;var oe=a=>a.length<2?a:a.length===2?`${a.substring(0,1)}***`:a.length===3?`${a.substring(0,2)}***`:`${a.substring(0,3)}***`,De=a=>`${a.substring(0,a.length-4)}****`;var yi=class extends r{constructor(e,i){super(e);this.contexts={};this.props=i,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,i){this.props.error=e,i&&(this.props.errorMessage=i),this.updateBorder(),this.contexts.error?.setError(e);let{id:o}=this.props;e?(document.getElementById(o)?.setAttribute("aria-invalid","true"),document.getElementById(o)?.setAttribute("aria-describedby",`${o}-error`)):(document.getElementById(o)?.removeAttribute("aria-invalid"),document.getElementById(o)?.removeAttribute("aria-describedby"))}render(){let{id:e,title:i,type:o,name:s,min:n,value:l,autocomplete:c,placeholder:m,unit:p,error:y,errorMessage:I,information:k,pattern:g,inputmode:w,help:N,onChange:_,onBlur:J,onClickInformation:G}=this.props;this.node.innerHTML=`
|
|
536
538
|
<div class="waykeecom-input-label">
|
|
537
539
|
<label for="${e}" class="waykeecom-input-label__label">${i}</label>
|
|
538
540
|
</div>
|
|
@@ -542,17 +544,19 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
542
544
|
${o==="number"?'pattern="[0-9]*" inputmode="numeric"':""}
|
|
543
545
|
id="${e}"
|
|
544
546
|
${g?`pattern="${g}"`:""}
|
|
545
|
-
${
|
|
547
|
+
${w?`inputmode="${w}"`:""}
|
|
546
548
|
value="${l}"
|
|
547
549
|
name="${s}"
|
|
548
550
|
${n!==void 0?`min="${n}"`:""}
|
|
549
|
-
${
|
|
551
|
+
${c?`autocomplete="${c}"`:""}
|
|
550
552
|
${m?`placeholder="${m}"`:""}
|
|
553
|
+
${N?`aria-describedby="${e}-help"`:""}
|
|
551
554
|
class="waykeecom-input-text__input"
|
|
552
555
|
/>
|
|
553
556
|
${p?`<div class="waykeecom-input-text__unit">${p}</div>`:""}
|
|
554
557
|
</div>
|
|
555
|
-
|
|
558
|
+
${N?`<div class="waykeecom-input-help" id="${e}-help">${N}</div>`:""}
|
|
559
|
+
`,this.updateBorder(),I&&(this.contexts.error=new te(this.node,{error:y,errorMessage:I,id:`${e}-error`})),k&&new ie(this.node.querySelector(".waykeecom-input-label"),{information:k,onClickInformation:G});let U=this.node.querySelector("input");U&&(_&&U.addEventListener("input",_),J&&U.addEventListener("blur",J))}},F=yi;var ns=/\S+@\S+\.\S+/,rs=/^[0-9\-\+\(\)\ ]+$/,cs=/^[0-9\ \-]+$/,ls=/^(19|20)(\d{6}(-|\s)\d{4}|(?!19|20)\d{10})$/,ds=/[a-zA-Z]{3}\d{2}(d||[a-zA-Z]){1}/,Qe=/\D/g;var B={requiredEmail:a=>ns.test(a),requiredTelephone:a=>rs.test(a),requiredSsn:a=>ls.test(a),requiredSsnOver18:a=>{if(B.requiredSsn(a)){let e=a.replace(Qe,"").slice(0,8),i=`${e.slice(0,4)}-${e.slice(4,6)}-${e.slice(6,8)}`;return new Date(new Date().valueOf()-new Date(i).valueOf()).getFullYear()-1970>17}return!1},requiredZip:a=>cs.test(a),requiredNumberOrStringNumberInRange:(a,t,e)=>{let i=parseInt(a.toString(),10);return isNaN(i)?!1:i>=t&&i<=e},requiredNumber:a=>a!=null&&!Number.isNaN(+a),requiredNumberGreaterOrEqualThanZero:a=>{if(a==null)return!1;let t=parseInt(a.toString(),10);return!Number.isNaN(t)&&t>=0},optionalNumberGreaterOrEqualThanZero:a=>{if(a==null||typeof a=="string"&&!a)return!0;let t=parseInt(a.toString(),10);return!Number.isNaN(t)&&t>=0},optionalNumber:a=>a==null||!Number.isNaN(+a),requiredRegistrationNumber:a=>{if(!a)return!1;let t=a.replace(" ",""),e=t.length===6,i=ds.test(t);return e&&i},requiredMileage:a=>B.requiredNumberOrStringNumberInRange(a||"",0,8e4),optionalString:a=>!!a||!a,requiredCondition:a=>["VeryGood","Good","Ok"].includes(a||""),requiredAssessmentMaritalStatus:a=>["married","single","commonLaw"].includes(a||""),requiredAssessmentEmplyment:a=>["other","retired","fullTimeEmployed","student","temporarilyEmployed","selfEmployed"].includes(a||""),requiredHousingType:a=>["singleFamily","condominium","apartment"].includes(a||"")};var ms="contact-email-node",Cl="contact-email",ps="contact-phone-node",Al="contact-phone",gs="contact-proceed-node",vl="contact-proceed",Ye={email:B.requiredEmail,phone:B.requiredTelephone},wl=a=>{let t={email:a?.email||"",phone:a?.phone||""};return{value:t,validation:{email:Ye.email(t.email),phone:Ye.phone(t.phone)},interact:{email:!1,phone:!1}}},hi=class extends r{constructor(e,i){super(e,{htmlTag:"div",className:"waykeecom-stack waykeecom-stack--2"});this.contexts={};this.props=i;let o=this.props.store.getState();this.state=wl(o.customer),this.render()}onChange(e){let i=e.currentTarget,o=i.name,s=i.value;this.state.value[o]=s,this.state.validation[o]=Ye[o](s),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"),Ko({email:this.state.value.email.trim(),phone:this.state.value.phone.trim()})(this.props.store.dispatch)}onChangeContacts(){d("MAIN","CUSTOMER_EDIT","CUSTOMER_EMAIL_AND_PHONE"),S("main",1)(this.props.store.dispatch)}render(){let e=this.props.store.getState().navigation.subStage;if(e>1){let i=[{key:"E-post",value:this.state.value.email},{key:"Telefonnummer",value:this.state.value.phone}];this.node.innerHTML=`
|
|
556
560
|
<div class="waykeecom-stack waykeecom-stack--2">
|
|
557
561
|
<ul class="waykeecom-key-value-list">
|
|
558
562
|
${i.map(o=>h(o)).join("")}
|
|
@@ -573,11 +577,11 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
573
577
|
</div>
|
|
574
578
|
|
|
575
579
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
576
|
-
<div class="waykeecom-stack waykeecom-stack--2" id="${
|
|
577
|
-
<div class="waykeecom-stack waykeecom-stack--2" id="${
|
|
580
|
+
<div class="waykeecom-stack waykeecom-stack--2" id="${ms}"></div>
|
|
581
|
+
<div class="waykeecom-stack waykeecom-stack--2" id="${ps}"></div>
|
|
578
582
|
</div>
|
|
579
|
-
<div class="waykeecom-stack waykeecom-stack--3" id="${
|
|
580
|
-
`,this.contexts.email=new F(this.node.querySelector(`#${
|
|
583
|
+
<div class="waykeecom-stack waykeecom-stack--3" id="${gs}"></div>
|
|
584
|
+
`,this.contexts.email=new F(this.node.querySelector(`#${ms}`),{title:"E-post",value:this.state.value.email,id:Cl,error:this.state.interact.email&&!this.state.validation.email,errorMessage:"En giltig e-postadress m\xE5ste anges",name:"email",autocomplete:"email",placeholder:"Ange din e-postadress",onChange:i=>this.onChange(i),onBlur:i=>this.onBlur(i)}),this.contexts.phone=new F(this.node.querySelector(`#${ps}`),{title:"Telefonnummer",value:this.state.value.phone,id:Al,error:this.state.interact.phone&&!this.state.validation.phone,errorMessage:"Ange ditt telefonnummer",name:"phone",autocomplete:"tel",placeholder:"Ange ditt telefonnummer",onChange:i=>this.onChange(i),onBlur:i=>this.onBlur(i)}),this.contexts.button=new v(this.node.querySelector(`#${gs}`),{title:"G\xE5 vidare",id:vl,disabled:!(this.state.validation.email&&this.state.validation.phone),onClick:()=>this.onProceed()});this.node.querySelector("#change-contacts")?.addEventListener("click",()=>this.onChangeContacts())}},Is=hi;var ki=class extends r{constructor(t,e){super(t),this.props=e,this.render()}render(){this.node.innerHTML=`
|
|
581
585
|
<div class="waykeecom-disclaimer">
|
|
582
586
|
<div class="waykeecom-disclaimer__icon" aria-hidden="true">
|
|
583
587
|
<svg
|
|
@@ -591,7 +595,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
591
595
|
</div>
|
|
592
596
|
<span class="waykeecom-disclaimer__text">${this.props.text}</span>
|
|
593
597
|
</div>
|
|
594
|
-
`}},
|
|
598
|
+
`}},be=ki;import{customers as us}from"@wayke-se/ecom";var bs=a=>{let t=us.newAddressLookupRequest().forCustomer(a).build();return us.lookupAddress(t)};var ys=(a,t)=>a?t:"";var Ci="contact-socialId-node",He="contact-socialId",Nl="contact-social-id-info",Gl=`${He}-proceed`,hs=`${He}-proceed-node`,ks=`${He}-disclaimer-node`,Ai={socialId:B.requiredSsnOver18},fl=a=>{let t={socialId:a?.socialId||""};return{value:t,validation:{socialId:Ai.socialId(t.socialId)},interact:{socialId:!1}}},vi=class extends r{constructor(e,i){super(e,{htmlTag:"div",className:"waykeecom-stack waykeecom-stack--2"});this.requestError=!1;this.contexts={};this.props=i;let o=this.props.store.getState();this.state=fl(o.customer),this.render()}async onFetchAddress(){let{store:e,lastStage:i}=this.props;this.requestError=!1,this.render();try{d("MAIN","CUSTOMER_ADDRESS_BY_SSN_REQUESTED","CUSTOMER_ADDRESS"),this.contexts.buttonFetch?.loading(!0);let o=await bs(this.state.value.socialId);d("MAIN","CUSTOMER_ADDRESS_BY_SSN_SUCCEEDED","CUSTOMER_ADDRESS");let s=o.getAddress();qo(this.state.value.socialId.replace(Qe,""),s,i)(e.dispatch),d("MAIN","CUSTOMER_ADDRESS_SET","CUSTOMER_ADDRESS")}catch{this.requestError=!0,d("MAIN","CUSTOMER_ADDRESS_BY_SSN_FAILED","CUSTOMER_ADDRESS")}finally{this.contexts.buttonFetch?.loading(!1),this.render()}}onChange(e){let i=e.currentTarget,o=i.name,s=i.value;this.state.value[o]=s,this.state.validation[o]=Ai[o](s),this.updateUiError(o),this.updateProceedButton()}onBlur(e){let o=e.currentTarget.name;this.state.interact[o]=!0,this.state.validation[o]=Ai[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.buttonFetch?.disabled(!this.state.validation.socialId)}render(){let e="https://www.wayke.se/trygghet-naer-det-kommer-till-dina-personuppgifter";this.node.innerHTML=`
|
|
595
599
|
<div class="waykeecom-stack waykeecom-stack--2">
|
|
596
600
|
<hr class="waykeecom-separator" />
|
|
597
601
|
</div>
|
|
@@ -604,11 +608,11 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
604
608
|
</div>
|
|
605
609
|
<div class="waykeecom-stack waykeecom-stack--3" id="${Ci}"></div>
|
|
606
610
|
|
|
607
|
-
${
|
|
611
|
+
${ys(this.requestError,`
|
|
608
612
|
<div class="waykeecom-stack waykeecom-stack--3" id="${Ci}">
|
|
609
613
|
${C({tone:"error",children:"Tyv\xE4rr fick vi ingen tr\xE4ff p\xE5 personnumret du angav."})}
|
|
610
614
|
</div>`)}
|
|
611
|
-
<div class="waykeecom-stack waykeecom-stack--3" id="${
|
|
615
|
+
<div class="waykeecom-stack waykeecom-stack--3" id="${Nl}">
|
|
612
616
|
${C({tone:"info",children:`
|
|
613
617
|
<div class="waykeecom-content waykeecom-content--inherit-size">
|
|
614
618
|
<p class="waykeecom-content__p">Vi kommer h\xE4mta f\xF6ljande uppgifter om dig:</p>
|
|
@@ -620,17 +624,17 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
620
624
|
`})}
|
|
621
625
|
</div>
|
|
622
626
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
623
|
-
<div class="waykeecom-stack waykeecom-stack--2" id="${
|
|
624
|
-
<div class="waykeecom-stack waykeecom-stack--2" id="${
|
|
627
|
+
<div class="waykeecom-stack waykeecom-stack--2" id="${hs}"></div>
|
|
628
|
+
<div class="waykeecom-stack waykeecom-stack--2" id="${ks}"></div>
|
|
625
629
|
</div>
|
|
626
630
|
</div>
|
|
627
|
-
`,this.contexts.socialId=new F(this.node.querySelector(`#${Ci}`),{title:"Personnummer",value:this.state.value.socialId,id:He,error:this.state.interact.socialId&&!this.state.validation.socialId,errorMessage:"Ange personnummer i formatet \xC5\xC5\xC5\xC5MMDD-XXXX. M\xE5ste vara \xF6ver 18 \xE5r.",name:"socialId",placeholder:"\xC5\xC5\xC5\xC5MMDD-XXXX",pattern:"[0-9]*",inputmode:"numeric",onChange:i=>this.onChange(i),onBlur:i=>this.onBlur(i)}),Object.keys(this.state.value).forEach(i=>this.updateUiError(i)),this.contexts.buttonFetch=new v(this.node.querySelector(`#${
|
|
631
|
+
`,this.contexts.socialId=new F(this.node.querySelector(`#${Ci}`),{title:"Personnummer",value:this.state.value.socialId,id:He,error:this.state.interact.socialId&&!this.state.validation.socialId,errorMessage:"Ange personnummer i formatet \xC5\xC5\xC5\xC5MMDD-XXXX. M\xE5ste vara \xF6ver 18 \xE5r.",name:"socialId",placeholder:"\xC5\xC5\xC5\xC5MMDD-XXXX",pattern:"[0-9]*",inputmode:"numeric",onChange:i=>this.onChange(i),onBlur:i=>this.onBlur(i)}),Object.keys(this.state.value).forEach(i=>this.updateUiError(i)),this.contexts.buttonFetch=new v(this.node.querySelector(`#${hs}`),{title:"H\xE4mta uppgifter",id:Gl,disabled:!this.state.validation.socialId,onClick:()=>this.onFetchAddress()}),new be(this.node.querySelector(`#${ks}`),{text:`Dina personuppgifter behandlas och sparas i enlighet med v\xE5r <a href="${e}" title="personuppgiftspolicy" target="_blank" rel="noopener noreferrer" class="waykeecom-link">personuppgiftspolicy</a>.`}),this.updateProceedButton()}},Cs=vi;var wi=class extends r{constructor(t,e){super(t,{htmlTag:"div",className:"waykeecom-stack waykeecom-stack--2"}),this.props=e;let i=this.props.store.getState();this.state=i.customer,this.render()}render(){let{store:t,lastStage:e}=this.props;if(t.getState().navigation.subStage>2){let o=[{key:"Personnummer",value:this.state.socialId}];this.node.innerHTML=`
|
|
628
632
|
<div class="waykeecom-stack waykeecom-stack--2">
|
|
629
633
|
<ul class="waykeecom-key-value-list">
|
|
630
634
|
${o.map(s=>h(s)).join("")}
|
|
631
635
|
</ul>
|
|
632
636
|
</div>
|
|
633
|
-
`}else this.node.innerHTML="",new
|
|
637
|
+
`}else this.node.innerHTML="",new Cs(this.node,{store:t,lastStage:e})}},As=wi;var Ni=class extends r{constructor(t,e){super(t),this.props=e,A(this.props.store,"navigation",()=>{this.render()}),this.render()}onChange(){d("MAIN","CUSTOMER_EDIT","CUSTOMER_EMAIL_AND_PHONE"),S("main",this.props.index)(this.props.store.dispatch)}render(){let{store:t,index:e,lastStage:i}=this.props,o=this.props.store.getState(),s=o.topNavigation.stage>e,n=o.navigation.stage===e&&!o.createdOrderId;n&&d("MAIN","CUSTOMER_ACTIVE",o.navigation.subStage===1?"CUSTOMER_EMAIL_AND_PHONE":"CUSTOMER_ADDRESS");let l=X(this.node,{completed:s,title:"Dina uppgifter",active:n,id:"customer",index:e});l.innerHTML="";let c=document.createElement("div");c.className="waykeecom-stack waykeecom-stack--2";let m=document.createElement("div");if(m.className="waykeecom-stack waykeecom-stack--2",o.navigation.stage>e||s&&o.navigation.stage!==e){let p=[{key:"E-post",value:o.customer.email},{key:"Telefonnummer",value:o.customer.phone},{key:"Personnummer",value:De(o.customer.socialId)},...o.address?[{key:"Namn",value:`${oe(o.address.givenName)} ${oe(o.address.surname)}`},{key:"Adress",value:o.address.street},{key:"Postnummer",value:o.address.postalCode},{key:"Stad",value:o.address.city}]:[]];new j(l,{keyValueList:p,changeButtonTitle:"\xC4ndra dina uppgifter",onEdit:o.createdOrderId?void 0:()=>this.onChange()})}else o.navigation.stage===e&&(new Is(l,{store:t}),o.navigation.subStage>1&&new As(l,{store:t,lastStage:i}));o.navigation.stage===e&&l.parentElement?.scrollIntoView()}},vs=Ni;import{DeliveryType as Ns}from"@wayke-se/ecom";var xl=(a,t)=>{if(a)return a.unit==="m"&&t.unit==="km"?Math.round(a.value/1e3):a.unit==="km"&&t.unit==="m"?a.value*1e3:a.value},ws=(a,t)=>{let e=xl(a,t);if(e&&t.unitPrice)return t.startupCost+t.unitPrice*e};var Bs="radio-home-delivery-true",Gs=`${Bs}-node`,Es="radio-home-delivery-false",fs=`${Es}-node`,Rs="button-home-delivery-proceed",xs=`${Rs}-node`,Gi=class extends r{constructor(t,e){super(t),this.props=e,A(this.props.store,"navigation",()=>{this.render()});let i=this.props.store.getState();this.homeDelivery=i.homeDelivery,this.render()}onChange(t){let i=t.currentTarget.value==="true";this.homeDelivery=i,d("MAIN",this.homeDelivery?"DELIVERY_HOME_SELECTED":"DELIVERY_DEALER_SELECTED","DELIVERY")}onProceed(){ea(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"),S("main",this.props.index)(this.props.store.dispatch)}render(){let{store:t,index:e}=this.props,i=t.getState();if(!i.order)throw"Missing order...";let o=i.order.contactInformation;if(!o)throw"Missing dealer contact information";let s=i.topNavigation.stage>e,n=i.navigation.stage===e;n&&d("MAIN","DELIVERY_ACTIVE","DELIVERY");let l=X(this.node,{completed:s,title:"Leverans",active:n,id:"delivery",index:e});if(i.navigation.stage>e||s&&i.navigation.stage!==e)new j(l,{keyValueList:[{key:"Leveranss\xE4tt",value:i.homeDelivery?"Hemleverans":"H\xE4mta hos handlaren"}],changeButtonTitle:"\xC4ndra leveranss\xE4tt",onEdit:i.createdOrderId?void 0:()=>this.onEdit()});else if(i.navigation.stage===e){let c=document.createElement("div");c.innerHTML=`
|
|
634
638
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
635
639
|
<h4 class="waykeecom-heading waykeecom-heading--4">Hur vill du ha din bil levererad?</h4>
|
|
636
640
|
<div class="waykeecom-content">
|
|
@@ -641,13 +645,13 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
641
645
|
|
|
642
646
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
643
647
|
<fieldset class="waykeecom-input-group" role="radiogroup" aria-required="true" aria-label="Leveranss\xE4tt">
|
|
648
|
+
<div class="waykeecom-input-group__item" id="${fs}"></div>
|
|
644
649
|
<div class="waykeecom-input-group__item" id="${Gs}"></div>
|
|
645
|
-
<div class="waykeecom-input-group__item" id="${ws}"></div>
|
|
646
650
|
</fieldset>
|
|
647
651
|
</div>
|
|
648
652
|
|
|
649
|
-
<div class="waykeecom-stack waykeecom-stack--3" id="${
|
|
650
|
-
`,i.order.deliveryOptions.forEach(p=>{let
|
|
653
|
+
<div class="waykeecom-stack waykeecom-stack--3" id="${xs}"></div>
|
|
654
|
+
`,i.order.deliveryOptions.forEach(p=>{let y=i.address?.distance,I=ws(y,p)||0;switch(p.type){case Ns.Pickup:new Ee(c.querySelector(`#${fs}`),{id:Bs,name:"homeDelivery",title:"H\xE4mta hos handlaren",value:"false",description:`
|
|
651
655
|
<div class="waykeecom-box">
|
|
652
656
|
<div class="waykeecom-icon-content">
|
|
653
657
|
<div class="waykeecom-icon-content__icon">
|
|
@@ -668,59 +672,17 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
668
672
|
</div>
|
|
669
673
|
</div>
|
|
670
674
|
</div>
|
|
671
|
-
`,meta:`<div class="waykeecom-text waykeecom-text--font-bold">${I===0?"Gratis":u(I,{postfix:"kr"})}</div>`,checked:!this.homeDelivery,onClick:N=>this.onChange(N)});break;case
|
|
675
|
+
`,meta:`<div class="waykeecom-text waykeecom-text--font-bold">${I===0?"Gratis":u(I,{postfix:"kr"})}</div>`,checked:!this.homeDelivery,onClick:N=>this.onChange(N)});break;case Ns.Delivery:let k=i.address?.distance?.value||0,g=p.unitPrice||0,w=k>g;new Ee(c.querySelector(`#${Gs}`),{id:Es,name:"homeDelivery",title:"Hemleverans",value:"true",disabled:w,description:`<div class="waykeecom-box">
|
|
672
676
|
<div class="waykeecom-stack waykeecom-stack--2">Till din folkbokf\xF6ringsadress</div>
|
|
673
|
-
${
|
|
674
|
-
<div class="waykeecom-input-label">
|
|
675
|
-
<label for="${s}" class="waykeecom-input-label__label">${e}</label>
|
|
676
|
-
</div>
|
|
677
|
-
<div role="range">
|
|
678
|
-
<div class="waykeecom-stack waykeecom-stack--1">
|
|
679
|
-
<div class="waykeecom-input-text">
|
|
680
|
-
<input
|
|
681
|
-
type="number"
|
|
682
|
-
pattern="[0-9]*"
|
|
683
|
-
id="${s}-input"
|
|
684
|
-
value="${this.inputFieldValue}"
|
|
685
|
-
name="${o}"
|
|
686
|
-
autocomplete="off"
|
|
687
|
-
class="waykeecom-input-text__input"
|
|
688
|
-
${(i===0||this.isDisabled||!p)&&'disabled=""'}
|
|
689
|
-
min="${this.min}"
|
|
690
|
-
max="${this.max}"
|
|
691
|
-
${i!==void 0&&`step="${i}"`}
|
|
692
|
-
/>
|
|
693
|
-
${l?`<div class="waykeecom-input-text__unit">${l}</div>`:""}
|
|
694
|
-
</div>
|
|
695
|
-
</div>
|
|
696
|
-
${p?`
|
|
697
|
-
<div class="waykeecom-stack waykeecom-stack--1">
|
|
698
|
-
<div class="waykeecom-input-range">
|
|
699
|
-
<input
|
|
700
|
-
type="range"
|
|
701
|
-
id="${s}"
|
|
702
|
-
min="${this.min}"
|
|
703
|
-
max="${this.max}"
|
|
704
|
-
${i!==void 0&&`step="${i}"`}
|
|
705
|
-
value="${this.value}"
|
|
706
|
-
name="${o}"
|
|
707
|
-
class="waykeecom-input-range__input"
|
|
708
|
-
${this.isDisabled&&'disabled=""'}
|
|
709
|
-
/>
|
|
710
|
-
</div>
|
|
711
|
-
</div>
|
|
712
|
-
`:""}
|
|
713
|
-
</div>
|
|
714
|
-
`,n&&new oe(this.node.querySelector(".waykeecom-input-label"),{information:n,onClickInformation:m}),p){this.contexts.rangeSlider=this.node.querySelector(`#${s}`)||void 0,this.contexts.rangeSlider&&(r&&this.contexts.rangeSlider.addEventListener("change",r),this.contexts.rangeSlider.addEventListener("input",I=>this.onInput(I)),this.updateRangeSliderColor(this.contexts.rangeSlider));let b=this.node.querySelector(`#${s}-input`);b&&(b.addEventListener("change",I=>this.onChange(I)),b.addEventListener("blur",I=>this.onBlur(I)))}}},ze=xi;import{payments as Ss}from"@wayke-se/ecom";var Os=({vehicleId:a,dealerId:t,downPayment:e,duration:i,residual:o,financialOptionId:s})=>{let n=Ss.newLookupRequest().forVehicle(a).withDownPayment(e).withDuration(i);return s&&n.withFinancialOptionId(s),o!==void 0&&n.withResidualValue(o),t!==void 0&&n.forDealer(t),Ss.lookupPayment(n.build())};import{AuthMethod as ve,Employment as le,HousingType as K,MaritalStatus as $e,PaymentType as rn}from"@wayke-se/ecom";var Bi=class extends c{constructor(t,e){super(t,e.append?{htmlTag:"div",className:"waykeecom-accordion"}:void 0),this.props=e,this.render()}render(){let{title:t,description:e,onClick:i}=this.props,o=`
|
|
677
|
+
${w?`<div class="waykeecom-stack waykeecom-stack--2">${C({tone:"info",children:"Tyv\xE4rr kan vi inte erbjuda hemleverans till din adress."})}</div>`:""}</div>`,meta:`<div class="waykeecom-text waykeecom-text--font-bold">${w?"-":u(I,{postfix:"kr"})}</div>`,checked:this.homeDelivery,onClick:N=>this.onChange(N)});break;default:break}}),new v(c.querySelector(`#${xs}`),{title:"G\xE5 vidare",id:Rs,onClick:()=>this.onProceed()}),l.appendChild(c),i.navigation.stage===e&&l.parentElement?.scrollIntoView()}}},Ss=Gi;import{PaymentType as T}from"@wayke-se/ecom";import{DrivingDistance as Re}from"@wayke-se/ecom";var ye={bankid:"https://cdn.wayke.se/public-assets/bankid-logo.svg",illustrations:{payment:"https://cdn.wayke.se/public-assets/payment.svg"}},he={VeryGood:"Mycket bra",Good:"Bra",Ok:"Ok"},P={[Re.Between0And1000]:"0\u20131000 mil",[Re.Between1000And1500]:"1000\u20131500 mil",[Re.Between1500And2000]:"1500\u20132000 mil",[Re.Between2000And2500]:"2000\u20132500 mil",[Re.Over2500]:"2500+ mil"};import{AuthMethod as ve,Employment as le,HousingType as se,MaritalStatus as Pe,PaymentType as rn}from"@wayke-se/ecom";var fi=class extends r{constructor(t,e){super(t,e.append?{htmlTag:"div",className:"waykeecom-accordion"}:void 0),this.props=e,this.render()}render(){let{title:t,description:e,onClick:i}=this.props,o=`
|
|
715
678
|
<input
|
|
716
679
|
type="checkbox"
|
|
717
680
|
id="${this.props.id}"
|
|
718
681
|
class="waykeecom-accordion__checkbox"
|
|
719
|
-
tabindex="-1"
|
|
720
682
|
/>
|
|
721
|
-
<label class="waykeecom-accordion__header" for="${this.props.id}"
|
|
683
|
+
<label class="waykeecom-accordion__header" for="${this.props.id}">
|
|
722
684
|
<div class="waykeecom-accordion__header-title">${t}</div>
|
|
723
|
-
<div class="waykeecom-accordion__header-icon">
|
|
685
|
+
<div class="waykeecom-accordion__header-icon" aria-hidden="true">
|
|
724
686
|
<svg
|
|
725
687
|
xmlns="http://www.w3.org/2000/svg"
|
|
726
688
|
viewBox="0 0 16 16"
|
|
@@ -734,14 +696,14 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
734
696
|
<div class="waykeecom-accordion__body">${e}</div>
|
|
735
697
|
`;this.props.append&&(this.node.innerHTML=o),this.node.innerHTML=`
|
|
736
698
|
${o}
|
|
737
|
-
`,i&&this.node.querySelector("input")?.addEventListener("click",()=>i())}},Me=
|
|
699
|
+
`,i&&this.node.querySelector("input")?.addEventListener("click",()=>i())}},Me=fi;import{AuthMethod as D}from"@wayke-se/ecom";var ke=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);var xi=class extends r{constructor(t,e){super(t),this.props=e,this.render()}render(){let{qrCode:t,errorMessage:e}=this.props;if(e){this.node.innerHTML=C({tone:"error",children:e});return}this.node.innerHTML=`
|
|
738
700
|
${t?`
|
|
739
701
|
<div class="waykeecom-stack waykeecom-stack--4">
|
|
740
702
|
<div class="waykeecom-align waykeecom-align--center">
|
|
741
703
|
<img src="data:image/png;base64, ${t}" alt="BankID QR" class="waykeecom-qr" />
|
|
742
704
|
</div>
|
|
743
705
|
</div>`:""}
|
|
744
|
-
<div class="waykeecom-stack waykeecom-stack--4">${R()}</div>`}},
|
|
706
|
+
<div class="waykeecom-stack waykeecom-stack--4">${R()}</div>`}},Os=xi;var Bi=class extends r{constructor(t,e){super(t,e.htmlNodesettings),this.props=e,this.render()}disabled(t){this.props.disabled!==t&&(this.props.disabled=t,this.render())}loading(t){this.props.loading!==t&&(this.props.loading=t,this.props.disabled=t,this.render())}render(){let{title:t,id:e,disabled:i,loading:o,onClick:s}=this.props;this.node.innerHTML=`
|
|
745
707
|
<button
|
|
746
708
|
type="button"
|
|
747
709
|
${e?`id="${e}"`:""}
|
|
@@ -762,14 +724,14 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
762
724
|
</span>
|
|
763
725
|
<span class="waykeecom-button__content">${t}</span>
|
|
764
726
|
</button>
|
|
765
|
-
`,s&&this.node.querySelector("button")?.addEventListener("click",s)}},Ce=
|
|
727
|
+
`,s&&this.node.querySelector("button")?.addEventListener("click",s)}},Ce=Bi;var Ei=class extends r{constructor(t,e){super(t),this.props=e,this.render()}render(){let{autoLaunchUrl:t,errorMessage:e}=this.props;if(e){this.node.innerHTML=C({tone:"error",children:e});return}this.node.innerHTML=`
|
|
766
728
|
<div class="waykeecom-stack waykeecom-stack--4">
|
|
767
729
|
<div class="waykeecom-align waykeecom-align--center">
|
|
768
|
-
<img src="${
|
|
730
|
+
<img src="${ye.bankid}" alt="BankID logotyp" class="waykeecom-image" style="width: 130px" />
|
|
769
731
|
</div>
|
|
770
732
|
</div>
|
|
771
733
|
<div class="waykeecom-stack waykeecom-stack--4">${R()}</div>
|
|
772
|
-
`,new Ce(this.node,{title:"\xD6ppna BankID",disabled:!t,onClick:()=>{window.open(t,"_blank"),this.props.onClick&&this.props.onClick()},htmlNodesettings:{htmlTag:"div",className:"waykeecom-stack waykeecom-stack--4"}})}},
|
|
734
|
+
`,new Ce(this.node,{title:"\xD6ppna BankID",disabled:!t,onClick:()=>{window.open(t,"_blank"),this.props.onClick&&this.props.onClick()},htmlNodesettings:{htmlTag:"div",className:"waykeecom-stack waykeecom-stack--4"}})}},Fs=Ei;var Ls="bankid-start-node",El="bankid-start",_s="bankid-abort",Xs=`${_s}-node`,Ri="bankid-auth-method-node",Si=class extends r{constructor(t,e){super(t),this.props=e,setTimeout(()=>{ke()?this.props.onStart(D.SameDevice):this.props.onStart(D.QrCode)},1),this.render(),V()}update(t,e){switch(this.props.errorMessage=void 0,this.props.method=t,t){case D.QrCode:this.props.autoLaunchUrl=void 0,this.props.qrCode=e||this.props.qrCode;break;case D.SameDevice:this.props.qrCode=void 0,this.props.autoLaunchUrl=e||this.props.autoLaunchUrl;break;default:break}this.render()}setErrorMessage(t){this.props.errorMessage=t,this.render()}setInfo(t){t!==this.props.info&&(this.props.info=t,this.render())}setTitle(t){t!==this.props.title&&(this.props.title=t,this.render())}setDescription(t){t!==this.props.description&&(this.props.description=t,this.render())}setFinalizing(t){t!==this.props.finalizing&&(this.props.finalizing=t,this.render())}render(){let{qrCode:t,autoLaunchUrl:e,method:i,errorMessage:o,descriptionQrCode:s,descriptionSameDevice:n,info:l,title:c,description:m,finalizing:p,onStart:y,onAbort:I}=this.props,k=c||(i===D.QrCode?"\xD6ppna BankID och scanna QR-koden":"Skriv in din s\xE4kerhetskod i BankID-appen"),g=m||(i===D.QrCode?s:n);if(this.node.innerHTML=`
|
|
773
735
|
<div class="waykeecom-text waykeecom-text--align-center">
|
|
774
736
|
<div class="waykeecom-stack waykeecom-stack--4" id="">
|
|
775
737
|
<h4 class="waykeecom-heading waykeecom-heading--4">${k}</h4>
|
|
@@ -780,7 +742,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
780
742
|
${l?` <div class="waykeecom-stack waykeecom-stack--4">${l}</div>`:""}
|
|
781
743
|
|
|
782
744
|
${p?`<div class="waykeecom-stack waykeecom-stack--4">${R()}</div>`:`
|
|
783
|
-
<div class="waykeecom-stack waykeecom-stack--4" id="${
|
|
745
|
+
<div class="waykeecom-stack waykeecom-stack--4" id="${Ri}"></div>
|
|
784
746
|
`}
|
|
785
747
|
<div class="waykeecom-stack waykeecom-stack--4">
|
|
786
748
|
${p?"":`
|
|
@@ -789,13 +751,13 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
789
751
|
<div class="waykeecom-stack waykeecom-stack--2" id="${Xs}"></div>
|
|
790
752
|
</div>
|
|
791
753
|
</div>
|
|
792
|
-
`,!p){i===
|
|
754
|
+
`,!p){i===D.SameDevice?new Fs(this.node.querySelector(`#${Ri}`),{autoLaunchUrl:e,errorMessage:o,onClick:()=>this.props?.onSameDeviceClick?.()}):i===D.QrCode&&new Os(this.node.querySelector(`#${Ri}`),{qrCode:t,errorMessage:o});let w=i===D.SameDevice?"Mitt BankID \xE4r p\xE5 en annan enhet":"\xD6ppna BankID p\xE5 den h\xE4r enheten";new Z(this.node.querySelector(`#${Ls}`),{title:w,id:El,onClick:()=>y(i===D.SameDevice?D.QrCode:D.SameDevice)})}new Z(this.node.querySelector(`#${Xs}`),{title:"Avbryt",id:_s,onClick:()=>I()})}},ze=Si;var Oi=class extends r{constructor(t,e){super(t),this.props=e,this.render()}render(){this.node.innerHTML=`
|
|
793
755
|
<div class="waykeecom-disclaimer">
|
|
794
756
|
<div class="waykeecom-disclaimer__text">
|
|
795
757
|
${this.props.text}
|
|
796
758
|
</div>
|
|
797
759
|
</div>
|
|
798
|
-
`}},Ae=
|
|
760
|
+
`}},Ae=Oi;var Fi=class extends r{constructor(e,i){super(e);this.contexts={};this.props=i,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,i){this.props.error=e,i&&(this.props.errorMessage=i),this.updateBorder(),this.contexts.error?.setError(e)}render(){let{id:e,options:i,value:o,name:s,title:n,error:l,errorMessage:c,onChange:m}=this.props;this.node.innerHTML=`
|
|
799
761
|
<div class="waykeecom-input-label">
|
|
800
762
|
<label for="wayke-estimated-mileage" class="waykeecom-input-label__label">${n}</label>
|
|
801
763
|
</div>
|
|
@@ -811,14 +773,14 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
811
773
|
${p.value===o?'selected="selected"':""}
|
|
812
774
|
>${p.title||p.value}</option>`).join("")}
|
|
813
775
|
</select>
|
|
814
|
-
`,this.updateBorder(),
|
|
776
|
+
`,this.updateBorder(),c&&(this.contexts.error=new te(this.node,{error:l,errorMessage:c})),this.node.querySelector("select")?.addEventListener("change",p=>m(p))}},Je=Fi;import{creditAssessment as Rl}from"@wayke-se/ecom";var Li=a=>Rl.decline(a);import{creditAssessment as Sl}from"@wayke-se/ecom";var Ts=a=>Sl.getStatus(a);import{creditAssessment as Ol}from"@wayke-se/ecom";var Ws=a=>Ol.newCase(a);import{creditAssessment as Fl}from"@wayke-se/ecom";var Zs=a=>Fl.signCase(a);import{CreditAssessmentRecommendation as an}from"@wayke-se/ecom";import{CreditAssessmentRecommendation as Xl}from"@wayke-se/ecom";import{CreditAssessmentRecommendation as Vs,PaymentType as Ll}from"@wayke-se/ecom";var Xi=class extends r{constructor(t,e){super(t),this.props=e,this.render()}render(){let{store:t,decision:e}=this.props,i=t.getState(),{order:o}=i,s=o?.paymentOptions.find(l=>l.type===Ll.Loan),n=o?.contactInformation;e===Vs.Approve?this.node.innerHTML=`
|
|
815
777
|
${C({tone:"success",children:`
|
|
816
778
|
<div class="waykeecom-content waykeecom-content--inherit-size">
|
|
817
779
|
<p class="waykeecom-content__p"><string>Grattis! Din l\xE5neans\xF6kan har beviljats av ${s?.name}.</strong></p>
|
|
818
780
|
<p class="waykeecom-content__p">Slutf\xF6r ordern genom att klicka dig igenom n\xE4stkommande steg. Har du fr\xE5gor under tiden? Kontakta ${n?.name} p\xE5 tel ${n?.phone}.</p>
|
|
819
781
|
</div>
|
|
820
782
|
`})}
|
|
821
|
-
`:e===
|
|
783
|
+
`:e===Vs.AssessManually?this.node.innerHTML=`
|
|
822
784
|
${C({tone:"warning",children:`
|
|
823
785
|
<div class="waykeecom-content waykeecom-content--inherit-size">
|
|
824
786
|
<p class="waykeecom-content__p"><span class="waykeecom-text waykeecom-text--font-medium">N\xE4r ordern \xE4r slutf\xF6rd kommer vi att g\xE5 igenom ditt \xE4rende och \xE5terkoppla till dig med ett l\xE5nebesked.</span></p>
|
|
@@ -834,22 +796,22 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
834
796
|
<p class="waykeecom-content__p">Har du fr\xE5gor under tiden? Kontakta ${n?.name} p\xE5 tel ${n?.phone}.</p>
|
|
835
797
|
</div>
|
|
836
798
|
`})}
|
|
837
|
-
`}},
|
|
838
|
-
<div class="waykeecom-stack waykeecom-stack--4" id="${
|
|
799
|
+
`}},ae=Xi;var _l="assessment-approved-result",Us=`${_l}-node`,Ys="assessment-approved-proceed",Ds=`${Ys}-node`,Hs="assessment-approved-abort",Qs=`${Hs}-node`,_i=class extends r{constructor(t,e){super(t),this.props=e,this.render()}render(){let{store:t,onProceed:e,onGoBack:i}=this.props;this.node.innerHTML=`
|
|
800
|
+
<div class="waykeecom-stack waykeecom-stack--4" id="${Us}"></div>
|
|
839
801
|
<div class="waykeecom-stack waykeecom-stack--4">
|
|
840
802
|
<div class="waykeecom-stack waykeecom-stack--2" id="${Ds}"></div>
|
|
841
|
-
<div class="waykeecom-stack waykeecom-stack--2" id="${
|
|
803
|
+
<div class="waykeecom-stack waykeecom-stack--2" id="${Qs}"></div>
|
|
842
804
|
</div>
|
|
843
|
-
`,new
|
|
844
|
-
<div class="waykeecom-stack waykeecom-stack--4" id="${
|
|
805
|
+
`,new ae(this.node.querySelector(`#${Us}`),{store:t,decision:Xl.Approve}),new v(this.node.querySelector(`#${Ds}`),{title:"G\xE5 vidare",id:Ys,onClick:()=>e()}),new Z(this.node.querySelector(`#${Qs}`),{title:"Avbryt",id:Hs,onClick:()=>i()})}},Ms=_i;import{CreditAssessmentRecommendation as Tl}from"@wayke-se/ecom";var Wl="assessment-assess-manually-result",zs=`${Wl}-node`,Ps="assessment-assess-manually-proceed",Js=`${Ps}-node`,$s="assessment-assess-manually-abort",js=`${$s}-node`,Ti=class extends r{constructor(t,e){super(t),this.props=e,this.render()}render(){let{store:t,onProceed:e,onGoBack:i}=this.props;this.node.innerHTML=`
|
|
806
|
+
<div class="waykeecom-stack waykeecom-stack--4" id="${zs}"></div>
|
|
845
807
|
<div class="waykeecom-stack waykeecom-stack--4">
|
|
808
|
+
<div class="waykeecom-stack waykeecom-stack--1" id="${Js}"></div>
|
|
846
809
|
<div class="waykeecom-stack waykeecom-stack--1" id="${js}"></div>
|
|
847
|
-
<div class="waykeecom-stack waykeecom-stack--1" id="${Ps}"></div>
|
|
848
810
|
</div>
|
|
849
|
-
`,new
|
|
811
|
+
`,new ae(this.node.querySelector(`#${zs}`),{store:t,decision:Tl.AssessManually}),new v(this.node.querySelector(`#${Js}`),{title:"G\xE5 vidare",id:Ps,onClick:()=>e()}),new ee(this.node.querySelector(`#${js}`),{title:"Avbryt",id:$s,onClick:()=>i()})}},Ks=Ti;import{CreditAssessmentRecommendation as Zl}from"@wayke-se/ecom";var Vl="assessment-rejected-result",qs=`${Vl}-node`,tn="assessment-rejected-abort",en=`${tn}-node`,Wi=class extends r{constructor(t,e){super(t),this.props=e,this.render()}render(){let{store:t,onGoBack:e}=this.props;this.node.innerHTML=`
|
|
812
|
+
<div class="waykeecom-stack waykeecom-stack--4" id="${qs}"></div>
|
|
850
813
|
<div class="waykeecom-stack waykeecom-stack--4" id="${en}"></div>
|
|
851
|
-
<div class="waykeecom-stack waykeecom-stack--4" id="${tn}"></div>
|
|
852
|
-
`,new se(this.node.querySelector(`#${en}`),{store:t,decision:Zl.Reject}),new Te(this.node.querySelector(`#${tn}`),{title:"G\xE5 tillbaka",id:on,onClick:()=>e()})}},an=Vi;var Ui=class extends c{constructor(t,e){super(t),this.props=e,this.render()}render(){let{store:t,creditAssessmentResponse:e,onProceed:i,onGoBack:o}=this.props,s=e.recommendation;s===sn.Approve?new Ms(this.node,{store:t,onProceed:()=>i(),onGoBack:()=>o()}):s===sn.AssessManually?new qs(this.node,{store:t,onProceed:()=>i(),onGoBack:()=>o()}):new an(this.node,{store:t,onGoBack:()=>o()})}},nn=Ui;var Vl=a=>{let t=a>0,e=a%12===0;if(!t||!e)throw new TypeError("Invalid months for creating creidt assessment term");return`${a}months`},cn=Vl,$=a=>{if(!a)return;let t=a.indexOf("-");return t===-1?a:a.slice(0,t)},Pe=a=>{if(!a)return;let t=a.indexOf("-");return parseInt(a.slice(t+1),10)};var Ul="credit-assessment-martial-status",ln=`${Ul}-node`,Yi="credit-assessment-income",Qi=`${Yi}-node`,Ql="credit-assessment-employment",dn=`${Ql}-node`,Dl="credit-assessment-household-children",mn=`${Dl}-node`,vn="credit-assessment-housing-cost",pn=`${vn}-node`,wn="credit-assessment-debt-specification-card-credit",gn=`${wn}-node`,Gn="credit-assessment-debt-specification-car-loan",In=`${Gn}-node`,Nn="credit-assessment-debt-specification-collateral",un=`${Nn}-node`,fn="credit-assessment-debt-specification-leasing-fees",yn=`${fn}-node`,xn="credit-assessment-debt-specification-private-loan",bn=`${xn}-node`,Yl="credit-assessment-housing-type",hn=`${Yl}-node`,Bn="credit-assessment-perform-application",Di=`${Bn}-node`,kn="disclaimer-node",Cn="disclaimer-safe-node",An="why-description-node",_={maritalStatus:B.requiredAssessmentMaritalStatus,income:B.requiredNumberGreaterOrEqualThanZero,employment:B.requiredAssessmentEmplyment,householdChildren:B.requiredNumberGreaterOrEqualThanZero,housingCost:B.requiredNumberGreaterOrEqualThanZero,"debtSpecification.cardCredits":B.optionalNumberGreaterOrEqualThanZero,"debtSpecification.vehicleLoan":B.optionalNumberGreaterOrEqualThanZero,"debtSpecification.collateral":B.optionalNumberGreaterOrEqualThanZero,"debtSpecification.leasingFees":B.optionalNumberGreaterOrEqualThanZero,"debtSpecification.privateLoan":B.optionalNumberGreaterOrEqualThanZero,housingType:B.requiredHousingType},Hl={maritalStatus:$e.Married,income:5e4,employment:le.FullTimeEmployed,householdChildren:-1,housingCost:2e3,debtSpecification:{cardCredits:0,vehicleLoan:0,collateral:0,leasingFees:0,privateLoan:0},housingType:K.Apartment},zl=()=>location.hostname==="localhost"?{...Hl}:void 0,Ml=a=>{let t={maritalStatus:a?.maritalStatus||"",income:a?.income.toString()||"",employment:a?.employment.toString()||"",householdChildren:a?.householdChildren.toString()||"-1",housingCost:a?.housingCost.toString()||"","debtSpecification.cardCredits":a?.debtSpecification.cardCredits.toString()||"","debtSpecification.vehicleLoan":a?.debtSpecification.vehicleLoan.toString()||"","debtSpecification.collateral":a?.debtSpecification.collateral.toString()||"","debtSpecification.leasingFees":a?.debtSpecification.leasingFees.toString()||"","debtSpecification.privateLoan":a?.debtSpecification.privateLoan.toString()||"",housingType:a?.housingType.toString()||""};return{value:t,validation:{maritalStatus:_.maritalStatus(t.maritalStatus),income:_.income(t.income),employment:_.employment(t.employment),householdChildren:_.householdChildren(t.householdChildren),housingCost:_.housingCost(t.housingCost),"debtSpecification.cardCredits":_["debtSpecification.cardCredits"](t["debtSpecification.cardCredits"]),"debtSpecification.vehicleLoan":_["debtSpecification.vehicleLoan"](t["debtSpecification.vehicleLoan"]),"debtSpecification.collateral":_["debtSpecification.collateral"](t["debtSpecification.collateral"]),"debtSpecification.leasingFees":_["debtSpecification.leasingFees"](t["debtSpecification.leasingFees"]),"debtSpecification.privateLoan":_["debtSpecification.privateLoan"](t["debtSpecification.privateLoan"]),housingType:_.housingType(t.housingType)},interact:{maritalStatus:!1,income:!1,employment:!1,householdChildren:!1,housingCost:!1,"debtSpecification.cardCredits":!1,"debtSpecification.vehicleLoan":!1,"debtSpecification.collateral":!1,"debtSpecification.leasingFees":!1,"debtSpecification.privateLoan":!1,housingType:!1}}},Hi=class extends c{constructor(e,i){super(e);this.view=1;this.contexts={};this.bankidError=!1;this.signed=!1;this.props=i,this.state=Ml(zl()),this.render()}onChange(e){let i=e.currentTarget,o=i.name,s=i.value;this.state.value[o]=s,this.state.validation[o]=_[o](s),this.updateUiError(o),this.updateProceedButton()}onBlur(e){let o=e.currentTarget.name;this.state.interact[o]=!0,this.state.validation[o]=_[o](this.state.value[o]),this.updateUiError(o),this.updateProceedButton()}onChangeSelect(e){let i=e.currentTarget,o=i.name,s=i.value;this.state.value[o]=s,this.state.validation[o]=_[o](s),this.updateProceedButton()}onChangeRadio(e){let i=e.currentTarget,o=i.name,s=i.value;this.state.value[o]=s,this.state.validation[o]=_[o](s),o==="housingType"&&(i.value===K.SingleFamily?(this.state.value.housingCost="0",this.state.validation.housingCost=_.housingCost(this.state.value.housingCost)):(this.state.value.housingCost="",this.state.validation.housingCost=_.housingCost(this.state.value.housingCost)),this.render()),this.updateProceedButton()}updateUiError(e){this.contexts[e]?.setError(this.state.interact[e]&&!this.state.validation[e])}updateProceedButton(){this.contexts.performApplicationButton?.disabled(!this.state.validation.maritalStatus||!this.state.validation.income||!this.state.validation.employment||!this.state.validation.householdChildren||!this.state.validation.housingCost||!this.state.validation["debtSpecification.cardCredits"]||!this.state.validation["debtSpecification.vehicleLoan"]||!this.state.validation["debtSpecification.collateral"]||!this.state.validation["debtSpecification.leasingFees"]||!this.state.validation["debtSpecification.privateLoan"]||!this.state.validation.housingType)}async onAbort(){d("MAIN","FINANCIAL_CREDIT_SCORING_ABORTED","FINANCIAL_CREDIT_SCORING");let{store:e}=this.props;this.view=1,this.bankidStatusInterval&&clearInterval(this.bankidStatusInterval);let i=e.getState().caseId;i&&(await Ne(i),await Xi(i),pe()(e.dispatch)),O(),this.creditAssessmentResponse=void 0,this.render(!0)}bankIdStatus(e,i,o=!1){o||d("MAIN",i===ve.SameDevice?"FINANCIAL_CREDIT_SCORING_BANKID_STATUS_SAME_DEVICE_REQUESTED":"FINANCIAL_CREDIT_SCORING_BANKID_STATUS_QR_REQUESTED","FINANCIAL_CREDIT_SCORING");let s=this.props.store.getState().order?.paymentOptions.find(n=>n.type===rn.Loan);this.bankidStatusInterval=setInterval(async()=>{try{let n=await Zs(e),l=n.getStatus();if(!this.signed&&l==="signed"&&(d("MAIN",i===ve.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 ${s?.name}...`),this.contexts.bankId?.setDescription(`H\xE4mtar uppgifter fr\xE5n ${s?.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=Mo(n),pe(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&&i===ve.QrCode){let r=n.getQrCode();this.contexts.bankId?.update(i,r)}}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),xe("bankidStatusInterval-credit",this.bankidStatusInterval)}async onStartBankIdAuth(e,i=!1){let o=this.props.store.getState().caseId;if(!o)throw"Missing caseID";this.bankidStatusInterval&&clearInterval(this.bankidStatusInterval);try{i||d("MAIN","FINANCIAL_CREDIT_SCORING_BANKID_INIT_REQUESTED","FINANCIAL_CREDIT_SCORING"),this.contexts.bankId?.update(e);let s=await Vs({caseId:o,method:e});if(i||d("MAIN","FINANCIAL_CREDIT_SCORING_BANKID_INIT_SUCCEEDED","FINANCIAL_CREDIT_SCORING"),this.bankIdStatus(o,e,i),e===ve.SameDevice){let n=s.getAutoLaunchUrl();this.contexts.bankId?.update(e,n)}else{let n=s.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:i}=this.props;this.caseError=void 0,this.bankidError=!1,this.signed=!1;let o=i.getState().caseId;if(this.bankidStatusInterval&&(clearInterval(this.bankidStatusInterval),o&&(await Ne(o),await Xi(o),pe()(i.dispatch))),o){let s=await this.newCreditAssessmentCase();pe(s)(i.dispatch),this.onStartBankIdAuth(e)}else try{d("MAIN","FINANCIAL_CREDIT_SCORING_CREATE_CASE_REQUESTED","FINANCIAL_CREDIT_SCORING");let s=await this.newCreditAssessmentCase();d("MAIN","FINANCIAL_CREDIT_SCORING_CREATE_CASE_SUCCEEDED","FINANCIAL_CREDIT_SCORING"),s&&(pe(s)(i.dispatch),this.onStartBankIdAuth(e))}catch{d("MAIN","FINANCIAL_CREDIT_SCORING_CREATE_CASE_FAILED","FINANCIAL_CREDIT_SCORING")}}async newCreditAssessmentCase(){try{let{store:e,loan:i,paymentLookupResponse:o}=this.props;this.contexts.performApplicationButton?.disabled(!0);let{customer:s,paymentLookupResponse:n}=e.getState(),l=n||o,{monthlyCost:r}=l.costs,{interest:m}=l.interests,p=l.downPaymentSpec.current,b=l.durationSpec.current,I=l.creditAmount,k=l.price,g=l.financialProductCode,G={employment:this.state.value.employment,householdChildren:parseInt(this.state.value.householdChildren,10),housingCost:parseInt(this.state.value.housingCost||"0",10),housingType:this.state.value.housingType,income:parseInt(this.state.value.income||"0",10),maritalStatus:this.state.value.maritalStatus,debtSpecification:{cardCredits:parseInt(this.state.value["debtSpecification.cardCredits"]||"0",10),vehicleLoan:parseInt(this.state.value["debtSpecification.vehicleLoan"]||"0",10),collateral:parseInt(this.state.value["debtSpecification.collateral"]||"0",10),leasingFees:parseInt(this.state.value["debtSpecification.leasingFees"]||"0",10),privateLoan:parseInt(this.state.value["debtSpecification.privateLoan"]||"0",10)}},N={customer:{...s},householdEconomy:G,externalId:i.externalId,loan:{downPayment:p,interestRate:m,credit:I,financialProductId:g,monthlyCost:r,price:k,term:cn(b)}};return(await Ws(N)).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:i,paymentLookupResponse:o,onProceed:s}=this.props,n=ke(),{order:l,paymentLookupResponse:r}=i.getState(),m=r||o,p=l?.paymentOptions.find(k=>k.type===rn.Loan),b=m.creditAmount,I=l?.contactInformation?.name;if(this.view===3&&this.creditAssessmentResponse)new nn(Y(),{store:i,creditAssessmentResponse:this.creditAssessmentResponse,onProceed:()=>{O(),s()},onGoBack:()=>this.onAbort()});else if(this.view===2)this.contexts.bankId=new Je(Y(),{method:n?ve.SameDevice:ve.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:k=>this.startBankId(k)}),V();else{this.node.innerHTML=`
|
|
814
|
+
`,new ae(this.node.querySelector(`#${qs}`),{store:t,decision:Zl.Reject}),new Te(this.node.querySelector(`#${en}`),{title:"G\xE5 tillbaka",id:tn,onClick:()=>e()})}},on=Wi;var Zi=class extends r{constructor(t,e){super(t),this.props=e,this.render()}render(){let{store:t,creditAssessmentResponse:e,onProceed:i,onGoBack:o}=this.props,s=e.recommendation;s===an.Approve?new Ms(this.node,{store:t,onProceed:()=>i(),onGoBack:()=>o()}):s===an.AssessManually?new Ks(this.node,{store:t,onProceed:()=>i(),onGoBack:()=>o()}):new on(this.node,{store:t,onGoBack:()=>o()})}},sn=Zi;var Ul=a=>{let t=a>0,e=a%12===0;if(!t||!e)throw new TypeError("Invalid months for creating creidt assessment term");return`${a}months`},nn=Ul,K=a=>{if(!a)return;let t=a.indexOf("-");return t===-1?a:a.slice(0,t)},je=a=>{if(!a)return;let t=a.indexOf("-");return parseInt(a.slice(t+1),10)};var Dl="credit-assessment-martial-status",cn=`${Dl}-node`,Di="credit-assessment-income",Vi=`${Di}-node`,Ql="credit-assessment-employment",ln=`${Ql}-node`,Yl="credit-assessment-household-children",dn=`${Yl}-node`,An="credit-assessment-housing-cost",mn=`${An}-node`,vn="credit-assessment-debt-specification-card-credit",pn=`${vn}-node`,wn="credit-assessment-debt-specification-car-loan",gn=`${wn}-node`,Nn="credit-assessment-debt-specification-collateral",In=`${Nn}-node`,Gn="credit-assessment-debt-specification-leasing-fees",un=`${Gn}-node`,fn="credit-assessment-debt-specification-private-loan",bn=`${fn}-node`,Hl="credit-assessment-housing-type",yn=`${Hl}-node`,xn="credit-assessment-perform-application",Ui=`${xn}-node`,Yi="credit-assessment-disclaimer",hn="disclaimer-node",kn="disclaimer-safe-node",Cn="why-description-node",L={maritalStatus:B.requiredAssessmentMaritalStatus,income:B.requiredNumberGreaterOrEqualThanZero,employment:B.requiredAssessmentEmplyment,householdChildren:B.requiredNumberGreaterOrEqualThanZero,housingCost:B.requiredNumberGreaterOrEqualThanZero,"debtSpecification.cardCredits":B.optionalNumberGreaterOrEqualThanZero,"debtSpecification.vehicleLoan":B.optionalNumberGreaterOrEqualThanZero,"debtSpecification.collateral":B.optionalNumberGreaterOrEqualThanZero,"debtSpecification.leasingFees":B.optionalNumberGreaterOrEqualThanZero,"debtSpecification.privateLoan":B.optionalNumberGreaterOrEqualThanZero,housingType:B.requiredHousingType},Ml={maritalStatus:Pe.Married,income:5e4,employment:le.FullTimeEmployed,householdChildren:-1,housingCost:2e3,debtSpecification:{cardCredits:0,vehicleLoan:0,collateral:0,leasingFees:0,privateLoan:0},housingType:se.Apartment},zl=()=>location.hostname==="localhost"?{...Ml}:void 0,Jl=a=>{let t={maritalStatus:a?.maritalStatus||"",income:a?.income.toString()||"",employment:a?.employment.toString()||"",householdChildren:a?.householdChildren.toString()||"-1",housingCost:a?.housingCost.toString()||"","debtSpecification.cardCredits":a?.debtSpecification.cardCredits.toString()||"","debtSpecification.vehicleLoan":a?.debtSpecification.vehicleLoan.toString()||"","debtSpecification.collateral":a?.debtSpecification.collateral.toString()||"","debtSpecification.leasingFees":a?.debtSpecification.leasingFees.toString()||"","debtSpecification.privateLoan":a?.debtSpecification.privateLoan.toString()||"",housingType:a?.housingType.toString()||""};return{value:t,validation:{maritalStatus:L.maritalStatus(t.maritalStatus),income:L.income(t.income),employment:L.employment(t.employment),householdChildren:L.householdChildren(t.householdChildren),housingCost:L.housingCost(t.housingCost),"debtSpecification.cardCredits":L["debtSpecification.cardCredits"](t["debtSpecification.cardCredits"]),"debtSpecification.vehicleLoan":L["debtSpecification.vehicleLoan"](t["debtSpecification.vehicleLoan"]),"debtSpecification.collateral":L["debtSpecification.collateral"](t["debtSpecification.collateral"]),"debtSpecification.leasingFees":L["debtSpecification.leasingFees"](t["debtSpecification.leasingFees"]),"debtSpecification.privateLoan":L["debtSpecification.privateLoan"](t["debtSpecification.privateLoan"]),housingType:L.housingType(t.housingType)},interact:{maritalStatus:!1,income:!1,employment:!1,householdChildren:!1,housingCost:!1,"debtSpecification.cardCredits":!1,"debtSpecification.vehicleLoan":!1,"debtSpecification.collateral":!1,"debtSpecification.leasingFees":!1,"debtSpecification.privateLoan":!1,housingType:!1}}},Qi=class extends r{constructor(e,i){super(e);this.view=1;this.contexts={};this.bankidError=!1;this.signed=!1;this.props=i,this.state=Jl(zl()),this.render()}onChange(e){let i=e.currentTarget,o=i.name,s=i.value;this.state.value[o]=s,this.state.validation[o]=L[o](s),this.updateUiError(o),this.updateProceedButton()}onBlur(e){let o=e.currentTarget.name;this.state.interact[o]=!0,this.state.validation[o]=L[o](this.state.value[o]),this.updateUiError(o),this.updateProceedButton()}onChangeSelect(e){let i=e.currentTarget,o=i.name,s=i.value;this.state.value[o]=s,this.state.validation[o]=L[o](s),this.updateProceedButton()}onChangeRadio(e){let i=e.currentTarget,o=i.name,s=i.value;this.state.value[o]=s,this.state.validation[o]=L[o](s),o==="housingType"&&(i.value===se.SingleFamily?(this.state.value.housingCost="0",this.state.validation.housingCost=L.housingCost(this.state.value.housingCost)):(this.state.value.housingCost="",this.state.validation.housingCost=L.housingCost(this.state.value.housingCost)),this.render()),this.updateProceedButton()}updateUiError(e){this.contexts[e]?.setError(this.state.interact[e]&&!this.state.validation[e])}updateProceedButton(){this.contexts.performApplicationButton?.disabled(!this.state.validation.maritalStatus||!this.state.validation.income||!this.state.validation.employment||!this.state.validation.householdChildren||!this.state.validation.housingCost||!this.state.validation["debtSpecification.cardCredits"]||!this.state.validation["debtSpecification.vehicleLoan"]||!this.state.validation["debtSpecification.collateral"]||!this.state.validation["debtSpecification.leasingFees"]||!this.state.validation["debtSpecification.privateLoan"]||!this.state.validation.housingType)}async onAbort(){d("MAIN","FINANCIAL_CREDIT_SCORING_ABORTED","FINANCIAL_CREDIT_SCORING");let{store:e}=this.props;this.view=1,this.bankidStatusInterval&&clearInterval(this.bankidStatusInterval);let i=e.getState().caseId;i&&(await Ge(i),await Li(i),pe()(e.dispatch)),O(),this.creditAssessmentResponse=void 0,this.render(!0)}bankIdStatus(e,i,o=!1){o||d("MAIN",i===ve.SameDevice?"FINANCIAL_CREDIT_SCORING_BANKID_STATUS_SAME_DEVICE_REQUESTED":"FINANCIAL_CREDIT_SCORING_BANKID_STATUS_QR_REQUESTED","FINANCIAL_CREDIT_SCORING");let s=this.props.store.getState().order?.paymentOptions.find(n=>n.type===rn.Loan);this.bankidStatusInterval=setInterval(async()=>{try{let n=await Ts(e),l=n.getStatus();if(!this.signed&&l==="signed"&&(d("MAIN",i===ve.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 ${s?.name}...`),this.contexts.bankId?.setDescription(`H\xE4mtar uppgifter fr\xE5n ${s?.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=Jo(n),pe(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&&i===ve.QrCode){let c=n.getQrCode();this.contexts.bankId?.update(i,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),xe("bankidStatusInterval-credit",this.bankidStatusInterval)}async onStartBankIdAuth(e,i=!1){let o=this.props.store.getState().caseId;if(!o)throw"Missing caseID";this.bankidStatusInterval&&clearInterval(this.bankidStatusInterval);try{i||d("MAIN","FINANCIAL_CREDIT_SCORING_BANKID_INIT_REQUESTED","FINANCIAL_CREDIT_SCORING"),this.contexts.bankId?.update(e);let s=await Zs({caseId:o,method:e});if(i||d("MAIN","FINANCIAL_CREDIT_SCORING_BANKID_INIT_SUCCEEDED","FINANCIAL_CREDIT_SCORING"),this.bankIdStatus(o,e,i),e===ve.SameDevice){let n=s.getAutoLaunchUrl();this.contexts.bankId?.update(e,n)}else{let n=s.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:i}=this.props;this.caseError=void 0,this.bankidError=!1,this.signed=!1;let o=i.getState().caseId;if(this.bankidStatusInterval&&(clearInterval(this.bankidStatusInterval),o&&(await Ge(o),await Li(o),pe()(i.dispatch))),o){let s=await this.newCreditAssessmentCase();pe(s)(i.dispatch),this.onStartBankIdAuth(e)}else try{d("MAIN","FINANCIAL_CREDIT_SCORING_CREATE_CASE_REQUESTED","FINANCIAL_CREDIT_SCORING");let s=await this.newCreditAssessmentCase();d("MAIN","FINANCIAL_CREDIT_SCORING_CREATE_CASE_SUCCEEDED","FINANCIAL_CREDIT_SCORING"),s&&(pe(s)(i.dispatch),this.onStartBankIdAuth(e))}catch{d("MAIN","FINANCIAL_CREDIT_SCORING_CREATE_CASE_FAILED","FINANCIAL_CREDIT_SCORING")}}async newCreditAssessmentCase(){try{let{store:e,loan:i,paymentLookupResponse:o}=this.props;this.contexts.performApplicationButton?.disabled(!0);let{customer:s,paymentLookupResponse:n}=e.getState(),l=n||o,{monthlyCost:c}=l.costs,{interest:m}=l.interests,p=l.downPaymentSpec.current,y=l.durationSpec.current,I=l.creditAmount,k=l.price,g=l.financialProductCode,w={employment:this.state.value.employment,householdChildren:parseInt(this.state.value.householdChildren,10),housingCost:parseInt(this.state.value.housingCost||"0",10),housingType:this.state.value.housingType,income:parseInt(this.state.value.income||"0",10),maritalStatus:this.state.value.maritalStatus,debtSpecification:{cardCredits:parseInt(this.state.value["debtSpecification.cardCredits"]||"0",10),vehicleLoan:parseInt(this.state.value["debtSpecification.vehicleLoan"]||"0",10),collateral:parseInt(this.state.value["debtSpecification.collateral"]||"0",10),leasingFees:parseInt(this.state.value["debtSpecification.leasingFees"]||"0",10),privateLoan:parseInt(this.state.value["debtSpecification.privateLoan"]||"0",10)}},N={customer:{...s},householdEconomy:w,externalId:i.externalId,loan:{downPayment:p,interestRate:m,credit:I,financialProductId:g,monthlyCost:c,price:k,term:nn(y)}};return(await Ws(N)).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:i,paymentLookupResponse:o,onProceed:s}=this.props,n=ke(),{order:l,paymentLookupResponse:c}=i.getState(),m=c||o,p=l?.paymentOptions.find(k=>k.type===rn.Loan),y=m.creditAmount,I=l?.contactInformation?.name;if(this.view===3&&this.creditAssessmentResponse)new sn(H(),{store:i,creditAssessmentResponse:this.creditAssessmentResponse,onProceed:()=>{O(),s()},onGoBack:()=>this.onAbort()});else if(this.view===2)this.contexts.bankId=new ze(H(),{method:n?ve.SameDevice:ve.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:k=>this.startBankId(k)}),V();else{this.node.innerHTML=`
|
|
853
815
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
854
816
|
<h5 class="waykeecom-heading waykeecom-heading--4">L\xE5neans\xF6kan</h5>
|
|
855
817
|
<div class="waykeecom-content">
|
|
@@ -857,34 +819,34 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
857
819
|
</div>
|
|
858
820
|
</div>
|
|
859
821
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
860
|
-
<div class="waykeecom-balloon waykeecom-balloon--info" id="${
|
|
822
|
+
<div class="waykeecom-balloon waykeecom-balloon--info" id="${Cn}"></div>
|
|
861
823
|
</div>
|
|
862
824
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
863
825
|
<div class="waykeecom-stack waykeecom-stack--2">
|
|
864
826
|
<h5 class="waykeecom-heading waykeecom-heading--4 waykeecom-no-margin">Civilstatus</h5>
|
|
865
827
|
</div>
|
|
866
|
-
<div class="waykeecom-stack waykeecom-stack--2" id="${
|
|
828
|
+
<div class="waykeecom-stack waykeecom-stack--2" id="${cn}"></div>
|
|
867
829
|
</div>
|
|
868
830
|
|
|
869
831
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
870
832
|
<div class="waykeecom-stack waykeecom-stack--2">
|
|
871
833
|
<h5 class="waykeecom-heading waykeecom-heading--4 waykeecom-no-margin">Syssels\xE4ttning</h5>
|
|
872
834
|
</div>
|
|
873
|
-
<div class="waykeecom-stack waykeecom-stack--2" id="${
|
|
835
|
+
<div class="waykeecom-stack waykeecom-stack--2" id="${ln}"></div>
|
|
874
836
|
</div>
|
|
875
837
|
|
|
876
838
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
877
839
|
<div class="waykeecom-stack waykeecom-stack--2">
|
|
878
840
|
<h5 class="waykeecom-heading waykeecom-heading--4 waykeecom-no-margin">Barn</h5>
|
|
879
841
|
</div>
|
|
880
|
-
<div class="waykeecom-stack waykeecom-stack--2" id="${
|
|
842
|
+
<div class="waykeecom-stack waykeecom-stack--2" id="${dn}"></div>
|
|
881
843
|
</div>
|
|
882
844
|
|
|
883
845
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
884
846
|
<div class="waykeecom-stack waykeecom-stack--2">
|
|
885
847
|
<h5 class="waykeecom-heading waykeecom-heading--4 waykeecom-no-margin">Inkomst</h5>
|
|
886
848
|
</div>
|
|
887
|
-
<div class="waykeecom-stack waykeecom-stack--2" id="${
|
|
849
|
+
<div class="waykeecom-stack waykeecom-stack--2" id="${Vi}"></div>
|
|
888
850
|
</div>
|
|
889
851
|
|
|
890
852
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
@@ -894,15 +856,15 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
894
856
|
<p class="waykeecom-content__p">Ange typ av boende.</p>
|
|
895
857
|
</div>
|
|
896
858
|
</div>
|
|
897
|
-
<div class="waykeecom-stack waykeecom-stack--2" id="${
|
|
859
|
+
<div class="waykeecom-stack waykeecom-stack--2" id="${yn}"></div>
|
|
898
860
|
</div>
|
|
899
861
|
|
|
900
|
-
${this.state.value.housingType!==
|
|
862
|
+
${this.state.value.housingType!==se.SingleFamily?`
|
|
901
863
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
902
864
|
<div class="waykeecom-stack waykeecom-stack--2">
|
|
903
865
|
<h5 class="waykeecom-heading waykeecom-heading--4 waykeecom-no-margin">Boendekostnad</h5>
|
|
904
866
|
</div>
|
|
905
|
-
<div class="waykeecom-stack waykeecom-stack--2" id="${
|
|
867
|
+
<div class="waykeecom-stack waykeecom-stack--2" id="${mn}"></div>
|
|
906
868
|
</div>
|
|
907
869
|
`:""}
|
|
908
870
|
|
|
@@ -914,29 +876,23 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
914
876
|
</div>
|
|
915
877
|
</div>
|
|
916
878
|
<div class="waykeecom-stack waykeecom-stack--2" id="${bn}"></div>
|
|
917
|
-
<div class="waykeecom-stack waykeecom-stack--2" id="${In}"></div>
|
|
918
|
-
<div class="waykeecom-stack waykeecom-stack--2" id="${yn}"></div>
|
|
919
879
|
<div class="waykeecom-stack waykeecom-stack--2" id="${gn}"></div>
|
|
920
880
|
<div class="waykeecom-stack waykeecom-stack--2" id="${un}"></div>
|
|
881
|
+
<div class="waykeecom-stack waykeecom-stack--2" id="${pn}"></div>
|
|
882
|
+
<div class="waykeecom-stack waykeecom-stack--2" id="${In}"></div>
|
|
921
883
|
</div>
|
|
922
884
|
|
|
923
885
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
924
886
|
<hr class="waykeecom-separator" />
|
|
925
887
|
</div>
|
|
926
888
|
|
|
927
|
-
<
|
|
928
|
-
<
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
<div class="waykeecom-stack waykeecom-stack--1">
|
|
932
|
-
<div class="waykeecom-heading waykeecom-heading--2 waykeecom-no-margin">
|
|
933
|
-
${u(b,{postfix:"kr"})}
|
|
934
|
-
</div>
|
|
935
|
-
</div>
|
|
936
|
-
</div>
|
|
889
|
+
<dl class="waykeecom-stack waykeecom-stack--3 waykeecom-text waykeecom-text--align-center">
|
|
890
|
+
<dt class="waykeecom-stack waykeecom-stack--1 waykeecom-text waykeecom-text--tone-alt waykeecom-text--size-small">Totalt l\xE5nebelopp</dt>
|
|
891
|
+
<dd class="waykeecom-stack waykeecom-stack--1 waykeecom-heading waykeecom-heading--2 waykeecom-no-margin">${u(y,{postfix:"kr"})}</dd>
|
|
892
|
+
</dl>
|
|
937
893
|
|
|
938
894
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
939
|
-
${C({tone:"info",children:`Du betalar inget i detta steg, detta \xE4r bara en l\xE5neans\xF6kan. K\xF6pet slutf\xF6rs sedan vid m\xF6te med ${I}.`})}
|
|
895
|
+
${C({tone:"info",polite:!0,children:`Du betalar inget i detta steg, detta \xE4r bara en l\xE5neans\xF6kan. K\xF6pet slutf\xF6rs sedan vid m\xF6te med ${I}.`})}
|
|
940
896
|
</div>
|
|
941
897
|
|
|
942
898
|
${this.caseError?`
|
|
@@ -952,48 +908,13 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
952
908
|
`:""}
|
|
953
909
|
|
|
954
910
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
955
|
-
<div class="waykeecom-stack waykeecom-stack--2" id="${
|
|
956
|
-
<div class="waykeecom-stack waykeecom-stack--2">
|
|
911
|
+
<div class="waykeecom-stack waykeecom-stack--2" id="${Ui}"></div>
|
|
912
|
+
<div class="waykeecom-stack waykeecom-stack--2" id="${Yi}">
|
|
913
|
+
<div class="waykeecom-stack waykeecom-stack--1" id="${hn}"></div>
|
|
957
914
|
<div class="waykeecom-stack waykeecom-stack--1" id="${kn}"></div>
|
|
958
|
-
<div class="waykeecom-stack waykeecom-stack--1" id="${Cn}"></div>
|
|
959
915
|
</div>
|
|
960
916
|
</div>
|
|
961
|
-
`,this.contexts.maritalStatus=new
|
|
962
|
-
<div class="waykeecom-content waykeecom-content--inherit-size">
|
|
963
|
-
<p class="waykeecom-content__p"><span class="waykeecom-text waykeecom-text--font-medium">Inkomst per m\xE5nad f\xF6re skatt</span></p>
|
|
964
|
-
<p class="waykeecom-content__p">L\xF6n och/eller pension, inte bidrag eller studiel\xE5n.</p>
|
|
965
|
-
</div>
|
|
966
|
-
`,onChange:g=>this.onChange(g),onBlur:g=>this.onBlur(g)}),this.contexts.householdChildren=new je(this.node.querySelector(`#${mn}`),{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:g=>this.onChangeSelect(g)});let k=this.node.querySelector(`#${pn}`);k&&(this.contexts.housingCost=new F(k,{title:this.state.value.housingType===K.Condominium?"Min del av m\xE5nadsavgiften":this.state.value.housingType===K.Apartment?"Min del av m\xE5nadshyran":"Boendekostnad",value:this.state.value.housingCost,id:vn,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===K.Condominium?`
|
|
967
|
-
<div class="waykeecom-content waykeecom-content--inherit-size">
|
|
968
|
-
<p class="waykeecom-content__p"><span class="waykeecom-text waykeecom-text--font-medium">Min del av m\xE5nadsavgiften</span></p>
|
|
969
|
-
<p class="waykeecom-content__p">Exklusive r\xE4nta och amortering</p>
|
|
970
|
-
</div>
|
|
971
|
-
`:void 0,onChange:g=>this.onChange(g),onBlur:g=>this.onBlur(g),onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_HOUSEHOLD_DEBT_INFORMATION_TOGGLE","FINANCIAL")}})),this.contexts["debtSpecification.cardCredits"]=new F(this.node.querySelector(`#${gn}`),{title:"Kortkrediter",value:this.state.value["debtSpecification.cardCredits"],id:wn,error:this.state.interact["debtSpecification.cardCredits"]&&!this.state.validation["debtSpecification.cardCredits"],errorMessage:"Ange kortkrediter eller l\xE4mna tomt",name:"debtSpecification.cardCredits",autocomplete:"off",placeholder:"",unit:"kr",type:"number",min:0,information:`
|
|
972
|
-
<div class="waykeecom-content waykeecom-content--inherit-size">
|
|
973
|
-
<p class="waykeecom-content__p"><span class="waykeecom-text waykeecom-text--font-medium">Kortkrediter</span></p>
|
|
974
|
-
<p class="waykeecom-content__p">Total skuld</p>
|
|
975
|
-
</div>
|
|
976
|
-
`,onChange:g=>this.onChange(g),onBlur:g=>this.onBlur(g),onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_DEBT_SPECIFICATION_CARD_CREDIT_INFORMATION_TOGGLE","FINANCIAL")}}),this.contexts["debtSpecification.vehicleLoan"]=new F(this.node.querySelector(`#${In}`),{title:"Bill\xE5n",value:this.state.value["debtSpecification.vehicleLoan"],id:Gn,error:this.state.interact["debtSpecification.vehicleLoan"]&&!this.state.validation["debtSpecification.vehicleLoan"],errorMessage:"Ange bill\xE5n eller l\xE4mna tomt",name:"debtSpecification.vehicleLoan",autocomplete:"off",placeholder:"",unit:"kr",type:"number",min:0,information:`
|
|
977
|
-
<div class="waykeecom-content waykeecom-content--inherit-size">
|
|
978
|
-
<p class="waykeecom-content__p"><span class="waykeecom-text waykeecom-text--font-medium">Bill\xE5n</span></p>
|
|
979
|
-
<p class="waykeecom-content__p">Total skuld. Ange inte skuld f\xF6r bil som ska ers\xE4ttas.</p>
|
|
980
|
-
</div>
|
|
981
|
-
`,onChange:g=>this.onChange(g),onBlur:g=>this.onBlur(g),onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_DEBT_SPECIFICATION_CAR_LOAN_INFORMATION_TOGGLE","FINANCIAL")}}),this.contexts["debtSpecification.collateral"]=new F(this.node.querySelector(`#${un}`),{title:"Borgens\xE5tagande ",value:this.state.value["debtSpecification.collateral"],id:Nn,error:this.state.interact["debtSpecification.collateral"]&&!this.state.validation["debtSpecification.collateral"],errorMessage:"Ange borgens\xE5tagande eller l\xE4mna tomt",name:"debtSpecification.collateral",autocomplete:"off",placeholder:"",unit:"kr",type:"number",min:0,information:`
|
|
982
|
-
<div class="waykeecom-content waykeecom-content--inherit-size">
|
|
983
|
-
<p class="waykeecom-content__p"><span class="waykeecom-text waykeecom-text--font-medium">Borgens\xE5tagande</span></p>
|
|
984
|
-
<p class="waykeecom-content__p">Totalt belopp.</p>
|
|
985
|
-
</div>
|
|
986
|
-
`,onChange:g=>this.onChange(g),onBlur:g=>this.onBlur(g),onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_DEBT_SPECIFICATION_COLLATERAL_INFORMATION_TOGGLE","FINANCIAL")}}),this.contexts["debtSpecification.leasingFees"]=new F(this.node.querySelector(`#${yn}`),{title:"Billeasing ",value:this.state.value["debtSpecification.leasingFees"],id:fn,error:this.state.interact["debtSpecification.leasingFees"]&&!this.state.validation["debtSpecification.leasingFees"],errorMessage:"Ang billeasingkostnader eller l\xE4mna tomt",name:"debtSpecification.leasingFees",autocomplete:"off",placeholder:"",unit:"kr",type:"number",min:0,information:`
|
|
987
|
-
<div class="waykeecom-content waykeecom-content--inherit-size">
|
|
988
|
-
<p class="waykeecom-content__p"><span class="waykeecom-text waykeecom-text--font-medium">Billeasing</span></p>
|
|
989
|
-
<p class="waykeecom-content__p">Ange inte m\xE5nadskostnad f\xF6r bil som skall ers\xE4ttas</p>
|
|
990
|
-
</div>
|
|
991
|
-
`,onChange:g=>this.onChange(g),onBlur:g=>this.onBlur(g),onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_DEBT_SPECIFICATION_LEASING_FEES_INFORMATION_TOGGLE","FINANCIAL")}}),this.contexts["debtSpecification.privateLoan"]=new F(this.node.querySelector(`#${bn}`),{title:"Privatl\xE5n (ej bol\xE5n och CSN)",value:this.state.value["debtSpecification.privateLoan"],id:xn,error:this.state.interact["debtSpecification.privateLoan"]&&!this.state.validation["debtSpecification.privateLoan"],errorMessage:"Ange privatl\xE5n eller l\xE4mna tomt",name:"debtSpecification.privateLoan",autocomplete:"off",placeholder:"",unit:"kr",type:"number",min:0,information:`
|
|
992
|
-
<div class="waykeecom-content waykeecom-content--inherit-size">
|
|
993
|
-
<p class="waykeecom-content__p"><span class="waykeecom-text waykeecom-text--font-medium">Privatl\xE5n (ej bol\xE5n och CSN)</span></p>
|
|
994
|
-
<p class="waykeecom-content__p">Total skuld, t.ex. blancol\xE5n och sms-l\xE5n</p>
|
|
995
|
-
</div>
|
|
996
|
-
`,onChange:g=>this.onChange(g),onBlur:g=>this.onBlur(g),onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_DEBT_SPECIFICATION_PRIVATE_LOAN_INFORMATION_TOGGLE","FINANCIAL")}}),this.contexts.performApplicationButton=new Ce(this.node.querySelector(`#${Di}`),{title:"Genomf\xF6r l\xE5neans\xF6kan",id:Bn,disabled:!(this.state.validation.maritalStatus&&this.state.validation.income&&this.state.validation.employment&&this.state.validation.householdChildren&&this.state.validation.housingCost),onClick:()=>{this.view=2,this.render()}}),new Ae(this.node.querySelector(`#${kn}`),{text:`Genom att klicka p\xE5 \u201DGenomf\xF6r l\xE5neans\xF6kan\u201D godk\xE4nner jag att ${p?.name} g\xF6r en kreditupplysning p\xE5 mig baserat p\xE5 informationen ovan och jag bekr\xE4ftar att jag l\xE4st <a href="${p?.loanDetails?.privacyPolicyUrl}" title="" target="_blank" rel="noopener noreferrer" class="waykeecom-link">${p?.name} dataskyddspolicy</a>.`}),new ye(this.node.querySelector(`#${Cn}`),{text:"Dina uppgifter lagras och sparas s\xE4kert."}),new Me(this.node.querySelector(`#${An}`),{id:"accordion-why-description",title:`
|
|
917
|
+
`,this.contexts.maritalStatus=new M(this.node.querySelector(`#${cn}`),{checked:this.state.value.maritalStatus,name:"maritalStatus",options:[{id:"maritalStatus-1",value:Pe.Married,title:"Gift/partnerskap"},{id:"maritalStatus-2",value:Pe.CommonLaw,title:"Sambo"},{id:"maritalStatus-3",value:Pe.Single,title:"Ensamst\xE5ende"}],onClick:g=>this.onChangeRadio(g)}),this.contexts.income=new F(this.node.querySelector(`#${Vi}`),{title:"Inkomst per m\xE5nad f\xF6re skatt",value:this.state.value.income,id:Di,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:g=>this.onChange(g),onBlur:g=>this.onBlur(g)}),this.contexts.employment=new M(this.node.querySelector(`#${ln}`),{checked:this.state.value.employment,name:"employment",options:[{id:"employment-1",value:le.FullTimeEmployed,title:"Fast eller tillsvidareanst\xE4lld"},{id:"employment-2",value:le.TemporarilyEmployed,title:"Visstidsanst\xE4lld"},{id:"employment-3",value:le.SelfEmployed,title:"Egen f\xF6retagare"},{id:"employment-4",value:le.Retired,title:"Pension\xE4r"},{id:"employment-5",value:le.Student,title:"Student"},{id:"employment-6",value:le.Other,title:"Annan"}],onClick:g=>this.onChangeRadio(g)}),this.contexts.housingType=new M(this.node.querySelector(`#${yn}`),{title:"Boendeform",checked:this.state.value.housingType,name:"housingType",options:[{id:"housingType-1",value:se.SingleFamily,title:"Villa"},{id:"housingType-2",value:se.Condominium,title:"Bostadsr\xE4tt"},{id:"housingType-3",value:se.Apartment,title:"Hyresr\xE4tt"}],onClick:g=>this.onChangeRadio(g)}),this.contexts.income=new F(this.node.querySelector(`#${Vi}`),{title:"Inkomst per m\xE5nad f\xF6re skatt",value:this.state.value.income,id:Di,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",help:"L\xF6n och/eller pension, inte bidrag eller studiel\xE5n",onChange:g=>this.onChange(g),onBlur:g=>this.onBlur(g)}),this.contexts.householdChildren=new Je(this.node.querySelector(`#${dn}`),{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:g=>this.onChangeSelect(g)});let k=this.node.querySelector(`#${mn}`);k&&(this.contexts.housingCost=new F(k,{title:this.state.value.housingType===se.Condominium?"Min del av m\xE5nadsavgiften":this.state.value.housingType===se.Apartment?"Min del av m\xE5nadshyran":"Boendekostnad",value:this.state.value.housingCost,id:An,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,help:"Exklusive r\xE4nta och amortering",onChange:g=>this.onChange(g),onBlur:g=>this.onBlur(g),onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_HOUSEHOLD_DEBT_INFORMATION_TOGGLE","FINANCIAL")}})),this.contexts["debtSpecification.cardCredits"]=new F(this.node.querySelector(`#${pn}`),{title:"Kortkrediter",value:this.state.value["debtSpecification.cardCredits"],id:vn,error:this.state.interact["debtSpecification.cardCredits"]&&!this.state.validation["debtSpecification.cardCredits"],errorMessage:"Ange kortkrediter eller l\xE4mna tomt",name:"debtSpecification.cardCredits",autocomplete:"off",placeholder:"",unit:"kr",type:"number",min:0,help:"Total skuld",onChange:g=>this.onChange(g),onBlur:g=>this.onBlur(g),onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_DEBT_SPECIFICATION_CARD_CREDIT_INFORMATION_TOGGLE","FINANCIAL")}}),this.contexts["debtSpecification.vehicleLoan"]=new F(this.node.querySelector(`#${gn}`),{title:"Bill\xE5n",value:this.state.value["debtSpecification.vehicleLoan"],id:wn,error:this.state.interact["debtSpecification.vehicleLoan"]&&!this.state.validation["debtSpecification.vehicleLoan"],errorMessage:"Ange bill\xE5n eller l\xE4mna tomt",name:"debtSpecification.vehicleLoan",autocomplete:"off",placeholder:"",unit:"kr",type:"number",min:0,help:"Total skuld. Ange inte skuld f\xF6r bil som ska ers\xE4ttas.",onChange:g=>this.onChange(g),onBlur:g=>this.onBlur(g),onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_DEBT_SPECIFICATION_CAR_LOAN_INFORMATION_TOGGLE","FINANCIAL")}}),this.contexts["debtSpecification.collateral"]=new F(this.node.querySelector(`#${In}`),{title:"Borgens\xE5tagande ",value:this.state.value["debtSpecification.collateral"],id:Nn,error:this.state.interact["debtSpecification.collateral"]&&!this.state.validation["debtSpecification.collateral"],errorMessage:"Ange borgens\xE5tagande eller l\xE4mna tomt",name:"debtSpecification.collateral",autocomplete:"off",placeholder:"",unit:"kr",type:"number",min:0,help:"Totalt belopp",onChange:g=>this.onChange(g),onBlur:g=>this.onBlur(g),onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_DEBT_SPECIFICATION_COLLATERAL_INFORMATION_TOGGLE","FINANCIAL")}}),this.contexts["debtSpecification.leasingFees"]=new F(this.node.querySelector(`#${un}`),{title:"Billeasing ",value:this.state.value["debtSpecification.leasingFees"],id:Gn,error:this.state.interact["debtSpecification.leasingFees"]&&!this.state.validation["debtSpecification.leasingFees"],errorMessage:"Ang billeasingkostnader eller l\xE4mna tomt",name:"debtSpecification.leasingFees",autocomplete:"off",placeholder:"",unit:"kr",type:"number",min:0,help:"Ange inte m\xE5nadskostnad f\xF6r bil som skall ers\xE4ttas",onChange:g=>this.onChange(g),onBlur:g=>this.onBlur(g),onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_DEBT_SPECIFICATION_LEASING_FEES_INFORMATION_TOGGLE","FINANCIAL")}}),this.contexts["debtSpecification.privateLoan"]=new F(this.node.querySelector(`#${bn}`),{title:"Privatl\xE5n (ej bol\xE5n och CSN)",value:this.state.value["debtSpecification.privateLoan"],id:fn,error:this.state.interact["debtSpecification.privateLoan"]&&!this.state.validation["debtSpecification.privateLoan"],errorMessage:"Ange privatl\xE5n eller l\xE4mna tomt",name:"debtSpecification.privateLoan",autocomplete:"off",placeholder:"",unit:"kr",type:"number",min:0,help:"Total skuld, t.ex. blancol\xE5n och sms-l\xE5n",onChange:g=>this.onChange(g),onBlur:g=>this.onBlur(g),onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_DEBT_SPECIFICATION_PRIVATE_LOAN_INFORMATION_TOGGLE","FINANCIAL")}}),this.contexts.performApplicationButton=new Ce(this.node.querySelector(`#${Ui}`),{title:"Genomf\xF6r l\xE5neans\xF6kan",id:xn,disabled:!(this.state.validation.maritalStatus&&this.state.validation.income&&this.state.validation.employment&&this.state.validation.householdChildren&&this.state.validation.housingCost),onClick:()=>{this.view=2,this.render()}}),new Ae(this.node.querySelector(`#${hn}`),{text:`Genom att klicka p\xE5 \u201DGenomf\xF6r l\xE5neans\xF6kan\u201D godk\xE4nner jag att ${p?.name} g\xF6r en kreditupplysning p\xE5 mig baserat p\xE5 informationen ovan och jag bekr\xE4ftar att jag l\xE4st <a href="${p?.loanDetails?.privacyPolicyUrl}" title="" target="_blank" rel="noopener noreferrer" class="waykeecom-link">${p?.name} dataskyddspolicy</a>.`}),new be(this.node.querySelector(`#${kn}`),{text:"Dina uppgifter lagras och sparas s\xE4kert."}),new Me(this.node.querySelector(`#${Cn}`),{id:"accordion-why-description",title:`
|
|
997
918
|
<div class="waykeecom-hstack waykeecom-hstack--align-center waykeecom-hstack--spacing-1">
|
|
998
919
|
<div class="waykeecom-hstack__item waykeecom-hstack__item--no-shrink" aria-hidden="true">
|
|
999
920
|
<div class="waykeecom-icon-backdrop waykeecom-icon-backdrop--info-alt">
|
|
@@ -1011,7 +932,48 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1011
932
|
</div>`,description:`<div class="waykeecom-content">
|
|
1012
933
|
<p class="waykeecom-content__p">${p?.name} m\xE5ste ta in uppgifterna av kunden f\xF6r att uppfylla best\xE4mmelser i Konsumentkreditlagen (2010:1846) och Lag (2017:630) om \xE5tg\xE4rder mot penningtv\xE4tt och finansiering av terrorism.</p>
|
|
1013
934
|
<p class="waykeecom-content__p"><a href="${p?.loanDetails?.moneyLaunderingInformationURL}" title="" target="_blank" rel="noopener norefferer" class="waykeecom-link">L\xE4s mer om detta h\xE4r</a></p>
|
|
1014
|
-
</div>`,onClick:()=>{d("MAIN","FINANCIAL_LOAN_KYC_INFORMATION_TOGGLE","FINANCIAL")}}),(e||this.caseError||this.bankidError)&&this.node.querySelector(`#${
|
|
935
|
+
</div>`,onClick:()=>{d("MAIN","FINANCIAL_LOAN_KYC_INFORMATION_TOGGLE","FINANCIAL")}}),(e||this.caseError||this.bankidError)&&this.node.querySelector(`#${Ui}`)?.scrollIntoView()}}},Bn=Qi;var Hi=class extends r{constructor(t,e){super(t),this.props=e,this.error=e.error,this.render()}update(t){this.error=t,this.render()}render(){if(!this.error){this.node.innerHTML="";return}this.node.innerHTML=C({tone:"error",children:this.error})}},En=Hi;var jl=(a,t)=>t?Math.round(a/t)*t:a,Mi=class extends r{constructor(e,i){super(e);this.contexts={};this.props=i,this.value=i.value,this.min=i.min,this.max=i.max,this.isDisabled=i.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,i,o){this.value=e,this.inputFieldValue=e,this.min=i,this.max=o,this.rangeSpan=o-i,this.isDisabled=!this.rangeSpan;let s=parseInt((100*((this.value-i)/this.rangeSpan)).toString(),10);this.currentValueInPercentage=isNaN(s)?0:s,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 i=e.currentTarget;this.inputFieldValue=i.valueAsNumber}onBlur(e){let i=this.inputFieldValue;if(!isNaN(i)&&i>=this.min&&i<=this.max){let o=jl(i,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 i=e.currentTarget;i.value=this.value.toString()}onInput(e){let i=e.currentTarget;this.value=parseInt(i.value,10),this.inputFieldValue=this.value,this.currentValueInPercentage=parseInt((100*((this.value-this.min)/this.rangeSpan)).toString(),10),this.updateInputField(),this.updateRangeSliderColor(i)}updateRangeSliderColor(e){let i=e||this.node.querySelector(`#${this.props.id}`);i&&i.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:i,name:o,id:s,information:n,unit:l,onChange:c,onClickInformation:m}=this.props,p=this.min!==this.max;if(this.node.innerHTML=`
|
|
936
|
+
<div class="waykeecom-input-label">
|
|
937
|
+
<label for="${s}" class="waykeecom-input-label__label">${e}</label>
|
|
938
|
+
</div>
|
|
939
|
+
<div role="range">
|
|
940
|
+
<div class="waykeecom-stack waykeecom-stack--1">
|
|
941
|
+
<div class="waykeecom-input-text">
|
|
942
|
+
<input
|
|
943
|
+
type="number"
|
|
944
|
+
pattern="[0-9]*"
|
|
945
|
+
id="${s}-input"
|
|
946
|
+
value="${this.inputFieldValue}"
|
|
947
|
+
name="${o}"
|
|
948
|
+
autocomplete="off"
|
|
949
|
+
class="waykeecom-input-text__input"
|
|
950
|
+
${(i===0||this.isDisabled||!p)&&'disabled=""'}
|
|
951
|
+
min="${this.min}"
|
|
952
|
+
max="${this.max}"
|
|
953
|
+
${i!==void 0&&`step="${i}"`}
|
|
954
|
+
/>
|
|
955
|
+
${l?`<div class="waykeecom-input-text__unit">${l}</div>`:""}
|
|
956
|
+
</div>
|
|
957
|
+
</div>
|
|
958
|
+
${p?`
|
|
959
|
+
<div class="waykeecom-stack waykeecom-stack--1">
|
|
960
|
+
<div class="waykeecom-input-range">
|
|
961
|
+
<input
|
|
962
|
+
type="range"
|
|
963
|
+
id="${s}"
|
|
964
|
+
min="${this.min}"
|
|
965
|
+
max="${this.max}"
|
|
966
|
+
${i!==void 0&&`step="${i}"`}
|
|
967
|
+
value="${this.value}"
|
|
968
|
+
name="${o}"
|
|
969
|
+
class="waykeecom-input-range__input"
|
|
970
|
+
${this.isDisabled&&'disabled=""'}
|
|
971
|
+
/>
|
|
972
|
+
</div>
|
|
973
|
+
</div>
|
|
974
|
+
`:""}
|
|
975
|
+
</div>
|
|
976
|
+
`,n&&new ie(this.node.querySelector(".waykeecom-input-label"),{information:n,onClickInformation:m}),p){this.contexts.rangeSlider=this.node.querySelector(`#${s}`)||void 0,this.contexts.rangeSlider&&(c&&this.contexts.rangeSlider.addEventListener("change",c),this.contexts.rangeSlider.addEventListener("input",I=>this.onInput(I)),this.updateRangeSliderColor(this.contexts.rangeSlider));let y=this.node.querySelector(`#${s}-input`);y&&(y.addEventListener("change",I=>this.onChange(I)),y.addEventListener("blur",I=>this.onBlur(I)))}}},$e=Mi;import{payments as Rn}from"@wayke-se/ecom";var Sn=({vehicleId:a,dealerId:t,downPayment:e,duration:i,residual:o,financialOptionId:s})=>{let n=Rn.newLookupRequest().forVehicle(a).withDownPayment(e).withDuration(i);return s&&n.withFinancialOptionId(s),o!==void 0&&n.withResidualValue(o),t!==void 0&&n.forDealer(t),Rn.lookupPayment(n.build())};var zi=class extends r{constructor(t,e){super(t),this.props=e,this.render()}update(t){this.props=t,this.node.querySelector(".waykeecom-pie-chart__chart-data")?.setAttribute("stroke-dasharray",`calc(${this.props.percentage} * 31.4 / 100) 31.4`)}render(){let{percentage:t}=this.props;this.node.innerHTML=`
|
|
1015
977
|
<div class="waykeecom-pie-chart">
|
|
1016
978
|
<svg height="20" width="20" viewBox="0 0 20 20" class="waykeecom-pie-chart__chart">
|
|
1017
979
|
<circle r="10" cx="10" cy="10" class="waykeecom-pie-chart__chart-data-base" />
|
|
@@ -1024,10 +986,10 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1024
986
|
/>
|
|
1025
987
|
</svg>
|
|
1026
988
|
<div class="waykeecom-pie-chart__overlay">
|
|
1027
|
-
<img src="${
|
|
989
|
+
<img src="${ye.illustrations.payment}" alt="Illustration av betalning" class="waykeecom-pie-chart__illustration" />
|
|
1028
990
|
</div>
|
|
1029
991
|
</div>
|
|
1030
|
-
`}},
|
|
992
|
+
`}},On=zi;var Ji=class extends r{constructor(t,e){super(t),this.props=e,this.render()}update(t){this.props=t,this.render()}render(){let{downPayment:t,creditAmount:e,downPaymentPercentage:i,creditAmountPercentage:o}=this.props;this.node.innerHTML=`
|
|
1031
993
|
<ul class="waykeecom-key-value-list">
|
|
1032
994
|
${h({key:`
|
|
1033
995
|
<div class="waykeecom-hstack waykeecom-hstack--spacing-1 waykeecom-hstack--align-center">
|
|
@@ -1050,18 +1012,17 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1050
1012
|
</div>
|
|
1051
1013
|
`,value:u(e,{postfix:"kr"})})}
|
|
1052
1014
|
</ul>
|
|
1053
|
-
`}},
|
|
1015
|
+
`}},Fn=Ji;var Ln=!1,ji=class extends r{constructor(e,i){super(e);this.showDetails=Ln;this.props=i,this.render()}onDetails(e){let i=e.currentTarget.checked;Ln=i,this.showDetails=i}update(e){this.props=e,this.render()}render(){let{duration:e,administrationFee:i,setupFee:o,totalCreditCost:s,interest:n,effectiveInterest:l,publicUrl:c,loanOrgName:m}=this.props;this.node.innerHTML=`
|
|
1054
1016
|
<div class="waykeecom-accordion">
|
|
1055
1017
|
<input
|
|
1056
1018
|
type="checkbox"
|
|
1057
1019
|
id="finance-details-accordion"
|
|
1058
1020
|
class="waykeecom-accordion__checkbox"
|
|
1059
1021
|
${this.showDetails?'checked="true"':""}
|
|
1060
|
-
tabindex="-1"
|
|
1061
1022
|
/>
|
|
1062
|
-
<label class="waykeecom-accordion__header" for="finance-details-accordion"
|
|
1023
|
+
<label class="waykeecom-accordion__header" for="finance-details-accordion">
|
|
1063
1024
|
<div class="waykeecom-accordion__header-title">Detaljer</div>
|
|
1064
|
-
<div class="waykeecom-accordion__header-icon">
|
|
1025
|
+
<div class="waykeecom-accordion__header-icon" aria-hidden="true">
|
|
1065
1026
|
<svg
|
|
1066
1027
|
xmlns="http://www.w3.org/2000/svg"
|
|
1067
1028
|
viewBox="0 0 16 16"
|
|
@@ -1095,10 +1056,10 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1095
1056
|
</div>
|
|
1096
1057
|
</div>
|
|
1097
1058
|
</div>
|
|
1098
|
-
${
|
|
1059
|
+
${c?`
|
|
1099
1060
|
<div class="waykeecom-stack waykeecom-stack--2">
|
|
1100
1061
|
<a
|
|
1101
|
-
href="${
|
|
1062
|
+
href="${c}"
|
|
1102
1063
|
title="Visa mer information om ${m}"
|
|
1103
1064
|
rel="noopener noreferrer"
|
|
1104
1065
|
target="_blank"
|
|
@@ -1111,35 +1072,35 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1111
1072
|
</div>
|
|
1112
1073
|
</div>
|
|
1113
1074
|
</div>
|
|
1114
|
-
`,this.node.querySelector("input")?.addEventListener("click",p=>this.onDetails(p))}},
|
|
1075
|
+
`,this.node.querySelector("input")?.addEventListener("click",p=>this.onDetails(p))}},Xn=ji;var Pi=class extends r{constructor(t,e){super(t),this.props=e,this.render()}update(t){this.props=t,this.render()}render(){let{monthlyCost:t}=this.props;this.node.innerHTML=`
|
|
1115
1076
|
<ul class="waykeecom-key-value-list waykeecom-key-value-list--large-value">
|
|
1116
1077
|
${h({key:"M\xE5nadskostnad f\xF6r l\xE5net",value:u(t,{postfix:"kr/m\xE5n*"})})}
|
|
1117
1078
|
</ul>
|
|
1118
|
-
`}},_n=
|
|
1079
|
+
`}},_n=Pi;var Tn="finance-details-monthly-cost",Wn="finance-details-pie-chart-node",Zn="finance-details-basic",Vn="finance-details-detailed",$i=class extends r{constructor(e,i){super(e);this.contexts={};this.props=i,this.render()}extractProps(){let{loan:e,paymentLookupResponse:i}=this.props,{monthlyCost:o,totalCreditCost:s}=i.costs,{interest:n,effectiveInterest:l}=i.interests,c=i.downPaymentSpec.current,m=i.durationSpec.current,{administrationFee:p,setupFee:y}=i.fees,I=i.creditAmount,k=i.publicURL,g=c+I,w=Math.round(c/g*100),N=Math.round(I/g*100);return{duration:m,downPayment:c,administrationFee:p,setupFee:y,totalCreditCost:s,interest:n,effectiveInterest:l,creditAmount:I,total:g,publicUrl:k,monthlyCost:o,loanOrgName:e.name,loanOrgLogo:e.logo,downPaymentPercentage:w,creditAmountPercentage:N}}update(e){this.props=e;let{duration:i,downPayment:o,administrationFee:s,setupFee:n,monthlyCost:l,totalCreditCost:c,interest:m,effectiveInterest:p,creditAmount:y,publicUrl:I,loanOrgName:k,downPaymentPercentage:g,creditAmountPercentage:w}=this.extractProps();this.contexts.loanDetailsMontlyCost?.update({monthlyCost:l}),this.contexts.pieChart?.update({percentage:w}),this.contexts.loanDetailsBasic?.update({downPayment:o,creditAmount:y,downPaymentPercentage:g,creditAmountPercentage:w}),this.contexts.loanDetailsDetailed?.update({duration:i,administrationFee:s,setupFee:n,totalCreditCost:c,interest:m,effectiveInterest:p,publicUrl:I,loanOrgName:k})}render(){let{duration:e,downPayment:i,administrationFee:o,setupFee:s,totalCreditCost:n,interest:l,effectiveInterest:c,creditAmount:m,publicUrl:p,loanOrgName:y,loanOrgLogo:I,monthlyCost:k,downPaymentPercentage:g,creditAmountPercentage:w}=this.extractProps(),N=`*Ber\xE4knat p\xE5 ${u(l*100,{decimals:2})} % r\xE4nta (effektivt ${u(c*100,{decimals:2})} %). Den r\xE4nta du f\xE5r s\xE4tts vid avtalskrivning.`;this.node.innerHTML=`
|
|
1119
1080
|
<div class="waykeecom-stepper__break">
|
|
1120
1081
|
<div class="waykeecom-shadow-box">
|
|
1121
1082
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1122
1083
|
<div class="waykeecom-stack waykeecom-stack--1">
|
|
1123
|
-
<img src="${I}" alt="${
|
|
1084
|
+
<img src="${I}" alt="${y} logotyp" class="waykeecom-image waykeecom-image--loan-logo" />
|
|
1124
1085
|
</div>
|
|
1125
1086
|
</div>
|
|
1126
1087
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1127
|
-
<div class="waykeecom-stack waykeecom-stack--1" id="${
|
|
1088
|
+
<div class="waykeecom-stack waykeecom-stack--1" id="${Tn}"></div>
|
|
1128
1089
|
<div class="waykeecom-stack waykeecom-stack--1">
|
|
1129
1090
|
<div class="waykeecom-disclaimer-text">${N}</div>
|
|
1130
1091
|
</div>
|
|
1131
1092
|
</div>
|
|
1132
|
-
<div class="waykeecom-stack waykeecom-stack--3" id="${
|
|
1093
|
+
<div class="waykeecom-stack waykeecom-stack--3" id="${Wn}"></div>
|
|
1133
1094
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1134
|
-
<div class="waykeecom-stack waykeecom-stack--2" id="${
|
|
1095
|
+
<div class="waykeecom-stack waykeecom-stack--2" id="${Zn}"></div>
|
|
1135
1096
|
<div class="waykeecom-stack waykeecom-stack--2">
|
|
1136
1097
|
<hr class="waykeecom-separator" />
|
|
1137
1098
|
</div>
|
|
1138
|
-
<div class="waykeecom-stack waykeecom-stack--2" id="${
|
|
1099
|
+
<div class="waykeecom-stack waykeecom-stack--2" id="${Vn}"></div>
|
|
1139
1100
|
</div>
|
|
1140
1101
|
</div>
|
|
1141
1102
|
</div>
|
|
1142
|
-
`,this.contexts.loanDetailsMontlyCost=new _n(this.node.querySelector(`#${
|
|
1103
|
+
`,this.contexts.loanDetailsMontlyCost=new _n(this.node.querySelector(`#${Tn}`),{monthlyCost:k}),this.contexts.pieChart=new On(this.node.querySelector(`#${Wn}`),{percentage:w}),this.contexts.loanDetailsBasic=new Fn(this.node.querySelector(`#${Zn}`),{downPayment:i,creditAmount:m,downPaymentPercentage:g,creditAmountPercentage:w}),this.contexts.loanDetailsDetailed=new Xn(this.node.querySelector(`#${Vn}`),{duration:e,administrationFee:o,setupFee:s,totalCreditCost:n,interest:l,effectiveInterest:c,publicUrl:p,loanOrgName:y})}},Un=$i;var Dn="downpayment-range-node",Pl="downpayment-range",Qn="duration-range-node",$l="duration-range",Yn="residual-range-node",Kl="residual-range",ql="loan-details",Hn=`${ql}-node`,Mn="credit-assessment-node",jn="credit-assessment-proceed",zn=`${jn}-node`,Jn="loan-error-node",Ki=class extends r{constructor(e,i){super(e);this.contexts={};this.props=i;let o=this.props.loan.loanDetails;if(!o)throw"err";this.paymentLookupResponse=this.props.paymentLookupResponse||o,this.paymentState={vehicleId:this.props.vehicleId,dealerId:"",downPayment:this.paymentLookupResponse.downPaymentSpec,duration:this.paymentLookupResponse.durationSpec,residual:this.paymentLookupResponse.residualValueSpec,financialOptionId:this.paymentLookupResponse.financialOptionId},this.previousState=JSON.parse(JSON.stringify(this.paymentState)),this.render()}async payment(){this.contexts.downPayment?.disabled(!0),this.contexts.duration?.disabled(!0),this.contexts.residual?.disabled(!0),this.contexts.proceedButton?.disabled(!0);try{let e=await Sn({vehicleId:this.paymentState.vehicleId,downPayment:this.paymentState.downPayment.current,duration:this.paymentState.duration.current,residual:this.paymentState.residual?.current,financialOptionId:this.paymentState.financialOptionId});this.previousState=JSON.parse(JSON.stringify(this.paymentState)),this.paymentLookupResponse=we(e),this.paymentState={...this.paymentState,downPayment:this.paymentLookupResponse.downPaymentSpec,duration:this.paymentLookupResponse.durationSpec,residual:this.paymentLookupResponse.residualValueSpec,financialOptionId:this.paymentLookupResponse.financialOptionId},aa(e)(this.props.store.dispatch),this.update(),this.contexts.errorAlert?.update(void 0),this.contexts.downPayment?.update(this.paymentState.downPayment.current,this.paymentState.downPayment.min,this.paymentState.downPayment.max),this.contexts.residual?.update(parseInt(`${this.paymentState.residual.current*100}`,10),parseInt(`${this.paymentState.residual.min*100}`,10),parseInt(`${this.paymentState.residual.max*100}`,10)),this.contexts.duration?.update(this.paymentState.duration.current,this.paymentState.duration.min,this.paymentState.duration.max)}catch{this.contexts.errorAlert?.update("Ett fel uppstod, f\xF6rs\xF6k igen."),this.contexts.downPayment?.disabled(!1),this.contexts.duration?.disabled(!1),this.contexts.residual?.disabled(!1),this.contexts.downPayment?.update(this.previousState.downPayment.current,this.previousState.downPayment.min,this.previousState.downPayment.max),this.contexts.residual?.update(parseInt(`${this.previousState.residual.current*100}`,10),parseInt(`${this.previousState.residual.min*100}`,10),parseInt(`${this.previousState.residual.max*100}`,10)),this.contexts.duration?.update(this.previousState.duration.current,this.previousState.duration.min,this.previousState.duration.max)}finally{this.contexts.downPayment?.disabled(!1),this.contexts.duration?.disabled(!1),this.contexts.residual?.disabled(!1),this.contexts.proceedButton?.disabled(!1)}}onChange(e){let i=e.currentTarget,o=i.name,s=i.value;i.value=s,this.paymentState[o].current=o==="residual"?parseInt(s,10)/100:parseInt(s,10),this.payment()}update(){this.contexts.loanDetails?.update({loan:this.props.loan,paymentLookupResponse:this.paymentLookupResponse})}render(){let{store:e,loan:i,onProceed:o}=this.props,{order:s}=e.getState(),n=s?.contactInformation?.name,l=i.loanDetails?.shouldUseCreditScoring;this.node.innerHTML=`
|
|
1143
1104
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1144
1105
|
<hr class="waykeecom-separator" />
|
|
1145
1106
|
</div>
|
|
@@ -1151,38 +1112,38 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1151
1112
|
</div>
|
|
1152
1113
|
</div>
|
|
1153
1114
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1154
|
-
<div class="waykeecom-stack waykeecom-stack--3" id="${
|
|
1155
|
-
<div class="waykeecom-stack waykeecom-stack--3" id="${Un}"></div>
|
|
1115
|
+
<div class="waykeecom-stack waykeecom-stack--3" id="${Dn}"></div>
|
|
1156
1116
|
<div class="waykeecom-stack waykeecom-stack--3" id="${Qn}"></div>
|
|
1157
|
-
<div class="waykeecom-stack waykeecom-stack--3" id="${
|
|
1117
|
+
<div class="waykeecom-stack waykeecom-stack--3" id="${Yn}"></div>
|
|
1118
|
+
<div class="waykeecom-stack waykeecom-stack--3" id="${Jn}"></div>
|
|
1158
1119
|
|
|
1159
|
-
<div class="waykeecom-stack waykeecom-stack--3" id="${
|
|
1120
|
+
<div class="waykeecom-stack waykeecom-stack--3" id="${Hn}"></div>
|
|
1160
1121
|
</div>
|
|
1161
1122
|
${l?`
|
|
1162
|
-
<div class="waykeecom-stack waykeecom-stack--3" id="${
|
|
1163
|
-
`:`<div class="waykeecom-stack waykeecom-stack--3" id="${
|
|
1164
|
-
`,this.contexts.downPayment=new
|
|
1123
|
+
<div class="waykeecom-stack waykeecom-stack--3" id="${Mn}"></div>
|
|
1124
|
+
`:`<div class="waykeecom-stack waykeecom-stack--3" id="${zn}"></div>`}
|
|
1125
|
+
`,this.contexts.downPayment=new $e(this.node.querySelector(`#${Dn}`),{title:"Kontantinsats",value:this.paymentState.downPayment.current,id:Pl,name:"downPayment",onChange:c=>this.onChange(c),min:this.paymentState.downPayment.min,max:this.paymentState.downPayment.max,unit:"kr",information:`
|
|
1165
1126
|
<div class="waykeecom-content waykeecom-content--inherit-size">
|
|
1166
1127
|
<p class="waykeecom-content__p"><span class="waykeecom-text waykeecom-text--font-medium">Hur mycket av dina egna pengar vill du l\xE4gga?</span></p>
|
|
1167
1128
|
<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>
|
|
1168
1129
|
<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>
|
|
1169
1130
|
</div>
|
|
1170
|
-
`,onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_DOWNPAYMENT_INFORMATION_TOGGLE","FINANCIAL")}}),this.contexts.duration=new
|
|
1131
|
+
`,onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_DOWNPAYMENT_INFORMATION_TOGGLE","FINANCIAL")}}),this.contexts.duration=new $e(this.node.querySelector(`#${Qn}`),{title:"Avbetalning",value:this.paymentState.duration.current,id:$l,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 $e(this.node.querySelector(`#${Yn}`),{title:"Restv\xE4rde",value:parseInt(`${this.paymentState.residual.current*100}`,10),id:Kl,name:"residual",onChange:c=>this.onChange(c),min:parseInt(`${this.paymentState.residual.min*100}`,10),max:parseInt(`${this.paymentState.residual.max*100}`,10),step:parseInt(`${this.paymentState.residual.step*100}`,10),unit:"%"})),this.contexts.errorAlert=new En(this.node.querySelector(`#${Jn}`),{}),this.contexts.loanDetails=new Un(this.node.querySelector(`#${Hn}`),{loan:i,paymentLookupResponse:this.paymentLookupResponse}),l?new Bn(this.node.querySelector(`#${Mn}`),{store:e,loan:i,paymentLookupResponse:this.paymentLookupResponse,onProceed:()=>o()}):this.contexts.proceedButton=new v(this.node.querySelector(`#${zn}`),{title:"G\xE5 vidare",id:jn,onClick:()=>o()})}},Pn=Ki;import{PaymentType as $n}from"@wayke-se/ecom";var ed="credit-assessment-result",Kn=`${ed}-node`,qi=class extends r{constructor(t,e){super(t,{htmlTag:"div"}),this.props=e,this.render()}render(){let{store:t,paymentType:e,loan:i,paymentLookupResponse:o,onEdit:s}=this.props,n=i?.loanDetails;if(e===$n.Loan){let l=this.props.store.getState(),c=o||n;if(!n||!c)throw"Missing loan";let m=c.downPaymentSpec.current,p=c.creditAmount,y=c.durationSpec.current,{interest:I,effectiveInterest:k}=c.interests,{monthlyCost:g}=c.costs,w=[{key:"Kontantinsats",value:u(m,{postfix:"kr"})},{key:"L\xE5nebelopp",value:u(p,{postfix:"kr"})},{key:"Avbetalningsperoid",value:`${y} m\xE5n`},{key:"M\xE5nadskostnad f\xF6r l\xE5net",value:u(g,{postfix:"kr*"})}],N=l.creditAssessmentResponse?.recommendation,_=`*Ber\xE4knat p\xE5 ${u(I*100,{decimals:2})} % r\xE4nta (effektivt ${u(k*100,{decimals:2})} %). Den r\xE4nta du f\xE5r s\xE4tts vid avtalskrivning.`;this.node.innerHTML=`
|
|
1171
1132
|
<div class="waykeecom-stack waykeecom-stack--2">
|
|
1172
1133
|
<h4 class="waykeecom-heading waykeecom-heading--4">${i.name}</h4>
|
|
1173
1134
|
<div class="waykeecom-content">
|
|
1174
1135
|
<p class="waykeecom-content__p">Ordern \xE4r snart klar, h\xE4r ser du ditt l\xE5nebesked:</p>
|
|
1175
1136
|
</div>
|
|
1176
1137
|
</div>
|
|
1177
|
-
${N?`<div class="waykeecom-stack waykeecom-stack--2" id="${
|
|
1138
|
+
${N?`<div class="waykeecom-stack waykeecom-stack--2" id="${Kn}"></div>`:""}
|
|
1178
1139
|
<div class="waykeecom-stack waykeecom-stack--2">
|
|
1179
1140
|
<div class="waykeecom-stack waykeecom-stack--1">
|
|
1180
1141
|
<ul class="waykeecom-key-value-list">
|
|
1181
|
-
${
|
|
1142
|
+
${w.map(J=>h(J)).join("")}
|
|
1182
1143
|
</ul>
|
|
1183
1144
|
</div>
|
|
1184
1145
|
<div class="waykeecom-stack waykeecom-stack--1">
|
|
1185
|
-
<div class="waykeecom-disclaimer-text">${
|
|
1146
|
+
<div class="waykeecom-disclaimer-text">${_}</div>
|
|
1186
1147
|
</div>
|
|
1187
1148
|
</div>
|
|
1188
1149
|
<div class="waykeecom-stack waykeecom-stack--1">
|
|
@@ -1190,10 +1151,10 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1190
1151
|
<button type="button" title="\xC4ndra finansiering" class="waykeecom-link">\xC4ndra</button>
|
|
1191
1152
|
</div>
|
|
1192
1153
|
</div>
|
|
1193
|
-
`,N&&new
|
|
1154
|
+
`,N&&new ae(this.node.querySelector(`#${Kn}`),{store:t,decision:N})}else this.node.innerHTML=`
|
|
1194
1155
|
<div class="waykeecom-stack waykeecom-stack--1">
|
|
1195
1156
|
<ul class="waykeecom-key-value-list">
|
|
1196
|
-
${h({key:"Finansiering",value:e
|
|
1157
|
+
${h({key:"Finansiering",value:e===$n.Cash?"Kontant":"Privatleasing"})}
|
|
1197
1158
|
</ul>
|
|
1198
1159
|
</div>
|
|
1199
1160
|
${s?`
|
|
@@ -1203,60 +1164,60 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1203
1164
|
</div>
|
|
1204
1165
|
</div>
|
|
1205
1166
|
`:""}
|
|
1206
|
-
`;s&&this.node.querySelector("button")?.addEventListener("click",()=>s())}}
|
|
1167
|
+
`;s&&this.node.querySelector("button")?.addEventListener("click",()=>s())}},qn=qi;var ar="button-financial-proceed",er=`${ar}-node`,td="financial-option",tr=`${td}-node`,id="financial-option-second",ir=`${id}-node`,od="radio-financial-cash",ad="radio-financial-loan",sd="radio-financial-lease",or="payment-node",nd=Yi,eo=class extends r{constructor(t,e){super(t),this.props=e,A(this.props.store,"navigation",()=>{let s=this.props.store.getState();this.paymentType=s.paymentType,this.render()});let i=this.props.store.getState(),{paymentType:o}=i;this.paymentType=o,this.render()}onChange(t){sa()(this.props.store.dispatch);let i=t.currentTarget.value;switch(this.paymentType=i,this.render(!0),K(this.paymentType)){case T.Cash:d("MAIN","FINANCIAL_CASH_SELECTED","FINANCIAL");break;case T.Lease:d("MAIN","FINANCIAL_LEASE_SELECTED","FINANCIAL");break;case T.Loan:d("MAIN","FINANCIAL_LOAN_SELECTED","FINANCIAL");default:break}}onProceed(){let t=K(this.paymentType);if(this.paymentType&&t){switch(t){case T.Cash:d("MAIN","FINANCIAL_CASH_SET","FINANCIAL");break;case T.Lease:d("MAIN","FINANCIAL_LEASE_SET","FINANCIAL");break;case T.Loan:d("MAIN","FINANCIAL_LOAN_SET","FINANCIAL");default:break}oa(this.paymentType,this.props.lastStage)(this.props.store.dispatch)}}onEdit(){d("MAIN","FINANCIAL_EDIT","FINANCIAL"),S("main",this.props.index)(this.props.store.dispatch)}render(t){let e=this.props.store.getState(),{id:i,order:o,paymentLookupResponse:s}=e;if(!o)throw"No order available";let n=o.paymentOptions,l=e.topNavigation.stage>this.props.index,c=X(this.node,{completed:l,title:"\xC4gandeform",active:e.navigation.stage===this.props.index,id:"financial",index:this.props.index}),m=document.createElement("div"),p=K(this.paymentType);if((e.navigation.stage>this.props.index||l&&e.navigation.stage!==this.props.index)&&p){let y=n.find(I=>I.type===T.Loan);new qn(c,{store:this.props.store,loan:y,paymentType:p,paymentLookupResponse:s||y?.loanDetails,onEdit:e.createdOrderId?void 0:()=>this.onEdit()})}else if(e.navigation.stage===this.props.index){let y=e.order?.orderVehicle,I=n.find(G=>G.type===T.Cash),k=n.filter(G=>G.type===T.Loan),g=n.find(G=>G.type===T.Lease);m.innerHTML=`
|
|
1207
1168
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1208
|
-
<h4 class="waykeecom-heading waykeecom-heading--4 waykeecom-no-margin">Hur vill du finansiera din ${
|
|
1169
|
+
<h4 class="waykeecom-heading waykeecom-heading--4 waykeecom-no-margin">Hur vill du finansiera din ${y?.title} ${ge(y)}?</h4>
|
|
1209
1170
|
</div>
|
|
1210
1171
|
|
|
1211
|
-
${I||k.length?`<div class="waykeecom-stack waykeecom-stack--3" id="${
|
|
1212
|
-
${g?`<div class="waykeecom-stack waykeecom-stack--3" id="${
|
|
1172
|
+
${I||k.length?`<div class="waykeecom-stack waykeecom-stack--3" id="${tr}"></div>`:""}
|
|
1173
|
+
${g?`<div class="waykeecom-stack waykeecom-stack--3" id="${ir}"></div>`:""}
|
|
1213
1174
|
|
|
1214
|
-
<div class="waykeecom-stack waykeecom-stack--3" id="${
|
|
1215
|
-
${p!==T.Loan?`<div class="waykeecom-stack waykeecom-stack--3" id="${
|
|
1175
|
+
<div class="waykeecom-stack waykeecom-stack--3" role="form" id="${or}" aria-describedby="${nd}"></div>
|
|
1176
|
+
${p!==T.Loan?`<div class="waykeecom-stack waykeecom-stack--3" id="${er}"></div>`:""}
|
|
1216
1177
|
|
|
1217
|
-
`,
|
|
1178
|
+
`,c.appendChild(m);let w=o.contactInformation,N=[];I&&N.push({id:od,value:T.Cash,title:"Kontant",description:`
|
|
1218
1179
|
<div class="waykeecom-box">
|
|
1219
1180
|
<div class="waykeecom-content waykeecom-content--inherit-size">
|
|
1220
1181
|
<ul class="waykeecom-content__ul">
|
|
1221
|
-
<li class="waykeecom-content__li">Betalning sker hos ${
|
|
1182
|
+
<li class="waykeecom-content__li">Betalning sker hos ${w?.name} vid
|
|
1222
1183
|
kontraktskrivning.</li>
|
|
1223
1184
|
<li class="waykeecom-content__li">Inga kostnader tillkommer.</li>
|
|
1224
1185
|
</ul>
|
|
1225
1186
|
</div>
|
|
1226
|
-
</div>`,meta:`<div class="waykeecom-text waykeecom-text--font-bold">${u(I.price,{postfix:I.unit})}</div>`}),k.forEach((
|
|
1187
|
+
</div>`,meta:`<div class="waykeecom-text waykeecom-text--font-bold">${u(I.price,{postfix:I.unit})}</div>`}),k.forEach((G,U)=>{let ot=G.price,Dc=G.loanDetails?.durationSpec.default,Qc=G.loanDetails?.interests.interest||NaN,Yc=G.loanDetails?.creditAmount||NaN,Hc=G.loanDetails?.shouldUseCreditScoring;N.push({id:`${ad}-${U}`,value:`${T.Loan}-${U}`,title:G.name,description:`
|
|
1227
1188
|
<div class="waykeecom-box">
|
|
1228
1189
|
<div class="waykeecom-stack waykeecom-stack--2">
|
|
1229
1190
|
<div class="waykeecom-content waykeecom-content--inherit-size">
|
|
1230
1191
|
<ul class="waykeecom-content__ul">
|
|
1231
|
-
${
|
|
1192
|
+
${Hc?`
|
|
1232
1193
|
<li class="waykeecom-content__li">
|
|
1233
1194
|
<div>
|
|
1234
1195
|
<span class="waykeecom-text waykeecom-text--valign-middle">L\xE5neans\xF6kan online med BankID </span>
|
|
1235
|
-
<img src="${
|
|
1196
|
+
<img src="${ye.bankid}" alt="BankID logotyp" class="waykeecom-image waykeecom-image--inline" aria-hidden="true" />
|
|
1236
1197
|
<span class="waykeecom-text waykeecom-text--valign-middle"> \u2013 svar direkt!</span>
|
|
1237
1198
|
</div>
|
|
1238
1199
|
</li>
|
|
1239
1200
|
`:""}
|
|
1240
|
-
<li class="waykeecom-content__li">Betalning sker hos ${
|
|
1201
|
+
<li class="waykeecom-content__li">Betalning sker hos ${w?.name} vid
|
|
1241
1202
|
kontraktskrivning.</li>
|
|
1242
|
-
<li class="waykeecom-content__li">Ber\xE4knat p\xE5 ${u(
|
|
1203
|
+
<li class="waykeecom-content__li">Ber\xE4knat p\xE5 ${u(Yc,{postfix:"kr"})}, ${Dc} m\xE5n, ${u(Qc*100,{decimals:2})}% r\xE4nta.</li>
|
|
1243
1204
|
</ul>
|
|
1244
1205
|
</div>
|
|
1245
1206
|
</div>
|
|
1246
|
-
${
|
|
1207
|
+
${G.logo?`<div class="waykeecom-stack waykeecom-stack--2">
|
|
1247
1208
|
<div class="waykeecom-align waykeecom-align--center">
|
|
1248
|
-
<img src="${
|
|
1209
|
+
<img src="${G.logo}" alt="${G.name} logotyp" class="waykeecom-image waykeecom-image--loan-logo" />
|
|
1249
1210
|
</div>
|
|
1250
1211
|
</div>`:""}
|
|
1251
1212
|
</div>
|
|
1252
|
-
`,meta:`<div class="waykeecom-text waykeecom-text--font-bold">${u(ot,{postfix:
|
|
1213
|
+
`,meta:`<div class="waykeecom-text waykeecom-text--font-bold">${u(ot,{postfix:G.unit})}</div>`})}),(I||k.length)&&new M(m.querySelector(`#${tr}`),{title:"K\xF6p bilen",checked:this.paymentType,name:"paymentType",information:`
|
|
1253
1214
|
<div class="waykeecom-content waykeecom-content--inherit-size">
|
|
1254
1215
|
<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>
|
|
1255
1216
|
</div>
|
|
1256
1217
|
`,footer:`
|
|
1257
|
-
<div class="waykeecom-box">
|
|
1218
|
+
<div class="waykeecom-box" role="status" aria-live="polite">
|
|
1258
1219
|
<div class="waykeecom-creditor-disclaimer">
|
|
1259
|
-
<div class="waykeecom-creditor-disclaimer__icon">
|
|
1220
|
+
<div class="waykeecom-creditor-disclaimer__icon" aria-hidden="true">
|
|
1260
1221
|
<svg
|
|
1261
1222
|
xmlns="http://www.w3.org/2000/svg"
|
|
1262
1223
|
width="59"
|
|
@@ -1293,12 +1254,12 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1293
1254
|
</div>
|
|
1294
1255
|
</div>
|
|
1295
1256
|
</div>
|
|
1296
|
-
`,options:N,onClick:
|
|
1257
|
+
`,options:N,onClick:G=>this.onChange(G),onClickInformation:()=>{d("MAIN","FINANCIAL_INFORMATION_TOGGLE","FINANCIAL")}});let _=[];g&&(_.push({id:sd,title:"Privatleasing",value:T.Lease,meta:`<div class="waykeecom-text waykeecom-text--font-bold">Fr\xE5n ${u(g?.price,{postfix:g.unit})}</div>`}),new M(m.querySelector(`#${ir}`),{title:"Leasa bilen",checked:this.paymentType,name:"paymentType",information:`
|
|
1297
1258
|
<div class="waykeecom-content waykeecom-content--inherit-size">
|
|
1298
1259
|
<p class="waykeecom-content__p">N\xE4r du privatleasar en bil \xE4ger du den inte sj\xE4lv utan betalar en m\xE5nadsavgift under en avtalad tid och som t\xE4cker en viss k\xF6rstr\xE4cka och andra avtalade tj\xE4nster.</p>
|
|
1299
1260
|
</div>
|
|
1300
|
-
`,options:
|
|
1301
|
-
<div class="waykeecom-nav-banner" id="${
|
|
1261
|
+
`,options:_,onClick:G=>this.onChange(G)}));let J=m.querySelector(`#${or}`);if(J){let G=K(this.paymentType),U=je(this.paymentType);k.length&&G===T.Loan&&U!==void 0?new Pn(J,{store:this.props.store,loan:JSON.parse(JSON.stringify(k[U])),vehicleId:i,paymentLookupResponse:s,onProceed:()=>this.onProceed()}):new v(m.querySelector(`#${er}`),{title:"G\xE5 vidare",id:ar,disabled:!this.paymentType,onClick:()=>this.onProceed()})}}!t&&e.navigation.stage===this.props.index&&c.parentElement?.scrollIntoView()}},sr=eo;var nr="insurance-button-top-left-node",rr="insurance-button-bottom-left-node",cr="insurance-add-remove-node",to=class extends r{constructor(t,e){super(t),this.props=e,this.render()}render(){let{freeInsurance:t,selected:e,onClose:i,onClick:o}=this.props,{title:s,description:n,logo:l,longDescription:c}=t;this.node.innerHTML=`
|
|
1262
|
+
<div class="waykeecom-nav-banner" id="${nr}"></div>
|
|
1302
1263
|
|
|
1303
1264
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1304
1265
|
<div class="waykeecom-hstack waykeecom-hstack--align-center waykeecom-hstack--spacing-3">
|
|
@@ -1320,30 +1281,30 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1320
1281
|
<p class="waykeecom-content__p">${n}</p>
|
|
1321
1282
|
</div>
|
|
1322
1283
|
</div>
|
|
1323
|
-
${
|
|
1284
|
+
${c?`
|
|
1324
1285
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1325
1286
|
<div class="waykeecom-content">
|
|
1326
|
-
<p class="waykeecom-content__p">${Ve(
|
|
1287
|
+
<p class="waykeecom-content__p">${Ve(c)}</p>
|
|
1327
1288
|
</div>
|
|
1328
1289
|
</div>
|
|
1329
1290
|
`:""}
|
|
1330
1291
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1331
|
-
<div class="waykeecom-stack waykeecom-stack--1" id="${
|
|
1332
|
-
<div class="waykeecom-stack waykeecom-stack--1" id="${
|
|
1292
|
+
<div class="waykeecom-stack waykeecom-stack--1" id="${cr}"></div>
|
|
1293
|
+
<div class="waykeecom-stack waykeecom-stack--1" id="${rr}"></div>
|
|
1333
1294
|
</div>
|
|
1334
|
-
`,new
|
|
1295
|
+
`,new ce(this.node.querySelector(`#${nr}`),{title:"Tillbaka",onClick:()=>i()}),new ee(this.node.querySelector(`#${rr}`),{title:"Tillbaka",onClick:()=>i()}),new q(this.node.querySelector(`#${cr}`),{selected:e,fullSize:!0,onClick:()=>o()}),V()}},lr=to;var io=class extends r{constructor(e,i){super(e);this.displayInfo=!1;this.props=i,A(this.props.store,"freeInsurance",()=>{this.render()}),this.render()}onInfoOpen(){d("MAIN","INSURANCE_INFORMATION_TOGGLE","INSURANCE"),this.displayInfo=!0,this.render()}onInfoClose(){d("MAIN","INSURANCE_INFORMATION_TOGGLE","INSURANCE"),this.displayInfo=!1,O(),this.render(),this.node.parentElement?.scrollIntoView()}onClick(){let{freeInsurance:e}=this.props.store.getState();e&&this.props.freeInsurance!==e?d("MAIN","INSURANCE_SELECTED","INSURANCE"):d("MAIN","INSURANCE_UNSELECTED","INSURANCE"),ca(this.props.freeInsurance)(this.props.store.dispatch)}render(){let{store:e,freeInsurance:i,key:o}=this.props,s=e.getState(),n=s.order?.insuranceOption?.logo,l=s.freeInsurance?JSON.stringify(s.freeInsurance).localeCompare(JSON.stringify(this.props.freeInsurance))===0:!1;this.displayInfo&&new lr(H(),{freeInsurance:i,selected:l,onClick:()=>{this.onInfoClose(),this.onClick()},onClose:()=>this.onInfoClose()}),new ue(this.node,{logo:n,id:o,title:i.title,description:i.description,price:"Gratis",selected:l,onClick:()=>this.onClick(),onInfo:()=>this.onInfoOpen()},o)}},dr=io;var oo=class extends r{constructor(t,e){super(t),this.props=e,this.render()}render(){let{store:t,insurances:e}=this.props,i=new Ie(this.node,{id:"insurance-list",onClick:()=>d("MAIN","INSURANCE_ARROW","INSURANCE")}),{overflowElement:o}=i;o&&(o.innerHTML="",e.forEach((s,n)=>new dr(o,{store:t,freeInsurance:s,key:`insurance-${n}`})))}},mr=oo;var ao="insurance-grid-list-node",rd="button-insurances-proceed",pr=`${ao}-node`,cd="button-insurances-skip",ld=`${cd}-node`,so=class extends r{constructor(t,e){super(t),this.props=e,this.render()}onProceed(){let{freeInsurance:t}=this.props.store.getState();$(this.props.lastStage)(this.props.store.dispatch),d("MAIN",t?"INSURANCE_SET":"INSURANCE_SKIPPED","INSURANCE")}render(){let{store:t,insurance:e}=this.props;this.node.innerHTML=`
|
|
1335
1296
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1336
1297
|
<h4 class="waykeecom-heading waykeecom-heading--4">Vill du teckna en f\xF6rs\xE4kring p\xE5 din nya bil?</h4>
|
|
1337
1298
|
<div class="waykeecom-content">
|
|
1338
1299
|
<p class="waykeecom-content__p">Nedan visas f\xF6rslag p\xE5 f\xF6rs\xE4kringar som passar dig och din nya bil.</p>
|
|
1339
1300
|
</div>
|
|
1340
1301
|
</div>
|
|
1341
|
-
<div class="waykeecom-stack waykeecom-stack--3" id="${
|
|
1302
|
+
<div class="waykeecom-stack waykeecom-stack--3" id="${ao}"></div>
|
|
1342
1303
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1343
|
-
<div class="waykeecom-stack waykeecom-stack--1" id="${
|
|
1344
|
-
<div class="waykeecom-stack waykeecom-stack--1" id="${
|
|
1304
|
+
<div class="waykeecom-stack waykeecom-stack--1" id="${pr}"></div>
|
|
1305
|
+
<div class="waykeecom-stack waykeecom-stack--1" id="${ld}"></div>
|
|
1345
1306
|
</div>
|
|
1346
|
-
`,new
|
|
1307
|
+
`,new mr(this.node.querySelector(`#${ao}`),{store:t,insurances:[e]}),new v(this.node.querySelector(`#${pr}`),{id:rd,title:"G\xE5 vidare",onClick:()=>this.onProceed()})}},gr=so;import{DrivingDistance as W}from"@wayke-se/ecom";import{insurances as Ir}from"@wayke-se/ecom";var ur=(a,t)=>{let e=a.getState();if(!e.id)throw"No id";let i=Ir.newInsuranceOptionsRequest().forCustomer(e.customer.socialId).forVehicle(e.id).withDrivingDistance(t);return Ir.getOptions(i.build())};var no=class extends r{constructor(t,e){super(t),this.props=e,this.render()}isDisabled(){return this.props.disabled}disabled(t){this.props.disabled!==t&&(this.props.disabled=t,this.render())}loading(t){this.props.loading!==t&&(this.props.loading=t,this.props.disabled=t,this.render())}render(){let{title:t,id:e,disabled:i,loading:o,onClick:s}=this.props;this.node.innerHTML=`
|
|
1347
1308
|
<button
|
|
1348
1309
|
type="button"
|
|
1349
1310
|
${e?`id="${e}"`:""}
|
|
@@ -1357,7 +1318,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1357
1318
|
${R({type:"inline"})}
|
|
1358
1319
|
</span>`:""}
|
|
1359
1320
|
</button>
|
|
1360
|
-
`,s&&this.node.querySelector("button")?.addEventListener("click",s)}},
|
|
1321
|
+
`,s&&this.node.querySelector("button")?.addEventListener("click",s)}},br=no;var ro=class extends r{constructor(t,e){super(t,e.append?{htmlTag:"div",className:"waykeecom-input-selection",attributes:[{key:"role",value:"checkbox"}]}:void 0),this.props=e,this.render()}checked(t){this.props.checked!==t&&(this.props.checked=t,this.render())}disabled(t){this.props.disabled!==t&&(this.props.disabled=t,this.render())}render(){let{id:t,title:e,value:i,name:o,checked:s,meta:n,description:l,append:c,disabled:m,onClick:p}=this.props,y=`
|
|
1361
1322
|
<input
|
|
1362
1323
|
type="checkbox"
|
|
1363
1324
|
id="${t}"
|
|
@@ -1376,12 +1337,12 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1376
1337
|
${l}
|
|
1377
1338
|
</label>
|
|
1378
1339
|
`:""}
|
|
1379
|
-
`;
|
|
1340
|
+
`;c&&(this.node.innerHTML=y),this.node.innerHTML=`
|
|
1380
1341
|
<div class="waykeecom-input-selection" role="checkbox">
|
|
1381
|
-
${
|
|
1342
|
+
${y}
|
|
1382
1343
|
</div>
|
|
1383
|
-
`;let I=this.node.querySelector(`#${t}`);I&&p&&I.addEventListener("click",p)}},Ke=
|
|
1384
|
-
<div class="waykeecom-nav-banner" id="${
|
|
1344
|
+
`;let I=this.node.querySelector(`#${t}`);I&&p&&I.addEventListener("click",p)}},Ke=ro;var co=class extends r{constructor(t){super(t,{htmlTag:"div",className:"waykeecom-stack waykeecom-stack--1"}),this.render()}render(){return this.node.innerHTML='<div class="waykeecom-box"></div>',this.node.querySelector(".waykeecom-box")}},yr=co;var lo="insurance-button-top-left-node",hr="insurance-button-bottom-left-node",mo="insurance-add-remove-node",kr="insurance-addons-node",Cr="insurance-accordion-node",dd=a=>a.toString().toLowerCase().replace(/\s+/g,"-").replace(/[^\w\-]+/g,"").replace(/\-\-+/g,"-").replace(/^-+/,"").replace(/-+$/,""),po=class a extends r{constructor(e,i){super(e);this.initialAddons=[];this.addons=[];this.contexts={checkboxes:{}};this.props=i;let{insuranceAddOns:o}=this.props.store.getState();o?.insurance&&o.insurance===this.props.insurance.name&&(this.addons=[...o.addOns]),this.initialAddons=[...this.addons],this.render()}static containChanges(e,i){let o=[...e].sort(),s=[...i].sort();return o.join().localeCompare(s.join())!==0}onClick(e){let i=e.currentTarget,{name:o,checked:s}=i,n=this.props.insurance.addOns.find(c=>c.name===o);if(n){if(Object.keys(this.contexts.checkboxes).forEach(c=>{this.contexts.checkboxes[c]?.disabled(!1)}),s)d("MAIN","INSURANCE_ADDON_SELECTED","INSURANCE_IF"),this.addons.push(n);else{d("MAIN","INSURANCE_ADDON_UNSELECTED","INSURANCE_IF");let c=this.addons.findIndex(m=>m.name===n.name);c>-1&&this.addons.splice(c,1)}this.contexts.checkboxes[o]?.checked(s),[...new Set(this.addons.map(c=>c.exclude).flat())].forEach(c=>this.contexts.checkboxes[c]?.disabled(!0))}let l=a.containChanges(this.initialAddons,this.addons);this.contexts.updateButton?.disabled(this.props.selected?!l:!1),this.render()}onUpdate(){let{insurance:e}=this.props.store.getState();!e||e&&this.props.insurance.name!==e.name?d("MAIN","INSURANCE_SELECTED","INSURANCE_IF"):d("MAIN","INSURANCE_UNSELECTED","INSURANCE_IF"),ra(this.props.insurance,this.addons)(this.props.store.dispatch),this.props.onClose()}render(){let{insurance:e,selected:i,onClose:o}=this.props,{name:s,description:n,legalDescription:l,legalUrl:c,insuranceItems:m}=e,p=e.addOns,y=a.containChanges(this.initialAddons,this.addons),I=this.addons.reduce((k,g)=>k+g.monthlyPrice,e.price);if(this.node.innerHTML=`
|
|
1345
|
+
<div class="waykeecom-nav-banner" id="${lo}"></div>
|
|
1385
1346
|
|
|
1386
1347
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1387
1348
|
<div class="waykeecom-hstack waykeecom-hstack--align-center waykeecom-hstack--spacing-3">
|
|
@@ -1401,7 +1362,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1401
1362
|
</div>
|
|
1402
1363
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1403
1364
|
<a
|
|
1404
|
-
href="${
|
|
1365
|
+
href="${c}"
|
|
1405
1366
|
rel="noopener noreferrer"
|
|
1406
1367
|
target="_blank"
|
|
1407
1368
|
class="waykeecom-link"
|
|
@@ -1410,20 +1371,20 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1410
1371
|
${p?.length?`<div class="waykeecom-stack waykeecom-stack--3">
|
|
1411
1372
|
<fieldset class="waykeecom-input-group">
|
|
1412
1373
|
<legend class="waykeecom-input-label"><div class="waykeecom-input-label__label">Tillval</div></legend>
|
|
1413
|
-
<div id="${
|
|
1374
|
+
<div id="${kr}"></div>
|
|
1414
1375
|
</fieldset>
|
|
1415
1376
|
</div>`:""}
|
|
1416
1377
|
${m?.length?`
|
|
1417
1378
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1418
1379
|
<h4 class="waykeecom-heading waykeecom-heading--4 waykeecom-no-margin">F\xF6rs\xE4kringen inneh\xE5ller</h4>
|
|
1419
1380
|
</div>
|
|
1420
|
-
<div class="waykeecom-stack waykeecom-stack--3" id="${
|
|
1381
|
+
<div class="waykeecom-stack waykeecom-stack--3" id="${Cr}"></div>
|
|
1421
1382
|
`:""}
|
|
1422
1383
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1423
|
-
<div class="waykeecom-stack waykeecom-stack--1" id="${
|
|
1424
|
-
<div class="waykeecom-stack waykeecom-stack--1" id="${
|
|
1384
|
+
<div class="waykeecom-stack waykeecom-stack--1" id="${mo}"></div>
|
|
1385
|
+
<div class="waykeecom-stack waykeecom-stack--1" id="${hr}"></div>
|
|
1425
1386
|
</div>
|
|
1426
|
-
`,new
|
|
1387
|
+
`,new ce(this.node.querySelector(`#${lo}`),{title:"Tillbaka",onClick:()=>o()}),p?.length){let k=this.node.querySelector(`#${kr}`);p.forEach(g=>{let w=new yr(k);this.contexts.checkboxes[g.name]=new Ke(w.render(),{id:dd(g.name),name:g.name,title:g.title,meta:`<div class="waykeecom-text waykeecom-text--font-bold">${u(g.monthlyPrice,{postfix:"kr/m\xE5n"})}</div>`,description:`<div class="waykeecom-text waykeecom-text--tone-alt">${g.description}</div>`,append:!0,value:g.name,checked:this.addons.findIndex(N=>N.name===g.name)>-1,onClick:N=>this.onClick(N)})})}if(m?.length){let k=this.node.querySelector(`#${Cr}`);m.forEach(g=>new Me(k,{id:g.name,title:g.name,description:g.description,append:!0}))}new ce(this.node.querySelector(`#${lo}`),{title:"Tillbaka",onClick:()=>o()}),new ee(this.node.querySelector(`#${hr}`),{title:"Tillbaka",onClick:()=>o()}),i?this.contexts.updateButton=new br(this.node.querySelector(`#${mo}`),{title:i?"Uppdatera":"V\xE4lj",disabled:i?!y:void 0,onClick:()=>this.onUpdate()}):this.contexts.updateButton=new q(this.node.querySelector(`#${mo}`),{selected:!1,fullSize:!0,disabled:i?!y:void 0,onClick:()=>this.onUpdate()}),V()}},Ar=po;var go=class extends r{constructor(e,i){super(e);this.displayInfo=!1;this.props=i,A(this.props.store,"insurance",()=>{this.render()}),this.render()}onInfoOpen(){d("MAIN","INSURANCE_INFORMATION_TOGGLE","INSURANCE_IF"),this.displayInfo=!0,this.render()}onInfoClose(){d("MAIN","INSURANCE_INFORMATION_TOGGLE","INSURANCE_IF"),this.displayInfo=!1,O(),this.render(),this.node.parentElement?.scrollIntoView()}onClick(){let{insurance:e}=this.props.store.getState();!e||e&&this.props.insurance.name!==e.name?d("MAIN","INSURANCE_SELECTED","INSURANCE_IF"):d("MAIN","INSURANCE_UNSELECTED","INSURANCE_IF"),me(this.props.insurance)(this.props.store.dispatch)}render(){let{store:e,insurance:i,key:o}=this.props,s=e.getState(),n=s.order?.insuranceOption?.logo,l=s.insuranceAddOns?.insurance===i.name?s.insuranceAddOns.addOns.map(m=>({key:m?.title,value:u(m?.monthlyPrice,{postfix:"kr/m\xE5n"})})):void 0,c=s.insurance?JSON.stringify(s.insurance).localeCompare(JSON.stringify(i))===0:!1;this.displayInfo&&new Ar(H(),{store:this.props.store,insurance:i,selected:c,onClose:()=>this.onInfoClose()}),new ue(this.node,{logo:n,selected:c,id:o,title:i.name,description:i.description,price:u(i.price,{postfix:"kr/m\xE5n"}),priceDetails:l,onClick:()=>this.onClick(),onInfo:()=>this.onInfoOpen()},o)}},vr=go;var Io=class extends r{constructor(t,e){super(t),this.props=e,this.render()}render(){let{store:t,insurances:e}=this.props,i=new Ie(this.node,{id:"insurance-list",onClick:()=>d("MAIN","INSURANCE_ARROW","INSURANCE_IF")}),{overflowElement:o}=i;o&&(o.innerHTML="",e.forEach((s,n)=>new vr(o,{store:t,insurance:s,key:`insurance-${n}`})))}},wr=Io;var uo="insurance-grid-list-node",md="button-insurances-proceed",Nr=`${uo}-node`,Br="button-insurances-skip",Gr=`${Br}-node`,Er="button-insurance-edit-driving-distance",fr=`${Er}-node`,xr={},bo=class extends r{constructor(e,i){super(e);this.requestError=!1;this.contexts={listners:[]};this.props=i;let o=A(this.props.store,"drivingDistance",()=>{this.fetchInsurance()});this.contexts.listners.push(o);let s=A(this.props.store,"customer.socialId",()=>{this.fetchInsurance()});this.contexts.listners.push(s);let n=A(this.props.store,"insurance",()=>{this.contexts.buttonProceed?.disabled(!this.props.store.getState().insurance)});this.contexts.listners.push(n),this.fetchInsurance(),this.render()}fetchInsurance(){this.props.store.getState().customer.socialId&&this.getInsurances()}async getInsurances(){let e=this.props.store.getState();this.requestError=!1,this.render();let i=`${e.customer.socialId}-${e.id}-${e.drivingDistance}`,o=xr[i];if(d("MAIN","INSURANCE_GET_INSURANCES_REQUESTED","INSURANCE_IF"),o){this.insurances=o,d("MAIN","INSURANCE_GET_INSURANCES_SUCCEEDED","INSURANCE_IF"),this.render();return}try{let s=await ur(this.props.store,e.drivingDistance);d("MAIN","INSURANCE_GET_INSURANCES_SUCCEEDED","INSURANCE_IF"),this.insurances=s.getInsuranceOptions(),xr[i]=this.insurances}catch{d("MAIN","INSURANCE_GET_INSURANCES_FAILED","INSURANCE_IF"),this.requestError=!0}finally{this.render()}}onEditDrivingDistance(){this.contexts.listners.forEach(e=>e?.()),this.props.onEdit()}onProceed(){$(this.props.lastStage)(this.props.store.dispatch)}onSkipInsurances(){d("MAIN","INSURANCE_SKIPPED","INSURANCE_IF"),me()(this.props.store.dispatch),$(this.props.lastStage)(this.props.store.dispatch)}render(){let{store:e}=this.props,i=e.getState(),{insurance:o,drivingDistance:s}=i;this.node.innerHTML=`
|
|
1427
1388
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1428
1389
|
<h4 class="waykeecom-heading waykeecom-heading--4">Vill du teckna en f\xF6rs\xE4kring p\xE5 din nya bil?</h4>
|
|
1429
1390
|
<div class="waykeecom-content">
|
|
@@ -1433,21 +1394,21 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1433
1394
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1434
1395
|
<div class="waykeecom-stack waykeecom-stack--1">
|
|
1435
1396
|
<ul class="waykeecom-key-value-list">
|
|
1436
|
-
${h({key:"Uppskattad k\xF6rstr\xE4cka",value:
|
|
1397
|
+
${h({key:"Uppskattad k\xF6rstr\xE4cka",value:P[s]})}
|
|
1437
1398
|
</ul>
|
|
1438
1399
|
</div>
|
|
1439
1400
|
<div class="waykeecom-stack waykeecom-stack--1">
|
|
1440
|
-
<div class="waykeecom-align waykeecom-align--end" id="${
|
|
1401
|
+
<div class="waykeecom-align waykeecom-align--end" id="${fr}">
|
|
1441
1402
|
<button type="button" title="\xC4ndra" class="waykeecom-link" >\xC4ndra</button>
|
|
1442
1403
|
</div>
|
|
1443
1404
|
</div>
|
|
1444
1405
|
</div>
|
|
1445
|
-
<div class="waykeecom-stack waykeecom-stack--3" id="${
|
|
1406
|
+
<div class="waykeecom-stack waykeecom-stack--3" id="${uo}"></div>
|
|
1446
1407
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1447
|
-
<div class="waykeecom-stack waykeecom-stack--1" id="${
|
|
1448
|
-
<div class="waykeecom-stack waykeecom-stack--1" id="${
|
|
1408
|
+
<div class="waykeecom-stack waykeecom-stack--1" id="${Nr}"></div>
|
|
1409
|
+
<div class="waykeecom-stack waykeecom-stack--1" id="${Gr}"></div>
|
|
1449
1410
|
</div>
|
|
1450
|
-
`;let n=this.node.querySelector(`#${
|
|
1411
|
+
`;let n=this.node.querySelector(`#${uo}`);if(n)if(this.requestError)n.innerHTML=C({tone:"error",children:'Det gick inte att h\xE4mta f\xF6rs\xE4kringar. <button type="button" titlte="F\xF6rs\xF6k igen" class="waykeecom-link waykeecom-link--align-baseline waykeecom-link--current-color">Klicka h\xE4r f\xF6r att f\xF6rs\xF6ka igen</button>.'}),n.querySelector("button")?.addEventListener("click",()=>this.getInsurances());else{let l=this.insurances;l?.length?new wr(n,{store:e,insurances:l}):n.innerHTML=R()}new Z(this.node.querySelector(`#${fr}`),{id:Er,title:"\xC4ndra",onClick:()=>this.onEditDrivingDistance()}),this.contexts.buttonProceed=new v(this.node.querySelector(`#${Nr}`),{id:md,disabled:!o,title:"G\xE5 vidare",onClick:()=>this.onProceed()}),new Y(this.node.querySelector(`#${Gr}`),{id:Br,title:"Hoppa \xF6ver detta steg",onClick:()=>this.onSkipInsurances()})}},Rr=bo;var _r="select-insurance-distance",Sr=`${_r}-node`,Or="insurance-info-node",ho="button-insurances-show",Fr=`${ho}-node`,Lr=`${ho}-disclaimer-node`,Tr="button-insurances-skip",Xr=`${Tr}-node`,yo=class extends r{constructor(e,i){super(e);this.showInsurances=!1;this.props=i,this.showInsurances=!!this.props.store.getState().insurance,this.render()}onChangeDistance(e){this.showInsurances=!1;let o=e.currentTarget.value;switch(na(o)(this.props.store.dispatch),o){case W.Between0And1000:d("MAIN","INSURANCE_MILEAGE_BETWEEN_0_AND_1000_SELECTED","INSURANCE_IF");break;case W.Between1000And1500:d("MAIN","INSURANCE_MILEAGE_BETWEEN_1000_AND_1500_SELECTED","INSURANCE_IF");break;case W.Between1500And2000:d("MAIN","INSURANCE_MILEAGE_BETWEEN_1500_AND_2000_SELECTED","INSURANCE_IF");break;case W.Between2000And2500:d("MAIN","INSURANCE_MILEAGE_BETWEEN_2000_AND_2500_SELECTED","INSURANCE_IF");break;case W.Over2500:d("MAIN","INSURANCE_MILEAGE_OVER_2500_SELECTED","INSURANCE_IF");break;default:break}}onShowInsurances(){this.showInsurances=!0,d("MAIN","INSURANCE_SHOW","INSURANCE_IF"),this.render()}onEdit(){this.showInsurances=!1,d("MAIN","INSURANCE_EDIT_MILEAGE","INSURANCE_IF"),this.render()}render(){let{store:e,lastStage:i,onSkip:o}=this.props,s=e.getState(),n=s.order?.insuranceOption?.title||"[Ok\xE4nt f\xF6rs\xE4kringsbolag]";if(this.showInsurances)new Rr(this.node,{store:e,lastStage:i,onEdit:()=>this.onEdit()});else{this.node.innerHTML=`
|
|
1451
1412
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1452
1413
|
<h4 class="waykeecom-heading waykeecom-heading--4">Vill du teckna en f\xF6rs\xE4kring p\xE5 din nya bil?</h4>
|
|
1453
1414
|
<div class="waykeecom-content">
|
|
@@ -1455,15 +1416,15 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1455
1416
|
</div>
|
|
1456
1417
|
</div>
|
|
1457
1418
|
|
|
1458
|
-
<div class="waykeecom-stack waykeecom-stack--3" id="${
|
|
1459
|
-
<div class="waykeecom-stack waykeecom-stack--3" id="${
|
|
1419
|
+
<div class="waykeecom-stack waykeecom-stack--3" id="${Or}"></div>
|
|
1420
|
+
<div class="waykeecom-stack waykeecom-stack--3" id="${Sr}"></div>
|
|
1460
1421
|
|
|
1461
1422
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1462
|
-
<div class="waykeecom-stack waykeecom-stack--1" id="${
|
|
1463
|
-
<div class="waykeecom-stack waykeecom-stack--1" id="${
|
|
1464
|
-
<div class="waykeecom-stack waykeecom-stack--1" id="${
|
|
1423
|
+
<div class="waykeecom-stack waykeecom-stack--1" id="${Fr}"></div>
|
|
1424
|
+
<div class="waykeecom-stack waykeecom-stack--1" id="${Xr}"></div>
|
|
1425
|
+
<div class="waykeecom-stack waykeecom-stack--1" id="${Lr}"></div>
|
|
1465
1426
|
</div>
|
|
1466
|
-
`,new
|
|
1427
|
+
`,new Je(this.node.querySelector(`#${Sr}`),{id:_r,title:"Visa f\xF6rs\xE4kringar",name:"distance",value:s.drivingDistance,options:[{value:W.Between0And1000,title:P[W.Between0And1000]},{value:W.Between1000And1500,title:P[W.Between1000And1500]},{value:W.Between1500And2000,title:P[W.Between1500And2000]},{value:W.Between2000And2500,title:P[W.Between2000And2500]},{value:W.Over2500,title:P[W.Over2500]}],onChange:c=>this.onChangeDistance(c)}),new v(this.node.querySelector(`#${Fr}`),{id:ho,title:"Visa f\xF6rs\xE4kringar",onClick:()=>this.onShowInsurances()});let l=this.node.querySelector(`#${Or}`);l&&(l.innerHTML=C({tone:"info",polite:!0,children:`Vi \xE4r anknutna f\xF6rs\xE4kringsf\xF6rmedlare till ${n}, If Skadef\xF6rs\xE4kring. F\xF6rs\xE4kringsgivare \xE4r If Skadef\xF6rs\xE4kring (publ). Vad detta inneb\xE4r kan du l\xE4sa mer om p\xE5 f\xF6rs\xE4kringsf\xF6rmedlarens hemsida.`})),new Ae(this.node.querySelector(`#${Lr}`),{text:`Genom att du klickar p\xE5 Visa f\xF6rs\xE4kringar s\xE5 godk\xE4nner du att vi skickar dina uppgifter vidare till ${n} f\xF6r att de ska kunna ge dig ett pris p\xE5 f\xF6rs\xE4kring. Hur de hanterar dina personuppgifter kan du l\xE4sa om p\xE5 deras hemsida.`}),new Y(this.node.querySelector(`#${Xr}`),{id:Tr,title:"Hoppa \xF6ver detta steg",onClick:()=>o()})}}},Wr=yo;var ko=class extends r{constructor(t,e){super(t),this.props=e,A(this.props.store,"navigation",()=>{this.render()}),this.render()}getStep(){let{order:t}=this.props.store.getState();return t?.insuranceOption?.institute==="IF"?"INSURANCE_IF":"INSURANCE"}onSkipInsurances(){me()(this.props.store.dispatch),$(this.props.lastStage)(this.props.store.dispatch),d("MAIN","INSURANCE_SKIPPED",this.getStep())}onEdit(){d("MAIN","INSURANCE_EDIT",this.getStep()),S("main",this.props.index)(this.props.store.dispatch)}render(){let{store:t,index:e,lastStage:i}=this.props,o=t.getState(),s=o.topNavigation.stage>e,n=o.navigation.stage===e;n&&d("MAIN","INSURANCE_ACTIVE",this.getStep());let l=X(this.node,{completed:s,title:"F\xF6rs\xE4kring",active:n,id:"insurance",index:e});if(o.navigation.stage>e||s&&o.navigation.stage!==e){let c=[];o.insurance?(c.push({key:"Uppskattad k\xF6rstr\xE4cka",value:P[o.drivingDistance]}),c.push({key:o.insurance.name,value:u(o.insurance.price,{postfix:"kr/m\xE5n"})}),o.insuranceAddOns?.insurance===o.insurance.name&&o.insuranceAddOns.addOns.forEach(m=>c.push({key:m.title,value:u(m.monthlyPrice,{postfix:"kr/m\xE5n"})}))):o.freeInsurance?c.push({key:"F\xF6rs\xE4kring",value:o.freeInsurance.title}):c.push({key:"F\xF6rs\xE4kring",value:"Ingen"}),new j(l,{keyValueList:c,changeButtonTitle:"\xC4ndra f\xF6rs\xE4kring",onEdit:o.createdOrderId?void 0:()=>this.onEdit()})}else if(o.navigation.stage===e){let c=o.order?.insuranceOption;if(!c)throw"Missing insurance";switch(c?.institute){case"IF":new Wr(l,{store:t,lastStage:i,onSkip:()=>this.onSkipInsurances()});break;default:new gr(l,{store:t,lastStage:i,insurance:c});break}}o.navigation.stage===e&&l.parentElement?.scrollIntoView()}},Zr=ko;var Co=class extends r{constructor(e,i){super(e);this.contexts={};this.props=i,this.render()}setError(e){this.contexts.error?.setError(e)}render(){let{title:e,value:i,name:o,id:s,error:n,errorMessage:l,placeholder:c,information:m,autocomplete:p,onChange:y,onBlur:I}=this.props;this.node.innerHTML=`
|
|
1467
1428
|
<div class="waykeecom-input-label">
|
|
1468
1429
|
<label for="${s}" class="waykeecom-input-label__label">${e}</label>
|
|
1469
1430
|
</div>
|
|
@@ -1471,10 +1432,10 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1471
1432
|
id="${s}"
|
|
1472
1433
|
name="${o}"
|
|
1473
1434
|
${p?`autocomplete="${p}"`:""}
|
|
1474
|
-
${
|
|
1435
|
+
${c?`placeholder="${c}"`:""}
|
|
1475
1436
|
class="waykeecom-textarea"
|
|
1476
1437
|
>${i}</textarea>
|
|
1477
|
-
`,l&&(this.contexts.error=new
|
|
1438
|
+
`,l&&(this.contexts.error=new te(this.node,{error:n,errorMessage:l})),m&&new ie(this.node.querySelector(".waykeecom-input-label"),{information:m});let k=this.node.querySelector("textarea");k&&(y&&k.addEventListener("input",y),I&&k.addEventListener("blur",I))}},Vr=Co;import{vehicles as Ur}from"@wayke-se/ecom";var Dr=a=>{let t=Ur.newLookupRequest().withRegistrationNumber(a.registrationNumber).withMileage(parseInt(a.mileage,10)).withCondition(a.condition);return Ur.lookupVehicle(t.build())};var Pr="trade-in-registrationNumber",Qr=`${Pr}-node`,$r="trade-in-mileage",Yr=`${$r}-node`,Kr="trade-in-description",Hr=`${Kr}-node`,pd="trade-in-condition",Mr=`${pd}-node`,qr="trade-in-fetch",zr=`${qr}-node`,gd="trade-in-proceed",Jr=`${gd}-node`,Ao="button-trade-in-no",qe=`${Ao}-node`,ec="button-trade-in-change",jr=`${ec}-node`,de={registrationNumber:B.requiredRegistrationNumber,mileage:B.requiredMileage,description:B.optionalString,condition:B.requiredCondition},Id=[{id:"radio-VeryGood",value:"VeryGood",title:"Mycket bra skick",description:`
|
|
1478
1439
|
<div class="waykeecom-box">
|
|
1479
1440
|
<div class="waykeecom-content waykeecom-content--inherit-size">
|
|
1480
1441
|
<ul class="waykeecom-content__ul">
|
|
@@ -1501,7 +1462,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1501
1462
|
<li class="waykeecom-content__li">D\xE4ck som beh\xF6ver bytas (m\xF6nsterdjup under 3 mm)</li>
|
|
1502
1463
|
</ul>
|
|
1503
1464
|
</div>
|
|
1504
|
-
</div>`}],
|
|
1465
|
+
</div>`}],ud=a=>{let t={registrationNumber:a?.registrationNumber||"",mileage:a?.mileage||"",description:a?.description||"",condition:a?.condition};return{value:t,validation:{registrationNumber:de.registrationNumber(t.registrationNumber),mileage:de.mileage(t.mileage),description:de.description(t.description),condition:de.condition(t.condition)},interact:{registrationNumber:!1,mileage:!1,description:!1,condition:!1}}},vo=class extends r{constructor(e,i){super(e);this.contexts={};this.requestError=!1;this.props=i;let o=this.props.store.getState();this.state=ud(o.tradeIn),this.render()}async onFetchVehicle(){this.requestError=!1,this.render();try{if(d("MAIN","TRADE_IN_VALUATION_REQUESTED","TRADE_IN_DETAILS"),this.contexts.buttonFetch?.loading(!0),this.state.validation.registrationNumber&&this.state.validation.mileage&&this.state.validation.description&&this.state.validation.condition){let e=this.state.value,i=await Dr(e),o=jo(i);this.response=o,this.render(),d("MAIN","TRADE_IN_VALUATION_SUCCEEDED","TRADE_IN_DETAILS")}}catch{this.requestError=!0,this.render(),d("MAIN","TRADE_IN_VALUATION_FAILED","TRADE_IN_DETAILS")}finally{this.contexts.buttonFetch?.loading(!1)}}onEdit(){this.response=void 0,this.render(),d("MAIN","TRADE_IN_SKIPPED","TRADE_IN_DETAILS")}onProceed(){if(this.response){let e=this.response.vehicle,i=this.state.value;Ne(this.props.lastStage,i,e)(this.props.store.dispatch),d("MAIN","TRADE_IN_SET","TRADE_IN_DETAILS")}}onChangeRadio(e){let i=e.currentTarget,o=i.name,s=i.value;switch(this.state.value[o]=s,this.state.validation[o]=de[o](s),this.updateProceedButton(),s){case"VeryGood":d("MAIN","TRADE_IN_CONDITION_VERY_GOOD_SELECTED","TRADE_IN_DETAILS");break;case"Good":d("MAIN","TRADE_IN_CONDITION_GOOD_SELECTED","TRADE_IN_DETAILS");break;case"Ok":d("MAIN","TRADE_IN_CONDITION_OK_SELECTED","TRADE_IN_DETAILS");break;default:break}}onChange(e){let i=e.currentTarget,o=i.name;o==="registrationNumber"&&(i.value=i.value.toUpperCase());let s=i.value;this.state.value[o]=s,this.state.validation[o]=de[o](s),this.updateUiError(o),this.updateProceedButton()}onBlur(e){let o=e.currentTarget.name;this.state.interact[o]=!0,this.state.validation[o]=de[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.buttonFetch?.disabled(!(this.state.validation.registrationNumber&&this.state.validation.mileage&&this.state.validation.description&&this.state.validation.condition))}onNoTradeIn(){Ne(this.props.lastStage)(this.props.store.dispatch),d("MAIN","TRADE_IN_SELECTED","TRADE_IN_DETAILS")}render(){if(this.response){let e=[],i=this.response.vehicle;e.push({key:"Miltal",value:`${this.state.value.mileage} mil`}),this.state.value.description&&e.push({key:"Beskrivning",value:`${this.state.value.description}`}),this.state.value.condition&&e.push({key:"Bilens skick",value:he[this.state.value.condition]}),this.node.innerHTML=`
|
|
1505
1466
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1506
1467
|
<div class="waykeecom-balloon">
|
|
1507
1468
|
<div class="waykeecom-stack waykeecom-stack--05">
|
|
@@ -1520,7 +1481,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1520
1481
|
</ul>
|
|
1521
1482
|
</div>
|
|
1522
1483
|
<div class="waykeecom-stack waykeecom-stack--1">
|
|
1523
|
-
<div class="waykeecom-align waykeecom-align--end" id="${
|
|
1484
|
+
<div class="waykeecom-align waykeecom-align--end" id="${jr}"></div>
|
|
1524
1485
|
</div>
|
|
1525
1486
|
</div>
|
|
1526
1487
|
<div class="waykeecom-stack waykeecom-stack--3 waykeecom-text waykeecom-text--align-center">
|
|
@@ -1537,10 +1498,10 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1537
1498
|
${C({tone:"info",children:'<span class="waykeecom-text waykeecom-text--font-medium">Vi skickar med uppgifter om din inbytesbil till bilhandlaren.</span> Observera att v\xE4rderingen som utf\xF6rs ger ett uppskattat inbytesv\xE4rde. Det slutgiltliga v\xE4rdet avg\xF6rs n\xE4r handlare kan bekr\xE4fta bilens skick.'})}
|
|
1538
1499
|
</div>
|
|
1539
1500
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1540
|
-
<div class="waykeecom-stack waykeecom-stack--1" id="${
|
|
1501
|
+
<div class="waykeecom-stack waykeecom-stack--1" id="${Jr}"></div>
|
|
1541
1502
|
<div class="waykeecom-stack waykeecom-stack--1" id="${qe}"></div>
|
|
1542
1503
|
</div>
|
|
1543
|
-
`,new
|
|
1504
|
+
`,new Z(this.node.querySelector(`#${jr}`),{id:ec,title:"\xC4ndra",onClick:()=>this.onEdit()}),new v(this.node.querySelector(`#${Jr}`),{title:"Anv\xE4nd och g\xE5 vidare",onClick:()=>this.onProceed()}),new Y(this.node.querySelector(`#${qe}`),{id:Ao,title:"Hoppa \xF6ver detta steg",onClick:()=>this.onNoTradeIn()}),this.node.parentElement?.parentElement?.scrollIntoView()}else this.node.innerHTML=`
|
|
1544
1505
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1545
1506
|
<h4 class="waykeecom-heading waykeecom-heading--4">Uppgifter om din inbytesbil</h4>
|
|
1546
1507
|
<div class="waykeecom-content">
|
|
@@ -1548,23 +1509,23 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1548
1509
|
</div>
|
|
1549
1510
|
</div>
|
|
1550
1511
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1551
|
-
<div class="waykeecom-stack waykeecom-stack--2" id="${
|
|
1552
|
-
<div class="waykeecom-stack waykeecom-stack--2" id="${
|
|
1553
|
-
<div class="waykeecom-stack waykeecom-stack--2" id="${
|
|
1554
|
-
<div class="waykeecom-stack waykeecom-stack--2" id="${
|
|
1512
|
+
<div class="waykeecom-stack waykeecom-stack--2" id="${Qr}"></div>
|
|
1513
|
+
<div class="waykeecom-stack waykeecom-stack--2" id="${Yr}"></div>
|
|
1514
|
+
<div class="waykeecom-stack waykeecom-stack--2" id="${Hr}"></div>
|
|
1515
|
+
<div class="waykeecom-stack waykeecom-stack--2" id="${Mr}"></div>
|
|
1555
1516
|
</div>
|
|
1556
1517
|
${this.requestError?`<div class="waykeecom-stack waykeecom-stack--3">${C({tone:"error",children:"Tyv\xE4rr fick vi ingen tr\xE4ff p\xE5 registreringsnummret du angav. V\xE4nligen kontrollera att registreringsnummret st\xE4mmer."})}</div>`:""}
|
|
1557
1518
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1558
|
-
<div class="waykeecom-stack waykeecom-stack--1" id="${
|
|
1519
|
+
<div class="waykeecom-stack waykeecom-stack--1" id="${zr}"></div>
|
|
1559
1520
|
<div class="waykeecom-stack waykeecom-stack--1" id="${qe}"></div>
|
|
1560
1521
|
</div>
|
|
1561
|
-
`,this.contexts.registrationNumber=new F(this.node.querySelector(`#${
|
|
1522
|
+
`,this.contexts.registrationNumber=new F(this.node.querySelector(`#${Qr}`),{title:"Registreringsnummer",value:this.state.value.registrationNumber,id:Pr,error:this.state.interact.registrationNumber&&!this.state.validation.registrationNumber,errorMessage:"Ett giltig registreringsnummer i formatet ABC123 eller ABC12A m\xE5ste anges",name:"registrationNumber",autocomplete:"off",placeholder:"Ange registreringsnummer",unit:`
|
|
1562
1523
|
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 34" class="waykeecom-input-text__unit-regnr-icon" aria-hidden="true">
|
|
1563
1524
|
<rect width="22" height="34" rx="1" fill="#458BDD"/>
|
|
1564
1525
|
<circle cx="11" cy="10" r="5.5" stroke="#FFF500" stroke-linejoin="round" stroke-dasharray="1 2"/>
|
|
1565
1526
|
<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"/>
|
|
1566
1527
|
</svg>
|
|
1567
|
-
`,onChange:e=>this.onChange(e),onBlur:e=>this.onBlur(e)}),this.contexts.mileage=new F(this.node.querySelector(`#${
|
|
1528
|
+
`,onChange:e=>this.onChange(e),onBlur:e=>this.onBlur(e)}),this.contexts.mileage=new F(this.node.querySelector(`#${Yr}`),{title:"Miltal",value:this.state.value.mileage,id:$r,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 Vr(this.node.querySelector(`#${Hr}`),{title:"Beskrivning (valfritt)",value:this.state.value.description,id:Kr,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 M(this.node.querySelector(`#${Mr}`),{title:"Bilens skick",checked:this.state.value.condition,name:"condition",options:Id,onClick:e=>this.onChangeRadio(e)}),this.contexts.buttonFetch=new v(this.node.querySelector(`#${zr}`),{title:"H\xE4mta uppskattat v\xE4rde",id:qr,disabled:!(this.state.validation.registrationNumber&&this.state.validation.mileage&&this.state.validation.condition),onClick:()=>this.onFetchVehicle()}),new Y(this.node.querySelector(`#${qe}`),{id:Ao,title:"Hoppa \xF6ver detta steg",onClick:()=>this.onNoTradeIn()})}},tc=vo;var ac="button-trade-in-yes",ic=`${ac}-node`,sc="button-trade-in-no",oc=`${sc}-node`,No="button-trade-in-change",wo=`${No}-node`,Go=class extends r{constructor(t,e){super(t),this.props=e,A(this.props.store,"navigation",()=>{this.render()}),this.render()}onEdit(){d("MAIN","TRADE_IN_EDIT","TRADE_IN"),S("main",this.props.index)(this.props.store.dispatch)}onYesTradeIn(){d("MAIN","TRADE_IN_SELECTED","TRADE_IN"),ia(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:t,index:e,lastStage:i}=this.props,o=this.props.store.getState();if(!o.order?.allowsTradeIn)return;let s=o.topNavigation.stage>e,n=o.navigation.stage===e;n&&d("MAIN","TRADE_IN_ACTIVE",o.navigation.subStage===1?"TRADE_IN":"TRADE_IN_DETAILS");let l=X(this.node,{title:"Inbytesbil",active:n,completed:s,id:"trade-in",index:e});l.innerHTML="";let c=document.createElement("div");if(o.navigation.stage>e||s&&o.navigation.stage!==e){let m=[];o.tradeIn&&o.tradeInVehicle?(m.push({key:"Miltal",value:`${o.tradeIn.mileage} mil`}),o.tradeIn.description&&m.push({key:"Beskrivning",value:`${o.tradeIn.description}`}),o.tradeIn.condition&&m.push({key:"Bilens skick",value:he[o.tradeIn.condition]}),c.innerHTML=`
|
|
1568
1529
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1569
1530
|
<div class="waykeecom-balloon">
|
|
1570
1531
|
<div class="waykeecom-stack waykeecom-stack--05">
|
|
@@ -1584,7 +1545,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1584
1545
|
</div>
|
|
1585
1546
|
${o.createdOrderId?"":`
|
|
1586
1547
|
<div class="waykeecom-stack waykeecom-stack--1">
|
|
1587
|
-
<div class="waykeecom-align waykeecom-align--end" id="${
|
|
1548
|
+
<div class="waykeecom-align waykeecom-align--end" id="${wo}"></div>
|
|
1588
1549
|
</div>
|
|
1589
1550
|
`}
|
|
1590
1551
|
</div>
|
|
@@ -1600,7 +1561,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1600
1561
|
</div>
|
|
1601
1562
|
</div>
|
|
1602
1563
|
</div>
|
|
1603
|
-
`,
|
|
1564
|
+
`,c.querySelector(`#${No}`)?.addEventListener("click",()=>this.onEdit())):(m.push({key:"Inbytesbil",value:"Nej"}),c.innerHTML=`
|
|
1604
1565
|
<div class="waykeecom-stack waykeecom-stack--1">
|
|
1605
1566
|
<ul class="waykeecom-key-value-list">
|
|
1606
1567
|
${m.map(p=>h(p)).join("")}
|
|
@@ -1608,10 +1569,10 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1608
1569
|
</div>
|
|
1609
1570
|
${o.createdOrderId?"":`
|
|
1610
1571
|
<div class="waykeecom-stack waykeecom-stack--1">
|
|
1611
|
-
<div class="waykeecom-align waykeecom-align--end" id="${
|
|
1572
|
+
<div class="waykeecom-align waykeecom-align--end" id="${wo}"></div>
|
|
1612
1573
|
</div>
|
|
1613
1574
|
`}
|
|
1614
|
-
`),o.createdOrderId||new
|
|
1575
|
+
`),o.createdOrderId||new Z(c.querySelector(`#${wo}`),{id:No,title:"\xC4ndra",onClick:()=>this.onEdit()})}else o.navigation.stage===e&&(o.wantTradeIn&&o.tradeIn?new tc(c,{store:t,lastStage:i}):(c.innerHTML=`
|
|
1615
1576
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1616
1577
|
<h4 class="waykeecom-heading waykeecom-heading--4">Har du en inbytesbil?</h4>
|
|
1617
1578
|
<div class="waykeecom-content">
|
|
@@ -1620,10 +1581,10 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1620
1581
|
</div>
|
|
1621
1582
|
|
|
1622
1583
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1623
|
-
<div class="waykeecom-stack waykeecom-stack--1" id="${
|
|
1624
|
-
<div class="waykeecom-stack waykeecom-stack--1" id="${
|
|
1584
|
+
<div class="waykeecom-stack waykeecom-stack--1" id="${ic}"></div>
|
|
1585
|
+
<div class="waykeecom-stack waykeecom-stack--1" id="${oc}"></div>
|
|
1625
1586
|
</div>
|
|
1626
|
-
`,new v(
|
|
1587
|
+
`,new v(c.querySelector(`#${ic}`),{id:ac,title:"Jag har inbytesbil",onClick:()=>this.onYesTradeIn()}),new Y(c.querySelector(`#${oc}`),{id:sc,title:"Hoppa \xF6ver detta steg",onClick:()=>this.onNoTradeIn()})));l.appendChild(c),o.navigation.stage===e&&l.parentElement?.scrollIntoView()}},nc=Go;var et={customer:{component:vs,name:"customer"},centralStorage:{component:ss,name:"centralStorage"},delivery:{component:Ss,name:"delivery"},tradeIn:{component:nc,name:"tradeIn"},financial:{component:sr,name:"financial"},insurance:{component:Zr,name:"insurance"},accessories:{component:Ka,name:"accessories"}};var rc=a=>{let t=document.createElement("script");t.setAttribute("src",a),t.onload=()=>{window.payex?.hostedView.paymentMenu({container:"payment-menu",culture:"sv-SE"}).open()},document.getElementsByTagName("head")[0].appendChild(t)};var fo=class extends r{constructor(t,e){super(t),this.props=e,this.render(),this.init()}init(){let{payment:t}=this.props.store.getState(),e=t;switch(sessionStorage.setItem("wayke-ecom-state",JSON.stringify(this.props.store.getState())),e.type){case"swedbank":rc(e.url);break;default:break}}render(){let{order:t}=this.props.store.getState(),e=t?.contactInformation?.name;this.node.innerHTML=`
|
|
1627
1588
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1628
1589
|
<h4 class="waykeecom-heading waykeecom-heading--4">V\xE4lj betals\xE4tt</h4>
|
|
1629
1590
|
<div class="waykeecom-content">
|
|
@@ -1640,7 +1601,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1640
1601
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1641
1602
|
<div id="payment-menu" style="padding: 24px;border: 1px solid #ececeb;"></div>
|
|
1642
1603
|
</div>
|
|
1643
|
-
`}},
|
|
1604
|
+
`}},cc=fo;import{AuthMethod as z}from"@wayke-se/ecom";import{DeliveryType as lc,PaymentType as xo,customers as bd,orders as Se,vehicles as yd}from"@wayke-se/ecom";var dc=a=>{let t=a.getState();if(!t.address)throw"Missing address";if(!t.paymentType)throw"Missing paymentType";if(!t.vehicle)throw"Missing vehicle";let e=bd.newCustomer().withAddress(t.address).withPersonalNumber(t.customer.socialId).withEmail(t.customer.email).withPhoneNumber(t.customer.phone).build(),i=K(t.paymentType),o=Se.newPayment().withType(i);if(i===xo.Loan){let p=je(t.paymentType),y=t.order?.paymentOptions.filter(_=>_.type===xo.Loan)?.[p],I=t.paymentLookupResponse||y?.loanDetails,k=I?.durationSpec.current,g=I?.downPaymentSpec.current,w=I?.residualValueSpec?.current,N=t.order?.paymentOptions.find(_=>_.type===xo.Loan)?.externalId;if(o.withDuration(k).withDownPayment(Math.round(g)),w&&o.withResidualValue(w),N&&o.withExternalId(N),t.creditAssessmentResponse){let _=t.creditAssessmentResponse.scoringId,J=t.creditAssessmentResponse.recommendation,G=t.creditAssessmentResponse.decision,U=I?.financialProductCode;if(!_||!J||!G||!U)throw"Missing credit assessment data";let ot=Se.newCreditAssessment().withScoreId(_).withFinancialProductCode(U).withRecommendation(J).withDecision(G).build();o.withCreditAssessment(ot)}}let s=o.build(),n=new URLSearchParams(window.location.search);n.set("wayke-ecom-web-id",t.id);let l=`${window.location.origin}${window.location.pathname}?${n.toString()}${window.location.hash}`;n.set("wayke-ecom-web-payment","true");let c=`${window.location.origin}${window.location.pathname}?${n.toString()}${window.location.hash}`,m=Se.newCreateRequest().forVehicle(t.id).withCustomer(e).withPayment(s).withUrls(l,c).withDeliveryType(t.homeDelivery?lc.Delivery:lc.Pickup);if(t.insurance){let p=Se.newInsurance().withDrivingDistance(t.drivingDistance);t.insuranceAddOns?.addOns.length&&t.insuranceAddOns.insurance===t.insurance.name&&p.withAddOns(t.insuranceAddOns.addOns.map(I=>I.name));let y=p.build();m.withInsurance(y)}else t.freeInsurance&&m.withInsurance({});if(t.accessories.length&&m.withAccessories(t.accessories),t.tradeIn&&t.tradeInVehicle&&t.tradeIn.condition){let p=yd.newVehicleTrade().forVehicle(t.tradeIn.registrationNumber).withMileage(parseInt(t.tradeIn.mileage,10)).withCondition(t.tradeIn.condition).withComment(t.tradeIn.description).build();m.withTradeIn(p)}return Se.create(m.build())};import{creditAssessment as hd}from"@wayke-se/ecom";var mc=a=>hd.accept(a);import{bankid as pc}from"@wayke-se/ecom";var gc=a=>{let t=pc.newAuthRequest().withMethod(a).build();return pc.auth(t)};import{bankid as Ic}from"@wayke-se/ecom";var uc=a=>{let t=Ic.newQrCodeRequest().withOrderRef(a).build();return Ic.qrcode(t)};import{bankid as bc}from"@wayke-se/ecom";var Bo=a=>{let t=bc.newCollectRequest().withOrderRef(a).build();return bc.collect(t)};var Ac="confirm-conditions",yc=`${Ac}-node`,hc="bankid-start-node",kd="bankid-start",kc="address-disclaimer-policy-node",Cc="address-disclaimer-reservation-node",Eo=class extends r{constructor(e,i){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 i=await Bo(e);this.handleBankidStatusResponse(i,z.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 uc(e)).getQrCode();this.contexts.bankId?.update(z.QrCode,o)}catch{this.clearIntervals(),this.contexts.bankId?.setErrorMessage("Det gick inte att h\xE4mta ny QR-kod f\xF6r BankId signering.")}};this.props=i,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===z.SameDevice)try{let e=await Bo(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,i){this.bankidRequestRef={reference:e,method:i}}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 mc(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:i}=e.getState(),o=await dc(e);d("MAIN","CONFIRMATION_CREATE_ORDER_SUCCEEDED","CONFIRMATION"),i?.isPaymentRequired&&O();let n=o.getPayment();ma(o.getOrderNumber(),n)(e.dispatch),this.acceptCreditAssessment()}catch(i){let o=i;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,i){if(e.isCompleted()){this.removeWindowEvents(),this.clearBankidRequestRef(),this.clearIntervals();let o=e.getAddress(),s=e.getPersonalNumber();if(o&&s){let n=this.props.store.getState();if(!B.requiredSsnOver18(s)){d("MAIN",i===z.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}if(n.customer.socialId!==s){d("MAIN",i===z.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}d("MAIN",i===z.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,i,o=!1){o||d("MAIN","CONFIRMATION_BANKID_STATUS_SAME_DEVICE_REQUESTED","CONFIRMATION");try{this.setBankidRequestRef(i,z.SameDevice);let s=e.getAutoLaunchUrl();this.contexts.bankId?.update(z.SameDevice,s)}catch(s){this.removeWindowEvents(),this.clearBankidRequestRef();let n=s;this.contexts.bankId?.setErrorMessage(`Error: ${n.message}`)}}async startBankidWithQr(e,i=!1){i||d("MAIN","CONFIRMATION_BANKID_STATUS_QR_REQUESTED","CONFIRMATION"),this.bankidStatusInterval=setInterval(()=>{this.bankidStatus(e)},2e3),xe("bankidStatusInterval",this.bankidStatusInterval),this.qrCode(e),this.bankidQrCodeInterval=setInterval(async()=>{this.qrCode(e)},1e3),xe("bankidQrCodeInterval",this.bankidQrCodeInterval)}async onStartBankIdAuth(e,i=!1){this.clearIntervals();try{i||d("MAIN","CONFIRMATION_BANKID_INIT_REQUESTED","CONFIRMATION"),this.contexts.bankId?.update(e),this.contexts.buttonLinkToggle?.disabled(!0);let o=await gc(e);i||d("MAIN","CONFIRMATION_BANKID_INIT_SUCCEEDED","CONFIRMATION");let s=o.getOrderRef();e===z.QrCode?this.startBankidWithQr(s,i):this.startBankidSameDevice(o,s,i)}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 i=e.currentTarget;this.confirmConditions=i.checked,this.contexts.confirmConditions?.checked(this.confirmConditions),this.contexts.startBankid?.disabled(!this.confirmConditions)}render(){let e=ke(),{navigation:i,order:o,insurance:s}=this.props.store.getState();if(this.view===2)this.contexts.bankId=new ze(H(),{method:e?z.SameDevice:z.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=`
|
|
1644
1605
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1645
1606
|
<h4 class="waykeecom-heading waykeecom-heading--4">Strax klart!</h4>
|
|
1646
1607
|
<div class="waykeecom-content">
|
|
@@ -1664,53 +1625,52 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1664
1625
|
<div class="waykeecom-stack waykeecom-stack--3">${C({tone:"error",children:"Personnummret i f\xF6rsta steget matchar inte med det som \xE4r kopplat mot bankid"})}</div>
|
|
1665
1626
|
`:""}
|
|
1666
1627
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1667
|
-
<div class="waykeecom-stack waykeecom-stack--2" id="${
|
|
1668
|
-
<div class="waykeecom-stack waykeecom-stack--2" id="${
|
|
1628
|
+
<div class="waykeecom-stack waykeecom-stack--2" id="${yc}"></div>
|
|
1629
|
+
<div class="waykeecom-stack waykeecom-stack--2" id="${hc}"></div>
|
|
1669
1630
|
<div class="waykeecom-stack waykeecom-stack--2">
|
|
1670
|
-
<div class="waykeecom-stack waykeecom-stack--1" id="${
|
|
1671
|
-
<div class="waykeecom-stack waykeecom-stack--1" id="${
|
|
1631
|
+
<div class="waykeecom-stack waykeecom-stack--1" id="${kc}"></div>
|
|
1632
|
+
<div class="waykeecom-stack waykeecom-stack--1" id="${Cc}"></div>
|
|
1672
1633
|
</div>
|
|
1673
1634
|
</div>
|
|
1674
|
-
`,this.contexts.confirmConditions=new Ke(this.node.querySelector(`#${
|
|
1635
|
+
`,this.contexts.confirmConditions=new Ke(this.node.querySelector(`#${yc}`),{checked:this.confirmConditions,id:Ac,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>${s?' <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 Ce(this.node.querySelector(`#${hc}`),{title:"Reservera bilen",id:kd,disabled:!this.confirmConditions||this.notAvailable,onClick:()=>{this.view=2,this.render()}}),new be(this.node.querySelector(`#${kc}`),{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 Ae(this.node.querySelector(`#${Cc}`),{text:"Vi reserverar oss f\xF6r eventuell \xE4ndring i tillg\xE5ngen av utbjudna bilar."}),i.stage===this.props.index&&this.node.parentElement?.scrollIntoView()}}},vc=Eo;var Ro=class extends r{constructor(e,i){super(e);this.view=1;this.props=i,A(this.props.store,"navigation",()=>{this.render()}),this.render()}render(){let{store:e,index:i}=this.props,{topNavigation:o,navigation:s,order:n}=e.getState(),l=o.stage>i,c=X(this.node,{completed:l,title:n?.isPaymentRequired?"Betalning":"Slutf\xF6r ordern",id:"confirmation",active:s.stage===i,index:i});s.stage===i&&(s.subStage===2?new cc(c,{store:e}):new vc(c,{lastStage:!0,index:i,store:this.props.store}),c.parentElement?.scrollIntoView())}},wc=Ro;var So=class extends r{constructor(t,e){super(t),this.props=e,A(this.props.store,"navigation.view",i=>{i===2&&this.render()}),this.render(),this.node.scrollTop=0}render(){let{store:t,cdnMedia:e}=this.props,i=t.getState(),{order:o,stages:s}=i;if(!o)throw"No order available";this.node.innerHTML="";let n=document.createElement("div");this.node.appendChild(n);let l=document.createElement("aside");l.className="waykeecom-cart",l.setAttribute("aria-label","Fordonsinformation"),l.innerHTML=Ta({vehicle:i.vehicle,order:i.order,cdnMedia:e}),n.appendChild(l);let c=document.createElement("ol");c.className="waykeecom-stepper",n.appendChild(c);let m=s?.length;s?.forEach((p,y)=>new et[p.name].component(c,{store:t,index:y+1,lastStage:!1})),new wc(c,{store:t,index:(m||0)+1,lastStage:!0})}},Nc=So;var Oo=class extends r{constructor(e,i){super(e);this.orderFetchFailed=!1;this.props=i,sessionStorage.removeItem("wayke-ecom-state"),this.render()}async loadOrder(){this.orderFetchFailed=!1,this.render();try{let e=await fetch(this.props.callbackOrder.orderUrl);this.order=await e.json()}catch{this.orderFetchFailed=!0}finally{this.render()}}render(){let{callbackOrder:e}=this.props;this.node.innerHTML=`
|
|
1675
1636
|
<div class="waykeecom-content">
|
|
1676
1637
|
<p class="waykeecom-content__p">Tack f\xF6r ditt k\xF6p</p>
|
|
1677
1638
|
<p class="waykeecom-content__p">Order id: ${e.orderUrl}</p>
|
|
1678
1639
|
<p class="waykeecom-content__p">Wayke id: ${e.id}</p>
|
|
1679
1640
|
</div>
|
|
1680
|
-
`}},
|
|
1641
|
+
`}},Gc=Oo;var Fo=class extends r{constructor(t,e){super(t),this.props=e,this.render()}render(){this.node.innerHTML=`
|
|
1681
1642
|
<h3 class="waykeecom-heading waykeecom-heading--4">K\xF6p online hos oss</h3>
|
|
1682
1643
|
<ul class="waykeecom-checklist" aria-label="F\xF6rdelar med att k\xF6pa bilen online hos oss">
|
|
1683
1644
|
${this.props.checklistItems.map(t=>` <li class="waykeecom-checklist__item">${t}</li>`).join("")}
|
|
1684
1645
|
</ul>
|
|
1685
|
-
`}},
|
|
1646
|
+
`}},fc=Fo;var Cd=({vehicle:a,order:t,meta:e,cdnMedia:i})=>{let o=a?.imageUrls,s=a?.title,n=u(a?.price||NaN),l=t?.contactInformation?.name;return`
|
|
1686
1647
|
<div class="waykeecom-product-card">
|
|
1687
1648
|
${o?.length?`
|
|
1688
1649
|
<div class="waykeecom-product-card__media">
|
|
1689
|
-
${o.slice(0,3).map(
|
|
1650
|
+
${o.slice(0,3).map(c=>`
|
|
1690
1651
|
<div class="waykeecom-product-card__media-item">
|
|
1691
|
-
<img src="${
|
|
1652
|
+
<img src="${We(c,i)}?spec=800x&format=webp" alt="" class="waykeecom-product-card__image" />
|
|
1692
1653
|
</div>
|
|
1693
1654
|
`).join("")}
|
|
1694
1655
|
</div>
|
|
1695
1656
|
`:""}
|
|
1696
|
-
<
|
|
1697
|
-
<
|
|
1698
|
-
|
|
1699
|
-
</
|
|
1700
|
-
<
|
|
1657
|
+
<dl class="waykeecom-product-card__body">
|
|
1658
|
+
<dt class="waykeecom-sr-only">S\xE4ljare</dt>
|
|
1659
|
+
<dd class="waykeecom-product-card__seller">${l}</dd>
|
|
1660
|
+
<dt class="waykeecom-sr-only">Modell</dt>
|
|
1661
|
+
<dd class="waykeecom-product-card__heading">
|
|
1701
1662
|
<span class="waykeecom-product-card__title">${s}</span> ${ge(a)}
|
|
1702
|
-
</
|
|
1703
|
-
<
|
|
1704
|
-
|
|
1705
|
-
</div>
|
|
1663
|
+
</dd>
|
|
1664
|
+
<dt class="waykeecom-sr-only">Pris</dt>
|
|
1665
|
+
<dd class="waykeecom-product-card__price">${n} kr</dd>
|
|
1706
1666
|
${e?`
|
|
1707
1667
|
<div class="waykeecom-product-card__meta">
|
|
1708
1668
|
${e}
|
|
1709
1669
|
</div>
|
|
1710
1670
|
`:""}
|
|
1711
|
-
</
|
|
1671
|
+
</dl>
|
|
1712
1672
|
</div>
|
|
1713
|
-
`},tt=
|
|
1673
|
+
`},tt=Cd;import{PaymentType as Lo}from"@wayke-se/ecom";var Ad=({heading:a,description:t,final:e})=>`
|
|
1714
1674
|
<li class="waykeecom-timeline__item${e?" waykeecom-timeline__item--final":""}">
|
|
1715
1675
|
<div class="waykeecom-timeline__stage">
|
|
1716
1676
|
<div class="waykeecom-timeline__badge"></div>
|
|
@@ -1720,7 +1680,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1720
1680
|
${t?`<div class="waykeecom-timeline__description">${t}</div>`:""}
|
|
1721
1681
|
</div>
|
|
1722
1682
|
</li>
|
|
1723
|
-
`,it=
|
|
1683
|
+
`,it=Ad;var xc={customer:{heading:"Dina kunduppgifter"},centralStorage:{heading:"V\xE4lj anl\xE4ggning",description:"V\xE4lj vilken anl\xE4ggning du vill k\xF6pa bilen ifr\xE5n."},delivery:{heading:"V\xE4lj leveranss\xE4tt",description:""},tradeIn:{heading:"Har du inbytesbil?",description:"F\xE5 den v\xE4rderad direkt online."},financial:{heading:"\xC4gandeform",description:""},insurance:{heading:"Vill du teckna en f\xF6rs\xE4kring?",description:"Se f\xF6rslag p\xE5 f\xF6rs\xE4kringar som passar din nya bil."},accessories:{heading:"Tillbeh\xF6r",description:"Best\xE4ll extra utrustning till din bil."}},vd=a=>{let t=a?.map(s=>s.type)||[],e=t.find(s=>s===Lo.Cash),i=t.find(s=>s===Lo.Lease),o=t.find(s=>s===Lo.Loan);return e&&o&&i?"Denna bil kan du k\xF6pa kontant, privatleasa eller finansiera med ett bill\xE5n.":e&&i?"Denna bil kan du k\xF6pa kontant eller privatleasa.":e&&o?"Denna bil kan du k\xF6pa kontant eller finansiera med ett bill\xE5n":o&&i?"Denna bil kan du privatleasa eller finansiera med ett bill\xE5n":e?"Denna bil kan du k\xF6pa kontant.":o?"Denna bil kan du finansiera med ett bill\xE5n":i?"Denna bil kan du privatleasa.":"???"},wd=a=>{let t=a?.find(i=>i.type==="Pickup"),e=a?.find(i=>i.type==="Delivery");return t&&e?"Hemleverans eller h\xE4mta hos handlaren.":t?"H\xE4mta hos handlaren.":e?"Hemleverans.":"???"},Nd=({order:a,stageOrderList:t})=>{let e=xc;return e.financial.description=vd(a?.paymentOptions),e.delivery.description=wd(a?.deliveryOptions),`
|
|
1724
1684
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1725
1685
|
<h4 class="waykeecom-heading waykeecom-heading--4">S\xE5 h\xE4r k\xF6per du bilen online</h4>
|
|
1726
1686
|
<div class="waykeecom-content">
|
|
@@ -1729,8 +1689,8 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1729
1689
|
</div>
|
|
1730
1690
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1731
1691
|
<div class="waykeecom-p--2">
|
|
1732
|
-
<ol class="waykeecom-timeline"
|
|
1733
|
-
${t?.map(i=>it(
|
|
1692
|
+
<ol class="waykeecom-timeline">
|
|
1693
|
+
${t?.map(i=>it(xc[i.name])).join("")}
|
|
1734
1694
|
${a?.isPaymentRequired?it({heading:"Genomf\xF6r f\xF6rskottsbetalning!",description:"Genomf\xF6r f\xF6rskottskottsbetalning p\xE5 5% av bilens v\xE4rde. (Genomf\xF6r betalning av deposition motsvarande 5% av bilens v\xE4rde.)"}):""}
|
|
1735
1695
|
${it({heading:"Klart!",final:!0})}
|
|
1736
1696
|
</ol>
|
|
@@ -1742,7 +1702,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1742
1702
|
tillsammans fram till detaljer kring betalning och skriver avtal.</p>
|
|
1743
1703
|
</div>
|
|
1744
1704
|
</div>
|
|
1745
|
-
`},
|
|
1705
|
+
`},Bc=Nd;var Sc="preview-proceed",Ec=`${Sc}-node`,Gd="preview-checklist",Rc=`${Gd}-node`,Xo=class extends r{constructor(e,i){super(e);this.contexts={};this.requestError=!1;this.props=i,this.init(),this.render()}async init(){this.requestError=!1,this.render();let e=this.props.store.getState();try{this.contexts.buttonProceed?.disabled(!0);let i=await Ue(e.id),o=Fe(i),s=[];this.props.stageOrderList.forEach(n=>{n==="centralStorage"&&!o.requiresDealerSelection||n==="tradeIn"&&!o.allowsTradeIn||n==="insurance"&&!o.insuranceOption||n==="accessories"&&!o.accessories.length||s.push(et[n])}),da(s)(this.props.store.dispatch),Le(o,this.props.vehicle)(this.props.store.dispatch),this.render()}catch(i){throw this.requestError=!0,this.render(),i}}onProceed(){d("PREVIEW","PREVIEW_PROCEED"),S("main")(this.props.store.dispatch)}render(){let{store:e,cdnMedia:i}=this.props,o=e.getState();if(!o.order){this.node.innerHTML=`
|
|
1746
1706
|
${this.requestError?C({tone:"error",children:"Ett fel uppstod och det gick inte att initiera modulen. F\xF6rs\xF6k igen."}):R()}
|
|
1747
1707
|
`;return}this.node.innerHTML=`
|
|
1748
1708
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
@@ -1751,10 +1711,10 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1751
1711
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1752
1712
|
${tt({vehicle:o.vehicle,order:o.order,cdnMedia:i})}
|
|
1753
1713
|
</div>
|
|
1754
|
-
${
|
|
1755
|
-
<div class="waykeecom-stack waykeecom-stack--3" id="${
|
|
1756
|
-
<footer class="waykeecom-footer" id="${
|
|
1757
|
-
`,this.contexts.buttonProceed=new v(document.querySelector(`#${
|
|
1714
|
+
${Bc({order:o.order,stageOrderList:o.stages})}
|
|
1715
|
+
<div class="waykeecom-stack waykeecom-stack--3" id="${Ec}"></div>
|
|
1716
|
+
<footer class="waykeecom-footer" id="${Rc}"></footer>
|
|
1717
|
+
`,this.contexts.buttonProceed=new v(document.querySelector(`#${Ec}`),{id:Sc,title:"G\xE5 vidare",onClick:()=>this.onProceed()}),new fc(document.querySelector(`#${Rc}`),{title:"K\xF6p online hos Wayke",ariaLabel:"F\xF6rdelar med att k\xF6pa bilen online hos Wayke",checklistItems:["Trygg hantering av personuppgifter","Reservera bilen nu \u2013 betalning och avtalsskrivning sker senare med handlaren","Inte bindande f\xF6rr\xE4n avtal skrivits ihop med handlaren","Bara kontrollerade bilar"]})}},Oc=Xo;var _o=class extends r{constructor(t){super(t,{htmlTag:"div",className:"waykeecom-stack waykeecom-stack--4"})}},Q=_o;var To=class extends Q{constructor(t,e){super(t),this.props=e,this.render()}render(){let{store:t}=this.props,{dealer:e,order:i}=t.getState(),o=i?.dealerSites.find(s=>s.id===e)?.name;this.node.innerHTML=`
|
|
1758
1718
|
<div class="waykeecom-stack waykeecom-stack--2">
|
|
1759
1719
|
<h4 class="waykeecom-heading waykeecom-heading--4 waykeecom-no-margin">Centrallager</h4>
|
|
1760
1720
|
</div>
|
|
@@ -1765,24 +1725,24 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1765
1725
|
</ul>
|
|
1766
1726
|
</div>
|
|
1767
1727
|
</div>
|
|
1768
|
-
`}},
|
|
1728
|
+
`}},Fc=To;var Wo=class extends Q{constructor(t,e){super(t),this.props=e,this.render()}render(){let{store:t}=this.props,e=t.getState();this.node.innerHTML=`
|
|
1769
1729
|
<div class="waykeecom-stack waykeecom-stack--2">
|
|
1770
1730
|
<h4 class="waykeecom-heading waykeecom-heading--4 waykeecom-no-margin">Kunduppgifter</h4>
|
|
1771
1731
|
</div>
|
|
1772
1732
|
<div class="waykeecom-stack waykeecom-stack--2">
|
|
1773
1733
|
<div class="waykeecom-stack waykeecom-stack--1">
|
|
1774
1734
|
<ul class="waykeecom-key-value-list">
|
|
1775
|
-
${h({key:"F\xF6r- och efternamn",value:`${
|
|
1776
|
-
${h({key:"Personnummer",value:
|
|
1735
|
+
${h({key:"F\xF6r- och efternamn",value:`${oe(e.address?.givenName||"")} ${oe(e.address?.surname||"")}`})}
|
|
1736
|
+
${h({key:"Personnummer",value:De(e.customer.socialId)})}
|
|
1777
1737
|
${h({key:"Adress",value:`
|
|
1778
|
-
${
|
|
1738
|
+
${oe(e.address?.givenName||"")} ${oe(e.address?.surname||"")}<br />${e.address?.street}<br />${e.address?.postalCode} ${e.address?.city}
|
|
1779
1739
|
`})}
|
|
1780
1740
|
${h({key:"E-post",value:e.customer.email})}
|
|
1781
1741
|
${h({key:"Telefonnummer",value:e.customer.phone})}
|
|
1782
1742
|
</ul>
|
|
1783
1743
|
</div>
|
|
1784
1744
|
</div>
|
|
1785
|
-
`}},
|
|
1745
|
+
`}},Lc=Wo;var Zo=class extends Q{constructor(t,e){super(t),this.props=e,this.render()}render(){let{store:t}=this.props,e=t.getState();this.node.innerHTML=`
|
|
1786
1746
|
<div class="waykeecom-stack waykeecom-stack--2">
|
|
1787
1747
|
<h4 class="waykeecom-heading waykeecom-heading--4 waykeecom-no-margin">Leverans</h4>
|
|
1788
1748
|
</div>
|
|
@@ -1793,7 +1753,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1793
1753
|
</ul>
|
|
1794
1754
|
</div>
|
|
1795
1755
|
</div>
|
|
1796
|
-
`}},
|
|
1756
|
+
`}},Xc=Zo;var Vo=class extends Q{constructor(t,e){super(t),this.props=e,this.render()}render(){let{store:t}=this.props,{customer:e,order:i,createdOrderId:o}=t.getState(),s=e.email,n=i?.contactInformation;o&&(this.node.innerHTML=`
|
|
1797
1757
|
<h3 class="waykeecom-heading waykeecom-heading--3">Tack f\xF6r din order!</h3>
|
|
1798
1758
|
<div class="waykeecom-stack waykeecom-stack--2">
|
|
1799
1759
|
<div class="waykeecom-content">
|
|
@@ -1814,7 +1774,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1814
1774
|
<div class="waykeecom-heading waykeecom-heading--4">Ordernummer ${o}</div>
|
|
1815
1775
|
</div>
|
|
1816
1776
|
|
|
1817
|
-
`)}},
|
|
1777
|
+
`)}},_c=Vo;import{PaymentType as Oe}from"@wayke-se/ecom";var Uo=class extends Q{constructor(t,e){super(t),this.props=e,this.render()}render(){let{store:t,cdnMedia:e}=this.props,i=t.getState(),o=i.order?.paymentOptions.find(c=>c.type===Oe.Loan),s=i.paymentLookupResponse||o?.loanDetails,n=i.order?.paymentOptions.find(c=>c.type===Oe.Lease),l=K(i.paymentType);this.node.innerHTML=`
|
|
1818
1778
|
<div class="waykeecom-stack waykeecom-stack--2">
|
|
1819
1779
|
<h4 class="waykeecom-heading waykeecom-heading--4 waykeecom-no-margin">Din order</h4>
|
|
1820
1780
|
</div>
|
|
@@ -1857,7 +1817,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1857
1817
|
</div>
|
|
1858
1818
|
<div class="waykeecom-stack waykeecom-stack--05">
|
|
1859
1819
|
<ul class="waykeecom-key-value-list">
|
|
1860
|
-
${i.accessories.map(
|
|
1820
|
+
${i.accessories.map(c=>h({key:c.name,value:u(c.price,{postfix:"kr"})})).join("")}
|
|
1861
1821
|
</ul>
|
|
1862
1822
|
</div>
|
|
1863
1823
|
</div>`:""}
|
|
@@ -1870,7 +1830,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1870
1830
|
<div class="waykeecom-stack waykeecom-stack--05">
|
|
1871
1831
|
<ul class="waykeecom-key-value-list">
|
|
1872
1832
|
${h({key:i.insurance.name,value:u(i.insurance.price,{postfix:"kr/m\xE5n"})})}
|
|
1873
|
-
${i.insuranceAddOns?.addOns.length&&i.insuranceAddOns.insurance===i.insurance.name?i.insuranceAddOns.addOns.map(
|
|
1833
|
+
${i.insuranceAddOns?.addOns.length&&i.insuranceAddOns.insurance===i.insurance.name?i.insuranceAddOns.addOns.map(c=>h({key:c.title,value:u(c.monthlyPrice,{postfix:"kr/m\xE5n"})})).join(""):""}
|
|
1874
1834
|
</ul>
|
|
1875
1835
|
</div>
|
|
1876
1836
|
`:""}
|
|
@@ -1888,7 +1848,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1888
1848
|
|
|
1889
1849
|
`})}
|
|
1890
1850
|
</div>
|
|
1891
|
-
`}},
|
|
1851
|
+
`}},Tc=Uo;var Do=class extends Q{constructor(t,e){super(t),this.props=e,this.render()}render(){let{store:t}=this.props,e=t.getState(),{order:i,tradeIn:o,tradeInVehicle:s}=e;i?.allowsTradeIn&&(this.node.innerHTML=`
|
|
1892
1852
|
<div class="waykeecom-stack waykeecom-stack--4">
|
|
1893
1853
|
<div class="waykeecom-stack waykeecom-stack--2">
|
|
1894
1854
|
<h4 class="waykeecom-heading waykeecom-heading--4 waykeecom-no-margin">Inbytesbil</h4>
|
|
@@ -1922,7 +1882,7 @@ import{config as wd}from"@wayke-se/ecom";var zo={name:"@wayke-se/ecom-web",versi
|
|
|
1922
1882
|
</ul>
|
|
1923
1883
|
</div>`}
|
|
1924
1884
|
</div>
|
|
1925
|
-
`)}},
|
|
1926
|
-
<div id="${
|
|
1927
|
-
`;let o=this.node.querySelector(`#${
|
|
1885
|
+
`)}},Wc=Do;var Zc="summary-node",Qo=class extends r{constructor(t,e){super(t),this.props=e,d("SUMMARY","SUMMARY_ACTIVE"),A(this.props.store,"navigation.view",i=>{i===3&&(this.render(),V())}),A(this.props.store,"createdOrderId",()=>{this.render()}),this.render(),V()}render(){let{store:t,cdnMedia:e}=this.props,{stages:i}=t.getState();this.node.innerHTML=`
|
|
1886
|
+
<div id="${Zc}"></div>
|
|
1887
|
+
`;let o=this.node.querySelector(`#${Zc}`);o&&(new _c(o,{store:t}),new Tc(o,{store:t,cdnMedia:e}),i?.find(s=>s.name==="tradeIn")&&new Wc(o,{store:t}),i?.find(s=>s.name==="centralStorage")&&new Fc(o,{store:t}),new Xc(o,{store:t}),new Lc(o,{store:t}))}},Vc=Qo;var Yo="order",xd="wayke-ecom-web-payment",Ho="wayke-ecom-web-id",Be="wayke-ecom-modal",Bd="ecom.wayketech.se",Ed="ecom.wayke.se",Rd=a=>{switch(new URL(a).host){case Ed:return"https://cdn.wayke.se";case Bd:return"https://test-cdn.wayketech.se";default:return}},Mo=class{constructor(t){this.contexts={store:ya()};if(!t.id)throw"Missing id";this.props=t,window.process||(window.process={...window.process||{},env:{}}),fd.bind(t.ecomSdkConfig),this.cdnMedia=Rd(t.ecomSdkConfig.api.address);let e=document.createElement("div");if(e.className="waykeecom-root",this.root=e,this.props.rootId){let l=document.getElementById(this.props.rootId);if(!l)throw"Missing element with id wayke-ecom";l.appendChild(e)}else document.body.appendChild(this.root);this.root.dataset.version=zo.version,this.stageOrderList=["centralStorage","customer","financial","tradeIn","accessories","insurance","delivery"],$o(t.id)(this.contexts.store.dispatch),this.view=this.contexts.store.getState().navigation.view,A(this.contexts.store,"navigation.view",l=>{this.view=l,l!=="preview"&&this.render()},!0);let i=new URLSearchParams(location.search),o=i.get(Yo)||void 0,s=!!i.get(xd),n=i.get(Ho);if(n&&n===this.props.id&&(o||s))if(s){let l=sessionStorage.getItem("wayke-ecom-state");sessionStorage.removeItem("wayke-ecom-state");let c=l?JSON.parse(l):void 0;c&&(this.view=c.navigation.view,pa({...c,stateLoadedFromSession:!0})(this.contexts.store.dispatch))}else o&&this.render({orderUrl:o,id:n})}close(){let t=fe();t&&d(t.view,"CLOSE",t.currentStep);let{caseId:e}=this.contexts.store.getState(),i=new URLSearchParams(location.search),o=i.get(Yo),s=i.get(Ho),n=!1;o&&(i.delete(Yo),n=!0,location.search=i.toString()),s&&(i.delete(Ho),n=!0),n&&(location.search=i.toString()),this.root.innerHTML="",this.contexts?.unsubribeVwListner?.(),Dt(),Ea(),e&&Ge(e),sessionStorage.removeItem("wayke-ecom-state"),Po(this.props.id)(this.contexts.store.dispatch),this.props.onEvent&&Sa(this.props.onEvent),this.contexts.lastTrigger&&(this.contexts.lastTrigger.focus(),this.contexts.lastTrigger=void 0)}destroy(){this.close(),this.root.remove()}closeWithConfirm(){let{navigation:t,createdOrderId:e}=this.contexts.store.getState(),i=t.view==="preview";if(Dt(),i||e){this.close();return}this.contexts.modal=new Vt(this.root,{title:"Wayke Ecom",id:Be,logo:this.props.logo,logoX2:this.props.logoX2});let o=fe();o&&d(o.view,"CONFIRM_CLOSE_ACTIVE"),new _a(this.contexts.modal.content,{onConfirmClose:()=>{let s=fe();d(s.view,"CONFIRM_CLOSE_CONFIRMED",s.currentStep),this.close()},onAbortClose:()=>{let s=fe();d(s.view,"CONFIRM_CLOSE_ABORTED",s.currentStep),this.render()}})}start(){this.props.onEvent&&Ra(this.props.onEvent),d("PREVIEW","START"),this.render()}focusModal(){this.contexts.modal?.content&&(this.contexts.modal.content.setAttribute("tabindex","-1"),this.contexts.modal.content.focus())}render(t){if(this.contexts.lastTrigger||(this.contexts.lastTrigger=document.activeElement),this.contexts.unsubribeVwListner||(this.contexts.unsubribeVwListner=Oa()),this.contexts.modal=new Vt(this.root,{title:"Wayke Ecom",id:Be,logo:this.props.logo,logoX2:this.props.logoX2,onClose:()=>this.closeWithConfirm()}),this.contexts.modal.content){if(this.contexts.modal.content.innerHTML="",t){new Gc(this.contexts.modal.content,{store:this.contexts.store,callbackOrder:t,onClose:()=>this.close()}),this.focusModal();return}switch(this.view){case"preview":new Oc(this.contexts.modal.content,{store:this.contexts.store,stageOrderList:this.stageOrderList,vehicle:this.props.vehicle,cdnMedia:this.cdnMedia});break;case"main":new Nc(this.contexts.modal.content,{store:this.contexts.store,cdnMedia:this.cdnMedia});break;case"summary":new Vc(this.contexts.modal.content,{store:this.contexts.store,cdnMedia:this.cdnMedia,onClose:()=>this.close()});break;default:throw"Unknown view..."}this.focusModal()}}},Uc=Mo;var uw=Uc;export{uw as default};
|
|
1928
1888
|
//# sourceMappingURL=index.mjs.map
|