@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,7 +1,7 @@
1
1
  export declare const ERROR_CODES: ErrorCodes;
2
2
  export declare const defaultErrorMessages: DefaultErrorMessages;
3
3
  declare const FramePayError: {
4
- ({ code, details, trace }: {
4
+ ({ code, details, trace, }: {
5
5
  readonly code: FramePayErrorCode;
6
6
  readonly details?: string | undefined;
7
7
  readonly trace?: any;
@@ -5,7 +5,7 @@ exports.defaultErrorMessages = exports.ERROR_CODES = void 0;
5
5
  exports.ERROR_CODES = {
6
6
  elementMountError: 'element-mount-error',
7
7
  initializeError: 'initialize-error',
8
- remoteScriptError: 'remote-script-error'
8
+ remoteScriptError: 'remote-script-error',
9
9
  };
10
10
  exports.defaultErrorMessages = (_a = {},
11
11
  _a[exports.ERROR_CODES.remoteScriptError] = "Can't load the FramePay remote script",
@@ -21,7 +21,7 @@ var ErrorBuilder = /** @class */ (function () {
21
21
  code: code,
22
22
  details: details,
23
23
  message: exports.defaultErrorMessages[code],
24
- trace: trace || null
24
+ trace: trace || null,
25
25
  };
26
26
  };
27
27
  return ErrorBuilder;
@@ -32,9 +32,9 @@ var FramePayError = function (_a) {
32
32
  return handler.make({
33
33
  code: code,
34
34
  details: details,
35
- trace: trace
35
+ trace: trace,
36
36
  });
37
37
  };
38
38
  FramePayError.codes = exports.ERROR_CODES;
39
39
  exports.default = FramePayError;
40
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZnJhbWVwYXktZXJyb3IuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbGliL2ZyYW1lcGF5LWVycm9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7QUFBYSxRQUFBLFdBQVcsR0FBRztJQUN2QixpQkFBaUIsRUFBRSxxQkFBcUI7SUFDeEMsZUFBZSxFQUFFLGtCQUFrQjtJQUNuQyxpQkFBaUIsRUFBRSxxQkFBcUI7Q0FDN0IsQ0FBQztBQUVILFFBQUEsb0JBQW9CLEdBQUcsQ0FBQTtJQUNoQyxHQUFDLG1CQUFXLENBQUMsaUJBQWlCLElBQUcsdUNBQXVDO0lBQ3hFLEdBQUMsbUJBQVcsQ0FBQyxpQkFBaUIsSUFBRyxtQ0FBbUM7SUFDcEUsR0FBQyxtQkFBVyxDQUFDLGVBQWUsSUFBRyxvUEFHMkQ7TUFDckUsQ0FBQSxDQUFDO0FBRTFCO0lBQUE7SUFzQkEsQ0FBQztJQXJCRywyQkFBSSxHQUFKLFVBQUssRUFRSjtZQVBHLElBQUksVUFBQSxFQUNKLE9BQU8sYUFBQSxFQUNQLEtBQUssV0FBQTtRQVdMLE9BQU87WUFDSCxJQUFJLE1BQUE7WUFDSixPQUFPLFNBQUE7WUFDUCxPQUFPLEVBQUUsNEJBQW9CLENBQUMsSUFBSSxDQUFDO1lBQ25DLEtBQUssRUFBRSxLQUFLLElBQUksSUFBSTtTQUN2QixDQUFDO0lBQ04sQ0FBQztJQUNMLG1CQUFDO0FBQUQsQ0FBQyxBQXRCRCxJQXNCQztBQUVELElBQU0sT0FBTyxHQUFHLElBQUksWUFBWSxFQUFFLENBQUM7QUFFbkMsSUFBTSxhQUFhLEdBQUcsVUFBQyxFQVF0QjtRQVBHLElBQUksVUFBQSxFQUNKLGVBQVksRUFBWixPQUFPLG1CQUFHLEVBQUUsS0FBQSxFQUNaLGFBQVUsRUFBVixLQUFLLG1CQUFHLEVBQUUsS0FBQTtJQU1WLE9BQUEsT0FBTyxDQUFDLElBQUksQ0FBQztRQUNULElBQUksTUFBQTtRQUNKLE9BQU8sU0FBQTtRQUNQLEtBQUssT0FBQTtLQUNSLENBQUM7QUFKRixDQUlFLENBQUM7QUFFUCxhQUFhLENBQUMsS0FBSyxHQUFHLG1CQUFXLENBQUM7QUFFbEMsa0JBQWUsYUFBYSxDQUFDIn0=
40
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZnJhbWVwYXktZXJyb3IuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbGliL2ZyYW1lcGF5LWVycm9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7QUFBYSxRQUFBLFdBQVcsR0FBRztJQUN2QixpQkFBaUIsRUFBRSxxQkFBcUI7SUFDeEMsZUFBZSxFQUFFLGtCQUFrQjtJQUNuQyxpQkFBaUIsRUFBRSxxQkFBcUI7Q0FDN0IsQ0FBQztBQUVILFFBQUEsb0JBQW9CLEdBQUcsQ0FBQTtJQUNoQyxHQUFDLG1CQUFXLENBQUMsaUJBQWlCLElBQUcsdUNBQXVDO0lBQ3hFLEdBQUMsbUJBQVcsQ0FBQyxpQkFBaUIsSUFBRyxtQ0FBbUM7SUFDcEUsR0FBQyxtQkFBVyxDQUFDLGVBQWUsSUFBRyxvUEFHMkQ7TUFDckUsQ0FBQSxDQUFDO0FBRTFCO0lBQUE7SUF3QkEsQ0FBQztJQXZCRywyQkFBSSxHQUFKLFVBQUssRUFTSjtZQVJHLElBQUksVUFBQSxFQUNKLE9BQU8sYUFBQSxFQUNQLEtBQUssV0FBQTtRQWFMLE9BQU87WUFDSCxJQUFJLE1BQUE7WUFDSixPQUFPLFNBQUE7WUFDUCxPQUFPLEVBQUUsNEJBQW9CLENBQUMsSUFBSSxDQUFDO1lBQ25DLEtBQUssRUFBRSxLQUFLLElBQUksSUFBSTtTQUN2QixDQUFDO0lBQ04sQ0FBQztJQUNMLG1CQUFDO0FBQUQsQ0FBQyxBQXhCRCxJQXdCQztBQUVELElBQU0sT0FBTyxHQUFHLElBQUksWUFBWSxFQUFFLENBQUM7QUFFbkMsSUFBTSxhQUFhLEdBQUcsVUFBQyxFQVN0QjtRQVJHLElBQUksVUFBQSxFQUNKLGVBQVksRUFBWixPQUFPLG1CQUFHLEVBQUUsS0FBQSxFQUNaLGFBQVUsRUFBVixLQUFLLG1CQUFHLEVBQUUsS0FBQTtJQU9WLE9BQUEsT0FBTyxDQUFDLElBQUksQ0FBQztRQUNULElBQUksTUFBQTtRQUNKLE9BQU8sU0FBQTtRQUNQLEtBQUssT0FBQTtLQUNSLENBQUM7QUFKRixDQUlFLENBQUM7QUFFUCxhQUFhLENBQUMsS0FBSyxHQUFHLG1CQUFXLENBQUM7QUFFbEMsa0JBQWUsYUFBYSxDQUFDIn0=
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  * Just simple wrapper of remote FramePay api
5
5
  */
6
6
  var remoteApi = function () {
7
- // @ts-ignore
7
+ // @ts-ignore todo setup typescript config correctly
8
8
  return typeof window !== 'undefined' ? window.Rebilly : undefined;
9
9
  };
10
10
  function getRebillyApi() {
11
11
  return remoteApi();
12
12
  }
13
13
  exports.default = getRebillyApi;
14
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0LXJlYmlsbHktYXBpLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2xpYi9nZXQtcmViaWxseS1hcGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQTs7R0FFRztBQUNILElBQU0sU0FBUyxHQUFHO0lBQ2QsYUFBYTtJQUNiLE9BQU8sT0FBTyxNQUFNLEtBQUssV0FBVyxDQUFDLENBQUMsQ0FBQyxNQUFNLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxTQUFTLENBQUM7QUFDdEUsQ0FBQyxDQUFDO0FBRUYsU0FBd0IsYUFBYTtJQUNqQyxPQUFPLFNBQVMsRUFBRSxDQUFDO0FBQ3ZCLENBQUM7QUFGRCxnQ0FFQyJ9
14
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0LXJlYmlsbHktYXBpLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2xpYi9nZXQtcmViaWxseS1hcGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQTs7R0FFRztBQUNILElBQU0sU0FBUyxHQUFHO0lBQ2Qsb0RBQW9EO0lBQ3BELE9BQU8sT0FBTyxNQUFNLEtBQUssV0FBVyxDQUFDLENBQUMsQ0FBQyxNQUFNLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxTQUFTLENBQUM7QUFDdEUsQ0FBQyxDQUFDO0FBRUYsU0FBd0IsYUFBYTtJQUNqQyxPQUFPLFNBQVMsRUFBRSxDQUFDO0FBQ3ZCLENBQUM7QUFGRCxnQ0FFQyJ9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rebilly/framepay-react",
3
- "version": "4.0.5",
3
+ "version": "5.0.0",
4
4
  "description": "A React wrapper for Rebilly's FramePay offering out-of-the-box support for Redux and other common React features",
5
5
  "main": "build/index.js",
6
6
  "author": "Rebilly",
@@ -25,8 +25,7 @@
25
25
  "LICENSE",
26
26
  "env.js",
27
27
  "tsconfig.json",
28
- "tsconfig.spec.json",
29
- "tslint.json"
28
+ "tsconfig.spec.json"
30
29
  ],
31
30
  "scripts": {
32
31
  "set-react-14": "cross-env REACT_VERSION=0.14.0 node ./test/e2e/switch-react-version",
@@ -41,10 +40,8 @@
41
40
  "dev:e2e": "cross-env NODE_ENV=development && run-s dotenv && parcel ./test/e2e/fixtures/* --no-cache --out-dir test/e2e/build",
42
41
  "serve:e2e": "run-s dotenv build:* && node test/e2e/local-server.mjs",
43
42
  "serve:e2e:no-build": "node test/e2e/local-server.mjs",
44
- "fix": "run-s fix:*",
45
- "fix:prettier": "prettier \"src/**/*.ts\" \"src/**/*.tsx\" \"test/**/*.ts\" \"test/**/*.tsx\" \"./*.json\" --write",
46
- "fix:tslint": "tslint --fix --project .",
47
- "lint:no-fix": "tslint --project . && prettier \"src/**/*.ts\" \"src/**/*.tsx\" \"test/**/*.ts\" \"test/**/*.tsx\" \"./*.json\" --list-different",
43
+ "lint": "eslint --ext .ts,.js,.tsx --max-warnings 0 src test --fix",
44
+ "lint:no-fix": "yarn lint --no-fix",
48
45
  "test:unit": "jest --config ./test/unit/jest.config.js",
49
46
  "test:e2e:base": "START_SERVER_AND_TEST_INSECURE=1 start-server-and-test serve:e2e:no-build https-get://localhost:8000 test:e2e:run",
50
47
  "test:e2e:react-14": "cross-env REACT_VERSION=0.14.0 run-s set-react-14 dotenv build:e2e clean-react-alias test:e2e:base",
@@ -68,6 +65,7 @@
68
65
  },
69
66
  "devDependencies": {
70
67
  "@fluffy-spoon/substitute": "^1.89.0",
68
+ "@rebilly/eslint-config": "*",
71
69
  "@small-tech/auto-encrypt-localhost": "^8.3.2",
72
70
  "@testing-library/cypress": "^9.0.0",
73
71
  "@testing-library/jest-dom": "^5.17.0",
@@ -79,32 +77,23 @@
79
77
  "cypress": "^12.17.4",
80
78
  "cypress-iframe": "^1.0.1",
81
79
  "dotenv": "^16.0.3",
80
+ "eslint-plugin-react": "^7.33.2",
82
81
  "express": "^4.17.3",
83
82
  "jest": "^29.5.0",
84
83
  "jest-environment-jsdom": "^29.5.0",
85
84
  "npm-run-all": "^4.1.5",
86
85
  "parcel-bundler": "^1.12.5",
87
86
  "portfinder": "^1.0.20",
88
- "prettier": "^2.8.8",
89
87
  "prop-types": "^15.0.0",
90
88
  "react": "^18.2.0",
91
89
  "react-dom": "^18.2.0",
92
- "start-server-and-test": "^2.0.0",
90
+ "start-server-and-test": "^2.0.1",
93
91
  "ts-jest": "^29.1.1",
94
- "tslint": "^5.11.0",
95
- "tslint-config-prettier": "^1.17.0",
96
- "tslint-immutable": "^6.0.1",
97
92
  "typescript": "4.5.5"
98
93
  },
99
- "prettier": {
100
- "singleQuote": true,
101
- "trailingComma": "none",
102
- "arrowParens": "avoid"
103
- },
104
94
  "resolutions": {
105
95
  "yargs-parser": "^13.1.2",
106
96
  "dot-prop": "^4.2.1",
107
- "node-notifier": "^8.0.1",
108
97
  "glob-parent": "^5.1.2",
109
98
  "trim-newlines": "^4.0.2",
110
99
  "node-forge": "^1.0.0",
package/src/index.spec.ts CHANGED
@@ -9,7 +9,7 @@ const exportKeys: ReadonlyArray<string> = [
9
9
  'withFramePayBankComponent',
10
10
  'withFramePayGooglePayComponent',
11
11
  'withFramePayIBANComponent',
12
- 'withFramePayPaypalComponent'
12
+ 'withFramePayPaypalComponent',
13
13
  ].sort();
14
14
 
15
15
  describe('lib/index', () => {
package/src/index.ts CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  withFramePayCardComponent,
8
8
  withFramePayGooglePayComponent,
9
9
  withFramePayIBANComponent,
10
- withFramePayPaypalComponent
10
+ withFramePayPaypalComponent,
11
11
  } from './lib/components/injector';
12
12
 
13
13
  import FramePayProvider from './lib/components/provider';
@@ -19,7 +19,7 @@ import {
19
19
  FramePayComponentProps,
20
20
  FramePayGooglePayProps,
21
21
  FramePayIBANProps,
22
- FramePayPaypalProps
22
+ FramePayPaypalProps,
23
23
  } from '../types/injector';
24
24
 
25
25
  export {
@@ -38,5 +38,5 @@ export {
38
38
  FramePayIBANProps,
39
39
  FramePayApplePayProps,
40
40
  FramePayGooglePayProps,
41
- FramePayPaypalProps
41
+ FramePayPaypalProps,
42
42
  };
@@ -15,7 +15,7 @@ export default class ApplePayElement extends BaseElement<
15
15
  if (!this.elementNode) {
16
16
  throw FramePayError({
17
17
  code: FramePayError.codes.elementMountError,
18
- details: `ApplePayElement invalid elementNode`
18
+ details: `ApplePayElement invalid elementNode`,
19
19
  });
20
20
  }
21
21
 
@@ -25,7 +25,7 @@ export default class ApplePayElement extends BaseElement<
25
25
  throw FramePayError({
26
26
  code: FramePayError.codes.elementMountError,
27
27
  details: `ApplePayElement error in remote api call`,
28
- trace: e
28
+ trace: e,
29
29
  });
30
30
  }
31
31
  };
@@ -10,7 +10,7 @@ describe('BankElement', () => {
10
10
 
11
11
  const setupElementSpy = jest.spyOn(
12
12
  BankElement.prototype,
13
- 'setupElement'
13
+ 'setupElement',
14
14
  );
15
15
 
16
16
  render(
@@ -19,10 +19,10 @@ describe('BankElement', () => {
19
19
  Rebilly={{
20
20
  ...props.Rebilly,
21
21
  bankAccount: props.Rebilly.bankAccount,
22
- ready: false
22
+ ready: false,
23
23
  }}
24
24
  elementType="bankRoutingNumber"
25
- />
25
+ />,
26
26
  );
27
27
 
28
28
  expect(setupElementSpy).not.toHaveBeenCalled();
@@ -33,7 +33,7 @@ describe('BankElement', () => {
33
33
 
34
34
  const setupElementSpy = jest.spyOn(
35
35
  BankElement.prototype,
36
- 'setupElement'
36
+ 'setupElement',
37
37
  );
38
38
 
39
39
  render(
@@ -42,16 +42,16 @@ describe('BankElement', () => {
42
42
  Rebilly={{
43
43
  ...props.Rebilly,
44
44
  bankAccount: props.Rebilly.bankAccount,
45
- ready: true
45
+ ready: true,
46
46
  }}
47
47
  elementType="bankAccountType"
48
- />
48
+ />,
49
49
  );
50
50
 
51
51
  expect(setupElementSpy).toHaveBeenCalled();
52
52
  });
53
53
 
54
- it('should destroy the element on component unmount', done => {
54
+ it('should destroy the element on component unmount', (done) => {
55
55
  const props = Substitute.for<BankProps>();
56
56
  const element = Substitute.for<PaymentElement>();
57
57
 
@@ -69,7 +69,7 @@ describe('BankElement', () => {
69
69
  Rebilly={{
70
70
  ...props.Rebilly,
71
71
  bankAccount: props.Rebilly.bankAccount,
72
- ready: true
72
+ ready: true,
73
73
  }}
74
74
  elementType="bankRoutingNumber"
75
75
  />
@@ -87,7 +87,7 @@ describe('BankElement', () => {
87
87
  props.Rebilly.ready.returns(true);
88
88
 
89
89
  const { container } = render(
90
- <BankElement {...props} Rebilly={props.Rebilly} />
90
+ <BankElement {...props} Rebilly={props.Rebilly} />,
91
91
  );
92
92
  expect(container.firstChild).toMatchInlineSnapshot(`<div />`);
93
93
  });
@@ -103,12 +103,12 @@ describe('BankElement', () => {
103
103
  ...props.Rebilly,
104
104
  bankAccount: {
105
105
  ...props.Rebilly.bankAccount,
106
- mount: null
106
+ mount: null,
107
107
  },
108
- ready: true
108
+ ready: true,
109
109
  }}
110
110
  elementType="bankAccountNumber"
111
- />
111
+ />,
112
112
  );
113
113
  // never
114
114
  expect(true).toEqual(false);
@@ -14,14 +14,14 @@ export default class BankElement extends BaseElement<BankProps, BankState> {
14
14
  code: FramePayError.codes.elementMountError,
15
15
  details: `BankElement invalid elementNode, elementType: ${
16
16
  elementType || 'default'
17
- }`
17
+ }`,
18
18
  });
19
19
  }
20
20
 
21
21
  try {
22
22
  return this.props.Rebilly.bankAccount.mount(
23
23
  this.elementNode,
24
- elementType
24
+ elementType,
25
25
  );
26
26
  } catch (e) {
27
27
  throw FramePayError({
@@ -29,7 +29,7 @@ export default class BankElement extends BaseElement<BankProps, BankState> {
29
29
  details: `BankElement error in remote api call, elementType: ${
30
30
  elementType || 'default'
31
31
  }`,
32
- trace: e
32
+ trace: e,
33
33
  });
34
34
  }
35
35
  };
@@ -70,7 +70,7 @@ export default class BankElement extends BaseElement<BankProps, BankState> {
70
70
  details: `BankElement events binding error, elementType: ${
71
71
  elementType || 'default'
72
72
  }`,
73
- trace: e
73
+ trace: e,
74
74
  });
75
75
  }
76
76
  }
@@ -2,24 +2,20 @@ import * as React from 'react';
2
2
 
3
3
  export default class BaseElement<
4
4
  T extends PaymentComponentProps,
5
- S extends PaymentComponentState
5
+ S extends PaymentComponentState,
6
6
  > extends React.Component<T, S> {
7
7
  readonly state = {
8
8
  element: null,
9
9
  mounted: false,
10
- ready: false
10
+ ready: false,
11
11
  } as S;
12
12
 
13
- /* tslint:disable:readonly-keyword */
14
13
  protected elementNode: HTMLDivElement | null = null;
15
14
 
16
- /* tslint:enable:readonly-keyword */
17
-
18
15
  componentWillUnmount() {
19
16
  if (this.state.mounted && !this.state.element) {
20
- // tslint:disable-next-line:no-console
21
17
  console.log(
22
- `WARNING Element does not exist, please fix the setupElement method and add setState({element})`
18
+ `WARNING Element does not exist, please fix the setupElement method and add setState({element})`,
23
19
  );
24
20
  return;
25
21
  }
@@ -58,34 +54,38 @@ export default class BaseElement<
58
54
  /**
59
55
  * Setup field
60
56
  */
61
- // @ts-ignore
57
+ // @ts-ignore todo fix type issue
58
+ // eslint-disable-next-line react/no-direct-mutation-state
62
59
  this.state.mounted = true;
63
60
  this.setupElement();
64
61
  }
65
62
 
63
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
66
64
  shouldComponentUpdate(nextProps: any, nextState: any) {
67
65
  // we can't use the componentDidUpdate, componentWillReceiveProps methods
68
66
  // also, we can't return true here (to avoid the dom element re-render)
69
67
  // so, in that case we had to use that method as componentDidUpdate or componentWillReceiveProps
70
68
  // with some magic
69
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
71
70
  const rules: ReadonlyArray<any> = [
72
- // @ts-ignore
71
+ // @ts-ignore todo fix typing issues
73
72
  [this.props.Rebilly.ready, nextProps.Rebilly.ready],
74
- // @ts-ignore
73
+ // @ts-ignore todo fix typing issues
75
74
  [this.state.mounted, nextState.mounted],
76
- // @ts-ignore
75
+ // @ts-ignore todo fix typing issues
77
76
  [this.state.ready, nextState.ready],
78
- // @ts-ignore
79
- [!!this.state.element, !!nextState.element]
77
+ // @ts-ignore todo fix typing issues
78
+ [!!this.state.element, !!nextState.element],
80
79
  ];
81
80
 
82
81
  const shouldUpdate = rules.find(([prev, next]) => prev !== next);
83
82
 
84
83
  if (shouldUpdate) {
85
- // @ts-ignore
84
+ // @ts-ignore todo fix typing issues
86
85
  this.props = nextProps;
87
86
  this.handleSetupElement();
88
- // @ts-ignore
87
+ // @ts-ignore todo fix typing issues
88
+ // eslint-disable-next-line react/no-direct-mutation-state
89
89
  this.state = { ...nextState };
90
90
  }
91
91
 
@@ -94,7 +94,7 @@ export default class BaseElement<
94
94
 
95
95
  render() {
96
96
  return (
97
- <div id={this.props.id} ref={node => (this.elementNode = node)} />
97
+ <div id={this.props.id} ref={(node) => (this.elementNode = node)} />
98
98
  );
99
99
  }
100
100
  }
@@ -12,7 +12,7 @@ describe('CardElement', () => {
12
12
 
13
13
  const setupElementSpy = jest.spyOn(
14
14
  CardElement.prototype,
15
- 'setupElement'
15
+ 'setupElement',
16
16
  );
17
17
 
18
18
  render(<CardElement {...props} Rebilly={props.Rebilly} />);
@@ -24,15 +24,15 @@ describe('CardElement', () => {
24
24
  const props = Substitute.for<CardProps>();
25
25
  const setupElementSpy = jest.spyOn(
26
26
  CardElement.prototype,
27
- 'setupElement'
27
+ 'setupElement',
28
28
  );
29
29
 
30
30
  const { rerender } = render(
31
31
  <CardElement
32
32
  Rebilly={{
33
- ready: false
33
+ ready: false,
34
34
  }}
35
- />
35
+ />,
36
36
  );
37
37
 
38
38
  expect(setupElementSpy).toHaveBeenCalledTimes(0);
@@ -41,9 +41,9 @@ describe('CardElement', () => {
41
41
  <CardElement
42
42
  Rebilly={{
43
43
  card: props.Rebilly.card,
44
- ready: true
44
+ ready: true,
45
45
  }}
46
- />
46
+ />,
47
47
  );
48
48
 
49
49
  expect(setupElementSpy).toHaveBeenCalledTimes(1);
@@ -52,12 +52,12 @@ describe('CardElement', () => {
52
52
  it('should render the empty div element', () => {
53
53
  const props = Substitute.for<CardProps>();
54
54
  const { container } = render(
55
- <CardElement {...props} Rebilly={props.Rebilly} />
55
+ <CardElement {...props} Rebilly={props.Rebilly} />,
56
56
  );
57
57
  expect(container.firstChild).toMatchInlineSnapshot(`<div />`);
58
58
  });
59
59
 
60
- it('should destroy the element on component unmount', done => {
60
+ it('should destroy the element on component unmount', (done) => {
61
61
  const props = Substitute.for<CardProps>();
62
62
  const element = Substitute.for<PaymentElement>();
63
63
 
@@ -74,9 +74,9 @@ describe('CardElement', () => {
74
74
  ...props.Rebilly,
75
75
  card: {
76
76
  ...props.Rebilly.card,
77
- mount: () => element
77
+ mount: () => element,
78
78
  },
79
- ready: true
79
+ ready: true,
80
80
  }}
81
81
  />
82
82
  );
@@ -98,11 +98,11 @@ describe('CardElement', () => {
98
98
  ...props.Rebilly,
99
99
  card: {
100
100
  ...props.Rebilly.card,
101
- mount: null
101
+ mount: null,
102
102
  },
103
- ready: true
103
+ ready: true,
104
104
  }}
105
- />
105
+ />,
106
106
  );
107
107
  // never
108
108
  expect(true).toEqual(false);
@@ -14,14 +14,14 @@ export default class CardElement extends BaseElement<CardProps, CardState> {
14
14
  code: FramePayError.codes.elementMountError,
15
15
  details: `CardElement invalid elementNode, elementType: ${
16
16
  elementType || 'default'
17
- }`
17
+ }`,
18
18
  });
19
19
  }
20
20
 
21
21
  try {
22
22
  return this.props.Rebilly.card.mount(
23
23
  this.elementNode,
24
- elementType
24
+ elementType,
25
25
  );
26
26
  } catch (e) {
27
27
  throw FramePayError({
@@ -29,7 +29,7 @@ export default class CardElement extends BaseElement<CardProps, CardState> {
29
29
  details: `CardElement error in remote api call, elementType: ${
30
30
  elementType || 'default'
31
31
  }`,
32
- trace: e
32
+ trace: e,
33
33
  });
34
34
  }
35
35
  };
@@ -69,7 +69,7 @@ export default class CardElement extends BaseElement<CardProps, CardState> {
69
69
  details: `CardElement events binding error, elementType: ${
70
70
  elementType || 'default'
71
71
  }`,
72
- trace: e
72
+ trace: e,
73
73
  });
74
74
  }
75
75
  }
@@ -15,7 +15,7 @@ export default class GooglePayElement extends BaseElement<
15
15
  if (!this.elementNode) {
16
16
  throw FramePayError({
17
17
  code: FramePayError.codes.elementMountError,
18
- details: `GooglePayElement invalid elementNode`
18
+ details: `GooglePayElement invalid elementNode`,
19
19
  });
20
20
  }
21
21
 
@@ -25,7 +25,7 @@ export default class GooglePayElement extends BaseElement<
25
25
  throw FramePayError({
26
26
  code: FramePayError.codes.elementMountError,
27
27
  details: `GooglePayElement error in remote api call`,
28
- trace: e
28
+ trace: e,
29
29
  });
30
30
  }
31
31
  };
@@ -23,7 +23,7 @@ describe('IBANElement', () => {
23
23
  props.Rebilly.ready.returns(false);
24
24
 
25
25
  const { rerender } = render(
26
- <IBANElement {...props} Rebilly={props.Rebilly} />
26
+ <IBANElement {...props} Rebilly={props.Rebilly} />,
27
27
  );
28
28
 
29
29
  expect(spy).toHaveBeenCalledTimes(0);
@@ -34,7 +34,7 @@ describe('IBANElement', () => {
34
34
  <IBANElement
35
35
  {...nextProps}
36
36
  Rebilly={{ iban: nextProps.Rebilly.iban, ready: true }}
37
- />
37
+ />,
38
38
  );
39
39
 
40
40
  expect(spy).toHaveBeenCalledTimes(1);
@@ -43,12 +43,12 @@ describe('IBANElement', () => {
43
43
  it('should render the empty div element', () => {
44
44
  const props = Substitute.for<IBANProps>();
45
45
  const { container } = render(
46
- <IBANElement {...props} Rebilly={props.Rebilly} />
46
+ <IBANElement {...props} Rebilly={props.Rebilly} />,
47
47
  );
48
48
  expect(container.firstChild).toMatchInlineSnapshot(`<div />`);
49
49
  });
50
50
 
51
- it('should destroy the element on component unmount', done => {
51
+ it('should destroy the element on component unmount', (done) => {
52
52
  const props = Substitute.for<IBANProps>();
53
53
  const element = Substitute.for<PaymentElement>();
54
54
 
@@ -65,9 +65,9 @@ describe('IBANElement', () => {
65
65
  ...props.Rebilly,
66
66
  iban: {
67
67
  ...props.Rebilly.iban,
68
- mount: () => element
68
+ mount: () => element,
69
69
  },
70
- ready: true
70
+ ready: true,
71
71
  }}
72
72
  />
73
73
  );
@@ -89,11 +89,11 @@ describe('IBANElement', () => {
89
89
  ...props.Rebilly,
90
90
  iban: {
91
91
  ...props.Rebilly.iban,
92
- mount: null
92
+ mount: null,
93
93
  },
94
- ready: true
94
+ ready: true,
95
95
  }}
96
- />
96
+ />,
97
97
  );
98
98
  // never
99
99
  expect(true).toEqual(false);
@@ -14,7 +14,7 @@ export default class IBANElement extends BaseElement<IBANProps, IBANState> {
14
14
  code: FramePayError.codes.elementMountError,
15
15
  details: `IBANElement invalid elementNode, elementType: ${
16
16
  elementType || 'default'
17
- }`
17
+ }`,
18
18
  });
19
19
  }
20
20
 
@@ -26,7 +26,7 @@ export default class IBANElement extends BaseElement<IBANProps, IBANState> {
26
26
  details: `IBANElement error in remote api call, elementType: ${
27
27
  elementType || 'default'
28
28
  }`,
29
- trace: e
29
+ trace: e,
30
30
  });
31
31
  }
32
32
  };
@@ -67,12 +67,12 @@ export default class IBANElement extends BaseElement<IBANProps, IBANState> {
67
67
  details: `IBANElement events binding error, elementType: ${
68
68
  elementType || 'default'
69
69
  }`,
70
- trace: e
70
+ trace: e,
71
71
  });
72
72
  }
73
73
  }
74
74
 
75
75
  render() {
76
- return <div ref={node => (this.elementNode = node)} />;
76
+ return <div ref={(node) => (this.elementNode = node)} />;
77
77
  }
78
78
  }
@@ -15,7 +15,7 @@ export default class PaypalElement extends BaseElement<
15
15
  if (!this.elementNode) {
16
16
  throw FramePayError({
17
17
  code: FramePayError.codes.elementMountError,
18
- details: `PaypalElement invalid elementNode`
18
+ details: `PaypalElement invalid elementNode`,
19
19
  });
20
20
  }
21
21
 
@@ -25,7 +25,7 @@ export default class PaypalElement extends BaseElement<
25
25
  throw FramePayError({
26
26
  code: FramePayError.codes.elementMountError,
27
27
  details: `PaypalElement error in remote api call`,
28
- trace: e
28
+ trace: e,
29
29
  });
30
30
  }
31
31
  };