@seamlessdocs/payment-modals 1.0.61 → 1.0.63
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/build/payment-modals.js +10 -10
- package/package.json +1 -1
- package/src/Components/GovOSPayACHPaymentModal/index.jsx +7 -1
- package/src/Components/GovOSPayCardPaymentModal/index.jsx +7 -1
- package/src/Components/GovOSPayInvoiceSummaryModal/index.jsx +7 -1
- package/src/index.jsx +15 -16
- package/src/shims.js +27 -4
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { ACHPayment } from '@kofile/platform-react-payrix';
|
|
4
4
|
|
|
5
5
|
import Modal from '../Modal';
|
|
6
|
+
import { restoreExtendedEventConstructor } from '../../shims';
|
|
6
7
|
|
|
7
8
|
import backIcon from '../../assets/img/back.svg';
|
|
8
9
|
|
|
@@ -16,6 +17,11 @@ const GovOSPayACHPaymentModal = ({
|
|
|
16
17
|
paymentConfig,
|
|
17
18
|
transactionUrl,
|
|
18
19
|
}) => {
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
// TODO: Remove use of shims when mootools is removed
|
|
22
|
+
restoreExtendedEventConstructor();
|
|
23
|
+
}, []);
|
|
24
|
+
|
|
19
25
|
return (
|
|
20
26
|
<Modal className={styles.modalContainer}>
|
|
21
27
|
<div
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { CardPayment } from '@kofile/platform-react-payrix';
|
|
4
4
|
|
|
5
5
|
import Modal from '../Modal';
|
|
6
|
+
import { restoreExtendedEventConstructor } from '../../shims';
|
|
6
7
|
|
|
7
8
|
import backIcon from '../../assets/img/back.svg';
|
|
8
9
|
|
|
@@ -17,6 +18,11 @@ const GovOSPayCardPaymentModal = ({
|
|
|
17
18
|
transactionMode,
|
|
18
19
|
transactionUrl,
|
|
19
20
|
}) => {
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
// TODO: Remove use of shims when mootools is removed
|
|
23
|
+
restoreExtendedEventConstructor();
|
|
24
|
+
}, []);
|
|
25
|
+
|
|
20
26
|
return (
|
|
21
27
|
<Modal className={styles.modalContainer}>
|
|
22
28
|
<div
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { InvoiceSummary } from '@kofile/platform-react-payrix';
|
|
4
4
|
|
|
5
5
|
import Modal from '../Modal';
|
|
6
|
+
import { restoreExtendedEventConstructor } from '../../shims';
|
|
6
7
|
|
|
7
8
|
import backIcon from '../../assets/img/back.svg';
|
|
8
9
|
|
|
@@ -13,6 +14,11 @@ const GovOSPayInvoiceSummaryModal = ({
|
|
|
13
14
|
onClose,
|
|
14
15
|
transactionData,
|
|
15
16
|
}) => {
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
// TODO: Remove use of shims when mootools is removed
|
|
19
|
+
restoreExtendedEventConstructor();
|
|
20
|
+
}, []);
|
|
21
|
+
|
|
16
22
|
return (
|
|
17
23
|
<Modal className={styles.modalContainer}>
|
|
18
24
|
<div
|
package/src/index.jsx
CHANGED
|
@@ -12,7 +12,7 @@ import GovOSPayACHPaymentModal from './Components/GovOSPayACHPaymentModal';
|
|
|
12
12
|
import GovOSPayCardPaymentModal from './Components/GovOSPayCardPaymentModal';
|
|
13
13
|
import GovOSPayInvoiceSummaryModal from './Components/GovOSPayInvoiceSummaryModal';
|
|
14
14
|
|
|
15
|
-
import { restoreNativeEventConstructor,
|
|
15
|
+
import { restoreNativeEventConstructor, loadJQuery } from './shims';
|
|
16
16
|
|
|
17
17
|
import './OpenViewStyles.css';
|
|
18
18
|
|
|
@@ -104,25 +104,25 @@ handlePaymentModal.govOSPayACHPaymentModal = settings => {
|
|
|
104
104
|
/>,
|
|
105
105
|
document.getElementById('payment-modal')
|
|
106
106
|
);
|
|
107
|
-
restoreExtendedEventConstructor();
|
|
108
107
|
}
|
|
109
108
|
|
|
110
109
|
// TODO: Remove use of shims when mootools is removed
|
|
111
110
|
handlePaymentModal.govOSPayCardPaymentModal = settings => {
|
|
112
111
|
restoreNativeEventConstructor();
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
112
|
+
loadJQuery(() => {
|
|
113
|
+
ReactDOM.render(
|
|
114
|
+
<GovOSPayCardPaymentModal
|
|
115
|
+
onPay={settings.callbacks.onPay}
|
|
116
|
+
onClose={settings.callbacks.onClose}
|
|
117
|
+
amount={settings.amount}
|
|
118
|
+
paymentCorrelationId={settings.paymentCorrelationId}
|
|
119
|
+
paymentConfig={settings.paymentConfig}
|
|
120
|
+
transactionMode={settings.transactionMode}
|
|
121
|
+
transactionUrl={settings.transactionUrl}
|
|
122
|
+
/>,
|
|
123
|
+
document.getElementById('payment-modal')
|
|
124
|
+
);
|
|
125
|
+
});
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
// TODO: Remove use of shims when mootools is removed
|
|
@@ -136,7 +136,6 @@ handlePaymentModal.govOSPayInvoiceSummaryModal = settings => {
|
|
|
136
136
|
/>,
|
|
137
137
|
document.getElementById('payment-modal')
|
|
138
138
|
);
|
|
139
|
-
restoreExtendedEventConstructor();
|
|
140
139
|
}
|
|
141
140
|
|
|
142
141
|
handlePaymentModal.none = () => {
|
package/src/shims.js
CHANGED
|
@@ -11,14 +11,37 @@ export function getNativeEventConstructor() {
|
|
|
11
11
|
// This function is used to restore the native Event constructor
|
|
12
12
|
// when the Event constructor is overridden by mootools
|
|
13
13
|
export function restoreNativeEventConstructor() {
|
|
14
|
-
|
|
14
|
+
window.ExtendedEvent = window.Event;
|
|
15
15
|
const nativeEvent = getNativeEventConstructor();
|
|
16
|
-
|
|
16
|
+
window.Event = nativeEvent;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
// This function is used to restore the Extended Event constructor
|
|
20
20
|
// so that mootools can continue to work
|
|
21
21
|
export function restoreExtendedEventConstructor() {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
if (!window.ExtendedEvent) return;
|
|
23
|
+
window.Event = window.ExtendedEvent;
|
|
24
24
|
}
|
|
25
|
+
|
|
26
|
+
export function loadJQuery(callback) {
|
|
27
|
+
// Check if jQuery is already loaded
|
|
28
|
+
if (!window.jQuery) {
|
|
29
|
+
const script = document.createElement('script');
|
|
30
|
+
script.src = "https://code.jquery.com/jquery-3.7.1.min.js"
|
|
31
|
+
script.integrity = "sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo="
|
|
32
|
+
script.crossOrigin = 'anonymous';
|
|
33
|
+
script.onload = () => {
|
|
34
|
+
console.log('jQuery loaded:', window.jQuery.fn.jquery);
|
|
35
|
+
window.jQuery = jQuery.noConflict();
|
|
36
|
+
if (callback) {
|
|
37
|
+
callback();
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
document.body.appendChild(script);
|
|
41
|
+
} else {
|
|
42
|
+
console.log('jQuery already loaded:', window.jQuery.fn.jquery);
|
|
43
|
+
if (callback) {
|
|
44
|
+
callback();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|