mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-22 22:49:45 +01:00
feat: add regional pricing api
This commit is contained in:
@@ -25,6 +25,7 @@ import { Mutex } from "async-mutex";
|
|||||||
import NoteHistory from "../collections/note-history";
|
import NoteHistory from "../collections/note-history";
|
||||||
import MFAManager from "./mfa-manager";
|
import MFAManager from "./mfa-manager";
|
||||||
import EventManager from "../utils/event-manager";
|
import EventManager from "../utils/event-manager";
|
||||||
|
import Pricing from "./pricing";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {EventSource}
|
* @type {EventSource}
|
||||||
@@ -101,6 +102,7 @@ class Database {
|
|||||||
this.monographs = new Monographs(this);
|
this.monographs = new Monographs(this);
|
||||||
this.offers = new Offers();
|
this.offers = new Offers();
|
||||||
this.debug = new Debug();
|
this.debug = new Debug();
|
||||||
|
this.pricing = new Pricing();
|
||||||
|
|
||||||
// collections
|
// collections
|
||||||
/** @type {Notes} */
|
/** @type {Notes} */
|
||||||
|
|||||||
34
packages/core/api/pricing.js
Normal file
34
packages/core/api/pricing.js
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
import http from "notes-core/utils/http";
|
||||||
|
|
||||||
|
const BASE_URL = `https://notesnook.com/api/v1/prices`;
|
||||||
|
class Pricing {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {"android"|"ios"|"web"} platform
|
||||||
|
* @param {"monthly"|"yearly"} period
|
||||||
|
* @returns {Promise<{
|
||||||
|
* country: string,
|
||||||
|
* countryCode: string,
|
||||||
|
* sku: string,
|
||||||
|
* discount: number
|
||||||
|
* }>}
|
||||||
|
*/
|
||||||
|
sku(platform, period) {
|
||||||
|
return http.get(`${BASE_URL}/skus/${platform}/${period}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {"monthly"|"yearly"} period
|
||||||
|
* @returns {Promise<{
|
||||||
|
* country: string,
|
||||||
|
* countryCode: string,
|
||||||
|
* price: string,
|
||||||
|
* discount: number
|
||||||
|
* }>}
|
||||||
|
*/
|
||||||
|
price(period) {
|
||||||
|
return http.get(`${BASE_URL}/${period}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export default Pricing;
|
||||||
Reference in New Issue
Block a user