@wayke-se/ecom-web 0.0.8-beta.13 → 0.0.8-beta.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Tc=(o=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(o,{get:(i,e)=>(typeof require!="undefined"?require:i)[e]}):o)(function(o){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+o+'" is not supported')});import{config as ed}from"@wayke-se/ecom";var Mo={name:"@wayke-se/ecom-web",version:"0.0.8-beta.13",description:"Wayke Ecom Web",module:"dist/index.mjs",main:"dist/index.js",types:"dist/index.d.ts",scripts:{start:"node ./esbuild/start.js",cl:"node ./esbuild/cl.js",build:"npm run clean && node ./esbuild/lib.js && node ./esbuild/cdn.js",clean:"rimraf build && rimraf dist && rimraf dist-cdn",test:"npm run lint && npm run typecheck",typecheck:"tsc -noEmit","typecheck:watch":"tsc -noEmit -watch",lint:"eslint --ext .ts,.js 'src'","lint:fix":"eslint --ext .ts,.js 'src' --fix",stylelint:"stylelint '**/*.scss'",prepare:"husky install"},author:"Wayke",license:"ISC",devDependencies:{"@types/marked":"^4.0.3","@types/node":"^17.0.18","@types/object-path":"^0.11.1","@types/sanitize-html":"^2.6.2","@typescript-eslint/eslint-plugin":"^5.12.0","@typescript-eslint/parser":"^5.12.0",esbuild:"^0.14.22","esbuild-sass-plugin":"^2.2.3",eslint:"^8.9.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0",husky:"^8.0.1","npm-dts":"^1.3.11",prettier:"^2.5.1",rimraf:"^3.0.2",stylelint:"^14.5.1","stylelint-config-prettier-scss":"^0.0.1","stylelint-config-standard-scss":"^4.0.0",typescript:"^4.5.5"},dependencies:{"@wayke-se/ecom":"^4.1.0",marked:"^4.0.16","object-path":"^0.11.8",redux:"^4.1.2","sanitize-html":"^2.7.0"},files:["dist"]};import{createStore as Oc}from"redux";import{DrivingDistance as Dc,PaymentType as Xo}from"@wayke-se/ecom";var Qe=(o,i)=>o!==void 0&&i!==void 0?JSON.stringify(o).localeCompare(JSON.stringify(i))===0:o===i;var _e=o=>({costs:o.getCosts(),fees:o.getFees(),interests:o.getInterests(),durationSpec:o.getDurationSpec(),downPaymentSpec:o.getDownPaymentSpec(),residualValueSpec:o.getResidualValueSpec(),totalResidualValue:o.getTotalResidualValue(),publicURL:o.getPublicURL(),shouldUseCreditScoring:o.shouldUseCreditScoring(),financialProductCode:o.getFinancialProductCode(),price:o.getPrice(),creditAmount:o.getCreditAmount(),hasPrivacyPolicy:o.hasPrivacyPolicy(),privacyPolicyUrl:o.getPrivacyPolicyUrl()}),xo=o=>({status:o.getStatus(),hasPendingSigning:o.hasPendingSigning(),hintCode:o.getHintCode(),signingMessage:o.getSigningMessage(),shouldRenewSigning:o.shouldRenewSigning(),isSigned:o.isSigned(),address:void 0,pendingScoring:o.hasPendingScoring(),isScored:o.isScored(),hasScoringError:o.hasScoringError(),scoringId:o.getScoringId(),recommendation:o.getRecommendation(),decision:o.getDecision(),isAccepted:o.isAccepted()}),De=o=>({orderVehicle:o.getOrderVehicle(),accessories:o.getAccessories(),requiresDealerSelection:o.requiresDealerSelection(),dealerSites:o.getDealerSites(),paymentOptions:o.getPaymentOptions().map(e=>({...e,loanDetails:e.loanDetails?_e(e.loanDetails):void 0})),deliveryOptions:o.getDeliveryOptions(),insuranceOption:o.getInsuranceOption(),orderConditions:o.getOrderConditions(),orderReturnConditions:o.getOrderReturnConditions(),conditionsPdfUri:o.getConditionsPdfUri(),contactInformation:o.getContactInformation(),allowsTradeIn:o.allowsTradeIn(),isUnavailable:o.isUnavailable(),isPaymentRequired:o.isPaymentRequired()}),Po=o=>({vehicle:o.getVehicle()});var je="RESET",$o=o=>i=>i({type:je,id:o}),ze="SET_ORDER",Re=(o,i)=>e=>e({type:ze,order:o,vehicle:i}),Je="SET_ID",Ho=o=>i=>i({type:Je,id:o}),Ze="SET_CONTACT_EMAIL_AND_PHONE",Bo=o=>i=>i({type:Ze,value:o}),Xe="SET_SOCIAL_ID_AND_ADDRESS",Uo=(o,i,e)=>t=>t({type:Xe,socialId:o,address:i,lastStage:e}),et="SET_HOME_DELIVERY",Fo=(o,i)=>e=>e({type:et,homeDelivery:o,lastStage:i}),tt="SET_DEALER",Vo=(o,i)=>e=>e({type:tt,dealer:o,lastStage:i}),st="INIT_TRADE_IN",Go=o=>i=>i({type:st,lastStage:o}),ot="SET_TRADE_IN",fe=(o,i,e)=>t=>t({type:ot,lastStage:o,tradeIn:i,tradeInVehicle:e}),it="SET_FINANCIAL",qo=(o,i)=>e=>e({type:it,paymentType:o,lastStage:i}),nt="SET_PAYMENT_LOOKUP_RESPONSE",Wo=o=>i=>i({type:nt,paymentLookupResponse:_e(o)}),at="SET_DRIVING_DISTANCE",Ko=o=>i=>i({type:at,drivingDistance:o}),rt="COMPLETE_STAGE",z=o=>i=>i({type:rt,lastStage:o}),ct="SET_OR_REMOVE_INSURANCE",ce=o=>i=>i({type:ct,insurance:o}),lt="SET_OR_REMOVE_INSURANCE_ADDONS",Yo=(o,i)=>e=>e({type:lt,insurance:o,insuranceAddons:i}),dt="SET_OR_REMOVE_FREE_INSURANCE",Qo=o=>i=>i({type:dt,freeInsurance:o}),mt="SET_OR_REMOVE_ACCESSORY",jo=o=>i=>i({type:mt,accessory:o}),pt="GO_TO",O=(o,i,e)=>t=>t({type:pt,view:o,index:i,subStage:e}),ut="SET_STAGES",zo=o=>i=>i({type:ut,stages:o}),ht="SET_CREATED_ORDER_ID",Jo=(o,i)=>e=>e({type:ht,id:o,payment:i}),kt="SET_CREDIT_ASSESSMENT_RESPONSE",le=(o,i)=>e=>e({type:kt,caseId:o,creditAssessmentResponse:i}),yt="SET_STATE",Zo=o=>i=>i({type:yt,state:o});var It={};try{It=Tc("../../statemock.json")}catch{It={}}var ei={view:"preview",stage:1,subStage:1},ti={id:"",topNavigation:{...ei},navigation:{...ei},customer:{email:"",phone:"",givenName:"",surname:"",socialId:""},homeDelivery:!1,accessories:[],drivingDistance:Dc.Between0And1000,...It},se=(o,i)=>i?{view:"summary",stage:1,subStage:1}:{view:"main",stage:o+1,subStage:1},oe=(o,i)=>i.view==="main"?o.stage<i.stage?i:v.topNavigation:{...o,stage:o.stage+1},vt=o=>o&&o?.length===1&&o?.[0].type===Xo.Cash?Xo.Cash:void 0,v,Et,Rc=(o=ti,i)=>{let e,t;switch(v={...o},i.type){case je:return{...ti,id:i.id};case ut:return{...v,stages:i.stages};case Je:return{...v,id:i.id};case ze:return{...o,order:i.order,paymentType:vt(i.order?.paymentOptions),vehicle:{...i.order.orderVehicle,...i.vehicle||{}}};case Ze:let s={...v,customer:{...o.customer,email:i.value.email,phone:i.value.phone},navigation:{view:"main",stage:o.navigation.stage,subStage:2}};return delete s.wantTradeIn,delete s.tradeIn,delete s.tradeInVehicle,s.paymentType=vt(o.order?.paymentOptions),delete s.paymentLookupResponse,delete s.insurance,delete s.insuranceAddOns,delete s.freeInsurance,delete s.dealer,s.accessories=[],s;case Xe:return e=se(v.navigation.stage,i.lastStage),t=oe(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,address:i.address,customer:{...o.customer,socialId:i.socialId}},v;case tt:return e=se(o.navigation.stage,i.lastStage),t={...e},v={...o,navigation:e,topNavigation:t,dealer:i.dealer},delete v.wantTradeIn,delete v.tradeIn,delete v.tradeInVehicle,v.paymentType=vt(o.order?.paymentOptions),delete v.paymentLookupResponse,delete v.insurance,delete v.insuranceAddOns,delete v.freeInsurance,v.accessories=[],v;case et:return e=se(o.navigation.stage,i.lastStage),t=oe(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,homeDelivery:i.homeDelivery},v;case st:return e={view:"main",stage:o.navigation.stage,subStage:1},t=oe(v.topNavigation,e),v={...o,navigation:e,wantTradeIn:!0,topNavigation:t,tradeIn:o.tradeIn||{registrationNumber:"",mileage:"",description:""}},v;case ot:return e=se(o.navigation.stage,i.lastStage),t=oe(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,wantTradeIn:!!i.tradeIn,tradeIn:i.tradeIn,tradeInVehicle:i.tradeInVehicle},v;case it:return e=se(o.navigation.stage,i.lastStage),t=oe(v.topNavigation,e),{...v,navigation:e,topNavigation:t,paymentType:i.paymentType};case nt:return{...v,paymentLookupResponse:i.paymentLookupResponse};case at:return{...v,drivingDistance:i.drivingDistance};case rt:return e=se(o.navigation.stage,i.lastStage),t=oe(v.topNavigation,e),v={...o,navigation:e,topNavigation:t},v;case lt:return v.insurance=i.insurance,v.insuranceAddOns={insurance:i.insurance.name,addOns:i.insuranceAddons},v;case ct:return Qe(v.insurance,i.insurance)?v.insurance=void 0:v.insurance=i.insurance,v.insuranceAddOns?.insurance&&(v.insuranceAddOns=void 0),v;case dt:return Qe(v.freeInsurance,i.freeInsurance)?v.freeInsurance=void 0:v.freeInsurance=i.freeInsurance,v;case mt:return Et=v.accessories.findIndex(n=>n.id===i.accessory.id),v.accessories=[...v.accessories],Et>-1?v.accessories.splice(Et,1):v.accessories.push(i.accessory),{...v,accessories:[...v.accessories]};case pt:return{...o,navigation:{view:i.view,stage:i.index||1,subStage:i.subStage||1}};case ht:return i.payment?e={view:"main",stage:o.navigation.stage,subStage:2}:e=se(o.navigation.stage,!0),t=oe(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,createdOrderId:i.id,payment:i.payment},v;case kt:return{...v,caseId:i.caseId,creditAssessmentResponse:i.creditAssessmentResponse};case yt:return{...i.state};default:return o}},si=Rc;var oi=()=>Oc(si);var Oe=(o,i)=>{if(!i)return o;let e=new URL(o);return`${i}${e.pathname}`};var Lc=o=>o.toString().replace(/\s/g,""),bc=(o,i)=>{if(!i)return o;let e=Math.pow(10,i);return(Math.round(o*e)/e).toFixed(i)},k=(o,i)=>{if(o===void 0)return"???";let e=bc(o,i?.decimals!==void 0?i.decimals:0);return`${i?.prefix?`${i.prefix}`:""}${Lc(e).replace(/\B(?=(\d{3})+(?!\d))/g," ")}${i?.postfix?` ${i.postfix}`:""}`};var Mc=({vehicle:o,order:i,meta:e,cdnMedia:t})=>{let s=o?.imageUrls,n=o?.title,a=o?.shortDescription,c=k(o?.price||NaN),l=i?.contactInformation?.name;return`
1
+ "use strict";var Tc=(o=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(o,{get:(i,e)=>(typeof require!="undefined"?require:i)[e]}):o)(function(o){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+o+'" is not supported')});import{config as ed}from"@wayke-se/ecom";var Mo={name:"@wayke-se/ecom-web",version:"0.0.8-beta.14",description:"Wayke Ecom Web",module:"dist/index.mjs",main:"dist/index.js",types:"dist/index.d.ts",scripts:{start:"node ./esbuild/start.js",cl:"node ./esbuild/cl.js",build:"npm run clean && node ./esbuild/lib.js && node ./esbuild/cdn.js",clean:"rimraf build && rimraf dist && rimraf dist-cdn",test:"npm run lint && npm run typecheck",typecheck:"tsc -noEmit","typecheck:watch":"tsc -noEmit -watch",lint:"eslint --ext .ts,.js 'src'","lint:fix":"eslint --ext .ts,.js 'src' --fix",stylelint:"stylelint '**/*.scss'",prepare:"husky install"},author:"Wayke",license:"ISC",devDependencies:{"@types/marked":"^4.0.3","@types/node":"^17.0.18","@types/object-path":"^0.11.1","@types/sanitize-html":"^2.6.2","@typescript-eslint/eslint-plugin":"^5.12.0","@typescript-eslint/parser":"^5.12.0",esbuild:"^0.14.22","esbuild-sass-plugin":"^2.2.3",eslint:"^8.9.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0",husky:"^8.0.1","npm-dts":"^1.3.11",prettier:"^2.5.1",rimraf:"^3.0.2",stylelint:"^14.5.1","stylelint-config-prettier-scss":"^0.0.1","stylelint-config-standard-scss":"^4.0.0",typescript:"^4.5.5"},dependencies:{"@wayke-se/ecom":"^4.1.0",marked:"^4.0.16","object-path":"^0.11.8",redux:"^4.1.2","sanitize-html":"^2.7.0"},files:["dist"]};import{createStore as Oc}from"redux";import{DrivingDistance as Dc,PaymentType as Xo}from"@wayke-se/ecom";var Qe=(o,i)=>o!==void 0&&i!==void 0?JSON.stringify(o).localeCompare(JSON.stringify(i))===0:o===i;var _e=o=>({costs:o.getCosts(),fees:o.getFees(),interests:o.getInterests(),durationSpec:o.getDurationSpec(),downPaymentSpec:o.getDownPaymentSpec(),residualValueSpec:o.getResidualValueSpec(),totalResidualValue:o.getTotalResidualValue(),publicURL:o.getPublicURL(),shouldUseCreditScoring:o.shouldUseCreditScoring(),financialProductCode:o.getFinancialProductCode(),price:o.getPrice(),creditAmount:o.getCreditAmount(),hasPrivacyPolicy:o.hasPrivacyPolicy(),privacyPolicyUrl:o.getPrivacyPolicyUrl()}),xo=o=>({status:o.getStatus(),hasPendingSigning:o.hasPendingSigning(),hintCode:o.getHintCode(),signingMessage:o.getSigningMessage(),shouldRenewSigning:o.shouldRenewSigning(),isSigned:o.isSigned(),address:void 0,pendingScoring:o.hasPendingScoring(),isScored:o.isScored(),hasScoringError:o.hasScoringError(),scoringId:o.getScoringId(),recommendation:o.getRecommendation(),decision:o.getDecision(),isAccepted:o.isAccepted()}),De=o=>({orderVehicle:o.getOrderVehicle(),accessories:o.getAccessories(),requiresDealerSelection:o.requiresDealerSelection(),dealerSites:o.getDealerSites(),paymentOptions:o.getPaymentOptions().map(e=>({...e,loanDetails:e.loanDetails?_e(e.loanDetails):void 0})),deliveryOptions:o.getDeliveryOptions(),insuranceOption:o.getInsuranceOption(),orderConditions:o.getOrderConditions(),orderReturnConditions:o.getOrderReturnConditions(),conditionsPdfUri:o.getConditionsPdfUri(),contactInformation:o.getContactInformation(),allowsTradeIn:o.allowsTradeIn(),isUnavailable:o.isUnavailable(),isPaymentRequired:o.isPaymentRequired()}),Po=o=>({vehicle:o.getVehicle()});var je="RESET",$o=o=>i=>i({type:je,id:o}),ze="SET_ORDER",Re=(o,i)=>e=>e({type:ze,order:o,vehicle:i}),Je="SET_ID",Ho=o=>i=>i({type:Je,id:o}),Ze="SET_CONTACT_EMAIL_AND_PHONE",Bo=o=>i=>i({type:Ze,value:o}),Xe="SET_SOCIAL_ID_AND_ADDRESS",Uo=(o,i,e)=>t=>t({type:Xe,socialId:o,address:i,lastStage:e}),et="SET_HOME_DELIVERY",Fo=(o,i)=>e=>e({type:et,homeDelivery:o,lastStage:i}),tt="SET_DEALER",Vo=(o,i)=>e=>e({type:tt,dealer:o,lastStage:i}),st="INIT_TRADE_IN",Go=o=>i=>i({type:st,lastStage:o}),ot="SET_TRADE_IN",fe=(o,i,e)=>t=>t({type:ot,lastStage:o,tradeIn:i,tradeInVehicle:e}),it="SET_FINANCIAL",qo=(o,i)=>e=>e({type:it,paymentType:o,lastStage:i}),nt="SET_PAYMENT_LOOKUP_RESPONSE",Wo=o=>i=>i({type:nt,paymentLookupResponse:_e(o)}),at="SET_DRIVING_DISTANCE",Ko=o=>i=>i({type:at,drivingDistance:o}),rt="COMPLETE_STAGE",z=o=>i=>i({type:rt,lastStage:o}),ct="SET_OR_REMOVE_INSURANCE",ce=o=>i=>i({type:ct,insurance:o}),lt="SET_OR_REMOVE_INSURANCE_ADDONS",Yo=(o,i)=>e=>e({type:lt,insurance:o,insuranceAddons:i}),dt="SET_OR_REMOVE_FREE_INSURANCE",Qo=o=>i=>i({type:dt,freeInsurance:o}),mt="SET_OR_REMOVE_ACCESSORY",jo=o=>i=>i({type:mt,accessory:o}),pt="GO_TO",O=(o,i,e)=>t=>t({type:pt,view:o,index:i,subStage:e}),ut="SET_STAGES",zo=o=>i=>i({type:ut,stages:o}),ht="SET_CREATED_ORDER_ID",Jo=(o,i)=>e=>e({type:ht,id:o,payment:i}),kt="SET_CREDIT_ASSESSMENT_RESPONSE",le=(o,i)=>e=>e({type:kt,caseId:o,creditAssessmentResponse:i}),yt="SET_STATE",Zo=o=>i=>i({type:yt,state:o});var It={};try{It=Tc("../../statemock.json")}catch{It={}}var ei={view:"preview",stage:1,subStage:1},ti={id:"",topNavigation:{...ei},navigation:{...ei},customer:{email:"",phone:"",givenName:"",surname:"",socialId:""},homeDelivery:!1,accessories:[],drivingDistance:Dc.Between0And1000,...It},se=(o,i)=>i?{view:"summary",stage:1,subStage:1}:{view:"main",stage:o+1,subStage:1},oe=(o,i)=>i.view==="main"?o.stage<i.stage?i:v.topNavigation:{...o,stage:o.stage+1},vt=o=>o&&o?.length===1&&o?.[0].type===Xo.Cash?Xo.Cash:void 0,v,Et,Rc=(o=ti,i)=>{let e,t;switch(v={...o},i.type){case je:return{...ti,id:i.id};case ut:return{...v,stages:i.stages};case Je:return{...v,id:i.id};case ze:return{...o,order:i.order,paymentType:vt(i.order?.paymentOptions),vehicle:{...i.order.orderVehicle,...i.vehicle||{}}};case Ze:let s={...v,customer:{...o.customer,email:i.value.email,phone:i.value.phone},navigation:{view:"main",stage:o.navigation.stage,subStage:2}};return delete s.wantTradeIn,delete s.tradeIn,delete s.tradeInVehicle,s.paymentType=vt(o.order?.paymentOptions),delete s.paymentLookupResponse,delete s.insurance,delete s.insuranceAddOns,delete s.freeInsurance,delete s.dealer,s.accessories=[],s;case Xe:return e=se(v.navigation.stage,i.lastStage),t=oe(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,address:i.address,customer:{...o.customer,socialId:i.socialId}},v;case tt:return e=se(o.navigation.stage,i.lastStage),t={...e},v={...o,navigation:e,topNavigation:t,dealer:i.dealer},delete v.wantTradeIn,delete v.tradeIn,delete v.tradeInVehicle,v.paymentType=vt(o.order?.paymentOptions),delete v.paymentLookupResponse,delete v.insurance,delete v.insuranceAddOns,delete v.freeInsurance,v.accessories=[],v;case et:return e=se(o.navigation.stage,i.lastStage),t=oe(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,homeDelivery:i.homeDelivery},v;case st:return e={view:"main",stage:o.navigation.stage,subStage:1},t=oe(v.topNavigation,e),v={...o,navigation:e,wantTradeIn:!0,topNavigation:t,tradeIn:o.tradeIn||{registrationNumber:"",mileage:"",description:""}},v;case ot:return e=se(o.navigation.stage,i.lastStage),t=oe(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,wantTradeIn:!!i.tradeIn,tradeIn:i.tradeIn,tradeInVehicle:i.tradeInVehicle},v;case it:return e=se(o.navigation.stage,i.lastStage),t=oe(v.topNavigation,e),{...v,navigation:e,topNavigation:t,paymentType:i.paymentType};case nt:return{...v,paymentLookupResponse:i.paymentLookupResponse};case at:return{...v,drivingDistance:i.drivingDistance};case rt:return e=se(o.navigation.stage,i.lastStage),t=oe(v.topNavigation,e),v={...o,navigation:e,topNavigation:t},v;case lt:return v.insurance=i.insurance,v.insuranceAddOns={insurance:i.insurance.name,addOns:i.insuranceAddons},v;case ct:return Qe(v.insurance,i.insurance)?v.insurance=void 0:v.insurance=i.insurance,v.insuranceAddOns?.insurance&&(v.insuranceAddOns=void 0),v;case dt:return Qe(v.freeInsurance,i.freeInsurance)?v.freeInsurance=void 0:v.freeInsurance=i.freeInsurance,v;case mt:return Et=v.accessories.findIndex(n=>n.id===i.accessory.id),v.accessories=[...v.accessories],Et>-1?v.accessories.splice(Et,1):v.accessories.push(i.accessory),{...v,accessories:[...v.accessories]};case pt:return{...o,navigation:{view:i.view,stage:i.index||1,subStage:i.subStage||1}};case ht:return i.payment?e={view:"main",stage:o.navigation.stage,subStage:2}:e=se(o.navigation.stage,!0),t=oe(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,createdOrderId:i.id,payment:i.payment},v;case kt:return{...v,caseId:i.caseId,creditAssessmentResponse:i.creditAssessmentResponse};case yt:return{...i.state};default:return o}},si=Rc;var oi=()=>Oc(si);var Oe=(o,i)=>{if(!i)return o;let e=new URL(o);return`${i}${e.pathname}`};var Lc=o=>o.toString().replace(/\s/g,""),bc=(o,i)=>{if(!i)return o;let e=Math.pow(10,i);return(Math.round(o*e)/e).toFixed(i)},k=(o,i)=>{if(o===void 0)return"???";let e=bc(o,i?.decimals!==void 0?i.decimals:0);return`${i?.prefix?`${i.prefix}`:""}${Lc(e).replace(/\B(?=(\d{3})+(?!\d))/g," ")}${i?.postfix?` ${i.postfix}`:""}`};var Mc=({vehicle:o,order:i,meta:e,cdnMedia:t})=>{let s=o?.imageUrls,n=o?.title,a=o?.shortDescription,c=k(o?.price||NaN),l=i?.contactInformation?.name;return`
2
2
  <div class="waykeecom-product-card">
3
3
  ${s?.length?`
4
4
  <div class="waykeecom-product-card__media">
@@ -977,7 +977,7 @@
977
977
  </div>
978
978
  </div>
979
979
  </div>
980
- `,this.contexts.loanDetailsMontlyCost=new sa(this.node.querySelector(`#${oa}`),{monthlyCost:y}),this.contexts.pieChart=new Zn(this.node.querySelector(`#${ia}`),{percentage:S}),this.contexts.loanDetailsBasic=new Xn(this.node.querySelector(`#${na}`),{downPayment:t,creditAmount:m,downPaymentPercentage:f,creditAmountPercentage:S}),this.contexts.loanDetailsDetailed=new ta(this.node.querySelector(`#${aa}`),{duration:e,administrationFee:s,setupFee:n,totalCreditCost:a,interest:c,effectiveInterest:l,publicUrl:u,loanOrgName:p})}},ra=Ns;var As=class extends r{constructor(e,t){super(e);this.props=t,this.error=t.error,this.render()}update(e){this.error=e,this.render()}render(){if(!this.error){this.node.innerHTML="";return}this.node.innerHTML=I({tone:"error",children:this.error})}},ca=As;var la="downpayment-range-node",Dl="downpayment-range",da="duration-range-node",Rl="duration-range",ma="residual-range-node",Ol="residual-range",Ll="loan-details",pa=`${Ll}-node`,ua="credit-assessment-node",ya="credit-assessment-proceed",ha=`${ya}-node`,ka="loan-error-node",Ts=class extends r{constructor(e,t){super(e);this.contexts={};this.props=t;let s=this.props.loan.loanDetails;if(!s)throw"err";this.paymentLookupResponse=this.props.paymentLookupResponse||s,this.paymentState={vehicleId:this.props.vehicleId,dealerId:"",downPayment:this.paymentLookupResponse.downPaymentSpec,duration:this.paymentLookupResponse.durationSpec,residual:this.paymentLookupResponse.residualValueSpec},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 rn({vehicleId:this.paymentState.vehicleId,downPayment:this.paymentState.downPayment.current,duration:this.paymentState.duration.current,residual:this.paymentState.residual?.current});this.previousState=JSON.parse(JSON.stringify(this.paymentState)),this.paymentLookupResponse=_e(e),this.paymentState={...this.paymentState,downPayment:this.paymentLookupResponse.downPaymentSpec,duration:this.paymentLookupResponse.durationSpec,residual:this.paymentLookupResponse.residualValueSpec},Wo(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(this.paymentState.residual.current*100,this.paymentState.residual.min*100,this.paymentState.residual.max*100),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(this.previousState.residual.current*100,this.previousState.residual.min*100,this.previousState.residual.max*100),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 t=e.currentTarget,s=t.name,n=t.value;this.paymentState[s].current=s==="residual"?parseInt(n,10)/100:parseInt(n,10),this.payment()}update(){this.contexts.loanDetails?.update({loan:this.props.loan,paymentLookupResponse:this.paymentLookupResponse})}render(){let{store:e,loan:t,onProceed:s}=this.props,{order:n}=e.getState(),a=n?.contactInformation?.name,c=t.loanDetails?.shouldUseCreditScoring;this.node.innerHTML=`
980
+ `,this.contexts.loanDetailsMontlyCost=new sa(this.node.querySelector(`#${oa}`),{monthlyCost:y}),this.contexts.pieChart=new Zn(this.node.querySelector(`#${ia}`),{percentage:S}),this.contexts.loanDetailsBasic=new Xn(this.node.querySelector(`#${na}`),{downPayment:t,creditAmount:m,downPaymentPercentage:f,creditAmountPercentage:S}),this.contexts.loanDetailsDetailed=new ta(this.node.querySelector(`#${aa}`),{duration:e,administrationFee:s,setupFee:n,totalCreditCost:a,interest:c,effectiveInterest:l,publicUrl:u,loanOrgName:p})}},ra=Ns;var As=class extends r{constructor(e,t){super(e);this.props=t,this.error=t.error,this.render()}update(e){this.error=e,this.render()}render(){if(!this.error){this.node.innerHTML="";return}this.node.innerHTML=I({tone:"error",children:this.error})}},ca=As;var la="downpayment-range-node",Dl="downpayment-range",da="duration-range-node",Rl="duration-range",ma="residual-range-node",Ol="residual-range",Ll="loan-details",pa=`${Ll}-node`,ua="credit-assessment-node",ya="credit-assessment-proceed",ha=`${ya}-node`,ka="loan-error-node",Ts=class extends r{constructor(e,t){super(e);this.contexts={};this.props=t;let s=this.props.loan.loanDetails;if(!s)throw"err";this.paymentLookupResponse=this.props.paymentLookupResponse||s,this.paymentState={vehicleId:this.props.vehicleId,dealerId:"",downPayment:this.paymentLookupResponse.downPaymentSpec,duration:this.paymentLookupResponse.durationSpec,residual:this.paymentLookupResponse.residualValueSpec},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 rn({vehicleId:this.paymentState.vehicleId,downPayment:this.paymentState.downPayment.current,duration:this.paymentState.duration.current,residual:this.paymentState.residual?.current});this.previousState=JSON.parse(JSON.stringify(this.paymentState)),this.paymentLookupResponse=_e(e),this.paymentState={...this.paymentState,downPayment:this.paymentLookupResponse.downPaymentSpec,duration:this.paymentLookupResponse.durationSpec,residual:this.paymentLookupResponse.residualValueSpec},Wo(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 t=e.currentTarget,s=t.name,n=t.value;t.value=n,this.paymentState[s].current=s==="residual"?parseInt(n,10)/100:parseInt(n,10),this.payment()}update(){this.contexts.loanDetails?.update({loan:this.props.loan,paymentLookupResponse:this.paymentLookupResponse})}render(){let{store:e,loan:t,onProceed:s}=this.props,{order:n}=e.getState(),a=n?.contactInformation?.name,c=t.loanDetails?.shouldUseCreditScoring;this.node.innerHTML=`
981
981
  <div class="waykeecom-stack waykeecom-stack--3">
982
982
  <hr class="waykeecom-separator" />
983
983
  </div>
@@ -1005,7 +1005,7 @@
1005
1005
  <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 ${a}.</p>
1006
1006
  <p class="waykeecom-content__p">Ifall du har en inbytesbil kan du betala kontantinsatsen med den. Detta kommer du \xF6verens om tillsammans med ${a} vid avtalsskrivning. </p>
1007
1007
  </div>
1008
- `,onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_DOWNPAYMENT_INFORMATION_TOGGLE","FINANCIAL")}}),this.contexts.duration=new Ue(this.node.querySelector(`#${da}`),{title:"Avbetalning",value:this.paymentState.duration.current,id:Rl,name:"duration",onChange:l=>this.onChange(l),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 Ue(this.node.querySelector(`#${ma}`),{title:"Restv\xE4rde",value:this.paymentState.residual.current*100,id:Ol,name:"residual",onChange:l=>this.onChange(l),min:this.paymentState.residual.min*100,max:this.paymentState.residual.max*100,step:this.paymentState.residual.step*100,unit:"%"})),this.contexts.errorAlert=new ca(this.node.querySelector(`#${ka}`),{}),this.contexts.loanDetails=new ra(this.node.querySelector(`#${pa}`),{loan:t,paymentLookupResponse:this.paymentLookupResponse}),c?new Jn(this.node.querySelector(`#${ua}`),{store:e,loan:t,paymentLookupResponse:this.paymentLookupResponse,onProceed:()=>s()}):this.contexts.proceedButton=new g(this.node.querySelector(`#${ha}`),{title:"G\xE5 vidare",id:ya,onClick:()=>s()})}},va=Ts;import{PaymentType as Ea}from"@wayke-se/ecom";var bl="credit-assessment-result",Ia=`${bl}-node`,Cs=class extends r{constructor(e,t){super(e,{htmlTag:"div"});this.props=t,this.render()}render(){let{store:e,paymentType:t,loan:s,paymentLookupResponse:n,onEdit:a}=this.props,c=s?.loanDetails;if(t===Ea.Loan){let l=this.props.store.getState(),m=n||c;if(!c||!m)throw"Missing loan";let u=m.downPaymentSpec.current,p=m.creditAmount,h=m.durationSpec.current,{interest:y,effectiveInterest:f}=m.interests,S=[{key:"Kontantinsats",value:k(u,{postfix:"kr"})},{key:"L\xE5nebelopp",value:k(p,{postfix:"kr"})},{key:"Avbetalningsperoid",value:`${h} m\xE5n`},{key:"M\xE5nadskostnad f\xF6r l\xE5net",value:k(u,{postfix:"kr*"})}],A=l.creditAssessmentResponse?.recommendation,P=`*Ber\xE4knat p\xE5 ${k(y*100,{decimals:2})} % r\xE4nta (effektivt ${k(f*100,{decimals:2})} %). Den r\xE4nta du f\xE5r s\xE4tts vid avtalskrivning.`;this.node.innerHTML=`
1008
+ `,onClickInformation:()=>{d("MAIN","FINANCIAL_LOAN_DOWNPAYMENT_INFORMATION_TOGGLE","FINANCIAL")}}),this.contexts.duration=new Ue(this.node.querySelector(`#${da}`),{title:"Avbetalning",value:this.paymentState.duration.current,id:Rl,name:"duration",onChange:l=>this.onChange(l),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 Ue(this.node.querySelector(`#${ma}`),{title:"Restv\xE4rde",value:parseInt(`${this.paymentState.residual.current*100}`,10),id:Ol,name:"residual",onChange:l=>this.onChange(l),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 ca(this.node.querySelector(`#${ka}`),{}),this.contexts.loanDetails=new ra(this.node.querySelector(`#${pa}`),{loan:t,paymentLookupResponse:this.paymentLookupResponse}),c?new Jn(this.node.querySelector(`#${ua}`),{store:e,loan:t,paymentLookupResponse:this.paymentLookupResponse,onProceed:()=>s()}):this.contexts.proceedButton=new g(this.node.querySelector(`#${ha}`),{title:"G\xE5 vidare",id:ya,onClick:()=>s()})}},va=Ts;import{PaymentType as Ea}from"@wayke-se/ecom";var bl="credit-assessment-result",Ia=`${bl}-node`,Cs=class extends r{constructor(e,t){super(e,{htmlTag:"div"});this.props=t,this.render()}render(){let{store:e,paymentType:t,loan:s,paymentLookupResponse:n,onEdit:a}=this.props,c=s?.loanDetails;if(t===Ea.Loan){let l=this.props.store.getState(),m=n||c;if(!c||!m)throw"Missing loan";let u=m.downPaymentSpec.current,p=m.creditAmount,h=m.durationSpec.current,{interest:y,effectiveInterest:f}=m.interests,S=[{key:"Kontantinsats",value:k(u,{postfix:"kr"})},{key:"L\xE5nebelopp",value:k(p,{postfix:"kr"})},{key:"Avbetalningsperoid",value:`${h} m\xE5n`},{key:"M\xE5nadskostnad f\xF6r l\xE5net",value:k(u,{postfix:"kr*"})}],A=l.creditAssessmentResponse?.recommendation,P=`*Ber\xE4knat p\xE5 ${k(y*100,{decimals:2})} % r\xE4nta (effektivt ${k(f*100,{decimals:2})} %). Den r\xE4nta du f\xE5r s\xE4tts vid avtalskrivning.`;this.node.innerHTML=`
1009
1009
  <div class="waykeecom-stack waykeecom-stack--2">
1010
1010
  <h4 class="waykeecom-heading waykeecom-heading--4">Bill\xE5n</h4>
1011
1011
  <div class="waykeecom-content">