@dintero/checkout-web-sdk 0.6.1 → 0.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.
Files changed (31) hide show
  1. package/.github/workflows/build.yml +14 -15
  2. package/.github/workflows/release.yml +4 -5
  3. package/.prettierrc.yml +8 -0
  4. package/.releaserc.json +7 -9
  5. package/CHANGELOG.md +11 -9
  6. package/README.md +39 -25
  7. package/dist/declarations/src/checkout.d.ts +2 -2
  8. package/dist/dintero-checkout-web-sdk.cjs.dev.js +105 -97
  9. package/dist/dintero-checkout-web-sdk.cjs.prod.js +105 -97
  10. package/dist/dintero-checkout-web-sdk.esm.js +105 -97
  11. package/dist/dintero-checkout-web-sdk.umd.min.js +1 -1
  12. package/dist/dintero-checkout-web-sdk.umd.min.js.map +1 -1
  13. package/package.json +45 -49
  14. package/patches/vitest+0.34.6.patch +33 -0
  15. package/coverage/Chrome Headless 117.0.5938.149 (Linux x86_64)/html/base.css +0 -224
  16. package/coverage/Chrome Headless 117.0.5938.149 (Linux x86_64)/html/block-navigation.js +0 -79
  17. package/coverage/Chrome Headless 117.0.5938.149 (Linux x86_64)/html/checkout.ts.html +0 -473
  18. package/coverage/Chrome Headless 117.0.5938.149 (Linux x86_64)/html/createIframeAsync.ts.html +0 -263
  19. package/coverage/Chrome Headless 117.0.5938.149 (Linux x86_64)/html/favicon.png +0 -0
  20. package/coverage/Chrome Headless 117.0.5938.149 (Linux x86_64)/html/index.html +0 -216
  21. package/coverage/Chrome Headless 117.0.5938.149 (Linux x86_64)/html/index.ts.html +0 -2366
  22. package/coverage/Chrome Headless 117.0.5938.149 (Linux x86_64)/html/popOut.ts.html +0 -377
  23. package/coverage/Chrome Headless 117.0.5938.149 (Linux x86_64)/html/popOutBackdrop.ts.html +0 -1046
  24. package/coverage/Chrome Headless 117.0.5938.149 (Linux x86_64)/html/popOutButton.ts.html +0 -374
  25. package/coverage/Chrome Headless 117.0.5938.149 (Linux x86_64)/html/prettify.css +0 -1
  26. package/coverage/Chrome Headless 117.0.5938.149 (Linux x86_64)/html/prettify.js +0 -2
  27. package/coverage/Chrome Headless 117.0.5938.149 (Linux x86_64)/html/sort-arrow-sprite.png +0 -0
  28. package/coverage/Chrome Headless 117.0.5938.149 (Linux x86_64)/html/sorter.js +0 -170
  29. package/coverage/Chrome Headless 117.0.5938.149 (Linux x86_64)/html/subscribe.ts.html +0 -632
  30. package/coverage/Chrome Headless 117.0.5938.149 (Linux x86_64)/html/url.ts.html +0 -284
  31. package/karma.conf.js +0 -33
@@ -2,24 +2,23 @@ name: CI
2
2
 
3
3
  on:
4
4
  pull_request:
5
- branches: [ master ]
5
+ branches: [master]
6
6
 
7
7
  jobs:
8
-
9
8
  build:
10
9
  runs-on: ubuntu-latest
11
10
 
12
11
  steps:
13
- - uses: actions/checkout@v3
14
- with:
15
- fetch-depth: 0
16
- - uses: actions/setup-node@v3
17
- with:
18
- node-version: 'lts/*'
19
- cache: npm
20
-
21
- - name: yarn install, build and test
22
- run: |
23
- yarn install
24
- yarn run test
25
- yarn run build
12
+ - uses: actions/checkout@v3
13
+ with:
14
+ fetch-depth: 0
15
+ - uses: actions/setup-node@v3
16
+ with:
17
+ node-version: "lts/*"
18
+ cache: npm
19
+ - name: yarn install, build, test and lint
20
+ run: |
21
+ yarn install --immutable
22
+ yarn run test
23
+ yarn run build
24
+ yarn run lint
@@ -25,13 +25,12 @@ jobs:
25
25
  - name: Setup Node.js
26
26
  uses: actions/setup-node@v3
27
27
  with:
28
- node-version: 'lts/*'
29
-
30
- - name: Install dependencies and test
28
+ node-version: "lts/*"
29
+ - name: Install dependencies, test and lint
31
30
  run: |
32
- yarn install
31
+ yarn install --immutable
33
32
  yarn run test
34
-
33
+ yarn run lint
35
34
  - name: Release
36
35
  env:
37
36
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,8 @@
1
+ printWidth: 80
2
+ tabWidth: 4
3
+ trailingComma: "all"
4
+ overrides:
5
+ - files:
6
+ - "*.yml"
7
+ options:
8
+ tabWidth: 2
package/.releaserc.json CHANGED
@@ -1,11 +1,9 @@
1
1
  {
2
- "branches": [
3
- "master"
4
- ],
5
- "plugins": [
6
- "@semantic-release/commit-analyzer",
7
- "@semantic-release/release-notes-generator",
8
- "@semantic-release/github",
9
- "@semantic-release/npm"
10
- ]
2
+ "branches": ["master"],
3
+ "plugins": [
4
+ "@semantic-release/commit-analyzer",
5
+ "@semantic-release/release-notes-generator",
6
+ "@semantic-release/github",
7
+ "@semantic-release/npm"
8
+ ]
11
9
  }
package/CHANGELOG.md CHANGED
@@ -1,38 +1,40 @@
1
1
  ## [0.6.0]
2
+
2
3
  ### Changed
3
4
 
4
- - Changes iframe to also have `allow="payment"` property to support Apple Pay when embedded
5
+ - Changes iframe to also have `allow="payment"` property to support Apple Pay when embedded
5
6
 
6
7
  ## [0.4.0]
7
8
 
8
9
  ### Changed
9
10
 
10
- - Changes `lockSession` to return a promise that resolves when the following `SessionLocked` event is returned from the checkout.
11
- - Changes `refreshSession` to return a promise that resolves when the following `SessionUpdated` event is returned from the checkout.
11
+ - Changes `lockSession` to return a promise that resolves when the following `SessionLocked` event is returned from the checkout.
12
+ - Changes `refreshSession` to return a promise that resolves when the following `SessionUpdated` event is returned from the checkout.
12
13
 
13
14
  ## [0.3.1]
14
15
 
15
16
  ### Bug Fixes
16
- * Add correct package version to url
17
+
18
+ - Add correct package version to url
17
19
 
18
20
  ## [0.3.0]
19
21
 
20
22
  ### Features
21
23
 
22
- * **lock:** Add callback function to `onSessionLocked`
24
+ - **lock:** Add callback function to `onSessionLocked`
23
25
 
24
26
  ## [0.2.0]
25
27
 
26
28
  ### Features
27
29
 
28
- * Handling of session validation when embedded
30
+ - Handling of session validation when embedded
29
31
 
30
32
  ## [0.0.17]
31
33
 
32
34
  ### Changed
33
35
 
34
- - Adds `onActivePaymentProductType` callback.
35
- - Adds `setActivePaymentProductType` function.
36
+ - Adds `onActivePaymentProductType` callback.
37
+ - Adds `setActivePaymentProductType` function.
36
38
 
37
39
  ## [0.0.16]
38
40
 
@@ -44,7 +46,7 @@
44
46
 
45
47
  ### Changed
46
48
 
47
- - Added `lockSession` and `refreshSession` functions
49
+ - Added `lockSession` and `refreshSession` functions
48
50
 
49
51
  ## [0.0.14]
50
52
 
package/README.md CHANGED
@@ -58,45 +58,48 @@ _The checkout sdk will add a polyfill for promises if the browser does not suppo
58
58
  sid: "T11223344.<short-uuid>",
59
59
  popOut: false, // optional parameter to enable pop out mode
60
60
  language: "no", // optional parameter, an ISO 639-1 two-letter language code
61
- onSession: function(event, checkout) {
61
+ onSession: function (event, checkout) {
62
62
  console.log("session", event.session);
63
63
  },
64
- onPayment: function(event, checkout) {
64
+ onPayment: function (event, checkout) {
65
65
  console.log("transaction_id", event.transaction_id);
66
66
  console.log("href", event.href);
67
67
  checkout.destroy();
68
68
  },
69
- onPaymentError: function(event, checkout) {
69
+ onPaymentError: function (event, checkout) {
70
70
  console.log("href", event.href);
71
71
  checkout.destroy();
72
72
  },
73
- onSessionCancel: function(event, checkout) {
73
+ onSessionCancel: function (event, checkout) {
74
74
  console.log("href", event.href);
75
75
  checkout.destroy();
76
76
  },
77
- onSessionNotFound: function(event, checkout) {
77
+ onSessionNotFound: function (event, checkout) {
78
78
  console.log("session not found (expired)", event.type);
79
79
  checkout.destroy();
80
80
  },
81
- onSessionLocked: function(event, checkout, callback) {
81
+ onSessionLocked: function (event, checkout, callback) {
82
82
  console.log("pay_lock_id", event.pay_lock_id);
83
83
  callback(); // refresh session
84
84
  },
85
- onSessionLockFailed: function(event, checkout) {
85
+ onSessionLockFailed: function (event, checkout) {
86
86
  console.log("session lock failed");
87
87
  },
88
- onActivePaymentType: function(event, checkout) {
89
- console.log("payment product type selected", event.payment_product_type);
88
+ onActivePaymentType: function (event, checkout) {
89
+ console.log(
90
+ "payment product type selected",
91
+ event.payment_product_type,
92
+ );
90
93
  },
91
- onValidateSession: function(event, checkout, callback) {
94
+ onValidateSession: function (event, checkout, callback) {
92
95
  console.log("validating session", event.session);
93
96
  callback({
94
- success: true,
95
- clientValidationError: undefined,
97
+ success: true,
98
+ clientValidationError: undefined,
96
99
  });
97
100
  },
98
101
  })
99
- .then(function(checkout) {
102
+ .then(function (checkout) {
100
103
  console.log("checkout", checkout);
101
104
  });
102
105
  </script>
@@ -125,7 +128,10 @@ const checkout = await embed({
125
128
  onSession: (event: SessionLoaded | SessionUpdated) => {
126
129
  console.log("session", event.session);
127
130
  },
128
- onPayment: (event: SessionPaymentAuthorized | SessionPaymentOnHold, checkout) => {
131
+ onPayment: (
132
+ event: SessionPaymentAuthorized | SessionPaymentOnHold,
133
+ checkout,
134
+ ) => {
129
135
  console.log("transaction_id", event.transaction_id);
130
136
  console.log("href", event.href);
131
137
  checkout.destroy();
@@ -149,16 +155,19 @@ const checkout = await embed({
149
155
  onSessionLockFailed: (event: SessionLockFailed, checkout) => {
150
156
  console.log("session lock failed");
151
157
  },
152
- onActivePaymentType: function(event: ActivePaymentProductType, checkout) {
153
- console.log("payment product type selected", event.payment_product_type);
158
+ onActivePaymentType: function (event: ActivePaymentProductType, checkout) {
159
+ console.log(
160
+ "payment product type selected",
161
+ event.payment_product_type,
162
+ );
154
163
  },
155
- onValidateSession: function(event: ValidateSession, checkout, callback) {
164
+ onValidateSession: function (event: ValidateSession, checkout, callback) {
156
165
  console.log("validating session", event.session);
157
166
  callback({
158
167
  success: true,
159
168
  clientValidationError: undefined,
160
169
  });
161
- },
170
+ },
162
171
  });
163
172
  ```
164
173
 
@@ -167,11 +176,13 @@ const checkout = await embed({
167
176
  The payment product type can be set with the returned `setActivePaymentProductType()`function when embedding the checkout.
168
177
 
169
178
  Select "vipps" payment product type:
179
+
170
180
  ```
171
181
  checkout.setActivePaymentProductType("vipps");
172
182
  ```
173
183
 
174
184
  Resetting selection (so no option is selected in the checkout):
185
+
175
186
  ```
176
187
  checkout.setActivePaymentProductType();
177
188
  ```
@@ -189,11 +200,14 @@ To update an existing Checkout Express-session, follow these steps:
189
200
  Call lockSession on the checkout object:
190
201
 
191
202
  ```js
192
- checkout.lockSession().then(function(sessionLockedEvent){
193
- // initiate server side session update and then refresh the session
194
- }).catch(function(sessionLockFailedEvent) {
195
- // handle failure to lock
196
- });;
203
+ checkout
204
+ .lockSession()
205
+ .then(function (sessionLockedEvent) {
206
+ // initiate server side session update and then refresh the session
207
+ })
208
+ .catch(function (sessionLockFailedEvent) {
209
+ // handle failure to lock
210
+ });
197
211
  ```
198
212
 
199
213
  `lockSession()` returns a promise that is resolved when the `SessionLocked` event is
@@ -222,7 +236,7 @@ or use the callback in `onSessionLocked`:
222
236
  onSessionLocked: (event, checkout, callback) => {
223
237
  console.log("pay_lock_id", event.pay_lock_id);
224
238
  callback(); // refresh session
225
- }
239
+ };
226
240
  ```
227
241
 
228
242
  `refreshSession()` returns a promise that is resolved when the `SessionUpdated`
@@ -241,7 +255,7 @@ When validated successfully, return a successful result:
241
255
 
242
256
  ```js
243
257
  {
244
- success: true
258
+ success: true;
245
259
  }
246
260
  ```
247
261
 
@@ -52,7 +52,7 @@ export type SessionLocked = {
52
52
  callback: () => void;
53
53
  };
54
54
  export type ShowPopOutButton = {
55
- type: 'ShowPopOutButton';
55
+ type: "ShowPopOutButton";
56
56
  styles: {
57
57
  font: string;
58
58
  height: string;
@@ -75,7 +75,7 @@ export type ShowPopOutButton = {
75
75
  left: string;
76
76
  right: string;
77
77
  language: string;
78
- disabled: 'true' | 'false';
78
+ disabled: "true" | "false";
79
79
  };
80
80
  export type SessionLockFailed = {
81
81
  type: CheckoutEvents.SessionLockFailed;