@seamlessdocs/payment-modals 1.0.61 → 1.0.62

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": "1.0.61",
3
+ "version": "1.0.62",
4
4
  "description": "Payment modals for SeamlessDocs",
5
5
  "main": "build/payment-modals.js",
6
6
  "repository": {
@@ -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, restoreExtendedEventConstructor } from './shims';
15
+ import { restoreNativeEventConstructor } from './shims';
16
16
 
17
17
  import './OpenViewStyles.css';
18
18
 
@@ -104,7 +104,6 @@ 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
@@ -122,7 +121,6 @@ handlePaymentModal.govOSPayCardPaymentModal = settings => {
122
121
  />,
123
122
  document.getElementById('payment-modal')
124
123
  );
125
- restoreExtendedEventConstructor();
126
124
  }
127
125
 
128
126
  // TODO: Remove use of shims when mootools is removed
@@ -136,7 +134,6 @@ handlePaymentModal.govOSPayInvoiceSummaryModal = settings => {
136
134
  />,
137
135
  document.getElementById('payment-modal')
138
136
  );
139
- restoreExtendedEventConstructor();
140
137
  }
141
138
 
142
139
  handlePaymentModal.none = () => {
package/src/shims.js CHANGED
@@ -11,14 +11,14 @@ 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
- global.ExtendedEvent = global.Event;
14
+ window.ExtendedEvent = window.Event;
15
15
  const nativeEvent = getNativeEventConstructor();
16
- global.Event = nativeEvent;
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
- global.Event = global.ExtendedEvent;
23
- delete global.ExtendedEvent;
22
+ if (!window.ExtendedEvent) return;
23
+ window.Event = window.ExtendedEvent;
24
24
  }