@seamlessdocs/payment-modals 1.0.65 → 2.0.0-beta.1
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 +0 -2
- package/package.json +40 -32
- package/seamlessdocs-payment-modals-v2.0.0-beta.1.tgz +0 -0
- package/src/index.jsx +34 -19
- package/webpack.config.js +59 -13
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,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>
|
|
@@ -22,7 +21,6 @@
|
|
|
22
21
|
</div>
|
|
23
22
|
<div id="payment-modal"></div>
|
|
24
23
|
<script src="https://core.spreedly.com/iframe/express-2.min.js"></script>
|
|
25
|
-
<script src="./build/payment-modals.js"></script>
|
|
26
24
|
<script>
|
|
27
25
|
var triggers = document.querySelectorAll('.links a');
|
|
28
26
|
var callbacks = {
|
package/package.json
CHANGED
|
@@ -1,60 +1,68 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seamlessdocs/payment-modals",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta.1",
|
|
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
|
-
"
|
|
39
|
+
"mini-css-extract-plugin": "^2.7.6",
|
|
40
|
+
"sass": "^1.69.0",
|
|
37
41
|
"prettier": "^1.17.0",
|
|
38
|
-
"
|
|
39
|
-
"
|
|
42
|
+
"react": "^18.2.0",
|
|
43
|
+
"react-dom": "^18.2.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": ">=18.0.0",
|
|
54
|
+
"react-dom": ">=18.0.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
68
|
"react-tippy": "^1.4.0"
|
|
Binary file
|
package/src/index.jsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { createRoot } from 'react-dom/client';
|
|
3
3
|
|
|
4
4
|
import ChooseModal from './Components/ChooseModal';
|
|
5
5
|
import ProcessingModal from './Components/ProcessingModal';
|
|
@@ -14,12 +14,27 @@ 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 18 createRoot
|
|
21
|
+
let rootInstance = null;
|
|
22
|
+
const renderModal = (element, containerId) => {
|
|
23
|
+
const containerElement = document.getElementById(containerId);
|
|
24
|
+
if (!containerElement) {
|
|
25
|
+
console.warn(`Container element with id "${containerId}" not found`);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (!rootInstance) {
|
|
29
|
+
rootInstance = createRoot(containerElement);
|
|
30
|
+
}
|
|
31
|
+
rootInstance.render(element);
|
|
32
|
+
};
|
|
33
|
+
|
|
19
34
|
const handlePaymentModal = {};
|
|
20
35
|
|
|
21
36
|
handlePaymentModal.chooseModal = settings => {
|
|
22
|
-
|
|
37
|
+
renderModal(
|
|
23
38
|
<ChooseModal
|
|
24
39
|
title={settings.title}
|
|
25
40
|
description={settings.description}
|
|
@@ -28,16 +43,16 @@ handlePaymentModal.chooseModal = settings => {
|
|
|
28
43
|
onWithPay={settings.callbacks.withPay}
|
|
29
44
|
onClose={settings.callbacks.close}
|
|
30
45
|
/>,
|
|
31
|
-
|
|
46
|
+
'payment-modal'
|
|
32
47
|
);
|
|
33
48
|
};
|
|
34
49
|
|
|
35
50
|
handlePaymentModal.processingModal = () => {
|
|
36
|
-
|
|
51
|
+
renderModal(<ProcessingModal />, 'payment-modal');
|
|
37
52
|
};
|
|
38
53
|
|
|
39
54
|
handlePaymentModal.errorModal = settings => {
|
|
40
|
-
|
|
55
|
+
renderModal(
|
|
41
56
|
<ErrorModal
|
|
42
57
|
isOptional={settings.isOptional}
|
|
43
58
|
errorText={settings.errorText}
|
|
@@ -45,19 +60,19 @@ handlePaymentModal.errorModal = settings => {
|
|
|
45
60
|
onRetry={settings.callbacks.retry}
|
|
46
61
|
onClose={settings.callbacks.close}
|
|
47
62
|
/>,
|
|
48
|
-
|
|
63
|
+
'payment-modal'
|
|
49
64
|
);
|
|
50
65
|
};
|
|
51
66
|
|
|
52
67
|
handlePaymentModal.successModal = settings => {
|
|
53
|
-
|
|
68
|
+
renderModal(
|
|
54
69
|
<SuccessModal description={settings.description} />,
|
|
55
|
-
|
|
70
|
+
'payment-modal'
|
|
56
71
|
);
|
|
57
72
|
};
|
|
58
73
|
|
|
59
74
|
handlePaymentModal.selectPaymentModal = settings => {
|
|
60
|
-
|
|
75
|
+
renderModal(
|
|
61
76
|
<SelectPaymentModal
|
|
62
77
|
isPaymentRequired={settings.isPaymentRequired}
|
|
63
78
|
onPayByBank={settings.callbacks.onPayByBank}
|
|
@@ -71,12 +86,12 @@ handlePaymentModal.selectPaymentModal = settings => {
|
|
|
71
86
|
isCreditCardFeeEnable={settings.isCreditCardFeeEnable}
|
|
72
87
|
isBankAccountFeeEnable={settings.isBankAccountFeeEnable}
|
|
73
88
|
/>,
|
|
74
|
-
|
|
89
|
+
'payment-modal'
|
|
75
90
|
);
|
|
76
91
|
};
|
|
77
92
|
|
|
78
93
|
handlePaymentModal.achPaymentModal = settings => {
|
|
79
|
-
|
|
94
|
+
renderModal(
|
|
80
95
|
<ACHPaymentModal
|
|
81
96
|
onPay={settings.callbacks.onPay}
|
|
82
97
|
onClose={settings.callbacks.onClose}
|
|
@@ -86,14 +101,14 @@ handlePaymentModal.achPaymentModal = settings => {
|
|
|
86
101
|
description={settings.description}
|
|
87
102
|
feeName={settings.feeName}
|
|
88
103
|
/>,
|
|
89
|
-
|
|
104
|
+
'payment-modal'
|
|
90
105
|
);
|
|
91
106
|
};
|
|
92
107
|
|
|
93
108
|
// TODO: Remove use of shims when mootools is removed
|
|
94
109
|
handlePaymentModal.govOSPayACHPaymentModal = settings => {
|
|
95
110
|
restoreNativeEventConstructor();
|
|
96
|
-
|
|
111
|
+
renderModal(
|
|
97
112
|
<GovOSPayACHPaymentModal
|
|
98
113
|
onPay={settings.callbacks.onPay}
|
|
99
114
|
onClose={settings.callbacks.onClose}
|
|
@@ -105,7 +120,7 @@ handlePaymentModal.govOSPayACHPaymentModal = settings => {
|
|
|
105
120
|
updateTransactionUrl={settings.updateTransactionUrl}
|
|
106
121
|
lineItems={settings.lineItems}
|
|
107
122
|
/>,
|
|
108
|
-
|
|
123
|
+
'payment-modal'
|
|
109
124
|
);
|
|
110
125
|
}
|
|
111
126
|
|
|
@@ -113,7 +128,7 @@ handlePaymentModal.govOSPayACHPaymentModal = settings => {
|
|
|
113
128
|
handlePaymentModal.govOSPayCardPaymentModal = settings => {
|
|
114
129
|
restoreNativeEventConstructor();
|
|
115
130
|
loadJQuery(() => {
|
|
116
|
-
|
|
131
|
+
renderModal(
|
|
117
132
|
<GovOSPayCardPaymentModal
|
|
118
133
|
onPay={settings.callbacks.onPay}
|
|
119
134
|
onClose={settings.callbacks.onClose}
|
|
@@ -126,7 +141,7 @@ handlePaymentModal.govOSPayCardPaymentModal = settings => {
|
|
|
126
141
|
updateTransactionUrl={settings.updateTransactionUrl}
|
|
127
142
|
lineItems={settings.lineItems}
|
|
128
143
|
/>,
|
|
129
|
-
|
|
144
|
+
'payment-modal'
|
|
130
145
|
);
|
|
131
146
|
});
|
|
132
147
|
}
|
|
@@ -134,18 +149,18 @@ handlePaymentModal.govOSPayCardPaymentModal = settings => {
|
|
|
134
149
|
// TODO: Remove use of shims when mootools is removed
|
|
135
150
|
handlePaymentModal.govOSPayInvoiceSummaryModal = settings => {
|
|
136
151
|
restoreNativeEventConstructor();
|
|
137
|
-
|
|
152
|
+
renderModal(
|
|
138
153
|
<GovOSPayInvoiceSummaryModal
|
|
139
154
|
onSubmit={settings.callbacks.onSubmit}
|
|
140
155
|
onClose={settings.callbacks.onClose}
|
|
141
156
|
transactionData={settings.transactionData}
|
|
142
157
|
/>,
|
|
143
|
-
|
|
158
|
+
'payment-modal'
|
|
144
159
|
);
|
|
145
160
|
}
|
|
146
161
|
|
|
147
162
|
handlePaymentModal.none = () => {
|
|
148
|
-
|
|
163
|
+
renderModal(<EmptyModal />, 'payment-modal');
|
|
149
164
|
};
|
|
150
165
|
|
|
151
166
|
window.handlePaymentModal = handlePaymentModal;
|
package/webpack.config.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
|
+
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
2
3
|
|
|
3
4
|
module.exports = (_env, argv) => {
|
|
4
5
|
const isProduction = argv.mode === 'production';
|
|
@@ -8,11 +9,37 @@ module.exports = (_env, argv) => {
|
|
|
8
9
|
},
|
|
9
10
|
output: {
|
|
10
11
|
filename: 'payment-modals.js',
|
|
11
|
-
path: '
|
|
12
|
-
library:
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
path: path.resolve(__dirname, 'build'),
|
|
13
|
+
library: {
|
|
14
|
+
name: 'payment-modals',
|
|
15
|
+
type: 'umd'
|
|
16
|
+
},
|
|
17
|
+
umdNamedDefine: true,
|
|
18
|
+
clean: true,
|
|
19
|
+
globalObject: 'this'
|
|
15
20
|
},
|
|
21
|
+
// Solo aplicar externals en producción
|
|
22
|
+
// En desarrollo, React debe estar incluido en el bundle
|
|
23
|
+
externals: isProduction ? {
|
|
24
|
+
'react': {
|
|
25
|
+
commonjs: 'react',
|
|
26
|
+
commonjs2: 'react',
|
|
27
|
+
amd: 'react',
|
|
28
|
+
root: 'React'
|
|
29
|
+
},
|
|
30
|
+
'react-dom': {
|
|
31
|
+
commonjs: 'react-dom',
|
|
32
|
+
commonjs2: 'react-dom',
|
|
33
|
+
amd: 'react-dom',
|
|
34
|
+
root: 'ReactDOM'
|
|
35
|
+
},
|
|
36
|
+
'react-dom/client': {
|
|
37
|
+
commonjs: 'react-dom/client',
|
|
38
|
+
commonjs2: 'react-dom/client',
|
|
39
|
+
amd: 'react-dom/client',
|
|
40
|
+
root: 'ReactDOM'
|
|
41
|
+
}
|
|
42
|
+
} : {},
|
|
16
43
|
module: {
|
|
17
44
|
rules: [
|
|
18
45
|
{
|
|
@@ -23,18 +50,20 @@ module.exports = (_env, argv) => {
|
|
|
23
50
|
}
|
|
24
51
|
},
|
|
25
52
|
{
|
|
26
|
-
test: /\.css$/,
|
|
53
|
+
test: /\.module\.css$/,
|
|
27
54
|
use: [
|
|
28
55
|
'style-loader',
|
|
29
56
|
{
|
|
30
57
|
loader: 'css-loader',
|
|
31
58
|
options: {
|
|
32
59
|
importLoaders: 1,
|
|
33
|
-
modules:
|
|
60
|
+
modules: {
|
|
61
|
+
localIdentName: '[local]__[hash:base64:5]',
|
|
62
|
+
exportLocalsConvention: 'camelCase'
|
|
63
|
+
}
|
|
34
64
|
}
|
|
35
65
|
}
|
|
36
|
-
]
|
|
37
|
-
include: /\.module\.css$/
|
|
66
|
+
]
|
|
38
67
|
},
|
|
39
68
|
{
|
|
40
69
|
test: /\.css$/,
|
|
@@ -55,24 +84,41 @@ module.exports = (_env, argv) => {
|
|
|
55
84
|
use: {
|
|
56
85
|
loader: 'html-loader',
|
|
57
86
|
options: {
|
|
58
|
-
|
|
87
|
+
sources: {
|
|
88
|
+
list: [
|
|
89
|
+
{ tag: 'img', attribute: 'src', type: 'src' },
|
|
90
|
+
{ tag: 'link', attribute: 'href', type: 'src' }
|
|
91
|
+
]
|
|
92
|
+
}
|
|
59
93
|
}
|
|
60
94
|
}
|
|
61
95
|
}
|
|
62
96
|
]
|
|
63
97
|
},
|
|
98
|
+
plugins: [
|
|
99
|
+
new HtmlWebpackPlugin({
|
|
100
|
+
template: path.join(__dirname, 'index.html'),
|
|
101
|
+
inject: 'body',
|
|
102
|
+
scriptLoading: 'blocking'
|
|
103
|
+
})
|
|
104
|
+
],
|
|
64
105
|
devServer: {
|
|
65
106
|
port: 9000,
|
|
66
107
|
compress: true,
|
|
67
108
|
open: true,
|
|
68
|
-
|
|
69
|
-
|
|
109
|
+
static: [
|
|
110
|
+
{
|
|
111
|
+
directory: path.join(__dirname),
|
|
112
|
+
publicPath: '/',
|
|
113
|
+
watch: true
|
|
114
|
+
}
|
|
115
|
+
],
|
|
70
116
|
historyApiFallback: true
|
|
71
117
|
},
|
|
72
118
|
devtool: isProduction ? false : 'inline-source-map',
|
|
73
119
|
resolve: {
|
|
74
|
-
modules: [path.join(__dirname, 'src'), 'node_modules'],
|
|
75
|
-
extensions: ['.js', '.jsx', '.scss'],
|
|
120
|
+
modules: [path.join(__dirname, 'src'), path.join(__dirname), 'node_modules'],
|
|
121
|
+
extensions: ['.js', '.jsx', '.scss', '.css'],
|
|
76
122
|
alias: {
|
|
77
123
|
'react-virtualized/List': 'react-virtualized/dist/es/List'
|
|
78
124
|
}
|