feat: Pass period & plan params to purchase page (#733)
This commit is contained in:
@@ -10,7 +10,9 @@ export type PurchaseFlowWrapperProps = {
|
|||||||
application: WebApplication;
|
application: WebApplication;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getPurchaseFlowUrl = async (application: WebApplication): Promise<string | undefined> => {
|
export const getPurchaseFlowUrl = async (
|
||||||
|
application: WebApplication
|
||||||
|
): Promise<string | undefined> => {
|
||||||
const currentUrl = window.location.origin;
|
const currentUrl = window.location.origin;
|
||||||
const successUrl = isDesktopApplication() ? `standardnotes://` : currentUrl;
|
const successUrl = isDesktopApplication() ? `standardnotes://` : currentUrl;
|
||||||
if (application.noAccount()) {
|
if (application.noAccount()) {
|
||||||
@@ -27,8 +29,11 @@ export const loadPurchaseFlowUrl = async (
|
|||||||
application: WebApplication
|
application: WebApplication
|
||||||
): Promise<boolean> => {
|
): Promise<boolean> => {
|
||||||
const url = await getPurchaseFlowUrl(application);
|
const url = await getPurchaseFlowUrl(application);
|
||||||
|
const params = new URLSearchParams(window.location.search);
|
||||||
|
const period = params.get('period') ? `&period=${params.get('period')}` : '';
|
||||||
|
const plan = params.get('plan') ? `&plan=${params.get('plan')}` : '';
|
||||||
if (url) {
|
if (url) {
|
||||||
window.location.assign(url);
|
window.location.assign(`${url}${period}${plan}`);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user