From 69eed60ab4e3b0be43ec5bc737764a2294720e97 Mon Sep 17 00:00:00 2001 From: Vasilii Burlacu Date: Fri, 19 Feb 2021 13:59:46 +0200 Subject: [PATCH 01/13] #1617 - Fetch store name from the GraphQL server at compile time --- .../lib/queries/getStoreConfigData.graphql | 1 + packages/venia-concept/webpack.config.js | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/pwa-buildpack/lib/queries/getStoreConfigData.graphql b/packages/pwa-buildpack/lib/queries/getStoreConfigData.graphql index 67b9d5a0b9..3fa0ba80c0 100644 --- a/packages/pwa-buildpack/lib/queries/getStoreConfigData.graphql +++ b/packages/pwa-buildpack/lib/queries/getStoreConfigData.graphql @@ -5,5 +5,6 @@ query { code locale secure_base_media_url + store_name } } diff --git a/packages/venia-concept/webpack.config.js b/packages/venia-concept/webpack.config.js index 073e3a9dd9..b8c63d7fd6 100644 --- a/packages/venia-concept/webpack.config.js +++ b/packages/venia-concept/webpack.config.js @@ -45,8 +45,18 @@ module.exports = async env => { const storeConfigData = await getStoreConfigData(); const { availableStores } = await getAvailableStoresConfigData(); + /** + * Loop the available stores when there is provided STORE_VIEW_CODE + * in the .env file, because should set the store name from the + * given store code instead of the default one. + */ + const availableStore = process.env.STORE_VIEW_CODE + ? availableStores.find(store => store.code === process.env.STORE_VIEW_CODE) + : undefined; + global.MAGENTO_MEDIA_BACKEND_URL = mediaUrl; global.LOCALE = storeConfigData.locale.replace('_', '-'); + global.STORE_NAME = storeConfigData.store_name; global.AVAILABLE_STORE_VIEWS = availableStores; const possibleTypes = await getPossibleTypes(); @@ -63,7 +73,9 @@ module.exports = async env => { * the globals object in jest.config.js. */ POSSIBLE_TYPES: JSON.stringify(possibleTypes), - STORE_NAME: JSON.stringify('Venia'), + STORE_NAME: process.env.STORE_VIEW_CODE && availableStore + ? JSON.stringify(availableStore.store_name) + : JSON.stringify(global.STORE_NAME), STORE_VIEW_CODE: process.env.STORE_VIEW_CODE ? JSON.stringify(process.env.STORE_VIEW_CODE) : JSON.stringify(storeConfigData.code), From 2bc69aed7d028706f719c6df87979f78c0808a70 Mon Sep 17 00:00:00 2001 From: Vasilii Burlacu Date: Fri, 19 Feb 2021 19:38:41 +0200 Subject: [PATCH 02/13] format the code with prettier --- packages/venia-concept/webpack.config.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/venia-concept/webpack.config.js b/packages/venia-concept/webpack.config.js index b8c63d7fd6..a5990cca63 100644 --- a/packages/venia-concept/webpack.config.js +++ b/packages/venia-concept/webpack.config.js @@ -51,7 +51,9 @@ module.exports = async env => { * given store code instead of the default one. */ const availableStore = process.env.STORE_VIEW_CODE - ? availableStores.find(store => store.code === process.env.STORE_VIEW_CODE) + ? availableStores.find( + store => store.code === process.env.STORE_VIEW_CODE + ) : undefined; global.MAGENTO_MEDIA_BACKEND_URL = mediaUrl; @@ -73,9 +75,10 @@ module.exports = async env => { * the globals object in jest.config.js. */ POSSIBLE_TYPES: JSON.stringify(possibleTypes), - STORE_NAME: process.env.STORE_VIEW_CODE && availableStore - ? JSON.stringify(availableStore.store_name) - : JSON.stringify(global.STORE_NAME), + STORE_NAME: + process.env.STORE_VIEW_CODE && availableStore + ? JSON.stringify(availableStore.store_name) + : JSON.stringify(global.STORE_NAME), STORE_VIEW_CODE: process.env.STORE_VIEW_CODE ? JSON.stringify(process.env.STORE_VIEW_CODE) : JSON.stringify(storeConfigData.code), From 71e9263e758aa324dceea46861d45167b98c14fe Mon Sep 17 00:00:00 2001 From: Vasilii Burlacu Date: Sat, 20 Feb 2021 15:12:37 +0200 Subject: [PATCH 03/13] remove unnecessary declarations --- packages/venia-concept/webpack.config.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/venia-concept/webpack.config.js b/packages/venia-concept/webpack.config.js index a5990cca63..39dd3f6d6f 100644 --- a/packages/venia-concept/webpack.config.js +++ b/packages/venia-concept/webpack.config.js @@ -58,7 +58,6 @@ module.exports = async env => { global.MAGENTO_MEDIA_BACKEND_URL = mediaUrl; global.LOCALE = storeConfigData.locale.replace('_', '-'); - global.STORE_NAME = storeConfigData.store_name; global.AVAILABLE_STORE_VIEWS = availableStores; const possibleTypes = await getPossibleTypes(); @@ -78,7 +77,7 @@ module.exports = async env => { STORE_NAME: process.env.STORE_VIEW_CODE && availableStore ? JSON.stringify(availableStore.store_name) - : JSON.stringify(global.STORE_NAME), + : JSON.stringify(storeConfigData.store_name), STORE_VIEW_CODE: process.env.STORE_VIEW_CODE ? JSON.stringify(process.env.STORE_VIEW_CODE) : JSON.stringify(storeConfigData.code), From 139b25178bba811f7c7a0d54d303d24d3bd84eba Mon Sep 17 00:00:00 2001 From: Vasilii Burlacu Date: Mon, 22 Feb 2021 08:26:22 +0200 Subject: [PATCH 04/13] Simplify the process of finding the available store Co-authored-by: Stephen --- packages/venia-concept/webpack.config.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/venia-concept/webpack.config.js b/packages/venia-concept/webpack.config.js index 39dd3f6d6f..b4878ede44 100644 --- a/packages/venia-concept/webpack.config.js +++ b/packages/venia-concept/webpack.config.js @@ -50,11 +50,7 @@ module.exports = async env => { * in the .env file, because should set the store name from the * given store code instead of the default one. */ - const availableStore = process.env.STORE_VIEW_CODE - ? availableStores.find( - store => store.code === process.env.STORE_VIEW_CODE - ) - : undefined; + const availableStore = availableStore.find({ code } => code === process.env.STORE_VIEW_CODE); global.MAGENTO_MEDIA_BACKEND_URL = mediaUrl; global.LOCALE = storeConfigData.locale.replace('_', '-'); From ee64ffb57cc215503f36b686f4d9a7e3007f74c4 Mon Sep 17 00:00:00 2001 From: Vasilii Burlacu Date: Mon, 22 Feb 2021 08:27:13 +0200 Subject: [PATCH 05/13] Simplify the assignment of current store name Co-authored-by: Stephen --- packages/venia-concept/webpack.config.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/venia-concept/webpack.config.js b/packages/venia-concept/webpack.config.js index b4878ede44..1707162531 100644 --- a/packages/venia-concept/webpack.config.js +++ b/packages/venia-concept/webpack.config.js @@ -70,8 +70,7 @@ module.exports = async env => { * the globals object in jest.config.js. */ POSSIBLE_TYPES: JSON.stringify(possibleTypes), - STORE_NAME: - process.env.STORE_VIEW_CODE && availableStore + STORE_NAME: availableStore ? JSON.stringify(availableStore.store_name) : JSON.stringify(storeConfigData.store_name), STORE_VIEW_CODE: process.env.STORE_VIEW_CODE From 9bb320e43a3fac3a180fe6fd076424c257ed3600 Mon Sep 17 00:00:00 2001 From: Stephen Date: Mon, 22 Feb 2021 10:07:23 -0600 Subject: [PATCH 06/13] Fix destructure syntax --- packages/venia-concept/webpack.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/venia-concept/webpack.config.js b/packages/venia-concept/webpack.config.js index 1707162531..f03ce06aa9 100644 --- a/packages/venia-concept/webpack.config.js +++ b/packages/venia-concept/webpack.config.js @@ -50,7 +50,7 @@ module.exports = async env => { * in the .env file, because should set the store name from the * given store code instead of the default one. */ - const availableStore = availableStore.find({ code } => code === process.env.STORE_VIEW_CODE); + const availableStore = availableStore.find(({ code }) => code === process.env.STORE_VIEW_CODE); global.MAGENTO_MEDIA_BACKEND_URL = mediaUrl; global.LOCALE = storeConfigData.locale.replace('_', '-'); From 30782a0f5a0758cdf43ffd46adced066080a728f Mon Sep 17 00:00:00 2001 From: Stephen Date: Mon, 22 Feb 2021 10:36:38 -0600 Subject: [PATCH 07/13] prettier --- packages/venia-concept/webpack.config.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/venia-concept/webpack.config.js b/packages/venia-concept/webpack.config.js index f03ce06aa9..9541e74ec3 100644 --- a/packages/venia-concept/webpack.config.js +++ b/packages/venia-concept/webpack.config.js @@ -50,7 +50,9 @@ module.exports = async env => { * in the .env file, because should set the store name from the * given store code instead of the default one. */ - const availableStore = availableStore.find(({ code }) => code === process.env.STORE_VIEW_CODE); + const availableStore = availableStore.find( + ({ code }) => code === process.env.STORE_VIEW_CODE + ); global.MAGENTO_MEDIA_BACKEND_URL = mediaUrl; global.LOCALE = storeConfigData.locale.replace('_', '-'); @@ -71,8 +73,8 @@ module.exports = async env => { */ POSSIBLE_TYPES: JSON.stringify(possibleTypes), STORE_NAME: availableStore - ? JSON.stringify(availableStore.store_name) - : JSON.stringify(storeConfigData.store_name), + ? JSON.stringify(availableStore.store_name) + : JSON.stringify(storeConfigData.store_name), STORE_VIEW_CODE: process.env.STORE_VIEW_CODE ? JSON.stringify(process.env.STORE_VIEW_CODE) : JSON.stringify(storeConfigData.code), From f3b36a5192b2ca0b3e90b0ce1d3e1ef4d644130b Mon Sep 17 00:00:00 2001 From: Revanth Kumar Annavarapu <35203638+revanth0212@users.noreply.github.com> Date: Mon, 22 Feb 2021 11:20:34 -0600 Subject: [PATCH 08/13] availableStore -> availableStores --- packages/venia-concept/webpack.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/venia-concept/webpack.config.js b/packages/venia-concept/webpack.config.js index 9541e74ec3..2da7fe3cef 100644 --- a/packages/venia-concept/webpack.config.js +++ b/packages/venia-concept/webpack.config.js @@ -50,7 +50,7 @@ module.exports = async env => { * in the .env file, because should set the store name from the * given store code instead of the default one. */ - const availableStore = availableStore.find( + const availableStore = availableStores.find( ({ code }) => code === process.env.STORE_VIEW_CODE ); From 22122c87361699c615f23cd227c51c058d3d0fa6 Mon Sep 17 00:00:00 2001 From: sirugh Date: Thu, 25 Feb 2021 14:35:23 -0600 Subject: [PATCH 09/13] Use runtime store name fetch in a new TitleWithStore component. Signed-off-by: sirugh --- .../i18n/fr_FR.json | 10 ++--- .../Category/useCategoryContent.js | 5 --- packages/venia-concept/template.html | 2 - packages/venia-ui/i18n/en_US.json | 10 ++--- .../venia-ui/lib/RootComponents/CMS/cms.js | 4 +- .../Category/categoryContent.js | 5 +-- .../lib/RootComponents/Product/product.js | 7 +--- .../accountInformationPage.js | 17 ++++----- .../AddressBookPage/addressBookPage.js | 6 +-- packages/venia-ui/lib/components/App/app.js | 6 +-- .../lib/components/CartPage/cartPage.js | 17 ++++----- .../orderConfirmationPage.js | 17 ++++----- .../components/CheckoutPage/checkoutPage.js | 17 ++++----- .../CommunicationsPage/communicationsPage.js | 15 +++----- .../venia-ui/lib/components/Head/index.js | 38 ++++++++++++++++++- .../MyAccount/ResetPassword/resetPassword.js | 7 +--- .../OrderHistoryPage/orderHistoryPage.js | 7 +--- .../SavedPaymentsPage/savedPaymentsPage.js | 4 +- .../modify-site-footer/index.md | 6 +-- 19 files changed, 101 insertions(+), 99 deletions(-) diff --git a/packages/extensions/venia-sample-language-packs/i18n/fr_FR.json b/packages/extensions/venia-sample-language-packs/i18n/fr_FR.json index 3b225139c3..b12d23ce99 100644 --- a/packages/extensions/venia-sample-language-packs/i18n/fr_FR.json +++ b/packages/extensions/venia-sample-language-packs/i18n/fr_FR.json @@ -5,7 +5,7 @@ "accountInformationPage.accountInformation": "Informations sur le compte", "accountInformationPage.editAccount": "Modifier les informations du compte", "accountInformationPage.errorTryAgain": "Un problème est survenu. Veuillez actualiser et réessayer.", - "accountInformationPage.titleAccount": "Information sur le compte - {name}", + "accountInformationPage.titleAccount": "Information sur le compte", "accountMenu.accountInfoLink": "Information sur le compte", "accountMenu.addressBookLink": "Carnet d'adresses", "accountMenu.communicationsLink": "Les communications", @@ -39,7 +39,7 @@ "cartPage.emptyCart": "Il n'y a aucun article dans votre panier.", "cartPage.heading": "Panier", "cartPage.signIn": "Se connecter", - "cartPage.title": "Panier - {name}", + "cartPage.title": "Panier", "cartTrigger.ariaLabel": "Basculer le mini-panier. Vous avez {count} articles dans votre panier.", "categoryContent.filter": "Filtre", "categoryContent.itemsSortedBy": "Articles triés par ", @@ -88,8 +88,8 @@ "checkoutPage.stockStatusMessage": "Un article de votre panier est actuellement en rupture de stock et doit être retiré pour pouvoir passer à la caisse. Veuillez retourner à votre panier pour retirer l'article.", "checkoutPage.subscribe": "Abonnez-vous aux nouvelles et mises à jour", "checkoutPage.thankYou": "Nous vous remercions de votre commande!", - "checkoutPage.titleCheckout": "Paiement - {name}", - "checkoutPage.titleReceipt": "Le reçu - {name}", + "checkoutPage.titleCheckout": "Paiement", + "checkoutPage.titleReceipt": "Le reçu", "cms.shopByCategory": "Acheter par catégorie", "cmsBlock.noBlocks": "Il n'y a aucun bloc à afficher", "communicationsPage.changesText": "Sauvegarder les modifications", @@ -99,7 +99,7 @@ "communicationsPage.preferencesText": "Vos préférences ont été mises à jour.", "communicationsPage.savingText": "Économie", "communicationsPage.subscribeText": "Restez à la pointe de la mode; abonnez-vous à la newsletter mensuelle de Venia.", - "communicationsPage.title": "Les Communications - {name}", + "communicationsPage.title": "Les Communications", "completedView.errorLoading": "Erreur lors du chargement de la méthode d'expédition sélectionnée. Veuillez sélectionner à nouveau.", "completedView.shippingMethod": "Méthode d'expédition", "Contact Us": "Nous contacter", diff --git a/packages/peregrine/lib/talons/RootComponents/Category/useCategoryContent.js b/packages/peregrine/lib/talons/RootComponents/Category/useCategoryContent.js index 481889a646..49074e932a 100644 --- a/packages/peregrine/lib/talons/RootComponents/Category/useCategoryContent.js +++ b/packages/peregrine/lib/talons/RootComponents/Category/useCategoryContent.js @@ -68,10 +68,6 @@ export const useCategoryContent = props => { : null; const categoryName = data ? data.category.name : null; const categoryDescription = data ? data.category.description : null; - // Note: STORE_NAME is injected by Webpack at build time. - const pageTitle = categoryName - ? `${categoryName} - ${STORE_NAME}` - : STORE_NAME; return { categoryName, @@ -81,7 +77,6 @@ export const useCategoryContent = props => { handleOpenFilters, items, loadFilters, - pageTitle, totalPagesFromData }; }; diff --git a/packages/venia-concept/template.html b/packages/venia-concept/template.html index 86fd9c4915..35979b00b5 100644 --- a/packages/venia-concept/template.html +++ b/packages/venia-concept/template.html @@ -7,8 +7,6 @@ - <%= STORE_NAME %> -