@wayke-se/ecom-web 1.7.0-beta.5 → 1.7.0-beta.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/dist/index.d.ts CHANGED
@@ -122,6 +122,7 @@ declare module '@wayke-se/ecom-web/src/@types/PaymentLookup' {
122
122
  hasPrivacyPolicy: boolean;
123
123
  privacyPolicyUrl: string | undefined;
124
124
  moneyLaunderingInformationURL: string | undefined;
125
+ financialOptionId: string | undefined;
125
126
  }
126
127
 
127
128
  }
@@ -1253,8 +1254,9 @@ declare module '@wayke-se/ecom-web/src/Data/getPayment' {
1253
1254
  duration: number;
1254
1255
  residual?: number;
1255
1256
  dealerId?: string;
1257
+ financialOptionId?: string;
1256
1258
  }
1257
- export const getPayment: ({ vehicleId, dealerId, downPayment, duration, residual, }: PaymentRequest) => Promise<import("@wayke-se/ecom/dist-types/payments/payment-lookup-response").PaymentLookupResponse>;
1259
+ export const getPayment: ({ vehicleId, dealerId, downPayment, duration, residual, financialOptionId, }: PaymentRequest) => Promise<import("@wayke-se/ecom/dist-types/payments/payment-lookup-response").PaymentLookupResponse>;
1258
1260
  export {};
1259
1261
 
1260
1262
  }
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";(()=>{var Zc=Object.create;var si=Object.defineProperty;var el=Object.getOwnPropertyDescriptor;var tl=Object.getOwnPropertyNames;var sl=Object.getPrototypeOf,ol=Object.prototype.hasOwnProperty;var g=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(i,e)=>(typeof require<"u"?require:i)[e]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+s+'" is not supported')});var il=(s,i,e,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of tl(i))!ol.call(s,o)&&o!==e&&si(s,o,{get:()=>i[o],enumerable:!(t=el(i,o))||t.enumerable});return s};var nl=(s,i,e)=>(e=s!=null?Zc(sl(s)):{},il(i||!s||!s.__esModule?si(e,"default",{value:s,enumerable:!0}):e,s));var Yc=g("@wayke-se/ecom");var oi={name:"@wayke-se/ecom-web",version:"1.7.0-beta.5",description:"Wayke Ecom Web",module:"dist/index.mjs",main:"dist/index.js",types:"dist/index.d.ts",homepage:"https://github.com/wayke-se/wayke-ecom-web",scripts:{start:"node ./esbuild/start.js",clip:"node ./esbuild/clip-ui.js && node ./clip-ui/start.js",build:"npm run clean && node ./esbuild/lib.js && node ./esbuild/cdn.js",clean:"rimraf build && rimraf dist && rimraf dist-cdn",test:"npm run lint && npm run typecheck",typecheck:"tsc -noEmit","typecheck:watch":"tsc -noEmit -watch",lint:"eslint --ext .ts,.js src","lint:fix":"eslint --ext .ts,.js 'src' --fix",stylelint:"stylelint '**/*.scss'",prepare:"husky install"},author:"Wayke",license:"ISC",devDependencies:{"@ourstudio/clip-ui":"^0.0.11","@types/marked":"^4.3.0","@types/node":"^17.0.18","@types/object-path":"^0.11.1","@types/sanitize-html":"^2.6.2","@typescript-eslint/eslint-plugin":"^5.12.0","@typescript-eslint/parser":"^5.12.0",esbuild:"^0.15.10","esbuild-sass-plugin":"2.3.3",eslint:"^8.9.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0",husky:"^8.0.1","npm-dts":"^1.3.11",prettier:"^2.5.1",rimraf:"^5.0.1",stylelint:"^15.2.0","stylelint-config-prettier-scss":"^1.0.0","stylelint-config-standard-scss":"^9.0.0",typescript:"^5.1.3"},dependencies:{"@wayke-se/ecom":"^4.4.1",marked:"^4.3.0","object-path":"^0.11.8",redux:"^4.1.2","sanitize-html":"^2.7.0"},files:["dist"]};var Ti=g("redux");var De=g("@wayke-se/ecom");var rt=(s,i)=>s!==void 0&&i!==void 0?JSON.stringify(s).localeCompare(JSON.stringify(i))===0:s===i;var Ae=s=>({costs:s.getCosts(),fees:s.getFees(),interests:s.getInterests(),durationSpec:s.getDurationSpec(),downPaymentSpec:s.getDownPaymentSpec(),residualValueSpec:s.getResidualValueSpec(),totalResidualValue:s.getTotalResidualValue(),publicURL:s.getPublicURL(),shouldUseCreditScoring:s.shouldUseCreditScoring(),financialProductCode:s.getFinancialProductCode(),price:s.getPrice(),creditAmount:s.getCreditAmount(),hasPrivacyPolicy:s.hasPrivacyPolicy(),privacyPolicyUrl:s.getPrivacyPolicyUrl(),moneyLaunderingInformationURL:s.getMoneyLaunderingInformationURL()}),ii=s=>({status:s.getStatus(),hasPendingSigning:s.hasPendingSigning(),hintCode:s.getHintCode(),signingMessage:s.getSigningMessage(),shouldRenewSigning:s.shouldRenewSigning(),isSigned:s.isSigned(),address:void 0,pendingScoring:s.hasPendingScoring(),isScored:s.isScored(),hasScoringError:s.hasScoringError(),scoringId:s.getScoringId(),recommendation:s.getRecommendation(),decision:s.getDecision(),isAccepted:s.isAccepted()}),$e=s=>({orderVehicle:s.getOrderVehicle(),accessories:s.getAccessories(),requiresDealerSelection:s.requiresDealerSelection(),dealerSites:s.getDealerSites(),paymentOptions:s.getPaymentOptions().map(e=>({...e,loanDetails:e.loanDetails?Ae(e.loanDetails):void 0})),deliveryOptions:s.getDeliveryOptions(),insuranceOption:s.getInsuranceOption(),orderConditions:s.getOrderConditions(),orderReturnConditions:s.getOrderReturnConditions(),conditionsPdfUri:s.getConditionsPdfUri(),contactInformation:s.getContactInformation(),allowsTradeIn:s.allowsTradeIn(),isUnavailable:s.isUnavailable(),isPaymentRequired:s.isPaymentRequired()}),ni=s=>({vehicle:s.getVehicle()});var ct="RESET",ai=s=>i=>i({type:ct,id:s}),lt="SET_ORDER",He=(s,i)=>e=>e({type:lt,order:s,vehicle:i}),dt="SET_ID",ri=s=>i=>i({type:dt,id:s}),mt="SET_CONTACT_EMAIL_AND_PHONE",ci=s=>i=>i({type:mt,value:s}),pt="SET_SOCIAL_ID_AND_ADDRESS",li=(s,i,e)=>t=>t({type:pt,socialId:s,address:i,lastStage:e}),ut="SET_HOME_DELIVERY",di=(s,i)=>e=>e({type:ut,homeDelivery:s,lastStage:i}),ht="SET_DEALER",mi=(s,i)=>e=>e({type:ht,dealer:s,lastStage:i}),kt="INIT_TRADE_IN",pi=s=>i=>i({type:kt,lastStage:s}),yt="SET_TRADE_IN",Ce=(s,i,e)=>t=>t({type:yt,lastStage:s,tradeIn:i,tradeInVehicle:e}),vt="SET_FINANCIAL",ui=(s,i)=>e=>e({type:vt,paymentType:s,lastStage:i}),Et="SET_PAYMENT_LOOKUP_RESPONSE",hi=s=>i=>i({type:Et,paymentLookupResponse:Ae(s)}),It="RESET_PAYMENT_LOOKUP_RESPONSE",ki=()=>s=>s({type:It}),ft="SET_DRIVING_DISTANCE",yi=s=>i=>i({type:ft,drivingDistance:s}),gt="COMPLETE_STAGE",ee=s=>i=>i({type:gt,lastStage:s}),_t="SET_OR_REMOVE_INSURANCE",ue=s=>i=>i({type:_t,insurance:s}),St="SET_OR_REMOVE_INSURANCE_ADDONS",vi=(s,i)=>e=>e({type:St,insurance:s,insuranceAddons:i}),wt="SET_OR_REMOVE_FREE_INSURANCE",Ei=s=>i=>i({type:wt,freeInsurance:s}),Nt="SET_OR_REMOVE_ACCESSORY",Ii=s=>i=>i({type:Nt,accessory:s}),Tt="GO_TO",M=(s,i,e)=>t=>t({type:Tt,view:s,index:i,subStage:e}),At="SET_STAGES",fi=s=>i=>i({type:At,stages:s}),Ct="SET_CREATED_ORDER_ID",gi=(s,i)=>e=>e({type:Ct,id:s,payment:i}),Dt="SET_CREDIT_ASSESSMENT_RESPONSE",he=(s,i)=>e=>e({type:Dt,caseId:s,creditAssessmentResponse:i}),bt="SET_STATE",_i=s=>i=>i({type:bt,state:s});var rl={};var Si={view:"preview",stage:1,subStage:1},wi={id:"",topNavigation:{...Si},navigation:{...Si},customer:{email:"",phone:"",givenName:"",surname:"",socialId:""},homeDelivery:!1,accessories:[],drivingDistance:De.DrivingDistance.Between0And1000,...rl},le=(s,i)=>i?{view:"summary",stage:1,subStage:1}:{view:"main",stage:s+1,subStage:1},de=(s,i)=>i.view==="main"?s.stage<i.stage?i:E.topNavigation:{...s,stage:s.stage+1},Rt=s=>s&&s?.length===1&&s?.[0].type===De.PaymentType.Cash?De.PaymentType.Cash:void 0,E,Lt,cl=(s=wi,i)=>{let e,t;switch(E={...s},i.type){case ct:return{...wi,id:i.id};case At:return{...E,stages:i.stages};case dt:return{...E,id:i.id};case lt:return{...s,order:i.order,paymentType:Rt(i.order?.paymentOptions),vehicle:{...i.order.orderVehicle,...i.vehicle||{}}};case mt:let o={...E,customer:{...s.customer,email:i.value.email,phone:i.value.phone},navigation:{view:"main",stage:s.navigation.stage,subStage:2}};return delete o.wantTradeIn,delete o.tradeIn,delete o.tradeInVehicle,o.paymentType=Rt(s.order?.paymentOptions),delete o.paymentLookupResponse,delete o.insurance,delete o.insuranceAddOns,delete o.freeInsurance,delete o.dealer,o.accessories=[],o;case pt:return e=le(E.navigation.stage,i.lastStage),t=de(E.topNavigation,e),E={...s,navigation:e,topNavigation:t,address:i.address,customer:{...s.customer,socialId:i.socialId}},E;case ht:return e=le(s.navigation.stage,i.lastStage),t={...e},E={...s,navigation:e,topNavigation:t,dealer:i.dealer},delete E.wantTradeIn,delete E.tradeIn,delete E.tradeInVehicle,E.paymentType=Rt(s.order?.paymentOptions),delete E.paymentLookupResponse,delete E.insurance,delete E.insuranceAddOns,delete E.freeInsurance,E.accessories=[],E;case ut:return e=le(s.navigation.stage,i.lastStage),t=de(E.topNavigation,e),E={...s,navigation:e,topNavigation:t,homeDelivery:i.homeDelivery},E;case kt:return e={view:"main",stage:s.navigation.stage,subStage:1},t=de(E.topNavigation,e),E={...s,navigation:e,wantTradeIn:!0,topNavigation:t,tradeIn:s.tradeIn||{registrationNumber:"",mileage:"",description:""}},E;case yt:return e=le(s.navigation.stage,i.lastStage),t=de(E.topNavigation,e),E={...s,navigation:e,topNavigation:t,wantTradeIn:!!i.tradeIn,tradeIn:i.tradeIn,tradeInVehicle:i.tradeInVehicle},E;case vt:return e=le(s.navigation.stage,i.lastStage),t=de(E.topNavigation,e),{...E,navigation:e,topNavigation:t,paymentType:i.paymentType};case It:return{...E,paymentLookupResponse:void 0};case Et:return{...E,paymentLookupResponse:i.paymentLookupResponse};case ft:return{...E,drivingDistance:i.drivingDistance};case gt:return e=le(s.navigation.stage,i.lastStage),t=de(E.topNavigation,e),E={...s,navigation:e,topNavigation:t},E;case St:return E.insurance=i.insurance,E.insuranceAddOns={insurance:i.insurance.name,addOns:i.insuranceAddons},E;case _t:return rt(E.insurance,i.insurance)?E.insurance=void 0:E.insurance=i.insurance,E.insuranceAddOns?.insurance&&(E.insuranceAddOns=void 0),E;case wt:return rt(E.freeInsurance,i.freeInsurance)?E.freeInsurance=void 0:E.freeInsurance=i.freeInsurance,E;case Nt:return Lt=E.accessories.findIndex(n=>n.id===i.accessory.id),E.accessories=[...E.accessories],Lt>-1?E.accessories.splice(Lt,1):E.accessories.push(i.accessory),{...E,accessories:[...E.accessories]};case Tt:return{...s,navigation:{view:i.view,stage:i.index||1,subStage:i.subStage||1}};case Ct:return i.payment?e={view:"main",stage:s.navigation.stage,subStage:2}:e=le(s.navigation.stage,!0),t=de(E.topNavigation,e),E={...s,navigation:e,topNavigation:t,createdOrderId:i.id,payment:i.payment},E;case Dt:return{...E,caseId:i.caseId,creditAssessmentResponse:i.creditAssessmentResponse};case bt:return{...i.state};default:return s}},Ni=cl;var Ai=()=>(0,Ti.createStore)(Ni);var Be=(s,i)=>{if(!i)return s;let e=new URL(s);return`${i}${e.pathname}`};var ll=s=>s.toString().replace(/\s/g,""),dl=(s,i)=>{if(!i)return s;let e=Math.pow(10,i);return(Math.round(s*e)/e).toFixed(i)},y=(s,i)=>{if(s===void 0)return"???";let e=dl(s,i?.decimals!==void 0?i.decimals:0);return`${i?.prefix?`${i.prefix}`:""}${ll(e).replace(/\B(?=(\d{3})+(?!\d))/g," ")}${i?.postfix?` ${i.postfix}`:""}`},ml=(s,i)=>{let e=s.split(" "),t=i.split(" ").map(o=>o.toLowerCase());return e.filter(o=>!t.includes(o.toLowerCase())).join(" ")},ke=s=>{if(!!s)return ml(s.shortDescription||"",s.title||"")};var pl=({vehicle:s,order:i,meta:e,cdnMedia:t})=>{let o=s?.imageUrls,n=s?.title,a=y(s?.price||NaN),c=i?.contactInformation?.name;return`
1
+ "use strict";(()=>{var Zc=Object.create;var si=Object.defineProperty;var el=Object.getOwnPropertyDescriptor;var tl=Object.getOwnPropertyNames;var sl=Object.getPrototypeOf,ol=Object.prototype.hasOwnProperty;var g=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(i,e)=>(typeof require<"u"?require:i)[e]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+s+'" is not supported')});var il=(s,i,e,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of tl(i))!ol.call(s,o)&&o!==e&&si(s,o,{get:()=>i[o],enumerable:!(t=el(i,o))||t.enumerable});return s};var nl=(s,i,e)=>(e=s!=null?Zc(sl(s)):{},il(i||!s||!s.__esModule?si(e,"default",{value:s,enumerable:!0}):e,s));var Yc=g("@wayke-se/ecom");var oi={name:"@wayke-se/ecom-web",version:"1.7.0-beta.6",description:"Wayke Ecom Web",module:"dist/index.mjs",main:"dist/index.js",types:"dist/index.d.ts",homepage:"https://github.com/wayke-se/wayke-ecom-web",scripts:{start:"node ./esbuild/start.js",clip:"node ./esbuild/clip-ui.js && node ./clip-ui/start.js",build:"npm run clean && node ./esbuild/lib.js && node ./esbuild/cdn.js",clean:"rimraf build && rimraf dist && rimraf dist-cdn",test:"npm run lint && npm run typecheck",typecheck:"tsc -noEmit","typecheck:watch":"tsc -noEmit -watch",lint:"eslint --ext .ts,.js src","lint:fix":"eslint --ext .ts,.js 'src' --fix",stylelint:"stylelint '**/*.scss'",prepare:"husky install"},author:"Wayke",license:"ISC",devDependencies:{"@ourstudio/clip-ui":"^0.0.11","@types/marked":"^4.3.0","@types/node":"^17.0.18","@types/object-path":"^0.11.1","@types/sanitize-html":"^2.6.2","@typescript-eslint/eslint-plugin":"^5.12.0","@typescript-eslint/parser":"^5.12.0",esbuild:"^0.15.10","esbuild-sass-plugin":"2.3.3",eslint:"^8.9.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0",husky:"^8.0.1","npm-dts":"^1.3.11",prettier:"^2.5.1",rimraf:"^5.0.1",stylelint:"^15.2.0","stylelint-config-prettier-scss":"^1.0.0","stylelint-config-standard-scss":"^9.0.0",typescript:"^5.1.3"},dependencies:{"@wayke-se/ecom":"^4.5.0-beta.3",marked:"^4.3.0","object-path":"^0.11.8",redux:"^4.1.2","sanitize-html":"^2.7.0"},files:["dist"]};var Ti=g("redux");var De=g("@wayke-se/ecom");var rt=(s,i)=>s!==void 0&&i!==void 0?JSON.stringify(s).localeCompare(JSON.stringify(i))===0:s===i;var Ae=s=>({costs:s.getCosts(),fees:s.getFees(),interests:s.getInterests(),durationSpec:s.getDurationSpec(),downPaymentSpec:s.getDownPaymentSpec(),residualValueSpec:s.getResidualValueSpec(),totalResidualValue:s.getTotalResidualValue(),publicURL:s.getPublicURL(),shouldUseCreditScoring:s.shouldUseCreditScoring(),financialProductCode:s.getFinancialProductCode(),price:s.getPrice(),creditAmount:s.getCreditAmount(),hasPrivacyPolicy:s.hasPrivacyPolicy(),privacyPolicyUrl:s.getPrivacyPolicyUrl(),moneyLaunderingInformationURL:s.getMoneyLaunderingInformationURL(),financialOptionId:s.getFinancialOptionId()}),ii=s=>({status:s.getStatus(),hasPendingSigning:s.hasPendingSigning(),hintCode:s.getHintCode(),signingMessage:s.getSigningMessage(),shouldRenewSigning:s.shouldRenewSigning(),isSigned:s.isSigned(),address:void 0,pendingScoring:s.hasPendingScoring(),isScored:s.isScored(),hasScoringError:s.hasScoringError(),scoringId:s.getScoringId(),recommendation:s.getRecommendation(),decision:s.getDecision(),isAccepted:s.isAccepted()}),$e=s=>({orderVehicle:s.getOrderVehicle(),accessories:s.getAccessories(),requiresDealerSelection:s.requiresDealerSelection(),dealerSites:s.getDealerSites(),paymentOptions:s.getPaymentOptions().map(e=>({...e,loanDetails:e.loanDetails?Ae(e.loanDetails):void 0})),deliveryOptions:s.getDeliveryOptions(),insuranceOption:s.getInsuranceOption(),orderConditions:s.getOrderConditions(),orderReturnConditions:s.getOrderReturnConditions(),conditionsPdfUri:s.getConditionsPdfUri(),contactInformation:s.getContactInformation(),allowsTradeIn:s.allowsTradeIn(),isUnavailable:s.isUnavailable(),isPaymentRequired:s.isPaymentRequired()}),ni=s=>({vehicle:s.getVehicle()});var ct="RESET",ai=s=>i=>i({type:ct,id:s}),lt="SET_ORDER",He=(s,i)=>e=>e({type:lt,order:s,vehicle:i}),dt="SET_ID",ri=s=>i=>i({type:dt,id:s}),mt="SET_CONTACT_EMAIL_AND_PHONE",ci=s=>i=>i({type:mt,value:s}),pt="SET_SOCIAL_ID_AND_ADDRESS",li=(s,i,e)=>t=>t({type:pt,socialId:s,address:i,lastStage:e}),ut="SET_HOME_DELIVERY",di=(s,i)=>e=>e({type:ut,homeDelivery:s,lastStage:i}),ht="SET_DEALER",mi=(s,i)=>e=>e({type:ht,dealer:s,lastStage:i}),kt="INIT_TRADE_IN",pi=s=>i=>i({type:kt,lastStage:s}),yt="SET_TRADE_IN",Ce=(s,i,e)=>t=>t({type:yt,lastStage:s,tradeIn:i,tradeInVehicle:e}),vt="SET_FINANCIAL",ui=(s,i)=>e=>e({type:vt,paymentType:s,lastStage:i}),Et="SET_PAYMENT_LOOKUP_RESPONSE",hi=s=>i=>i({type:Et,paymentLookupResponse:Ae(s)}),It="RESET_PAYMENT_LOOKUP_RESPONSE",ki=()=>s=>s({type:It}),ft="SET_DRIVING_DISTANCE",yi=s=>i=>i({type:ft,drivingDistance:s}),gt="COMPLETE_STAGE",ee=s=>i=>i({type:gt,lastStage:s}),_t="SET_OR_REMOVE_INSURANCE",ue=s=>i=>i({type:_t,insurance:s}),St="SET_OR_REMOVE_INSURANCE_ADDONS",vi=(s,i)=>e=>e({type:St,insurance:s,insuranceAddons:i}),wt="SET_OR_REMOVE_FREE_INSURANCE",Ei=s=>i=>i({type:wt,freeInsurance:s}),Nt="SET_OR_REMOVE_ACCESSORY",Ii=s=>i=>i({type:Nt,accessory:s}),Tt="GO_TO",M=(s,i,e)=>t=>t({type:Tt,view:s,index:i,subStage:e}),At="SET_STAGES",fi=s=>i=>i({type:At,stages:s}),Ct="SET_CREATED_ORDER_ID",gi=(s,i)=>e=>e({type:Ct,id:s,payment:i}),Dt="SET_CREDIT_ASSESSMENT_RESPONSE",he=(s,i)=>e=>e({type:Dt,caseId:s,creditAssessmentResponse:i}),bt="SET_STATE",_i=s=>i=>i({type:bt,state:s});var rl={};var Si={view:"preview",stage:1,subStage:1},wi={id:"",topNavigation:{...Si},navigation:{...Si},customer:{email:"",phone:"",givenName:"",surname:"",socialId:""},homeDelivery:!1,accessories:[],drivingDistance:De.DrivingDistance.Between0And1000,...rl},le=(s,i)=>i?{view:"summary",stage:1,subStage:1}:{view:"main",stage:s+1,subStage:1},de=(s,i)=>i.view==="main"?s.stage<i.stage?i:E.topNavigation:{...s,stage:s.stage+1},Rt=s=>s&&s?.length===1&&s?.[0].type===De.PaymentType.Cash?De.PaymentType.Cash:void 0,E,Lt,cl=(s=wi,i)=>{let e,t;switch(E={...s},i.type){case ct:return{...wi,id:i.id};case At:return{...E,stages:i.stages};case dt:return{...E,id:i.id};case lt:return{...s,order:i.order,paymentType:Rt(i.order?.paymentOptions),vehicle:{...i.order.orderVehicle,...i.vehicle||{}}};case mt:let o={...E,customer:{...s.customer,email:i.value.email,phone:i.value.phone},navigation:{view:"main",stage:s.navigation.stage,subStage:2}};return delete o.wantTradeIn,delete o.tradeIn,delete o.tradeInVehicle,o.paymentType=Rt(s.order?.paymentOptions),delete o.paymentLookupResponse,delete o.insurance,delete o.insuranceAddOns,delete o.freeInsurance,delete o.dealer,o.accessories=[],o;case pt:return e=le(E.navigation.stage,i.lastStage),t=de(E.topNavigation,e),E={...s,navigation:e,topNavigation:t,address:i.address,customer:{...s.customer,socialId:i.socialId}},E;case ht:return e=le(s.navigation.stage,i.lastStage),t={...e},E={...s,navigation:e,topNavigation:t,dealer:i.dealer},delete E.wantTradeIn,delete E.tradeIn,delete E.tradeInVehicle,E.paymentType=Rt(s.order?.paymentOptions),delete E.paymentLookupResponse,delete E.insurance,delete E.insuranceAddOns,delete E.freeInsurance,E.accessories=[],E;case ut:return e=le(s.navigation.stage,i.lastStage),t=de(E.topNavigation,e),E={...s,navigation:e,topNavigation:t,homeDelivery:i.homeDelivery},E;case kt:return e={view:"main",stage:s.navigation.stage,subStage:1},t=de(E.topNavigation,e),E={...s,navigation:e,wantTradeIn:!0,topNavigation:t,tradeIn:s.tradeIn||{registrationNumber:"",mileage:"",description:""}},E;case yt:return e=le(s.navigation.stage,i.lastStage),t=de(E.topNavigation,e),E={...s,navigation:e,topNavigation:t,wantTradeIn:!!i.tradeIn,tradeIn:i.tradeIn,tradeInVehicle:i.tradeInVehicle},E;case vt:return e=le(s.navigation.stage,i.lastStage),t=de(E.topNavigation,e),{...E,navigation:e,topNavigation:t,paymentType:i.paymentType};case It:return{...E,paymentLookupResponse:void 0};case Et:return{...E,paymentLookupResponse:i.paymentLookupResponse};case ft:return{...E,drivingDistance:i.drivingDistance};case gt:return e=le(s.navigation.stage,i.lastStage),t=de(E.topNavigation,e),E={...s,navigation:e,topNavigation:t},E;case St:return E.insurance=i.insurance,E.insuranceAddOns={insurance:i.insurance.name,addOns:i.insuranceAddons},E;case _t:return rt(E.insurance,i.insurance)?E.insurance=void 0:E.insurance=i.insurance,E.insuranceAddOns?.insurance&&(E.insuranceAddOns=void 0),E;case wt:return rt(E.freeInsurance,i.freeInsurance)?E.freeInsurance=void 0:E.freeInsurance=i.freeInsurance,E;case Nt:return Lt=E.accessories.findIndex(n=>n.id===i.accessory.id),E.accessories=[...E.accessories],Lt>-1?E.accessories.splice(Lt,1):E.accessories.push(i.accessory),{...E,accessories:[...E.accessories]};case Tt:return{...s,navigation:{view:i.view,stage:i.index||1,subStage:i.subStage||1}};case Ct:return i.payment?e={view:"main",stage:s.navigation.stage,subStage:2}:e=le(s.navigation.stage,!0),t=de(E.topNavigation,e),E={...s,navigation:e,topNavigation:t,createdOrderId:i.id,payment:i.payment},E;case Dt:return{...E,caseId:i.caseId,creditAssessmentResponse:i.creditAssessmentResponse};case bt:return{...i.state};default:return s}},Ni=cl;var Ai=()=>(0,Ti.createStore)(Ni);var Be=(s,i)=>{if(!i)return s;let e=new URL(s);return`${i}${e.pathname}`};var ll=s=>s.toString().replace(/\s/g,""),dl=(s,i)=>{if(!i)return s;let e=Math.pow(10,i);return(Math.round(s*e)/e).toFixed(i)},y=(s,i)=>{if(s===void 0)return"???";let e=dl(s,i?.decimals!==void 0?i.decimals:0);return`${i?.prefix?`${i.prefix}`:""}${ll(e).replace(/\B(?=(\d{3})+(?!\d))/g," ")}${i?.postfix?` ${i.postfix}`:""}`},ml=(s,i)=>{let e=s.split(" "),t=i.split(" ").map(o=>o.toLowerCase());return e.filter(o=>!t.includes(o.toLowerCase())).join(" ")},ke=s=>{if(!!s)return ml(s.shortDescription||"",s.title||"")};var pl=({vehicle:s,order:i,meta:e,cdnMedia:t})=>{let o=s?.imageUrls,n=s?.title,a=y(s?.price||NaN),c=i?.contactInformation?.name;return`
2
2
  <div class="waykeecom-product-card">
3
3
  ${o?.length?`
4
4
  <div class="waykeecom-product-card__media">
@@ -592,7 +592,7 @@
592
592
  </div>
593
593
  `:""}
594
594
  </div>
595
- `,a&&new ne(this.node.querySelector(".waykeecom-input-label"),{information:a,onClickInformation:m}),p){this.contexts.rangeSlider=this.node.querySelector(`#${n}`)||void 0,this.contexts.rangeSlider&&(l&&this.contexts.rangeSlider.addEventListener("change",l),this.contexts.rangeSlider.addEventListener("input",k=>this.onInput(k)),this.updateRangeSliderColor(this.contexts.rangeSlider));let u=this.node.querySelector(`#${n}-input`);u&&(u.addEventListener("change",k=>this.onChange(k)),u.addEventListener("blur",k=>this.onBlur(k)))}}},Je=ys;var vs=g("@wayke-se/ecom"),Cn=({vehicleId:s,dealerId:i,downPayment:e,duration:t,residual:o})=>{let n=vs.payments.newLookupRequest().forVehicle(s).withDownPayment(e).withDuration(t);return o!==void 0&&n.withResidualValue(o),i!==void 0&&n.forDealer(i),vs.payments.lookupPayment(n.build())};var S=g("@wayke-se/ecom");var Es=class extends r{constructor(e,t){super(e,t.append?{htmlTag:"div",className:"waykeecom-accordion"}:void 0);this.props=t,this.render()}render(){let{title:e,description:t,onClick:o}=this.props,n=`
595
+ `,a&&new ne(this.node.querySelector(".waykeecom-input-label"),{information:a,onClickInformation:m}),p){this.contexts.rangeSlider=this.node.querySelector(`#${n}`)||void 0,this.contexts.rangeSlider&&(l&&this.contexts.rangeSlider.addEventListener("change",l),this.contexts.rangeSlider.addEventListener("input",k=>this.onInput(k)),this.updateRangeSliderColor(this.contexts.rangeSlider));let u=this.node.querySelector(`#${n}-input`);u&&(u.addEventListener("change",k=>this.onChange(k)),u.addEventListener("blur",k=>this.onBlur(k)))}}},Je=ys;var vs=g("@wayke-se/ecom"),Cn=({vehicleId:s,dealerId:i,downPayment:e,duration:t,residual:o,financialOptionId:n})=>{let a=vs.payments.newLookupRequest().forVehicle(s).withDownPayment(e).withDuration(t);return n&&a.withFinancialOptionId(n),o!==void 0&&a.withResidualValue(o),i!==void 0&&a.forDealer(i),vs.payments.lookupPayment(a.build())};var S=g("@wayke-se/ecom");var Es=class extends r{constructor(e,t){super(e,t.append?{htmlTag:"div",className:"waykeecom-accordion"}:void 0);this.props=t,this.render()}render(){let{title:e,description:t,onClick:o}=this.props,n=`
596
596
  <input
597
597
  type="checkbox"
598
598
  id="${this.props.id}"
@@ -1034,7 +1034,7 @@
1034
1034
  </div>
1035
1035
  </div>
1036
1036
  </div>
1037
- `,this.contexts.loanDetailsMontlyCost=new Ma(this.node.querySelector(`#${xa}`),{monthlyCost:v}),this.contexts.pieChart=new ba(this.node.querySelector(`#${Pa}`),{percentage:N}),this.contexts.loanDetailsBasic=new Ra(this.node.querySelector(`#${$a}`),{downPayment:t,creditAmount:m,downPaymentPercentage:h,creditAmountPercentage:N}),this.contexts.loanDetailsDetailed=new Oa(this.node.querySelector(`#${Ha}`),{duration:e,administrationFee:o,setupFee:n,totalCreditCost:a,interest:c,effectiveInterest:l,publicUrl:p,loanOrgName:u})}},Ba=Gs;var qs=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=f({tone:"error",children:this.error})}},Fa=qs;var Ua="downpayment-range-node",td="downpayment-range",Va="duration-range-node",sd="duration-range",Ga="residual-range-node",od="residual-range",id="loan-details",qa=`${id}-node`,Wa="credit-assessment-node",ja="credit-assessment-proceed",Ya=`${ja}-node`,Ka="loan-error-node",Ws=class extends r{constructor(e,t){super(e);this.contexts={};this.props=t;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},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 Cn({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=Ae(e),this.paymentState={...this.paymentState,downPayment:this.paymentLookupResponse.downPaymentSpec,duration:this.paymentLookupResponse.durationSpec,residual:this.paymentLookupResponse.residualValueSpec},hi(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,o=t.name,n=t.value;t.value=n,this.paymentState[o].current=o==="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:o}=this.props,{order:n}=e.getState(),a=n?.contactInformation?.name,c=t.loanDetails?.shouldUseCreditScoring;this.node.innerHTML=`
1037
+ `,this.contexts.loanDetailsMontlyCost=new Ma(this.node.querySelector(`#${xa}`),{monthlyCost:v}),this.contexts.pieChart=new ba(this.node.querySelector(`#${Pa}`),{percentage:N}),this.contexts.loanDetailsBasic=new Ra(this.node.querySelector(`#${$a}`),{downPayment:t,creditAmount:m,downPaymentPercentage:h,creditAmountPercentage:N}),this.contexts.loanDetailsDetailed=new Oa(this.node.querySelector(`#${Ha}`),{duration:e,administrationFee:o,setupFee:n,totalCreditCost:a,interest:c,effectiveInterest:l,publicUrl:p,loanOrgName:u})}},Ba=Gs;var qs=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=f({tone:"error",children:this.error})}},Fa=qs;var Ua="downpayment-range-node",td="downpayment-range",Va="duration-range-node",sd="duration-range",Ga="residual-range-node",od="residual-range",id="loan-details",qa=`${id}-node`,Wa="credit-assessment-node",ja="credit-assessment-proceed",Ya=`${ja}-node`,Ka="loan-error-node",Ws=class extends r{constructor(e,t){super(e);this.contexts={};this.props=t;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 Cn({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=Ae(e),this.paymentState={...this.paymentState,downPayment:this.paymentLookupResponse.downPaymentSpec,duration:this.paymentLookupResponse.durationSpec,residual:this.paymentLookupResponse.residualValueSpec,financialOptionId:this.paymentLookupResponse.financialOptionId},hi(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,o=t.name,n=t.value;t.value=n,this.paymentState[o].current=o==="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:o}=this.props,{order:n}=e.getState(),a=n?.contactInformation?.name,c=t.loanDetails?.shouldUseCreditScoring;this.node.innerHTML=`
1038
1038
  <div class="waykeecom-stack waykeecom-stack--3">
1039
1039
  <hr class="waykeecom-separator" />
1040
1040
  </div>