@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rebilly/instruments",
3
- "version": "3.9.0-beta.0",
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": "^0.23.0",
41
- "msw-when-then": "^1.4.0",
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",
@@ -142,7 +142,7 @@ export async function fetchData({
142
142
  invoice,
143
143
  transaction,
144
144
  riskMetadata,
145
- customerAddress: account?.address || null,
145
+ account,
146
146
  });
147
147
 
148
148
  const [readyToPay, previewPurchase] = await Promise.all([
@@ -93,7 +93,9 @@ describe('fetchData function', () => {
93
93
  const mockFetchAccount = jest.fn();
94
94
 
95
95
  await fetchData({
96
- state: {},
96
+ state: {
97
+ options: {}
98
+ },
97
99
  fetchAccount: mockFetchAccount,
98
100
  });
99
101
 
@@ -1,11 +1,4 @@
1
- import { RenderMockRebillyInstruments } from 'tests/mocks/rebilly-instruments-mock';
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 () => {
@@ -30,7 +30,7 @@ export const paymentInstrument = () => `
30
30
  }
31
31
 
32
32
  .rebilly-instruments-payment-instrument-brand {
33
- margin: 0 0 0 var(--rebilly-spacings-s);
33
+ margin: 0 0 0 var(--rebilly-spacings-xs);
34
34
  }
35
35
 
36
36
  .rebilly-instruments-payment-instrument-last4 {
@@ -81,4 +81,11 @@ export const modal = () => `
81
81
  .rebilly-instruments-modal-close:hover{
82
82
  color: #000;
83
83
  }
84
+
85
+ @media screen and (max-width: 480px) {
86
+ .rebilly-instruments-modal-container.is-redirect {
87
+ max-width: 96vw;
88
+ margin: 20px auto 20px;
89
+ }
90
+ }
84
91
  `;
@@ -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
- customerAddress: state.data.customerAddress,
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 { ok, get, post } from 'msw-when-then';
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
  };
@@ -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(...handlers);
7
+ export const server = setupServer();
9
8
 
10
9
  export const {when} = whenThen(server, rest);
11
10
 
@@ -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
- ];