Skip to content
This repository was archived by the owner on Jul 6, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/snjs/lib/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export class SNApplication {
private defaultHost: string,
private appVersion: string,
private enableV4 = false,
private webSocketUrl?: string
private webSocketUrl?: string,
) {
if (!SNLog.onLog) {
throw Error('SNLog.onLog must be set.');
Expand Down Expand Up @@ -1605,6 +1605,10 @@ export class SNApplication {
return this.featuresService.getFeature(featureId);
}

public getPurchaseIframeUrl(): string {
return this.apiService.getPurchaseIframeUrl();
}

private constructServices() {
this.createPayloadManager();
this.createItemManager();
Expand Down
8 changes: 7 additions & 1 deletion packages/snjs/lib/services/api/api_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ type PathNamesV1 = {
settings: (userUuid: string) => string;
setting: (userUuid: string, settingName: string) => string;
subscription: (userUuid: string) => string;
purchase: string;
};

type PathNamesV2 = {
Expand Down Expand Up @@ -88,6 +89,7 @@ const Paths: {
setting: (userUuid, settingName) =>
`/v1/users/${userUuid}/settings/${settingName}`,
subscription: (userUuid) => `/v1/users/${userUuid}/subscription`,
purchase: '/v1/purchase'
},
v2: {
subscriptions: '/v2/subscriptions',
Expand Down Expand Up @@ -124,7 +126,7 @@ export class SNApiService extends PureService<
constructor(
private httpService: SNHttpService,
private storageService: SNStorageService,
private host: string
private host: string,
) {
super();
}
Expand Down Expand Up @@ -737,6 +739,10 @@ export class SNApiService extends PureService<
return response;
}

public getPurchaseIframeUrl(): string {
return `${joinPaths(this.host, Paths.v1.purchase)}?sn_api_authorization=${this.session!.authorizationValue}`;
}

private preprocessingError() {
if (this.refreshingSession) {
return this.createErrorResponse(
Expand Down
2 changes: 1 addition & 1 deletion packages/snjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/snjs",
"version": "2.14.6",
"version": "2.14.7",
"engines": {
"node": ">=14.0.0 <16.0.0"
},
Expand Down