From 9f49ef3286f1cfa654aee8e5751044e718d5d7d4 Mon Sep 17 00:00:00 2001 From: v-hansen Date: Tue, 19 Sep 2023 14:51:57 -0700 Subject: [PATCH 1/6] validate if locale as rootPath --- apps/vtex-my-subscriptions-3/manifest.json | 4 +++- .../react/components/DetailsPage/index.tsx | 3 ++- .../vtex-my-subscriptions-3/react/utils/pathUrl.ts | 14 ++++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 apps/vtex-my-subscriptions-3/react/utils/pathUrl.ts diff --git a/apps/vtex-my-subscriptions-3/manifest.json b/apps/vtex-my-subscriptions-3/manifest.json index 0c614c0c..e30c731f 100644 --- a/apps/vtex-my-subscriptions-3/manifest.json +++ b/apps/vtex-my-subscriptions-3/manifest.json @@ -11,7 +11,9 @@ "store": "0.x" }, "mustUpdateAt": "2019-04-02", - "registries": ["smartcheckout"], + "registries": [ + "smartcheckout" + ], "scripts": { "postreleasy": "vtex publish --verbose" }, diff --git a/apps/vtex-my-subscriptions-3/react/components/DetailsPage/index.tsx b/apps/vtex-my-subscriptions-3/react/components/DetailsPage/index.tsx index 4ff56fb4..c885acd7 100644 --- a/apps/vtex-my-subscriptions-3/react/components/DetailsPage/index.tsx +++ b/apps/vtex-my-subscriptions-3/react/components/DetailsPage/index.tsx @@ -5,6 +5,7 @@ import { graphql, MutationResult } from 'react-apollo' import { ApolloError } from 'apollo-client' import { withRouter, RouteComponentProps } from 'vtex.my-account-commons/Router' import { SubscriptionStatus } from 'vtex.subscriptions-graphql' +import pathUrl from '../../utils/pathUrl' import DETAILS_PAGE_QUERY, { Subscription, @@ -158,7 +159,7 @@ class SubscriptionsDetailsContainer extends Component { } return orderNow({ variables }) - .then(() => (window.location.href = '/checkout/')) + .then(() => (window.location.href = `${pathUrl()}/checkout/`)) .catch((error: ApolloError) => { logGraphQLError({ error, diff --git a/apps/vtex-my-subscriptions-3/react/utils/pathUrl.ts b/apps/vtex-my-subscriptions-3/react/utils/pathUrl.ts new file mode 100644 index 00000000..f5d35dfe --- /dev/null +++ b/apps/vtex-my-subscriptions-3/react/utils/pathUrl.ts @@ -0,0 +1,14 @@ +const pathUrl = () => { + let frontPart = '' + const { pathname} = window.location + const canonicalValues: string[] = ["af-ZA","sq-AL","ar-DZ","ar-BH","ar-EG","ar-IQ","ar-JO","ar-LB","ar-LY","ar-MA","ar-OM","ar-QA","ar-SA","ar-SY","ar-TN","ar-AE","ar-YE","hy-AM","az-AZ","eu-ES","be-BY","bn-IN","bs-BA","bg-BG","ca-ES","zh-CN","zh-HK","zh-MO","zh-SG","zh-TW","hr-HR","cs-CZ","da-DK","nl-BE","nl-NL","en-AU","en-BZ","en-CA","en-IE","en-JM","en-NZ","en-PH","en-ZA","en-TT","en-VI","en-GB","en-US","en-ZW","et-EE","fo-FO","fi-FI","fr-BE","fr-CA","fr-FR","fr-LU","fr-MC","fr-CH","gl-ES","ka-GE","de-AT","de-DE","de-LI","de-LU","de-CH","el-GR","gu-IN","he-IL","hi-IN","hu-HU","is-IS","id-ID","it-IT","it-CH","ja-JP","kn-IN","kk-KZ","kok-IN","ko-KR","lv-LV","lt-LT","mk-MK","ms-BN","ms-MY","ml-IN","mt-MT","mr-IN","mn-MN","se-NO","nb-NO","nn-NO","fa-IR","pl-PL","pt-BR","pt-PT","pa-IN","ro-RO","ru-RU","sr-BA","sr-CS","sk-SK","sl-SI","es-AR","es-BO","es-CL","es-CO","es-CR","es-DO","es-EC","es-SV","es-GT","es-HN","es-MX","es-NI","es-PA","es-PY","es-PE","es-PR","es-ES","es-UY","es-VE","sw-KE","sv-FI","sv-SE","ta-IN","te-IN","th-TH","tn-ZA","tr-TR","uk-UA","uz-UZ","vi-VN","cy-GB","xh-ZA"] + for (let i = 0; i < canonicalValues.length; i++) { + if (pathname?.includes(`/${canonicalValues[i]}`.toLowerCase())) { + frontPart = `/${canonicalValues[i]}` + } + } + return frontPart + +} + +export default pathUrl From 75fbff6a37fe37c55480bef1bfc2ee0c5f7ad57e Mon Sep 17 00:00:00 2001 From: v-hansen Date: Tue, 19 Sep 2023 15:21:56 -0700 Subject: [PATCH 2/6] lower case + manifest --- apps/vtex-my-subscriptions-3/manifest.json | 2 +- apps/vtex-my-subscriptions-3/react/utils/pathUrl.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/vtex-my-subscriptions-3/manifest.json b/apps/vtex-my-subscriptions-3/manifest.json index e30c731f..8d4ec6ce 100644 --- a/apps/vtex-my-subscriptions-3/manifest.json +++ b/apps/vtex-my-subscriptions-3/manifest.json @@ -1,7 +1,7 @@ { "vendor": "vtex", "name": "my-subscriptions", - "version": "3.15.5", + "version": "3.15.6-beta", "title": "MySubscriptions", "defaultLocale": "pt-BR", "description": "MySubscriptions app used used inside of the MyAccounts", diff --git a/apps/vtex-my-subscriptions-3/react/utils/pathUrl.ts b/apps/vtex-my-subscriptions-3/react/utils/pathUrl.ts index f5d35dfe..af3d7251 100644 --- a/apps/vtex-my-subscriptions-3/react/utils/pathUrl.ts +++ b/apps/vtex-my-subscriptions-3/react/utils/pathUrl.ts @@ -1,10 +1,10 @@ const pathUrl = () => { let frontPart = '' - const { pathname} = window.location + const { pathname } = window.location const canonicalValues: string[] = ["af-ZA","sq-AL","ar-DZ","ar-BH","ar-EG","ar-IQ","ar-JO","ar-LB","ar-LY","ar-MA","ar-OM","ar-QA","ar-SA","ar-SY","ar-TN","ar-AE","ar-YE","hy-AM","az-AZ","eu-ES","be-BY","bn-IN","bs-BA","bg-BG","ca-ES","zh-CN","zh-HK","zh-MO","zh-SG","zh-TW","hr-HR","cs-CZ","da-DK","nl-BE","nl-NL","en-AU","en-BZ","en-CA","en-IE","en-JM","en-NZ","en-PH","en-ZA","en-TT","en-VI","en-GB","en-US","en-ZW","et-EE","fo-FO","fi-FI","fr-BE","fr-CA","fr-FR","fr-LU","fr-MC","fr-CH","gl-ES","ka-GE","de-AT","de-DE","de-LI","de-LU","de-CH","el-GR","gu-IN","he-IL","hi-IN","hu-HU","is-IS","id-ID","it-IT","it-CH","ja-JP","kn-IN","kk-KZ","kok-IN","ko-KR","lv-LV","lt-LT","mk-MK","ms-BN","ms-MY","ml-IN","mt-MT","mr-IN","mn-MN","se-NO","nb-NO","nn-NO","fa-IR","pl-PL","pt-BR","pt-PT","pa-IN","ro-RO","ru-RU","sr-BA","sr-CS","sk-SK","sl-SI","es-AR","es-BO","es-CL","es-CO","es-CR","es-DO","es-EC","es-SV","es-GT","es-HN","es-MX","es-NI","es-PA","es-PY","es-PE","es-PR","es-ES","es-UY","es-VE","sw-KE","sv-FI","sv-SE","ta-IN","te-IN","th-TH","tn-ZA","tr-TR","uk-UA","uz-UZ","vi-VN","cy-GB","xh-ZA"] for (let i = 0; i < canonicalValues.length; i++) { if (pathname?.includes(`/${canonicalValues[i]}`.toLowerCase())) { - frontPart = `/${canonicalValues[i]}` + frontPart = `/${canonicalValues[i].toLowerCase()}` } } return frontPart From b76342e93a854fbab4940ae7ae3dcd5d73c87c8b Mon Sep 17 00:00:00 2001 From: v-hansen Date: Tue, 19 Sep 2023 15:22:43 -0700 Subject: [PATCH 3/6] Update manifest.json --- apps/vtex-my-subscriptions-3/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/vtex-my-subscriptions-3/manifest.json b/apps/vtex-my-subscriptions-3/manifest.json index 8d4ec6ce..0e67da52 100644 --- a/apps/vtex-my-subscriptions-3/manifest.json +++ b/apps/vtex-my-subscriptions-3/manifest.json @@ -1,7 +1,7 @@ { "vendor": "vtex", "name": "my-subscriptions", - "version": "3.15.6-beta", + "version": "3.15.6-beta.1", "title": "MySubscriptions", "defaultLocale": "pt-BR", "description": "MySubscriptions app used used inside of the MyAccounts", From 34573b460eb1021e37461721fc4294389b79abdd Mon Sep 17 00:00:00 2001 From: v-hansen Date: Tue, 19 Sep 2023 15:23:25 -0700 Subject: [PATCH 4/6] Update manifest.json --- apps/vtex-my-subscriptions-3/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/vtex-my-subscriptions-3/manifest.json b/apps/vtex-my-subscriptions-3/manifest.json index 0e67da52..e30c731f 100644 --- a/apps/vtex-my-subscriptions-3/manifest.json +++ b/apps/vtex-my-subscriptions-3/manifest.json @@ -1,7 +1,7 @@ { "vendor": "vtex", "name": "my-subscriptions", - "version": "3.15.6-beta.1", + "version": "3.15.5", "title": "MySubscriptions", "defaultLocale": "pt-BR", "description": "MySubscriptions app used used inside of the MyAccounts", From 7c794406b0b0443d0986b7cba980fe5d32d4076d Mon Sep 17 00:00:00 2001 From: v-hansen Date: Tue, 19 Sep 2023 19:13:25 -0700 Subject: [PATCH 5/6] Update en.json set actives to active --- apps/vtex-my-subscriptions-3/messages/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/vtex-my-subscriptions-3/messages/en.json b/apps/vtex-my-subscriptions-3/messages/en.json index 408d6e34..488cfc27 100644 --- a/apps/vtex-my-subscriptions-3/messages/en.json +++ b/apps/vtex-my-subscriptions-3/messages/en.json @@ -32,7 +32,7 @@ "subscription.notFound.title": "You don't have subscriptions yet", "subscription.notFound.text": "Subscribe your favorite products and always find them here", "subscription.list.display": "Display", - "subscription.list.display.active_filter": "Actives", + "subscription.list.display.active_filter": "Active", "subscription.list.display.canceled_filter": "Canceled", "subscription.list.button.seeDetails": "View details", "subscription.list.button.reactivate": "Reactivate Subscription", From 5f28424786bd839a50c8a68155363ae93fbdae16 Mon Sep 17 00:00:00 2001 From: v-hansen Date: Tue, 19 Sep 2023 19:14:18 -0700 Subject: [PATCH 6/6] Update ca.json --- apps/vtex-my-subscriptions-3/messages/ca.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/vtex-my-subscriptions-3/messages/ca.json b/apps/vtex-my-subscriptions-3/messages/ca.json index 9b7023da..8a875502 100644 --- a/apps/vtex-my-subscriptions-3/messages/ca.json +++ b/apps/vtex-my-subscriptions-3/messages/ca.json @@ -32,7 +32,7 @@ "subscription.notFound.title": "Encara no teniu cap subscripció", "subscription.notFound.text": "Afegiu els vostres productes preferits a la subscripció i trobeu-los sempre aquí", "subscription.list.display": "Visualització", - "subscription.list.display.active_filter": "Actives", + "subscription.list.display.active_filter": "Active", "subscription.list.display.canceled_filter": "Cancel·lades", "subscription.list.button.seeDetails": "Mostra'n els detalls", "subscription.list.button.reactivate": "Reactiva la subscripció",