@wayke-se/ecom-web 1.4.5 → 1.4.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/README.md +65 -48
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var bc=(o=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(o,{get:(i,e)=>(typeof require<"u"?require:i)[e]}):o)(function(o){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+o+'" is not supported')});import{config as nd}from"@wayke-se/ecom";var Bo={name:"@wayke-se/ecom-web",version:"1.4.
|
|
1
|
+
var bc=(o=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(o,{get:(i,e)=>(typeof require<"u"?require:i)[e]}):o)(function(o){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+o+'" is not supported')});import{config as nd}from"@wayke-se/ecom";var Bo={name:"@wayke-se/ecom-web",version:"1.4.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",cl:"node ./esbuild/cl.js",build:"npm run clean && node ./esbuild/lib.js && node ./esbuild/cdn.js",clean:"rimraf build && rimraf dist && rimraf dist-cdn",test:"npm run lint && npm run typecheck",typecheck:"tsc -noEmit","typecheck:watch":"tsc -noEmit -watch",lint:"eslint --ext .ts,.js 'src'","lint:fix":"eslint --ext .ts,.js 'src' --fix",stylelint:"stylelint '**/*.scss'",prepare:"husky install"},author:"Wayke",license:"ISC",devDependencies:{"@types/marked":"^4.0.3","@types/node":"^17.0.18","@types/object-path":"^0.11.1","@types/sanitize-html":"^2.6.2","@typescript-eslint/eslint-plugin":"^5.12.0","@typescript-eslint/parser":"^5.12.0",esbuild:"^0.15.8","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":"^6.0.0",typescript:"^4.5.5"},dependencies:{"@wayke-se/ecom":"^4.1.0",marked:"^4.0.16","object-path":"^0.11.8",redux:"^4.1.2","sanitize-html":"^2.7.0"},files:["dist"]};import{createStore as xc}from"redux";import{DrivingDistance as Lc,PaymentType as ii}from"@wayke-se/ecom";var Xe=(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()}),Uo=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()}),Re=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()}),Fo=o=>({vehicle:o.getVehicle()});var Ze="RESET",Vo=o=>i=>i({type:Ze,id:o}),et="SET_ORDER",be=(o,i)=>e=>e({type:et,order:o,vehicle:i}),tt="SET_ID",Go=o=>i=>i({type:tt,id:o}),st="SET_CONTACT_EMAIL_AND_PHONE",qo=o=>i=>i({type:st,value:o}),ot="SET_SOCIAL_ID_AND_ADDRESS",Wo=(o,i,e)=>t=>t({type:ot,socialId:o,address:i,lastStage:e}),it="SET_HOME_DELIVERY",Yo=(o,i)=>e=>e({type:it,homeDelivery:o,lastStage:i}),nt="SET_DEALER",Ko=(o,i)=>e=>e({type:nt,dealer:o,lastStage:i}),at="INIT_TRADE_IN",jo=o=>i=>i({type:at,lastStage:o}),rt="SET_TRADE_IN",fe=(o,i,e)=>t=>t({type:rt,lastStage:o,tradeIn:i,tradeInVehicle:e}),ct="SET_FINANCIAL",zo=(o,i)=>e=>e({type:ct,paymentType:o,lastStage:i}),lt="SET_PAYMENT_LOOKUP_RESPONSE",Qo=o=>i=>i({type:lt,paymentLookupResponse:_e(o)}),dt="SET_DRIVING_DISTANCE",Jo=o=>i=>i({type:dt,drivingDistance:o}),mt="COMPLETE_STAGE",z=o=>i=>i({type:mt,lastStage:o}),pt="SET_OR_REMOVE_INSURANCE",re=o=>i=>i({type:pt,insurance:o}),ut="SET_OR_REMOVE_INSURANCE_ADDONS",Xo=(o,i)=>e=>e({type:ut,insurance:o,insuranceAddons:i}),ht="SET_OR_REMOVE_FREE_INSURANCE",Zo=o=>i=>i({type:ht,freeInsurance:o}),kt="SET_OR_REMOVE_ACCESSORY",ei=o=>i=>i({type:kt,accessory:o}),yt="GO_TO",b=(o,i,e)=>t=>t({type:yt,view:o,index:i,subStage:e}),vt="SET_STAGES",ti=o=>i=>i({type:vt,stages:o}),Et="SET_CREATED_ORDER_ID",si=(o,i)=>e=>e({type:Et,id:o,payment:i}),It="SET_CREDIT_ASSESSMENT_RESPONSE",ce=(o,i)=>e=>e({type:It,caseId:o,creditAssessmentResponse:i}),_t="SET_STATE",oi=o=>i=>i({type:_t,state:o});var wt={};try{wt=bc("../../statemock.json")}catch{wt={}}var ni={view:"preview",stage:1,subStage:1},ai={id:"",topNavigation:{...ni},navigation:{...ni},customer:{email:"",phone:"",givenName:"",surname:"",socialId:""},homeDelivery:!1,accessories:[],drivingDistance:Lc.Between0And1000,...wt},te=(o,i)=>i?{view:"summary",stage:1,subStage:1}:{view:"main",stage:o+1,subStage:1},se=(o,i)=>i.view==="main"?o.stage<i.stage?i:v.topNavigation:{...o,stage:o.stage+1},ft=o=>o&&o?.length===1&&o?.[0].type===ii.Cash?ii.Cash:void 0,v,gt,Mc=(o=ai,i)=>{let e,t;switch(v={...o},i.type){case Ze:return{...ai,id:i.id};case vt:return{...v,stages:i.stages};case tt:return{...v,id:i.id};case et:return{...o,order:i.order,paymentType:ft(i.order?.paymentOptions),vehicle:{...i.order.orderVehicle,...i.vehicle||{}}};case st: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=ft(o.order?.paymentOptions),delete s.paymentLookupResponse,delete s.insurance,delete s.insuranceAddOns,delete s.freeInsurance,delete s.dealer,s.accessories=[],s;case ot:return e=te(v.navigation.stage,i.lastStage),t=se(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,address:i.address,customer:{...o.customer,socialId:i.socialId}},v;case nt:return e=te(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=ft(o.order?.paymentOptions),delete v.paymentLookupResponse,delete v.insurance,delete v.insuranceAddOns,delete v.freeInsurance,v.accessories=[],v;case it:return e=te(o.navigation.stage,i.lastStage),t=se(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,homeDelivery:i.homeDelivery},v;case at:return e={view:"main",stage:o.navigation.stage,subStage:1},t=se(v.topNavigation,e),v={...o,navigation:e,wantTradeIn:!0,topNavigation:t,tradeIn:o.tradeIn||{registrationNumber:"",mileage:"",description:""}},v;case rt:return e=te(o.navigation.stage,i.lastStage),t=se(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,wantTradeIn:!!i.tradeIn,tradeIn:i.tradeIn,tradeInVehicle:i.tradeInVehicle},v;case ct:return e=te(o.navigation.stage,i.lastStage),t=se(v.topNavigation,e),{...v,navigation:e,topNavigation:t,paymentType:i.paymentType};case lt:return{...v,paymentLookupResponse:i.paymentLookupResponse};case dt:return{...v,drivingDistance:i.drivingDistance};case mt:return e=te(o.navigation.stage,i.lastStage),t=se(v.topNavigation,e),v={...o,navigation:e,topNavigation:t},v;case ut:return v.insurance=i.insurance,v.insuranceAddOns={insurance:i.insurance.name,addOns:i.insuranceAddons},v;case pt:return Xe(v.insurance,i.insurance)?v.insurance=void 0:v.insurance=i.insurance,v.insuranceAddOns?.insurance&&(v.insuranceAddOns=void 0),v;case ht:return Xe(v.freeInsurance,i.freeInsurance)?v.freeInsurance=void 0:v.freeInsurance=i.freeInsurance,v;case kt:return gt=v.accessories.findIndex(n=>n.id===i.accessory.id),v.accessories=[...v.accessories],gt>-1?v.accessories.splice(gt,1):v.accessories.push(i.accessory),{...v,accessories:[...v.accessories]};case yt:return{...o,navigation:{view:i.view,stage:i.index||1,subStage:i.subStage||1}};case Et:return i.payment?e={view:"main",stage:o.navigation.stage,subStage:2}:e=te(o.navigation.stage,!0),t=se(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,createdOrderId:i.id,payment:i.payment},v;case It:return{...v,caseId:i.caseId,creditAssessmentResponse:i.creditAssessmentResponse};case _t:return{...i.state};default:return o}},ri=Mc;var ci=()=>xc(ri);var Oe=(o,i)=>{if(!i)return o;let e=new URL(o);return`${i}${e.pathname}`};var Pc=o=>o.toString().replace(/\s/g,""),$c=(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=$c(o,i?.decimals!==void 0?i.decimals:0);return`${i?.prefix?`${i.prefix}`:""}${Pc(e).replace(/\B(?=(\d{3})+(?!\d))/g," ")}${i?.postfix?` ${i.postfix}`:""}`},Hc=(o,i)=>{let e=o.split(" "),t=i.split(" ").map(s=>s.toLowerCase());return e.filter(s=>!t.includes(s.toLowerCase())).join(" ")},le=o=>{if(!!o)return Hc(o.shortDescription||"",o.title||"")};var Bc=({vehicle:o,order:i,meta:e,cdnMedia:t})=>{let s=o?.imageUrls,n=o?.title,a=k(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">
|