@seamlessdocs/payment-modals 1.0.65 → 2.0.0-beta.2
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 +6 -2
- package/.eslintrc.json +9 -1
- package/.nvmrc +1 -1
- package/build/payment-modals.js +2 -78
- package/config/webpack.config.js +16 -26
- package/config/webpackDevServer.config.js +26 -11
- package/index.html +1 -2
- package/package.json +42 -33
- package/seamlessdocs-payment-modals-v2.0.0-beta.1.tgz +0 -0
- package/src/index.jsx +29 -18
- package/src/jsx-runtime-shim.js +19 -0
- package/src/react-with-polyfills.js +18 -0
- package/webpack.config.js +67 -14
package/config/webpack.config.js
CHANGED
|
@@ -11,7 +11,7 @@ const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
|
|
|
11
11
|
const InlineChunkHtmlPlugin = require('react-dev-utils/InlineChunkHtmlPlugin');
|
|
12
12
|
const TerserPlugin = require('terser-webpack-plugin');
|
|
13
13
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
14
|
-
const
|
|
14
|
+
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
|
15
15
|
const safePostCssParser = require('postcss-safe-parser');
|
|
16
16
|
const ManifestPlugin = require('webpack-manifest-plugin');
|
|
17
17
|
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
|
|
@@ -242,19 +242,9 @@ module.exports = function(webpackEnv) {
|
|
|
242
242
|
sourceMap: shouldUseSourceMap,
|
|
243
243
|
}),
|
|
244
244
|
// This is only used in production mode
|
|
245
|
-
new
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
map: shouldUseSourceMap
|
|
249
|
-
? {
|
|
250
|
-
// `inline: false` forces the sourcemap to be output into a
|
|
251
|
-
// separate file
|
|
252
|
-
inline: false,
|
|
253
|
-
// `annotation: true` appends the sourceMappingURL to the end of
|
|
254
|
-
// the css file, helping the browser find the sourcemap
|
|
255
|
-
annotation: true,
|
|
256
|
-
}
|
|
257
|
-
: false,
|
|
245
|
+
new CssMinimizerPlugin({
|
|
246
|
+
minimizerOptions: {
|
|
247
|
+
preset: ['default'],
|
|
258
248
|
},
|
|
259
249
|
}),
|
|
260
250
|
],
|
|
@@ -305,6 +295,18 @@ module.exports = function(webpackEnv) {
|
|
|
305
295
|
// Make sure your source files are compiled, as they will not be processed in any way.
|
|
306
296
|
new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson]),
|
|
307
297
|
],
|
|
298
|
+
// Some libraries import Node modules but don't use them in the browser.
|
|
299
|
+
// Tell Webpack to provide empty mocks for them so importing them works.
|
|
300
|
+
fallback: {
|
|
301
|
+
module: false,
|
|
302
|
+
dgram: false,
|
|
303
|
+
dns: false,
|
|
304
|
+
fs: false,
|
|
305
|
+
http2: false,
|
|
306
|
+
net: false,
|
|
307
|
+
tls: false,
|
|
308
|
+
child_process: false,
|
|
309
|
+
},
|
|
308
310
|
},
|
|
309
311
|
resolveLoader: {
|
|
310
312
|
plugins: [
|
|
@@ -637,18 +639,6 @@ module.exports = function(webpackEnv) {
|
|
|
637
639
|
formatter: isEnvProduction ? typescriptFormatter : undefined,
|
|
638
640
|
}),
|
|
639
641
|
].filter(Boolean),
|
|
640
|
-
// Some libraries import Node modules but don't use them in the browser.
|
|
641
|
-
// Tell Webpack to provide empty mocks for them so importing them works.
|
|
642
|
-
node: {
|
|
643
|
-
module: 'empty',
|
|
644
|
-
dgram: 'empty',
|
|
645
|
-
dns: 'mock',
|
|
646
|
-
fs: 'empty',
|
|
647
|
-
http2: 'empty',
|
|
648
|
-
net: 'empty',
|
|
649
|
-
tls: 'empty',
|
|
650
|
-
child_process: 'empty',
|
|
651
|
-
},
|
|
652
642
|
// Turn off performance processing because we utilize
|
|
653
643
|
// our own hints via the FileSizeReporter
|
|
654
644
|
performance: false,
|
|
@@ -28,16 +28,25 @@ 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
|
-
|
|
32
|
-
|
|
31
|
+
// WebpackDevServer 2.4.3 introduced a security fix that prevents remote
|
|
32
|
+
// websites from potentially accessing local content through DNS rebinding.
|
|
33
|
+
// For Webpack 5, we use allowedHosts instead of disableHostCheck
|
|
34
|
+
allowedHosts: proxy || process.env.DANGEROUSLY_DISABLE_HOST_CHECK === 'true'
|
|
35
|
+
? 'all'
|
|
36
|
+
: 'auto',
|
|
33
37
|
// Enable gzip compression of generated files.
|
|
34
38
|
compress: true,
|
|
35
39
|
// Silence WebpackDevServer's own logs since they're generally not useful.
|
|
36
40
|
// It will still show compile warnings and errors with this setting.
|
|
37
|
-
|
|
41
|
+
client: {
|
|
42
|
+
logging: 'none',
|
|
43
|
+
webSocketURL: allowedHost ? {
|
|
44
|
+
hostname: allowedHost,
|
|
45
|
+
} : undefined,
|
|
46
|
+
},
|
|
38
47
|
// By default WebpackDevServer serves physical files from current directory
|
|
39
48
|
// in addition to all the virtual build products that it serves from memory.
|
|
40
|
-
// This is confusing because those files won
|
|
49
|
+
// This is confusing because those files won't automatically be available in
|
|
41
50
|
// production build folder unless we copy them. However, copying the whole
|
|
42
51
|
// project directory is dangerous because we may expose sensitive files.
|
|
43
52
|
// Instead, we establish a convention that only files in `public` directory
|
|
@@ -49,21 +58,23 @@ module.exports = function(proxy, allowedHost) {
|
|
|
49
58
|
// for files like `favicon.ico`, `manifest.json`, and libraries that are
|
|
50
59
|
// for some reason broken when imported through Webpack. If you just want to
|
|
51
60
|
// use an image, put it in `src` and `import` it from JavaScript instead.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
61
|
+
static: {
|
|
62
|
+
directory: paths.appPublic,
|
|
63
|
+
watch: true,
|
|
64
|
+
},
|
|
55
65
|
// Enable hot reloading server. It will provide /sockjs-node/ endpoint
|
|
56
66
|
// for the WebpackDevServer client so it can learn when the files were
|
|
57
67
|
// updated. The WebpackDevServer client is included as an entry point
|
|
58
68
|
// in the Webpack development configuration. Note that only changes
|
|
59
69
|
// to CSS are currently hot reloaded. JS changes will refresh the browser.
|
|
60
70
|
hot: true,
|
|
71
|
+
liveReload: false,
|
|
61
72
|
// It is important to tell WebpackDevServer to use the same "root" path
|
|
62
73
|
// as we specified in the config. In development, we always serve from /.
|
|
63
74
|
publicPath: '/',
|
|
64
75
|
// WebpackDevServer is noisy by default so we emit custom message instead
|
|
65
76
|
// by listening to the compiler events with `compiler.hooks[...].tap` calls above.
|
|
66
|
-
|
|
77
|
+
// Note: 'quiet' option is deprecated in Webpack 5, use client.logging instead
|
|
67
78
|
// Reportedly, this avoids CPU overload on some systems.
|
|
68
79
|
// https://github.com/facebook/create-react-app/issues/293
|
|
69
80
|
// src/node_modules is not ignored to support absolute imports
|
|
@@ -80,16 +91,19 @@ module.exports = function(proxy, allowedHost) {
|
|
|
80
91
|
// See https://github.com/facebook/create-react-app/issues/387.
|
|
81
92
|
disableDotRule: true,
|
|
82
93
|
},
|
|
83
|
-
public: allowedHost,
|
|
84
94
|
proxy,
|
|
85
|
-
|
|
95
|
+
setupMiddlewares: (middlewares, devServer) => {
|
|
96
|
+
if (!devServer) {
|
|
97
|
+
throw new Error('webpack-dev-server is not defined');
|
|
98
|
+
}
|
|
99
|
+
const app = devServer.app;
|
|
86
100
|
if (fs.existsSync(paths.proxySetup)) {
|
|
87
101
|
// This registers user provided middleware for proxy reasons
|
|
88
102
|
require(paths.proxySetup)(app);
|
|
89
103
|
}
|
|
90
104
|
|
|
91
105
|
// This lets us fetch source contents from webpack for the error overlay
|
|
92
|
-
app.use(evalSourceMapMiddleware(
|
|
106
|
+
app.use(evalSourceMapMiddleware(devServer));
|
|
93
107
|
// This lets us open files from the runtime error overlay.
|
|
94
108
|
app.use(errorOverlayMiddleware());
|
|
95
109
|
|
|
@@ -99,6 +113,7 @@ module.exports = function(proxy, allowedHost) {
|
|
|
99
113
|
// it used the same host and port.
|
|
100
114
|
// https://github.com/facebook/create-react-app/issues/2272#issuecomment-302832432
|
|
101
115
|
app.use(noopServiceWorkerMiddleware());
|
|
116
|
+
return middlewares;
|
|
102
117
|
},
|
|
103
118
|
};
|
|
104
119
|
};
|
package/index.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
-
|
|
6
|
+
<!--<link rel="stylesheet" href="index.css" /> -->
|
|
7
7
|
<title>Payment Modals</title>
|
|
8
8
|
</head>
|
|
9
9
|
<body>
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
</div>
|
|
23
23
|
<div id="payment-modal"></div>
|
|
24
24
|
<script src="https://core.spreedly.com/iframe/express-2.min.js"></script>
|
|
25
|
-
<script src="./build/payment-modals.js"></script>
|
|
26
25
|
<script>
|
|
27
26
|
var triggers = document.querySelectorAll('.links a');
|
|
28
27
|
var callbacks = {
|
package/package.json
CHANGED
|
@@ -1,62 +1,71 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seamlessdocs/payment-modals",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta.2",
|
|
4
4
|
"description": "Payment modals for SeamlessDocs",
|
|
5
5
|
"main": "build/payment-modals.js",
|
|
6
6
|
"repository": {
|
|
7
7
|
"url": "https://github.com/SeamlessDocsDev/PaymentModals"
|
|
8
8
|
},
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": ">=22.0.0"
|
|
11
|
+
},
|
|
9
12
|
"scripts": {
|
|
10
13
|
"start": "webpack-dev-server --mode development",
|
|
11
|
-
"dev": "webpack --mode development
|
|
12
|
-
"build": "webpack --mode production
|
|
14
|
+
"dev": "webpack --mode development",
|
|
15
|
+
"build": "webpack --mode production"
|
|
13
16
|
},
|
|
14
17
|
"devDependencies": {
|
|
15
|
-
"@babel/core": "^7.
|
|
16
|
-
"@babel/
|
|
17
|
-
"@babel/plugin-
|
|
18
|
-
"@babel/
|
|
19
|
-
"@babel/preset-
|
|
20
|
-
"@babel/
|
|
21
|
-
"babel
|
|
22
|
-
"babel-loader": "^
|
|
23
|
-
"
|
|
24
|
-
"css-
|
|
25
|
-
"eslint": "^
|
|
26
|
-
"eslint-config-airbnb": "^
|
|
27
|
-
"eslint-config-prettier": "^
|
|
28
|
-
"eslint-plugin-import": "^2.
|
|
29
|
-
"eslint-plugin-jsx-a11y": "^6.
|
|
30
|
-
"eslint-plugin-prettier": "^
|
|
31
|
-
"eslint-plugin-react": "^7.
|
|
32
|
-
"extract-text-webpack-plugin": "^3.0.2",
|
|
18
|
+
"@babel/core": "^7.23.7",
|
|
19
|
+
"@babel/eslint-parser": "^7.23.3",
|
|
20
|
+
"@babel/plugin-syntax-class-properties": "^7.12.13",
|
|
21
|
+
"@babel/plugin-transform-runtime": "^7.23.7",
|
|
22
|
+
"@babel/preset-env": "^7.23.7",
|
|
23
|
+
"@babel/preset-react": "^7.23.3",
|
|
24
|
+
"@babel/runtime": "^7.23.7",
|
|
25
|
+
"babel-loader": "^9.1.3",
|
|
26
|
+
"css-loader": "^6.8.1",
|
|
27
|
+
"css-minimizer-webpack-plugin": "^5.0.1",
|
|
28
|
+
"eslint": "^8.56.0",
|
|
29
|
+
"eslint-config-airbnb": "^19.0.4",
|
|
30
|
+
"eslint-config-prettier": "^9.1.0",
|
|
31
|
+
"eslint-plugin-import": "^2.29.1",
|
|
32
|
+
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
33
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
34
|
+
"eslint-plugin-react": "^7.33.2",
|
|
33
35
|
"file-loader": "^3.0.1",
|
|
36
|
+
"html-loader": "^4.2.0",
|
|
37
|
+
"html-webpack-plugin": "^5.6.0",
|
|
34
38
|
"image-webpack-loader": "^6.0.0",
|
|
35
|
-
"mini-css-extract-plugin": "^
|
|
36
|
-
"node-sass": "^4.11.0",
|
|
39
|
+
"mini-css-extract-plugin": "^2.7.6",
|
|
37
40
|
"prettier": "^1.17.0",
|
|
38
|
-
"
|
|
39
|
-
"
|
|
41
|
+
"react": "^16.14.0",
|
|
42
|
+
"react-dom": "^16.14.0",
|
|
43
|
+
"sass": "^1.69.0",
|
|
44
|
+
"sass-loader": "^13.3.0",
|
|
45
|
+
"style-loader": "^3.3.3",
|
|
40
46
|
"svg-inline-loader": "^0.8.0",
|
|
41
47
|
"url-loader": "^1.1.2",
|
|
42
|
-
"webpack": "^
|
|
43
|
-
"webpack-cli": "^
|
|
44
|
-
"webpack-dev-server": "^
|
|
48
|
+
"webpack": "^5.89.0",
|
|
49
|
+
"webpack-cli": "^5.1.4",
|
|
50
|
+
"webpack-dev-server": "^5.0.0"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"react": "^16.8.0",
|
|
54
|
+
"react-dom": "^16.8.0"
|
|
45
55
|
},
|
|
46
56
|
"dependencies": {
|
|
47
|
-
"@kofile/platform-react-payrix": "1.
|
|
57
|
+
"@kofile/platform-react-payrix": "1.7.47",
|
|
48
58
|
"babel-plugin-import": "^1.11.0",
|
|
49
59
|
"base64-image-loader": "^1.2.1",
|
|
50
60
|
"classnames": "^2.2.6",
|
|
51
61
|
"download": "^7.1.0",
|
|
52
62
|
"formik": "^2.1.5",
|
|
53
|
-
"postcss-loader": "^3.
|
|
63
|
+
"postcss-loader": "^7.3.4",
|
|
54
64
|
"postcss-nested": "^4.1.2",
|
|
55
65
|
"prop-types": "^15.7.2",
|
|
56
|
-
"react": "^16.10.1",
|
|
57
|
-
"react-dom": "^16.10.1",
|
|
58
66
|
"react-inlinesvg": "^1.1.7",
|
|
59
67
|
"react-select": "^3.1.0",
|
|
60
|
-
"react-tippy": "^1.4.0"
|
|
68
|
+
"react-tippy": "^1.4.0",
|
|
69
|
+
"use-sync-external-store": "^1.2.0"
|
|
61
70
|
}
|
|
62
71
|
}
|
|
Binary file
|
package/src/index.jsx
CHANGED
|
@@ -14,12 +14,23 @@ import GovOSPayInvoiceSummaryModal from './Components/GovOSPayInvoiceSummaryModa
|
|
|
14
14
|
|
|
15
15
|
import { restoreNativeEventConstructor, loadJQuery } from './shims';
|
|
16
16
|
|
|
17
|
+
import '../index.css';
|
|
17
18
|
import './OpenViewStyles.css';
|
|
18
19
|
|
|
20
|
+
// Helper function to render with React 16 ReactDOM.render
|
|
21
|
+
const renderModal = (element, containerId) => {
|
|
22
|
+
const containerElement = document.getElementById(containerId);
|
|
23
|
+
if (!containerElement) {
|
|
24
|
+
console.warn(`Container element with id "${containerId}" not found`);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
ReactDOM.render(element, containerElement);
|
|
28
|
+
};
|
|
29
|
+
|
|
19
30
|
const handlePaymentModal = {};
|
|
20
31
|
|
|
21
32
|
handlePaymentModal.chooseModal = settings => {
|
|
22
|
-
|
|
33
|
+
renderModal(
|
|
23
34
|
<ChooseModal
|
|
24
35
|
title={settings.title}
|
|
25
36
|
description={settings.description}
|
|
@@ -28,16 +39,16 @@ handlePaymentModal.chooseModal = settings => {
|
|
|
28
39
|
onWithPay={settings.callbacks.withPay}
|
|
29
40
|
onClose={settings.callbacks.close}
|
|
30
41
|
/>,
|
|
31
|
-
|
|
42
|
+
'payment-modal'
|
|
32
43
|
);
|
|
33
44
|
};
|
|
34
45
|
|
|
35
46
|
handlePaymentModal.processingModal = () => {
|
|
36
|
-
|
|
47
|
+
renderModal(<ProcessingModal />, 'payment-modal');
|
|
37
48
|
};
|
|
38
49
|
|
|
39
50
|
handlePaymentModal.errorModal = settings => {
|
|
40
|
-
|
|
51
|
+
renderModal(
|
|
41
52
|
<ErrorModal
|
|
42
53
|
isOptional={settings.isOptional}
|
|
43
54
|
errorText={settings.errorText}
|
|
@@ -45,19 +56,19 @@ handlePaymentModal.errorModal = settings => {
|
|
|
45
56
|
onRetry={settings.callbacks.retry}
|
|
46
57
|
onClose={settings.callbacks.close}
|
|
47
58
|
/>,
|
|
48
|
-
|
|
59
|
+
'payment-modal'
|
|
49
60
|
);
|
|
50
61
|
};
|
|
51
62
|
|
|
52
63
|
handlePaymentModal.successModal = settings => {
|
|
53
|
-
|
|
64
|
+
renderModal(
|
|
54
65
|
<SuccessModal description={settings.description} />,
|
|
55
|
-
|
|
66
|
+
'payment-modal'
|
|
56
67
|
);
|
|
57
68
|
};
|
|
58
69
|
|
|
59
70
|
handlePaymentModal.selectPaymentModal = settings => {
|
|
60
|
-
|
|
71
|
+
renderModal(
|
|
61
72
|
<SelectPaymentModal
|
|
62
73
|
isPaymentRequired={settings.isPaymentRequired}
|
|
63
74
|
onPayByBank={settings.callbacks.onPayByBank}
|
|
@@ -71,12 +82,12 @@ handlePaymentModal.selectPaymentModal = settings => {
|
|
|
71
82
|
isCreditCardFeeEnable={settings.isCreditCardFeeEnable}
|
|
72
83
|
isBankAccountFeeEnable={settings.isBankAccountFeeEnable}
|
|
73
84
|
/>,
|
|
74
|
-
|
|
85
|
+
'payment-modal'
|
|
75
86
|
);
|
|
76
87
|
};
|
|
77
88
|
|
|
78
89
|
handlePaymentModal.achPaymentModal = settings => {
|
|
79
|
-
|
|
90
|
+
renderModal(
|
|
80
91
|
<ACHPaymentModal
|
|
81
92
|
onPay={settings.callbacks.onPay}
|
|
82
93
|
onClose={settings.callbacks.onClose}
|
|
@@ -86,14 +97,14 @@ handlePaymentModal.achPaymentModal = settings => {
|
|
|
86
97
|
description={settings.description}
|
|
87
98
|
feeName={settings.feeName}
|
|
88
99
|
/>,
|
|
89
|
-
|
|
100
|
+
'payment-modal'
|
|
90
101
|
);
|
|
91
102
|
};
|
|
92
103
|
|
|
93
104
|
// TODO: Remove use of shims when mootools is removed
|
|
94
105
|
handlePaymentModal.govOSPayACHPaymentModal = settings => {
|
|
95
106
|
restoreNativeEventConstructor();
|
|
96
|
-
|
|
107
|
+
renderModal(
|
|
97
108
|
<GovOSPayACHPaymentModal
|
|
98
109
|
onPay={settings.callbacks.onPay}
|
|
99
110
|
onClose={settings.callbacks.onClose}
|
|
@@ -105,7 +116,7 @@ handlePaymentModal.govOSPayACHPaymentModal = settings => {
|
|
|
105
116
|
updateTransactionUrl={settings.updateTransactionUrl}
|
|
106
117
|
lineItems={settings.lineItems}
|
|
107
118
|
/>,
|
|
108
|
-
|
|
119
|
+
'payment-modal'
|
|
109
120
|
);
|
|
110
121
|
}
|
|
111
122
|
|
|
@@ -113,7 +124,7 @@ handlePaymentModal.govOSPayACHPaymentModal = settings => {
|
|
|
113
124
|
handlePaymentModal.govOSPayCardPaymentModal = settings => {
|
|
114
125
|
restoreNativeEventConstructor();
|
|
115
126
|
loadJQuery(() => {
|
|
116
|
-
|
|
127
|
+
renderModal(
|
|
117
128
|
<GovOSPayCardPaymentModal
|
|
118
129
|
onPay={settings.callbacks.onPay}
|
|
119
130
|
onClose={settings.callbacks.onClose}
|
|
@@ -126,7 +137,7 @@ handlePaymentModal.govOSPayCardPaymentModal = settings => {
|
|
|
126
137
|
updateTransactionUrl={settings.updateTransactionUrl}
|
|
127
138
|
lineItems={settings.lineItems}
|
|
128
139
|
/>,
|
|
129
|
-
|
|
140
|
+
'payment-modal'
|
|
130
141
|
);
|
|
131
142
|
});
|
|
132
143
|
}
|
|
@@ -134,18 +145,18 @@ handlePaymentModal.govOSPayCardPaymentModal = settings => {
|
|
|
134
145
|
// TODO: Remove use of shims when mootools is removed
|
|
135
146
|
handlePaymentModal.govOSPayInvoiceSummaryModal = settings => {
|
|
136
147
|
restoreNativeEventConstructor();
|
|
137
|
-
|
|
148
|
+
renderModal(
|
|
138
149
|
<GovOSPayInvoiceSummaryModal
|
|
139
150
|
onSubmit={settings.callbacks.onSubmit}
|
|
140
151
|
onClose={settings.callbacks.onClose}
|
|
141
152
|
transactionData={settings.transactionData}
|
|
142
153
|
/>,
|
|
143
|
-
|
|
154
|
+
'payment-modal'
|
|
144
155
|
);
|
|
145
156
|
}
|
|
146
157
|
|
|
147
158
|
handlePaymentModal.none = () => {
|
|
148
|
-
|
|
159
|
+
renderModal(<EmptyModal />, 'payment-modal');
|
|
149
160
|
};
|
|
150
161
|
|
|
151
162
|
window.handlePaymentModal = handlePaymentModal;
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
|
package/webpack.config.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
|
+
const webpack = require('webpack');
|
|
3
|
+
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
2
4
|
|
|
3
5
|
module.exports = (_env, argv) => {
|
|
4
6
|
const isProduction = argv.mode === 'production';
|
|
@@ -8,11 +10,31 @@ module.exports = (_env, argv) => {
|
|
|
8
10
|
},
|
|
9
11
|
output: {
|
|
10
12
|
filename: 'payment-modals.js',
|
|
11
|
-
path: '
|
|
12
|
-
library:
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
path: path.resolve(__dirname, 'build'),
|
|
14
|
+
library: {
|
|
15
|
+
name: 'payment-modals',
|
|
16
|
+
type: 'umd'
|
|
17
|
+
},
|
|
18
|
+
umdNamedDefine: true,
|
|
19
|
+
clean: true,
|
|
20
|
+
globalObject: 'this'
|
|
15
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
|
+
} : {},
|
|
16
38
|
module: {
|
|
17
39
|
rules: [
|
|
18
40
|
{
|
|
@@ -23,18 +45,20 @@ module.exports = (_env, argv) => {
|
|
|
23
45
|
}
|
|
24
46
|
},
|
|
25
47
|
{
|
|
26
|
-
test: /\.css$/,
|
|
48
|
+
test: /\.module\.css$/,
|
|
27
49
|
use: [
|
|
28
50
|
'style-loader',
|
|
29
51
|
{
|
|
30
52
|
loader: 'css-loader',
|
|
31
53
|
options: {
|
|
32
54
|
importLoaders: 1,
|
|
33
|
-
modules:
|
|
55
|
+
modules: {
|
|
56
|
+
localIdentName: '[local]__[hash:base64:5]',
|
|
57
|
+
exportLocalsConvention: 'camelCase'
|
|
58
|
+
}
|
|
34
59
|
}
|
|
35
60
|
}
|
|
36
|
-
]
|
|
37
|
-
include: /\.module\.css$/
|
|
61
|
+
]
|
|
38
62
|
},
|
|
39
63
|
{
|
|
40
64
|
test: /\.css$/,
|
|
@@ -55,26 +79,55 @@ module.exports = (_env, argv) => {
|
|
|
55
79
|
use: {
|
|
56
80
|
loader: 'html-loader',
|
|
57
81
|
options: {
|
|
58
|
-
|
|
82
|
+
sources: {
|
|
83
|
+
list: [
|
|
84
|
+
{ tag: 'img', attribute: 'src', type: 'src' },
|
|
85
|
+
{ tag: 'link', attribute: 'href', type: 'src' }
|
|
86
|
+
]
|
|
87
|
+
}
|
|
59
88
|
}
|
|
60
89
|
}
|
|
61
90
|
}
|
|
62
91
|
]
|
|
63
92
|
},
|
|
93
|
+
plugins: [
|
|
94
|
+
new HtmlWebpackPlugin({
|
|
95
|
+
template: path.join(__dirname, 'index.html'),
|
|
96
|
+
inject: 'body',
|
|
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
|
+
)
|
|
110
|
+
],
|
|
64
111
|
devServer: {
|
|
65
112
|
port: 9000,
|
|
66
113
|
compress: true,
|
|
67
114
|
open: true,
|
|
68
|
-
|
|
69
|
-
|
|
115
|
+
static: [
|
|
116
|
+
{
|
|
117
|
+
directory: path.join(__dirname),
|
|
118
|
+
publicPath: '/',
|
|
119
|
+
watch: true
|
|
120
|
+
}
|
|
121
|
+
],
|
|
70
122
|
historyApiFallback: true
|
|
71
123
|
},
|
|
72
124
|
devtool: isProduction ? false : 'inline-source-map',
|
|
73
125
|
resolve: {
|
|
74
|
-
modules: [path.join(__dirname, 'src'), 'node_modules'],
|
|
75
|
-
extensions: ['.js', '.jsx', '.scss'],
|
|
126
|
+
modules: [path.join(__dirname, 'src'), path.join(__dirname), 'node_modules'],
|
|
127
|
+
extensions: ['.js', '.jsx', '.scss', '.css'],
|
|
76
128
|
alias: {
|
|
77
|
-
'react-virtualized/List': 'react-virtualized/dist/es/List'
|
|
129
|
+
'react-virtualized/List': 'react-virtualized/dist/es/List',
|
|
130
|
+
'react/jsx-runtime': path.resolve(__dirname, 'src/jsx-runtime-shim.js')
|
|
78
131
|
}
|
|
79
132
|
}
|
|
80
133
|
};
|