@seamlessdocs/payment-modals 2.0.0-beta.8 → 2.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.
@@ -28,11 +28,9 @@ module.exports = function(proxy, allowedHost) {
28
28
  // So we will disable the host check normally, but enable it if you have
29
29
  // specified the `proxy` setting. Finally, we let you override it if you
30
30
  // really know what you're doing with a special environment variable.
31
- // WebpackDevServer 2.4.3 introduced a security fix that prevents remote
32
- // websites from potentially accessing local content through DNS rebinding.
33
31
  // For Webpack 5, we use allowedHosts instead of disableHostCheck
34
- allowedHosts: proxy || process.env.DANGEROUSLY_DISABLE_HOST_CHECK === 'true'
35
- ? 'all'
32
+ allowedHosts: proxy || process.env.DANGEROUSLY_DISABLE_HOST_CHECK === 'true'
33
+ ? 'all'
36
34
  : 'auto',
37
35
  // Enable gzip compression of generated files.
38
36
  compress: true,
package/index.html CHANGED
@@ -3,7 +3,6 @@
3
3
  <head>
4
4
  <meta charset="utf-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
- <!--<link rel="stylesheet" href="index.css" /> -->
7
6
  <title>Payment Modals</title>
8
7
  </head>
9
8
  <body>
@@ -17,6 +16,7 @@
17
16
  <a href="#" id="achPaymentModal">Open "ACH Payment" modal</a>
18
17
  <a href="#" id="govOSPayACHPaymentModal">Open "GovOS Pay ACH Payment" modal</a>
19
18
  <a href="#" id="govOSPayCardPaymentModal">Open "GovOS Pay Card Payment" modal</a>
19
+ <a href="#" id="govOSPayCardPaymentModalNcourt">Open "GovOS Pay Card Payment" modal (ncourt/payments)</a>
20
20
  <a href="#" id="govOSPayInvoiceSummaryModal">Open "GovOS Pay Invoice Summary" modal</a>
21
21
  <a href="#" id="none">Close</a>
22
22
  </div>
@@ -260,6 +260,70 @@
260
260
  });
261
261
 
262
262
  triggers[9].addEventListener('click', function(event) {
263
+ window.handlePaymentModal.govOSPayCardPaymentModal({
264
+ amount: 2200,
265
+ paymentCorrelationId: String(Math.random()).slice(2),
266
+ paymentConfig: {
267
+ providerAccountCode: "54c574a2-5271-4c93-bd68-57e39930a52a",
268
+ mapping: {
269
+ platformApplicationCode: "FORMS",
270
+ platformTenantCode: "TESTFORCE",
271
+ providerName: "ncourt",
272
+ accountName: "Test studio 3",
273
+ configuration: {
274
+ accessCredentials: {
275
+ gatewayName: "ncourt",
276
+ merchantId: "t1_mer_65e617f34f1e57a4ee46560",
277
+ publicKey: "ae298630ef3e58ddd93079c908d5ff5e"
278
+ },
279
+ scriptUrl: "https://test-api.payrix.com/payFieldsScript"
280
+ }
281
+ },
282
+ merchantInformation: {
283
+ id: "t1_mer_65e617f34f1e57a4ee46560",
284
+ name: "Waxahachie City Test Merchant",
285
+ phone: "5555555555",
286
+ address: {
287
+ address1: "109 South Jackson Street",
288
+ address2: "",
289
+ city: "Waxahachie",
290
+ state: "TX",
291
+ zip: "75165",
292
+ phone: "5555555555"
293
+ }
294
+ }
295
+ },
296
+ transactionUrl: 'https://backend.dev.nonprod.seamlessdocs.com/payments/transactions/govOsPay/transaction.json',
297
+ getTransactionUrl: 'https://backend.dev.nonprod.seamlessdocs.com/payments/transactions/govOsPay/transactions/',
298
+ updateTransactionUrl: 'https://backend.dev.nonprod.seamlessdocs.com/payments/transactions/govOsPay/transactions/',
299
+ lineItems: [
300
+ {
301
+ title: "Document Fee",
302
+ description: "test",
303
+ quantity: 1,
304
+ unitPrice: 100,
305
+ },
306
+ {
307
+ title: "Fee Test Credit Card",
308
+ description: "test",
309
+ quantity: 1,
310
+ unitPrice: 2.0408163265306145,
311
+ },
312
+ ],
313
+ callbacks: {
314
+ onPay: function () {
315
+ setTimeout(function () {
316
+ console.log('Pay');
317
+ }, 400);
318
+ },
319
+ onClose: function() {
320
+ console.log('close');
321
+ }
322
+ }
323
+ });
324
+ });
325
+
326
+ triggers[10].addEventListener('click', function(event) {
263
327
  window.handlePaymentModal.govOSPayInvoiceSummaryModal({
264
328
  transactionData: [
265
329
  {
@@ -291,7 +355,7 @@
291
355
  });
292
356
  });
293
357
 
294
- triggers[10].addEventListener('click', function(event) {
358
+ triggers[11].addEventListener('click', function(event) {
295
359
  window.handlePaymentModal.none();
296
360
  });
297
361
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seamlessdocs/payment-modals",
3
- "version": "2.0.0-beta.8",
3
+ "version": "2.0.0",
4
4
  "description": "Payment modals for SeamlessDocs",
5
5
  "main": "build/payment-modals.js",
6
6
  "repository": {
@@ -30,31 +30,28 @@
30
30
  "eslint-config-prettier": "^9.1.0",
31
31
  "eslint-plugin-import": "^2.29.1",
32
32
  "eslint-plugin-jsx-a11y": "^6.8.0",
33
- "eslint-plugin-prettier": "^5.1.3",
33
+ "eslint-plugin-prettier": "^5.2.0",
34
34
  "eslint-plugin-react": "^7.33.2",
35
- "file-loader": "^3.0.1",
35
+ "eslint-plugin-react-hooks": "^4.6.0",
36
+ "file-loader": "^6.2.0",
36
37
  "html-loader": "^4.2.0",
37
38
  "html-webpack-plugin": "^5.6.0",
38
39
  "image-webpack-loader": "^6.0.0",
39
40
  "mini-css-extract-plugin": "^2.7.6",
40
- "prettier": "^1.17.0",
41
- "react": "^18.2.0",
42
- "react-dom": "^18.2.0",
41
+ "postcss": "^8.4.35",
42
+ "prettier": "^3.2.5",
43
43
  "sass": "^1.69.0",
44
44
  "sass-loader": "^13.3.0",
45
45
  "style-loader": "^3.3.3",
46
46
  "svg-inline-loader": "^0.8.0",
47
- "url-loader": "^1.1.2",
47
+ "url-loader": "^4.1.1",
48
48
  "webpack": "^5.89.0",
49
49
  "webpack-cli": "^5.1.4",
50
50
  "webpack-dev-server": "^5.0.0"
51
51
  },
52
- "peerDependencies": {
53
- "react": "^18.0.0",
54
- "react-dom": "^18.0.0"
55
- },
56
52
  "dependencies": {
57
53
  "@kofile/platform-react-payrix": "1.7.47",
54
+ "@tippyjs/react": "^4.2.6",
58
55
  "babel-plugin-import": "^1.11.0",
59
56
  "base64-image-loader": "^1.2.1",
60
57
  "classnames": "^2.2.6",
@@ -63,8 +60,9 @@
63
60
  "postcss-loader": "^7.3.4",
64
61
  "postcss-nested": "^4.1.2",
65
62
  "prop-types": "^15.7.2",
66
- "react-inlinesvg": "^1.1.7",
67
- "react-select": "^3.1.0",
68
- "react-tippy": "^1.4.0"
63
+ "react": "^18.2.0",
64
+ "react-dom": "^18.2.0",
65
+ "react-inlinesvg": "^4.2.0",
66
+ "react-select": "^5.8.0"
69
67
  }
70
68
  }
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import classNames from 'classnames';
3
3
  import PropTypes from 'prop-types';
4
- import { Tooltip } from 'react-tippy';
4
+ import Tippy from '@tippyjs/react';
5
5
 
6
6
  import { Field } from 'formik';
7
7
 
@@ -10,7 +10,7 @@ import validIcon from '../../../../assets/img/valid-icon.svg';
10
10
 
11
11
  import styles from './FieldContainer.module.css';
12
12
 
13
- import 'react-tippy/dist/tippy.css';
13
+ import 'tippy.js/dist/tippy.css';
14
14
 
15
15
  const FieldContainer = ({ name, label, children }) => {
16
16
  return (
@@ -24,9 +24,9 @@ const FieldContainer = ({ name, label, children }) => {
24
24
  <div className={styles.fieldHeader}>
25
25
  <div className={styles.fieldName}>{label}</div>
26
26
  {meta.touched && meta.error && (
27
- <Tooltip title={meta.error} arrow>
27
+ <Tippy content={meta.error} arrow>
28
28
  <img src={errorIcon} alt="error" />
29
- </Tooltip>
29
+ </Tippy>
30
30
  )}
31
31
  {meta.touched && !meta.error && (
32
32
  <img className={styles.validationIcon} src={validIcon} alt="valid" />
package/src/index.jsx CHANGED
@@ -1,3 +1,5 @@
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom/client';
1
3
  import ChooseModal from './Components/ChooseModal';
2
4
  import ProcessingModal from './Components/ProcessingModal';
3
5
  import ErrorModal from './Components/ErrorModal';
@@ -14,48 +16,32 @@ import { restoreNativeEventConstructor, loadJQuery } from './shims';
14
16
  import '../index.css';
15
17
  import './OpenViewStyles.css';
16
18
 
17
- // Store root instances to manage React 18 roots
18
19
  const rootInstances = new Map();
19
20
 
20
- // Helper function to get createRoot - works in both development and production
21
- // IMPORTANT: This function ONLY uses the global ReactDOM to avoid conflicts
22
- // In development, React must be exposed globally (webpack will bundle it)
23
- // In production, React is external and must be available globally
24
21
  const getCreateRoot = () => {
25
- // Access ReactDOM from global scope - this is the ONLY way we access React
26
- // This prevents multiple React instances and internal conflicts
27
- const ReactDOM = (typeof window !== 'undefined' && window.ReactDOM)
28
- || (typeof global !== 'undefined' && global.ReactDOM)
29
- || (typeof self !== 'undefined' && self.ReactDOM);
30
-
31
22
  if (ReactDOM && typeof ReactDOM.createRoot === 'function') {
32
23
  return ReactDOM.createRoot;
33
24
  }
34
-
25
+
35
26
  throw new Error(
36
- 'createRoot is not available. Make sure React 18 is loaded and ReactDOM is available globally. ' +
37
- 'ReactDOM should be accessible as window.ReactDOM. ' +
38
- 'In development, ensure React is loaded before this script. ' +
39
- 'In production, React must be external and available as window.ReactDOM.'
27
+ 'createRoot is not available. ReactDOM.createRoot should be available from the bundled react-dom/client.'
40
28
  );
41
29
  };
42
30
 
43
- // Helper function to render with React 18 createRoot
44
31
  const renderModal = (element, containerId) => {
45
32
  const containerElement = document.getElementById(containerId);
46
33
  if (!containerElement) {
47
34
  console.warn(`Container element with id "${containerId}" not found`);
48
35
  return;
49
36
  }
50
-
51
- // Get or create root instance
37
+
52
38
  let root = rootInstances.get(containerId);
53
39
  if (!root) {
54
40
  const createRoot = getCreateRoot();
55
41
  root = createRoot(containerElement);
56
42
  rootInstances.set(containerId, root);
57
43
  }
58
-
44
+
59
45
  root.render(element);
60
46
  };
61
47
 
package/webpack.config.js CHANGED
@@ -19,22 +19,7 @@ module.exports = (_env, argv) => {
19
19
  clean: true,
20
20
  globalObject: 'this'
21
21
  },
22
- // Solo aplicar externals en producción
23
- // En desarrollo, React debe estar incluido en el bundle
24
- externals: isProduction ? {
25
- 'react': {
26
- commonjs: 'react',
27
- commonjs2: 'react',
28
- amd: 'react',
29
- root: 'React'
30
- },
31
- 'react-dom': {
32
- commonjs: 'react-dom',
33
- commonjs2: 'react-dom',
34
- amd: 'react-dom',
35
- root: 'ReactDOM'
36
- }
37
- } : {},
22
+ externals: {},
38
23
  module: {
39
24
  rules: [
40
25
  {
@@ -95,23 +80,8 @@ module.exports = (_env, argv) => {
95
80
  template: path.join(__dirname, 'index.html'),
96
81
  inject: 'body',
97
82
  scriptLoading: 'blocking'
98
- }),
99
- // In development, expose ReactDOM globally at the start of the bundle
100
- !isProduction && new webpack.BannerPlugin({
101
- banner: `
102
- (function() {
103
- try {
104
- if (typeof window !== 'undefined' && typeof require !== 'undefined' && !window.ReactDOM) {
105
- var ReactDOM = require('react-dom');
106
- if (ReactDOM) window.ReactDOM = ReactDOM;
107
- }
108
- } catch(e) {}
109
- })();
110
- `.trim(),
111
- raw: true,
112
- entryOnly: true
113
83
  })
114
- ].filter(Boolean),
84
+ ],
115
85
  devServer: {
116
86
  port: 9000,
117
87
  compress: true,