From 3e0fdec3642a907d1f9c5796d044fb5b5b910ce6 Mon Sep 17 00:00:00 2001 From: Marija Date: Tue, 24 Oct 2023 13:12:54 +0200 Subject: [PATCH] Fix issues with store switcher ISSUE CS-4764 --- src/views/css/adyen-core.css | 4 +++- src/views/js/StateController.js | 20 +++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/views/css/adyen-core.css b/src/views/css/adyen-core.css index e6c54e84..611d6706 100644 --- a/src/views/css/adyen-core.css +++ b/src/views/css/adyen-core.css @@ -2796,10 +2796,12 @@ ul.adl-bullet-list li { max-width: 90%; flex-direction: column; align-items: center; - position: relative; + position: fixed; margin: 0 auto; box-shadow: 0 8px 8px rgba(0, 17, 44, 0.04), 0 2px 4px rgba(0, 17, 44, 0.08); border-radius: 12px; + top: 50vh; + transform: translateY(-50%); } #adl-page .adl-modal .adlp-modal-content .adlp-close-button { position: absolute; diff --git a/src/views/js/StateController.js b/src/views/js/StateController.js index d0b8845c..2a46c4c4 100644 --- a/src/views/js/StateController.js +++ b/src/views/js/StateController.js @@ -21,6 +21,7 @@ if (!window.AdyenFE) { * @property {string} stateUrl * @property {string} storesUrl * @property {string} currentStoreUrl + * @property {string} switchContextUrl * @property {string} connectionDetailsUrl * @property {string} merchantsUrl * @property {string} versionUrl @@ -288,10 +289,15 @@ if (!window.AdyenFE) { return Promise.resolve(true); }, (storeId) => { - setStoreId(storeId); - window.location.hash = ''; - this.enableSidebar(); - this.display(); + if (storeId !== getStoreId()) { + api.get(configuration.switchContextUrl.replace('{storeId}', storeId)).then( + /** @param {Store|Store[]} response */ + (response) => { + setStoreId(storeId); + location.reload(); + } + ); + } } ) ); @@ -362,9 +368,9 @@ if (!window.AdyenFE) { const container = templateService.getHeaderSection(); templateService.clearComponent(container); enabled && - container.append( - elementGenerator.createFlashMessage(['maintenance.title', 'maintenance.description'], 'warning') - ); + container.append( + elementGenerator.createFlashMessage(['maintenance.title', 'maintenance.description'], 'warning') + ); }; /**