@seamlessdocs/payment-modals 2.0.0-beta.2 → 2.0.0-beta.3
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/.babelrc +1 -1
- package/build/payment-modals.js +1 -1
- package/package.json +6 -7
- package/src/index.jsx +14 -4
- package/webpack.config.js +2 -14
- package/src/jsx-runtime-shim.js +0 -19
- package/src/react-with-polyfills.js +0 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seamlessdocs/payment-modals",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.3",
|
|
4
4
|
"description": "Payment modals for SeamlessDocs",
|
|
5
5
|
"main": "build/payment-modals.js",
|
|
6
6
|
"repository": {
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"image-webpack-loader": "^6.0.0",
|
|
39
39
|
"mini-css-extract-plugin": "^2.7.6",
|
|
40
40
|
"prettier": "^1.17.0",
|
|
41
|
-
"react": "^
|
|
42
|
-
"react-dom": "^
|
|
41
|
+
"react": "^18.2.0",
|
|
42
|
+
"react-dom": "^18.2.0",
|
|
43
43
|
"sass": "^1.69.0",
|
|
44
44
|
"sass-loader": "^13.3.0",
|
|
45
45
|
"style-loader": "^3.3.3",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"webpack-dev-server": "^5.0.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"react": "^
|
|
54
|
-
"react-dom": "^
|
|
53
|
+
"react": "^18.0.0",
|
|
54
|
+
"react-dom": "^18.0.0"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@kofile/platform-react-payrix": "1.7.47",
|
|
@@ -65,7 +65,6 @@
|
|
|
65
65
|
"prop-types": "^15.7.2",
|
|
66
66
|
"react-inlinesvg": "^1.1.7",
|
|
67
67
|
"react-select": "^3.1.0",
|
|
68
|
-
"react-tippy": "^1.4.0"
|
|
69
|
-
"use-sync-external-store": "^1.2.0"
|
|
68
|
+
"react-tippy": "^1.4.0"
|
|
70
69
|
}
|
|
71
70
|
}
|
package/src/index.jsx
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import ReactDOM from 'react-dom';
|
|
1
|
+
import { createRoot } from 'react-dom/client';
|
|
3
2
|
|
|
4
3
|
import ChooseModal from './Components/ChooseModal';
|
|
5
4
|
import ProcessingModal from './Components/ProcessingModal';
|
|
@@ -17,14 +16,25 @@ import { restoreNativeEventConstructor, loadJQuery } from './shims';
|
|
|
17
16
|
import '../index.css';
|
|
18
17
|
import './OpenViewStyles.css';
|
|
19
18
|
|
|
20
|
-
//
|
|
19
|
+
// Store root instances to manage React 18 roots
|
|
20
|
+
const rootInstances = new Map();
|
|
21
|
+
|
|
22
|
+
// Helper function to render with React 18 createRoot
|
|
21
23
|
const renderModal = (element, containerId) => {
|
|
22
24
|
const containerElement = document.getElementById(containerId);
|
|
23
25
|
if (!containerElement) {
|
|
24
26
|
console.warn(`Container element with id "${containerId}" not found`);
|
|
25
27
|
return;
|
|
26
28
|
}
|
|
27
|
-
|
|
29
|
+
|
|
30
|
+
// Get or create root instance
|
|
31
|
+
let root = rootInstances.get(containerId);
|
|
32
|
+
if (!root) {
|
|
33
|
+
root = createRoot(containerElement);
|
|
34
|
+
rootInstances.set(containerId, root);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
root.render(element);
|
|
28
38
|
};
|
|
29
39
|
|
|
30
40
|
const handlePaymentModal = {};
|
package/webpack.config.js
CHANGED
|
@@ -95,18 +95,7 @@ module.exports = (_env, argv) => {
|
|
|
95
95
|
template: path.join(__dirname, 'index.html'),
|
|
96
96
|
inject: 'body',
|
|
97
97
|
scriptLoading: 'blocking'
|
|
98
|
-
})
|
|
99
|
-
// Replace 'react' imports from @kofile/platform-react-payrix with our polyfilled version
|
|
100
|
-
new webpack.NormalModuleReplacementPlugin(
|
|
101
|
-
/^react$/,
|
|
102
|
-
function(resource) {
|
|
103
|
-
const context = resource.context || '';
|
|
104
|
-
// Only replace for @kofile/platform-react-payrix
|
|
105
|
-
if (context.includes('@kofile') && context.includes('platform-react-payrix')) {
|
|
106
|
-
resource.request = path.resolve(__dirname, 'src/react-with-polyfills.js');
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
)
|
|
98
|
+
})
|
|
110
99
|
],
|
|
111
100
|
devServer: {
|
|
112
101
|
port: 9000,
|
|
@@ -126,8 +115,7 @@ module.exports = (_env, argv) => {
|
|
|
126
115
|
modules: [path.join(__dirname, 'src'), path.join(__dirname), 'node_modules'],
|
|
127
116
|
extensions: ['.js', '.jsx', '.scss', '.css'],
|
|
128
117
|
alias: {
|
|
129
|
-
'react-virtualized/List': 'react-virtualized/dist/es/List'
|
|
130
|
-
'react/jsx-runtime': path.resolve(__dirname, 'src/jsx-runtime-shim.js')
|
|
118
|
+
'react-virtualized/List': 'react-virtualized/dist/es/List'
|
|
131
119
|
}
|
|
132
120
|
}
|
|
133
121
|
};
|
package/src/jsx-runtime-shim.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// Shim for react/jsx-runtime to support React 16
|
|
2
|
-
// This provides the jsx and jsxs functions that React 17+ uses
|
|
3
|
-
// but implemented using React.createElement for React 16 compatibility
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
// jsx function for single children
|
|
8
|
-
export function jsx(type, props, key) {
|
|
9
|
-
return React.createElement(type, { ...props, key });
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// jsxs function for multiple children
|
|
13
|
-
export function jsxs(type, props, key) {
|
|
14
|
-
return React.createElement(type, { ...props, key });
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// Fragment support
|
|
18
|
-
export const Fragment = React.Fragment;
|
|
19
|
-
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// React wrapper that includes polyfills for React 16 compatibility
|
|
2
|
-
// This exports everything from React plus useSyncExternalStore polyfill
|
|
3
|
-
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import { useSyncExternalStore } from 'use-sync-external-store/shim';
|
|
6
|
-
|
|
7
|
-
// Re-export everything from React
|
|
8
|
-
export * from 'react';
|
|
9
|
-
|
|
10
|
-
// Add useSyncExternalStore to the default export
|
|
11
|
-
export default {
|
|
12
|
-
...React,
|
|
13
|
-
useSyncExternalStore
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
// Also export useSyncExternalStore as a named export
|
|
17
|
-
export { useSyncExternalStore };
|
|
18
|
-
|