@monei-js/components 1.7.5 → 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.
@@ -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
- if (Array.from(document.scripts).findIndex(function (s) {
825
+ var existingScript = Array.from(document.scripts).find(function (s) {
826
826
  return s.src === src;
827
- }) !== -1) {
828
- resolve();
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
- return containerTemplate(params);
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: {