elpaypg 2.1.2 → 2.1.3

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": "elpaypg",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "description": "ELPAY PG - single-backend payment gateway module",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -2694,6 +2694,47 @@
2694
2694
  }
2695
2695
  }
2696
2696
 
2697
+ /* --- RUNTIME RESPONSIVE GUARD ---
2698
+ checkout.html measures the real rendered width of .ypg-wrapper and toggles
2699
+ ypg-layout-compact / ypg-layout-single on <body>. These rules therefore win
2700
+ over any media query and guarantee the QR/payment workspace is never squeezed
2701
+ into an unusable sliver, no matter how the checkout is embedded. */
2702
+ body.ypg-layout-compact .ypg-pc-sidebar {
2703
+ display: none !important;
2704
+ }
2705
+
2706
+ body.ypg-layout-compact .ypg-pc-methods-list {
2707
+ width: 190px !important;
2708
+ min-width: 190px !important;
2709
+ max-width: 190px !important;
2710
+ flex-shrink: 0 !important;
2711
+ }
2712
+
2713
+ body.ypg-layout-compact .ypg-pc-active-view {
2714
+ padding: 14px 18px !important;
2715
+ }
2716
+
2717
+ /* Below ~900px the methods rail itself becomes the problem, so collapse it and
2718
+ fall back to the tabbed method selector. */
2719
+ body.ypg-layout-single .ypg-pc-methods-list {
2720
+ display: none !important;
2721
+ }
2722
+
2723
+ body.ypg-layout-single .ypg-pc-active-view {
2724
+ width: 100% !important;
2725
+ padding: 12px 14px !important;
2726
+ }
2727
+
2728
+ body.ypg-layout-single .ypg-method-selector-bar {
2729
+ display: flex !important;
2730
+ }
2731
+
2732
+ body.ypg-layout-single .ypg-qr-card-container {
2733
+ flex-wrap: wrap !important;
2734
+ justify-content: center !important;
2735
+ gap: 12px !important;
2736
+ }
2737
+
2697
2738
  /* NARROW DESKTOP (iframe width 768-1099px)
2698
2739
  The branding sidebar (310px) + methods rail (220px) together eat 530px of a
2699
2740
  ~900px modal, leaving too little for the QR workspace, which then gets clipped
@@ -2730,42 +2771,6 @@
2730
2771
  }
2731
2772
  }
2732
2773
 
2733
- /* NARROW DESKTOP (iframe width 768-1099px)
2734
- The branding sidebar (310px) + methods rail (220px) together eat 530px of a
2735
- ~900px modal, leaving too little for the QR workspace, which then gets clipped
2736
- by the wrapper's overflow:hidden. Reclaim the branding panel and slim the rail
2737
- so the right-hand column always fits. */
2738
- @media (min-width: 768px) and (max-width: 1099px) {
2739
- .ypg-pc-sidebar {
2740
- display: none !important;
2741
- }
2742
-
2743
- .ypg-pc-methods-list {
2744
- width: 190px !important;
2745
- min-width: 190px !important;
2746
- max-width: 190px !important;
2747
- flex-shrink: 0 !important;
2748
- padding: 12px 10px !important;
2749
- }
2750
-
2751
- .ypg-pc-active-view {
2752
- padding: 14px 18px !important;
2753
- }
2754
- }
2755
-
2756
- /* Very narrow desktop: let the QR card wrap instead of overflowing. */
2757
- @media (min-width: 768px) and (max-width: 880px) {
2758
- .ypg-pc-active-view {
2759
- padding: 12px 14px !important;
2760
- }
2761
-
2762
- .ypg-qr-card-container {
2763
- flex-wrap: wrap !important;
2764
- justify-content: center !important;
2765
- gap: 12px !important;
2766
- }
2767
- }
2768
-
2769
2774
  /* MOBILE SPECIFIC RULES - PINNED HEADER WITH CONTENT SCROLLING BEHIND IT */
2770
2775
  @media (max-width: 767px) {
2771
2776
  .ypg-pc-sidebar {
@@ -3126,4 +3131,4 @@
3126
3131
  max-width: 170px !important;
3127
3132
  max-height: 170px !important;
3128
3133
  }
3129
- }
3134
+ }
@@ -8,7 +8,7 @@
8
8
  <link rel="stylesheet" href="/css/checkout.css?v={{CSS_VERSION}}">
9
9
  </head>
10
10
 
11
- <body>
11
+ <body data-elpay-version="{{CSS_VERSION}}">
12
12
 
13
13
  <!-- include:partials/splash.html -->
14
14
 
@@ -2828,6 +2828,42 @@
2828
2828
  });
2829
2829
  }
2830
2830
 
2831
+ // --- RESPONSIVE LAYOUT GUARD ---
2832
+ // The checkout is rendered inside an iframe whose width the stylesheet cannot
2833
+ // always predict (the modal can be resized, the host page can be zoomed, and the
2834
+ // wrapper is capped by 95vw). Media queries alone therefore sometimes kept the
2835
+ // 3-column desktop layout alive in a container that was far too narrow, which
2836
+ // squeezed the QR workspace down to ~210px and clipped it.
2837
+ // Measuring the real rendered width and toggling layout modes makes the checkout
2838
+ // degrade predictably: the branding panel drops first, then the methods rail.
2839
+ const LAYOUT_COMPACT_MAX = 1100;
2840
+ const LAYOUT_SINGLE_MAX = 900;
2841
+
2842
+ function applyResponsiveLayout() {
2843
+ const wrapper = document.querySelector('.ypg-wrapper');
2844
+ if (!wrapper) return;
2845
+ const width = wrapper.getBoundingClientRect().width;
2846
+ if (!width) return;
2847
+ document.body.classList.toggle('ypg-layout-compact', width < LAYOUT_COMPACT_MAX);
2848
+ document.body.classList.toggle('ypg-layout-single', width < LAYOUT_SINGLE_MAX);
2849
+ }
2850
+
2851
+ function initResponsiveLayoutGuard() {
2852
+ applyResponsiveLayout();
2853
+ const wrapper = document.querySelector('.ypg-wrapper');
2854
+ if (wrapper && typeof ResizeObserver !== 'undefined') {
2855
+ try {
2856
+ new ResizeObserver(applyResponsiveLayout).observe(wrapper);
2857
+ } catch (e) { }
2858
+ }
2859
+ window.addEventListener('resize', applyResponsiveLayout);
2860
+ window.addEventListener('orientationchange', applyResponsiveLayout);
2861
+ console.log('[elpay-checkout] build', document.body.dataset.elpayVersion || 'unknown',
2862
+ '| layout guard active');
2863
+ }
2864
+
2865
+ initResponsiveLayoutGuard();
2866
+
2831
2867
  // Boot checkout - restore preserved 1-week identity if available
2832
2868
  const bootPreserved = getPreservedIdentity();
2833
2869
  if (bootPreserved && bootPreserved.customer) {