@wayke-se/ecom-web 0.0.7-beta.1 → 0.0.7-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- (()=>{var Lc=Object.create;var Vo=Object.defineProperty;var Oc=Object.getOwnPropertyDescriptor;var bc=Object.getOwnPropertyNames;var Mc=Object.getPrototypeOf,xc=Object.prototype.hasOwnProperty;var _=(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')});var Pc=(o,i,e,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let s of bc(i))!xc.call(o,s)&&s!==e&&Vo(o,s,{get:()=>i[s],enumerable:!(t=Oc(i,s))||t.enumerable});return o};var $c=(o,i,e)=>(e=o!=null?Lc(Mc(o)):{},Pc(i||!o||!o.__esModule?Vo(e,"default",{value:o,enumerable:!0}):e,o));var Nc=_("@wayke-se/ecom");var Hc="@wayke-se/ecom-web",Bc="0.0.7-beta.1",Uc="Wayke Ecom Web",Fc="dist/index.mjs",Vc="dist/index.js",Gc="dist/index.d.ts",qc={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"},Wc="Wayke",Kc="ISC",Yc={"@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":"^3.0.0",typescript:"^4.5.5"},Qc={"@wayke-se/ecom":"^3.7.0-alpha.10",marked:"^4.0.16","object-path":"^0.11.8",redux:"^4.1.2","sanitize-html":"^2.7.0"},jc=["dist"],Go={name:Hc,version:Bc,description:Uc,module:Fc,main:Vc,types:Gc,scripts:qc,author:Wc,license:Kc,devDependencies:Yc,dependencies:Qc,files:jc};var mi=_("redux");var Ae=_("@wayke-se/ecom");var Je=(o,i)=>o!==void 0&&i!==void 0?JSON.stringify(o).localeCompare(JSON.stringify(i))===0:o===i;var Se=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()}),qo=o=>({status:o.getStatus(),hasPendingSigning:o.hasPendingSigning(),hintCode:o.getHintCode(),signingMessage:o.getSigningMessage(),shouldRenewSigning:o.shouldRenewSigning(),isSigned:o.isSigned(),address:o.getAddress(),pendingScoring:o.hasPendingScoring(),isScored:o.isScored(),hasScoringError:o.hasScoringError(),scoringId:o.getScoringId(),recommendation:o.getRecommendation(),decision:o.getDecision(),isAccepted:o.isAccepted()}),be=o=>({orderVehicle:o.getOrderVehicle(),accessories:o.getAccessories(),requiresDealerSelection:o.requiresDealerSelection(),dealerSites:o.getDealerSites(),paymentOptions:o.getPaymentOptions().map(e=>({...e,loanDetails:e.loanDetails?Se(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()}),Wo=o=>({vehicle:o.getVehicle()});var Ze="RESET",Ko=o=>i=>i({type:Ze,id:o}),Xe="SET_ORDER",Me=(o,i)=>e=>e({type:Xe,order:o,vehicle:i}),et="SET_ID",Yo=o=>i=>i({type:et,id:o}),tt="SET_CONTACT_EMAIL_AND_PHONE",Qo=o=>i=>i({type:tt,value:o}),st="SET_SOCIAL_ID_AND_ADDRESS",jo=(o,i,e)=>t=>t({type:st,socialId:o,address:i,lastStage:e}),ot="SET_HOME_DELIVERY",zo=(o,i)=>e=>e({type:ot,homeDelivery:o,lastStage:i}),it="SET_DEALER",Jo=(o,i)=>e=>e({type:it,dealer:o,lastStage:i}),nt="INIT_TRADE_IN",Zo=o=>i=>i({type:nt,lastStage:o}),at="SET_TRADE_IN",we=(o,i,e)=>t=>t({type:at,lastStage:o,tradeIn:i,tradeInVehicle:e}),rt="SET_FINANCIAL",Xo=(o,i)=>e=>e({type:rt,paymentType:o,lastStage:i}),ct="SET_PAYMENT_LOOKUP_RESPONSE",ei=o=>i=>i({type:ct,paymentLookupResponse:Se(o)}),lt="SET_DRIVING_DISTANCE",ti=o=>i=>i({type:lt,drivingDistance:o}),dt="COMPLETE_STAGE",Z=o=>i=>i({type:dt,lastStage:o}),mt="SET_OR_REMOVE_INSURANCE",pe=o=>i=>i({type:mt,insurance:o}),pt="SET_OR_REMOVE_INSURANCE_ADDONS",si=(o,i)=>e=>e({type:pt,insurance:o,insuranceAddons:i}),ut="SET_OR_REMOVE_FREE_INSURANCE",oi=o=>i=>i({type:ut,freeInsurance:o}),ht="SET_OR_REMOVE_ACCESSORY",ii=o=>i=>i({type:ht,accessory:o}),kt="GO_TO",b=(o,i,e)=>t=>t({type:kt,view:o,index:i,subStage:e}),yt="SET_STAGES",ni=o=>i=>i({type:yt,stages:o}),vt="SET_CREATED_ORDER_ID",ai=(o,i)=>e=>e({type:vt,id:o,payment:i}),Et="SET_CREDIT_ASSESSMENT_RESPONSE",Ne=(o,i)=>e=>e({type:Et,caseId:o,creditAssessmentResponse:i}),It="SET_STATE",ri=o=>i=>i({type:It,state:o});var gt={};try{gt=_("../../statemock.json")}catch{gt={}}var ci={view:"preview",stage:1,subStage:1},li={id:"",topNavigation:{...ci},navigation:{...ci},customer:{email:"",phone:"",givenName:"",surname:"",socialId:""},homeDelivery:!1,accessories:[],drivingDistance:Ae.DrivingDistance.Between0And1000,...gt},re=(o,i)=>i?{view:"summary",stage:1,subStage:1}:{view:"main",stage:o+1,subStage:1},ce=(o,i)=>i.view==="main"?o.stage<i.stage?i:v.topNavigation:{...o,stage:o.stage+1},_t=o=>o&&o?.length===1&&o?.[0].type===Ae.PaymentType.Cash?Ae.PaymentType.Cash:void 0,v,ft,zc=(o=li,i)=>{let e,t;switch(v={...o},i.type){case Ze:return{...li,id:i.id};case yt:return{...v,stages:i.stages};case et:return{...v,id:i.id};case Xe:return{...o,order:i.order,paymentType:_t(i.order?.paymentOptions),vehicle:{...i.order.orderVehicle,...i.vehicle||{}}};case tt: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=_t(o.order?.paymentOptions),delete s.paymentLookupResponse,delete s.insurance,delete s.insuranceAddOns,delete s.freeInsurance,delete s.dealer,s.accessories=[],s;case st:return e=re(v.navigation.stage,i.lastStage),t=ce(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,address:i.address,customer:{...o.customer,socialId:i.socialId}},v;case it:return e=re(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=_t(o.order?.paymentOptions),delete v.paymentLookupResponse,delete v.insurance,delete v.insuranceAddOns,delete v.freeInsurance,v.accessories=[],v;case ot:return e=re(o.navigation.stage,i.lastStage),t=ce(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,homeDelivery:i.homeDelivery},v;case nt:return e={view:"main",stage:o.navigation.stage,subStage:1},t=ce(v.topNavigation,e),v={...o,navigation:e,wantTradeIn:!0,topNavigation:t,tradeIn:o.tradeIn||{registrationNumber:"",mileage:"",description:""}},v;case at:return e=re(o.navigation.stage,i.lastStage),t=ce(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,wantTradeIn:!!i.tradeIn,tradeIn:i.tradeIn,tradeInVehicle:i.tradeInVehicle},v;case rt:return e=re(o.navigation.stage,i.lastStage),t=ce(v.topNavigation,e),{...v,navigation:e,topNavigation:t,paymentType:i.paymentType};case ct:return{...v,paymentLookupResponse:i.paymentLookupResponse};case lt:return{...v,drivingDistance:i.drivingDistance};case dt:return e=re(o.navigation.stage,i.lastStage),t=ce(v.topNavigation,e),v={...o,navigation:e,topNavigation:t},v;case pt:return v.insurance=i.insurance,v.insuranceAddOns={insurance:i.insurance.name,addOns:i.insuranceAddons},v;case mt:return Je(v.insurance,i.insurance)?v.insurance=void 0:v.insurance=i.insurance,v.insuranceAddOns?.insurance&&(v.insuranceAddOns=void 0),v;case ut:return Je(v.freeInsurance,i.freeInsurance)?v.freeInsurance=void 0:v.freeInsurance=i.freeInsurance,v;case ht:return ft=v.accessories.findIndex(n=>n.id===i.accessory.id),v.accessories=[...v.accessories],ft>-1?v.accessories.splice(ft,1):v.accessories.push(i.accessory),{...v,accessories:[...v.accessories]};case kt:return{...o,navigation:{view:i.view,stage:i.index||1,subStage:i.subStage||1}};case vt:return i.payment?e={view:"main",stage:o.navigation.stage,subStage:2}:e=re(o.navigation.stage,!0),t=ce(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,createdOrderId:i.id,payment:i.payment},v;case Et:return{...v,caseId:i.caseId,creditAssessmentResponse:i.creditAssessmentResponse};case It:return{...i.state};default:return o}},di=zc;var pi=()=>(0,mi.createStore)(di);var Jc=o=>o.toString().replace(/\s/g,""),Zc=(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=Zc(o,i?.decimals!==void 0?i.decimals:0);return`${i?.prefix?`${i.prefix}`:""}${Jc(e).replace(/\B(?=(\d{3})+(?!\d))/g," ")}${i?.postfix?` ${i.postfix}`:""}`};var Xc=({vehicle:o,order:i,meta:e})=>{let t=o?.imageUrls,s=o?.title,n=o?.shortDescription,a=k(o?.price||NaN),c=i?.contactInformation?.name;return`
1
+ (()=>{var Lc=Object.create;var Vo=Object.defineProperty;var Oc=Object.getOwnPropertyDescriptor;var bc=Object.getOwnPropertyNames;var Mc=Object.getPrototypeOf,xc=Object.prototype.hasOwnProperty;var _=(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')});var Pc=(o,i,e,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let s of bc(i))!xc.call(o,s)&&s!==e&&Vo(o,s,{get:()=>i[s],enumerable:!(t=Oc(i,s))||t.enumerable});return o};var $c=(o,i,e)=>(e=o!=null?Lc(Mc(o)):{},Pc(i||!o||!o.__esModule?Vo(e,"default",{value:o,enumerable:!0}):e,o));var Nc=_("@wayke-se/ecom");var Hc="@wayke-se/ecom-web",Bc="0.0.7-beta.2",Uc="Wayke Ecom Web",Fc="dist/index.mjs",Vc="dist/index.js",Gc="dist/index.d.ts",qc={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"},Wc="Wayke",Kc="ISC",Yc={"@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":"^3.0.0",typescript:"^4.5.5"},Qc={"@wayke-se/ecom":"^3.7.0-alpha.10",marked:"^4.0.16","object-path":"^0.11.8",redux:"^4.1.2","sanitize-html":"^2.7.0"},jc=["dist"],Go={name:Hc,version:Bc,description:Uc,module:Fc,main:Vc,types:Gc,scripts:qc,author:Wc,license:Kc,devDependencies:Yc,dependencies:Qc,files:jc};var mi=_("redux");var Ae=_("@wayke-se/ecom");var Je=(o,i)=>o!==void 0&&i!==void 0?JSON.stringify(o).localeCompare(JSON.stringify(i))===0:o===i;var Se=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()}),qo=o=>({status:o.getStatus(),hasPendingSigning:o.hasPendingSigning(),hintCode:o.getHintCode(),signingMessage:o.getSigningMessage(),shouldRenewSigning:o.shouldRenewSigning(),isSigned:o.isSigned(),address:o.getAddress(),pendingScoring:o.hasPendingScoring(),isScored:o.isScored(),hasScoringError:o.hasScoringError(),scoringId:o.getScoringId(),recommendation:o.getRecommendation(),decision:o.getDecision(),isAccepted:o.isAccepted()}),be=o=>({orderVehicle:o.getOrderVehicle(),accessories:o.getAccessories(),requiresDealerSelection:o.requiresDealerSelection(),dealerSites:o.getDealerSites(),paymentOptions:o.getPaymentOptions().map(e=>({...e,loanDetails:e.loanDetails?Se(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()}),Wo=o=>({vehicle:o.getVehicle()});var Ze="RESET",Ko=o=>i=>i({type:Ze,id:o}),Xe="SET_ORDER",Me=(o,i)=>e=>e({type:Xe,order:o,vehicle:i}),et="SET_ID",Yo=o=>i=>i({type:et,id:o}),tt="SET_CONTACT_EMAIL_AND_PHONE",Qo=o=>i=>i({type:tt,value:o}),st="SET_SOCIAL_ID_AND_ADDRESS",jo=(o,i,e)=>t=>t({type:st,socialId:o,address:i,lastStage:e}),ot="SET_HOME_DELIVERY",zo=(o,i)=>e=>e({type:ot,homeDelivery:o,lastStage:i}),it="SET_DEALER",Jo=(o,i)=>e=>e({type:it,dealer:o,lastStage:i}),nt="INIT_TRADE_IN",Zo=o=>i=>i({type:nt,lastStage:o}),at="SET_TRADE_IN",we=(o,i,e)=>t=>t({type:at,lastStage:o,tradeIn:i,tradeInVehicle:e}),rt="SET_FINANCIAL",Xo=(o,i)=>e=>e({type:rt,paymentType:o,lastStage:i}),ct="SET_PAYMENT_LOOKUP_RESPONSE",ei=o=>i=>i({type:ct,paymentLookupResponse:Se(o)}),lt="SET_DRIVING_DISTANCE",ti=o=>i=>i({type:lt,drivingDistance:o}),dt="COMPLETE_STAGE",Z=o=>i=>i({type:dt,lastStage:o}),mt="SET_OR_REMOVE_INSURANCE",pe=o=>i=>i({type:mt,insurance:o}),pt="SET_OR_REMOVE_INSURANCE_ADDONS",si=(o,i)=>e=>e({type:pt,insurance:o,insuranceAddons:i}),ut="SET_OR_REMOVE_FREE_INSURANCE",oi=o=>i=>i({type:ut,freeInsurance:o}),ht="SET_OR_REMOVE_ACCESSORY",ii=o=>i=>i({type:ht,accessory:o}),kt="GO_TO",b=(o,i,e)=>t=>t({type:kt,view:o,index:i,subStage:e}),yt="SET_STAGES",ni=o=>i=>i({type:yt,stages:o}),vt="SET_CREATED_ORDER_ID",ai=(o,i)=>e=>e({type:vt,id:o,payment:i}),Et="SET_CREDIT_ASSESSMENT_RESPONSE",Ne=(o,i)=>e=>e({type:Et,caseId:o,creditAssessmentResponse:i}),It="SET_STATE",ri=o=>i=>i({type:It,state:o});var gt={};try{gt=_("../../statemock.json")}catch{gt={}}var ci={view:"preview",stage:1,subStage:1},li={id:"",topNavigation:{...ci},navigation:{...ci},customer:{email:"",phone:"",givenName:"",surname:"",socialId:""},homeDelivery:!1,accessories:[],drivingDistance:Ae.DrivingDistance.Between0And1000,...gt},re=(o,i)=>i?{view:"summary",stage:1,subStage:1}:{view:"main",stage:o+1,subStage:1},ce=(o,i)=>i.view==="main"?o.stage<i.stage?i:v.topNavigation:{...o,stage:o.stage+1},_t=o=>o&&o?.length===1&&o?.[0].type===Ae.PaymentType.Cash?Ae.PaymentType.Cash:void 0,v,ft,zc=(o=li,i)=>{let e,t;switch(v={...o},i.type){case Ze:return{...li,id:i.id};case yt:return{...v,stages:i.stages};case et:return{...v,id:i.id};case Xe:return{...o,order:i.order,paymentType:_t(i.order?.paymentOptions),vehicle:{...i.order.orderVehicle,...i.vehicle||{}}};case tt: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=_t(o.order?.paymentOptions),delete s.paymentLookupResponse,delete s.insurance,delete s.insuranceAddOns,delete s.freeInsurance,delete s.dealer,s.accessories=[],s;case st:return e=re(v.navigation.stage,i.lastStage),t=ce(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,address:i.address,customer:{...o.customer,socialId:i.socialId}},v;case it:return e=re(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=_t(o.order?.paymentOptions),delete v.paymentLookupResponse,delete v.insurance,delete v.insuranceAddOns,delete v.freeInsurance,v.accessories=[],v;case ot:return e=re(o.navigation.stage,i.lastStage),t=ce(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,homeDelivery:i.homeDelivery},v;case nt:return e={view:"main",stage:o.navigation.stage,subStage:1},t=ce(v.topNavigation,e),v={...o,navigation:e,wantTradeIn:!0,topNavigation:t,tradeIn:o.tradeIn||{registrationNumber:"",mileage:"",description:""}},v;case at:return e=re(o.navigation.stage,i.lastStage),t=ce(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,wantTradeIn:!!i.tradeIn,tradeIn:i.tradeIn,tradeInVehicle:i.tradeInVehicle},v;case rt:return e=re(o.navigation.stage,i.lastStage),t=ce(v.topNavigation,e),{...v,navigation:e,topNavigation:t,paymentType:i.paymentType};case ct:return{...v,paymentLookupResponse:i.paymentLookupResponse};case lt:return{...v,drivingDistance:i.drivingDistance};case dt:return e=re(o.navigation.stage,i.lastStage),t=ce(v.topNavigation,e),v={...o,navigation:e,topNavigation:t},v;case pt:return v.insurance=i.insurance,v.insuranceAddOns={insurance:i.insurance.name,addOns:i.insuranceAddons},v;case mt:return Je(v.insurance,i.insurance)?v.insurance=void 0:v.insurance=i.insurance,v.insuranceAddOns?.insurance&&(v.insuranceAddOns=void 0),v;case ut:return Je(v.freeInsurance,i.freeInsurance)?v.freeInsurance=void 0:v.freeInsurance=i.freeInsurance,v;case ht:return ft=v.accessories.findIndex(n=>n.id===i.accessory.id),v.accessories=[...v.accessories],ft>-1?v.accessories.splice(ft,1):v.accessories.push(i.accessory),{...v,accessories:[...v.accessories]};case kt:return{...o,navigation:{view:i.view,stage:i.index||1,subStage:i.subStage||1}};case vt:return i.payment?e={view:"main",stage:o.navigation.stage,subStage:2}:e=re(o.navigation.stage,!0),t=ce(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,createdOrderId:i.id,payment:i.payment},v;case Et:return{...v,caseId:i.caseId,creditAssessmentResponse:i.creditAssessmentResponse};case It:return{...i.state};default:return o}},di=zc;var pi=()=>(0,mi.createStore)(di);var Jc=o=>o.toString().replace(/\s/g,""),Zc=(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=Zc(o,i?.decimals!==void 0?i.decimals:0);return`${i?.prefix?`${i.prefix}`:""}${Jc(e).replace(/\B(?=(\d{3})+(?!\d))/g," ")}${i?.postfix?` ${i.postfix}`:""}`};var Xc=({vehicle:o,order:i,meta:e})=>{let t=o?.imageUrls,s=o?.title,n=o?.shortDescription,a=k(o?.price||NaN),c=i?.contactInformation?.name;return`
2
2
  <div class="waykeecom-product-card">
3
3
  ${t?.length?`
4
4
  <div class="waykeecom-product-card__media">
@@ -718,7 +718,7 @@
718
718
  `,a&&this.node.querySelector("button")?.addEventListener("click",a)}},Qe=Es;var Ol="assessment-rejected-result",Bn=`${Ol}-node`,Vn="assessment-rejected-abort",Un=`${Vn}-node`,Is=class extends r{constructor(e,t){super(e);this.props=t,this.render()}render(){let{store:e,onGoBack:t}=this.props;this.node.innerHTML=`
719
719
  <div class="waykeecom-stack waykeecom-stack--4" id="${Bn}"></div>
720
720
  <div class="waykeecom-stack waykeecom-stack--4" id="${Un}"></div>
721
- `,new ae(this.node.querySelector(`#${Bn}`),{store:e,decision:Fn.CreditAssessmentRecommendation.Reject}),new Qe(this.node.querySelector(`#${Un}`),{title:"G\xE5 tillbaka",id:Vn,onClick:()=>t()})}},Gn=Is;var fs=class extends r{constructor(e,t){super(e);this.props=t,this.render()}render(){let{store:e,creditAssessmentResponse:t,onProceed:s,onGoBack:n}=this.props,a=t.recommendation;a===_s.CreditAssessmentRecommendation.Approve?new Ln(this.node,{store:e,onProceed:()=>s(),onGoBack:()=>n()}):a===_s.CreditAssessmentRecommendation.AssessManually?new Hn(this.node,{store:e,onProceed:()=>s(),onGoBack:()=>n()}):new Gn(this.node,{store:e,onGoBack:()=>n()})}},qn=fs;var bl=o=>{let i=o>0,e=o%12===0;if(!i||!e)throw new TypeError("Invalid months for creating creidt assessment term");return`${o}months`},Wn=bl;var Ml="credit-assessment-martial-status",Kn=`${Ml}-node`,ws="credit-assessment-income",gs=`${ws}-node`,xl="credit-assessment-employment",Yn=`${xl}-node`,ta="credit-assessment-household-children",Qn=`${ta}-node`,sa="credit-assessment-household-income",jn=`${sa}-node`,oa="credit-assessment-household-housing-cost",zn=`${oa}-node`,ia="credit-assessment-household-debt",Jn=`${ia}-node`,na="credit-assessment-perform-application",Ss=`${na}-node`,Zn="disclaimer-node",Xn="disclaimer-safe-node",ea="why-description-node",J={maritalStatus:D.requiredAssessmentMaritalStatus,income:D.requiredNumber,employment:D.requiredAssessmentEmplyment,householdChildren:D.requiredNumber,householdIncome:D.requiredNumber,householdHousingCost:D.requiredNumber,householdDebt:D.requiredNumber},Pl=o=>{let i={maritalStatus:o?.maritalStatus||"",income:o?.income.toString()||"",employment:o?.employment.toString()||"",householdChildren:o?.householdChildren.toString()||"",householdIncome:o?.householdIncome.toString()||"",householdHousingCost:o?.householdHousingCost.toString()||"",householdDebt:o?.householdDebt.toString()||""};return{value:i,validation:{maritalStatus:J.maritalStatus(i.maritalStatus),income:J.income(i.income),employment:J.employment(i.employment),householdChildren:J.householdChildren(i.householdChildren),householdIncome:J.householdIncome(i.householdIncome),householdHousingCost:J.householdHousingCost(i.householdHousingCost),householdDebt:J.householdDebt(i.householdDebt)},interact:{maritalStatus:!1,income:!1,employment:!1,householdChildren:!1,householdIncome:!1,householdHousingCost:!1,householdDebt:!1}}},Ns=class extends r{constructor(e,t){super(e);this.view=1;this.contexts={};this.bankidError=!1;this.props=t,this.state=Pl(),this.render()}onChange(e){let t=e.currentTarget,s=t.name,n=t.value;this.state.value[s]=n,this.state.validation[s]=J[s](n),this.updateUiError(s),this.updateProceedButton()}onBlur(e){let s=e.currentTarget.name;this.state.interact[s]=!0,this.state.validation[s]=J[s](this.state.value[s]),this.updateUiError(s),this.updateProceedButton()}onChangeRadio(e){let t=e.currentTarget,s=t.name,n=t.value;this.state.value[s]=n,this.state.validation[s]=J[s](n),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.householdIncome||!this.state.validation.householdHousingCost||!this.state.validation.householdDebt)}onAbort(){l("MAIN","FINANCIAL_CREDIT_SCORING_ABORTED","FINANCIAL_CREDIT_SCORING");let{store:e}=this.props;this.view=1,this.bankidStatusInterval&&clearInterval(this.bankidStatusInterval);let t=e.getState().caseId;t&&(Re(t),Ne()(e.dispatch)),O(),this.creditAssessmentResponse=void 0,this.render(!0)}bankIdStatus(e,t){let s=this.props.store.getState().order?.paymentOptions.find(n=>n.type===R.PaymentType.Loan);this.bankidStatusInterval=setInterval(async()=>{try{l("MAIN",t===R.AuthMethod.SameDevice?"FINANCIAL_CREDIT_SCORING_BANKID_STATUS_SAME_DEVICE_REQUESTED":"FINANCIAL_CREDIT_SCORING_BANKID_STATUS_QR_REQUESTED","FINANCIAL_CREDIT_SCORING");let n=await _n(e);l("MAIN",t===R.AuthMethod.SameDevice?"FINANCIAL_CREDIT_SCORING_BANKID_STATUS_SAME_DEVICE_SUCCEEDED":"FINANCIAL_CREDIT_SCORING_BANKID_STATUS_QR_SUCCEEDED","FINANCIAL_CREDIT_SCORING"),n.getStatus()==="signed"&&(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),l("MAIN","FINANCIAL_CREDIT_SCORING_SIGNING_SIGNED","FINANCIAL_CREDIT_SCORING")),n.isScored()?(l("MAIN","FINANCIAL_CREDIT_SCORING_SIGNING_SCORED","FINANCIAL_CREDIT_SCORING"),this.bankidStatusInterval&&clearInterval(this.bankidStatusInterval),this.view=3,this.creditAssessmentResponse=qo(n),Ne(e,this.creditAssessmentResponse)(this.props.store.dispatch),O(),this.render()):n.shouldRenewSigning()&&(l("MAIN",t===R.AuthMethod.SameDevice?"FINANCIAL_CREDIT_SCORING_BANKID_STATUS_SAME_DEVICE_SHOULD_RENEW":"FINANCIAL_CREDIT_SCORING_BANKID_STATUS_QR_SHOULD_RENEW","FINANCIAL_CREDIT_SCORING"),this.onStartBankIdAuth(t))}catch{clearInterval(this.bankidStatusInterval),this.contexts.bankId?.setErrorMessage("Det gick inte att h\xE4mta status kring nuvanrade BankId signering. Nytt f\xF6rs\xF6k sker igenom om 2 sekunder"),l("MAIN",t===R.AuthMethod.SameDevice?"FINANCIAL_CREDIT_SCORING_BANKID_STATUS_SAME_DEVICE_FAILED":"FINANCIAL_CREDIT_SCORING_BANKID_STATUS_QR_FAILED","FINANCIAL_CREDIT_SCORING")}},2e3)}async onStartBankIdAuth(e){let t=this.props.store.getState().caseId;if(!t)throw"Missing caseID";this.bankidStatusInterval&&clearInterval(this.bankidStatusInterval);try{l("MAIN","FINANCIAL_CREDIT_SCORING_BANKID_INIT_REQUESTED","FINANCIAL_CREDIT_SCORING"),this.contexts.bankId?.update(e);let s=await wn({caseId:t,method:e});if(l("MAIN","FINANCIAL_CREDIT_SCORING_BANKID_INIT_SUCCEEDED","FINANCIAL_CREDIT_SCORING"),this.bankIdStatus(t,e),e===R.AuthMethod.SameDevice){let n=s.getAutoLaunchUrl();this.contexts.bankId?.update(e,n)}else{let n=s.getQrCode();this.contexts.bankId?.update(e,n)}}catch{l("MAIN","FINANCIAL_CREDIT_SCORING_BANKID_INIT_FAILED","FINANCIAL_CREDIT_SCORING"),this.bankidStatusInterval&&clearInterval(this.bankidStatusInterval),this.bankidError=!0,this.view=1,O(),this.render(!0)}}async startBankId(e){let{store:t}=this.props;this.caseError=void 0,this.bankidError=!1;let s=t.getState().caseId;this.bankidStatusInterval&&(clearInterval(this.bankidStatusInterval),s&&(Re(s),Ne()(t.dispatch)));try{l("MAIN","FINANCIAL_CREDIT_SCORING_CREATE_CASE_REQUESTED","FINANCIAL_CREDIT_SCORING");let n=s||await this.newCreditAssessmentCase();l("MAIN","FINANCIAL_CREDIT_SCORING_CREATE_CASE_SUCCEEDED","FINANCIAL_CREDIT_SCORING"),n&&(Ne(n)(t.dispatch),this.onStartBankIdAuth(e))}catch{l("MAIN","FINANCIAL_CREDIT_SCORING_CREATE_CASE_FAILED","FINANCIAL_CREDIT_SCORING")}}async newCreditAssessmentCase(){try{let{store:e,loan:t,paymentLookupResponse:s}=this.props;this.contexts.performApplicationButton?.disabled(!0);let{customer:n}=e.getState(),{monthlyCost:a}=s.costs,{interest:c}=s.interests,d=s.downPaymentSpec.current,m=s.durationSpec.current,u=s.creditAmount,p=s.price,y=s.financialProductCode,h={customer:{...n},householdEconomy:this.state.value,externalId:t.externalId,loan:{downPayment:d,interestRate:c,credit:u,financialProductId:y,monthlyCost:a,price:p,term:Wn(m)}};return(await gn(h)).caseId}catch(e){this.bankidStatusInterval&&clearInterval(this.bankidStatusInterval),this.caseError=e?.message||"",this.view=1,this.render(!0);return}finally{this.contexts.performApplicationButton?.disabled(!1)}}render(e){let{store:t,paymentLookupResponse:s,onProceed:n}=this.props,a=Ie(),{order:c}=t.getState(),d=c?.paymentOptions.find(p=>p.type===R.PaymentType.Loan),m=s.creditAmount,u=c?.contactInformation?.name;this.view===3&&this.creditAssessmentResponse?new qn(K(),{store:t,creditAssessmentResponse:this.creditAssessmentResponse,onProceed:()=>{O(),n()},onGoBack:()=>this.onAbort()}):this.view===2?(this.contexts.bankId=new Ye(K(),{method:a?R.AuthMethod.SameDevice:R.AuthMethod.QrCode,descriptionQrCode:"F\xF6r att h\xE4mta dina uppgifter, starta din BankID applikation p\xE5 din andra enhet.",descriptionSameDevice:"F\xF6r att h\xE4mta dina uppgifter, starta din BankID-applikation.",onAbort:()=>this.onAbort(),onStart:p=>this.startBankId(p)}),F()):(this.node.innerHTML=`
721
+ `,new ae(this.node.querySelector(`#${Bn}`),{store:e,decision:Fn.CreditAssessmentRecommendation.Reject}),new Qe(this.node.querySelector(`#${Un}`),{title:"G\xE5 tillbaka",id:Vn,onClick:()=>t()})}},Gn=Is;var fs=class extends r{constructor(e,t){super(e);this.props=t,this.render()}render(){let{store:e,creditAssessmentResponse:t,onProceed:s,onGoBack:n}=this.props,a=t.recommendation;a===_s.CreditAssessmentRecommendation.Approve?new Ln(this.node,{store:e,onProceed:()=>s(),onGoBack:()=>n()}):a===_s.CreditAssessmentRecommendation.AssessManually?new Hn(this.node,{store:e,onProceed:()=>s(),onGoBack:()=>n()}):new Gn(this.node,{store:e,onGoBack:()=>n()})}},qn=fs;var bl=o=>{let i=o>0,e=o%12===0;if(!i||!e)throw new TypeError("Invalid months for creating creidt assessment term");return`${o}months`},Wn=bl;var Ml="credit-assessment-martial-status",Kn=`${Ml}-node`,ws="credit-assessment-income",gs=`${ws}-node`,xl="credit-assessment-employment",Yn=`${xl}-node`,ta="credit-assessment-household-children",Qn=`${ta}-node`,sa="credit-assessment-household-income",jn=`${sa}-node`,oa="credit-assessment-household-housing-cost",zn=`${oa}-node`,ia="credit-assessment-household-debt",Jn=`${ia}-node`,na="credit-assessment-perform-application",Ss=`${na}-node`,Zn="disclaimer-node",Xn="disclaimer-safe-node",ea="why-description-node",J={maritalStatus:D.requiredAssessmentMaritalStatus,income:D.requiredNumber,employment:D.requiredAssessmentEmplyment,householdChildren:D.requiredNumber,householdIncome:D.requiredNumber,householdHousingCost:D.requiredNumber,householdDebt:D.requiredNumber},Pl=o=>{let i={maritalStatus:o?.maritalStatus||"",income:o?.income.toString()||"",employment:o?.employment.toString()||"",householdChildren:o?.householdChildren.toString()||"",householdIncome:o?.householdIncome.toString()||"",householdHousingCost:o?.householdHousingCost.toString()||"",householdDebt:o?.householdDebt.toString()||""};return{value:i,validation:{maritalStatus:J.maritalStatus(i.maritalStatus),income:J.income(i.income),employment:J.employment(i.employment),householdChildren:J.householdChildren(i.householdChildren),householdIncome:J.householdIncome(i.householdIncome),householdHousingCost:J.householdHousingCost(i.householdHousingCost),householdDebt:J.householdDebt(i.householdDebt)},interact:{maritalStatus:!1,income:!1,employment:!1,householdChildren:!1,householdIncome:!1,householdHousingCost:!1,householdDebt:!1}}},Ns=class extends r{constructor(e,t){super(e);this.view=1;this.contexts={};this.bankidError=!1;this.props=t,this.state=Pl(),this.render()}onChange(e){let t=e.currentTarget,s=t.name,n=t.value;this.state.value[s]=n,this.state.validation[s]=J[s](n),this.updateUiError(s),this.updateProceedButton()}onBlur(e){let s=e.currentTarget.name;this.state.interact[s]=!0,this.state.validation[s]=J[s](this.state.value[s]),this.updateUiError(s),this.updateProceedButton()}onChangeRadio(e){let t=e.currentTarget,s=t.name,n=t.value;this.state.value[s]=n,this.state.validation[s]=J[s](n),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.householdIncome||!this.state.validation.householdHousingCost||!this.state.validation.householdDebt)}onAbort(){l("MAIN","FINANCIAL_CREDIT_SCORING_ABORTED","FINANCIAL_CREDIT_SCORING");let{store:e}=this.props;this.view=1,this.bankidStatusInterval&&clearInterval(this.bankidStatusInterval);let t=e.getState().caseId;t&&(Re(t),Ne()(e.dispatch)),O(),this.creditAssessmentResponse=void 0,this.render(!0)}bankIdStatus(e,t){let s=this.props.store.getState().order?.paymentOptions.find(n=>n.type===R.PaymentType.Loan);this.bankidStatusInterval=setInterval(async()=>{try{l("MAIN",t===R.AuthMethod.SameDevice?"FINANCIAL_CREDIT_SCORING_BANKID_STATUS_SAME_DEVICE_REQUESTED":"FINANCIAL_CREDIT_SCORING_BANKID_STATUS_QR_REQUESTED","FINANCIAL_CREDIT_SCORING");let n=await _n(e);l("MAIN",t===R.AuthMethod.SameDevice?"FINANCIAL_CREDIT_SCORING_BANKID_STATUS_SAME_DEVICE_SUCCEEDED":"FINANCIAL_CREDIT_SCORING_BANKID_STATUS_QR_SUCCEEDED","FINANCIAL_CREDIT_SCORING"),n.getStatus()==="signed"&&(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),l("MAIN","FINANCIAL_CREDIT_SCORING_SIGNING_SIGNED","FINANCIAL_CREDIT_SCORING")),n.isScored()?(l("MAIN","FINANCIAL_CREDIT_SCORING_SIGNING_SCORED","FINANCIAL_CREDIT_SCORING"),this.bankidStatusInterval&&clearInterval(this.bankidStatusInterval),this.view=3,this.creditAssessmentResponse=qo(n),Ne(e,this.creditAssessmentResponse)(this.props.store.dispatch),O(),this.render()):n.shouldRenewSigning()&&(l("MAIN",t===R.AuthMethod.SameDevice?"FINANCIAL_CREDIT_SCORING_BANKID_STATUS_SAME_DEVICE_SHOULD_RENEW":"FINANCIAL_CREDIT_SCORING_BANKID_STATUS_QR_SHOULD_RENEW","FINANCIAL_CREDIT_SCORING"),this.onStartBankIdAuth(t))}catch{clearInterval(this.bankidStatusInterval),this.contexts.bankId?.setErrorMessage("Det gick inte att h\xE4mta status kring nuvanrade BankId signering. Nytt f\xF6rs\xF6k sker igenom om 2 sekunder"),l("MAIN",t===R.AuthMethod.SameDevice?"FINANCIAL_CREDIT_SCORING_BANKID_STATUS_SAME_DEVICE_FAILED":"FINANCIAL_CREDIT_SCORING_BANKID_STATUS_QR_FAILED","FINANCIAL_CREDIT_SCORING")}},2e3)}async onStartBankIdAuth(e){let t=this.props.store.getState().caseId;if(!t)throw"Missing caseID";this.bankidStatusInterval&&clearInterval(this.bankidStatusInterval);try{l("MAIN","FINANCIAL_CREDIT_SCORING_BANKID_INIT_REQUESTED","FINANCIAL_CREDIT_SCORING"),this.contexts.bankId?.update(e);let s=await wn({caseId:t,method:e});if(l("MAIN","FINANCIAL_CREDIT_SCORING_BANKID_INIT_SUCCEEDED","FINANCIAL_CREDIT_SCORING"),this.bankIdStatus(t,e),e===R.AuthMethod.SameDevice){let n=s.getAutoLaunchUrl();this.contexts.bankId?.update(e,n)}else{let n=s.getQrCode();this.contexts.bankId?.update(e,n)}}catch{l("MAIN","FINANCIAL_CREDIT_SCORING_BANKID_INIT_FAILED","FINANCIAL_CREDIT_SCORING"),this.bankidStatusInterval&&clearInterval(this.bankidStatusInterval),this.bankidError=!0,this.view=1,O(),this.render(!0)}}async startBankId(e){let{store:t}=this.props;this.caseError=void 0,this.bankidError=!1;let s=t.getState().caseId;this.bankidStatusInterval&&(clearInterval(this.bankidStatusInterval),s&&(await Re(s),Ne()(t.dispatch)));try{l("MAIN","FINANCIAL_CREDIT_SCORING_CREATE_CASE_REQUESTED","FINANCIAL_CREDIT_SCORING");let n=s||await this.newCreditAssessmentCase();l("MAIN","FINANCIAL_CREDIT_SCORING_CREATE_CASE_SUCCEEDED","FINANCIAL_CREDIT_SCORING"),n&&(Ne(n)(t.dispatch),this.onStartBankIdAuth(e))}catch{l("MAIN","FINANCIAL_CREDIT_SCORING_CREATE_CASE_FAILED","FINANCIAL_CREDIT_SCORING")}}async newCreditAssessmentCase(){try{let{store:e,loan:t,paymentLookupResponse:s}=this.props;this.contexts.performApplicationButton?.disabled(!0);let{customer:n}=e.getState(),{monthlyCost:a}=s.costs,{interest:c}=s.interests,d=s.downPaymentSpec.current,m=s.durationSpec.current,u=s.creditAmount,p=s.price,y=s.financialProductCode,h={customer:{...n},householdEconomy:this.state.value,externalId:t.externalId,loan:{downPayment:d,interestRate:c,credit:u,financialProductId:y,monthlyCost:a,price:p,term:Wn(m)}};return(await gn(h)).caseId}catch(e){this.bankidStatusInterval&&clearInterval(this.bankidStatusInterval),this.caseError=e?.message||"",this.view=1,this.render(!0);return}finally{this.contexts.performApplicationButton?.disabled(!1)}}render(e){let{store:t,paymentLookupResponse:s,onProceed:n}=this.props,a=Ie(),{order:c}=t.getState(),d=c?.paymentOptions.find(p=>p.type===R.PaymentType.Loan),m=s.creditAmount,u=c?.contactInformation?.name;this.view===3&&this.creditAssessmentResponse?new qn(K(),{store:t,creditAssessmentResponse:this.creditAssessmentResponse,onProceed:()=>{O(),n()},onGoBack:()=>this.onAbort()}):this.view===2?(this.contexts.bankId=new Ye(K(),{method:a?R.AuthMethod.SameDevice:R.AuthMethod.QrCode,descriptionQrCode:"F\xF6r att h\xE4mta dina uppgifter, starta din BankID applikation p\xE5 din andra enhet.",descriptionSameDevice:"F\xF6r att h\xE4mta dina uppgifter, starta din BankID-applikation.",onAbort:()=>this.onAbort(),onStart:p=>this.startBankId(p)}),F()):(this.node.innerHTML=`
722
722
  <div class="waykeecom-stack waykeecom-stack--3">
723
723
  <h5 class="waykeecom-heading waykeecom-heading--4">L\xE5neans\xF6kan</h5>
724
724
  <div class="waykeecom-content">