From 90c7cf8f78c08cab01880481ab3c8841169d1cbe Mon Sep 17 00:00:00 2001 From: Marvin Muxfeld Date: Wed, 26 Jun 2024 13:23:13 +0200 Subject: [PATCH] PISHPS-293: added fallback for Shopware.Utils.dom.copyToClipboard if unavailable --- .../sw-order/view/sw-order-detail-general/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Resources/app/administration/src/module/mollie-payments/extension/sw-order/view/sw-order-detail-general/index.js b/src/Resources/app/administration/src/module/mollie-payments/extension/sw-order/view/sw-order-detail-general/index.js index f4aba23bf..bc8140c73 100644 --- a/src/Resources/app/administration/src/module/mollie-payments/extension/sw-order/view/sw-order-detail-general/index.js +++ b/src/Resources/app/administration/src/module/mollie-payments/extension/sw-order/view/sw-order-detail-general/index.js @@ -221,12 +221,20 @@ Component.override('sw-order-detail-general', { return orderAttributes.getCreditCardAttributes(); }, + + /** * */ copyPaymentUrlToClipboard() { + let fallback = async function(e) { + await navigator.clipboard.writeText(e) + }; + + // eslint-disable-next-line no-undef + let clipboard = typeof Shopware.Utils.dom.copyToClipboard === 'function' ? Shopware.Utils.dom.copyToClipboard : fallback; // eslint-disable-next-line no-undef - Shopware.Utils.dom.copyToClipboard(this.molliePaymentUrl); + clipboard(this.molliePaymentUrl); this.molliePaymentUrlCopied = true; },