@paystack/inline-js 2.23.0-dev.3 → 2.23.0-dev.4
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/dist/inline.js +28 -2
- package/es/inline.js +28 -2
- package/lib/inline.js +28 -2
- package/package.json +1 -1
package/dist/inline.js
CHANGED
|
@@ -945,8 +945,34 @@ var PaystackPop = (function () {
|
|
|
945
945
|
content.appendChild(wrapper);
|
|
946
946
|
var style = document.createElement('style');
|
|
947
947
|
style.textContent = preCheckoutModalCSS;
|
|
948
|
-
|
|
949
|
-
|
|
948
|
+
|
|
949
|
+
// === TEMP (test): render the precheckout modal inside an iframe for ONE merchant — revert before commit ===
|
|
950
|
+
// Only the merchant whose request_inline response carries this merchant_id gets the iframe
|
|
951
|
+
// treatment; every other merchant keeps the original behaviour (modal appended to document.body).
|
|
952
|
+
var IFRAME_MODAL_MERCHANT_ID = 550652; // target merchant_id from the request inline response
|
|
953
|
+
var renderInIframe = transaction && String(transaction.merchant_id) === String(IFRAME_MODAL_MERCHANT_ID);
|
|
954
|
+
if (renderInIframe) {
|
|
955
|
+
// Host the modal + style in a full-viewport, same-origin (about:blank) iframe.
|
|
956
|
+
var hostIframe = document.createElement('iframe');
|
|
957
|
+
hostIframe.id = "pre-checkout-modal-iframe-".concat(id);
|
|
958
|
+
hostIframe.setAttribute('allow', 'payment');
|
|
959
|
+
hostIframe.style.cssText = ['position: fixed', 'top: 0', 'left: 0', 'width: 100%', 'height: 100%', 'border: 0', 'margin: 0', 'background: transparent', "z-index: ".concat(findHighestZIndex() + 1)].join(';');
|
|
960
|
+
document.body.appendChild(hostIframe);
|
|
961
|
+
var frameDocument = hostIframe.contentDocument || hostIframe.contentWindow.document;
|
|
962
|
+
frameDocument.body.style.margin = '0';
|
|
963
|
+
frameDocument.head.appendChild(style);
|
|
964
|
+
frameDocument.body.appendChild(modal);
|
|
965
|
+
|
|
966
|
+
// closePreCheckoutModal() calls modal.remove(); make that tear down the host iframe too.
|
|
967
|
+
modal.remove = function () {
|
|
968
|
+
return hostIframe.remove();
|
|
969
|
+
};
|
|
970
|
+
} else {
|
|
971
|
+
document.body.appendChild(style);
|
|
972
|
+
document.body.appendChild(modal);
|
|
973
|
+
}
|
|
974
|
+
// === END TEMP ===
|
|
975
|
+
|
|
950
976
|
return modal;
|
|
951
977
|
}
|
|
952
978
|
function getPreCheckoutModalCloseButton(modal) {
|
package/es/inline.js
CHANGED
|
@@ -942,8 +942,34 @@ function mountPreCheckoutModal(id, transaction) {
|
|
|
942
942
|
content.appendChild(wrapper);
|
|
943
943
|
var style = document.createElement('style');
|
|
944
944
|
style.textContent = preCheckoutModalCSS;
|
|
945
|
-
|
|
946
|
-
|
|
945
|
+
|
|
946
|
+
// === TEMP (test): render the precheckout modal inside an iframe for ONE merchant — revert before commit ===
|
|
947
|
+
// Only the merchant whose request_inline response carries this merchant_id gets the iframe
|
|
948
|
+
// treatment; every other merchant keeps the original behaviour (modal appended to document.body).
|
|
949
|
+
var IFRAME_MODAL_MERCHANT_ID = 550652; // target merchant_id from the request inline response
|
|
950
|
+
var renderInIframe = transaction && String(transaction.merchant_id) === String(IFRAME_MODAL_MERCHANT_ID);
|
|
951
|
+
if (renderInIframe) {
|
|
952
|
+
// Host the modal + style in a full-viewport, same-origin (about:blank) iframe.
|
|
953
|
+
var hostIframe = document.createElement('iframe');
|
|
954
|
+
hostIframe.id = "pre-checkout-modal-iframe-".concat(id);
|
|
955
|
+
hostIframe.setAttribute('allow', 'payment');
|
|
956
|
+
hostIframe.style.cssText = ['position: fixed', 'top: 0', 'left: 0', 'width: 100%', 'height: 100%', 'border: 0', 'margin: 0', 'background: transparent', "z-index: ".concat(findHighestZIndex() + 1)].join(';');
|
|
957
|
+
document.body.appendChild(hostIframe);
|
|
958
|
+
var frameDocument = hostIframe.contentDocument || hostIframe.contentWindow.document;
|
|
959
|
+
frameDocument.body.style.margin = '0';
|
|
960
|
+
frameDocument.head.appendChild(style);
|
|
961
|
+
frameDocument.body.appendChild(modal);
|
|
962
|
+
|
|
963
|
+
// closePreCheckoutModal() calls modal.remove(); make that tear down the host iframe too.
|
|
964
|
+
modal.remove = function () {
|
|
965
|
+
return hostIframe.remove();
|
|
966
|
+
};
|
|
967
|
+
} else {
|
|
968
|
+
document.body.appendChild(style);
|
|
969
|
+
document.body.appendChild(modal);
|
|
970
|
+
}
|
|
971
|
+
// === END TEMP ===
|
|
972
|
+
|
|
947
973
|
return modal;
|
|
948
974
|
}
|
|
949
975
|
function getPreCheckoutModalCloseButton(modal) {
|
package/lib/inline.js
CHANGED
|
@@ -944,8 +944,34 @@ function mountPreCheckoutModal(id, transaction) {
|
|
|
944
944
|
content.appendChild(wrapper);
|
|
945
945
|
var style = document.createElement('style');
|
|
946
946
|
style.textContent = preCheckoutModalCSS;
|
|
947
|
-
|
|
948
|
-
|
|
947
|
+
|
|
948
|
+
// === TEMP (test): render the precheckout modal inside an iframe for ONE merchant — revert before commit ===
|
|
949
|
+
// Only the merchant whose request_inline response carries this merchant_id gets the iframe
|
|
950
|
+
// treatment; every other merchant keeps the original behaviour (modal appended to document.body).
|
|
951
|
+
var IFRAME_MODAL_MERCHANT_ID = 550652; // target merchant_id from the request inline response
|
|
952
|
+
var renderInIframe = transaction && String(transaction.merchant_id) === String(IFRAME_MODAL_MERCHANT_ID);
|
|
953
|
+
if (renderInIframe) {
|
|
954
|
+
// Host the modal + style in a full-viewport, same-origin (about:blank) iframe.
|
|
955
|
+
var hostIframe = document.createElement('iframe');
|
|
956
|
+
hostIframe.id = "pre-checkout-modal-iframe-".concat(id);
|
|
957
|
+
hostIframe.setAttribute('allow', 'payment');
|
|
958
|
+
hostIframe.style.cssText = ['position: fixed', 'top: 0', 'left: 0', 'width: 100%', 'height: 100%', 'border: 0', 'margin: 0', 'background: transparent', "z-index: ".concat(findHighestZIndex() + 1)].join(';');
|
|
959
|
+
document.body.appendChild(hostIframe);
|
|
960
|
+
var frameDocument = hostIframe.contentDocument || hostIframe.contentWindow.document;
|
|
961
|
+
frameDocument.body.style.margin = '0';
|
|
962
|
+
frameDocument.head.appendChild(style);
|
|
963
|
+
frameDocument.body.appendChild(modal);
|
|
964
|
+
|
|
965
|
+
// closePreCheckoutModal() calls modal.remove(); make that tear down the host iframe too.
|
|
966
|
+
modal.remove = function () {
|
|
967
|
+
return hostIframe.remove();
|
|
968
|
+
};
|
|
969
|
+
} else {
|
|
970
|
+
document.body.appendChild(style);
|
|
971
|
+
document.body.appendChild(modal);
|
|
972
|
+
}
|
|
973
|
+
// === END TEMP ===
|
|
974
|
+
|
|
949
975
|
return modal;
|
|
950
976
|
}
|
|
951
977
|
function getPreCheckoutModalCloseButton(modal) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paystack/inline-js",
|
|
3
|
-
"version": "2.23.0-dev.
|
|
3
|
+
"version": "2.23.0-dev.4",
|
|
4
4
|
"description": "Client-side library to load the Paystack checkout form",
|
|
5
5
|
"packageManager": "pnpm@10.33.4+sha512.1c67b3b359b2d408119ba1ed289f34b8fc3c6873412bec6fd264fbdc82489e510fcbecb9ce9d22dae7f3b76269d8441046014bdca53b9979cd7a561ad631b800",
|
|
6
6
|
"main": "lib/inline.js",
|