@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.
@@ -816,12 +816,19 @@ var transformStyle = function transformStyle(style) {
816
816
  return result;
817
817
  }, {});
818
818
  };
819
- var loadScript = function loadScript(src, nonce, dataset) {
819
+ var loadScript = function loadScript(src, nonce, dataset, forceReload) {
820
820
  return new Promise(function (resolve, reject) {
821
- if (Array.from(document.scripts).findIndex(function (s) {
821
+ var existingScript = Array.from(document.scripts).find(function (s) {
822
822
  return s.src === src;
823
- }) !== -1) {
824
- resolve();
823
+ });
824
+
825
+ if (existingScript) {
826
+ if (forceReload) {
827
+ existingScript.remove();
828
+ } else {
829
+ resolve();
830
+ return;
831
+ }
825
832
  }
826
833
 
827
834
  var script = document.createElement('script');
@@ -15163,7 +15170,7 @@ var onLoadPaypal = /*#__PURE__*/function () {
15163
15170
  return loadScript(src, props.cspNonce, {
15164
15171
  namespace: namespace,
15165
15172
  cspNonce: props.cspNonce
15166
- });
15173
+ }, true);
15167
15174
 
15168
15175
  case 2:
15169
15176
  defaultStyle = {
@@ -15274,7 +15281,14 @@ var options$2 = {
15274
15281
  throw new Error('You need to provide paymentId or accountId');
15275
15282
  }
15276
15283
 
15277
- return containerTemplate(params);
15284
+ var container = containerTemplate(params);
15285
+
15286
+ params.event.on(zoid.EVENT.DESTROY, function () {
15287
+ window[namespace].Buttons.instances.forEach(function (instance) {
15288
+ instance.close();
15289
+ });
15290
+ });
15291
+ return container;
15278
15292
  },
15279
15293
  props: {
15280
15294
  accountId: {