feat: add purchase url (#695)
* feat: add purchase url * chore: bump snjs * fix: reuse existing function
This commit is contained in:
@@ -3,7 +3,7 @@ import { LinkButton, Text } from '@/preferences/components';
|
||||
import { Button } from '@/components/Button';
|
||||
import { WebApplication } from "@/ui_models/application";
|
||||
import { useState } from "preact/hooks";
|
||||
import { isDesktopApplication } from "@/utils";
|
||||
import { loadPurchaseFlowUrl } from "@/purchaseFlow/PurchaseFlowWrapper";
|
||||
|
||||
export const NoSubscription: FunctionalComponent<{
|
||||
application: WebApplication;
|
||||
@@ -15,12 +15,7 @@ export const NoSubscription: FunctionalComponent<{
|
||||
const errorMessage = 'There was an error when attempting to redirect you to the subscription page.';
|
||||
setIsLoadingPurchaseFlow(true);
|
||||
try {
|
||||
const url = await application.getPurchaseFlowUrl();
|
||||
if (url) {
|
||||
const currentUrl = window.location.href;
|
||||
const successUrl = isDesktopApplication() ? `standardnotes://${currentUrl}` : currentUrl;
|
||||
window.location.assign(`${url}&success_url=${successUrl}`);
|
||||
} else {
|
||||
if (!await loadPurchaseFlowUrl(application)) {
|
||||
setPurchaseFlowError(errorMessage);
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user