@paypercut/checkout-js 1.4.4 → 1.4.5

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/README.md CHANGED
@@ -1761,7 +1761,7 @@ Tip: Prefer subscribing with the SdkEvent enum for stronger typing.
1761
1761
  <body>
1762
1762
  <div id="checkout"></div>
1763
1763
 
1764
- <script src="https://cdn.jsdelivr.net/npm/@paypercut/checkout-js@1.4.4/dist/paypercut-checkout.iife.min.js"></script>
1764
+ <script src="https://cdn.jsdelivr.net/npm/@paypercut/checkout-js@1.4.5/dist/paypercut-checkout.iife.min.js"></script>
1765
1765
  <script>
1766
1766
  const checkout = PaypercutCheckout({
1767
1767
  id: '01KB23M9EC960C50G3AH14FTTT',
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
4
- const SDK_VERSION = "1.4.4";
4
+ const SDK_VERSION = "1.4.5";
5
5
 
6
6
  const ELEMENTS_APPEARANCE_VARIABLE_NAMES = [
7
7
  'colorPrimary',
@@ -1,4 +1,4 @@
1
- const SDK_VERSION = "1.4.4";
1
+ const SDK_VERSION = "1.4.5";
2
2
 
3
3
  const ELEMENTS_APPEARANCE_VARIABLE_NAMES = [
4
4
  'colorPrimary',
package/dist/index.cjs CHANGED
@@ -105,7 +105,7 @@ class Emitter {
105
105
  }
106
106
  }
107
107
 
108
- const SDK_VERSION = "1.4.4";
108
+ const SDK_VERSION = "1.4.5";
109
109
 
110
110
  /**
111
111
  * Build-time configuration
@@ -4774,6 +4774,7 @@ class CardElementImpl {
4774
4774
  this.handleInitializationTimeout();
4775
4775
  return;
4776
4776
  }
4777
+ this.group.retryStalledControllerInitialization();
4777
4778
  const replacement = this.createFrame();
4778
4779
  const previousGeneration = this.componentGeneration;
4779
4780
  this.componentGeneration += 1;
@@ -5735,6 +5736,7 @@ class ExpressCheckoutElementImpl {
5735
5736
  }
5736
5737
  createFrame(options = this.options) {
5737
5738
  const iframe = document.createElement('iframe');
5739
+ const disableAnimations = this.group.getRenderableElementsOptions().appearance?.disableAnimations === true;
5738
5740
  iframe.id = `paypercut-express-checkout-element-${this.componentId}`;
5739
5741
  iframe.title = 'Express checkout';
5740
5742
  iframe.referrerPolicy = 'origin';
@@ -5763,8 +5765,8 @@ class ExpressCheckoutElementImpl {
5763
5765
  display: 'block',
5764
5766
  overflow: 'hidden',
5765
5767
  colorScheme: 'light dark',
5766
- transition: 'height 250ms ease-in-out, opacity 250ms ease-in-out',
5767
- willChange: 'height, opacity',
5768
+ transition: disableAnimations ? 'none' : 'height 250ms ease-in-out, opacity 250ms ease-in-out',
5769
+ willChange: disableAnimations ? 'auto' : 'height, opacity',
5768
5770
  });
5769
5771
  return iframe;
5770
5772
  }
@@ -11755,6 +11757,29 @@ class ElementsGroupImpl {
11755
11757
  window.addEventListener('message', this.windowMessageHandler);
11756
11758
  (document.body ?? document.documentElement).appendChild(iframe);
11757
11759
  }
11760
+ retryStalledControllerInitialization() {
11761
+ const current = this.controllerIframe;
11762
+ const parent = current?.parentNode;
11763
+ if (this.destroyed || this.controllerInitialized || !current || !parent)
11764
+ return false;
11765
+ // A component-only reload cannot recover a controller whose session request
11766
+ // or bootstrap never completed. Keep the group and its pending components,
11767
+ // but give the controller a fresh browsing context and navigation identity.
11768
+ let replacement;
11769
+ try {
11770
+ replacement = current.cloneNode(false);
11771
+ replacement.src = withElementsFrameNavigationIdentity(current.src, generateId());
11772
+ parent.replaceChild(replacement, current);
11773
+ }
11774
+ catch {
11775
+ return false;
11776
+ }
11777
+ this.controlPort?.close();
11778
+ this.controlPort = null;
11779
+ this.controllerBootstrapped = false;
11780
+ this.controllerIframe = replacement;
11781
+ return true;
11782
+ }
11758
11783
  attachComponent(element, port) {
11759
11784
  if (this.destroyed || !this.elements.has(element.componentId)) {
11760
11785
  port.close();