elpaypg 2.1.1 → 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 +1 -1
- package/public/css/checkout.css +42 -1
- package/public/elpay-checkout.js +11 -2
- package/public/views/checkout.html +38 -2
- package/src/router.js +17 -0
package/package.json
CHANGED
package/public/css/checkout.css
CHANGED
|
@@ -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
|
|
@@ -3090,4 +3131,4 @@
|
|
|
3090
3131
|
max-width: 170px !important;
|
|
3091
3132
|
max-height: 170px !important;
|
|
3092
3133
|
}
|
|
3093
|
-
}
|
|
3134
|
+
}
|
package/public/elpay-checkout.js
CHANGED
|
@@ -704,9 +704,9 @@
|
|
|
704
704
|
/* DESKTOP / PC MODAL STYLES (Razorpay 2-Column Exact Layout) */
|
|
705
705
|
@media (min-width: 768px) {
|
|
706
706
|
.elpay-checkout-container {
|
|
707
|
-
width:
|
|
707
|
+
width: 960px;
|
|
708
708
|
max-width: 95vw;
|
|
709
|
-
height:
|
|
709
|
+
height: 620px;
|
|
710
710
|
max-height: 92vh;
|
|
711
711
|
border-radius: 16px;
|
|
712
712
|
box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
|
|
@@ -716,6 +716,15 @@
|
|
|
716
716
|
}
|
|
717
717
|
}
|
|
718
718
|
|
|
719
|
+
/* Large desktop: give the branding sidebar room so the QR workspace keeps
|
|
720
|
+
full width. Below this breakpoint the checkout hides the sidebar instead. */
|
|
721
|
+
@media (min-width: 1200px) {
|
|
722
|
+
.elpay-checkout-container {
|
|
723
|
+
width: 1100px;
|
|
724
|
+
height: 660px;
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
|
|
719
728
|
/* MOBILE BOTTOM DRAWER / BOTTOM SHEET STYLES */
|
|
720
729
|
@media (max-width: 767px) {
|
|
721
730
|
.elpay-checkout-backdrop {
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
<meta charset="UTF-8">
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
|
7
7
|
<title>{{MERCHANT_NAME}} · {{APP_NAME}} Checkout</title>
|
|
8
|
-
<link rel="stylesheet" href="/css/checkout.css">
|
|
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) {
|
package/src/router.js
CHANGED
|
@@ -97,6 +97,22 @@ export function createRouter(ctx = {}) {
|
|
|
97
97
|
return router;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Reads the installed package version so static assets can be cache-busted.
|
|
102
|
+
* Without this a merchant browser can keep serving a stale checkout stylesheet
|
|
103
|
+
* after the package is upgraded, which silently re-introduces old layout bugs.
|
|
104
|
+
*/
|
|
105
|
+
function readPackageVersion() {
|
|
106
|
+
try {
|
|
107
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8'));
|
|
108
|
+
return String(pkg.version || '0.0.0');
|
|
109
|
+
} catch {
|
|
110
|
+
return '0.0.0';
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const ASSET_VERSION = readPackageVersion();
|
|
115
|
+
|
|
100
116
|
function renderCheckoutPage(ctx, paymentId, state) {
|
|
101
117
|
const template = loadTemplateWithPartials();
|
|
102
118
|
const values = {
|
|
@@ -105,6 +121,7 @@ function renderCheckoutPage(ctx, paymentId, state) {
|
|
|
105
121
|
APP_NAME: state?.branding?.appName || 'ELPAY PG',
|
|
106
122
|
MERCHANT_NAME: state?.merchantName || 'Merchant Checkout',
|
|
107
123
|
AMOUNT: state?.amount || '0.00',
|
|
124
|
+
CSS_VERSION: ASSET_VERSION,
|
|
108
125
|
INITIAL_STATE_JSON: serializeForScript(state || {})
|
|
109
126
|
};
|
|
110
127
|
return renderTemplate(template, values);
|