@wayke-se/ecom-web 1.6.1 → 1.6.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
- "use strict";(()=>{var Yc=Object.create;var Jo=Object.defineProperty;var Kc=Object.getOwnPropertyDescriptor;var jc=Object.getOwnPropertyNames;var Qc=Object.getPrototypeOf,zc=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 Jc=(s,i,e,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of jc(i))!zc.call(s,o)&&o!==e&&Jo(s,o,{get:()=>i[o],enumerable:!(t=Kc(i,o))||t.enumerable});return s};var Xc=(s,i,e)=>(e=s!=null?Yc(Qc(s)):{},Jc(i||!s||!s.__esModule?Jo(e,"default",{value:s,enumerable:!0}):e,s));var Fc=g("@wayke-se/ecom");var Xo={name:"@wayke-se/ecom-web",version:"1.6.1",description:"Wayke Ecom Web",module:"dist/index.mjs",main:"dist/index.js",types:"dist/index.d.ts",homepage:"https://github.com/wayke-se/wayke-ecom-web",scripts:{start:"node ./esbuild/start.js",clip:"node ./esbuild/clip-ui.js && node ./clip-ui/start.js",build:"npm run clean && node ./esbuild/lib.js && node ./esbuild/cdn.js",clean:"rimraf build && rimraf dist && rimraf dist-cdn",test:"npm run lint && npm run typecheck",typecheck:"tsc -noEmit","typecheck:watch":"tsc -noEmit -watch",lint:"eslint --ext .ts,.js src","lint:fix":"eslint --ext .ts,.js 'src' --fix",stylelint:"stylelint '**/*.scss'",prepare:"husky install"},author:"Wayke",license:"ISC",devDependencies:{"@ourstudio/clip-ui":"^0.0.11","@types/marked":"^4.3.0","@types/node":"^17.0.18","@types/object-path":"^0.11.1","@types/sanitize-html":"^2.6.2","@typescript-eslint/eslint-plugin":"^5.12.0","@typescript-eslint/parser":"^5.12.0",esbuild:"^0.15.10","esbuild-sass-plugin":"2.3.3",eslint:"^8.9.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0",husky:"^8.0.1","npm-dts":"^1.3.11",prettier:"^2.5.1",rimraf:"^5.0.1",stylelint:"^15.2.0","stylelint-config-prettier-scss":"^1.0.0","stylelint-config-standard-scss":"^9.0.0",typescript:"^5.1.3"},dependencies:{"@wayke-se/ecom":"^4.4.1",marked:"^4.3.0","object-path":"^0.11.8",redux:"^4.1.2","sanitize-html":"^2.7.0"},files:["dist"]};var fi=g("redux");var Ae=g("@wayke-se/ecom");var ot=(s,i)=>s!==void 0&&i!==void 0?JSON.stringify(s).localeCompare(JSON.stringify(i))===0:s===i;var we=s=>({costs:s.getCosts(),fees:s.getFees(),interests:s.getInterests(),durationSpec:s.getDurationSpec(),downPaymentSpec:s.getDownPaymentSpec(),residualValueSpec:s.getResidualValueSpec(),totalResidualValue:s.getTotalResidualValue(),publicURL:s.getPublicURL(),shouldUseCreditScoring:s.shouldUseCreditScoring(),financialProductCode:s.getFinancialProductCode(),price:s.getPrice(),creditAmount:s.getCreditAmount(),hasPrivacyPolicy:s.hasPrivacyPolicy(),privacyPolicyUrl:s.getPrivacyPolicyUrl(),moneyLaunderingInformationURL:s.getMoneyLaunderingInformationURL()}),Zo=s=>({status:s.getStatus(),hasPendingSigning:s.hasPendingSigning(),hintCode:s.getHintCode(),signingMessage:s.getSigningMessage(),shouldRenewSigning:s.shouldRenewSigning(),isSigned:s.isSigned(),address:void 0,pendingScoring:s.hasPendingScoring(),isScored:s.isScored(),hasScoringError:s.hasScoringError(),scoringId:s.getScoringId(),recommendation:s.getRecommendation(),decision:s.getDecision(),isAccepted:s.isAccepted()}),Me=s=>({orderVehicle:s.getOrderVehicle(),accessories:s.getAccessories(),requiresDealerSelection:s.requiresDealerSelection(),dealerSites:s.getDealerSites(),paymentOptions:s.getPaymentOptions().map(e=>({...e,loanDetails:e.loanDetails?we(e.loanDetails):void 0})),deliveryOptions:s.getDeliveryOptions(),insuranceOption:s.getInsuranceOption(),orderConditions:s.getOrderConditions(),orderReturnConditions:s.getOrderReturnConditions(),conditionsPdfUri:s.getConditionsPdfUri(),contactInformation:s.getContactInformation(),allowsTradeIn:s.allowsTradeIn(),isUnavailable:s.isUnavailable(),isPaymentRequired:s.isPaymentRequired()}),ei=s=>({vehicle:s.getVehicle()});var it="RESET",ti=s=>i=>i({type:it,id:s}),nt="SET_ORDER",xe=(s,i)=>e=>e({type:nt,order:s,vehicle:i}),at="SET_ID",si=s=>i=>i({type:at,id:s}),rt="SET_CONTACT_EMAIL_AND_PHONE",oi=s=>i=>i({type:rt,value:s}),ct="SET_SOCIAL_ID_AND_ADDRESS",ii=(s,i,e)=>t=>t({type:ct,socialId:s,address:i,lastStage:e}),lt="SET_HOME_DELIVERY",ni=(s,i)=>e=>e({type:lt,homeDelivery:s,lastStage:i}),dt="SET_DEALER",ai=(s,i)=>e=>e({type:dt,dealer:s,lastStage:i}),mt="INIT_TRADE_IN",ri=s=>i=>i({type:mt,lastStage:s}),pt="SET_TRADE_IN",Ne=(s,i,e)=>t=>t({type:pt,lastStage:s,tradeIn:i,tradeInVehicle:e}),ut="SET_FINANCIAL",ci=(s,i)=>e=>e({type:ut,paymentType:s,lastStage:i}),ht="SET_PAYMENT_LOOKUP_RESPONSE",li=s=>i=>i({type:ht,paymentLookupResponse:we(s)}),kt="SET_DRIVING_DISTANCE",di=s=>i=>i({type:kt,drivingDistance:s}),yt="COMPLETE_STAGE",Z=s=>i=>i({type:yt,lastStage:s}),vt="SET_OR_REMOVE_INSURANCE",de=s=>i=>i({type:vt,insurance:s}),Et="SET_OR_REMOVE_INSURANCE_ADDONS",mi=(s,i)=>e=>e({type:Et,insurance:s,insuranceAddons:i}),It="SET_OR_REMOVE_FREE_INSURANCE",pi=s=>i=>i({type:It,freeInsurance:s}),ft="SET_OR_REMOVE_ACCESSORY",ui=s=>i=>i({type:ft,accessory:s}),gt="GO_TO",O=(s,i,e)=>t=>t({type:gt,view:s,index:i,subStage:e}),_t="SET_STAGES",hi=s=>i=>i({type:_t,stages:s}),St="SET_CREATED_ORDER_ID",ki=(s,i)=>e=>e({type:St,id:s,payment:i}),wt="SET_CREDIT_ASSESSMENT_RESPONSE",me=(s,i)=>e=>e({type:wt,caseId:s,creditAssessmentResponse:i}),Nt="SET_STATE",yi=s=>i=>i({type:Nt,state:s});var el={};var vi={view:"preview",stage:1,subStage:1},Ei={id:"",topNavigation:{...vi},navigation:{...vi},customer:{email:"",phone:"",givenName:"",surname:"",socialId:""},homeDelivery:!1,accessories:[],drivingDistance:Ae.DrivingDistance.Between0And1000,...el},ae=(s,i)=>i?{view:"summary",stage:1,subStage:1}:{view:"main",stage:s+1,subStage:1},re=(s,i)=>i.view==="main"?s.stage<i.stage?i:E.topNavigation:{...s,stage:s.stage+1},At=s=>s&&s?.length===1&&s?.[0].type===Ae.PaymentType.Cash?Ae.PaymentType.Cash:void 0,E,Tt,tl=(s=Ei,i)=>{let e,t;switch(E={...s},i.type){case it:return{...Ei,id:i.id};case _t:return{...E,stages:i.stages};case at:return{...E,id:i.id};case nt:return{...s,order:i.order,paymentType:At(i.order?.paymentOptions),vehicle:{...i.order.orderVehicle,...i.vehicle||{}}};case rt: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=At(s.order?.paymentOptions),delete o.paymentLookupResponse,delete o.insurance,delete o.insuranceAddOns,delete o.freeInsurance,delete o.dealer,o.accessories=[],o;case ct:return e=ae(E.navigation.stage,i.lastStage),t=re(E.topNavigation,e),E={...s,navigation:e,topNavigation:t,address:i.address,customer:{...s.customer,socialId:i.socialId}},E;case dt:return e=ae(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=At(s.order?.paymentOptions),delete E.paymentLookupResponse,delete E.insurance,delete E.insuranceAddOns,delete E.freeInsurance,E.accessories=[],E;case lt:return e=ae(s.navigation.stage,i.lastStage),t=re(E.topNavigation,e),E={...s,navigation:e,topNavigation:t,homeDelivery:i.homeDelivery},E;case mt:return e={view:"main",stage:s.navigation.stage,subStage:1},t=re(E.topNavigation,e),E={...s,navigation:e,wantTradeIn:!0,topNavigation:t,tradeIn:s.tradeIn||{registrationNumber:"",mileage:"",description:""}},E;case pt:return e=ae(s.navigation.stage,i.lastStage),t=re(E.topNavigation,e),E={...s,navigation:e,topNavigation:t,wantTradeIn:!!i.tradeIn,tradeIn:i.tradeIn,tradeInVehicle:i.tradeInVehicle},E;case ut:return e=ae(s.navigation.stage,i.lastStage),t=re(E.topNavigation,e),{...E,navigation:e,topNavigation:t,paymentType:i.paymentType};case ht:return{...E,paymentLookupResponse:i.paymentLookupResponse};case kt:return{...E,drivingDistance:i.drivingDistance};case yt:return e=ae(s.navigation.stage,i.lastStage),t=re(E.topNavigation,e),E={...s,navigation:e,topNavigation:t},E;case Et:return E.insurance=i.insurance,E.insuranceAddOns={insurance:i.insurance.name,addOns:i.insuranceAddons},E;case vt:return ot(E.insurance,i.insurance)?E.insurance=void 0:E.insurance=i.insurance,E.insuranceAddOns?.insurance&&(E.insuranceAddOns=void 0),E;case It:return ot(E.freeInsurance,i.freeInsurance)?E.freeInsurance=void 0:E.freeInsurance=i.freeInsurance,E;case ft:return Tt=E.accessories.findIndex(n=>n.id===i.accessory.id),E.accessories=[...E.accessories],Tt>-1?E.accessories.splice(Tt,1):E.accessories.push(i.accessory),{...E,accessories:[...E.accessories]};case gt:return{...s,navigation:{view:i.view,stage:i.index||1,subStage:i.subStage||1}};case St:return i.payment?e={view:"main",stage:s.navigation.stage,subStage:2}:e=ae(s.navigation.stage,!0),t=re(E.topNavigation,e),E={...s,navigation:e,topNavigation:t,createdOrderId:i.id,payment:i.payment},E;case wt:return{...E,caseId:i.caseId,creditAssessmentResponse:i.creditAssessmentResponse};case Nt:return{...i.state};default:return s}},Ii=tl;var gi=()=>(0,fi.createStore)(Ii);var Pe=(s,i)=>{if(!i)return s;let e=new URL(s);return`${i}${e.pathname}`};var sl=s=>s.toString().replace(/\s/g,""),ol=(s,i)=>{if(!i)return s;let e=Math.pow(10,i);return(Math.round(s*e)/e).toFixed(i)},v=(s,i)=>{if(s===void 0)return"???";let e=ol(s,i?.decimals!==void 0?i.decimals:0);return`${i?.prefix?`${i.prefix}`:""}${sl(e).replace(/\B(?=(\d{3})+(?!\d))/g," ")}${i?.postfix?` ${i.postfix}`:""}`},il=(s,i)=>{let e=s.split(" "),t=i.split(" ").map(o=>o.toLowerCase());return e.filter(o=>!t.includes(o.toLowerCase())).join(" ")},pe=s=>{if(!!s)return il(s.shortDescription||"",s.title||"")};var nl=({vehicle:s,order:i,meta:e,cdnMedia:t})=>{let o=s?.imageUrls,n=s?.title,a=v(s?.price||NaN),c=i?.contactInformation?.name;return`
1
+ "use strict";(()=>{var Yc=Object.create;var Jo=Object.defineProperty;var Kc=Object.getOwnPropertyDescriptor;var jc=Object.getOwnPropertyNames;var Qc=Object.getPrototypeOf,zc=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 Jc=(s,i,e,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of jc(i))!zc.call(s,o)&&o!==e&&Jo(s,o,{get:()=>i[o],enumerable:!(t=Kc(i,o))||t.enumerable});return s};var Xc=(s,i,e)=>(e=s!=null?Yc(Qc(s)):{},Jc(i||!s||!s.__esModule?Jo(e,"default",{value:s,enumerable:!0}):e,s));var Fc=g("@wayke-se/ecom");var Xo={name:"@wayke-se/ecom-web",version:"1.6.2",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 fi=g("redux");var Ae=g("@wayke-se/ecom");var ot=(s,i)=>s!==void 0&&i!==void 0?JSON.stringify(s).localeCompare(JSON.stringify(i))===0:s===i;var we=s=>({costs:s.getCosts(),fees:s.getFees(),interests:s.getInterests(),durationSpec:s.getDurationSpec(),downPaymentSpec:s.getDownPaymentSpec(),residualValueSpec:s.getResidualValueSpec(),totalResidualValue:s.getTotalResidualValue(),publicURL:s.getPublicURL(),shouldUseCreditScoring:s.shouldUseCreditScoring(),financialProductCode:s.getFinancialProductCode(),price:s.getPrice(),creditAmount:s.getCreditAmount(),hasPrivacyPolicy:s.hasPrivacyPolicy(),privacyPolicyUrl:s.getPrivacyPolicyUrl(),moneyLaunderingInformationURL:s.getMoneyLaunderingInformationURL()}),Zo=s=>({status:s.getStatus(),hasPendingSigning:s.hasPendingSigning(),hintCode:s.getHintCode(),signingMessage:s.getSigningMessage(),shouldRenewSigning:s.shouldRenewSigning(),isSigned:s.isSigned(),address:void 0,pendingScoring:s.hasPendingScoring(),isScored:s.isScored(),hasScoringError:s.hasScoringError(),scoringId:s.getScoringId(),recommendation:s.getRecommendation(),decision:s.getDecision(),isAccepted:s.isAccepted()}),Me=s=>({orderVehicle:s.getOrderVehicle(),accessories:s.getAccessories(),requiresDealerSelection:s.requiresDealerSelection(),dealerSites:s.getDealerSites(),paymentOptions:s.getPaymentOptions().map(e=>({...e,loanDetails:e.loanDetails?we(e.loanDetails):void 0})),deliveryOptions:s.getDeliveryOptions(),insuranceOption:s.getInsuranceOption(),orderConditions:s.getOrderConditions(),orderReturnConditions:s.getOrderReturnConditions(),conditionsPdfUri:s.getConditionsPdfUri(),contactInformation:s.getContactInformation(),allowsTradeIn:s.allowsTradeIn(),isUnavailable:s.isUnavailable(),isPaymentRequired:s.isPaymentRequired()}),ei=s=>({vehicle:s.getVehicle()});var it="RESET",ti=s=>i=>i({type:it,id:s}),nt="SET_ORDER",xe=(s,i)=>e=>e({type:nt,order:s,vehicle:i}),at="SET_ID",si=s=>i=>i({type:at,id:s}),rt="SET_CONTACT_EMAIL_AND_PHONE",oi=s=>i=>i({type:rt,value:s}),ct="SET_SOCIAL_ID_AND_ADDRESS",ii=(s,i,e)=>t=>t({type:ct,socialId:s,address:i,lastStage:e}),lt="SET_HOME_DELIVERY",ni=(s,i)=>e=>e({type:lt,homeDelivery:s,lastStage:i}),dt="SET_DEALER",ai=(s,i)=>e=>e({type:dt,dealer:s,lastStage:i}),mt="INIT_TRADE_IN",ri=s=>i=>i({type:mt,lastStage:s}),pt="SET_TRADE_IN",Ne=(s,i,e)=>t=>t({type:pt,lastStage:s,tradeIn:i,tradeInVehicle:e}),ut="SET_FINANCIAL",ci=(s,i)=>e=>e({type:ut,paymentType:s,lastStage:i}),ht="SET_PAYMENT_LOOKUP_RESPONSE",li=s=>i=>i({type:ht,paymentLookupResponse:we(s)}),kt="SET_DRIVING_DISTANCE",di=s=>i=>i({type:kt,drivingDistance:s}),yt="COMPLETE_STAGE",Z=s=>i=>i({type:yt,lastStage:s}),vt="SET_OR_REMOVE_INSURANCE",de=s=>i=>i({type:vt,insurance:s}),Et="SET_OR_REMOVE_INSURANCE_ADDONS",mi=(s,i)=>e=>e({type:Et,insurance:s,insuranceAddons:i}),It="SET_OR_REMOVE_FREE_INSURANCE",pi=s=>i=>i({type:It,freeInsurance:s}),ft="SET_OR_REMOVE_ACCESSORY",ui=s=>i=>i({type:ft,accessory:s}),gt="GO_TO",O=(s,i,e)=>t=>t({type:gt,view:s,index:i,subStage:e}),_t="SET_STAGES",hi=s=>i=>i({type:_t,stages:s}),St="SET_CREATED_ORDER_ID",ki=(s,i)=>e=>e({type:St,id:s,payment:i}),wt="SET_CREDIT_ASSESSMENT_RESPONSE",me=(s,i)=>e=>e({type:wt,caseId:s,creditAssessmentResponse:i}),Nt="SET_STATE",yi=s=>i=>i({type:Nt,state:s});var el={};var vi={view:"preview",stage:1,subStage:1},Ei={id:"",topNavigation:{...vi},navigation:{...vi},customer:{email:"",phone:"",givenName:"",surname:"",socialId:""},homeDelivery:!1,accessories:[],drivingDistance:Ae.DrivingDistance.Between0And1000,...el},ae=(s,i)=>i?{view:"summary",stage:1,subStage:1}:{view:"main",stage:s+1,subStage:1},re=(s,i)=>i.view==="main"?s.stage<i.stage?i:E.topNavigation:{...s,stage:s.stage+1},At=s=>s&&s?.length===1&&s?.[0].type===Ae.PaymentType.Cash?Ae.PaymentType.Cash:void 0,E,Tt,tl=(s=Ei,i)=>{let e,t;switch(E={...s},i.type){case it:return{...Ei,id:i.id};case _t:return{...E,stages:i.stages};case at:return{...E,id:i.id};case nt:return{...s,order:i.order,paymentType:At(i.order?.paymentOptions),vehicle:{...i.order.orderVehicle,...i.vehicle||{}}};case rt: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=At(s.order?.paymentOptions),delete o.paymentLookupResponse,delete o.insurance,delete o.insuranceAddOns,delete o.freeInsurance,delete o.dealer,o.accessories=[],o;case ct:return e=ae(E.navigation.stage,i.lastStage),t=re(E.topNavigation,e),E={...s,navigation:e,topNavigation:t,address:i.address,customer:{...s.customer,socialId:i.socialId}},E;case dt:return e=ae(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=At(s.order?.paymentOptions),delete E.paymentLookupResponse,delete E.insurance,delete E.insuranceAddOns,delete E.freeInsurance,E.accessories=[],E;case lt:return e=ae(s.navigation.stage,i.lastStage),t=re(E.topNavigation,e),E={...s,navigation:e,topNavigation:t,homeDelivery:i.homeDelivery},E;case mt:return e={view:"main",stage:s.navigation.stage,subStage:1},t=re(E.topNavigation,e),E={...s,navigation:e,wantTradeIn:!0,topNavigation:t,tradeIn:s.tradeIn||{registrationNumber:"",mileage:"",description:""}},E;case pt:return e=ae(s.navigation.stage,i.lastStage),t=re(E.topNavigation,e),E={...s,navigation:e,topNavigation:t,wantTradeIn:!!i.tradeIn,tradeIn:i.tradeIn,tradeInVehicle:i.tradeInVehicle},E;case ut:return e=ae(s.navigation.stage,i.lastStage),t=re(E.topNavigation,e),{...E,navigation:e,topNavigation:t,paymentType:i.paymentType};case ht:return{...E,paymentLookupResponse:i.paymentLookupResponse};case kt:return{...E,drivingDistance:i.drivingDistance};case yt:return e=ae(s.navigation.stage,i.lastStage),t=re(E.topNavigation,e),E={...s,navigation:e,topNavigation:t},E;case Et:return E.insurance=i.insurance,E.insuranceAddOns={insurance:i.insurance.name,addOns:i.insuranceAddons},E;case vt:return ot(E.insurance,i.insurance)?E.insurance=void 0:E.insurance=i.insurance,E.insuranceAddOns?.insurance&&(E.insuranceAddOns=void 0),E;case It:return ot(E.freeInsurance,i.freeInsurance)?E.freeInsurance=void 0:E.freeInsurance=i.freeInsurance,E;case ft:return Tt=E.accessories.findIndex(n=>n.id===i.accessory.id),E.accessories=[...E.accessories],Tt>-1?E.accessories.splice(Tt,1):E.accessories.push(i.accessory),{...E,accessories:[...E.accessories]};case gt:return{...s,navigation:{view:i.view,stage:i.index||1,subStage:i.subStage||1}};case St:return i.payment?e={view:"main",stage:s.navigation.stage,subStage:2}:e=ae(s.navigation.stage,!0),t=re(E.topNavigation,e),E={...s,navigation:e,topNavigation:t,createdOrderId:i.id,payment:i.payment},E;case wt:return{...E,caseId:i.caseId,creditAssessmentResponse:i.creditAssessmentResponse};case Nt:return{...i.state};default:return s}},Ii=tl;var gi=()=>(0,fi.createStore)(Ii);var Pe=(s,i)=>{if(!i)return s;let e=new URL(s);return`${i}${e.pathname}`};var sl=s=>s.toString().replace(/\s/g,""),ol=(s,i)=>{if(!i)return s;let e=Math.pow(10,i);return(Math.round(s*e)/e).toFixed(i)},v=(s,i)=>{if(s===void 0)return"???";let e=ol(s,i?.decimals!==void 0?i.decimals:0);return`${i?.prefix?`${i.prefix}`:""}${sl(e).replace(/\B(?=(\d{3})+(?!\d))/g," ")}${i?.postfix?` ${i.postfix}`:""}`},il=(s,i)=>{let e=s.split(" "),t=i.split(" ").map(o=>o.toLowerCase());return e.filter(o=>!t.includes(o.toLowerCase())).join(" ")},pe=s=>{if(!!s)return il(s.shortDescription||"",s.title||"")};var nl=({vehicle:s,order:i,meta:e,cdnMedia:t})=>{let o=s?.imageUrls,n=s?.title,a=v(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">
@@ -1098,7 +1098,7 @@
1098
1098
  </div>
1099
1099
  </div>
1100
1100
  `:""}
1101
- `;a&&this.node.querySelector("button")?.addEventListener("click",()=>a())}},Wa=Vs;var za="button-financial-proceed",Ya=`${za}-node`,Zl="financial-option",Ka=`${Zl}-node`,ed="financial-option-second",ja=`${ed}-node`,td="radio-financial-cash",sd="radio-financial-loan",od="radio-financial-lease",Qa="payment-node",Gs=class extends r{constructor(e,t){super(e);this.props=t,_(this.props.store,"navigation",()=>{let a=this.props.store.getState();this.paymentType=a.paymentType,this.render()});let o=this.props.store.getState(),{paymentType:n}=o;this.paymentType=n,this.render()}onChange(e){let o=e.currentTarget.value;switch(this.paymentType=o,this.render(!0),this.paymentType){case F.PaymentType.Cash:d("MAIN","FINANCIAL_CASH_SELECTED","FINANCIAL");break;case F.PaymentType.Lease:d("MAIN","FINANCIAL_LEASE_SELECTED","FINANCIAL");case F.PaymentType.Loan:d("MAIN","FINANCIAL_LOAN_SELECTED","FINANCIAL");default:break}}onProceed(){if(this.paymentType){switch(this.paymentType){case F.PaymentType.Cash:d("MAIN","FINANCIAL_CASH_SET","FINANCIAL");break;case F.PaymentType.Lease:d("MAIN","FINANCIAL_LEASE_SET","FINANCIAL");case F.PaymentType.Loan:d("MAIN","FINANCIAL_LOAN_SET","FINANCIAL");default:break}ci(this.paymentType,this.props.lastStage)(this.props.store.dispatch)}}onEdit(){d("MAIN","FINANCIAL_EDIT","FINANCIAL"),O("main",this.props.index)(this.props.store.dispatch)}render(e){let t=this.props.store.getState(),{id:o,order:n,paymentLookupResponse:a}=t;if(!n)throw"No order available";let c=n.paymentOptions,l=t.topNavigation.stage>this.props.index,m=B(this.node,{completed:l,title:"\xC4gandeform",active:t.navigation.stage===this.props.index,id:"financial"}),p=document.createElement("div");if((t.navigation.stage>this.props.index||l&&t.navigation.stage!==this.props.index)&&this.paymentType){let u=c.find(y=>y.type===F.PaymentType.Loan);new Wa(m,{store:this.props.store,loan:u,paymentType:this.paymentType,paymentLookupResponse:a||u?.loanDetails,onEdit:t.createdOrderId?void 0:()=>this.onEdit()})}else if(t.navigation.stage===this.props.index){let u=t.order?.orderVehicle,y=c.find(L=>L.type===F.PaymentType.Cash),k=c.find(L=>L.type===F.PaymentType.Loan),h=c.find(L=>L.type===F.PaymentType.Lease);p.innerHTML=`
1101
+ `;a&&this.node.querySelector("button")?.addEventListener("click",()=>a())}},Wa=Vs;var za="button-financial-proceed",Ya=`${za}-node`,Zl="financial-option",Ka=`${Zl}-node`,ed="financial-option-second",ja=`${ed}-node`,td="radio-financial-cash",sd="radio-financial-loan",od="radio-financial-lease",Qa="payment-node",Gs=class extends r{constructor(e,t){super(e);this.props=t,_(this.props.store,"navigation",()=>{let a=this.props.store.getState();this.paymentType=a.paymentType,this.render()});let o=this.props.store.getState(),{paymentType:n}=o;this.paymentType=n,this.render()}onChange(e){let o=e.currentTarget.value;switch(this.paymentType=o,this.render(!0),this.paymentType){case F.PaymentType.Cash:d("MAIN","FINANCIAL_CASH_SELECTED","FINANCIAL");break;case F.PaymentType.Lease:d("MAIN","FINANCIAL_LEASE_SELECTED","FINANCIAL");break;case F.PaymentType.Loan:d("MAIN","FINANCIAL_LOAN_SELECTED","FINANCIAL");default:break}}onProceed(){if(this.paymentType){switch(this.paymentType){case F.PaymentType.Cash:d("MAIN","FINANCIAL_CASH_SET","FINANCIAL");break;case F.PaymentType.Lease:d("MAIN","FINANCIAL_LEASE_SET","FINANCIAL");break;case F.PaymentType.Loan:d("MAIN","FINANCIAL_LOAN_SET","FINANCIAL");default:break}ci(this.paymentType,this.props.lastStage)(this.props.store.dispatch)}}onEdit(){d("MAIN","FINANCIAL_EDIT","FINANCIAL"),O("main",this.props.index)(this.props.store.dispatch)}render(e){let t=this.props.store.getState(),{id:o,order:n,paymentLookupResponse:a}=t;if(!n)throw"No order available";let c=n.paymentOptions,l=t.topNavigation.stage>this.props.index,m=B(this.node,{completed:l,title:"\xC4gandeform",active:t.navigation.stage===this.props.index,id:"financial"}),p=document.createElement("div");if((t.navigation.stage>this.props.index||l&&t.navigation.stage!==this.props.index)&&this.paymentType){let u=c.find(y=>y.type===F.PaymentType.Loan);new Wa(m,{store:this.props.store,loan:u,paymentType:this.paymentType,paymentLookupResponse:a||u?.loanDetails,onEdit:t.createdOrderId?void 0:()=>this.onEdit()})}else if(t.navigation.stage===this.props.index){let u=t.order?.orderVehicle,y=c.find(L=>L.type===F.PaymentType.Cash),k=c.find(L=>L.type===F.PaymentType.Loan),h=c.find(L=>L.type===F.PaymentType.Lease);p.innerHTML=`
1102
1102
  <div class="waykeecom-stack waykeecom-stack--3">
1103
1103
  <h4 class="waykeecom-heading waykeecom-heading--4 waykeecom-no-margin">Hur vill du finansiera din ${u?.title} ${pe(u)}?</h4>
1104
1104
  </div>