diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index da8cdadba..464d33658 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -26,7 +26,6 @@ Modify API_URI if you want test instance to use custom backend. CYPRESS_API_URI API_URI=https://automation-dashboard.staging.saleor.cloud/graphql/ APPS_MARKETPLACE_API_URI=https://apps.staging.saleor.io/api/v2/saleor-apps -SALEOR_APPS_ENDPOINT=https://apps.saleor.io/api/saleor-apps ### Do you want to run more stable tests? diff --git a/Dockerfile b/Dockerfile index b259bab27..43de0a992 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,9 +20,8 @@ COPY src/ src/ ARG API_URI ARG APP_MOUNT_URI -ARG APPS_MARKETPLACE_API_URI, -ARG APPS_TUNNEL_URL_KEYWORDS, -ARG SALEOR_APPS_ENDPOINT +ARG APPS_MARKETPLACE_API_URI +ARG APPS_TUNNEL_URL_KEYWORDS ARG STATIC_URL ARG SKIP_SOURCEMAPS @@ -30,7 +29,6 @@ ENV API_URI ${API_URI:-http://localhost:8000/graphql/} ENV APP_MOUNT_URI ${APP_MOUNT_URI:-/dashboard/} ENV APPS_MARKETPLACE_API_URI ${APPS_MARKETPLACE_API_URI:-https://apps.saleor.io/api/v2/saleor-apps} ENV APPS_TUNNEL_URL_KEYWORDS ${APPS_TUNNEL_URL_KEYWORDS} -ENV SALEOR_APPS_ENDPOINT=${SALEOR_APPS_ENDPOINT} ENV STATIC_URL ${STATIC_URL:-/dashboard/} ENV SKIP_SOURCEMAPS ${SKIP_SOURCEMAPS:-true} RUN npm run build diff --git a/locale/defaultMessages.json b/locale/defaultMessages.json index 3e8ad6c52..9f4dcef0b 100644 --- a/locale/defaultMessages.json +++ b/locale/defaultMessages.json @@ -3279,10 +3279,6 @@ "context": "collection", "string": "Not Published" }, - "M2dPzK": { - "context": "app template gallery section name", - "string": "App Templates Gallery" - }, "M6s/9e": { "context": "unassign country, dialog header", "string": "Remove from Shipping Zone" @@ -7780,10 +7776,6 @@ "context": "order total amount", "string": "Total" }, - "ti4Hqw": { - "context": "saleor marketplace section name", - "string": "Saleor Apps Marketplace" - }, "tlGXkh": { "context": "input description", "string": "Unlimited" diff --git a/src/components/Datagrid/RowActions.test.tsx b/src/components/Datagrid/RowActions.test.tsx index 8a78bab4f..0c9714034 100644 --- a/src/components/Datagrid/RowActions.test.tsx +++ b/src/components/Datagrid/RowActions.test.tsx @@ -60,7 +60,7 @@ describe("RowActions", () => { expect(screen.getByTestId("show-more-button")).toBeInTheDocument(); }); - it("should render card meu with multiple items", async () => { + it("should render card menu with multiple items", async () => { // Arrange render( diff --git a/src/components/Sidebar/menu/useMenuStructure.tsx b/src/components/Sidebar/menu/useMenuStructure.tsx index b18d94020..a4af46294 100644 --- a/src/components/Sidebar/menu/useMenuStructure.tsx +++ b/src/components/Sidebar/menu/useMenuStructure.tsx @@ -6,7 +6,6 @@ import { AppPaths } from "@dashboard/apps/urls"; import { useUser } from "@dashboard/auth"; import { categoryListUrl } from "@dashboard/categories/urls"; import { collectionListUrl } from "@dashboard/collections/urls"; -import { MARKETPLACE_URL } from "@dashboard/config"; import { configurationMenuUrl } from "@dashboard/configuration"; import { getConfigMenuItemsPermissions } from "@dashboard/configuration/utils"; import { customerListUrl } from "@dashboard/customers/urls"; @@ -14,7 +13,6 @@ import { saleListUrl, voucherListUrl } from "@dashboard/discounts/urls"; import { giftCardListUrl } from "@dashboard/giftCards/urls"; import { PermissionEnum } from "@dashboard/graphql"; import { commonMessages, sectionNames } from "@dashboard/intl"; -import { marketplaceUrlResolver } from "@dashboard/marketplace/marketplace-url-resolver"; import { orderDraftListUrl, orderListUrl } from "@dashboard/orders/urls"; import { pageListPath } from "@dashboard/pages/urls"; import { productListUrl } from "@dashboard/products/urls"; @@ -54,48 +52,14 @@ export function useMenuStructure() { paddingY: 4, }; - // This will be deleted when Marketplace is released - // Consider this solution as temporary - const getAppSection = (): SidebarMenuItem => { - if (MARKETPLACE_URL) { - return { - icon: , - label: intl.formatMessage(sectionNames.apps), - permissions: [PermissionEnum.MANAGE_APPS], - id: "apps_section", - type: "itemGroup", - children: [ - { - label: intl.formatMessage(sectionNames.apps), - id: "apps", - url: AppPaths.appListPath, - type: "item", - }, - { - label: intl.formatMessage(sectionNames.marketplace), - id: "marketplace-saleor-apps", - url: marketplaceUrlResolver.getSaleorAppsDashboardPath(), - type: "item", - }, - { - label: intl.formatMessage(sectionNames.appTemplateGallery), - id: "marketplace-template-gallery", - url: marketplaceUrlResolver.getTemplateGalleryDashboardPath(), - type: "item", - }, - ], - }; - } - - return { - icon: , - label: intl.formatMessage(sectionNames.apps), - permissions: [PermissionEnum.MANAGE_APPS], - id: "apps", - url: AppPaths.appListPath, - type: "item", - }; - }; + const getAppSection = (): SidebarMenuItem => ({ + icon: , + label: intl.formatMessage(sectionNames.apps), + permissions: [PermissionEnum.MANAGE_APPS], + id: "apps", + url: AppPaths.appListPath, + type: "item", + }); const menuItems: SidebarMenuItem[] = [ { diff --git a/src/config.ts b/src/config.ts index 1ad297458..bff7351d4 100644 --- a/src/config.ts +++ b/src/config.ts @@ -9,25 +9,6 @@ export const getApiUrl = () => window.__SALEOR_CONFIG__.API_URL; export const SW_INTERVAL = parseInt(process.env.SW_INTERVAL, 10) || 300; export const IS_CLOUD_INSTANCE = window.__SALEOR_CONFIG__.IS_CLOUD_INSTANCE === "true"; -/** - * @deprecated - */ -export const MARKETPLACE_URL = window.__SALEOR_CONFIG__.MARKETPLACE_URL; -/** - * @deprecated - */ -export const MARKETPLACE_SALEOR_APPS_PAGE_PATH = - window.__SALEOR_CONFIG__.SALEOR_APPS_PAGE_PATH; -/** - * @deprecated - */ -export const MARKETPLACE_SALEOR_APPS_JSON_PATH = - window.__SALEOR_CONFIG__.SALEOR_APPS_JSON_PATH; -/** - * @deprecated - */ -export const MARKETPLACE_APP_TEMPLATE_GALLERY_PATH = - window.__SALEOR_CONFIG__.APP_TEMPLATE_GALLERY_PATH; export const getAppsConfig = () => ({ marketplaceApiUri: window.__SALEOR_CONFIG__.APPS_MARKETPLACE_API_URI, diff --git a/src/index.html b/src/index.html index f217aec96..6b37aad83 100644 --- a/src/index.html +++ b/src/index.html @@ -17,10 +17,6 @@ window.__SALEOR_CONFIG__ = { API_URL: "<%= API_URL %>", APP_MOUNT_URI: "<%= APP_MOUNT_URI %>", - MARKETPLACE_URL: "<%= MARKETPLACE_URL %>", - SALEOR_APPS_PAGE_PATH: "<%= SALEOR_APPS_PAGE_PATH %>", - SALEOR_APPS_JSON_PATH: "<%= SALEOR_APPS_JSON_PATH %>", - APP_TEMPLATE_GALLERY_PATH: "<%= APP_TEMPLATE_GALLERY_PATH %>", APPS_MARKETPLACE_API_URI: "<%= APPS_MARKETPLACE_API_URI %>", APPS_TUNNEL_URL_KEYWORDS: "<%= APPS_TUNNEL_URL_KEYWORDS %>", IS_CLOUD_INSTANCE: "<%= IS_CLOUD_INSTANCE %>", diff --git a/src/index.tsx b/src/index.tsx index de774fb9c..a1a936026 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -56,8 +56,6 @@ import HomePage from "./home"; import { FlagsServiceProvider } from "./hooks/useFlags/flagsService"; import { useLocationState } from "./hooks/useLocationState"; import { commonMessages } from "./intl"; -import MarketplaceSection from "./marketplace"; -import { marketplaceUrl } from "./marketplace/urls"; import NavigationSection from "./navigation"; import { navigationSection } from "./navigation/urls"; import { NotFound } from "./NotFound"; @@ -285,11 +283,6 @@ const Routes: React.FC = () => { path={AppSections.appsSection} component={AppsSection} /> - path.replace(marketplaceUrl, ""); - -const Component = () => { - const classes = useStyles(); - const intl = useIntl(); - const navigate = useNavigator(); - const router = useRouter(); - - const marketplaceUrl = useMemo( - () => new URL(getDeepPath(router.location.pathname), MARKETPLACE_URL).href, - [router.location.pathname], - ); - - if (!marketplaceUrlResolver.checkMarketplaceConfigExists()) { - return navigate("/")} />; - } - - return ( - <> - - - - - - - ); -}; - -export default Component; diff --git a/src/marketplace/marketplace-url-resolver.test.ts b/src/marketplace/marketplace-url-resolver.test.ts deleted file mode 100644 index f65125698..000000000 --- a/src/marketplace/marketplace-url-resolver.test.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { MarketplaceUrlResolver } from "@dashboard/marketplace/marketplace-url-resolver"; - -describe("MarketplaceUrlResolver", function() { - it("Resolves deep marketplace url from full path", () => { - const resolver = new MarketplaceUrlResolver(); - - expect( - resolver.getMarketplaceDeepUrlFromPath("/marketplace/saleor-apps"), - ).toEqual("/saleor-apps"); - }); - - it("Generates full dashboard url that points to Marketplace - Saleor Apps", () => { - const resolver = new MarketplaceUrlResolver(); - - expect(resolver.getSaleorAppsDashboardPath()).toEqual( - "/marketplace/saleor-apps", - ); - }); - - it("Generates full dashboard url that points to Marketplace - App Template Gallery", () => { - const resolver = new MarketplaceUrlResolver(); - - expect(resolver.getTemplateGalleryDashboardPath()).toEqual( - "/marketplace/template-gallery", - ); - }); -}); diff --git a/src/marketplace/marketplace-url-resolver.ts b/src/marketplace/marketplace-url-resolver.ts deleted file mode 100644 index f8e6457fe..000000000 --- a/src/marketplace/marketplace-url-resolver.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { - MARKETPLACE_APP_TEMPLATE_GALLERY_PATH, - MARKETPLACE_SALEOR_APPS_JSON_PATH, - MARKETPLACE_SALEOR_APPS_PAGE_PATH, - MARKETPLACE_URL, -} from "@dashboard/config"; -import urlJoin from "url-join"; - -export class MarketplaceUrlResolver { - private rootSection = "/marketplace"; - - private marketplaceAppBaseUrl = MARKETPLACE_URL; - private saleorAppsPath = MARKETPLACE_SALEOR_APPS_PAGE_PATH; - private saleorAppsJsonPath = MARKETPLACE_SALEOR_APPS_JSON_PATH; - private templateGalleryJsonPath = MARKETPLACE_APP_TEMPLATE_GALLERY_PATH; - - checkMarketplaceConfigExists() { - return Boolean( - this.marketplaceAppBaseUrl && - this.saleorAppsPath && - this.saleorAppsJsonPath && - this.templateGalleryJsonPath, - ); - } - - getMarketplaceDeepUrlFromPath(path: string) { - return path.replace(this.rootSection, ""); - } - - getTemplateGalleryDashboardPath() { - return urlJoin(this.rootSection, MARKETPLACE_APP_TEMPLATE_GALLERY_PATH); - } - - getSaleorAppsDashboardPath() { - return urlJoin(this.rootSection, MARKETPLACE_SALEOR_APPS_PAGE_PATH); - } - - getSaleorAppsJsonEndpoint() { - return urlJoin(this.marketplaceAppBaseUrl, this.saleorAppsJsonPath); - } -} - -export const marketplaceUrlResolver = new MarketplaceUrlResolver(); diff --git a/src/marketplace/styles.ts b/src/marketplace/styles.ts deleted file mode 100644 index b4b7d1273..000000000 --- a/src/marketplace/styles.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { makeStyles } from "@saleor/macaw-ui"; - -const useStyles = makeStyles( - theme => ({ - iframe: { - height: "100vh", - position: "sticky", - }, - previewPill: { - marginBottom: theme.spacing(2), - }, - }), - { - name: "marketplaceStyles", - }, -); - -export { useStyles }; diff --git a/src/marketplace/urls.ts b/src/marketplace/urls.ts deleted file mode 100644 index b190437c6..000000000 --- a/src/marketplace/urls.ts +++ /dev/null @@ -1,3 +0,0 @@ -const marketplaceSection = "/marketplace/"; - -export const marketplaceUrl = marketplaceSection; diff --git a/src/storybook/preview-head.html b/src/storybook/preview-head.html index 9087812f1..fd15dd373 100644 --- a/src/storybook/preview-head.html +++ b/src/storybook/preview-head.html @@ -2,10 +2,6 @@ window.__SALEOR_CONFIG__ = { API_URL: "", APP_MOUNT_URI: "/", - MARKETPLACE_URL: "", - SALEOR_APPS_PAGE_PATH: "", - SALEOR_APPS_JSON_PATH: "", IS_CLOUD_INSTANCE: "", - APP_TEMPLATE_GALLERY_PATH: "", }; diff --git a/testUtils/setup.ts b/testUtils/setup.ts index 6b9b503f4..6a61385a2 100644 --- a/testUtils/setup.ts +++ b/testUtils/setup.ts @@ -23,10 +23,6 @@ document.createRange = () => { window.__SALEOR_CONFIG__ = { API_URL: "http://localhost:8000/graphql/", APP_MOUNT_URI: "/", - MARKETPLACE_URL: "http://localhost:3000", - SALEOR_APPS_PAGE_PATH: "/saleor-apps", - SALEOR_APPS_JSON_PATH: "/api/saleor-apps", - APP_TEMPLATE_GALLERY_PATH: "/template-gallery", APPS_MARKETPLACE_API_URI: "http://localhost:3000", APPS_TUNNEL_URL_KEYWORDS: ".ngrok.io;.saleor.live", IS_CLOUD_INSTANCE: "true", diff --git a/types.d.ts b/types.d.ts index 3cdfa03c0..6cfd3629f 100644 --- a/types.d.ts +++ b/types.d.ts @@ -14,10 +14,6 @@ declare interface Window { __SALEOR_CONFIG__: { API_URL: string; APP_MOUNT_URI: string; - MARKETPLACE_URL: string; - SALEOR_APPS_PAGE_PATH: string; - SALEOR_APPS_JSON_PATH: string; - APP_TEMPLATE_GALLERY_PATH: string; APPS_MARKETPLACE_API_URI?: string; APPS_TUNNEL_URL_KEYWORDS?: string; IS_CLOUD_INSTANCE?: string; diff --git a/vite.config.js b/vite.config.js index ba6e60d6b..8b3f9c3ce 100644 --- a/vite.config.js +++ b/vite.config.js @@ -28,11 +28,6 @@ export default defineConfig(({ command, mode }) => { API_URI, SW_INTERVAL, IS_CLOUD_INSTANCE, - /** - * @deprecated - */ - MARKETPLACE_URL, // To be removed - SALEOR_APPS_ENDPOINT, APP_MOUNT_URI, SENTRY_ORG, SENTRY_PROJECT, @@ -40,9 +35,6 @@ export default defineConfig(({ command, mode }) => { SENTRY_DSN, ENVIRONMENT, STATIC_URL, - SALEOR_APPS_PAGE_PATH, - SALEOR_APPS_JSON_PATH, - APP_TEMPLATE_GALLERY_PATH, APPS_MARKETPLACE_API_URI, APPS_TUNNEL_URL_KEYWORDS, SKIP_SOURCEMAPS, @@ -70,10 +62,6 @@ export default defineConfig(({ command, mode }) => { data: { API_URL: API_URI, APP_MOUNT_URI, - SALEOR_APPS_PAGE_PATH, - SALEOR_APPS_JSON_PATH, - APP_TEMPLATE_GALLERY_PATH, - MARKETPLACE_URL, APPS_MARKETPLACE_API_URI, APPS_TUNNEL_URL_KEYWORDS, IS_CLOUD_INSTANCE, @@ -162,8 +150,6 @@ export default defineConfig(({ command, mode }) => { API_URI, SW_INTERVAL, IS_CLOUD_INSTANCE, - MARKETPLACE_URL, - SALEOR_APPS_ENDPOINT, APP_MOUNT_URI, SENTRY_DSN, ENVIRONMENT,