saleor-apps-redis_apl/apps/klaviyo/components/AccessWarning/AccessWarning.tsx
Lukasz Ostrowski 4865d33d5d
Add Klaviyo (#112)
* Add Klaviyo

* Update schema

* Fix build

* Empty commit to trigger deploy
2023-02-09 10:41:54 +01:00

34 lines
938 B
TypeScript

import { Typography } from "@material-ui/core";
import React from "react";
type WarningCause =
| "not_in_iframe"
| "missing_access_token"
| "invalid_access_token"
| "unknown_cause";
interface AccessWarningProps {
cause?: WarningCause;
}
const warnings: Record<WarningCause, string> = {
not_in_iframe: "The view can only be displayed in the iframe.",
missing_access_token: "App doesn't have an access token.",
invalid_access_token: "Access token is invalid.",
unknown_cause: "Something went wrong.",
};
function AccessWarning({ cause = "unknown_cause" }: AccessWarningProps) {
return (
<div suppressHydrationWarning>
<Typography variant="subtitle1">
App can&apos;t be accessed outside of the Saleor Dashboard
</Typography>
<Typography variant="subtitle2" style={{ marginTop: "2rem" }}>
{warnings[cause]}
</Typography>
</div>
);
}
export default AccessWarning;