@rebilly/framepay-react 4.0.5 → 5.0.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/build/index.d.ts +1 -1
  3. package/build/index.spec.js +1 -1
  4. package/build/lib/components/elements/applepay-element.js +2 -2
  5. package/build/lib/components/elements/bank-element.js +3 -3
  6. package/build/lib/components/elements/base-element.js +14 -13
  7. package/build/lib/components/elements/card-element.js +3 -3
  8. package/build/lib/components/elements/googlepay-element.js +2 -2
  9. package/build/lib/components/elements/iban-element.js +4 -4
  10. package/build/lib/components/elements/paypal-element.js +2 -2
  11. package/build/lib/components/injector.js +20 -20
  12. package/build/lib/components/provider.js +11 -11
  13. package/build/lib/constants.js +1 -1
  14. package/build/lib/context.js +2 -4
  15. package/build/lib/dom-util.js +1 -5
  16. package/build/lib/framepay-error.d.ts +1 -1
  17. package/build/lib/framepay-error.js +4 -4
  18. package/build/lib/get-rebilly-api.js +2 -2
  19. package/package.json +7 -18
  20. package/src/index.spec.ts +1 -1
  21. package/src/index.ts +3 -3
  22. package/src/lib/components/elements/applepay-element.tsx +2 -2
  23. package/src/lib/components/elements/bank-element.spec.tsx +12 -12
  24. package/src/lib/components/elements/bank-element.tsx +4 -4
  25. package/src/lib/components/elements/base-element.tsx +16 -16
  26. package/src/lib/components/elements/card-element.spec.tsx +13 -13
  27. package/src/lib/components/elements/card-element.tsx +4 -4
  28. package/src/lib/components/elements/googlepay-element.tsx +2 -2
  29. package/src/lib/components/elements/iban-element.spec.tsx +9 -9
  30. package/src/lib/components/elements/iban-element.tsx +4 -4
  31. package/src/lib/components/elements/paypal-element.tsx +2 -2
  32. package/src/lib/components/injector.spec.tsx +3 -4
  33. package/src/lib/components/injector.tsx +50 -48
  34. package/src/lib/components/provider.spec.tsx +5 -7
  35. package/src/lib/components/provider.tsx +15 -15
  36. package/src/lib/constants.ts +1 -1
  37. package/src/lib/context.ts +1 -3
  38. package/src/lib/dom-util.ts +0 -4
  39. package/src/lib/framepay-error.ts +9 -6
  40. package/src/lib/get-rebilly-api.ts +1 -1
  41. package/test/e2e/cypress-support.js +1 -1
  42. package/test/e2e/fixtures/apple-pay.js +4 -8
  43. package/test/e2e/fixtures/bank-separate.js +68 -67
  44. package/test/e2e/fixtures/card-separate-brands.js +256 -139
  45. package/test/e2e/fixtures/card-separate-rebilly-fields.js +48 -57
  46. package/test/e2e/fixtures/card-separate.js +214 -112
  47. package/test/e2e/fixtures/checkout-combined.js +145 -95
  48. package/test/e2e/fixtures/google-pay.js +6 -10
  49. package/test/e2e/fixtures/iban.js +47 -45
  50. package/test/e2e/fixtures/multiple-methods.js +104 -98
  51. package/test/e2e/fixtures/nav.js +3 -4
  52. package/test/e2e/fixtures/paypal.js +5 -12
  53. package/test/e2e/fixtures/util.js +50 -37
  54. package/test/e2e/specs/card-separate-brands.cy.ts +2 -2
  55. package/test/e2e/specs/react-version.cy.ts +1 -1
  56. package/test/e2e/switch-react-version.js +5 -6
  57. package/test/unit/jest.config.js +18 -28
  58. package/test/unit/specs/declaration-mock.spec.tsx +1 -0
  59. package/tslint.json +0 -36
@@ -1,4 +1,3 @@
1
- // tslint:disable:max-classes-per-file
2
1
  import { Substitute } from '@fluffy-spoon/substitute';
3
2
  import { render } from '@testing-library/react';
4
3
  import * as React from 'react';
@@ -40,7 +39,7 @@ describe('Injector', () => {
40
39
  value={{
41
40
  ...context,
42
41
  error: 'withFramePay',
43
- ready: true
42
+ ready: true,
44
43
  }}
45
44
  >
46
45
  <TMPWrapper />
@@ -90,7 +89,7 @@ describe('Injector', () => {
90
89
  value={{
91
90
  ...context,
92
91
  error: 'withFramePayCardComponent',
93
- ready: true
92
+ ready: true,
94
93
  }}
95
94
  >
96
95
  <TMPWrapper />
@@ -140,7 +139,7 @@ describe('Injector', () => {
140
139
  value={{
141
140
  ...context,
142
141
  error: 'withFramePayBankComponent',
143
- ready: true
142
+ ready: true,
144
143
  }}
145
144
  >
146
145
  <TMPWrapper />
@@ -1,4 +1,4 @@
1
- // tslint:disable:max-classes-per-file
1
+ /* eslint-disable @typescript-eslint/ban-types */
2
2
 
3
3
  import * as React from 'react';
4
4
  import { ContextConsumer } from '../context';
@@ -16,19 +16,19 @@ import {
16
16
  FramePayComponentProps,
17
17
  FramePayGooglePayProps,
18
18
  FramePayIBANProps,
19
- FramePayPaypalProps
19
+ FramePayPaypalProps,
20
20
  } from '../../../types/injector';
21
21
 
22
22
  const makeRebillyProps = (data: FramePayContext): RebillyProps =>
23
23
  Object.assign(Object.create(data.api || {}), {
24
24
  error: data.error,
25
- ready: data.ready
25
+ ready: data.ready,
26
26
  }) as RebillyProps;
27
27
 
28
28
  function Hoc<P extends object>(
29
29
  name: string,
30
30
  WrappedComponent: React.ComponentType<P>,
31
- provider: (data: FramePayContext) => object
31
+ provider: (data: FramePayContext) => object,
32
32
  ) {
33
33
  return class extends React.Component<P, {}> {
34
34
  static readonly displayName = `withFramePay${name}(${
@@ -72,12 +72,12 @@ const elementsFabric = (type: PaymentElements): object => {
72
72
  (data: FramePayContext) =>
73
73
  ({
74
74
  Rebilly: makeRebillyProps(data),
75
- elementType: 'iban'
76
- } as IBANProps)
75
+ elementType: 'iban',
76
+ } as IBANProps),
77
77
  );
78
78
 
79
79
  return {
80
- IBANElement
80
+ IBANElement,
81
81
  };
82
82
  }
83
83
 
@@ -96,8 +96,8 @@ const elementsFabric = (type: PaymentElements): object => {
96
96
  (data: FramePayContext) =>
97
97
  ({
98
98
  Rebilly: makeRebillyProps(data),
99
- elementType: 'bankAccountType'
100
- } as BankProps)
99
+ elementType: 'bankAccountType',
100
+ } as BankProps),
101
101
  );
102
102
 
103
103
  /**
@@ -109,8 +109,8 @@ const elementsFabric = (type: PaymentElements): object => {
109
109
  (data: FramePayContext) =>
110
110
  ({
111
111
  Rebilly: makeRebillyProps(data),
112
- elementType: 'bankRoutingNumber'
113
- } as BankProps)
112
+ elementType: 'bankRoutingNumber',
113
+ } as BankProps),
114
114
  );
115
115
 
116
116
  /**
@@ -122,14 +122,14 @@ const elementsFabric = (type: PaymentElements): object => {
122
122
  (data: FramePayContext) =>
123
123
  ({
124
124
  Rebilly: makeRebillyProps(data),
125
- elementType: 'bankAccountNumber'
126
- } as BankProps)
125
+ elementType: 'bankAccountNumber',
126
+ } as BankProps),
127
127
  );
128
128
 
129
129
  return {
130
130
  BankAccountNumberElement,
131
131
  BankAccountTypeElement,
132
- BankRoutingNumberElement
132
+ BankRoutingNumberElement,
133
133
  };
134
134
  }
135
135
 
@@ -143,8 +143,8 @@ const elementsFabric = (type: PaymentElements): object => {
143
143
  CardElementComponent,
144
144
  (data: FramePayContext) =>
145
145
  ({
146
- Rebilly: makeRebillyProps(data)
147
- } as CardProps)
146
+ Rebilly: makeRebillyProps(data),
147
+ } as CardProps),
148
148
  );
149
149
 
150
150
  /**
@@ -156,8 +156,8 @@ const elementsFabric = (type: PaymentElements): object => {
156
156
  (data: FramePayContext) =>
157
157
  ({
158
158
  Rebilly: makeRebillyProps(data),
159
- elementType: 'cardCvv'
160
- } as CardProps)
159
+ elementType: 'cardCvv',
160
+ } as CardProps),
161
161
  );
162
162
 
163
163
  /**
@@ -169,8 +169,8 @@ const elementsFabric = (type: PaymentElements): object => {
169
169
  (data: FramePayContext) =>
170
170
  ({
171
171
  Rebilly: makeRebillyProps(data),
172
- elementType: 'cardExpiry'
173
- } as CardProps)
172
+ elementType: 'cardExpiry',
173
+ } as CardProps),
174
174
  );
175
175
 
176
176
  /**
@@ -182,15 +182,15 @@ const elementsFabric = (type: PaymentElements): object => {
182
182
  (data: FramePayContext) =>
183
183
  ({
184
184
  Rebilly: makeRebillyProps(data),
185
- elementType: 'cardNumber'
186
- } as CardProps)
185
+ elementType: 'cardNumber',
186
+ } as CardProps),
187
187
  );
188
188
 
189
189
  return {
190
190
  CardCvvElement,
191
191
  CardElement,
192
192
  CardExpiryElement,
193
- CardNumberElement
193
+ CardNumberElement,
194
194
  };
195
195
  }
196
196
 
@@ -204,12 +204,12 @@ const elementsFabric = (type: PaymentElements): object => {
204
204
  ApplePayElementComponent,
205
205
  (data: FramePayContext) =>
206
206
  ({
207
- Rebilly: makeRebillyProps(data)
208
- } as ApplePayProps)
207
+ Rebilly: makeRebillyProps(data),
208
+ } as ApplePayProps),
209
209
  );
210
210
 
211
211
  return {
212
- ApplePayElement
212
+ ApplePayElement,
213
213
  };
214
214
  }
215
215
 
@@ -223,12 +223,12 @@ const elementsFabric = (type: PaymentElements): object => {
223
223
  GooglePayElementComponent,
224
224
  (data: FramePayContext) =>
225
225
  ({
226
- Rebilly: makeRebillyProps(data)
227
- } as GooglePayProps)
226
+ Rebilly: makeRebillyProps(data),
227
+ } as GooglePayProps),
228
228
  );
229
229
 
230
230
  return {
231
- GooglePayElement
231
+ GooglePayElement,
232
232
  };
233
233
  }
234
234
 
@@ -242,12 +242,12 @@ const elementsFabric = (type: PaymentElements): object => {
242
242
  PaypalElementComponent,
243
243
  (data: FramePayContext) =>
244
244
  ({
245
- Rebilly: makeRebillyProps(data)
246
- } as PaypalProps)
245
+ Rebilly: makeRebillyProps(data),
246
+ } as PaypalProps),
247
247
  );
248
248
 
249
249
  return {
250
- PaypalElement
250
+ PaypalElement,
251
251
  };
252
252
  }
253
253
 
@@ -255,14 +255,14 @@ const elementsFabric = (type: PaymentElements): object => {
255
255
  * Throw the error by default.
256
256
  */
257
257
  throw new Error(
258
- `Invalid PaymentMethod type, see PaymentMethodTypes declaration`
258
+ `Invalid PaymentMethod type, see PaymentMethodTypes declaration`,
259
259
  );
260
260
  };
261
261
 
262
262
  export function withFramePay<OriginalProps extends object>(
263
263
  WrappedComponent: React.ComponentType<
264
264
  OriginalProps & FramePayComponentProps
265
- >
265
+ >,
266
266
  ) {
267
267
  const elements = {
268
268
  ...elementsFabric('card'),
@@ -270,7 +270,7 @@ export function withFramePay<OriginalProps extends object>(
270
270
  ...elementsFabric('iban'),
271
271
  ...elementsFabric('applePay'),
272
272
  ...elementsFabric('googlePay'),
273
- ...elementsFabric('paypal')
273
+ ...elementsFabric('paypal'),
274
274
  } as FramePayComponentProps;
275
275
  return class extends React.Component<OriginalProps, {}> {
276
276
  static readonly displayName = `withFramePay(${
@@ -286,7 +286,7 @@ export function withFramePay<OriginalProps extends object>(
286
286
  {...{
287
287
  ...this.props,
288
288
  ...elements,
289
- Rebilly: makeRebillyProps(data)
289
+ Rebilly: makeRebillyProps(data),
290
290
  }}
291
291
  />
292
292
  );
@@ -298,7 +298,7 @@ export function withFramePay<OriginalProps extends object>(
298
298
  }
299
299
 
300
300
  export function withFramePayCardComponent<OriginalProps extends object>(
301
- WrappedComponent: React.ComponentType<OriginalProps & FramePayCardProps>
301
+ WrappedComponent: React.ComponentType<OriginalProps & FramePayCardProps>,
302
302
  ) {
303
303
  const elements = elementsFabric('card') as FramePayCardProps;
304
304
  return class extends React.Component<OriginalProps, {}> {
@@ -315,7 +315,7 @@ export function withFramePayCardComponent<OriginalProps extends object>(
315
315
  {...{
316
316
  ...this.props,
317
317
  ...elements,
318
- Rebilly: makeRebillyProps(data)
318
+ Rebilly: makeRebillyProps(data),
319
319
  }}
320
320
  />
321
321
  );
@@ -327,7 +327,7 @@ export function withFramePayCardComponent<OriginalProps extends object>(
327
327
  }
328
328
 
329
329
  export function withFramePayBankComponent<OriginalProps extends object>(
330
- WrappedComponent: React.ComponentType<OriginalProps & FramePayBankProps>
330
+ WrappedComponent: React.ComponentType<OriginalProps & FramePayBankProps>,
331
331
  ) {
332
332
  const elements = elementsFabric('bankAccount') as FramePayBankProps;
333
333
  return class extends React.Component<OriginalProps, {}> {
@@ -344,7 +344,7 @@ export function withFramePayBankComponent<OriginalProps extends object>(
344
344
  {...{
345
345
  ...this.props,
346
346
  ...elements,
347
- Rebilly: makeRebillyProps(data)
347
+ Rebilly: makeRebillyProps(data),
348
348
  }}
349
349
  />
350
350
  );
@@ -356,7 +356,7 @@ export function withFramePayBankComponent<OriginalProps extends object>(
356
356
  }
357
357
 
358
358
  export function withFramePayIBANComponent<OriginalProps extends object>(
359
- WrappedComponent: React.ComponentType<OriginalProps & FramePayIBANProps>
359
+ WrappedComponent: React.ComponentType<OriginalProps & FramePayIBANProps>,
360
360
  ) {
361
361
  const elements = elementsFabric('iban') as FramePayIBANProps;
362
362
  return class extends React.Component<OriginalProps, {}> {
@@ -373,7 +373,7 @@ export function withFramePayIBANComponent<OriginalProps extends object>(
373
373
  {...{
374
374
  ...this.props,
375
375
  ...elements,
376
- Rebilly: makeRebillyProps(data)
376
+ Rebilly: makeRebillyProps(data),
377
377
  }}
378
378
  />
379
379
  );
@@ -385,7 +385,9 @@ export function withFramePayIBANComponent<OriginalProps extends object>(
385
385
  }
386
386
 
387
387
  export function withFramePayApplePayComponent<OriginalProps extends object>(
388
- WrappedComponent: React.ComponentType<OriginalProps & FramePayApplePayProps>
388
+ WrappedComponent: React.ComponentType<
389
+ OriginalProps & FramePayApplePayProps
390
+ >,
389
391
  ) {
390
392
  const elements = elementsFabric('applePay') as FramePayApplePayProps;
391
393
  return class extends React.Component<OriginalProps, {}> {
@@ -402,7 +404,7 @@ export function withFramePayApplePayComponent<OriginalProps extends object>(
402
404
  {...{
403
405
  ...this.props,
404
406
  ...elements,
405
- Rebilly: makeRebillyProps(data)
407
+ Rebilly: makeRebillyProps(data),
406
408
  }}
407
409
  />
408
410
  );
@@ -416,7 +418,7 @@ export function withFramePayApplePayComponent<OriginalProps extends object>(
416
418
  export function withFramePayGooglePayComponent<OriginalProps extends object>(
417
419
  WrappedComponent: React.ComponentType<
418
420
  OriginalProps & FramePayGooglePayProps
419
- >
421
+ >,
420
422
  ) {
421
423
  const elements = elementsFabric('googlePay') as FramePayGooglePayProps;
422
424
  return class extends React.Component<OriginalProps, {}> {
@@ -433,7 +435,7 @@ export function withFramePayGooglePayComponent<OriginalProps extends object>(
433
435
  {...{
434
436
  ...this.props,
435
437
  ...elements,
436
- Rebilly: makeRebillyProps(data)
438
+ Rebilly: makeRebillyProps(data),
437
439
  }}
438
440
  />
439
441
  );
@@ -445,7 +447,7 @@ export function withFramePayGooglePayComponent<OriginalProps extends object>(
445
447
  }
446
448
 
447
449
  export function withFramePayPaypalComponent<OriginalProps extends object>(
448
- WrappedComponent: React.ComponentType<OriginalProps & FramePayPaypalProps>
450
+ WrappedComponent: React.ComponentType<OriginalProps & FramePayPaypalProps>,
449
451
  ) {
450
452
  const elements = elementsFabric('paypal') as FramePayPaypalProps;
451
453
  return class extends React.Component<OriginalProps, {}> {
@@ -462,7 +464,7 @@ export function withFramePayPaypalComponent<OriginalProps extends object>(
462
464
  {...{
463
465
  ...this.props,
464
466
  ...elements,
465
- Rebilly: makeRebillyProps(data)
467
+ Rebilly: makeRebillyProps(data),
466
468
  }}
467
469
  />
468
470
  );
@@ -1,5 +1,3 @@
1
- // tslint:disable:max-classes-per-file
2
-
3
1
  import { render } from '@testing-library/react';
4
2
  import * as React from 'react';
5
3
  import { FRAMEPAY_SCRIPT_LINK, FRAMEPAY_STYLE_LINK } from '../constants';
@@ -20,7 +18,7 @@ describe('Provider', () => {
20
18
  render(
21
19
  <Provider {...props}>
22
20
  <ChildComponent />
23
- </Provider>
21
+ </Provider>,
24
22
  );
25
23
  expect(document.head.innerHTML).toContain(FRAMEPAY_SCRIPT_LINK);
26
24
  });
@@ -28,7 +26,7 @@ describe('Provider', () => {
28
26
  it('should add the FramePay styles on the page', () => {
29
27
  const props = {
30
28
  injectStyle: true,
31
- publishableKey: 'pk_sandbox_1234567890'
29
+ publishableKey: 'pk_sandbox_1234567890',
32
30
  };
33
31
 
34
32
  class ChildComponent extends React.Component {
@@ -41,7 +39,7 @@ describe('Provider', () => {
41
39
  render(
42
40
  <Provider {...props}>
43
41
  <ChildComponent />
44
- </Provider>
42
+ </Provider>,
45
43
  );
46
44
  expect(document.head.innerHTML).toContain(FRAMEPAY_STYLE_LINK);
47
45
  });
@@ -58,7 +56,7 @@ describe('Provider', () => {
58
56
  const { container } = render(
59
57
  <Provider {...props}>
60
58
  <ChildComponent />
61
- </Provider>
59
+ </Provider>,
62
60
  );
63
61
  expect(container.firstChild).toMatchInlineSnapshot(`
64
62
  <div>
@@ -82,7 +80,7 @@ describe('Provider', () => {
82
80
  <Provider {...props}>
83
81
  <ChildComponent title="child-1" />
84
82
  <ChildComponent title="child-2" />
85
- </Provider>
83
+ </Provider>,
86
84
  );
87
85
  expect(container).toMatchInlineSnapshot(`
88
86
  <div>
@@ -14,20 +14,20 @@ export default class Provider extends React.Component<
14
14
  injectStyle: false,
15
15
  onError: () => ({}),
16
16
  onReady: () => ({}),
17
- onTokenReady: () => ({})
17
+ onTokenReady: () => ({}),
18
18
  };
19
19
 
20
20
  readonly state: FramePayContext = {
21
21
  api: getRebillyApi(),
22
22
  error: null,
23
- ready: false
23
+ ready: false,
24
24
  };
25
25
 
26
26
  componentDidMount() {
27
27
  if (this.props.injectScript) {
28
28
  injectScript({
29
29
  onError: () => this.onApiError(),
30
- onReady: () => this.onApiReady()
30
+ onReady: () => this.onApiReady(),
31
31
  });
32
32
  }
33
33
  if (this.props.injectStyle) {
@@ -39,24 +39,23 @@ export default class Provider extends React.Component<
39
39
  return this.setState(
40
40
  {
41
41
  error: FramePayError.codes.remoteScriptError,
42
- ready: false
42
+ ready: false,
43
43
  },
44
44
  () => {
45
45
  const error = FramePayError({
46
46
  code: FramePayError.codes.remoteScriptError,
47
- details: `Remote CDN link "${FRAMEPAY_SCRIPT_LINK}"`
47
+ details: `Remote CDN link "${FRAMEPAY_SCRIPT_LINK}"`,
48
48
  });
49
49
  throw error;
50
- }
50
+ },
51
51
  );
52
52
  }
53
53
 
54
54
  async onApiReady() {
55
55
  const api = getRebillyApi();
56
56
  try {
57
- // tslint:disable:no-shadowed-variable
57
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
58
58
  const { injectStyle, children, ...settings } = this.props;
59
- // tslint:enable:no-shadowed-variable
60
59
  api.initialize(settings);
61
60
  api.on('ready', () => {
62
61
  this.setState({ ready: true, api, error: null });
@@ -66,20 +65,21 @@ export default class Provider extends React.Component<
66
65
  this.props.onReady();
67
66
  }
68
67
  });
69
- api.on('error', error => {
68
+ api.on('error', (error) => {
70
69
  this.setState({
71
70
  api,
71
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
72
72
  error: (error as any).code,
73
- ready: false
73
+ ready: false,
74
74
  });
75
75
 
76
76
  // call error callback
77
77
  if (this.props.onError) {
78
- // @ts-ignore
78
+ // @ts-ignore todo fix typing issues
79
79
  this.props.onError(error);
80
80
  }
81
81
  });
82
- api.on('token-ready', token => {
82
+ api.on('token-ready', (token) => {
83
83
  if (this.props.onTokenReady) {
84
84
  this.props.onTokenReady(token);
85
85
  }
@@ -88,15 +88,15 @@ export default class Provider extends React.Component<
88
88
  return this.setState(
89
89
  {
90
90
  error: FramePayError.codes.initializeError,
91
- ready: false
91
+ ready: false,
92
92
  },
93
93
  () => {
94
94
  throw FramePayError({
95
95
  code: FramePayError.codes.initializeError,
96
96
  details: 'Api initialize error',
97
- trace: e
97
+ trace: e,
98
98
  });
99
- }
99
+ },
100
100
  );
101
101
  }
102
102
  }
@@ -39,5 +39,5 @@ export const SUPPORTED_CARD_BRANDS: SupportedCardBrandsObject = {
39
39
  JCB: SupportedCardBrands.JCB,
40
40
  Maestro: SupportedCardBrands.Maestro,
41
41
  MasterCard: SupportedCardBrands.MasterCard,
42
- Visa: SupportedCardBrands.Visa
42
+ Visa: SupportedCardBrands.Visa,
43
43
  };
@@ -5,13 +5,11 @@ import getRebillyApi from './get-rebilly-api';
5
5
  const defaultContextValue = {
6
6
  api: getRebillyApi(),
7
7
  error: null,
8
- ready: false
8
+ ready: false,
9
9
  };
10
10
 
11
- // tslint:disable:no-let
12
11
  let ProvidedContext;
13
12
  if (/^15.*/.test(REACT_VERSION) || /^0.14.*/.test(REACT_VERSION)) {
14
- // tslint:disable:no-var-requires
15
13
  const createReactContext = require('create-react-context');
16
14
  ProvidedContext = createReactContext(defaultContextValue);
17
15
  } else {
@@ -6,7 +6,6 @@ interface ScriptProperties {
6
6
  }
7
7
 
8
8
  export const injectScript = ({ onReady, onError }: ScriptProperties) => {
9
- // tslint:disable:no-expression-statement
10
9
  const script = document.createElement('script');
11
10
  const header = document.querySelector('head');
12
11
  script.setAttribute('type', 'text/javascript');
@@ -19,11 +18,9 @@ export const injectScript = ({ onReady, onError }: ScriptProperties) => {
19
18
  if (header) {
20
19
  header.appendChild(script);
21
20
  }
22
- // tslint:enable:no-expression-statement
23
21
  };
24
22
 
25
23
  export const injectStyle = () => {
26
- // tslint:disable:no-expression-statement
27
24
  const style = document.createElement('link');
28
25
  const header = document.querySelector('head');
29
26
  style.setAttribute('rel', 'stylesheet');
@@ -31,5 +28,4 @@ export const injectStyle = () => {
31
28
  if (header) {
32
29
  header.appendChild(style);
33
30
  }
34
- // tslint:enable:no-expression-statement
35
31
  };
@@ -1,7 +1,7 @@
1
1
  export const ERROR_CODES = {
2
2
  elementMountError: 'element-mount-error',
3
3
  initializeError: 'initialize-error',
4
- remoteScriptError: 'remote-script-error'
4
+ remoteScriptError: 'remote-script-error',
5
5
  } as ErrorCodes;
6
6
 
7
7
  export const defaultErrorMessages = {
@@ -10,29 +10,31 @@ export const defaultErrorMessages = {
10
10
  [ERROR_CODES.initializeError]: `
11
11
  FramePay initialize error\r\n
12
12
  See https://github.com/Rebilly/framepay-react/tree/alpha#the-framepay-context-framepayprovider\r\n
13
- See https://rebilly.github.io/framepay-docs/reference/rebilly.html#rebilly-initialize`
13
+ See https://rebilly.github.io/framepay-docs/reference/rebilly.html#rebilly-initialize`,
14
14
  } as DefaultErrorMessages;
15
15
 
16
16
  class ErrorBuilder {
17
17
  make({
18
18
  code,
19
19
  details,
20
- trace
20
+ trace,
21
21
  }: {
22
22
  readonly code: FramePayErrorCode;
23
23
  readonly details: string;
24
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
25
  readonly trace: any;
25
26
  }): {
26
27
  readonly code: FramePayErrorCode;
27
28
  readonly details: string;
28
29
  readonly message: DefaultErrorMessage;
30
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
31
  readonly trace: any;
30
32
  } {
31
33
  return {
32
34
  code,
33
35
  details,
34
36
  message: defaultErrorMessages[code],
35
- trace: trace || null
37
+ trace: trace || null,
36
38
  };
37
39
  }
38
40
  }
@@ -42,16 +44,17 @@ const handler = new ErrorBuilder();
42
44
  const FramePayError = ({
43
45
  code,
44
46
  details = '',
45
- trace = ''
47
+ trace = '',
46
48
  }: {
47
49
  readonly code: FramePayErrorCode;
48
50
  readonly details?: string;
51
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
49
52
  readonly trace?: any;
50
53
  }) =>
51
54
  handler.make({
52
55
  code,
53
56
  details,
54
- trace
57
+ trace,
55
58
  });
56
59
 
57
60
  FramePayError.codes = ERROR_CODES;
@@ -2,7 +2,7 @@
2
2
  * Just simple wrapper of remote FramePay api
3
3
  */
4
4
  const remoteApi = (): RebillyApi => {
5
- // @ts-ignore
5
+ // @ts-ignore todo setup typescript config correctly
6
6
  return typeof window !== 'undefined' ? window.Rebilly : undefined;
7
7
  };
8
8
 
@@ -1,2 +1,2 @@
1
1
  import '@testing-library/cypress/add-commands';
2
- import 'cypress-iframe';
2
+ import 'cypress-iframe';
@@ -3,7 +3,7 @@ import ReactDOM from 'react-dom';
3
3
 
4
4
  import {
5
5
  FramePayProvider,
6
- withFramePayApplePayComponent
6
+ withFramePayApplePayComponent,
7
7
  } from '../../../build';
8
8
  import { prettyDebugRender, ReactVersion } from './util';
9
9
  import './style.css';
@@ -20,7 +20,6 @@ const params = {
20
20
  };
21
21
 
22
22
  class App extends Component {
23
-
24
23
  constructor(props) {
25
24
  super(props);
26
25
  this.state = {
@@ -36,10 +35,10 @@ class App extends Component {
36
35
  onReady={() => {
37
36
  console.log('FramePayProvider.onReady');
38
37
  }}
39
- onError={err => {
38
+ onError={(err) => {
40
39
  console.log('FramePayProvider.onError', err);
41
40
  }}
42
- onTokenReady={token => this.setState({ token })}
41
+ onTokenReady={(token) => this.setState({ token })}
43
42
  >
44
43
  <div>
45
44
  {ReactVersion()}
@@ -57,7 +56,4 @@ class App extends Component {
57
56
  }
58
57
 
59
58
  const WrappedApp = withFramePayApplePayComponent(App);
60
- ReactDOM.render(
61
- <WrappedApp />,
62
- document.getElementById('app')
63
- );
59
+ ReactDOM.render(<WrappedApp />, document.getElementById('app'));