@rebilly/instruments 3.9.0-beta.0 → 3.9.3-beta.0
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 +4 -4
- package/dist/index.min.js +4 -4
- package/package.json +3 -3
- package/src/functions/mount/fetch-data.js +1 -1
- package/src/functions/mount/fetch-data.spec.js +3 -1
- package/src/functions/mount/mount.spec.js +1 -8
- package/src/style/payment-instruments/payment-instrument.js +1 -1
- package/src/style/views/modal.js +7 -0
- package/src/views/method-selector/mount-methods.js +1 -1
- package/tests/mocks/storefront-api-mock.js +11 -7
- package/tests/msw/server.js +1 -2
- package/tests/msw/handlers.js +0 -37
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebilly/instruments",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.3-beta.0",
|
|
4
4
|
"author": "Rebilly",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"unpkg": "dist/index.min.js",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"babel-plugin-module-resolver": "^4.1.0",
|
|
38
38
|
"component-emitter": "^1.3.0",
|
|
39
39
|
"jest": "^27.0.6",
|
|
40
|
-
"msw": "
|
|
41
|
-
"msw-when-then": "^1.
|
|
40
|
+
"msw": "0.38.2",
|
|
41
|
+
"msw-when-then": "^1.5.1",
|
|
42
42
|
"rollup": "^2.35.1",
|
|
43
43
|
"rollup-plugin-ignore": "^1.0.10",
|
|
44
44
|
"rollup-plugin-polyfill-node": "^0.8.0",
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { RebillyInstrumentsInstance } from '@rebilly/instruments';
|
|
3
|
-
import { get, ok, post } from 'msw-when-then';
|
|
4
|
-
import { when } from 'tests/msw/server';
|
|
5
|
-
import { storefrontURL } from 'tests/mocks/storefront-api-mock';
|
|
6
|
-
import PlanModel from '@/storefront/models/plan-model';
|
|
7
|
-
import ProductModel from '@/storefront/models/product-model';
|
|
8
|
-
import SummaryModel from '@/storefront/models/summary-model';
|
|
1
|
+
import {RenderMockRebillyInstruments} from 'tests/mocks/rebilly-instruments-mock';
|
|
9
2
|
|
|
10
3
|
describe('RebillyInstruments instance', () => {
|
|
11
4
|
it('should inject HTML to the merchant\'s website', async () => {
|
package/src/style/views/modal.js
CHANGED
|
@@ -65,7 +65,7 @@ export function MountMethods({
|
|
|
65
65
|
'payment-card'
|
|
66
66
|
].includes(methodId) && state.options.paymentInstruments[methodType]?.popup;
|
|
67
67
|
const model = {
|
|
68
|
-
|
|
68
|
+
account: state.data?.account,
|
|
69
69
|
options: state.options,
|
|
70
70
|
mainStyle: state.mainStyle,
|
|
71
71
|
plans: state.data.plans,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {ok, get, post} from 'msw-when-then';
|
|
2
2
|
|
|
3
3
|
export const storefrontURL = '*/storefront';
|
|
4
4
|
|
|
@@ -8,22 +8,26 @@ export const initStoreFrontApiMocks = (when) => {
|
|
|
8
8
|
})());
|
|
9
9
|
|
|
10
10
|
when(post(`${storefrontURL}/preview-purchase`)).thenReturn((() => {
|
|
11
|
-
return ok({})
|
|
11
|
+
return ok({});
|
|
12
12
|
})());
|
|
13
13
|
|
|
14
14
|
when(get(`${storefrontURL}/plans`)).thenReturn((() => {
|
|
15
|
-
return ok([])
|
|
15
|
+
return ok([]);
|
|
16
16
|
})());
|
|
17
17
|
|
|
18
18
|
when(get(`${storefrontURL}/products`)).thenReturn((() => {
|
|
19
|
-
return ok([])
|
|
19
|
+
return ok([]);
|
|
20
20
|
})());
|
|
21
21
|
|
|
22
22
|
when(post(`${storefrontURL}/payment-instruments`)).thenReturn((() => {
|
|
23
|
-
return ok([])
|
|
23
|
+
return ok([]);
|
|
24
24
|
})());
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
when(post(`${storefrontURL}/payment-instruments/*/setup`)).thenReturn((() => {
|
|
27
|
-
return ok([])
|
|
27
|
+
return ok([]);
|
|
28
|
+
})());
|
|
29
|
+
|
|
30
|
+
when(get(`${storefrontURL}/transactions/test-transaction-id`)).thenReturn((() => {
|
|
31
|
+
return ok({});
|
|
28
32
|
})());
|
|
29
33
|
};
|
package/tests/msw/server.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import {setupServer} from 'msw/node';
|
|
2
2
|
import {rest} from 'msw';
|
|
3
3
|
import {whenThen} from 'msw-when-then';
|
|
4
|
-
import {handlers} from './handlers';
|
|
5
4
|
import {initStoreFrontApiMocks} from '../mocks/storefront-api-mock';
|
|
6
5
|
import {initRebillyApiMocks} from '../mocks/rebilly-api-mock';
|
|
7
6
|
|
|
8
|
-
export const server = setupServer(
|
|
7
|
+
export const server = setupServer();
|
|
9
8
|
|
|
10
9
|
export const {when} = whenThen(server, rest);
|
|
11
10
|
|
package/tests/msw/handlers.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
const withFallback = (resolver) => {
|
|
2
|
-
return {
|
|
3
|
-
predicate () {
|
|
4
|
-
// Match all requests, regardless of URL, method, etc.
|
|
5
|
-
return true;
|
|
6
|
-
},
|
|
7
|
-
resolver
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const handlers = [
|
|
12
|
-
withFallback((params, params2) => {
|
|
13
|
-
// Handle any requests that didn't match the existing handlers.
|
|
14
|
-
// Throw exceptions, or return a mocked response.
|
|
15
|
-
|
|
16
|
-
// params: {
|
|
17
|
-
// url: URL {},
|
|
18
|
-
// method: 'GET',
|
|
19
|
-
// body: '',
|
|
20
|
-
// headers: Headers { map: [Object] },
|
|
21
|
-
// cookies: {},
|
|
22
|
-
// params: {},
|
|
23
|
-
// redirect: 'manual',
|
|
24
|
-
// referrer: '',
|
|
25
|
-
// keepalive: false,
|
|
26
|
-
// cache: 'default',
|
|
27
|
-
// mode: 'cors',
|
|
28
|
-
// referrerPolicy: 'no-referrer',
|
|
29
|
-
// integrity: '',
|
|
30
|
-
// destination: 'document',
|
|
31
|
-
// bodyUsed: false,
|
|
32
|
-
// credentials: 'same-origin'
|
|
33
|
-
// }
|
|
34
|
-
|
|
35
|
-
throw Error(`UNHANDLED URL!!! Url: ${params.url} method: ${params.method}}`);
|
|
36
|
-
})
|
|
37
|
-
];
|