@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 +2 -2
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +2 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",version:"1.6.
|
|
1
|
+
import{config as kd}from"@wayke-se/ecom";var Uo={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"]};import{createStore as Vc}from"redux";import{DrivingDistance as Bc,PaymentType as ai}from"@wayke-se/ecom";var tt=(o,i)=>o!==void 0&&i!==void 0?JSON.stringify(o).localeCompare(JSON.stringify(i))===0:o===i;var _e=o=>({costs:o.getCosts(),fees:o.getFees(),interests:o.getInterests(),durationSpec:o.getDurationSpec(),downPaymentSpec:o.getDownPaymentSpec(),residualValueSpec:o.getResidualValueSpec(),totalResidualValue:o.getTotalResidualValue(),publicURL:o.getPublicURL(),shouldUseCreditScoring:o.shouldUseCreditScoring(),financialProductCode:o.getFinancialProductCode(),price:o.getPrice(),creditAmount:o.getCreditAmount(),hasPrivacyPolicy:o.hasPrivacyPolicy(),privacyPolicyUrl:o.getPrivacyPolicyUrl(),moneyLaunderingInformationURL:o.getMoneyLaunderingInformationURL()}),Vo=o=>({status:o.getStatus(),hasPendingSigning:o.hasPendingSigning(),hintCode:o.getHintCode(),signingMessage:o.getSigningMessage(),shouldRenewSigning:o.shouldRenewSigning(),isSigned:o.isSigned(),address:void 0,pendingScoring:o.hasPendingScoring(),isScored:o.isScored(),hasScoringError:o.hasScoringError(),scoringId:o.getScoringId(),recommendation:o.getRecommendation(),decision:o.getDecision(),isAccepted:o.isAccepted()}),Le=o=>({orderVehicle:o.getOrderVehicle(),accessories:o.getAccessories(),requiresDealerSelection:o.requiresDealerSelection(),dealerSites:o.getDealerSites(),paymentOptions:o.getPaymentOptions().map(e=>({...e,loanDetails:e.loanDetails?_e(e.loanDetails):void 0})),deliveryOptions:o.getDeliveryOptions(),insuranceOption:o.getInsuranceOption(),orderConditions:o.getOrderConditions(),orderReturnConditions:o.getOrderReturnConditions(),conditionsPdfUri:o.getConditionsPdfUri(),contactInformation:o.getContactInformation(),allowsTradeIn:o.allowsTradeIn(),isUnavailable:o.isUnavailable(),isPaymentRequired:o.isPaymentRequired()}),Go=o=>({vehicle:o.getVehicle()});var st="RESET",qo=o=>i=>i({type:st,id:o}),ot="SET_ORDER",Oe=(o,i)=>e=>e({type:ot,order:o,vehicle:i}),it="SET_ID",Wo=o=>i=>i({type:it,id:o}),nt="SET_CONTACT_EMAIL_AND_PHONE",Yo=o=>i=>i({type:nt,value:o}),at="SET_SOCIAL_ID_AND_ADDRESS",Ko=(o,i,e)=>t=>t({type:at,socialId:o,address:i,lastStage:e}),rt="SET_HOME_DELIVERY",jo=(o,i)=>e=>e({type:rt,homeDelivery:o,lastStage:i}),ct="SET_DEALER",Qo=(o,i)=>e=>e({type:ct,dealer:o,lastStage:i}),lt="INIT_TRADE_IN",zo=o=>i=>i({type:lt,lastStage:o}),dt="SET_TRADE_IN",Se=(o,i,e)=>t=>t({type:dt,lastStage:o,tradeIn:i,tradeInVehicle:e}),mt="SET_FINANCIAL",Jo=(o,i)=>e=>e({type:mt,paymentType:o,lastStage:i}),pt="SET_PAYMENT_LOOKUP_RESPONSE",Xo=o=>i=>i({type:pt,paymentLookupResponse:_e(o)}),ut="SET_DRIVING_DISTANCE",Zo=o=>i=>i({type:ut,drivingDistance:o}),ht="COMPLETE_STAGE",z=o=>i=>i({type:ht,lastStage:o}),kt="SET_OR_REMOVE_INSURANCE",le=o=>i=>i({type:kt,insurance:o}),yt="SET_OR_REMOVE_INSURANCE_ADDONS",ei=(o,i)=>e=>e({type:yt,insurance:o,insuranceAddons:i}),vt="SET_OR_REMOVE_FREE_INSURANCE",ti=o=>i=>i({type:vt,freeInsurance:o}),Et="SET_OR_REMOVE_ACCESSORY",si=o=>i=>i({type:Et,accessory:o}),It="GO_TO",R=(o,i,e)=>t=>t({type:It,view:o,index:i,subStage:e}),ft="SET_STAGES",oi=o=>i=>i({type:ft,stages:o}),gt="SET_CREATED_ORDER_ID",ii=(o,i)=>e=>e({type:gt,id:o,payment:i}),_t="SET_CREDIT_ASSESSMENT_RESPONSE",de=(o,i)=>e=>e({type:_t,caseId:o,creditAssessmentResponse:i}),St="SET_STATE",ni=o=>i=>i({type:St,state:o});var Fc={};var ri={view:"preview",stage:1,subStage:1},ci={id:"",topNavigation:{...ri},navigation:{...ri},customer:{email:"",phone:"",givenName:"",surname:"",socialId:""},homeDelivery:!1,accessories:[],drivingDistance:Bc.Between0And1000,...Fc},ie=(o,i)=>i?{view:"summary",stage:1,subStage:1}:{view:"main",stage:o+1,subStage:1},ne=(o,i)=>i.view==="main"?o.stage<i.stage?i:E.topNavigation:{...o,stage:o.stage+1},wt=o=>o&&o?.length===1&&o?.[0].type===ai.Cash?ai.Cash:void 0,E,Nt,Uc=(o=ci,i)=>{let e,t;switch(E={...o},i.type){case st:return{...ci,id:i.id};case ft:return{...E,stages:i.stages};case it:return{...E,id:i.id};case ot:return{...o,order:i.order,paymentType:wt(i.order?.paymentOptions),vehicle:{...i.order.orderVehicle,...i.vehicle||{}}};case nt:let s={...E,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=wt(o.order?.paymentOptions),delete s.paymentLookupResponse,delete s.insurance,delete s.insuranceAddOns,delete s.freeInsurance,delete s.dealer,s.accessories=[],s;case at:return e=ie(E.navigation.stage,i.lastStage),t=ne(E.topNavigation,e),E={...o,navigation:e,topNavigation:t,address:i.address,customer:{...o.customer,socialId:i.socialId}},E;case ct:return e=ie(o.navigation.stage,i.lastStage),t={...e},E={...o,navigation:e,topNavigation:t,dealer:i.dealer},delete E.wantTradeIn,delete E.tradeIn,delete E.tradeInVehicle,E.paymentType=wt(o.order?.paymentOptions),delete E.paymentLookupResponse,delete E.insurance,delete E.insuranceAddOns,delete E.freeInsurance,E.accessories=[],E;case rt:return e=ie(o.navigation.stage,i.lastStage),t=ne(E.topNavigation,e),E={...o,navigation:e,topNavigation:t,homeDelivery:i.homeDelivery},E;case lt:return e={view:"main",stage:o.navigation.stage,subStage:1},t=ne(E.topNavigation,e),E={...o,navigation:e,wantTradeIn:!0,topNavigation:t,tradeIn:o.tradeIn||{registrationNumber:"",mileage:"",description:""}},E;case dt:return e=ie(o.navigation.stage,i.lastStage),t=ne(E.topNavigation,e),E={...o,navigation:e,topNavigation:t,wantTradeIn:!!i.tradeIn,tradeIn:i.tradeIn,tradeInVehicle:i.tradeInVehicle},E;case mt:return e=ie(o.navigation.stage,i.lastStage),t=ne(E.topNavigation,e),{...E,navigation:e,topNavigation:t,paymentType:i.paymentType};case pt:return{...E,paymentLookupResponse:i.paymentLookupResponse};case ut:return{...E,drivingDistance:i.drivingDistance};case ht:return e=ie(o.navigation.stage,i.lastStage),t=ne(E.topNavigation,e),E={...o,navigation:e,topNavigation:t},E;case yt:return E.insurance=i.insurance,E.insuranceAddOns={insurance:i.insurance.name,addOns:i.insuranceAddons},E;case kt:return tt(E.insurance,i.insurance)?E.insurance=void 0:E.insurance=i.insurance,E.insuranceAddOns?.insurance&&(E.insuranceAddOns=void 0),E;case vt:return tt(E.freeInsurance,i.freeInsurance)?E.freeInsurance=void 0:E.freeInsurance=i.freeInsurance,E;case Et:return Nt=E.accessories.findIndex(n=>n.id===i.accessory.id),E.accessories=[...E.accessories],Nt>-1?E.accessories.splice(Nt,1):E.accessories.push(i.accessory),{...E,accessories:[...E.accessories]};case It:return{...o,navigation:{view:i.view,stage:i.index||1,subStage:i.subStage||1}};case gt:return i.payment?e={view:"main",stage:o.navigation.stage,subStage:2}:e=ie(o.navigation.stage,!0),t=ne(E.topNavigation,e),E={...o,navigation:e,topNavigation:t,createdOrderId:i.id,payment:i.payment},E;case _t:return{...E,caseId:i.caseId,creditAssessmentResponse:i.creditAssessmentResponse};case St:return{...i.state};default:return o}},li=Uc;var di=()=>Vc(li);var Me=(o,i)=>{if(!i)return o;let e=new URL(o);return`${i}${e.pathname}`};var Gc=o=>o.toString().replace(/\s/g,""),qc=(o,i)=>{if(!i)return o;let e=Math.pow(10,i);return(Math.round(o*e)/e).toFixed(i)},v=(o,i)=>{if(o===void 0)return"???";let e=qc(o,i?.decimals!==void 0?i.decimals:0);return`${i?.prefix?`${i.prefix}`:""}${Gc(e).replace(/\B(?=(\d{3})+(?!\d))/g," ")}${i?.postfix?` ${i.postfix}`:""}`},Wc=(o,i)=>{let e=o.split(" "),t=i.split(" ").map(s=>s.toLowerCase());return e.filter(s=>!t.includes(s.toLowerCase())).join(" ")},me=o=>{if(!!o)return Wc(o.shortDescription||"",o.title||"")};var Yc=({vehicle:o,order:i,meta:e,cdnMedia:t})=>{let s=o?.imageUrls,n=o?.title,a=v(o?.price||NaN),c=i?.contactInformation?.name;return`
|
|
2
2
|
<div class="waykeecom-product-card">
|
|
3
3
|
${s?.length?`
|
|
4
4
|
<div class="waykeecom-product-card__media">
|
|
@@ -1098,7 +1098,7 @@ import{config as kd}from"@wayke-se/ecom";var Uo={name:"@wayke-se/ecom-web",versi
|
|
|
1098
1098
|
</div>
|
|
1099
1099
|
</div>
|
|
1100
1100
|
`:""}
|
|
1101
|
-
`;a&&this.node.querySelector("button")?.addEventListener("click",()=>a())}},Oa=Ps;var Ha="button-financial-proceed",Ma=`${Ha}-node`,zl="financial-option",xa=`${zl}-node`,Jl="financial-option-second",Pa=`${Jl}-node`,Xl="radio-financial-cash",Zl="radio-financial-loan",ed="radio-financial-lease",$a="payment-node",$s=class extends r{constructor(e,t){super(e);this.props=t,g(this.props.store,"navigation",()=>{let a=this.props.store.getState();this.paymentType=a.paymentType,this.render()});let s=this.props.store.getState(),{paymentType:n}=s;this.paymentType=n,this.render()}onChange(e){let s=e.currentTarget.value;switch(this.paymentType=s,this.render(!0),this.paymentType){case $.Cash:d("MAIN","FINANCIAL_CASH_SELECTED","FINANCIAL");break;case $.Lease:d("MAIN","FINANCIAL_LEASE_SELECTED","FINANCIAL");case $.Loan:d("MAIN","FINANCIAL_LOAN_SELECTED","FINANCIAL");default:break}}onProceed(){if(this.paymentType){switch(this.paymentType){case $.Cash:d("MAIN","FINANCIAL_CASH_SET","FINANCIAL");break;case $.Lease:d("MAIN","FINANCIAL_LEASE_SET","FINANCIAL");case $.Loan:d("MAIN","FINANCIAL_LOAN_SET","FINANCIAL");default:break}Jo(this.paymentType,this.props.lastStage)(this.props.store.dispatch)}}onEdit(){d("MAIN","FINANCIAL_EDIT","FINANCIAL"),R("main",this.props.index)(this.props.store.dispatch)}render(e){let t=this.props.store.getState(),{id:s,order:n,paymentLookupResponse:a}=t;if(!n)throw"No order available";let c=n.paymentOptions,l=t.topNavigation.stage>this.props.index,m=P(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===$.Loan);new Oa(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(b=>b.type===$.Cash),k=c.find(b=>b.type===$.Loan),h=c.find(b=>b.type===$.Lease);p.innerHTML=`
|
|
1101
|
+
`;a&&this.node.querySelector("button")?.addEventListener("click",()=>a())}},Oa=Ps;var Ha="button-financial-proceed",Ma=`${Ha}-node`,zl="financial-option",xa=`${zl}-node`,Jl="financial-option-second",Pa=`${Jl}-node`,Xl="radio-financial-cash",Zl="radio-financial-loan",ed="radio-financial-lease",$a="payment-node",$s=class extends r{constructor(e,t){super(e);this.props=t,g(this.props.store,"navigation",()=>{let a=this.props.store.getState();this.paymentType=a.paymentType,this.render()});let s=this.props.store.getState(),{paymentType:n}=s;this.paymentType=n,this.render()}onChange(e){let s=e.currentTarget.value;switch(this.paymentType=s,this.render(!0),this.paymentType){case $.Cash:d("MAIN","FINANCIAL_CASH_SELECTED","FINANCIAL");break;case $.Lease:d("MAIN","FINANCIAL_LEASE_SELECTED","FINANCIAL");break;case $.Loan:d("MAIN","FINANCIAL_LOAN_SELECTED","FINANCIAL");default:break}}onProceed(){if(this.paymentType){switch(this.paymentType){case $.Cash:d("MAIN","FINANCIAL_CASH_SET","FINANCIAL");break;case $.Lease:d("MAIN","FINANCIAL_LEASE_SET","FINANCIAL");break;case $.Loan:d("MAIN","FINANCIAL_LOAN_SET","FINANCIAL");default:break}Jo(this.paymentType,this.props.lastStage)(this.props.store.dispatch)}}onEdit(){d("MAIN","FINANCIAL_EDIT","FINANCIAL"),R("main",this.props.index)(this.props.store.dispatch)}render(e){let t=this.props.store.getState(),{id:s,order:n,paymentLookupResponse:a}=t;if(!n)throw"No order available";let c=n.paymentOptions,l=t.topNavigation.stage>this.props.index,m=P(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===$.Loan);new Oa(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(b=>b.type===$.Cash),k=c.find(b=>b.type===$.Loan),h=c.find(b=>b.type===$.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} ${me(u)}?</h4>
|
|
1104
1104
|
</div>
|