@wayke-se/ecom-web 1.7.1 → 1.7.2-beta.1
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 → index.cjs} +2 -2
- package/dist/index.cjs.map +7 -0
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +2 -2
- package/package.json +1 -1
- package/dist/index.js.map +0 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var qr=Object.create;var Le=Object.defineProperty;var el=Object.getOwnPropertyDescriptor;var tl=Object.getOwnPropertyNames;var il=Object.getPrototypeOf,ol=Object.prototype.hasOwnProperty;var al=(o,t)=>{for(var e in t)Le(o,e,{get:t[e],enumerable:!0})},ia=(o,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of tl(t))!ol.call(o,a)&&a!==e&&Le(o,a,{get:()=>t[a],enumerable:!(i=el(t,a))||i.enumerable});return o};var oa=(o,t,e)=>(e=o!=null?qr(il(o)):{},ia(t||!o||!o.__esModule?Le(e,"default",{value:o,enumerable:!0}):e,o)),sl=o=>ia(Le({},"__esModule",{value:!0}),o);var Bd={};al(Bd,{default:()=>Ed});module.exports=sl(Bd);var Mr=require("@wayke-se/ecom");var aa={name:"@wayke-se/ecom-web",version:"1.7.1",description:"Wayke Ecom Web",type:"module",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"},author:"Wayke",license:"ISC",devDependencies:{"@ourstudio/clip-ui":"^0.0.11","@types/node":"^18.19.17","@types/object-path":"^0.11.1","@types/sanitize-html":"^2.6.2","@types/showdown":"^2.0.6","@typescript-eslint/eslint-plugin":"^7.0.1","@typescript-eslint/parser":"^7.0.1",esbuild:"^0.20.0","esbuild-sass-plugin":"^3.2.0",eslint:"^8.9.0","eslint-config-prettier":"^9.1.0","eslint-plugin-prettier":"^5.1.3",husky:"^9.0.11","npm-dts":"^1.3.11",prettier:"^3.2.5",rimraf:"^5.0.1",stylelint:"^16.2.1","stylelint-config-prettier-scss":"^1.0.0","stylelint-config-standard-scss":"^13.0.0",typescript:"^5.1.3"},dependencies:{"@wayke-se/ecom":"^4.5.0","object-path":"^0.11.8",redux:"^5.0.1","sanitize-html":"^2.7.0",showdown:"^2.1.0"},files:["dist"]};var xa=require("redux");var fe=require("@wayke-se/ecom");var nt=(o,t)=>o!==void 0&&t!==void 0?JSON.stringify(o).localeCompare(JSON.stringify(t))===0:o===t;var Ge=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(),financialOptionId:o.getFinancialOptionId()}),sa=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()}),_e=o=>({orderVehicle:o.getOrderVehicle(),accessories:o.getAccessories(),requiresDealerSelection:o.requiresDealerSelection(),dealerSites:o.getDealerSites(),paymentOptions:o.getPaymentOptions().map(e=>({...e,loanDetails:e.loanDetails?Ge(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()}),na=o=>({vehicle:o.getVehicle()});var ct="RESET",ca=o=>t=>t({type:ct,id:o}),rt="SET_ORDER",Xe=(o,t)=>e=>e({type:rt,order:o,vehicle:t}),lt="SET_ID",ra=o=>t=>t({type:lt,id:o}),dt="SET_CONTACT_EMAIL_AND_PHONE",la=o=>t=>t({type:dt,value:o}),mt="SET_SOCIAL_ID_AND_ADDRESS",da=(o,t,e)=>i=>i({type:mt,socialId:o,address:t,lastStage:e}),pt="SET_HOME_DELIVERY",ma=(o,t)=>e=>e({type:pt,homeDelivery:o,lastStage:t}),gt="SET_DEALER",pa=(o,t)=>e=>e({type:gt,dealer:o,lastStage:t}),It="INIT_TRADE_IN",ga=o=>t=>t({type:It,lastStage:o}),ut="SET_TRADE_IN",Ne=(o,t,e)=>i=>i({type:ut,lastStage:o,tradeIn:t,tradeInVehicle:e}),yt="SET_FINANCIAL",Ia=(o,t)=>e=>e({type:yt,paymentType:o,lastStage:t}),bt="SET_PAYMENT_LOOKUP_RESPONSE",ua=o=>t=>t({type:bt,paymentLookupResponse:Ge(o)}),ht="RESET_PAYMENT_LOOKUP_RESPONSE",ya=()=>o=>o({type:ht}),kt="SET_DRIVING_DISTANCE",ba=o=>t=>t({type:kt,drivingDistance:o}),Ct="COMPLETE_STAGE",K=o=>t=>t({type:Ct,lastStage:o}),At="SET_OR_REMOVE_INSURANCE",me=o=>t=>t({type:At,insurance:o}),vt="SET_OR_REMOVE_INSURANCE_ADDONS",ha=(o,t)=>e=>e({type:vt,insurance:o,insuranceAddons:t}),wt="SET_OR_REMOVE_FREE_INSURANCE",ka=o=>t=>t({type:wt,freeInsurance:o}),Gt="SET_OR_REMOVE_ACCESSORY",Ca=o=>t=>t({type:Gt,accessory:o}),Nt="GO_TO",O=(o,t,e)=>i=>i({type:Nt,view:o,index:t,subStage:e}),ft="SET_STAGES",Aa=o=>t=>t({type:ft,stages:o}),xt="SET_CREATED_ORDER_ID",va=(o,t)=>e=>e({type:xt,id:o,payment:t}),Et="SET_CREDIT_ASSESSMENT_RESPONSE",pe=(o,t)=>e=>e({type:Et,caseId:o,creditAssessmentResponse:t}),Bt="SET_STATE",wa=o=>t=>t({type:Bt,state:o});var cl={};var Ga={view:"preview",stage:1,subStage:1},Na={id:"",topNavigation:{...Ga},navigation:{...Ga},customer:{email:"",phone:"",givenName:"",surname:"",socialId:""},homeDelivery:!1,accessories:[],drivingDistance:fe.DrivingDistance.Between0And1000,...cl},ce=(o,t)=>t?{view:"summary",stage:1,subStage:1}:{view:"main",stage:o+1,subStage:1},re=(o,t)=>t.view==="main"?o.stage<t.stage?t:b.topNavigation:{...o,stage:o.stage+1},Rt=o=>o&&o?.length===1&&o?.[0].type===fe.PaymentType.Cash?fe.PaymentType.Cash:void 0,b,St,rl=(o=Na,t)=>{let e,i;switch(b={...o},t.type){case ct:return{...Na,id:t.id};case ft:return{...b,stages:t.stages};case lt:return{...b,id:t.id};case rt:return{...o,order:t.order,paymentType:Rt(t.order?.paymentOptions),vehicle:{...t.order.orderVehicle,...t.vehicle||{}}};case dt:let a={...b,customer:{...o.customer,email:t.value.email,phone:t.value.phone},navigation:{view:"main",stage:o.navigation.stage,subStage:2}};return delete a.wantTradeIn,delete a.tradeIn,delete a.tradeInVehicle,a.paymentType=Rt(o.order?.paymentOptions),delete a.paymentLookupResponse,delete a.insurance,delete a.insuranceAddOns,delete a.freeInsurance,delete a.dealer,a.accessories=[],a;case mt:return e=ce(b.navigation.stage,t.lastStage),i=re(b.topNavigation,e),b={...o,navigation:e,topNavigation:i,address:t.address,customer:{...o.customer,socialId:t.socialId}},b;case gt:return e=ce(o.navigation.stage,t.lastStage),i={...e},b={...o,navigation:e,topNavigation:i,dealer:t.dealer},delete b.wantTradeIn,delete b.tradeIn,delete b.tradeInVehicle,b.paymentType=Rt(o.order?.paymentOptions),delete b.paymentLookupResponse,delete b.insurance,delete b.insuranceAddOns,delete b.freeInsurance,b.accessories=[],b;case pt:return e=ce(o.navigation.stage,t.lastStage),i=re(b.topNavigation,e),b={...o,navigation:e,topNavigation:i,homeDelivery:t.homeDelivery},b;case It:return e={view:"main",stage:o.navigation.stage,subStage:1},i=re(b.topNavigation,e),b={...o,navigation:e,wantTradeIn:!0,topNavigation:i,tradeIn:o.tradeIn||{registrationNumber:"",mileage:"",description:""}},b;case ut:return e=ce(o.navigation.stage,t.lastStage),i=re(b.topNavigation,e),b={...o,navigation:e,topNavigation:i,wantTradeIn:!!t.tradeIn,tradeIn:t.tradeIn,tradeInVehicle:t.tradeInVehicle},b;case yt:return e=ce(o.navigation.stage,t.lastStage),i=re(b.topNavigation,e),{...b,navigation:e,topNavigation:i,paymentType:t.paymentType};case ht:return{...b,paymentLookupResponse:void 0};case bt:return{...b,paymentLookupResponse:t.paymentLookupResponse};case kt:return{...b,drivingDistance:t.drivingDistance};case Ct:return e=ce(o.navigation.stage,t.lastStage),i=re(b.topNavigation,e),b={...o,navigation:e,topNavigation:i},b;case vt:return b.insurance=t.insurance,b.insuranceAddOns={insurance:t.insurance.name,addOns:t.insuranceAddons},b;case At:return nt(b.insurance,t.insurance)?b.insurance=void 0:b.insurance=t.insurance,b.insuranceAddOns?.insurance&&(b.insuranceAddOns=void 0),b;case wt:return nt(b.freeInsurance,t.freeInsurance)?b.freeInsurance=void 0:b.freeInsurance=t.freeInsurance,b;case Gt:return St=b.accessories.findIndex(s=>s.id===t.accessory.id),b.accessories=[...b.accessories],St>-1?b.accessories.splice(St,1):b.accessories.push(t.accessory),{...b,accessories:[...b.accessories]};case Nt:return{...o,navigation:{view:t.view,stage:t.index||1,subStage:t.subStage||1}};case xt:return t.payment?e={view:"main",stage:o.navigation.stage,subStage:2}:e=ce(o.navigation.stage,!0),i=re(b.topNavigation,e),b={...o,navigation:e,topNavigation:i,createdOrderId:t.id,payment:t.payment},b;case Et:return{...b,caseId:t.caseId,creditAssessmentResponse:t.creditAssessmentResponse};case Bt:return{...t.state};default:return o}},fa=rl;var Ea=()=>(0,xa.createStore)(fa);var Te=(o,t)=>{if(!t)return o;let e=new URL(o);return`${t}${e.pathname}`};var ll=o=>o.toString().replace(/\s/g,""),dl=(o,t)=>{if(!t)return o;let e=Math.pow(10,t);return(Math.round(o*e)/e).toFixed(t)},y=(o,t)=>{if(o===void 0)return"???";let e=dl(o,t?.decimals!==void 0?t.decimals:0);return`${t?.prefix?`${t.prefix}`:""}${ll(e).replace(/\B(?=(\d{3})+(?!\d))/g," ")}${t?.postfix?` ${t.postfix}`:""}`},ml=(o,t)=>{let e=o.split(" "),i=t.split(" ").map(a=>a.toLowerCase());return e.filter(a=>!i.includes(a.toLowerCase())).join(" ")},ge=o=>{if(o)return ml(o.shortDescription||"",o.title||"")};var pl=({vehicle:o,order:t,meta:e,cdnMedia:i})=>{let a=o?.imageUrls,s=o?.title,n=y(o?.price||NaN),l=t?.contactInformation?.name;return`
|
|
1
|
+
"use strict";var qr=Object.create;var Le=Object.defineProperty;var el=Object.getOwnPropertyDescriptor;var tl=Object.getOwnPropertyNames;var il=Object.getPrototypeOf,ol=Object.prototype.hasOwnProperty;var al=(o,t)=>{for(var e in t)Le(o,e,{get:t[e],enumerable:!0})},ia=(o,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of tl(t))!ol.call(o,a)&&a!==e&&Le(o,a,{get:()=>t[a],enumerable:!(i=el(t,a))||i.enumerable});return o};var oa=(o,t,e)=>(e=o!=null?qr(il(o)):{},ia(t||!o||!o.__esModule?Le(e,"default",{value:o,enumerable:!0}):e,o)),sl=o=>ia(Le({},"__esModule",{value:!0}),o);var Bd={};al(Bd,{default:()=>Ed});module.exports=sl(Bd);var Mr=require("@wayke-se/ecom");var aa={name:"@wayke-se/ecom-web",version:"1.7.2-beta.1",description:"Wayke Ecom Web",type:"module",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"},author:"Wayke",license:"ISC",devDependencies:{"@ourstudio/clip-ui":"^0.0.11","@types/node":"^18.19.17","@types/object-path":"^0.11.1","@types/sanitize-html":"^2.6.2","@types/showdown":"^2.0.6","@typescript-eslint/eslint-plugin":"^7.0.1","@typescript-eslint/parser":"^7.0.1",esbuild:"^0.20.0","esbuild-sass-plugin":"^3.2.0",eslint:"^8.9.0","eslint-config-prettier":"^9.1.0","eslint-plugin-prettier":"^5.1.3",husky:"^9.0.11","npm-dts":"^1.3.11",prettier:"^3.2.5",rimraf:"^5.0.1",stylelint:"^16.2.1","stylelint-config-prettier-scss":"^1.0.0","stylelint-config-standard-scss":"^13.0.0",typescript:"^5.1.3"},dependencies:{"@wayke-se/ecom":"^4.5.0","object-path":"^0.11.8",redux:"^5.0.1","sanitize-html":"^2.7.0",showdown:"^2.1.0"},files:["dist"]};var xa=require("redux");var fe=require("@wayke-se/ecom");var nt=(o,t)=>o!==void 0&&t!==void 0?JSON.stringify(o).localeCompare(JSON.stringify(t))===0:o===t;var Ge=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(),financialOptionId:o.getFinancialOptionId()}),sa=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()}),_e=o=>({orderVehicle:o.getOrderVehicle(),accessories:o.getAccessories(),requiresDealerSelection:o.requiresDealerSelection(),dealerSites:o.getDealerSites(),paymentOptions:o.getPaymentOptions().map(e=>({...e,loanDetails:e.loanDetails?Ge(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()}),na=o=>({vehicle:o.getVehicle()});var ct="RESET",ca=o=>t=>t({type:ct,id:o}),rt="SET_ORDER",Xe=(o,t)=>e=>e({type:rt,order:o,vehicle:t}),lt="SET_ID",ra=o=>t=>t({type:lt,id:o}),dt="SET_CONTACT_EMAIL_AND_PHONE",la=o=>t=>t({type:dt,value:o}),mt="SET_SOCIAL_ID_AND_ADDRESS",da=(o,t,e)=>i=>i({type:mt,socialId:o,address:t,lastStage:e}),pt="SET_HOME_DELIVERY",ma=(o,t)=>e=>e({type:pt,homeDelivery:o,lastStage:t}),gt="SET_DEALER",pa=(o,t)=>e=>e({type:gt,dealer:o,lastStage:t}),It="INIT_TRADE_IN",ga=o=>t=>t({type:It,lastStage:o}),ut="SET_TRADE_IN",Ne=(o,t,e)=>i=>i({type:ut,lastStage:o,tradeIn:t,tradeInVehicle:e}),yt="SET_FINANCIAL",Ia=(o,t)=>e=>e({type:yt,paymentType:o,lastStage:t}),bt="SET_PAYMENT_LOOKUP_RESPONSE",ua=o=>t=>t({type:bt,paymentLookupResponse:Ge(o)}),ht="RESET_PAYMENT_LOOKUP_RESPONSE",ya=()=>o=>o({type:ht}),kt="SET_DRIVING_DISTANCE",ba=o=>t=>t({type:kt,drivingDistance:o}),Ct="COMPLETE_STAGE",K=o=>t=>t({type:Ct,lastStage:o}),At="SET_OR_REMOVE_INSURANCE",me=o=>t=>t({type:At,insurance:o}),vt="SET_OR_REMOVE_INSURANCE_ADDONS",ha=(o,t)=>e=>e({type:vt,insurance:o,insuranceAddons:t}),wt="SET_OR_REMOVE_FREE_INSURANCE",ka=o=>t=>t({type:wt,freeInsurance:o}),Gt="SET_OR_REMOVE_ACCESSORY",Ca=o=>t=>t({type:Gt,accessory:o}),Nt="GO_TO",O=(o,t,e)=>i=>i({type:Nt,view:o,index:t,subStage:e}),ft="SET_STAGES",Aa=o=>t=>t({type:ft,stages:o}),xt="SET_CREATED_ORDER_ID",va=(o,t)=>e=>e({type:xt,id:o,payment:t}),Et="SET_CREDIT_ASSESSMENT_RESPONSE",pe=(o,t)=>e=>e({type:Et,caseId:o,creditAssessmentResponse:t}),Bt="SET_STATE",wa=o=>t=>t({type:Bt,state:o});var cl={};var Ga={view:"preview",stage:1,subStage:1},Na={id:"",topNavigation:{...Ga},navigation:{...Ga},customer:{email:"",phone:"",givenName:"",surname:"",socialId:""},homeDelivery:!1,accessories:[],drivingDistance:fe.DrivingDistance.Between0And1000,...cl},ce=(o,t)=>t?{view:"summary",stage:1,subStage:1}:{view:"main",stage:o+1,subStage:1},re=(o,t)=>t.view==="main"?o.stage<t.stage?t:b.topNavigation:{...o,stage:o.stage+1},Rt=o=>o&&o?.length===1&&o?.[0].type===fe.PaymentType.Cash?fe.PaymentType.Cash:void 0,b,St,rl=(o=Na,t)=>{let e,i;switch(b={...o},t.type){case ct:return{...Na,id:t.id};case ft:return{...b,stages:t.stages};case lt:return{...b,id:t.id};case rt:return{...o,order:t.order,paymentType:Rt(t.order?.paymentOptions),vehicle:{...t.order.orderVehicle,...t.vehicle||{}}};case dt:let a={...b,customer:{...o.customer,email:t.value.email,phone:t.value.phone},navigation:{view:"main",stage:o.navigation.stage,subStage:2}};return delete a.wantTradeIn,delete a.tradeIn,delete a.tradeInVehicle,a.paymentType=Rt(o.order?.paymentOptions),delete a.paymentLookupResponse,delete a.insurance,delete a.insuranceAddOns,delete a.freeInsurance,delete a.dealer,a.accessories=[],a;case mt:return e=ce(b.navigation.stage,t.lastStage),i=re(b.topNavigation,e),b={...o,navigation:e,topNavigation:i,address:t.address,customer:{...o.customer,socialId:t.socialId}},b;case gt:return e=ce(o.navigation.stage,t.lastStage),i={...e},b={...o,navigation:e,topNavigation:i,dealer:t.dealer},delete b.wantTradeIn,delete b.tradeIn,delete b.tradeInVehicle,b.paymentType=Rt(o.order?.paymentOptions),delete b.paymentLookupResponse,delete b.insurance,delete b.insuranceAddOns,delete b.freeInsurance,b.accessories=[],b;case pt:return e=ce(o.navigation.stage,t.lastStage),i=re(b.topNavigation,e),b={...o,navigation:e,topNavigation:i,homeDelivery:t.homeDelivery},b;case It:return e={view:"main",stage:o.navigation.stage,subStage:1},i=re(b.topNavigation,e),b={...o,navigation:e,wantTradeIn:!0,topNavigation:i,tradeIn:o.tradeIn||{registrationNumber:"",mileage:"",description:""}},b;case ut:return e=ce(o.navigation.stage,t.lastStage),i=re(b.topNavigation,e),b={...o,navigation:e,topNavigation:i,wantTradeIn:!!t.tradeIn,tradeIn:t.tradeIn,tradeInVehicle:t.tradeInVehicle},b;case yt:return e=ce(o.navigation.stage,t.lastStage),i=re(b.topNavigation,e),{...b,navigation:e,topNavigation:i,paymentType:t.paymentType};case ht:return{...b,paymentLookupResponse:void 0};case bt:return{...b,paymentLookupResponse:t.paymentLookupResponse};case kt:return{...b,drivingDistance:t.drivingDistance};case Ct:return e=ce(o.navigation.stage,t.lastStage),i=re(b.topNavigation,e),b={...o,navigation:e,topNavigation:i},b;case vt:return b.insurance=t.insurance,b.insuranceAddOns={insurance:t.insurance.name,addOns:t.insuranceAddons},b;case At:return nt(b.insurance,t.insurance)?b.insurance=void 0:b.insurance=t.insurance,b.insuranceAddOns?.insurance&&(b.insuranceAddOns=void 0),b;case wt:return nt(b.freeInsurance,t.freeInsurance)?b.freeInsurance=void 0:b.freeInsurance=t.freeInsurance,b;case Gt:return St=b.accessories.findIndex(s=>s.id===t.accessory.id),b.accessories=[...b.accessories],St>-1?b.accessories.splice(St,1):b.accessories.push(t.accessory),{...b,accessories:[...b.accessories]};case Nt:return{...o,navigation:{view:t.view,stage:t.index||1,subStage:t.subStage||1}};case xt:return t.payment?e={view:"main",stage:o.navigation.stage,subStage:2}:e=ce(o.navigation.stage,!0),i=re(b.topNavigation,e),b={...o,navigation:e,topNavigation:i,createdOrderId:t.id,payment:t.payment},b;case Et:return{...b,caseId:t.caseId,creditAssessmentResponse:t.creditAssessmentResponse};case Bt:return{...t.state};default:return o}},fa=rl;var Ea=()=>(0,xa.createStore)(fa);var Te=(o,t)=>{if(!t)return o;let e=new URL(o);return`${t}${e.pathname}`};var ll=o=>o.toString().replace(/\s/g,""),dl=(o,t)=>{if(!t)return o;let e=Math.pow(10,t);return(Math.round(o*e)/e).toFixed(t)},y=(o,t)=>{if(o===void 0)return"???";let e=dl(o,t?.decimals!==void 0?t.decimals:0);return`${t?.prefix?`${t.prefix}`:""}${ll(e).replace(/\B(?=(\d{3})+(?!\d))/g," ")}${t?.postfix?` ${t.postfix}`:""}`},ml=(o,t)=>{let e=o.split(" "),i=t.split(" ").map(a=>a.toLowerCase());return e.filter(a=>!i.includes(a.toLowerCase())).join(" ")},ge=o=>{if(o)return ml(o.shortDescription||"",o.title||"")};var pl=({vehicle:o,order:t,meta:e,cdnMedia:i})=>{let a=o?.imageUrls,s=o?.title,n=y(o?.price||NaN),l=t?.contactInformation?.name;return`
|
|
2
2
|
<div class="waykeecom-product-card">
|
|
3
3
|
${a?.length?`
|
|
4
4
|
<div class="waykeecom-product-card__media">
|
|
@@ -1883,4 +1883,4 @@
|
|
|
1883
1883
|
<div class="waykeecom-stack waykeecom-stack--1" id="${Dr}"></div>
|
|
1884
1884
|
</div>
|
|
1885
1885
|
`,new Ke(this.node.querySelector(`#${Yr}`),{title:"Forts\xE4tt min order",onClick:()=>e()}),new Qr(this.node.querySelector(`#${Dr}`),{title:"Avbryt min order",onClick:()=>t()})}},Hr=$o;var Ko=()=>{let o=document.documentElement.clientWidth/100;document.documentElement.style.setProperty("--waykeecom-vw",`${o}px`)},zr=()=>(Ko(),window.addEventListener("resize",Ko),()=>window.removeEventListener("resize",Ko));var qo="order",Gd="wayke-ecom-web-payment",ea="wayke-ecom-web-id",Ee="wayke-ecom-modal",Nd="ecom.wayketech.se",fd="ecom.wayke.se",xd=o=>{switch(new URL(o).host){case fd:return"https://cdn.wayke.se";case Nd:return"https://test-cdn.wayketech.se";default:return}},ta=class{constructor(t){this.contexts={store:Ea()};if(!t.id)throw"Missing id";this.props=t,window.process||(window.process={...window.process||{},env:{}}),Mr.config.bind(t.ecomSdkConfig),this.cdnMedia=xd(t.ecomSdkConfig.api.address);let e=document.createElement("div");if(e.className="waykeecom-root",this.root=e,this.props.rootId){let l=document.getElementById(this.props.rootId);if(!l)throw"Missing element with id wayke-ecom";l.appendChild(e)}else document.body.appendChild(this.root);this.root.dataset.version=aa.version,this.stageOrderList=["centralStorage","customer","financial","tradeIn","accessories","insurance","delivery"],ra(t.id)(this.contexts.store.dispatch),this.view=this.contexts.store.getState().navigation.view,A(this.contexts.store,"navigation.view",l=>{this.view=l,l!=="preview"&&this.render()},!0);let i=new URLSearchParams(location.search),a=i.get(qo)||void 0,s=!!i.get(Gd),n=i.get(ea);if(n&&n===this.props.id&&(a||s))if(s){let l=sessionStorage.getItem("wayke-ecom-state");sessionStorage.removeItem("wayke-ecom-state");let r=l?JSON.parse(l):void 0;r&&(this.view=r.navigation.view,wa({...r,stateLoadedFromSession:!0})(this.contexts.store.dispatch))}else a&&this.render({orderUrl:a,id:n})}close(){let t=xe();t&&d(t.view,"CLOSE",t.currentStep);let{caseId:e}=this.contexts.store.getState(),i=new URLSearchParams(location.search),a=i.get(qo),s=i.get(ea),n=!1;a&&(i.delete(qo),n=!0,location.search=i.toString()),s&&(i.delete(ea),n=!0),n&&(location.search=i.toString()),this.root.innerHTML="",this.contexts?.unsubribeVwListner?.(),Si(),Oa(),e&&Se(e),sessionStorage.removeItem("wayke-ecom-state"),ca(this.props.id)(this.contexts.store.dispatch),this.props.onEvent&&La(this.props.onEvent)}destroy(){this.close(),this.root.remove()}closeWithConfirm(){let{navigation:t,createdOrderId:e}=this.contexts.store.getState(),i=t.view==="preview";if(Si(),i||e){this.close();return}this.contexts.modal=new jo(this.root,{title:"Wayke Ecom",id:Ee,logo:this.props.logo,logoX2:this.props.logoX2});let a=xe();a&&d(a.view,"CONFIRM_CLOSE_ACTIVE"),new Hr(this.contexts.modal.content,{onConfirmClose:()=>{let s=xe();d(s.view,"CONFIRM_CLOSE_CONFIRMED",s.currentStep),this.close()},onAbortClose:()=>{let s=xe();d(s.view,"CONFIRM_CLOSE_ABORTED",s.currentStep),this.render()}})}start(){this.props.onEvent&&Fa(this.props.onEvent),d("PREVIEW","START"),this.render()}render(t){if(this.contexts.unsubribeVwListner||(this.contexts.unsubribeVwListner=zr()),this.contexts.modal=new jo(this.root,{title:"Wayke Ecom",id:Ee,logo:this.props.logo,logoX2:this.props.logoX2,onClose:()=>this.closeWithConfirm()}),this.contexts.modal.content){if(this.contexts.modal.content.innerHTML="",t){new Fr(this.contexts.modal.content,{store:this.contexts.store,callbackOrder:t,onClose:()=>this.close()});return}switch(this.view){case"preview":new rr(this.contexts.modal.content,{store:this.contexts.store,stageOrderList:this.stageOrderList,vehicle:this.props.vehicle,cdnMedia:this.cdnMedia});break;case"main":new Gr(this.contexts.modal.content,{store:this.contexts.store,cdnMedia:this.cdnMedia});break;case"summary":new Or(this.contexts.modal.content,{store:this.contexts.store,cdnMedia:this.cdnMedia,onClose:()=>this.close()});break;default:throw"Unknown view..."}}}},Jr=ta;var Ed=Jr;
|
|
1886
|
-
//# sourceMappingURL=index.
|
|
1886
|
+
//# sourceMappingURL=index.cjs.map
|