Remove vercel handling from Slack APL
This commit is contained in:
parent
0104da3184
commit
96fc53d6c3
4 changed files with 58134 additions and 64788 deletions
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,34 +1,7 @@
|
||||||
import { AplReadyResult } from "@saleor/app-sdk/APL";
|
export function ConfigurationError() {
|
||||||
import { Alert } from "@saleor/macaw-ui";
|
|
||||||
|
|
||||||
const vercelInfo = (
|
|
||||||
<div>
|
|
||||||
<Alert variant="warning" title="Vercel detected">
|
|
||||||
<p>
|
|
||||||
App detected Vercel hosting. Check if Vercel is currently redeploying your app and try again
|
|
||||||
in few minutes
|
|
||||||
</p>
|
|
||||||
</Alert>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
export function ConfigurationError({
|
|
||||||
isVercel,
|
|
||||||
appReady,
|
|
||||||
}: {
|
|
||||||
isVercel: boolean;
|
|
||||||
appReady: AplReadyResult;
|
|
||||||
}) {
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h1>⚠️ Can't connect with the App API</h1>
|
<h1>⚠️ Can't connect with the App API</h1>
|
||||||
{isVercel && vercelInfo}
|
|
||||||
{appReady.ready ? null : (
|
|
||||||
<div>
|
|
||||||
<p>Environment variables validation is incorrect</p>
|
|
||||||
<p>{appReady.error.message}</p>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
You may see this error because:
|
You may see this error because:
|
||||||
<ul>
|
<ul>
|
||||||
<li>Internet connection has been lost</li>
|
<li>Internet connection has been lost</li>
|
||||||
|
|
|
@ -2,25 +2,22 @@ import {
|
||||||
Card,
|
Card,
|
||||||
CardContent,
|
CardContent,
|
||||||
CardHeader,
|
CardHeader,
|
||||||
|
Link,
|
||||||
List,
|
List,
|
||||||
ListItem,
|
ListItem,
|
||||||
TextField,
|
TextField,
|
||||||
Typography,
|
Typography,
|
||||||
} from "@material-ui/core";
|
} from "@material-ui/core";
|
||||||
import Skeleton from "@material-ui/lab/Skeleton";
|
import Skeleton from "@material-ui/lab/Skeleton";
|
||||||
import { AplReadyResult, VercelAPL } from "@saleor/app-sdk/APL";
|
|
||||||
import { useAppBridge, withAuthorization } from "@saleor/app-sdk/app-bridge";
|
import { useAppBridge, withAuthorization } from "@saleor/app-sdk/app-bridge";
|
||||||
import { SALEOR_API_URL_HEADER, SALEOR_AUTHORIZATION_BEARER_HEADER } from "@saleor/app-sdk/const";
|
import { SALEOR_API_URL_HEADER, SALEOR_AUTHORIZATION_BEARER_HEADER } from "@saleor/app-sdk/const";
|
||||||
import { ConfirmButton, ConfirmButtonTransitionState, makeStyles } from "@saleor/macaw-ui";
|
import { ConfirmButton, ConfirmButtonTransitionState, makeStyles } from "@saleor/macaw-ui";
|
||||||
import { GetServerSideProps } from "next";
|
|
||||||
import { ChangeEvent, ReactElement, SyntheticEvent, useEffect, useState } from "react";
|
import { ChangeEvent, ReactElement, SyntheticEvent, useEffect, useState } from "react";
|
||||||
|
|
||||||
import AccessWarning from "../components/AccessWarning/AccessWarning";
|
import AccessWarning from "../components/AccessWarning/AccessWarning";
|
||||||
import { ConfigurationError } from "../components/ConfigurationError/ConfigurationError";
|
import { ConfigurationError } from "../components/ConfigurationError/ConfigurationError";
|
||||||
import useAppApi from "../hooks/useAppApi";
|
import useAppApi from "../hooks/useAppApi";
|
||||||
import { saleorApp } from "../lib/saleor-app";
|
|
||||||
import useDashboardNotifier from "../utils/useDashboardNotifier";
|
import useDashboardNotifier from "../utils/useDashboardNotifier";
|
||||||
import { Link } from "@material-ui/core";
|
|
||||||
import { SlackAppMainBar } from "../components/SlackAppMainBar/SlackAppMainBar";
|
import { SlackAppMainBar } from "../components/SlackAppMainBar/SlackAppMainBar";
|
||||||
import { AppColumnsLayout } from "../components/AppColumnsLayout/AppColumnsLayout";
|
import { AppColumnsLayout } from "../components/AppColumnsLayout/AppColumnsLayout";
|
||||||
|
|
||||||
|
@ -41,24 +38,7 @@ const useStyles = makeStyles((theme) => ({
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
type PageProps = {
|
function Configuration() {
|
||||||
isVercel: boolean;
|
|
||||||
appReady: AplReadyResult;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getServerSideProps: GetServerSideProps<PageProps> = async () => {
|
|
||||||
const isVercel = saleorApp.apl instanceof VercelAPL;
|
|
||||||
const isAppReady = await saleorApp.isReady();
|
|
||||||
|
|
||||||
return {
|
|
||||||
props: {
|
|
||||||
isVercel,
|
|
||||||
appReady: isAppReady,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
function Configuration({ isVercel, appReady }: PageProps) {
|
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const { appBridgeState } = useAppBridge();
|
const { appBridgeState } = useAppBridge();
|
||||||
const [notify] = useDashboardNotifier();
|
const [notify] = useDashboardNotifier();
|
||||||
|
@ -114,7 +94,7 @@ function Configuration({ isVercel, appReady }: PageProps) {
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error("Can't establish connection with the App API: ", error);
|
console.error("Can't establish connection with the App API: ", error);
|
||||||
return <ConfigurationError appReady={appReady} isVercel={isVercel} />;
|
return <ConfigurationError />;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (configuration === undefined) {
|
if (configuration === undefined) {
|
||||||
|
|
Loading…
Reference in a new issue