Merge branch 'develop' into feat/prefs-defaults
This commit is contained in:
@@ -1,23 +1,63 @@
|
|||||||
import { FunctionalComponent } from "preact";
|
import { FunctionalComponent } from "preact";
|
||||||
import { Text } from '@/preferences/components';
|
import { Text } from '@/preferences/components';
|
||||||
import { Button } from '@/components/Button';
|
import { Button } from '@/components/Button';
|
||||||
|
import { WebApplication } from "@/ui_models/application";
|
||||||
|
import { useState } from "preact/hooks";
|
||||||
|
import { isDesktopApplication } from "@/utils";
|
||||||
|
|
||||||
export const NoSubscription: FunctionalComponent = () => (
|
export const NoSubscription: FunctionalComponent<{
|
||||||
<>
|
application: WebApplication;
|
||||||
<Text>You don't have a Standard Notes subscription yet.</Text>
|
}> = ({ application }) => {
|
||||||
<div className="flex">
|
const [isLoadingPurchaseFlow, setIsLoadingPurchaseFlow] = useState(false);
|
||||||
<Button
|
const [purchaseFlowError, setPurchaseFlowError] = useState<string | undefined>(undefined);
|
||||||
className="min-w-20 mt-3 mr-3"
|
|
||||||
type="normal"
|
const onPurchaseClick = async () => {
|
||||||
label="Refresh"
|
const errorMessage = 'There was an error when attempting to redirect you to the subscription page.';
|
||||||
onClick={() => null}
|
setIsLoadingPurchaseFlow(true);
|
||||||
/>
|
try {
|
||||||
<Button
|
const url = await application.getPurchaseFlowUrl();
|
||||||
className="min-w-20 mt-3"
|
if (url) {
|
||||||
type="primary"
|
const currentUrl = window.location.href;
|
||||||
label="Purchase subscription"
|
const successUrl = isDesktopApplication() ? `standardnotes://${currentUrl}` : currentUrl;
|
||||||
onClick={() => null}
|
console.log(successUrl);
|
||||||
/>
|
window.location.assign(`${url}&success_url=${successUrl}`);
|
||||||
</div>
|
} else {
|
||||||
</>
|
setPurchaseFlowError(errorMessage);
|
||||||
);
|
}
|
||||||
|
} catch (e) {
|
||||||
|
setPurchaseFlowError(errorMessage);
|
||||||
|
} finally {
|
||||||
|
setIsLoadingPurchaseFlow(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Text>You don't have a Standard Notes subscription yet.</Text>
|
||||||
|
{isLoadingPurchaseFlow && (
|
||||||
|
<Text>
|
||||||
|
Redirecting you to the subscription page...
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
{purchaseFlowError && (
|
||||||
|
<Text className="color-danger">
|
||||||
|
{purchaseFlowError}
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
<div className="flex">
|
||||||
|
<Button
|
||||||
|
className="min-w-20 mt-3 mr-3"
|
||||||
|
type="normal"
|
||||||
|
label="Refresh"
|
||||||
|
onClick={() => null}
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
className="min-w-20 mt-3"
|
||||||
|
type="primary"
|
||||||
|
label="Purchase subscription"
|
||||||
|
onClick={onPurchaseClick}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ export const Subscription: FunctionComponent<Props> = observer(({
|
|||||||
) : userSubscription && userSubscription.endsAt > now ? (
|
) : userSubscription && userSubscription.endsAt > now ? (
|
||||||
<SubscriptionInformation subscriptionState={subscriptionState} />
|
<SubscriptionInformation subscriptionState={subscriptionState} />
|
||||||
) : (
|
) : (
|
||||||
<NoSubscription />
|
<NoSubscription application={application} />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ export class WebApplication extends SNApplication {
|
|||||||
scope: angular.IScope,
|
scope: angular.IScope,
|
||||||
defaultSyncServerHost: string,
|
defaultSyncServerHost: string,
|
||||||
public bridge: Bridge,
|
public bridge: Bridge,
|
||||||
|
webSocketUrl: string,
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
bridge.environment,
|
bridge.environment,
|
||||||
@@ -67,6 +68,7 @@ export class WebApplication extends SNApplication {
|
|||||||
defaultSyncServerHost,
|
defaultSyncServerHost,
|
||||||
AppVersion,
|
AppVersion,
|
||||||
isDev,
|
isDev,
|
||||||
|
webSocketUrl,
|
||||||
);
|
);
|
||||||
this.$compile = $compile;
|
this.$compile = $compile;
|
||||||
this.scope = scope;
|
this.scope = scope;
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ export class ApplicationGroup extends SNApplicationGroup {
|
|||||||
scope,
|
scope,
|
||||||
this.defaultSyncServerHost,
|
this.defaultSyncServerHost,
|
||||||
this.bridge,
|
this.bridge,
|
||||||
|
this.webSocketUrl,
|
||||||
);
|
);
|
||||||
const appState = new AppState(
|
const appState = new AppState(
|
||||||
this.$rootScope,
|
this.$rootScope,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
is-open='ctrl.showAccountMenu',
|
is-open='ctrl.showAccountMenu',
|
||||||
ng-click='ctrl.accountMenuPressed()'
|
ng-click='ctrl.accountMenuPressed()'
|
||||||
)
|
)
|
||||||
.w-8.h-8.flex.items-center.justify-center.cursor-pointer.rounded-full(
|
.w-8.h-full.flex.items-center.justify-center.cursor-pointer.rounded-full(
|
||||||
ng-class="ctrl.showAccountMenu ? 'bg-border' : '' "
|
ng-class="ctrl.showAccountMenu ? 'bg-border' : '' "
|
||||||
)
|
)
|
||||||
.w-5.h-5(
|
.w-5.h-5(
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
ng-click='ctrl.clickPreferences()'
|
ng-click='ctrl.clickPreferences()'
|
||||||
ng-if='ctrl.appState.enableUnfinishedFeatures'
|
ng-if='ctrl.appState.enableUnfinishedFeatures'
|
||||||
)
|
)
|
||||||
.w-8.h-8.flex.items-center.justify-center.cursor-pointer
|
.w-8.h-full.flex.items-center.justify-center.cursor-pointer
|
||||||
.h-5
|
.h-5
|
||||||
icon(
|
icon(
|
||||||
type="tune"
|
type="tune"
|
||||||
|
|||||||
@@ -73,7 +73,7 @@
|
|||||||
"@reach/listbox": "^0.16.1",
|
"@reach/listbox": "^0.16.1",
|
||||||
"@standardnotes/features": "1.6.1",
|
"@standardnotes/features": "1.6.1",
|
||||||
"@standardnotes/sncrypto-web": "1.5.2",
|
"@standardnotes/sncrypto-web": "1.5.2",
|
||||||
"@standardnotes/snjs": "2.14.8",
|
"@standardnotes/snjs": "2.14.11",
|
||||||
"mobx": "^6.3.2",
|
"mobx": "^6.3.2",
|
||||||
"mobx-react-lite": "^3.2.0",
|
"mobx-react-lite": "^3.2.0",
|
||||||
"preact": "^10.5.12",
|
"preact": "^10.5.12",
|
||||||
|
|||||||
17
yarn.lock
17
yarn.lock
@@ -2100,7 +2100,12 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@standardnotes/common" "^1.1.0"
|
"@standardnotes/common" "^1.1.0"
|
||||||
|
|
||||||
"@standardnotes/common@1.1.0", "@standardnotes/common@^1.1.0":
|
"@standardnotes/common@1.2.0":
|
||||||
|
version "1.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@standardnotes/common/-/common-1.2.0.tgz#949c9d384c54fbabeacca9ea3f6485cbc78da4bf"
|
||||||
|
integrity sha512-QiOAG858BcXUGSRjsmtk854/4OLyGkdcbvixia8Xcfv4d76iL/pQf7JFTDbanr9Ygodrc6B+h+NuzliO41COcg==
|
||||||
|
|
||||||
|
"@standardnotes/common@^1.1.0":
|
||||||
version "1.1.0"
|
version "1.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/@standardnotes/common/-/common-1.1.0.tgz#5ffb0a50f9947471e236bb66d097f153ad9a148f"
|
resolved "https://registry.yarnpkg.com/@standardnotes/common/-/common-1.1.0.tgz#5ffb0a50f9947471e236bb66d097f153ad9a148f"
|
||||||
integrity sha512-Nm2IFWbMSfZDD7cnKtN+Gjic0f+PhPq/da/o4eOoUKg21VeOaQkTn+jlQKraKIs6Lmf+w9mmPNAgMc5o4hj7Lg==
|
integrity sha512-Nm2IFWbMSfZDD7cnKtN+Gjic0f+PhPq/da/o4eOoUKg21VeOaQkTn+jlQKraKIs6Lmf+w9mmPNAgMc5o4hj7Lg==
|
||||||
@@ -2144,13 +2149,13 @@
|
|||||||
"@standardnotes/sncrypto-common" "^1.5.2"
|
"@standardnotes/sncrypto-common" "^1.5.2"
|
||||||
libsodium-wrappers "^0.7.8"
|
libsodium-wrappers "^0.7.8"
|
||||||
|
|
||||||
"@standardnotes/snjs@2.14.8":
|
"@standardnotes/snjs@2.14.11":
|
||||||
version "2.14.8"
|
version "2.14.11"
|
||||||
resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.14.8.tgz#ebd89734d7e846ade96b7d0d81a465418147337d"
|
resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.14.11.tgz#e80a23df763c44d463fe6b73ea0b12522afad9e7"
|
||||||
integrity sha512-+nfo1civqJlHfrcDeKNJfp2t6o4gs1pkDbjPzT3vULhZUWbOwCeuF1jXHosCxpjnhd+5Wa/oG2KcbKKsqlrrfw==
|
integrity sha512-L33rhU/NK2ev+o8QXWbVT7jZtVwIwvNwT46N/3Lv5RQXkY7wa1yxO08NHt4BfHqrmXI3mF5qnBH3mcYoOtBY7A==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@standardnotes/auth" "3.7.2"
|
"@standardnotes/auth" "3.7.2"
|
||||||
"@standardnotes/common" "1.1.0"
|
"@standardnotes/common" "1.2.0"
|
||||||
"@standardnotes/domain-events" "2.1.0"
|
"@standardnotes/domain-events" "2.1.0"
|
||||||
"@standardnotes/features" "1.6.2"
|
"@standardnotes/features" "1.6.2"
|
||||||
"@standardnotes/settings" "1.2.0"
|
"@standardnotes/settings" "1.2.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user