@seamlessdocs/payment-modals 2.0.0-beta.9 → 2.0.1-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.
@@ -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.9",
3
+ "version": "2.0.1-beta.0",
4
4
  "description": "Payment modals for SeamlessDocs",
5
5
  "main": "build/payment-modals.js",
6
6
  "repository": {
@@ -40,8 +40,6 @@
40
40
  "mini-css-extract-plugin": "^2.7.6",
41
41
  "postcss": "^8.4.35",
42
42
  "prettier": "^3.2.5",
43
- "react": "^18.2.0",
44
- "react-dom": "^18.2.0",
45
43
  "sass": "^1.69.0",
46
44
  "sass-loader": "^13.3.0",
47
45
  "style-loader": "^3.3.3",
@@ -51,12 +49,8 @@
51
49
  "webpack-cli": "^5.1.4",
52
50
  "webpack-dev-server": "^5.0.0"
53
51
  },
54
- "peerDependencies": {
55
- "react": "^18.0.0",
56
- "react-dom": "^18.0.0"
57
- },
58
52
  "dependencies": {
59
- "@kofile/platform-react-payrix": "1.7.47",
53
+ "@kofile/platform-react-payrix": "1.8.10",
60
54
  "@tippyjs/react": "^4.2.6",
61
55
  "babel-plugin-import": "^1.11.0",
62
56
  "base64-image-loader": "^1.2.1",
@@ -66,6 +60,8 @@
66
60
  "postcss-loader": "^7.3.4",
67
61
  "postcss-nested": "^4.1.2",
68
62
  "prop-types": "^15.7.2",
63
+ "react": "^18.2.0",
64
+ "react-dom": "^18.2.0",
69
65
  "react-inlinesvg": "^4.2.0",
70
66
  "react-select": "^5.8.0"
71
67
  }
package/src/index.jsx CHANGED
@@ -16,61 +16,32 @@ import { restoreNativeEventConstructor, loadJQuery } from './shims';
16
16
  import '../index.css';
17
17
  import './OpenViewStyles.css';
18
18
 
19
- // Expose React and ReactDOM globally for compatibility
20
- // In development, these are bundled and need to be exposed
21
- // In production, these should already be available externally
22
- if (typeof window !== 'undefined') {
23
- if (!window.React) {
24
- window.React = React;
25
- }
26
- if (!window.ReactDOM) {
27
- window.ReactDOM = ReactDOM;
28
- }
29
- }
30
-
31
- // Store root instances to manage React 18 roots
32
19
  const rootInstances = new Map();
33
20
 
34
- // Helper function to get createRoot - works in both development and production
35
- // In development, ReactDOM is imported and exposed globally
36
- // In production, ReactDOM is external and should be available globally
37
21
  const getCreateRoot = () => {
38
- // First try to use the imported ReactDOM (development)
39
22
  if (ReactDOM && typeof ReactDOM.createRoot === 'function') {
40
23
  return ReactDOM.createRoot;
41
24
  }
42
-
43
- // Fallback to global ReactDOM (production or if imported version not available)
44
- const globalReactDOM = (typeof window !== 'undefined' && window.ReactDOM)
45
- || (typeof global !== 'undefined' && global.ReactDOM)
46
- || (typeof self !== 'undefined' && self.ReactDOM);
47
-
48
- if (globalReactDOM && typeof globalReactDOM.createRoot === 'function') {
49
- return globalReactDOM.createRoot;
50
- }
51
-
25
+
52
26
  throw new Error(
53
- 'createRoot is not available. Make sure React 18 is loaded and ReactDOM is available. ' +
54
- 'ReactDOM should be accessible as window.ReactDOM or imported from react-dom/client.'
27
+ 'createRoot is not available. ReactDOM.createRoot should be available from the bundled react-dom/client.'
55
28
  );
56
29
  };
57
30
 
58
- // Helper function to render with React 18 createRoot
59
31
  const renderModal = (element, containerId) => {
60
32
  const containerElement = document.getElementById(containerId);
61
33
  if (!containerElement) {
62
34
  console.warn(`Container element with id "${containerId}" not found`);
63
35
  return;
64
36
  }
65
-
66
- // Get or create root instance
37
+
67
38
  let root = rootInstances.get(containerId);
68
39
  if (!root) {
69
40
  const createRoot = getCreateRoot();
70
41
  root = createRoot(containerElement);
71
42
  rootInstances.set(containerId, root);
72
43
  }
73
-
44
+
74
45
  root.render(element);
75
46
  };
76
47
 
package/webpack.config.js CHANGED
@@ -19,29 +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 ? function({ context, request }, callback) {
25
- // Handle react and react-dom as externals
26
- if (/^react$/.test(request)) {
27
- return callback(null, {
28
- commonjs: 'react',
29
- commonjs2: 'react',
30
- amd: 'react',
31
- root: 'React'
32
- });
33
- }
34
- if (/^react-dom$/.test(request) || /^react-dom\/client$/.test(request)) {
35
- return callback(null, {
36
- commonjs: 'react-dom',
37
- commonjs2: 'react-dom',
38
- amd: 'react-dom',
39
- root: 'ReactDOM'
40
- });
41
- }
42
- // Don't externalize anything else
43
- callback();
44
- } : {},
22
+ externals: {},
45
23
  module: {
46
24
  rules: [
47
25
  {