chore: ugprade snjs deps (#898)

This commit is contained in:
Mo
2022-02-24 12:57:32 -06:00
committed by GitHub
parent 7fe0873bbb
commit c3d849d204
19 changed files with 163 additions and 182 deletions

View File

@@ -1,21 +1,24 @@
import { FunctionalComponent } from "preact";
import { FunctionalComponent } from 'preact';
import { LinkButton, Text } from '@/preferences/components';
import { Button } from '@/components/Button';
import { WebApplication } from "@/ui_models/application";
import { useState } from "preact/hooks";
import { loadPurchaseFlowUrl } from "@/purchaseFlow/PurchaseFlowWrapper";
import { WebApplication } from '@/ui_models/application';
import { useState } from 'preact/hooks';
import { loadPurchaseFlowUrl } from '@/purchaseFlow/PurchaseFlowWrapper';
export const NoSubscription: FunctionalComponent<{
application: WebApplication;
}> = ({ application }) => {
const [isLoadingPurchaseFlow, setIsLoadingPurchaseFlow] = useState(false);
const [purchaseFlowError, setPurchaseFlowError] = useState<string | undefined>(undefined);
const [purchaseFlowError, setPurchaseFlowError] = useState<
string | undefined
>(undefined);
const onPurchaseClick = async () => {
const errorMessage = 'There was an error when attempting to redirect you to the subscription page.';
const errorMessage =
'There was an error when attempting to redirect you to the subscription page.';
setIsLoadingPurchaseFlow(true);
try {
if (!await loadPurchaseFlowUrl(application)) {
if (!(await loadPurchaseFlowUrl(application))) {
setPurchaseFlowError(errorMessage);
}
} catch (e) {
@@ -29,29 +32,25 @@ export const NoSubscription: FunctionalComponent<{
<>
<Text>You don't have a Standard Notes subscription yet.</Text>
{isLoadingPurchaseFlow && (
<Text>
Redirecting you to the subscription page...
</Text>
<Text>Redirecting you to the subscription page...</Text>
)}
{purchaseFlowError && (
<Text className="color-danger">
{purchaseFlowError}
</Text>
<Text className="color-danger">{purchaseFlowError}</Text>
)}
<div className="flex">
<LinkButton
className="min-w-20 mt-3 mr-3"
label="Learn More"
link={window._plans_url as string}
link={window.plansUrl as string}
/>
{application.hasAccount() &&
{application.hasAccount() && (
<Button
className="min-w-20 mt-3"
type="primary"
label="Subscribe"
onClick={onPurchaseClick}
/>
}
)}
</div>
</>
);