@wayke-se/ecom-web 1.4.5-beta.1 → 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 CHANGED
@@ -4,69 +4,66 @@ Repository for Wayke Ecom Web.
4
4
 
5
5
  ## Getting started
6
6
 
7
- __Using npm__
7
+ **Using npm**
8
8
 
9
9
  ```bash
10
10
  npm install @wayke-se/ecom-web
11
11
  ```
12
12
 
13
13
  ```js
14
- import WaykeEcomWeb from "@wayke-se/ecom-web";
15
- import "@wayke-se/ecom-web/dist/index.css";
14
+ import WaykeEcomWeb from '@wayke-se/ecom-web';
15
+ import '@wayke-se/ecom-web/dist/index.css';
16
16
 
17
17
  const context = new WaykeEcomWeb({
18
- id: "36364808-671a-49da-b69a-5e0fc4cfe83e",
19
- ecomSdkConfig: {
20
- api: {
21
- address: "https://ecom.wayketech.se",
22
- },
18
+ id: '36364808-671a-49da-b69a-5e0fc4cfe83e',
19
+ ecomSdkConfig: {
20
+ api: {
21
+ address: 'https://ecom.wayketech.se',
23
22
  },
23
+ },
24
24
  });
25
25
 
26
26
  constext.start();
27
27
  ```
28
28
 
29
- __Using cdn__
29
+ **Using cdn**
30
30
  The associated css is injected into head by default once a `new WaykeEcomWeb(...)` is called. This can be turned off by adding `disablecssinjection` to the script tag.
31
31
 
32
-
33
32
  ```html
34
- <button id="ecom-button">Start</button>
35
-
36
- <script
37
- type="module"
38
- src="https://cdn.wayke.se/public-assets/wayke-ecom-web/x.x.x/index.js"
39
- ></script>
40
-
41
- <script>
42
- window.addEventListener("DOMContentLoaded", (_) => {
43
- var context = new WaykeEcomWeb({
44
- id: "36364808-671a-49da-b69a-5e0fc4cfe83e",
45
- ecomSdkConfig: {
46
- api: {
47
- address: "https://ecom.wayketech.se",
48
- },
33
+ <button id="ecom-button">Start</button>
34
+
35
+ <script
36
+ type="module"
37
+ src="https://cdn.wayke.se/public-assets/wayke-ecom-web/x.x.x/index.js"
38
+ ></script>
39
+
40
+ <script>
41
+ window.addEventListener('DOMContentLoaded', (_) => {
42
+ var context = new WaykeEcomWeb({
43
+ id: '36364808-671a-49da-b69a-5e0fc4cfe83e',
44
+ ecomSdkConfig: {
45
+ api: {
46
+ address: 'https://ecom.wayketech.se',
49
47
  },
50
- });
51
-
52
- document
53
- .getElementById('ecom-button')
54
- .addEventListener('click', () => context.start());
48
+ },
55
49
  });
56
- </script>
50
+
51
+ document.getElementById('ecom-button').addEventListener('click', () => context.start());
52
+ });
53
+ </script>
57
54
  ```
58
55
 
59
56
  ## Full configuration
60
57
 
61
58
  ```js
62
59
  new WaykeEcomWeb({
63
- id: "36364808-671a-49da-b69a-5e0fc4cfe83e",
64
- rootId: "random-element-id",
60
+ id: '36364808-671a-49da-b69a-5e0fc4cfe83e',
61
+ rootId: 'random-element-id',
65
62
  vehicle: {
66
63
  title: 'Lorem ipsum',
67
64
  shortDescription: 'Lorem ipsum',
68
65
  price: 250000,
69
- imageUrls: ["https://www...", "https://www..."],
66
+ imageUrls: ['https://www...', 'https://www...'],
70
67
  modelYear: 2013,
71
68
  milage: 4900,
72
69
  gearBox: 'Automat',
@@ -74,39 +71,59 @@ new WaykeEcomWeb({
74
71
  },
75
72
  ecomSdkConfig: {
76
73
  api: {
77
- address: "https://ecom.wayketech.se",
74
+ address: 'https://ecom.wayketech.se',
78
75
  },
79
- bankIdThumbprint: "[Dealer Specific BankId Certificate Thumbprint]" // OPTIONAL
76
+ bankIdThumbprint: '[Dealer Specific BankId Certificate Thumbprint]', // OPTIONAL
80
77
  },
81
78
  logo: 'https://placehold.jp/180x40.png', // OPTIONAL
82
79
  logoX2: 'https://placehold.jp/360x80.png', // OPTIONAL
80
+ onEvent: (view, event, step, data) => // OPTIONAL
81
+ console.log({
82
+ view,
83
+ event,
84
+ step,
85
+ data,
86
+ }),
83
87
  });
84
88
  ```
85
89
 
86
90
  ### Instance
91
+
87
92
  Instance contains three public methods, `.start()`, `.close()` and `.destroy()`.
88
93
 
89
94
  ### Required
90
- * `id` Id of the vehicle from Wayke
91
- * `ecomSdkConfig.api.address` Should be one of the following urls below:
92
95
 
93
- | Environment | Url |
94
- | ----------- | --- |
95
- | Test | https://ecom.wayketech.se |
96
- | Production | https://ecom.wayke.se |
96
+ - `id` Id of the vehicle from Wayke
97
+ - `ecomSdkConfig.api.address` Should be one of the following urls below:
97
98
 
99
+ | Environment | Url |
100
+ | ----------- | ------------------------- |
101
+ | Test | https://ecom.wayketech.se |
102
+ | Production | https://ecom.wayke.se |
98
103
 
99
104
  ### Optional
100
- * `rootId` Choose the element, id, that WakeEcomWeb should append to, by default it will be appended to the body.
101
- * `vehicle` Used to override specific vehicle data properties provided from Wayke.
102
- * `ecomSdkConfig.bankIdThumbprint` By default Wayke's BankId certificate is used to verify customer identity. There is an optional configuration property `bankIdThumbprint` which allows for dealers to use their own BankId certificate. If the certificate's thumbprint is set that certificate will be used instead, given that it is correctly setup in the Dealer back-office.
103
- * `logo` Logo to be displayed in the header of the modal.
104
- * `logoX2` Logo to be displayed in the header with higher resolution of the modal.
105
105
 
106
+ - `rootId` Choose the element, id, that WakeEcomWeb should append to, by default it will be appended to the body.
107
+ - `vehicle` Used to override specific vehicle data properties provided from Wayke.
108
+ - `ecomSdkConfig.bankIdThumbprint` By default Wayke's BankId certificate is used to verify customer identity. There is an optional configuration property `bankIdThumbprint` which allows for dealers to use their own BankId certificate. If the certificate's thumbprint is set that certificate will be used instead, given that it is correctly setup in the Dealer back-office.
109
+ - `logo` Logo to be displayed in the header of the modal.
110
+ - `logoX2` Logo to be displayed in the header with higher resolution of the modal.
111
+ - `onEvent` Attack function to listen for callback. Callback will be called with 3 parameters
112
+
113
+ ### onEvent argsuments
114
+
115
+ | Parameter | Value | Optional |
116
+ | --------- | --------- | -------- |
117
+ | view | EcomView | false |
118
+ | event | EcomEvent | false |
119
+ | step | EcomStep | true |
120
+ | data | any | true |
121
+
122
+ Above types are located in `src/Utils/ecomEvent.ts`
106
123
 
107
124
  ## CSS specificity
108
125
 
109
- ⚠️ __We can guarantee to not overwrite any of the host site _CSS_. But it is possible for the host site to overwrite the styling in _Wayke Ecom_. Read how to prevent such overwrites below.__
126
+ ⚠️ **We can guarantee to not overwrite any of the host site _CSS_. But it is possible for the host site to overwrite the styling in _Wayke Ecom_. Read how to prevent such overwrites below.**
110
127
 
111
128
  All _CSS_ class names are prefixed using the namespace `.waykeecom-*`. This will prevent this widget to overwrite any _CSS_ applied to the website on which it is implemented on. However, we can not guarantee other _CSS_ files won't overwrite the _CSS_ in _Wayke Ecom_. This is due to it is impossible to protect against element selectors.
112
129
 
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";(()=>{var Bc=Object.create;var zo=Object.defineProperty;var Uc=Object.getOwnPropertyDescriptor;var Fc=Object.getOwnPropertyNames;var Vc=Object.getPrototypeOf,Gc=Object.prototype.hasOwnProperty;var _=(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')});var qc=(o,i,e,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let s of Fc(i))!Gc.call(o,s)&&s!==e&&zo(o,s,{get:()=>i[s],enumerable:!(t=Uc(i,s))||t.enumerable});return o};var Wc=(o,i,e)=>(e=o!=null?Bc(Vc(o)):{},qc(i||!o||!o.__esModule?zo(e,"default",{value:o,enumerable:!0}):e,o));var Lc=_("@wayke-se/ecom");var Qo={name:"@wayke-se/ecom-web",version:"1.4.5-beta.1",description:"Wayke Ecom Web",module:"dist/index.mjs",main:"dist/index.js",types:"dist/index.d.ts",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"]};var Ei=_("redux");var Ae=_("@wayke-se/ecom");var st=(o,i)=>o!==void 0&&i!==void 0?JSON.stringify(o).localeCompare(JSON.stringify(i))===0:o===i;var Se=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()}),Jo=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?Se(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()}),Xo=o=>({vehicle:o.getVehicle()});var ot="RESET",Zo=o=>i=>i({type:ot,id:o}),it="SET_ORDER",Me=(o,i)=>e=>e({type:it,order:o,vehicle:i}),nt="SET_ID",ei=o=>i=>i({type:nt,id:o}),at="SET_CONTACT_EMAIL_AND_PHONE",ti=o=>i=>i({type:at,value:o}),rt="SET_SOCIAL_ID_AND_ADDRESS",si=(o,i,e)=>t=>t({type:rt,socialId:o,address:i,lastStage:e}),ct="SET_HOME_DELIVERY",oi=(o,i)=>e=>e({type:ct,homeDelivery:o,lastStage:i}),lt="SET_DEALER",ii=(o,i)=>e=>e({type:lt,dealer:o,lastStage:i}),dt="INIT_TRADE_IN",ni=o=>i=>i({type:dt,lastStage:o}),mt="SET_TRADE_IN",Ne=(o,i,e)=>t=>t({type:mt,lastStage:o,tradeIn:i,tradeInVehicle:e}),pt="SET_FINANCIAL",ai=(o,i)=>e=>e({type:pt,paymentType:o,lastStage:i}),ut="SET_PAYMENT_LOOKUP_RESPONSE",ri=o=>i=>i({type:ut,paymentLookupResponse:Se(o)}),ht="SET_DRIVING_DISTANCE",ci=o=>i=>i({type:ht,drivingDistance:o}),kt="COMPLETE_STAGE",X=o=>i=>i({type:kt,lastStage:o}),yt="SET_OR_REMOVE_INSURANCE",le=o=>i=>i({type:yt,insurance:o}),vt="SET_OR_REMOVE_INSURANCE_ADDONS",li=(o,i)=>e=>e({type:vt,insurance:o,insuranceAddons:i}),Et="SET_OR_REMOVE_FREE_INSURANCE",di=o=>i=>i({type:Et,freeInsurance:o}),It="SET_OR_REMOVE_ACCESSORY",mi=o=>i=>i({type:It,accessory:o}),_t="GO_TO",M=(o,i,e)=>t=>t({type:_t,view:o,index:i,subStage:e}),ft="SET_STAGES",pi=o=>i=>i({type:ft,stages:o}),gt="SET_CREATED_ORDER_ID",ui=(o,i)=>e=>e({type:gt,id:o,payment:i}),wt="SET_CREDIT_ASSESSMENT_RESPONSE",de=(o,i)=>e=>e({type:wt,caseId:o,creditAssessmentResponse:i}),St="SET_STATE",hi=o=>i=>i({type:St,state:o});var Tt={};try{Tt=_("../../statemock.json")}catch{Tt={}}var ki={view:"preview",stage:1,subStage:1},yi={id:"",topNavigation:{...ki},navigation:{...ki},customer:{email:"",phone:"",givenName:"",surname:"",socialId:""},homeDelivery:!1,accessories:[],drivingDistance:Ae.DrivingDistance.Between0And1000,...Tt},ne=(o,i)=>i?{view:"summary",stage:1,subStage:1}:{view:"main",stage:o+1,subStage:1},ae=(o,i)=>i.view==="main"?o.stage<i.stage?i:v.topNavigation:{...o,stage:o.stage+1},Nt=o=>o&&o?.length===1&&o?.[0].type===Ae.PaymentType.Cash?Ae.PaymentType.Cash:void 0,v,At,Kc=(o=yi,i)=>{let e,t;switch(v={...o},i.type){case ot:return{...yi,id:i.id};case ft:return{...v,stages:i.stages};case nt:return{...v,id:i.id};case it:return{...o,order:i.order,paymentType:Nt(i.order?.paymentOptions),vehicle:{...i.order.orderVehicle,...i.vehicle||{}}};case at: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=Nt(o.order?.paymentOptions),delete s.paymentLookupResponse,delete s.insurance,delete s.insuranceAddOns,delete s.freeInsurance,delete s.dealer,s.accessories=[],s;case rt:return e=ne(v.navigation.stage,i.lastStage),t=ae(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,address:i.address,customer:{...o.customer,socialId:i.socialId}},v;case lt:return e=ne(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=Nt(o.order?.paymentOptions),delete v.paymentLookupResponse,delete v.insurance,delete v.insuranceAddOns,delete v.freeInsurance,v.accessories=[],v;case ct:return e=ne(o.navigation.stage,i.lastStage),t=ae(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,homeDelivery:i.homeDelivery},v;case dt:return e={view:"main",stage:o.navigation.stage,subStage:1},t=ae(v.topNavigation,e),v={...o,navigation:e,wantTradeIn:!0,topNavigation:t,tradeIn:o.tradeIn||{registrationNumber:"",mileage:"",description:""}},v;case mt:return e=ne(o.navigation.stage,i.lastStage),t=ae(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,wantTradeIn:!!i.tradeIn,tradeIn:i.tradeIn,tradeInVehicle:i.tradeInVehicle},v;case pt:return e=ne(o.navigation.stage,i.lastStage),t=ae(v.topNavigation,e),{...v,navigation:e,topNavigation:t,paymentType:i.paymentType};case ut:return{...v,paymentLookupResponse:i.paymentLookupResponse};case ht:return{...v,drivingDistance:i.drivingDistance};case kt:return e=ne(o.navigation.stage,i.lastStage),t=ae(v.topNavigation,e),v={...o,navigation:e,topNavigation:t},v;case vt:return v.insurance=i.insurance,v.insuranceAddOns={insurance:i.insurance.name,addOns:i.insuranceAddons},v;case yt:return st(v.insurance,i.insurance)?v.insurance=void 0:v.insurance=i.insurance,v.insuranceAddOns?.insurance&&(v.insuranceAddOns=void 0),v;case Et:return st(v.freeInsurance,i.freeInsurance)?v.freeInsurance=void 0:v.freeInsurance=i.freeInsurance,v;case It:return At=v.accessories.findIndex(n=>n.id===i.accessory.id),v.accessories=[...v.accessories],At>-1?v.accessories.splice(At,1):v.accessories.push(i.accessory),{...v,accessories:[...v.accessories]};case _t: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=ne(o.navigation.stage,!0),t=ae(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,createdOrderId:i.id,payment:i.payment},v;case wt:return{...v,caseId:i.caseId,creditAssessmentResponse:i.creditAssessmentResponse};case St:return{...i.state};default:return o}},vi=Kc;var Ii=()=>(0,Ei.createStore)(vi);var xe=(o,i)=>{if(!i)return o;let e=new URL(o);return`${i}${e.pathname}`};var jc=o=>o.toString().replace(/\s/g,""),zc=(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=zc(o,i?.decimals!==void 0?i.decimals:0);return`${i?.prefix?`${i.prefix}`:""}${jc(e).replace(/\B(?=(\d{3})+(?!\d))/g," ")}${i?.postfix?` ${i.postfix}`:""}`},Qc=(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 Qc(o.shortDescription||"",o.title||"")};var Jc=({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`
1
+ "use strict";(()=>{var Bc=Object.create;var zo=Object.defineProperty;var Uc=Object.getOwnPropertyDescriptor;var Fc=Object.getOwnPropertyNames;var Vc=Object.getPrototypeOf,Gc=Object.prototype.hasOwnProperty;var _=(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')});var qc=(o,i,e,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let s of Fc(i))!Gc.call(o,s)&&s!==e&&zo(o,s,{get:()=>i[s],enumerable:!(t=Uc(i,s))||t.enumerable});return o};var Wc=(o,i,e)=>(e=o!=null?Bc(Vc(o)):{},qc(i||!o||!o.__esModule?zo(e,"default",{value:o,enumerable:!0}):e,o));var Lc=_("@wayke-se/ecom");var Qo={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"]};var Ei=_("redux");var Ae=_("@wayke-se/ecom");var st=(o,i)=>o!==void 0&&i!==void 0?JSON.stringify(o).localeCompare(JSON.stringify(i))===0:o===i;var Se=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()}),Jo=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?Se(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()}),Xo=o=>({vehicle:o.getVehicle()});var ot="RESET",Zo=o=>i=>i({type:ot,id:o}),it="SET_ORDER",Me=(o,i)=>e=>e({type:it,order:o,vehicle:i}),nt="SET_ID",ei=o=>i=>i({type:nt,id:o}),at="SET_CONTACT_EMAIL_AND_PHONE",ti=o=>i=>i({type:at,value:o}),rt="SET_SOCIAL_ID_AND_ADDRESS",si=(o,i,e)=>t=>t({type:rt,socialId:o,address:i,lastStage:e}),ct="SET_HOME_DELIVERY",oi=(o,i)=>e=>e({type:ct,homeDelivery:o,lastStage:i}),lt="SET_DEALER",ii=(o,i)=>e=>e({type:lt,dealer:o,lastStage:i}),dt="INIT_TRADE_IN",ni=o=>i=>i({type:dt,lastStage:o}),mt="SET_TRADE_IN",Ne=(o,i,e)=>t=>t({type:mt,lastStage:o,tradeIn:i,tradeInVehicle:e}),pt="SET_FINANCIAL",ai=(o,i)=>e=>e({type:pt,paymentType:o,lastStage:i}),ut="SET_PAYMENT_LOOKUP_RESPONSE",ri=o=>i=>i({type:ut,paymentLookupResponse:Se(o)}),ht="SET_DRIVING_DISTANCE",ci=o=>i=>i({type:ht,drivingDistance:o}),kt="COMPLETE_STAGE",X=o=>i=>i({type:kt,lastStage:o}),yt="SET_OR_REMOVE_INSURANCE",le=o=>i=>i({type:yt,insurance:o}),vt="SET_OR_REMOVE_INSURANCE_ADDONS",li=(o,i)=>e=>e({type:vt,insurance:o,insuranceAddons:i}),Et="SET_OR_REMOVE_FREE_INSURANCE",di=o=>i=>i({type:Et,freeInsurance:o}),It="SET_OR_REMOVE_ACCESSORY",mi=o=>i=>i({type:It,accessory:o}),_t="GO_TO",M=(o,i,e)=>t=>t({type:_t,view:o,index:i,subStage:e}),ft="SET_STAGES",pi=o=>i=>i({type:ft,stages:o}),gt="SET_CREATED_ORDER_ID",ui=(o,i)=>e=>e({type:gt,id:o,payment:i}),wt="SET_CREDIT_ASSESSMENT_RESPONSE",de=(o,i)=>e=>e({type:wt,caseId:o,creditAssessmentResponse:i}),St="SET_STATE",hi=o=>i=>i({type:St,state:o});var Tt={};try{Tt=_("../../statemock.json")}catch{Tt={}}var ki={view:"preview",stage:1,subStage:1},yi={id:"",topNavigation:{...ki},navigation:{...ki},customer:{email:"",phone:"",givenName:"",surname:"",socialId:""},homeDelivery:!1,accessories:[],drivingDistance:Ae.DrivingDistance.Between0And1000,...Tt},ne=(o,i)=>i?{view:"summary",stage:1,subStage:1}:{view:"main",stage:o+1,subStage:1},ae=(o,i)=>i.view==="main"?o.stage<i.stage?i:v.topNavigation:{...o,stage:o.stage+1},Nt=o=>o&&o?.length===1&&o?.[0].type===Ae.PaymentType.Cash?Ae.PaymentType.Cash:void 0,v,At,Kc=(o=yi,i)=>{let e,t;switch(v={...o},i.type){case ot:return{...yi,id:i.id};case ft:return{...v,stages:i.stages};case nt:return{...v,id:i.id};case it:return{...o,order:i.order,paymentType:Nt(i.order?.paymentOptions),vehicle:{...i.order.orderVehicle,...i.vehicle||{}}};case at: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=Nt(o.order?.paymentOptions),delete s.paymentLookupResponse,delete s.insurance,delete s.insuranceAddOns,delete s.freeInsurance,delete s.dealer,s.accessories=[],s;case rt:return e=ne(v.navigation.stage,i.lastStage),t=ae(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,address:i.address,customer:{...o.customer,socialId:i.socialId}},v;case lt:return e=ne(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=Nt(o.order?.paymentOptions),delete v.paymentLookupResponse,delete v.insurance,delete v.insuranceAddOns,delete v.freeInsurance,v.accessories=[],v;case ct:return e=ne(o.navigation.stage,i.lastStage),t=ae(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,homeDelivery:i.homeDelivery},v;case dt:return e={view:"main",stage:o.navigation.stage,subStage:1},t=ae(v.topNavigation,e),v={...o,navigation:e,wantTradeIn:!0,topNavigation:t,tradeIn:o.tradeIn||{registrationNumber:"",mileage:"",description:""}},v;case mt:return e=ne(o.navigation.stage,i.lastStage),t=ae(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,wantTradeIn:!!i.tradeIn,tradeIn:i.tradeIn,tradeInVehicle:i.tradeInVehicle},v;case pt:return e=ne(o.navigation.stage,i.lastStage),t=ae(v.topNavigation,e),{...v,navigation:e,topNavigation:t,paymentType:i.paymentType};case ut:return{...v,paymentLookupResponse:i.paymentLookupResponse};case ht:return{...v,drivingDistance:i.drivingDistance};case kt:return e=ne(o.navigation.stage,i.lastStage),t=ae(v.topNavigation,e),v={...o,navigation:e,topNavigation:t},v;case vt:return v.insurance=i.insurance,v.insuranceAddOns={insurance:i.insurance.name,addOns:i.insuranceAddons},v;case yt:return st(v.insurance,i.insurance)?v.insurance=void 0:v.insurance=i.insurance,v.insuranceAddOns?.insurance&&(v.insuranceAddOns=void 0),v;case Et:return st(v.freeInsurance,i.freeInsurance)?v.freeInsurance=void 0:v.freeInsurance=i.freeInsurance,v;case It:return At=v.accessories.findIndex(n=>n.id===i.accessory.id),v.accessories=[...v.accessories],At>-1?v.accessories.splice(At,1):v.accessories.push(i.accessory),{...v,accessories:[...v.accessories]};case _t: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=ne(o.navigation.stage,!0),t=ae(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,createdOrderId:i.id,payment:i.payment},v;case wt:return{...v,caseId:i.caseId,creditAssessmentResponse:i.creditAssessmentResponse};case St:return{...i.state};default:return o}},vi=Kc;var Ii=()=>(0,Ei.createStore)(vi);var xe=(o,i)=>{if(!i)return o;let e=new URL(o);return`${i}${e.pathname}`};var jc=o=>o.toString().replace(/\s/g,""),zc=(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=zc(o,i?.decimals!==void 0?i.decimals:0);return`${i?.prefix?`${i.prefix}`:""}${jc(e).replace(/\B(?=(\d{3})+(?!\d))/g," ")}${i?.postfix?` ${i.postfix}`:""}`},Qc=(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 Qc(o.shortDescription||"",o.title||"")};var Jc=({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">
@@ -279,7 +279,7 @@
279
279
  <div class="waykeecom-stack waykeecom-stack--3" id="${Li}"></div>
280
280
 
281
281
  <div class="waykeecom-stack waykeecom-stack--3">
282
- ${h?`<div class="waykeecom-text waykeecom-text--font-bold">${k(h,{postfix:"kr"})}<span class="waykeecom-text waykeecom-text--tone-alt waykeecom-text--line-through">(${k(m,{postfix:"kr"})})</span></div>`:`<div class="waykeecom-text waykeecom-text--font-bold">${k(m,{postfix:"kr"})}</div>`}
282
+ ${h?`<div class="waykeecom-text waykeecom-text--font-bold">${k(h,{postfix:"kr"})}<span class="waykeecom-text waykeecom-text--tone-alt waykeecom-text--line-through"> (${k(m,{postfix:"kr"})})</span></div>`:`<div class="waykeecom-text waykeecom-text--font-bold">${k(m,{postfix:"kr"})}</div>`}
283
283
  </div>
284
284
  <div class="waykeecom-stack waykeecom-stack--3">
285
285
  <div class="waykeecom-content waykeecom-text waykeecom-text--font-medium">