@monei-js/components 1.7.4 → 1.7.6
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/dist/bizum/index.d.ts +2 -2
- package/dist/components.cjs.development.js +25 -7
- package/dist/components.cjs.development.js.map +1 -1
- package/dist/components.cjs.production.min.js +1 -1
- package/dist/components.cjs.production.min.js.map +1 -1
- package/dist/components.esm.js +25 -7
- package/dist/components.esm.js.map +1 -1
- package/dist/paypal/index.d.ts +1 -1
- package/dist/utils.d.ts +1 -1
- package/package.json +1 -1
package/dist/bizum/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BizumProps } from './types';
|
|
2
1
|
import { MoneiComponent } from '../../types/component';
|
|
3
|
-
|
|
2
|
+
import { BizumProps } from './types';
|
|
4
3
|
export * from './modal';
|
|
4
|
+
export * from './types';
|
|
5
5
|
export declare const Bizum: MoneiComponent<BizumProps>;
|
|
@@ -820,12 +820,19 @@ var transformStyle = function transformStyle(style) {
|
|
|
820
820
|
return result;
|
|
821
821
|
}, {});
|
|
822
822
|
};
|
|
823
|
-
var loadScript = function loadScript(src, nonce, dataset) {
|
|
823
|
+
var loadScript = function loadScript(src, nonce, dataset, forceReload) {
|
|
824
824
|
return new Promise(function (resolve, reject) {
|
|
825
|
-
|
|
825
|
+
var existingScript = Array.from(document.scripts).find(function (s) {
|
|
826
826
|
return s.src === src;
|
|
827
|
-
})
|
|
828
|
-
|
|
827
|
+
});
|
|
828
|
+
|
|
829
|
+
if (existingScript) {
|
|
830
|
+
if (forceReload) {
|
|
831
|
+
existingScript.remove();
|
|
832
|
+
} else {
|
|
833
|
+
resolve();
|
|
834
|
+
return;
|
|
835
|
+
}
|
|
829
836
|
}
|
|
830
837
|
|
|
831
838
|
var script = document.createElement('script');
|
|
@@ -15167,7 +15174,7 @@ var onLoadPaypal = /*#__PURE__*/function () {
|
|
|
15167
15174
|
return loadScript(src, props.cspNonce, {
|
|
15168
15175
|
namespace: namespace,
|
|
15169
15176
|
cspNonce: props.cspNonce
|
|
15170
|
-
});
|
|
15177
|
+
}, true);
|
|
15171
15178
|
|
|
15172
15179
|
case 2:
|
|
15173
15180
|
defaultStyle = {
|
|
@@ -15278,7 +15285,14 @@ var options$2 = {
|
|
|
15278
15285
|
throw new Error('You need to provide paymentId or accountId');
|
|
15279
15286
|
}
|
|
15280
15287
|
|
|
15281
|
-
|
|
15288
|
+
var container = containerTemplate(params);
|
|
15289
|
+
|
|
15290
|
+
params.event.on(zoid.EVENT.DESTROY, function () {
|
|
15291
|
+
window[namespace].Buttons.instances.forEach(function (instance) {
|
|
15292
|
+
instance.close();
|
|
15293
|
+
});
|
|
15294
|
+
});
|
|
15295
|
+
return container;
|
|
15282
15296
|
},
|
|
15283
15297
|
props: {
|
|
15284
15298
|
accountId: {
|
|
@@ -15609,12 +15623,14 @@ var options$4 = {
|
|
|
15609
15623
|
type: zoid.PROP_TYPE.FUNCTION,
|
|
15610
15624
|
required: false,
|
|
15611
15625
|
value: function value(_ref2) {
|
|
15612
|
-
var props = _ref2.props
|
|
15626
|
+
var props = _ref2.props,
|
|
15627
|
+
state = _ref2.state;
|
|
15613
15628
|
var rootNode = document.createElement('div');
|
|
15614
15629
|
document.body.appendChild(rootNode);
|
|
15615
15630
|
return function (_ref3) {
|
|
15616
15631
|
var amount = _ref3.amount,
|
|
15617
15632
|
currency = _ref3.currency;
|
|
15633
|
+
if (state.isOpen) return;
|
|
15618
15634
|
var shouldOpen = true;
|
|
15619
15635
|
|
|
15620
15636
|
if (props.onBeforeOpen) {
|
|
@@ -15622,11 +15638,13 @@ var options$4 = {
|
|
|
15622
15638
|
}
|
|
15623
15639
|
|
|
15624
15640
|
if (!shouldOpen) return;
|
|
15641
|
+
state.isOpen = true;
|
|
15625
15642
|
var bizumModal = new BizumModal(_extends({
|
|
15626
15643
|
amount: amount,
|
|
15627
15644
|
currency: currency
|
|
15628
15645
|
}, props, {
|
|
15629
15646
|
onClose: function onClose() {
|
|
15647
|
+
state.isOpen = false;
|
|
15630
15648
|
window.onpopstate = null;
|
|
15631
15649
|
document.body.style.overflow = '';
|
|
15632
15650
|
},
|