@up-im/medotvet_sdk 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cursor/rules/apcheki_sdk.mdc +90 -0
- package/README.md +136 -0
- package/dist/api/abstract.d.ts +21 -0
- package/dist/api/abstract.js +125 -0
- package/dist/api/bookmarks.d.ts +28 -0
- package/dist/api/bookmarks.js +121 -0
- package/dist/api/chat.d.ts +30 -0
- package/dist/api/chat.js +118 -0
- package/dist/api/content.d.ts +154 -0
- package/dist/api/content.js +237 -0
- package/dist/api/geoIp.d.ts +8 -0
- package/dist/api/geoIp.js +14 -0
- package/dist/api/index.d.ts +27 -0
- package/dist/api/index.js +31 -0
- package/dist/api/payment.d.ts +54 -0
- package/dist/api/payment.js +90 -0
- package/dist/api/promocode.d.ts +9 -0
- package/dist/api/promocode.js +22 -0
- package/dist/api/push.d.ts +54 -0
- package/dist/api/push.js +99 -0
- package/dist/api/receipt.d.ts +34 -0
- package/dist/api/receipt.js +60 -0
- package/dist/api/stat.d.ts +21 -0
- package/dist/api/stat.js +75 -0
- package/dist/api/survey.d.ts +82 -0
- package/dist/api/survey.js +122 -0
- package/dist/api/user.d.ts +80 -0
- package/dist/api/user.js +167 -0
- package/dist/eventBus/abstract.d.ts +4 -0
- package/dist/eventBus/abstract.js +29 -0
- package/dist/eventBus/userLogin.d.ts +5 -0
- package/dist/eventBus/userLogin.js +11 -0
- package/dist/eventBus/userLogout.d.ts +4 -0
- package/dist/eventBus/userLogout.js +11 -0
- package/dist/http/apiError.d.ts +4 -0
- package/dist/http/apiError.js +10 -0
- package/dist/http/apiRoute.d.ts +98 -0
- package/dist/http/apiRoute.js +197 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +7 -0
- package/dist/interfaces/BannerType.d.ts +5 -0
- package/dist/interfaces/BannerType.js +7 -0
- package/dist/interfaces/apiStatEvents.d.ts +1 -0
- package/dist/interfaces/apiStatEvents.js +18 -0
- package/dist/interfaces/diplomaStatus.d.ts +8 -0
- package/dist/interfaces/diplomaStatus.js +9 -0
- package/dist/interfaces/iAppStore.d.ts +1 -0
- package/dist/interfaces/iAppStore.js +2 -0
- package/dist/interfaces/iAppVersionCheck.d.ts +5 -0
- package/dist/interfaces/iAppVersionCheck.js +2 -0
- package/dist/interfaces/iArticle.d.ts +15 -0
- package/dist/interfaces/iArticle.js +2 -0
- package/dist/interfaces/iBalance.d.ts +6 -0
- package/dist/interfaces/iBalance.js +2 -0
- package/dist/interfaces/iBank.d.ts +4 -0
- package/dist/interfaces/iBank.js +2 -0
- package/dist/interfaces/iBanner.d.ts +6 -0
- package/dist/interfaces/iBanner.js +2 -0
- package/dist/interfaces/iBookmark.d.ts +3 -0
- package/dist/interfaces/iBookmark.js +2 -0
- package/dist/interfaces/iBrand.d.ts +6 -0
- package/dist/interfaces/iBrand.js +2 -0
- package/dist/interfaces/iCatalog.d.ts +50 -0
- package/dist/interfaces/iCatalog.js +2 -0
- package/dist/interfaces/iCatalogNode.d.ts +3 -0
- package/dist/interfaces/iCatalogNode.js +2 -0
- package/dist/interfaces/iCatalogPreview.d.ts +17 -0
- package/dist/interfaces/iCatalogPreview.js +2 -0
- package/dist/interfaces/iCity.d.ts +4 -0
- package/dist/interfaces/iCity.js +2 -0
- package/dist/interfaces/iContentItem.d.ts +7 -0
- package/dist/interfaces/iContentItem.js +2 -0
- package/dist/interfaces/iEnv.d.ts +6 -0
- package/dist/interfaces/iEnv.js +2 -0
- package/dist/interfaces/iFilter.d.ts +11 -0
- package/dist/interfaces/iFilter.js +2 -0
- package/dist/interfaces/iGetNodeListProps.d.ts +8 -0
- package/dist/interfaces/iGetNodeListProps.js +2 -0
- package/dist/interfaces/iInstruction.d.ts +6 -0
- package/dist/interfaces/iInstruction.js +2 -0
- package/dist/interfaces/iIntro.d.ts +6 -0
- package/dist/interfaces/iIntro.js +2 -0
- package/dist/interfaces/iMessage.d.ts +25 -0
- package/dist/interfaces/iMessage.js +2 -0
- package/dist/interfaces/iNode.d.ts +26 -0
- package/dist/interfaces/iNode.js +2 -0
- package/dist/interfaces/iNodeTree.d.ts +14 -0
- package/dist/interfaces/iNodeTree.js +2 -0
- package/dist/interfaces/iPagingItems.d.ts +9 -0
- package/dist/interfaces/iPagingItems.js +2 -0
- package/dist/interfaces/iPayment.d.ts +20 -0
- package/dist/interfaces/iPayment.js +2 -0
- package/dist/interfaces/iPush.d.ts +14 -0
- package/dist/interfaces/iPush.js +2 -0
- package/dist/interfaces/iQuestion.d.ts +7 -0
- package/dist/interfaces/iQuestion.js +2 -0
- package/dist/interfaces/iReceipt.d.ts +20 -0
- package/dist/interfaces/iReceipt.js +2 -0
- package/dist/interfaces/iReceiptAddProps.d.ts +8 -0
- package/dist/interfaces/iReceiptAddProps.js +2 -0
- package/dist/interfaces/iReceiptProduct.d.ts +7 -0
- package/dist/interfaces/iReceiptProduct.js +2 -0
- package/dist/interfaces/iSearchParams.d.ts +11 -0
- package/dist/interfaces/iSearchParams.js +2 -0
- package/dist/interfaces/iShop.d.ts +6 -0
- package/dist/interfaces/iShop.js +2 -0
- package/dist/interfaces/iShopAddress.d.ts +5 -0
- package/dist/interfaces/iShopAddress.js +2 -0
- package/dist/interfaces/iSorter.d.ts +7 -0
- package/dist/interfaces/iSorter.js +2 -0
- package/dist/interfaces/iSpecialization.d.ts +4 -0
- package/dist/interfaces/iSpecialization.js +2 -0
- package/dist/interfaces/iStatView.d.ts +4 -0
- package/dist/interfaces/iStatView.js +2 -0
- package/dist/interfaces/iStorage.d.ts +5 -0
- package/dist/interfaces/iStorage.js +2 -0
- package/dist/interfaces/iStories.d.ts +13 -0
- package/dist/interfaces/iStories.js +2 -0
- package/dist/interfaces/iSubstance.d.ts +4 -0
- package/dist/interfaces/iSubstance.js +2 -0
- package/dist/interfaces/iSurvey.d.ts +36 -0
- package/dist/interfaces/iSurvey.js +2 -0
- package/dist/interfaces/iSurveyQuestion.d.ts +11 -0
- package/dist/interfaces/iSurveyQuestion.js +2 -0
- package/dist/interfaces/iSymptoms.d.ts +4 -0
- package/dist/interfaces/iSymptoms.js +2 -0
- package/dist/interfaces/iTestQuestion.d.ts +20 -0
- package/dist/interfaces/iTestQuestion.js +2 -0
- package/dist/interfaces/iTestResult.d.ts +17 -0
- package/dist/interfaces/iTestResult.js +2 -0
- package/dist/interfaces/iText.d.ts +3 -0
- package/dist/interfaces/iText.js +2 -0
- package/dist/interfaces/iUser.d.ts +35 -0
- package/dist/interfaces/iUser.js +2 -0
- package/dist/interfaces/iUserData.d.ts +10 -0
- package/dist/interfaces/iUserData.js +2 -0
- package/dist/interfaces/iUserEditProps.d.ts +20 -0
- package/dist/interfaces/iUserEditProps.js +2 -0
- package/dist/interfaces/iUserStat.d.ts +7 -0
- package/dist/interfaces/iUserStat.js +2 -0
- package/dist/interfaces/iUserSurvey.d.ts +21 -0
- package/dist/interfaces/iUserSurvey.js +11 -0
- package/dist/interfaces/iUserTokens.d.ts +4 -0
- package/dist/interfaces/iUserTokens.js +2 -0
- package/dist/interfaces/intRange.d.ts +3 -0
- package/dist/interfaces/intRange.js +2 -0
- package/dist/interfaces/itemType.d.ts +9 -0
- package/dist/interfaces/itemType.js +11 -0
- package/dist/interfaces/paymentStatus.d.ts +7 -0
- package/dist/interfaces/paymentStatus.js +9 -0
- package/dist/interfaces/paymentType.d.ts +5 -0
- package/dist/interfaces/paymentType.js +7 -0
- package/dist/interfaces/payoutType.d.ts +5 -0
- package/dist/interfaces/payoutType.js +7 -0
- package/dist/interfaces/pushStatus.d.ts +6 -0
- package/dist/interfaces/pushStatus.js +8 -0
- package/dist/interfaces/receiptStatus.d.ts +7 -0
- package/dist/interfaces/receiptStatus.js +9 -0
- package/dist/interfaces/testStatus.d.ts +6 -0
- package/dist/interfaces/testStatus.js +7 -0
- package/dist/interfaces/userRole.d.ts +6 -0
- package/dist/interfaces/userRole.js +14 -0
- package/dist/interfaces/userStatEvent.d.ts +5 -0
- package/dist/interfaces/userStatEvent.js +7 -0
- package/dist/interfaces/viewEventType.d.ts +13 -0
- package/dist/interfaces/viewEventType.js +19 -0
- package/dist/service/webSocketClient.d.ts +21 -0
- package/dist/service/webSocketClient.js +87 -0
- package/dist/storage/default.d.ts +2 -0
- package/dist/storage/default.js +8 -0
- package/dist/storage/user.d.ts +21 -0
- package/dist/storage/user.js +107 -0
- package/dist/utils/queryString.d.ts +3 -0
- package/dist/utils/queryString.js +21 -0
- package/package.json +31 -0
- package/src/api/abstract.ts +136 -0
- package/src/api/bookmarks.ts +109 -0
- package/src/api/chat.ts +127 -0
- package/src/api/content.ts +258 -0
- package/src/api/geoIp.ts +12 -0
- package/src/api/index.ts +38 -0
- package/src/api/payment.ts +105 -0
- package/src/api/promocode.ts +18 -0
- package/src/api/push.ts +102 -0
- package/src/api/stat.ts +74 -0
- package/src/api/survey.ts +164 -0
- package/src/api/user.ts +176 -0
- package/src/eventBus/abstract.ts +33 -0
- package/src/eventBus/userLogin.ts +13 -0
- package/src/eventBus/userLogout.ts +12 -0
- package/src/http/apiError.ts +9 -0
- package/src/http/apiRoute.ts +234 -0
- package/src/index.ts +2 -0
- package/src/interfaces/BannerType.ts +6 -0
- package/src/interfaces/apiStatEvents.ts +18 -0
- package/src/interfaces/diplomaStatus.ts +10 -0
- package/src/interfaces/iAppStore.ts +1 -0
- package/src/interfaces/iArticle.ts +12 -0
- package/src/interfaces/iBalance.ts +6 -0
- package/src/interfaces/iBank.ts +4 -0
- package/src/interfaces/iBanner.ts +6 -0
- package/src/interfaces/iBookmark.ts +3 -0
- package/src/interfaces/iCity.ts +4 -0
- package/src/interfaces/iContentItem.ts +6 -0
- package/src/interfaces/iEnv.ts +6 -0
- package/src/interfaces/iFilter.ts +16 -0
- package/src/interfaces/iGetNodeListProps.ts +9 -0
- package/src/interfaces/iInstruction.ts +6 -0
- package/src/interfaces/iIntro.ts +6 -0
- package/src/interfaces/iMessage.ts +25 -0
- package/src/interfaces/iNode.ts +24 -0
- package/src/interfaces/iNodeTree.ts +14 -0
- package/src/interfaces/iPagingItems.ts +8 -0
- package/src/interfaces/iPayment.ts +28 -0
- package/src/interfaces/iPush.ts +15 -0
- package/src/interfaces/iQuestion.ts +4 -0
- package/src/interfaces/iSearchParams.ts +12 -0
- package/src/interfaces/iSorter.ts +10 -0
- package/src/interfaces/iSpecialization.ts +4 -0
- package/src/interfaces/iStatView.ts +4 -0
- package/src/interfaces/iStorage.ts +5 -0
- package/src/interfaces/iStories.ts +10 -0
- package/src/interfaces/iSubstance.ts +4 -0
- package/src/interfaces/iSurvey.ts +38 -0
- package/src/interfaces/iSurveyQuestion.ts +15 -0
- package/src/interfaces/iSymptoms.ts +4 -0
- package/src/interfaces/iTestQuestion.ts +21 -0
- package/src/interfaces/iTestResult.ts +20 -0
- package/src/interfaces/iText.ts +3 -0
- package/src/interfaces/iUser.ts +37 -0
- package/src/interfaces/iUserData.ts +10 -0
- package/src/interfaces/iUserEditProps.ts +16 -0
- package/src/interfaces/iUserStat.ts +8 -0
- package/src/interfaces/iUserSurvey.ts +23 -0
- package/src/interfaces/iUserTokens.ts +4 -0
- package/src/interfaces/intRange.ts +5 -0
- package/src/interfaces/itemType.ts +10 -0
- package/src/interfaces/paymentStatus.ts +8 -0
- package/src/interfaces/paymentType.ts +6 -0
- package/src/interfaces/payoutType.ts +6 -0
- package/src/interfaces/pushStatus.ts +7 -0
- package/src/interfaces/testStatus.ts +8 -0
- package/src/interfaces/userRole.ts +13 -0
- package/src/interfaces/userStatEvent.ts +6 -0
- package/src/interfaces/viewEventType.ts +17 -0
- package/src/service/webSocketClient.ts +94 -0
- package/src/storage/default.ts +7 -0
- package/src/storage/user.ts +109 -0
- package/src/utils/queryString.ts +22 -0
- package/tsconfig.json +27 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { iArticle } from "../interfaces/iArticle";
|
|
2
|
+
import { iBanner } from "../interfaces/iBanner";
|
|
3
|
+
import { BannerType, BannerTypeKeys } from "../interfaces/BannerType";
|
|
4
|
+
import { iCity } from "../interfaces/iCity";
|
|
5
|
+
import { iContentItem } from "../interfaces/iContentItem";
|
|
6
|
+
import { iInstruction } from "../interfaces/iInstruction";
|
|
7
|
+
import { iNode } from "../interfaces/iNode";
|
|
8
|
+
import { iNodeTree } from "../interfaces/iNodeTree";
|
|
9
|
+
import { iPagingItems } from "../interfaces/iPagingItems";
|
|
10
|
+
import { iSearchParams } from "../interfaces/iSearchParams";
|
|
11
|
+
import { iText } from "../interfaces/iText";
|
|
12
|
+
import { ApiAbstract } from "./abstract";
|
|
13
|
+
import { iStories } from "../interfaces/iStories";
|
|
14
|
+
import { iEnv } from "../interfaces/iEnv";
|
|
15
|
+
import { iIntro } from "../interfaces/iIntro";
|
|
16
|
+
import { iAppStore } from "../interfaces/iAppStore";
|
|
17
|
+
export declare class ApiContent extends ApiAbstract {
|
|
18
|
+
/**
|
|
19
|
+
* получение настроек, включая размер реферальных вознаграждений
|
|
20
|
+
*/
|
|
21
|
+
getEnv(): Promise<iEnv>;
|
|
22
|
+
/**
|
|
23
|
+
* проверка актуальности версии приложения
|
|
24
|
+
* @param {number} params.appStore - магазин приложения "App Store" или "Google Play"
|
|
25
|
+
* @param {boolean} params.appVersion - версия приложения, например 1.0.0
|
|
26
|
+
*/
|
|
27
|
+
checkAppVersion({ appStore, appVersion }: {
|
|
28
|
+
appStore: iAppStore;
|
|
29
|
+
appVersion: string;
|
|
30
|
+
}): Promise<{
|
|
31
|
+
isActual: boolean;
|
|
32
|
+
}>;
|
|
33
|
+
/**
|
|
34
|
+
* получение версии приложения для конкретной операционной системы
|
|
35
|
+
* @param {string} os - операционная система "ios" или "android"
|
|
36
|
+
*/
|
|
37
|
+
getCloudVersion(appStore: iAppStore): Promise<any>;
|
|
38
|
+
/**
|
|
39
|
+
* получение дерева категорий. не обязательный параметр
|
|
40
|
+
* @param {string} parent id категории от которой строится вложенность
|
|
41
|
+
*/
|
|
42
|
+
getNodeTree(parent?: number): Promise<iNodeTree[]>;
|
|
43
|
+
/**
|
|
44
|
+
* получение раздела
|
|
45
|
+
*/
|
|
46
|
+
private getNodeByCode;
|
|
47
|
+
/**
|
|
48
|
+
* получение списка статей
|
|
49
|
+
*/
|
|
50
|
+
getArticleList<Keys extends keyof iArticle>({ select, page, //отсчет страниц с первой, чтобы не было путаницы
|
|
51
|
+
filters, sorters, perPage, }: iSearchParams<iArticle, Keys>): Promise<iPagingItems<Pick<iArticle, Keys> & {
|
|
52
|
+
url?: string;
|
|
53
|
+
}, {
|
|
54
|
+
[key: string]: unknown;
|
|
55
|
+
} | undefined>>;
|
|
56
|
+
/**
|
|
57
|
+
* получение одной статьи
|
|
58
|
+
*/
|
|
59
|
+
getArticleOne({ id }: {
|
|
60
|
+
id: number;
|
|
61
|
+
}): Promise<iContentItem<iArticle, {
|
|
62
|
+
[key: string]: unknown;
|
|
63
|
+
} | undefined>>;
|
|
64
|
+
/**
|
|
65
|
+
* политика конфиденциальности
|
|
66
|
+
*/
|
|
67
|
+
getPolicy(): Promise<iNode<iText>>;
|
|
68
|
+
/**
|
|
69
|
+
* оферта
|
|
70
|
+
*/
|
|
71
|
+
getTerms(): Promise<iNode<iText>>;
|
|
72
|
+
/**
|
|
73
|
+
* Правила программы лояльности
|
|
74
|
+
*/
|
|
75
|
+
getLoyalty(): Promise<iNode<iText>>;
|
|
76
|
+
/**
|
|
77
|
+
* как получить деньги
|
|
78
|
+
*/
|
|
79
|
+
getInstruction(): Promise<iPagingItems<iInstruction, {
|
|
80
|
+
[key: string]: unknown;
|
|
81
|
+
} | undefined>>;
|
|
82
|
+
/**
|
|
83
|
+
* Согласие на обработку персональных данных
|
|
84
|
+
*/
|
|
85
|
+
getAgreement(): Promise<iNode<iText>>;
|
|
86
|
+
/**
|
|
87
|
+
* банки для выбора при запросе на вывод средств
|
|
88
|
+
* @param {number} props.page - страница. Отсчет страниц с первой, чтобы не было путаницы
|
|
89
|
+
* @param {string} props.searchTitle - поисковая строка по началу названия банка
|
|
90
|
+
*/
|
|
91
|
+
getBanks({ page, searchTitle }: {
|
|
92
|
+
page: number;
|
|
93
|
+
searchTitle?: string;
|
|
94
|
+
}): Promise<iPagingItems<iInstruction, {
|
|
95
|
+
[key: string]: unknown;
|
|
96
|
+
} | undefined>>;
|
|
97
|
+
/**
|
|
98
|
+
* получение списка специализаций врачей
|
|
99
|
+
* @param {number} props.page - страница. Отсчет страниц с первой, чтобы не было путаницы
|
|
100
|
+
* @param {string} props.searchTitle - поисковая строка по началу названия банка
|
|
101
|
+
*/
|
|
102
|
+
getSpecializationList({ page, searchTitle }: {
|
|
103
|
+
page: number;
|
|
104
|
+
searchTitle?: string;
|
|
105
|
+
}): Promise<iPagingItems<iInstruction, {
|
|
106
|
+
[key: string]: unknown;
|
|
107
|
+
} | undefined>>;
|
|
108
|
+
/**
|
|
109
|
+
* поиск города
|
|
110
|
+
* @param {number} props.page - страница. Отсчет страниц с первой, чтобы не было путаницы
|
|
111
|
+
* @param {string} props.searchTitle - поисковая строка по началу названия банка
|
|
112
|
+
*/
|
|
113
|
+
getCityList({ page, searchTitle }: {
|
|
114
|
+
page: number;
|
|
115
|
+
searchTitle?: string;
|
|
116
|
+
}): Promise<iPagingItems<iCity, {
|
|
117
|
+
[key: string]: unknown;
|
|
118
|
+
} | undefined>>;
|
|
119
|
+
/**
|
|
120
|
+
* получение одного города
|
|
121
|
+
*/
|
|
122
|
+
getCityOne({ id }: {
|
|
123
|
+
id: number;
|
|
124
|
+
}): Promise<iContentItem<iArticle, {
|
|
125
|
+
[key: string]: unknown;
|
|
126
|
+
} | undefined>>;
|
|
127
|
+
/**
|
|
128
|
+
* баннер
|
|
129
|
+
* @param {number} props.type - тип баннера
|
|
130
|
+
*/
|
|
131
|
+
getBannerRand({ type, signal }: {
|
|
132
|
+
type: typeof BannerType[BannerTypeKeys];
|
|
133
|
+
signal?: AbortSignal;
|
|
134
|
+
}): Promise<{
|
|
135
|
+
item: iBanner | undefined;
|
|
136
|
+
}>;
|
|
137
|
+
/**
|
|
138
|
+
* получение списка сторисов
|
|
139
|
+
*/
|
|
140
|
+
getStoriesList<Keys extends keyof iStories>({ select, page, //отсчет страниц с первой, чтобы не было путаницы
|
|
141
|
+
perPage, }: iSearchParams<iStories, Keys>): Promise<iPagingItems<Pick<iStories, Keys>>>;
|
|
142
|
+
/**
|
|
143
|
+
* получение одного сториса
|
|
144
|
+
*/
|
|
145
|
+
getStoriesOne({ id }: {
|
|
146
|
+
id: number;
|
|
147
|
+
}): Promise<iContentItem<iStories>>;
|
|
148
|
+
/**
|
|
149
|
+
* получение списка интро (приветственная инструкция)
|
|
150
|
+
*/
|
|
151
|
+
getIntro(): Promise<iPagingItems<iIntro, {
|
|
152
|
+
[key: string]: unknown;
|
|
153
|
+
} | undefined>>;
|
|
154
|
+
}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiContent = void 0;
|
|
4
|
+
const apiRoute_1 = require("../http/apiRoute");
|
|
5
|
+
const abstract_1 = require("./abstract");
|
|
6
|
+
class ApiContent extends abstract_1.ApiAbstract {
|
|
7
|
+
/**
|
|
8
|
+
* получение настроек, включая размер реферальных вознаграждений
|
|
9
|
+
*/
|
|
10
|
+
async getEnv() {
|
|
11
|
+
return this.fetcher({ route: apiRoute_1.apiRouteEnv });
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* проверка актуальности версии приложения
|
|
15
|
+
* @param {number} params.appStore - магазин приложения "App Store" или "Google Play"
|
|
16
|
+
* @param {boolean} params.appVersion - версия приложения, например 1.0.0
|
|
17
|
+
*/
|
|
18
|
+
async checkAppVersion({ appStore, appVersion }) {
|
|
19
|
+
return this.fetcher({ route: (0, apiRoute_1.apiRouteCheckAppVersion)(appStore, appVersion) });
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* получение версии приложения для конкретной операционной системы
|
|
23
|
+
* @param {string} os - операционная система "ios" или "android"
|
|
24
|
+
*/
|
|
25
|
+
async getCloudVersion(appStore) {
|
|
26
|
+
return this.fetcher({ route: (0, apiRoute_1.apiRouteGetCloudVersion)(appStore) });
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* получение дерева категорий. не обязательный параметр
|
|
30
|
+
* @param {string} parent id категории от которой строится вложенность
|
|
31
|
+
*/
|
|
32
|
+
async getNodeTree(parent) {
|
|
33
|
+
return this.fetcher({ route: (0, apiRoute_1.apiRouteNodeTree)(parent) });
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* получение раздела
|
|
37
|
+
*/
|
|
38
|
+
async getNodeByCode(nodeCode) {
|
|
39
|
+
return this.fetcher({
|
|
40
|
+
route: (0, apiRoute_1.apiRouteNode)(nodeCode)
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* получение списка статей
|
|
45
|
+
*/
|
|
46
|
+
async getArticleList({ select, page = 1, //отсчет страниц с первой, чтобы не было путаницы
|
|
47
|
+
filters, sorters, perPage = 10, }) {
|
|
48
|
+
return this.fetcher({
|
|
49
|
+
route: (0, apiRoute_1.apiRouteList)({
|
|
50
|
+
nodeCode: "articles",
|
|
51
|
+
page,
|
|
52
|
+
select,
|
|
53
|
+
filters,
|
|
54
|
+
sorters,
|
|
55
|
+
perPage,
|
|
56
|
+
})
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* получение одной статьи
|
|
61
|
+
*/
|
|
62
|
+
async getArticleOne({ id }) {
|
|
63
|
+
return this.fetcher({
|
|
64
|
+
route: (0, apiRoute_1.apiRouteItemById)("articles", id)
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* политика конфиденциальности
|
|
69
|
+
*/
|
|
70
|
+
async getPolicy() {
|
|
71
|
+
return this.getNodeByCode("policy");
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* оферта
|
|
75
|
+
*/
|
|
76
|
+
async getTerms() {
|
|
77
|
+
return this.getNodeByCode("terms");
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Правила программы лояльности
|
|
81
|
+
*/
|
|
82
|
+
async getLoyalty() {
|
|
83
|
+
return this.getNodeByCode("loyalty");
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* как получить деньги
|
|
87
|
+
*/
|
|
88
|
+
async getInstruction() {
|
|
89
|
+
return await this.fetcher({
|
|
90
|
+
route: (0, apiRoute_1.apiRouteList)({
|
|
91
|
+
nodeCode: "instruction",
|
|
92
|
+
select: ["id", "title", "text", "image"],
|
|
93
|
+
sorters: ["sorter asc"],
|
|
94
|
+
perPage: 100,
|
|
95
|
+
})
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Согласие на обработку персональных данных
|
|
100
|
+
*/
|
|
101
|
+
async getAgreement() {
|
|
102
|
+
return this.getNodeByCode("agreement");
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* банки для выбора при запросе на вывод средств
|
|
106
|
+
* @param {number} props.page - страница. Отсчет страниц с первой, чтобы не было путаницы
|
|
107
|
+
* @param {string} props.searchTitle - поисковая строка по началу названия банка
|
|
108
|
+
*/
|
|
109
|
+
async getBanks({ page, searchTitle }) {
|
|
110
|
+
const filters = {};
|
|
111
|
+
if (searchTitle?.length)
|
|
112
|
+
filters.title = [searchTitle + "%"];
|
|
113
|
+
return await this.fetcher({
|
|
114
|
+
route: (0, apiRoute_1.apiRouteList)({
|
|
115
|
+
nodeCode: "bank",
|
|
116
|
+
select: ["id", "title"],
|
|
117
|
+
sorters: ["sorter asc", "title asc"],
|
|
118
|
+
perPage: 10,
|
|
119
|
+
filters,
|
|
120
|
+
page
|
|
121
|
+
})
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* получение списка специализаций врачей
|
|
126
|
+
* @param {number} props.page - страница. Отсчет страниц с первой, чтобы не было путаницы
|
|
127
|
+
* @param {string} props.searchTitle - поисковая строка по началу названия банка
|
|
128
|
+
*/
|
|
129
|
+
async getSpecializationList({ page, searchTitle }) {
|
|
130
|
+
const filters = {};
|
|
131
|
+
if (searchTitle?.length)
|
|
132
|
+
filters.title = [searchTitle + "%"];
|
|
133
|
+
return await this.fetcher({
|
|
134
|
+
route: (0, apiRoute_1.apiRouteList)({
|
|
135
|
+
nodeCode: "specialization",
|
|
136
|
+
select: ["id", "title"],
|
|
137
|
+
sorters: ["sorter asc", "title asc"],
|
|
138
|
+
perPage: 10,
|
|
139
|
+
filters,
|
|
140
|
+
page
|
|
141
|
+
})
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* поиск города
|
|
146
|
+
* @param {number} props.page - страница. Отсчет страниц с первой, чтобы не было путаницы
|
|
147
|
+
* @param {string} props.searchTitle - поисковая строка по началу названия банка
|
|
148
|
+
*/
|
|
149
|
+
async getCityList({ page, searchTitle }) {
|
|
150
|
+
const filters = {};
|
|
151
|
+
if (searchTitle?.length)
|
|
152
|
+
filters.title = [searchTitle + "%"];
|
|
153
|
+
return await this.fetcher({
|
|
154
|
+
route: (0, apiRoute_1.apiRouteList)({
|
|
155
|
+
nodeCode: "city",
|
|
156
|
+
select: ["id", "title"],
|
|
157
|
+
sorters: ["sorter asc"],
|
|
158
|
+
perPage: 20,
|
|
159
|
+
filters,
|
|
160
|
+
page
|
|
161
|
+
})
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* получение одного города
|
|
166
|
+
*/
|
|
167
|
+
async getCityOne({ id }) {
|
|
168
|
+
return this.fetcher({
|
|
169
|
+
route: (0, apiRoute_1.apiRouteItemById)("city", id)
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* баннер
|
|
174
|
+
* @param {number} props.type - тип баннера
|
|
175
|
+
*/
|
|
176
|
+
async getBannerRand({ type, signal }) {
|
|
177
|
+
return await this.fetcher({
|
|
178
|
+
route: (0, apiRoute_1.apiRouteBannerGetRand)(type),
|
|
179
|
+
options: { addToken: true, signal }
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* получение списка сторисов
|
|
184
|
+
*/
|
|
185
|
+
async getStoriesList({ select, page = 1, //отсчет страниц с первой, чтобы не было путаницы
|
|
186
|
+
perPage = 10, }) {
|
|
187
|
+
const data = await this.fetcher({
|
|
188
|
+
route: (0, apiRoute_1.apiRouteList)({
|
|
189
|
+
nodeCode: "stories",
|
|
190
|
+
page,
|
|
191
|
+
select,
|
|
192
|
+
perPage,
|
|
193
|
+
}),
|
|
194
|
+
options: { addToken: true }
|
|
195
|
+
});
|
|
196
|
+
return {
|
|
197
|
+
...data,
|
|
198
|
+
items: data.items.map(it => ({
|
|
199
|
+
...it,
|
|
200
|
+
sku: it?.sku
|
|
201
|
+
? { id: it.sku.id, title: it.sku.title }
|
|
202
|
+
: null
|
|
203
|
+
}))
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* получение одного сториса
|
|
208
|
+
*/
|
|
209
|
+
async getStoriesOne({ id }) {
|
|
210
|
+
const data = await this.fetcher({
|
|
211
|
+
route: (0, apiRoute_1.apiRouteItemById)("stories", id)
|
|
212
|
+
});
|
|
213
|
+
return {
|
|
214
|
+
...data,
|
|
215
|
+
item: {
|
|
216
|
+
...data.item,
|
|
217
|
+
sku: data.item?.sku
|
|
218
|
+
? { id: data.item.sku.id, title: data.item.sku.title }
|
|
219
|
+
: null
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* получение списка интро (приветственная инструкция)
|
|
225
|
+
*/
|
|
226
|
+
async getIntro() {
|
|
227
|
+
return this.fetcher({
|
|
228
|
+
route: (0, apiRoute_1.apiRouteList)({
|
|
229
|
+
nodeCode: "intro",
|
|
230
|
+
select: ["id", "title", "image"],
|
|
231
|
+
sorters: ["sorter asc"],
|
|
232
|
+
perPage: 50,
|
|
233
|
+
})
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
exports.ApiContent = ApiContent;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiGeoIp = void 0;
|
|
4
|
+
const apiRoute_1 = require("../http/apiRoute");
|
|
5
|
+
const abstract_1 = require("./abstract");
|
|
6
|
+
class ApiGeoIp extends abstract_1.ApiAbstract {
|
|
7
|
+
/**
|
|
8
|
+
* определение города по ip
|
|
9
|
+
*/
|
|
10
|
+
async detect() {
|
|
11
|
+
return this.fetcher({ route: apiRoute_1.apiRouteGeoDetect });
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.ApiGeoIp = ApiGeoIp;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { iStorage } from "../interfaces/iStorage";
|
|
2
|
+
import { ApiBookmarks } from "./bookmarks";
|
|
3
|
+
import { ApiChat } from "./chat";
|
|
4
|
+
import { ApiContent } from "./content";
|
|
5
|
+
import { ApiGeoIp } from "./geoIp";
|
|
6
|
+
import { ApiPayment } from "./payment";
|
|
7
|
+
import { ApiPromocode } from "./promocode";
|
|
8
|
+
import { ApiPush } from "./push";
|
|
9
|
+
import { ApiSurvey } from "./survey";
|
|
10
|
+
import { ApiStat } from "./stat";
|
|
11
|
+
import { ApiUser } from "./user";
|
|
12
|
+
export declare function createClient({ host, wsHost, storage }: {
|
|
13
|
+
host: string;
|
|
14
|
+
wsHost: string;
|
|
15
|
+
storage?: iStorage;
|
|
16
|
+
}): {
|
|
17
|
+
user: ApiUser;
|
|
18
|
+
content: ApiContent;
|
|
19
|
+
geoIp: ApiGeoIp;
|
|
20
|
+
survey: ApiSurvey;
|
|
21
|
+
payment: ApiPayment;
|
|
22
|
+
stat: ApiStat;
|
|
23
|
+
chat: ApiChat;
|
|
24
|
+
bookmarks: ApiBookmarks;
|
|
25
|
+
push: ApiPush;
|
|
26
|
+
promocode: ApiPromocode;
|
|
27
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createClient = createClient;
|
|
4
|
+
const default_1 = require("../storage/default");
|
|
5
|
+
const user_1 = require("../storage/user");
|
|
6
|
+
const bookmarks_1 = require("./bookmarks");
|
|
7
|
+
const chat_1 = require("./chat");
|
|
8
|
+
const content_1 = require("./content");
|
|
9
|
+
const geoIp_1 = require("./geoIp");
|
|
10
|
+
const payment_1 = require("./payment");
|
|
11
|
+
const promocode_1 = require("./promocode");
|
|
12
|
+
const push_1 = require("./push");
|
|
13
|
+
const survey_1 = require("./survey");
|
|
14
|
+
const stat_1 = require("./stat");
|
|
15
|
+
const user_2 = require("./user");
|
|
16
|
+
function createClient({ host, wsHost, storage }) {
|
|
17
|
+
const userStorage = new user_1.UserStorage(storage || default_1.storageDefault);
|
|
18
|
+
const constructorProps = { host, wsHost, userStorage };
|
|
19
|
+
return {
|
|
20
|
+
user: new user_2.ApiUser(constructorProps),
|
|
21
|
+
content: new content_1.ApiContent(constructorProps),
|
|
22
|
+
geoIp: new geoIp_1.ApiGeoIp(constructorProps),
|
|
23
|
+
survey: new survey_1.ApiSurvey(constructorProps),
|
|
24
|
+
payment: new payment_1.ApiPayment(constructorProps),
|
|
25
|
+
stat: new stat_1.ApiStat(constructorProps),
|
|
26
|
+
chat: new chat_1.ApiChat(constructorProps),
|
|
27
|
+
bookmarks: new bookmarks_1.ApiBookmarks(constructorProps),
|
|
28
|
+
push: new push_1.ApiPush(constructorProps),
|
|
29
|
+
promocode: new promocode_1.ApiPromocode(constructorProps),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ApiAbstract } from "./abstract";
|
|
2
|
+
import { iPagingItems } from "../interfaces/iPagingItems";
|
|
3
|
+
import { iPayment } from "../interfaces/iPayment";
|
|
4
|
+
import { iBalance } from "../interfaces/iBalance";
|
|
5
|
+
export declare class ApiPayment extends ApiAbstract {
|
|
6
|
+
/**
|
|
7
|
+
* добавление запроса на выплату по системе быстрых платежей
|
|
8
|
+
* * @param {number} props.sum - сумма выплаты
|
|
9
|
+
* * @param {number} props.bank - id банка из справочника content.getBanks
|
|
10
|
+
*/
|
|
11
|
+
addSBP(props: {
|
|
12
|
+
sum: number;
|
|
13
|
+
bank: number;
|
|
14
|
+
}): Promise<iPayment>;
|
|
15
|
+
/**
|
|
16
|
+
* добавление запроса на выплату по номеру карты
|
|
17
|
+
* * @param {number} props.sum - сумма выплаты
|
|
18
|
+
* * @param {number} props.card_number - номер карты
|
|
19
|
+
*/
|
|
20
|
+
addCard(props: {
|
|
21
|
+
sum: number;
|
|
22
|
+
card_number: number;
|
|
23
|
+
}): Promise<iPayment>;
|
|
24
|
+
/**
|
|
25
|
+
* список начислений
|
|
26
|
+
* * @param {number} page - отсчет страниц с первой, чтобы не было путаницы
|
|
27
|
+
*/
|
|
28
|
+
getList<Keys extends keyof iPayment>({ page, select, }: {
|
|
29
|
+
page: number;
|
|
30
|
+
select: Keys[];
|
|
31
|
+
}): Promise<iPagingItems<Pick<iPayment, Keys>, {
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
} | undefined>>;
|
|
34
|
+
/**
|
|
35
|
+
* баланс пользователя
|
|
36
|
+
*/
|
|
37
|
+
balance(): Promise<iBalance>;
|
|
38
|
+
/**
|
|
39
|
+
* Получить URL для верификации в SolarStaff
|
|
40
|
+
* Необходимо для получения выплат
|
|
41
|
+
*/
|
|
42
|
+
getVerificationUrl(): Promise<{
|
|
43
|
+
url: string;
|
|
44
|
+
verified: boolean;
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* Проверить статус верификации пользователя в SolarStaff
|
|
48
|
+
*/
|
|
49
|
+
checkVerificationStatus(): Promise<{
|
|
50
|
+
verified: boolean;
|
|
51
|
+
status: "not_started" | "pending" | "active" | "blocked";
|
|
52
|
+
message: string;
|
|
53
|
+
}>;
|
|
54
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiPayment = void 0;
|
|
4
|
+
const abstract_1 = require("./abstract");
|
|
5
|
+
const apiRoute_1 = require("../http/apiRoute");
|
|
6
|
+
const payoutType_1 = require("../interfaces/payoutType");
|
|
7
|
+
const apiError_1 = require("../http/apiError");
|
|
8
|
+
class ApiPayment extends abstract_1.ApiAbstract {
|
|
9
|
+
/**
|
|
10
|
+
* добавление запроса на выплату по системе быстрых платежей
|
|
11
|
+
* * @param {number} props.sum - сумма выплаты
|
|
12
|
+
* * @param {number} props.bank - id банка из справочника content.getBanks
|
|
13
|
+
*/
|
|
14
|
+
async addSBP(props) {
|
|
15
|
+
if (!await this.userStorage.isAuth())
|
|
16
|
+
throw new apiError_1.ApiError(401, "Пользователь не авторизован");
|
|
17
|
+
const data = await this.fetcher({
|
|
18
|
+
route: apiRoute_1.apiRoutePaymentAdd,
|
|
19
|
+
postBody: { ...props, type: payoutType_1.PayoutType.sbp },
|
|
20
|
+
options: { addToken: true }
|
|
21
|
+
});
|
|
22
|
+
return data.payment;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* добавление запроса на выплату по номеру карты
|
|
26
|
+
* * @param {number} props.sum - сумма выплаты
|
|
27
|
+
* * @param {number} props.card_number - номер карты
|
|
28
|
+
*/
|
|
29
|
+
async addCard(props) {
|
|
30
|
+
if (!await this.userStorage.isAuth())
|
|
31
|
+
throw new apiError_1.ApiError(401, "Пользователь не авторизован");
|
|
32
|
+
const data = await this.fetcher({
|
|
33
|
+
route: apiRoute_1.apiRoutePaymentAdd,
|
|
34
|
+
postBody: { ...props, type: payoutType_1.PayoutType.card },
|
|
35
|
+
options: { addToken: true }
|
|
36
|
+
});
|
|
37
|
+
return data.payment;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* список начислений
|
|
41
|
+
* * @param {number} page - отсчет страниц с первой, чтобы не было путаницы
|
|
42
|
+
*/
|
|
43
|
+
async getList({ page = 1, select, }) {
|
|
44
|
+
if (!await this.userStorage.isAuth())
|
|
45
|
+
throw new apiError_1.ApiError(401, "Пользователь не авторизован");
|
|
46
|
+
return await this.fetcher({
|
|
47
|
+
route: (0, apiRoute_1.apiRoutePaymentList)({
|
|
48
|
+
page,
|
|
49
|
+
sorters: ["id desc"],
|
|
50
|
+
select
|
|
51
|
+
}),
|
|
52
|
+
options: { addToken: true }
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* баланс пользователя
|
|
57
|
+
*/
|
|
58
|
+
async balance() {
|
|
59
|
+
if (!await this.userStorage.isAuth())
|
|
60
|
+
throw new apiError_1.ApiError(401, "Пользователь не авторизован");
|
|
61
|
+
return await this.fetcher({
|
|
62
|
+
route: apiRoute_1.apiRoutePaymentBalance,
|
|
63
|
+
options: { addToken: true }
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Получить URL для верификации в SolarStaff
|
|
68
|
+
* Необходимо для получения выплат
|
|
69
|
+
*/
|
|
70
|
+
async getVerificationUrl() {
|
|
71
|
+
if (!await this.userStorage.isAuth())
|
|
72
|
+
throw new apiError_1.ApiError(401, "Пользователь не авторизован");
|
|
73
|
+
return await this.fetcher({
|
|
74
|
+
route: apiRoute_1.apiRoutePaymentVerificationUrl,
|
|
75
|
+
options: { addToken: true }
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Проверить статус верификации пользователя в SolarStaff
|
|
80
|
+
*/
|
|
81
|
+
async checkVerificationStatus() {
|
|
82
|
+
if (!await this.userStorage.isAuth())
|
|
83
|
+
throw new apiError_1.ApiError(401, "Пользователь не авторизован");
|
|
84
|
+
return await this.fetcher({
|
|
85
|
+
route: apiRoute_1.apiRoutePaymentVerificationStatus,
|
|
86
|
+
options: { addToken: true }
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.ApiPayment = ApiPayment;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiPromocode = void 0;
|
|
4
|
+
const abstract_1 = require("./abstract");
|
|
5
|
+
const apiRoute_1 = require("../http/apiRoute");
|
|
6
|
+
const apiError_1 = require("../http/apiError");
|
|
7
|
+
class ApiPromocode extends abstract_1.ApiAbstract {
|
|
8
|
+
/**
|
|
9
|
+
* активация промокода
|
|
10
|
+
*/
|
|
11
|
+
async activate(code) {
|
|
12
|
+
if (!await this.userStorage.isAuth())
|
|
13
|
+
throw new apiError_1.ApiError(401, "Пользователь не авторизован");
|
|
14
|
+
const { sum } = await this.fetcher({
|
|
15
|
+
route: apiRoute_1.apiRoutePromocodeActivate,
|
|
16
|
+
postBody: { code },
|
|
17
|
+
options: { addToken: true }
|
|
18
|
+
});
|
|
19
|
+
return { sum };
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.ApiPromocode = ApiPromocode;
|