@wayke-se/ecom-web 1.4.5 → 1.4.7-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/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.d.ts CHANGED
@@ -1240,6 +1240,10 @@ declare module '@wayke-se/ecom-web/src/Data/getBankIdAuth' {
1240
1240
  import { AuthMethod } from '@wayke-se/ecom';
1241
1241
  export const getBankIdAuth: (method: AuthMethod) => Promise<import("@wayke-se/ecom/dist-types/bankid/bankid-auth-response").BankIdAuthResponse>;
1242
1242
 
1243
+ }
1244
+ declare module '@wayke-se/ecom-web/src/Data/getBankIdQrCode' {
1245
+ export const getBankIdQrCode: (reference: string) => Promise<import("@wayke-se/ecom/dist-types/bankid/bankid-qrcode-response").BankIdQrCodeResponse>;
1246
+
1243
1247
  }
1244
1248
  declare module '@wayke-se/ecom-web/src/Data/getBankIdStatus' {
1245
1249
  export const getBankIdStatus: (reference: string) => Promise<import("@wayke-se/ecom/dist-types/bankid/bankid-collect-response").BankIdCollectResponse>;
@@ -2077,6 +2081,7 @@ declare module '@wayke-se/ecom-web/src/Views/Main/Confirmation/VerifyByBankId' {
2077
2081
  class VerifyByBankId extends HtmlNode {
2078
2082
  private readonly props;
2079
2083
  private bankidStatusInterval?;
2084
+ private bankidQrCodeInterval?;
2080
2085
  private view;
2081
2086
  private contexts;
2082
2087
  private ageError;