@seamlessdocs/payment-modals 2.0.0-beta.8 → 2.0.0-beta.9

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": "@seamlessdocs/payment-modals",
3
- "version": "2.0.0-beta.8",
3
+ "version": "2.0.0-beta.9",
4
4
  "description": "Payment modals for SeamlessDocs",
5
5
  "main": "build/payment-modals.js",
6
6
  "repository": {
@@ -30,21 +30,23 @@
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
+ "postcss": "^8.4.35",
42
+ "prettier": "^3.2.5",
41
43
  "react": "^18.2.0",
42
44
  "react-dom": "^18.2.0",
43
45
  "sass": "^1.69.0",
44
46
  "sass-loader": "^13.3.0",
45
47
  "style-loader": "^3.3.3",
46
48
  "svg-inline-loader": "^0.8.0",
47
- "url-loader": "^1.1.2",
49
+ "url-loader": "^4.1.1",
48
50
  "webpack": "^5.89.0",
49
51
  "webpack-cli": "^5.1.4",
50
52
  "webpack-dev-server": "^5.0.0"
@@ -55,6 +57,7 @@
55
57
  },
56
58
  "dependencies": {
57
59
  "@kofile/platform-react-payrix": "1.7.47",
60
+ "@tippyjs/react": "^4.2.6",
58
61
  "babel-plugin-import": "^1.11.0",
59
62
  "base64-image-loader": "^1.2.1",
60
63
  "classnames": "^2.2.6",
@@ -63,8 +66,7 @@
63
66
  "postcss-loader": "^7.3.4",
64
67
  "postcss-nested": "^4.1.2",
65
68
  "prop-types": "^15.7.2",
66
- "react-inlinesvg": "^1.1.7",
67
- "react-select": "^3.1.0",
68
- "react-tippy": "^1.4.0"
69
+ "react-inlinesvg": "^4.2.0",
70
+ "react-select": "^5.8.0"
69
71
  }
70
72
  }
@@ -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,29 +16,42 @@ import { restoreNativeEventConstructor, loadJQuery } from './shims';
14
16
  import '../index.css';
15
17
  import './OpenViewStyles.css';
16
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
+
17
31
  // Store root instances to manage React 18 roots
18
32
  const rootInstances = new Map();
19
33
 
20
34
  // 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
35
+ // In development, ReactDOM is imported and exposed globally
36
+ // In production, ReactDOM is external and should be available globally
24
37
  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)
38
+ // First try to use the imported ReactDOM (development)
39
+ if (ReactDOM && typeof ReactDOM.createRoot === 'function') {
40
+ return ReactDOM.createRoot;
41
+ }
42
+
43
+ // Fallback to global ReactDOM (production or if imported version not available)
44
+ const globalReactDOM = (typeof window !== 'undefined' && window.ReactDOM)
28
45
  || (typeof global !== 'undefined' && global.ReactDOM)
29
46
  || (typeof self !== 'undefined' && self.ReactDOM);
30
47
 
31
- if (ReactDOM && typeof ReactDOM.createRoot === 'function') {
32
- return ReactDOM.createRoot;
48
+ if (globalReactDOM && typeof globalReactDOM.createRoot === 'function') {
49
+ return globalReactDOM.createRoot;
33
50
  }
34
51
 
35
52
  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.'
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.'
40
55
  );
41
56
  };
42
57
 
package/webpack.config.js CHANGED
@@ -21,19 +21,26 @@ module.exports = (_env, argv) => {
21
21
  },
22
22
  // Solo aplicar externals en producción
23
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'
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
+ });
36
41
  }
42
+ // Don't externalize anything else
43
+ callback();
37
44
  } : {},
38
45
  module: {
39
46
  rules: [
@@ -95,23 +102,8 @@ module.exports = (_env, argv) => {
95
102
  template: path.join(__dirname, 'index.html'),
96
103
  inject: 'body',
97
104
  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
105
  })
114
- ].filter(Boolean),
106
+ ],
115
107
  devServer: {
116
108
  port: 9000,
117
109
  compress: true,