Change Vercel deployment button to fork on github button (#3119)
* Change vercel deployment button to fork on github button * Extract translations
This commit is contained in:
parent
98ad73acdc
commit
477de5c3dc
12 changed files with 109 additions and 111 deletions
|
@ -6771,10 +6771,6 @@
|
||||||
"oYGfnY": {
|
"oYGfnY": {
|
||||||
"string": "ZIP / Postal code"
|
"string": "ZIP / Postal code"
|
||||||
},
|
},
|
||||||
"ohQrzn": {
|
|
||||||
"context": "button",
|
|
||||||
"string": "Deploy to Vercel"
|
|
||||||
},
|
|
||||||
"oiuwOl": {
|
"oiuwOl": {
|
||||||
"context": "button",
|
"context": "button",
|
||||||
"string": "Assign"
|
"string": "Assign"
|
||||||
|
@ -8176,6 +8172,10 @@
|
||||||
"context": "header",
|
"context": "header",
|
||||||
"string": "Translation Sale \"{saleName}\" - {languageCode}"
|
"string": "Translation Sale \"{saleName}\" - {languageCode}"
|
||||||
},
|
},
|
||||||
|
"zmnGkp": {
|
||||||
|
"context": "button",
|
||||||
|
"string": "Fork on GitHub"
|
||||||
|
},
|
||||||
"znbVYT": {
|
"znbVYT": {
|
||||||
"context": "product available for purchase date",
|
"context": "product available for purchase date",
|
||||||
"string": "Will become available on {date}"
|
"string": "Will become available on {date}"
|
||||||
|
|
|
@ -11,14 +11,14 @@ interface AllAppListProps {
|
||||||
appList?: GetV2SaleorAppsResponse.SaleorApp[];
|
appList?: GetV2SaleorAppsResponse.SaleorApp[];
|
||||||
appInstallationList?: AppInstallationFragment[];
|
appInstallationList?: AppInstallationFragment[];
|
||||||
navigateToAppInstallPage?: (manifestUrl: string) => void;
|
navigateToAppInstallPage?: (manifestUrl: string) => void;
|
||||||
navigateToVercelDeploymentPage?: (vercelDeploymentUrl: string) => void;
|
navigateToGithubForkPage?: (githubForkUrl: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const AllAppList: React.FC<AllAppListProps> = ({
|
const AllAppList: React.FC<AllAppListProps> = ({
|
||||||
appList,
|
appList,
|
||||||
appInstallationList,
|
appInstallationList,
|
||||||
navigateToAppInstallPage,
|
navigateToAppInstallPage,
|
||||||
navigateToVercelDeploymentPage,
|
navigateToGithubForkPage,
|
||||||
}) => {
|
}) => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ const AllAppList: React.FC<AllAppListProps> = ({
|
||||||
appInstallationList,
|
appInstallationList,
|
||||||
)}
|
)}
|
||||||
navigateToAppInstallPage={navigateToAppInstallPage}
|
navigateToAppInstallPage={navigateToAppInstallPage}
|
||||||
navigateToVercelDeploymentPage={navigateToVercelDeploymentPage}
|
navigateToGithubForkPage={navigateToGithubForkPage}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -64,14 +64,14 @@ describe("Apps AppListCard", () => {
|
||||||
<AppListCard
|
<AppListCard
|
||||||
app={releasedApp}
|
app={releasedApp}
|
||||||
navigateToAppInstallPage={navigateToAppInstallPage}
|
navigateToAppInstallPage={navigateToAppInstallPage}
|
||||||
navigateToVercelDeploymentPage={navigateToVercelDeploymentPage}
|
navigateToGithubForkPage={navigateToVercelDeploymentPage}
|
||||||
/>
|
/>
|
||||||
</Wrapper>,
|
</Wrapper>,
|
||||||
);
|
);
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
const installButton = screen.getByTestId("app-install-button");
|
const installButton = screen.getByTestId("app-install-button");
|
||||||
const deployToVercelButton = screen.getByTestId(
|
const deployToVercelButton = screen.getByTestId(
|
||||||
"app-deploy-to-vercel-button",
|
"app-fork-on-github-button",
|
||||||
);
|
);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|
|
@ -16,14 +16,14 @@ interface AppListCardProps {
|
||||||
app: GetV2SaleorAppsResponse.SaleorApp;
|
app: GetV2SaleorAppsResponse.SaleorApp;
|
||||||
appInstallation?: AppInstallationFragment;
|
appInstallation?: AppInstallationFragment;
|
||||||
navigateToAppInstallPage?: (manifestUrl: string) => void;
|
navigateToAppInstallPage?: (manifestUrl: string) => void;
|
||||||
navigateToVercelDeploymentPage?: (vercelDeploymentUrl: string) => void;
|
navigateToGithubForkPage?: (githubForkUrl: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const AppListCard: React.FC<AppListCardProps> = ({
|
const AppListCard: React.FC<AppListCardProps> = ({
|
||||||
app,
|
app,
|
||||||
appInstallation,
|
appInstallation,
|
||||||
navigateToAppInstallPage,
|
navigateToAppInstallPage,
|
||||||
navigateToVercelDeploymentPage,
|
navigateToGithubForkPage,
|
||||||
}) => {
|
}) => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
@ -34,7 +34,7 @@ const AppListCard: React.FC<AppListCardProps> = ({
|
||||||
app,
|
app,
|
||||||
appInstallation,
|
appInstallation,
|
||||||
navigateToAppInstallPage,
|
navigateToAppInstallPage,
|
||||||
navigateToVercelDeploymentPage,
|
navigateToGithubForkPage,
|
||||||
retryAppInstallation,
|
retryAppInstallation,
|
||||||
removeAppInstallation,
|
removeAppInstallation,
|
||||||
});
|
});
|
||||||
|
@ -51,7 +51,7 @@ const AppListCard: React.FC<AppListCardProps> = ({
|
||||||
releaseDate={details.releaseDate}
|
releaseDate={details.releaseDate}
|
||||||
installationPending={details.installationPending}
|
installationPending={details.installationPending}
|
||||||
installHandler={details.installHandler}
|
installHandler={details.installHandler}
|
||||||
vercelDeployHandler={details.vercelDeployHandler}
|
githubForkHandler={details.githubForkHandler}
|
||||||
retryInstallHandler={details.retryInstallHandler}
|
retryInstallHandler={details.retryInstallHandler}
|
||||||
removeInstallHandler={details.removeInstallHandler}
|
removeInstallHandler={details.removeInstallHandler}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -16,7 +16,7 @@ interface AppListCardActionsProps {
|
||||||
installationPending?: boolean;
|
installationPending?: boolean;
|
||||||
appInstallation?: AppInstallationFragment;
|
appInstallation?: AppInstallationFragment;
|
||||||
installHandler?: () => void;
|
installHandler?: () => void;
|
||||||
vercelDeployHandler?: () => void;
|
githubForkHandler?: () => void;
|
||||||
retryInstallHandler?: () => void;
|
retryInstallHandler?: () => void;
|
||||||
removeInstallHandler?: () => void;
|
removeInstallHandler?: () => void;
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ const AppListCardActions: React.FC<AppListCardActionsProps> = ({
|
||||||
installationPending = false,
|
installationPending = false,
|
||||||
appInstallation,
|
appInstallation,
|
||||||
installHandler,
|
installHandler,
|
||||||
vercelDeployHandler,
|
githubForkHandler,
|
||||||
retryInstallHandler,
|
retryInstallHandler,
|
||||||
removeInstallHandler,
|
removeInstallHandler,
|
||||||
}) => {
|
}) => {
|
||||||
|
@ -34,7 +34,7 @@ const AppListCardActions: React.FC<AppListCardActionsProps> = ({
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!installHandler &&
|
!installHandler &&
|
||||||
!vercelDeployHandler &&
|
!githubForkHandler &&
|
||||||
!releaseDate &&
|
!releaseDate &&
|
||||||
!retryInstallHandler &&
|
!retryInstallHandler &&
|
||||||
!removeInstallHandler &&
|
!removeInstallHandler &&
|
||||||
|
@ -47,13 +47,13 @@ const AppListCardActions: React.FC<AppListCardActionsProps> = ({
|
||||||
<>
|
<>
|
||||||
<Hr />
|
<Hr />
|
||||||
<CardActions className={classes.cardActions}>
|
<CardActions className={classes.cardActions}>
|
||||||
{vercelDeployHandler && (
|
{githubForkHandler && (
|
||||||
<Button
|
<Button
|
||||||
variant="secondary"
|
variant="secondary"
|
||||||
onClick={vercelDeployHandler}
|
onClick={githubForkHandler}
|
||||||
data-test-id="app-deploy-to-vercel-button"
|
data-test-id="app-fork-on-github-button"
|
||||||
>
|
>
|
||||||
<FormattedMessage {...messages.deployToVercel} />
|
<FormattedMessage {...messages.forkOnGithub} />
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
{installHandler && (
|
{installHandler && (
|
||||||
|
|
|
@ -6,9 +6,9 @@ export const messages = defineMessages({
|
||||||
defaultMessage: "Integrations",
|
defaultMessage: "Integrations",
|
||||||
description: "header",
|
description: "header",
|
||||||
},
|
},
|
||||||
deployToVercel: {
|
forkOnGithub: {
|
||||||
id: "ohQrzn",
|
id: "zmnGkp",
|
||||||
defaultMessage: "Deploy to Vercel",
|
defaultMessage: "Fork on GitHub",
|
||||||
description: "button",
|
description: "button",
|
||||||
},
|
},
|
||||||
releaseComingSoon: {
|
releaseComingSoon: {
|
||||||
|
|
|
@ -67,12 +67,9 @@ export const AppListPage: React.FC<AppListPageProps> = props => {
|
||||||
[navigate],
|
[navigate],
|
||||||
);
|
);
|
||||||
|
|
||||||
const navigateToVercelDeploymentPage = useCallback(
|
const navigateToGithubForkPage = useCallback((githubForkUrl: string) => {
|
||||||
(vercelDeploymentUrl: string) => {
|
window.open(githubForkUrl, "_blank");
|
||||||
window.open(vercelDeploymentUrl, "_blank");
|
}, []);
|
||||||
},
|
|
||||||
[],
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
|
@ -110,7 +107,7 @@ export const AppListPage: React.FC<AppListPageProps> = props => {
|
||||||
appList={verifiedInstallableMarketplaceApps}
|
appList={verifiedInstallableMarketplaceApps}
|
||||||
appInstallationList={appsInstallations}
|
appInstallationList={appsInstallations}
|
||||||
navigateToAppInstallPage={navigateToAppInstallPage}
|
navigateToAppInstallPage={navigateToAppInstallPage}
|
||||||
navigateToVercelDeploymentPage={navigateToVercelDeploymentPage}
|
navigateToGithubForkPage={navigateToGithubForkPage}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import {
|
||||||
installedAppsList,
|
installedAppsList,
|
||||||
releasedApp,
|
releasedApp,
|
||||||
} from "@dashboard/new-apps/fixtures";
|
} from "@dashboard/new-apps/fixtures";
|
||||||
|
import { GetV2SaleorAppsResponse } from "@dashboard/new-apps/marketplace.types";
|
||||||
|
|
||||||
import { AppListPageSections } from "./types";
|
import { AppListPageSections } from "./types";
|
||||||
import {
|
import {
|
||||||
|
@ -210,26 +211,27 @@ describe("App List verified installed apps util", () => {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const installableMarketplaceApps = [
|
const installableMarketplaceApps: GetV2SaleorAppsResponse.ReleasedSaleorApp[] =
|
||||||
{
|
[
|
||||||
name: {
|
{
|
||||||
en: "Test app",
|
name: {
|
||||||
|
en: "Test app",
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
en: "Test app description",
|
||||||
|
},
|
||||||
|
logo: {
|
||||||
|
source: "https://www.example.com/logo",
|
||||||
|
color: "#000000",
|
||||||
|
},
|
||||||
|
integrations: [],
|
||||||
|
manifestUrl: "https://www.example.com/manifest",
|
||||||
|
privacyUrl: "https://www.example.com/privacy",
|
||||||
|
supportUrl: "https://www.example.com/support",
|
||||||
|
repositoryUrl: "https://www.example.com/repository",
|
||||||
|
githubForkUrl: "https://www.example.com/repository/fork",
|
||||||
},
|
},
|
||||||
description: {
|
];
|
||||||
en: "Test app description",
|
|
||||||
},
|
|
||||||
logo: {
|
|
||||||
source: "https://www.example.com/logo",
|
|
||||||
color: "#000000",
|
|
||||||
},
|
|
||||||
integrations: [],
|
|
||||||
manifestUrl: "https://www.example.com/manifest",
|
|
||||||
privacyUrl: "https://www.example.com/privacy",
|
|
||||||
supportUrl: "https://www.example.com/support",
|
|
||||||
repositoryUrl: "https://www.example.com/repository",
|
|
||||||
vercelDeploymentUrl: "https://www.example.com/deployment",
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const verifiedInstalledApps = getVerifiedInstalledApps(
|
const verifiedInstalledApps = getVerifiedInstalledApps(
|
||||||
|
@ -301,44 +303,45 @@ describe("App List verified installable marketplace apps util", () => {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const installableMarketplaceApps = [
|
const installableMarketplaceApps: GetV2SaleorAppsResponse.ReleasedSaleorApp[] =
|
||||||
{
|
[
|
||||||
name: {
|
{
|
||||||
en: "Test app",
|
name: {
|
||||||
|
en: "Test app",
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
en: "Test app description",
|
||||||
|
},
|
||||||
|
logo: {
|
||||||
|
source: "https://www.example.com/logo",
|
||||||
|
color: "#000000",
|
||||||
|
},
|
||||||
|
integrations: [],
|
||||||
|
manifestUrl: "https://www.example.com/manifest",
|
||||||
|
privacyUrl: "https://www.example.com/privacy",
|
||||||
|
supportUrl: "https://www.example.com/support",
|
||||||
|
repositoryUrl: "https://www.example.com/repository",
|
||||||
|
githubForkUrl: "https://www.example.com/repository/fork",
|
||||||
},
|
},
|
||||||
description: {
|
{
|
||||||
en: "Test app description",
|
name: {
|
||||||
|
en: "Test app",
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
en: "Test app description",
|
||||||
|
},
|
||||||
|
logo: {
|
||||||
|
source: "https://www.example-2.com/logo",
|
||||||
|
color: "#000000",
|
||||||
|
},
|
||||||
|
integrations: [],
|
||||||
|
manifestUrl: "https://www.example-2.com/manifest",
|
||||||
|
privacyUrl: "https://www.example-2.com/privacy",
|
||||||
|
supportUrl: "https://www.example-2.com/support",
|
||||||
|
repositoryUrl: "https://www.example-2.com/repository",
|
||||||
|
githubForkUrl: "https://www.example-2.com/repository/fork",
|
||||||
},
|
},
|
||||||
logo: {
|
];
|
||||||
source: "https://www.example.com/logo",
|
|
||||||
color: "#000000",
|
|
||||||
},
|
|
||||||
integrations: [],
|
|
||||||
manifestUrl: "https://www.example.com/manifest",
|
|
||||||
privacyUrl: "https://www.example.com/privacy",
|
|
||||||
supportUrl: "https://www.example.com/support",
|
|
||||||
repositoryUrl: "https://www.example.com/repository",
|
|
||||||
vercelDeploymentUrl: "https://www.example.com/deployment",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: {
|
|
||||||
en: "Test app",
|
|
||||||
},
|
|
||||||
description: {
|
|
||||||
en: "Test app description",
|
|
||||||
},
|
|
||||||
logo: {
|
|
||||||
source: "https://www.example-2.com/logo",
|
|
||||||
color: "#000000",
|
|
||||||
},
|
|
||||||
integrations: [],
|
|
||||||
manifestUrl: "https://www.example-2.com/manifest",
|
|
||||||
privacyUrl: "https://www.example-2.com/privacy",
|
|
||||||
supportUrl: "https://www.example-2.com/support",
|
|
||||||
repositoryUrl: "https://www.example-2.com/repository",
|
|
||||||
vercelDeploymentUrl: "https://www.example-2.com/deployment",
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const verifiedInstallableMarketplaceApps =
|
const verifiedInstallableMarketplaceApps =
|
||||||
|
|
|
@ -130,7 +130,7 @@ export const releasedApp: GetV2SaleorAppsResponse.ReleasedSaleorApp = {
|
||||||
privacyUrl: "https://www.released-example.com/privacy",
|
privacyUrl: "https://www.released-example.com/privacy",
|
||||||
supportUrl: "https://www.released-example.com/support",
|
supportUrl: "https://www.released-example.com/support",
|
||||||
repositoryUrl: "https://www.released-example.com/repository",
|
repositoryUrl: "https://www.released-example.com/repository",
|
||||||
vercelDeploymentUrl: "https://www.released-example.com/deployment",
|
githubForkUrl: "https://www.released-example.com/repository/fork",
|
||||||
integrations: [
|
integrations: [
|
||||||
{
|
{
|
||||||
name: "First released integration",
|
name: "First released integration",
|
||||||
|
|
|
@ -29,7 +29,7 @@ export namespace GetV2SaleorAppsResponse {
|
||||||
supportUrl: string;
|
supportUrl: string;
|
||||||
privacyUrl: string;
|
privacyUrl: string;
|
||||||
manifestUrl: string;
|
manifestUrl: string;
|
||||||
vercelDeploymentUrl?: string;
|
githubForkUrl?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ComingSoonSaleorApp = SaleorAppBase & {
|
export type ComingSoonSaleorApp = SaleorAppBase & {
|
||||||
|
|
|
@ -26,7 +26,7 @@ describe("App utils app details", () => {
|
||||||
privacyUrl: "https://www.example.com/privacy",
|
privacyUrl: "https://www.example.com/privacy",
|
||||||
supportUrl: "https://www.example.com/support",
|
supportUrl: "https://www.example.com/support",
|
||||||
repositoryUrl: "https://www.example.com/repository",
|
repositoryUrl: "https://www.example.com/repository",
|
||||||
vercelDeploymentUrl: "https://www.example.com/deployment",
|
githubForkUrl: "https://www.example.com/repository/fork",
|
||||||
};
|
};
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
@ -35,7 +35,7 @@ describe("App utils app details", () => {
|
||||||
app,
|
app,
|
||||||
appInstallation: undefined,
|
appInstallation: undefined,
|
||||||
navigateToAppInstallPage: () => undefined,
|
navigateToAppInstallPage: () => undefined,
|
||||||
navigateToVercelDeploymentPage: () => undefined,
|
navigateToGithubForkPage: () => undefined,
|
||||||
removeAppInstallation: () => undefined,
|
removeAppInstallation: () => undefined,
|
||||||
retryAppInstallation: () => undefined,
|
retryAppInstallation: () => undefined,
|
||||||
});
|
});
|
||||||
|
@ -44,7 +44,7 @@ describe("App utils app details", () => {
|
||||||
const expectedDetails: AppDetails = {
|
const expectedDetails: AppDetails = {
|
||||||
releaseDate: undefined,
|
releaseDate: undefined,
|
||||||
installHandler: expect.any(Function),
|
installHandler: expect.any(Function),
|
||||||
vercelDeployHandler: expect.any(Function),
|
githubForkHandler: expect.any(Function),
|
||||||
installationPending: undefined,
|
installationPending: undefined,
|
||||||
removeInstallHandler: undefined,
|
removeInstallHandler: undefined,
|
||||||
retryInstallHandler: undefined,
|
retryInstallHandler: undefined,
|
||||||
|
@ -89,7 +89,7 @@ describe("App utils app details", () => {
|
||||||
app,
|
app,
|
||||||
appInstallation: undefined,
|
appInstallation: undefined,
|
||||||
navigateToAppInstallPage: () => undefined,
|
navigateToAppInstallPage: () => undefined,
|
||||||
navigateToVercelDeploymentPage: () => undefined,
|
navigateToGithubForkPage: () => undefined,
|
||||||
removeAppInstallation: () => undefined,
|
removeAppInstallation: () => undefined,
|
||||||
retryAppInstallation: () => undefined,
|
retryAppInstallation: () => undefined,
|
||||||
});
|
});
|
||||||
|
@ -98,7 +98,7 @@ describe("App utils app details", () => {
|
||||||
const expectedDetails: AppDetails = {
|
const expectedDetails: AppDetails = {
|
||||||
releaseDate: "2019-12-16",
|
releaseDate: "2019-12-16",
|
||||||
installHandler: undefined,
|
installHandler: undefined,
|
||||||
vercelDeployHandler: undefined,
|
githubForkHandler: undefined,
|
||||||
links: [],
|
links: [],
|
||||||
installationPending: undefined,
|
installationPending: undefined,
|
||||||
removeInstallHandler: undefined,
|
removeInstallHandler: undefined,
|
||||||
|
@ -125,7 +125,7 @@ describe("App utils app details", () => {
|
||||||
privacyUrl: "https://www.example.com/privacy",
|
privacyUrl: "https://www.example.com/privacy",
|
||||||
supportUrl: "https://www.example.com/support",
|
supportUrl: "https://www.example.com/support",
|
||||||
repositoryUrl: "https://www.example.com/repository",
|
repositoryUrl: "https://www.example.com/repository",
|
||||||
vercelDeploymentUrl: "https://www.example.com/deployment",
|
githubForkUrl: "https://www.example.com/repository/fork",
|
||||||
};
|
};
|
||||||
const appInstallation: AppInstallationFragment = {
|
const appInstallation: AppInstallationFragment = {
|
||||||
__typename: "AppInstallation",
|
__typename: "AppInstallation",
|
||||||
|
@ -142,7 +142,7 @@ describe("App utils app details", () => {
|
||||||
app,
|
app,
|
||||||
appInstallation,
|
appInstallation,
|
||||||
navigateToAppInstallPage: () => undefined,
|
navigateToAppInstallPage: () => undefined,
|
||||||
navigateToVercelDeploymentPage: () => undefined,
|
navigateToGithubForkPage: () => undefined,
|
||||||
removeAppInstallation: () => undefined,
|
removeAppInstallation: () => undefined,
|
||||||
retryAppInstallation: () => undefined,
|
retryAppInstallation: () => undefined,
|
||||||
});
|
});
|
||||||
|
@ -151,7 +151,7 @@ describe("App utils app details", () => {
|
||||||
const expectedDetails: AppDetails = {
|
const expectedDetails: AppDetails = {
|
||||||
releaseDate: undefined,
|
releaseDate: undefined,
|
||||||
installHandler: undefined,
|
installHandler: undefined,
|
||||||
vercelDeployHandler: undefined,
|
githubForkHandler: undefined,
|
||||||
links: [
|
links: [
|
||||||
{
|
{
|
||||||
name: expect.any(String),
|
name: expect.any(String),
|
||||||
|
@ -191,7 +191,7 @@ describe("App utils app details", () => {
|
||||||
privacyUrl: "https://www.example.com/privacy",
|
privacyUrl: "https://www.example.com/privacy",
|
||||||
supportUrl: "https://www.example.com/support",
|
supportUrl: "https://www.example.com/support",
|
||||||
repositoryUrl: "https://www.example.com/repository",
|
repositoryUrl: "https://www.example.com/repository",
|
||||||
vercelDeploymentUrl: "https://www.example.com/deployment",
|
githubForkUrl: "https://www.example.com/repository/fork",
|
||||||
};
|
};
|
||||||
const appInstallation: AppInstallationFragment = {
|
const appInstallation: AppInstallationFragment = {
|
||||||
__typename: "AppInstallation",
|
__typename: "AppInstallation",
|
||||||
|
@ -208,7 +208,7 @@ describe("App utils app details", () => {
|
||||||
app,
|
app,
|
||||||
appInstallation,
|
appInstallation,
|
||||||
navigateToAppInstallPage: () => undefined,
|
navigateToAppInstallPage: () => undefined,
|
||||||
navigateToVercelDeploymentPage: () => undefined,
|
navigateToGithubForkPage: () => undefined,
|
||||||
removeAppInstallation: () => undefined,
|
removeAppInstallation: () => undefined,
|
||||||
retryAppInstallation: () => undefined,
|
retryAppInstallation: () => undefined,
|
||||||
});
|
});
|
||||||
|
@ -217,7 +217,7 @@ describe("App utils app details", () => {
|
||||||
const expectedDetails: AppDetails = {
|
const expectedDetails: AppDetails = {
|
||||||
releaseDate: undefined,
|
releaseDate: undefined,
|
||||||
installHandler: undefined,
|
installHandler: undefined,
|
||||||
vercelDeployHandler: undefined,
|
githubForkHandler: undefined,
|
||||||
links: [
|
links: [
|
||||||
{
|
{
|
||||||
name: expect.any(String),
|
name: expect.any(String),
|
||||||
|
|
|
@ -10,7 +10,7 @@ const getInstallableMarketplaceApps = (
|
||||||
marketplaceAppList?: GetV2SaleorAppsResponse.SaleorApp[],
|
marketplaceAppList?: GetV2SaleorAppsResponse.SaleorApp[],
|
||||||
) =>
|
) =>
|
||||||
marketplaceAppList?.filter(
|
marketplaceAppList?.filter(
|
||||||
app => "manifestUrl" in app || "vercelDeploymentUrl" in app,
|
app => "manifestUrl" in app || "githubForkUrl" in app,
|
||||||
) as GetV2SaleorAppsResponse.ReleasedSaleorApp[] | undefined;
|
) as GetV2SaleorAppsResponse.ReleasedSaleorApp[] | undefined;
|
||||||
|
|
||||||
const getComingSoonMarketplaceApps = (
|
const getComingSoonMarketplaceApps = (
|
||||||
|
@ -19,7 +19,7 @@ const getComingSoonMarketplaceApps = (
|
||||||
marketplaceAppList?.filter(
|
marketplaceAppList?.filter(
|
||||||
app =>
|
app =>
|
||||||
!("manifestUrl" in app) &&
|
!("manifestUrl" in app) &&
|
||||||
!("vercelDeploymentUrl" in app) &&
|
!("githubForkUrl" in app) &&
|
||||||
"releaseDate" in app,
|
"releaseDate" in app,
|
||||||
) as GetV2SaleorAppsResponse.ComingSoonSaleorApp[] | undefined;
|
) as GetV2SaleorAppsResponse.ComingSoonSaleorApp[] | undefined;
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ interface GetAppDetailsOpts {
|
||||||
app: GetV2SaleorAppsResponse.SaleorApp;
|
app: GetV2SaleorAppsResponse.SaleorApp;
|
||||||
appInstallation?: AppInstallationFragment;
|
appInstallation?: AppInstallationFragment;
|
||||||
navigateToAppInstallPage?: (url: string) => void;
|
navigateToAppInstallPage?: (url: string) => void;
|
||||||
navigateToVercelDeploymentPage?: (url?: string) => void;
|
navigateToGithubForkPage?: (url?: string) => void;
|
||||||
retryAppInstallation: (installationId: string) => void;
|
retryAppInstallation: (installationId: string) => void;
|
||||||
removeAppInstallation: (installationId: string) => void;
|
removeAppInstallation: (installationId: string) => void;
|
||||||
}
|
}
|
||||||
|
@ -102,17 +102,15 @@ export const getAppDetails = ({
|
||||||
app,
|
app,
|
||||||
appInstallation,
|
appInstallation,
|
||||||
navigateToAppInstallPage,
|
navigateToAppInstallPage,
|
||||||
navigateToVercelDeploymentPage,
|
navigateToGithubForkPage,
|
||||||
retryAppInstallation,
|
retryAppInstallation,
|
||||||
removeAppInstallation,
|
removeAppInstallation,
|
||||||
}: GetAppDetailsOpts) => {
|
}: GetAppDetailsOpts) => {
|
||||||
const isAppComingSoon =
|
const isAppComingSoon = !("manifestUrl" in app);
|
||||||
!("manifestUrl" in app) &&
|
|
||||||
!("vercelDeploymentUrl" in app) &&
|
|
||||||
"releaseDate" in app;
|
|
||||||
const isAppInstallable = "manifestUrl" in app && !!navigateToAppInstallPage;
|
const isAppInstallable = "manifestUrl" in app && !!navigateToAppInstallPage;
|
||||||
const isAppVercelDeployable =
|
const isAppForkableOnGithub =
|
||||||
"vercelDeploymentUrl" in app && !!navigateToVercelDeploymentPage;
|
"githubForkUrl" in app && !!navigateToGithubForkPage;
|
||||||
const installationPending =
|
const installationPending =
|
||||||
appInstallation && appInstallation.status === JobStatusEnum.PENDING;
|
appInstallation && appInstallation.status === JobStatusEnum.PENDING;
|
||||||
|
|
||||||
|
@ -123,9 +121,9 @@ export const getAppDetails = ({
|
||||||
!appInstallation && isAppInstallable
|
!appInstallation && isAppInstallable
|
||||||
? () => navigateToAppInstallPage(app.manifestUrl)
|
? () => navigateToAppInstallPage(app.manifestUrl)
|
||||||
: undefined,
|
: undefined,
|
||||||
vercelDeployHandler:
|
githubForkHandler:
|
||||||
!appInstallation && isAppVercelDeployable && !!app.vercelDeploymentUrl
|
!appInstallation && isAppForkableOnGithub && !!app.githubForkUrl
|
||||||
? () => navigateToVercelDeploymentPage(app.vercelDeploymentUrl)
|
? () => navigateToGithubForkPage(app.githubForkUrl)
|
||||||
: undefined,
|
: undefined,
|
||||||
installationPending,
|
installationPending,
|
||||||
retryInstallHandler:
|
retryInstallHandler:
|
||||||
|
|
Loading…
Reference in a new issue