@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
package/dist/api/user.js
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiUser = void 0;
|
|
4
|
+
const apiError_1 = require("../http/apiError");
|
|
5
|
+
const apiRoute_1 = require("../http/apiRoute");
|
|
6
|
+
const abstract_1 = require("./abstract");
|
|
7
|
+
const userLogin_1 = require("../eventBus/userLogin");
|
|
8
|
+
const userLogout_1 = require("../eventBus/userLogout");
|
|
9
|
+
class ApiUser extends abstract_1.ApiAbstract {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
/**
|
|
13
|
+
* подписка на событие logout
|
|
14
|
+
*/
|
|
15
|
+
this.onLogout = userLogout_1.eventBusUserLogout.subscribe;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* получает пользователя из расшифрованного JWT токена без запроса на backend
|
|
19
|
+
*/
|
|
20
|
+
get() {
|
|
21
|
+
return this.userStorage.getUser();
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* получает полную информацию о пользователе с сервера
|
|
25
|
+
*/
|
|
26
|
+
async getFull() {
|
|
27
|
+
if (!await this.userStorage.isAuth())
|
|
28
|
+
throw new apiError_1.ApiError(401, "Пользователь не авторизован");
|
|
29
|
+
return this.fetcher({ route: apiRoute_1.apiRouteUserGetMe, options: { addToken: true } });
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 1ый этап регистрации или авторизации
|
|
33
|
+
*/
|
|
34
|
+
async loginOrRegisterByPhone({ phone }) {
|
|
35
|
+
try {
|
|
36
|
+
await this.fetcher({ route: apiRoute_1.apiRouteUserLoginWithCode, postBody: { login: phone } });
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
if (error instanceof apiError_1.ApiError && error.message == "confirm_phone")
|
|
40
|
+
return;
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 2ой этап регистрации или авторизации - ввод кода подтверждения
|
|
46
|
+
*/
|
|
47
|
+
async loginOrRegisterByPhoneConfirm({ phone, code }) {
|
|
48
|
+
const data = await this.fetcher({
|
|
49
|
+
route: apiRoute_1.apiRouteUserLoginWithCode,
|
|
50
|
+
postBody: { login: phone, phone_code: code }
|
|
51
|
+
});
|
|
52
|
+
const user = await this.userStorage.setUser(data.accessToken, data.refreshToken);
|
|
53
|
+
if (user)
|
|
54
|
+
userLogin_1.eventBusUserLogin.broadcast(user);
|
|
55
|
+
return user;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Ввод реферального кода другого пользователя
|
|
59
|
+
* @param {string} props.ref - реферальный код
|
|
60
|
+
*/
|
|
61
|
+
async setRef({ ref }) {
|
|
62
|
+
await this.fetcher({
|
|
63
|
+
route: apiRoute_1.apiRouteUserSetRef,
|
|
64
|
+
postBody: { ref },
|
|
65
|
+
options: { addToken: true }
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* редактирование пользователя
|
|
70
|
+
* если метод вернул false - то необходимо ввести код из email и передать его в data.email_code
|
|
71
|
+
* @param {string} props.email - опционально, для смены email. Если емейл не меняется то не передаем этот параметр или передаем пустую строку
|
|
72
|
+
* @param {number} props.city - id города
|
|
73
|
+
* @param {string} props.email_code - код отправленный на email. Первый раз метод вызывается без него, если метод вернул false необходимо вызвать повторно передав код из email
|
|
74
|
+
*/
|
|
75
|
+
async editUser(data) {
|
|
76
|
+
if (!await this.userStorage.isAuth())
|
|
77
|
+
throw new apiError_1.ApiError(401, "Пользователь не авторизован");
|
|
78
|
+
try {
|
|
79
|
+
await this.fetcher({
|
|
80
|
+
route: apiRoute_1.apiRouteUserEdit,
|
|
81
|
+
postBody: data,
|
|
82
|
+
options: { addToken: true }
|
|
83
|
+
});
|
|
84
|
+
if (data.firstname?.length && data.lastname?.length) {
|
|
85
|
+
await this.userStorage.saveUser({ firstname: data.firstname, lastname: data.lastname });
|
|
86
|
+
}
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
if (error instanceof apiError_1.ApiError && error.message == "confirm_email")
|
|
91
|
+
return false;
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* выход из ЛК
|
|
97
|
+
*/
|
|
98
|
+
async logout() {
|
|
99
|
+
if (!await this.userStorage.isAuth())
|
|
100
|
+
throw new apiError_1.ApiError(401, "Пользователь не авторизован");
|
|
101
|
+
await this.userStorage.clearUser();
|
|
102
|
+
await userLogout_1.eventBusUserLogout.broadcast();
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* выход из ЛК (выход со всех устройств, на сервере будет удален refresh token, accessToken продолжит действовать остаток своего времени. Другие устройства разлогинет в течении 5 минут)
|
|
106
|
+
*/
|
|
107
|
+
async logoutAllDevice() {
|
|
108
|
+
if (!await this.userStorage.isAuth())
|
|
109
|
+
throw new apiError_1.ApiError(401, "Пользователь не авторизован");
|
|
110
|
+
await this.fetcher({
|
|
111
|
+
route: apiRoute_1.apiRouteUserLogout,
|
|
112
|
+
postBody: { logout: 1 },
|
|
113
|
+
options: { addToken: true }
|
|
114
|
+
});
|
|
115
|
+
await this.userStorage.clearUser();
|
|
116
|
+
await userLogout_1.eventBusUserLogout.broadcast();
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* удаление аккаунта пользователя, сделавшего запрос и всех связанных с ним сущностей (уведомлений, выплат, чеков, статистики и т.д.)
|
|
120
|
+
*/
|
|
121
|
+
async delete() {
|
|
122
|
+
if (!await this.userStorage.isAuth())
|
|
123
|
+
throw new apiError_1.ApiError(401, "Пользователь не авторизован");
|
|
124
|
+
await this.fetcher({
|
|
125
|
+
route: apiRoute_1.apiRouteUserDelete,
|
|
126
|
+
postBody: { confirm: "1" },
|
|
127
|
+
options: { addToken: true }
|
|
128
|
+
});
|
|
129
|
+
await this.userStorage.clearUser();
|
|
130
|
+
await userLogout_1.eventBusUserLogout.broadcast();
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* возвращает реф. код пользователя, который другие пользователя вводят при регистрации
|
|
134
|
+
*/
|
|
135
|
+
async getMyReferer() {
|
|
136
|
+
return (await this.getFull())?.my_ref_code;
|
|
137
|
+
}
|
|
138
|
+
// =====================================================
|
|
139
|
+
// Методы для работы с дипломом (Medotvet)
|
|
140
|
+
// =====================================================
|
|
141
|
+
/**
|
|
142
|
+
* Загрузить файлы диплома
|
|
143
|
+
* @param formData - FormData с файлами (ключ "diploma[]")
|
|
144
|
+
*/
|
|
145
|
+
async uploadDiploma(formData) {
|
|
146
|
+
if (!await this.userStorage.isAuth())
|
|
147
|
+
throw new apiError_1.ApiError(401, "Пользователь не авторизован");
|
|
148
|
+
return await this.fetcher({
|
|
149
|
+
route: apiRoute_1.apiRouteUserDiplomaUpload,
|
|
150
|
+
postBody: formData,
|
|
151
|
+
options: { addToken: true }
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Получить статус диплома
|
|
156
|
+
* @returns diploma_status: 1-не загружен, 2-на проверке, 3-верифицирован, 4-отклонен
|
|
157
|
+
*/
|
|
158
|
+
async getDiplomaStatus() {
|
|
159
|
+
if (!await this.userStorage.isAuth())
|
|
160
|
+
throw new apiError_1.ApiError(401, "Пользователь не авторизован");
|
|
161
|
+
return await this.fetcher({
|
|
162
|
+
route: apiRoute_1.apiRouteUserDiplomaStatus,
|
|
163
|
+
options: { addToken: true }
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
exports.ApiUser = ApiUser;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.abstract = void 0;
|
|
4
|
+
const subscriptions = {};
|
|
5
|
+
const subscribe = (eventName, callback) => {
|
|
6
|
+
if (!subscriptions[eventName]) {
|
|
7
|
+
subscriptions[eventName] = new Set();
|
|
8
|
+
}
|
|
9
|
+
const callbacks = subscriptions[eventName];
|
|
10
|
+
callbacks.add(callback);
|
|
11
|
+
return () => {
|
|
12
|
+
callbacks.delete(callback);
|
|
13
|
+
if (callbacks.size === 0) {
|
|
14
|
+
delete subscriptions[eventName];
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
const broadcast = async (eventName, ...args) => {
|
|
19
|
+
if (!subscriptions[eventName])
|
|
20
|
+
return;
|
|
21
|
+
const callbacks = subscriptions[eventName];
|
|
22
|
+
for (const callback of Array.from(callbacks)) {
|
|
23
|
+
await callback(...args);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
exports.abstract = {
|
|
27
|
+
subscribe,
|
|
28
|
+
broadcast
|
|
29
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.eventBusUserLogin = void 0;
|
|
4
|
+
const abstract_1 = require("./abstract");
|
|
5
|
+
const eventName = "userLogin";
|
|
6
|
+
const subscribe = (callback) => abstract_1.abstract.subscribe(eventName, callback);
|
|
7
|
+
const broadcast = (user) => abstract_1.abstract.broadcast(eventName, user);
|
|
8
|
+
exports.eventBusUserLogin = {
|
|
9
|
+
subscribe,
|
|
10
|
+
broadcast
|
|
11
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.eventBusUserLogout = void 0;
|
|
4
|
+
const abstract_1 = require("./abstract");
|
|
5
|
+
const eventName = "userLogout";
|
|
6
|
+
const subscribe = (callback) => abstract_1.abstract.subscribe(eventName, callback);
|
|
7
|
+
const broadcast = () => abstract_1.abstract.broadcast(eventName);
|
|
8
|
+
exports.eventBusUserLogout = {
|
|
9
|
+
subscribe,
|
|
10
|
+
broadcast
|
|
11
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { iAppStore } from "../interfaces/iAppStore";
|
|
2
|
+
import { iFilter } from "../interfaces/iFilter";
|
|
3
|
+
import { iGetNodeListProps } from "../interfaces/iGetNodeListProps";
|
|
4
|
+
import { iPayment } from "../interfaces/iPayment";
|
|
5
|
+
import { iPush } from "../interfaces/iPush";
|
|
6
|
+
import { iSurvey } from "../interfaces/iSurvey";
|
|
7
|
+
export declare const apiRouteEnv = "/env";
|
|
8
|
+
export declare const apiRouteCheckAppVersion: (appStore: iAppStore, appVersion: string) => string;
|
|
9
|
+
export declare const apiRouteGetCloudVersion: (appStore: iAppStore) => string;
|
|
10
|
+
export declare const apiRouteList: <T>({ nodeCode, nodeGenerator, page, filters, sorters, select, perPage, subNodes, }: {
|
|
11
|
+
nodeCode: string;
|
|
12
|
+
nodeGenerator?: string[];
|
|
13
|
+
page?: number;
|
|
14
|
+
filters?: iFilter<T>;
|
|
15
|
+
sorters?: string[];
|
|
16
|
+
select?: string[];
|
|
17
|
+
perPage?: number;
|
|
18
|
+
subNodes?: boolean;
|
|
19
|
+
}) => string;
|
|
20
|
+
export declare const apiRouteFilters: <T>({ nodeCode, nodeGenerator, filters, subNodes, }: {
|
|
21
|
+
nodeCode: string;
|
|
22
|
+
nodeGenerator?: string[];
|
|
23
|
+
filters?: iFilter<T>;
|
|
24
|
+
subNodes?: boolean;
|
|
25
|
+
}) => string;
|
|
26
|
+
export declare const apiRouteItem: (nodeCode: string, itemCode: string) => string;
|
|
27
|
+
export declare const apiRouteItemById: (nodeCode: string, itemId: number) => string;
|
|
28
|
+
export declare const apiRouteNodeTree: (parent?: number) => string;
|
|
29
|
+
export declare const apiRouteNodeTreeContentByFilters: <T>({ parent, filters, subNodes, }: {
|
|
30
|
+
parent: number;
|
|
31
|
+
filters?: iFilter<T>;
|
|
32
|
+
subNodes: boolean;
|
|
33
|
+
}) => string;
|
|
34
|
+
export declare const apiRouteNodeList: <T>({ page, filters, sorter, perPage, setParams }: iGetNodeListProps<T>) => string;
|
|
35
|
+
export declare const apiRouteNode: (nodeCode: string, nodeGenerator?: string[]) => string;
|
|
36
|
+
export declare const apiRouteNodeById: (nodeId: number) => string;
|
|
37
|
+
export declare const apiRouteNodeGeneratedLinks: (nodeCode: string, pageIndex?: number, isAll?: boolean) => string;
|
|
38
|
+
export declare const apiRouteBasketTotal: () => string;
|
|
39
|
+
export declare const apiRouteBasketGet: () => string;
|
|
40
|
+
export declare const apiRouteBasketMutate: () => string;
|
|
41
|
+
export declare const apiRouteBasketMoveToDraft: () => string;
|
|
42
|
+
export declare const apiRouteGeoDetect = "/geo/detect";
|
|
43
|
+
export declare const apiRouteUserGetMe = "/user/get_me";
|
|
44
|
+
export declare const apiRouteUserRefresh = "/user/refresh";
|
|
45
|
+
export declare const apiRouteUserLoginWithCode = "/user/login_with_code";
|
|
46
|
+
export declare const apiRouteUserEdit = "/user/edit";
|
|
47
|
+
export declare const apiRouteUserUploadPhoto = "/user/upload_photo";
|
|
48
|
+
export declare const apiRouteUserLogout = "/user/logout";
|
|
49
|
+
export declare const apiRouteUserDelete = "/user/delete";
|
|
50
|
+
export declare const apiRouteUserSetRef = "/user/set_ref";
|
|
51
|
+
export declare const apiRouteUserDiplomaUpload = "/user/diploma";
|
|
52
|
+
export declare const apiRouteUserDiplomaStatus = "/user/diploma/status";
|
|
53
|
+
export declare const apiRouteSurveyList: ({ page, filters, sorters, select, bookmarks, }: {
|
|
54
|
+
page?: number;
|
|
55
|
+
filters?: iFilter<iSurvey>;
|
|
56
|
+
sorters?: string[];
|
|
57
|
+
select?: string[];
|
|
58
|
+
bookmarks?: boolean;
|
|
59
|
+
}) => string;
|
|
60
|
+
export declare const apiRouteSurveyItem: (id: number) => string;
|
|
61
|
+
export declare const apiRouteSurveyStart: (surveyId: number) => string;
|
|
62
|
+
export declare const apiRouteSurveySaveAnswer: (userSurveyId: number) => string;
|
|
63
|
+
export declare const apiRouteSurveyCancel: (userSurveyId: number) => string;
|
|
64
|
+
export declare const apiRouteSurveyHistory: ({ page }?: {
|
|
65
|
+
page?: number;
|
|
66
|
+
}) => string;
|
|
67
|
+
export declare const apiRoutePaymentAdd = "/payment/add";
|
|
68
|
+
export declare const apiRoutePaymentList: ({ page, filters, sorters, select, }: {
|
|
69
|
+
page?: number;
|
|
70
|
+
filters?: iFilter<iPayment>;
|
|
71
|
+
sorters?: string[];
|
|
72
|
+
select?: string[];
|
|
73
|
+
}) => string;
|
|
74
|
+
export declare const apiRoutePaymentBalance = "/payment/balance";
|
|
75
|
+
export declare const apiRoutePaymentVerificationUrl = "/payment/verification_url";
|
|
76
|
+
export declare const apiRoutePaymentVerificationStatus = "/payment/verification_status";
|
|
77
|
+
export declare const apiRouteViewAdd = "/view/add";
|
|
78
|
+
export declare const apiRouteStatAdd = "/stat/add";
|
|
79
|
+
export declare const apiRouteStatGet = "/stat/get";
|
|
80
|
+
export declare const apiRouteBookmarksGet = "/bookmarks/get";
|
|
81
|
+
export declare const apiRouteBookmarksAdd = "/bookmarks/add";
|
|
82
|
+
export declare const apiRouteBookmarksRemove = "/bookmarks/remove";
|
|
83
|
+
export declare const apiRouteBookmarksCount = "/bookmarks/count";
|
|
84
|
+
export declare const apiRouteBannerGetRand: (type: number) => string;
|
|
85
|
+
export declare const apiRoutePushList: ({ page, filters, sorters, select, }: {
|
|
86
|
+
page?: number;
|
|
87
|
+
filters?: iFilter<iPush>;
|
|
88
|
+
sorters?: string[];
|
|
89
|
+
select?: string[];
|
|
90
|
+
}) => string;
|
|
91
|
+
export declare const apiRoutePushCountNew = "/push/count_new";
|
|
92
|
+
export declare const apiRoutePushRegister = "/push/register";
|
|
93
|
+
export declare const apiRoutePushUnsubscribe = "/push/unsubscribe";
|
|
94
|
+
export declare const apiRoutePushIsSubscribed = "/push/is_subscribed";
|
|
95
|
+
export declare const apiRoutePushView = "/push/view";
|
|
96
|
+
export declare const apiRoutePushViewAll = "/push/view_all";
|
|
97
|
+
export declare const apiRouteChatUnread = "/chat/unread";
|
|
98
|
+
export declare const apiRoutePromocodeActivate = "/promocode/activate";
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.apiRoutePushRegister = exports.apiRoutePushCountNew = exports.apiRoutePushList = exports.apiRouteBannerGetRand = exports.apiRouteBookmarksCount = exports.apiRouteBookmarksRemove = exports.apiRouteBookmarksAdd = exports.apiRouteBookmarksGet = exports.apiRouteStatGet = exports.apiRouteStatAdd = exports.apiRouteViewAdd = exports.apiRoutePaymentVerificationStatus = exports.apiRoutePaymentVerificationUrl = exports.apiRoutePaymentBalance = exports.apiRoutePaymentList = exports.apiRoutePaymentAdd = exports.apiRouteSurveyHistory = exports.apiRouteSurveyCancel = exports.apiRouteSurveySaveAnswer = exports.apiRouteSurveyStart = exports.apiRouteSurveyItem = exports.apiRouteSurveyList = exports.apiRouteUserDiplomaStatus = exports.apiRouteUserDiplomaUpload = exports.apiRouteUserSetRef = exports.apiRouteUserDelete = exports.apiRouteUserLogout = exports.apiRouteUserUploadPhoto = exports.apiRouteUserEdit = exports.apiRouteUserLoginWithCode = exports.apiRouteUserRefresh = exports.apiRouteUserGetMe = exports.apiRouteGeoDetect = exports.apiRouteBasketMoveToDraft = exports.apiRouteBasketMutate = exports.apiRouteBasketGet = exports.apiRouteBasketTotal = exports.apiRouteNodeGeneratedLinks = exports.apiRouteNodeById = exports.apiRouteNode = exports.apiRouteNodeList = exports.apiRouteNodeTreeContentByFilters = exports.apiRouteNodeTree = exports.apiRouteItemById = exports.apiRouteItem = exports.apiRouteFilters = exports.apiRouteList = exports.apiRouteGetCloudVersion = exports.apiRouteCheckAppVersion = exports.apiRouteEnv = void 0;
|
|
4
|
+
exports.apiRoutePromocodeActivate = exports.apiRouteChatUnread = exports.apiRoutePushViewAll = exports.apiRoutePushView = exports.apiRoutePushIsSubscribed = exports.apiRoutePushUnsubscribe = void 0;
|
|
5
|
+
const queryString_1 = require("../utils/queryString");
|
|
6
|
+
exports.apiRouteEnv = "/env";
|
|
7
|
+
const apiRouteCheckAppVersion = (appStore, appVersion) => `/env/check_app_version/${appStore}/${appVersion}`;
|
|
8
|
+
exports.apiRouteCheckAppVersion = apiRouteCheckAppVersion;
|
|
9
|
+
const apiRouteGetCloudVersion = (appStore) => `/env/get_cloud_version/${appStore}`;
|
|
10
|
+
exports.apiRouteGetCloudVersion = apiRouteGetCloudVersion;
|
|
11
|
+
const apiRouteList = ({ nodeCode, nodeGenerator, page = 1, //отсчет страниц с первой, чтобы не было путаницы
|
|
12
|
+
filters = undefined, sorters = undefined, select = undefined, perPage = undefined, subNodes = false, }) => {
|
|
13
|
+
const hasFilters = filters && Object.keys(filters).length;
|
|
14
|
+
if (!nodeCode.includes("/type") && !nodeCode.includes("/tag/")) {
|
|
15
|
+
nodeCode = nodeCode.replaceAll("/", ".");
|
|
16
|
+
}
|
|
17
|
+
const getParams = [];
|
|
18
|
+
if (hasFilters)
|
|
19
|
+
getParams.push((0, queryString_1.queryString)({ filters: filters }));
|
|
20
|
+
if (sorters)
|
|
21
|
+
getParams.push((0, queryString_1.queryString)({ sorter: sorters }));
|
|
22
|
+
if (select)
|
|
23
|
+
getParams.push('select=' + select.join(","));
|
|
24
|
+
if (perPage)
|
|
25
|
+
getParams.push('perpage=' + perPage);
|
|
26
|
+
if (subNodes)
|
|
27
|
+
getParams.push('subnodes');
|
|
28
|
+
return `/content/${nodeCode}/list/${page}` +
|
|
29
|
+
(nodeGenerator?.length ? '/' + nodeGenerator.join(".") : '') +
|
|
30
|
+
(getParams ? '?' : '') +
|
|
31
|
+
getParams.join("&");
|
|
32
|
+
};
|
|
33
|
+
exports.apiRouteList = apiRouteList;
|
|
34
|
+
//метод получает фильтры и доступные значения фильтра
|
|
35
|
+
const apiRouteFilters = ({ nodeCode, nodeGenerator, filters = undefined, subNodes = false, }) => {
|
|
36
|
+
if (!nodeCode.includes("/type") && !nodeCode.includes("/tag/")) {
|
|
37
|
+
nodeCode = nodeCode.replaceAll("/", ".");
|
|
38
|
+
}
|
|
39
|
+
const getParams = [];
|
|
40
|
+
const hasFilters = filters && Object.keys(filters).length;
|
|
41
|
+
if (hasFilters)
|
|
42
|
+
getParams.push((0, queryString_1.queryString)({ filters: filters }));
|
|
43
|
+
if (subNodes)
|
|
44
|
+
getParams.push('subnodes');
|
|
45
|
+
return `/content/${nodeCode}/filters` +
|
|
46
|
+
(nodeGenerator?.length ? '/' + nodeGenerator.join(".") : '') +
|
|
47
|
+
(getParams ? '?' : '') +
|
|
48
|
+
getParams.join("&");
|
|
49
|
+
};
|
|
50
|
+
exports.apiRouteFilters = apiRouteFilters;
|
|
51
|
+
const apiRouteItem = (nodeCode, itemCode) => `/content/${nodeCode.replaceAll("/", ".")}/item/code/${itemCode}`;
|
|
52
|
+
exports.apiRouteItem = apiRouteItem;
|
|
53
|
+
const apiRouteItemById = (nodeCode, itemId) => `/content/${nodeCode.replaceAll("/", ".")}/item/id/${itemId}`;
|
|
54
|
+
exports.apiRouteItemById = apiRouteItemById;
|
|
55
|
+
const apiRouteNodeTree = (parent = 0) => `/node/tree/${parent}`;
|
|
56
|
+
exports.apiRouteNodeTree = apiRouteNodeTree;
|
|
57
|
+
//метод получает фильтры, возвращает подкатегории в которых есть товары по этим фильтрам
|
|
58
|
+
const apiRouteNodeTreeContentByFilters = ({ parent, filters = undefined, subNodes, }) => {
|
|
59
|
+
const getParams = [];
|
|
60
|
+
const hasFilters = filters && Object.keys(filters).length;
|
|
61
|
+
if (hasFilters)
|
|
62
|
+
getParams.push((0, queryString_1.queryString)({ filters: filters }));
|
|
63
|
+
if (subNodes)
|
|
64
|
+
getParams.push('subnodes');
|
|
65
|
+
return `/node/tree/by_content_filters/${parent}` +
|
|
66
|
+
(getParams ? '?' : '') +
|
|
67
|
+
getParams.join("&");
|
|
68
|
+
};
|
|
69
|
+
exports.apiRouteNodeTreeContentByFilters = apiRouteNodeTreeContentByFilters;
|
|
70
|
+
const apiRouteNodeList = ({ page = 1, //отсчет страниц с первой, чтобы не было путаницы
|
|
71
|
+
filters = undefined, sorter = undefined, perPage = undefined, setParams = false }) => {
|
|
72
|
+
const hasFilters = filters && Object.keys(filters).length;
|
|
73
|
+
const getParams = [];
|
|
74
|
+
if (hasFilters)
|
|
75
|
+
getParams.push((0, queryString_1.queryString)({ filters: filters }));
|
|
76
|
+
if (sorter)
|
|
77
|
+
getParams.push((0, queryString_1.queryString)({ sorter: sorter }));
|
|
78
|
+
if (perPage)
|
|
79
|
+
getParams.push('perpage=' + perPage);
|
|
80
|
+
if (setParams)
|
|
81
|
+
getParams.push('set_params');
|
|
82
|
+
return `/node/list/${page}` +
|
|
83
|
+
(getParams ? '?' : '') +
|
|
84
|
+
getParams.join("&");
|
|
85
|
+
};
|
|
86
|
+
exports.apiRouteNodeList = apiRouteNodeList;
|
|
87
|
+
const apiRouteNode = (nodeCode, nodeGenerator) => `/node/item/${nodeCode.replaceAll("/", ".")}` +
|
|
88
|
+
(nodeGenerator?.length ? '/' + nodeGenerator.join(".") : '');
|
|
89
|
+
exports.apiRouteNode = apiRouteNode;
|
|
90
|
+
const apiRouteNodeById = (nodeId) => `/node/item/id/${nodeId}`;
|
|
91
|
+
exports.apiRouteNodeById = apiRouteNodeById;
|
|
92
|
+
const apiRouteNodeGeneratedLinks = (nodeCode, pageIndex = 0, isAll = false) => `/content/${nodeCode.replaceAll("/", ".")}/generator_links/${pageIndex + 1}${isAll ? '/all' : ""}`;
|
|
93
|
+
exports.apiRouteNodeGeneratedLinks = apiRouteNodeGeneratedLinks;
|
|
94
|
+
//basket
|
|
95
|
+
const apiRouteBasketTotal = () => `/basket/total`;
|
|
96
|
+
exports.apiRouteBasketTotal = apiRouteBasketTotal;
|
|
97
|
+
const apiRouteBasketGet = () => `/basket/get`;
|
|
98
|
+
exports.apiRouteBasketGet = apiRouteBasketGet;
|
|
99
|
+
const apiRouteBasketMutate = () => `/basket/mutate`;
|
|
100
|
+
exports.apiRouteBasketMutate = apiRouteBasketMutate;
|
|
101
|
+
const apiRouteBasketMoveToDraft = () => `/basket/move_to_draft`;
|
|
102
|
+
exports.apiRouteBasketMoveToDraft = apiRouteBasketMoveToDraft;
|
|
103
|
+
//geo
|
|
104
|
+
exports.apiRouteGeoDetect = `/geo/detect`;
|
|
105
|
+
//user
|
|
106
|
+
exports.apiRouteUserGetMe = `/user/get_me`;
|
|
107
|
+
exports.apiRouteUserRefresh = `/user/refresh`;
|
|
108
|
+
exports.apiRouteUserLoginWithCode = `/user/login_with_code`;
|
|
109
|
+
exports.apiRouteUserEdit = '/user/edit';
|
|
110
|
+
exports.apiRouteUserUploadPhoto = '/user/upload_photo';
|
|
111
|
+
exports.apiRouteUserLogout = '/user/logout';
|
|
112
|
+
exports.apiRouteUserDelete = '/user/delete';
|
|
113
|
+
exports.apiRouteUserSetRef = '/user/set_ref';
|
|
114
|
+
// Диплом (Medotvet)
|
|
115
|
+
exports.apiRouteUserDiplomaUpload = '/user/diploma';
|
|
116
|
+
exports.apiRouteUserDiplomaStatus = '/user/diploma/status';
|
|
117
|
+
//survey
|
|
118
|
+
const apiRouteSurveyList = ({ page = 1, filters = undefined, sorters = undefined, select = undefined, bookmarks = false, }) => {
|
|
119
|
+
const hasFilters = filters && Object.keys(filters).length;
|
|
120
|
+
const getParams = [];
|
|
121
|
+
if (hasFilters)
|
|
122
|
+
getParams.push((0, queryString_1.queryString)({ filters: filters }));
|
|
123
|
+
if (sorters)
|
|
124
|
+
getParams.push((0, queryString_1.queryString)({ sorter: sorters }));
|
|
125
|
+
if (select)
|
|
126
|
+
getParams.push('select=' + select.join(","));
|
|
127
|
+
return `/survey/${bookmarks ? 'bookmarks' : 'list'}/${page}` +
|
|
128
|
+
(getParams.length ? '?' : '') +
|
|
129
|
+
getParams.join("&");
|
|
130
|
+
};
|
|
131
|
+
exports.apiRouteSurveyList = apiRouteSurveyList;
|
|
132
|
+
const apiRouteSurveyItem = (id) => `/survey/item/${id}`;
|
|
133
|
+
exports.apiRouteSurveyItem = apiRouteSurveyItem;
|
|
134
|
+
const apiRouteSurveyStart = (surveyId) => `/survey/${surveyId}/start`;
|
|
135
|
+
exports.apiRouteSurveyStart = apiRouteSurveyStart;
|
|
136
|
+
const apiRouteSurveySaveAnswer = (userSurveyId) => `/survey/${userSurveyId}/answer`;
|
|
137
|
+
exports.apiRouteSurveySaveAnswer = apiRouteSurveySaveAnswer;
|
|
138
|
+
const apiRouteSurveyCancel = (userSurveyId) => `/survey/${userSurveyId}/cancel`;
|
|
139
|
+
exports.apiRouteSurveyCancel = apiRouteSurveyCancel;
|
|
140
|
+
const apiRouteSurveyHistory = ({ page = 1 } = {}) => `/survey/history/${page}`;
|
|
141
|
+
exports.apiRouteSurveyHistory = apiRouteSurveyHistory;
|
|
142
|
+
//payment
|
|
143
|
+
exports.apiRoutePaymentAdd = '/payment/add';
|
|
144
|
+
const apiRoutePaymentList = ({ page = 1, //отсчет страниц с первой, чтобы не было путаницы
|
|
145
|
+
filters = undefined, sorters = undefined, select = undefined, }) => {
|
|
146
|
+
const hasFilters = filters && Object.keys(filters).length;
|
|
147
|
+
const getParams = [];
|
|
148
|
+
if (hasFilters)
|
|
149
|
+
getParams.push((0, queryString_1.queryString)({ filters: filters }));
|
|
150
|
+
if (sorters)
|
|
151
|
+
getParams.push((0, queryString_1.queryString)({ sorter: sorters }));
|
|
152
|
+
if (select)
|
|
153
|
+
getParams.push('select=' + select.join(","));
|
|
154
|
+
return `/payment/list/${page}` +
|
|
155
|
+
(getParams ? '?' : '') +
|
|
156
|
+
getParams.join("&");
|
|
157
|
+
};
|
|
158
|
+
exports.apiRoutePaymentList = apiRoutePaymentList;
|
|
159
|
+
exports.apiRoutePaymentBalance = '/payment/balance';
|
|
160
|
+
exports.apiRoutePaymentVerificationUrl = '/payment/verification_url';
|
|
161
|
+
exports.apiRoutePaymentVerificationStatus = '/payment/verification_status';
|
|
162
|
+
//stat
|
|
163
|
+
exports.apiRouteViewAdd = '/view/add';
|
|
164
|
+
exports.apiRouteStatAdd = '/stat/add';
|
|
165
|
+
exports.apiRouteStatGet = '/stat/get';
|
|
166
|
+
//bookmarks
|
|
167
|
+
exports.apiRouteBookmarksGet = '/bookmarks/get';
|
|
168
|
+
exports.apiRouteBookmarksAdd = '/bookmarks/add';
|
|
169
|
+
exports.apiRouteBookmarksRemove = '/bookmarks/remove';
|
|
170
|
+
exports.apiRouteBookmarksCount = '/bookmarks/count';
|
|
171
|
+
//banner
|
|
172
|
+
const apiRouteBannerGetRand = (type) => `/banner/get_rand/${type}`;
|
|
173
|
+
exports.apiRouteBannerGetRand = apiRouteBannerGetRand;
|
|
174
|
+
//push
|
|
175
|
+
const apiRoutePushList = ({ page = 1, //отсчет страниц с первой, чтобы не было путаницы
|
|
176
|
+
filters = undefined, sorters = undefined, select = undefined, }) => {
|
|
177
|
+
const hasFilters = filters && Object.keys(filters).length;
|
|
178
|
+
const getParams = [];
|
|
179
|
+
if (hasFilters)
|
|
180
|
+
getParams.push((0, queryString_1.queryString)({ filters: filters }));
|
|
181
|
+
if (sorters)
|
|
182
|
+
getParams.push((0, queryString_1.queryString)({ sorter: sorters }));
|
|
183
|
+
if (select)
|
|
184
|
+
getParams.push('select=' + select.join(","));
|
|
185
|
+
return `/push/list/${page}` +
|
|
186
|
+
(getParams ? '?' : '') +
|
|
187
|
+
getParams.join("&");
|
|
188
|
+
};
|
|
189
|
+
exports.apiRoutePushList = apiRoutePushList;
|
|
190
|
+
exports.apiRoutePushCountNew = '/push/count_new';
|
|
191
|
+
exports.apiRoutePushRegister = '/push/register';
|
|
192
|
+
exports.apiRoutePushUnsubscribe = '/push/unsubscribe';
|
|
193
|
+
exports.apiRoutePushIsSubscribed = '/push/is_subscribed';
|
|
194
|
+
exports.apiRoutePushView = '/push/view';
|
|
195
|
+
exports.apiRoutePushViewAll = '/push/view_all';
|
|
196
|
+
exports.apiRouteChatUnread = '/chat/unread';
|
|
197
|
+
exports.apiRoutePromocodeActivate = '/promocode/activate';
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiError = exports.createClient = void 0;
|
|
4
|
+
var index_1 = require("./api/index");
|
|
5
|
+
Object.defineProperty(exports, "createClient", { enumerable: true, get: function () { return index_1.createClient; } });
|
|
6
|
+
var apiError_1 = require("./http/apiError");
|
|
7
|
+
Object.defineProperty(exports, "ApiError", { enumerable: true, get: function () { return apiError_1.ApiError; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const apiStatEvents: readonly ["ARTICLES/VIEW", "ARTICLES/READ", "ARTICLES/SKU_BTN", "CATALOG_SKU/VIEW", "CATALOG_SKU/FAVORITE", "CATALOG_SKU/PROMO_BLOCK", "CATALOG_SKU/PRESENTATION_CLICK", "CATALOG_SKU/PRESENTATION_SUCCESS", "CATALOG_SKU/QUESTIONS_CLICK", "CATALOG_SKU/QUESTIONS_SUCCESS", "BANNER/VIEW", "BANNER/CLICK", "STORIES/VIEW"];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.apiStatEvents = void 0;
|
|
4
|
+
exports.apiStatEvents = [
|
|
5
|
+
"ARTICLES/VIEW", //открытие статьи
|
|
6
|
+
"ARTICLES/READ", //прочтение статьи
|
|
7
|
+
"ARTICLES/SKU_BTN", //клик по кнопке акции в статье
|
|
8
|
+
"CATALOG_SKU/VIEW", // открытие акции
|
|
9
|
+
"CATALOG_SKU/FAVORITE", //добавление акции в избранное
|
|
10
|
+
"CATALOG_SKU/PROMO_BLOCK", //клик по промоблоку
|
|
11
|
+
"CATALOG_SKU/PRESENTATION_CLICK", //клик по презентации
|
|
12
|
+
"CATALOG_SKU/PRESENTATION_SUCCESS", //полностью посмотрели презентацию
|
|
13
|
+
"CATALOG_SKU/QUESTIONS_CLICK", //клик по квизу (вопросам)
|
|
14
|
+
"CATALOG_SKU/QUESTIONS_SUCCESS", //ответили правильно на все вопросы
|
|
15
|
+
"BANNER/VIEW", //просмотр баннера
|
|
16
|
+
"BANNER/CLICK", //клик по баннеру
|
|
17
|
+
"STORIES/VIEW" //просмотр сториса
|
|
18
|
+
];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const DiplomaStatus: {
|
|
2
|
+
readonly not_uploaded: 1;
|
|
3
|
+
readonly pending: 2;
|
|
4
|
+
readonly verified: 3;
|
|
5
|
+
readonly rejected: 4;
|
|
6
|
+
};
|
|
7
|
+
export type DiplomaStatusKeys = keyof typeof DiplomaStatus;
|
|
8
|
+
export type DiplomaStatusValue = typeof DiplomaStatus[DiplomaStatusKeys];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type iAppStore = "App Store" | "Google Play" | "RuStore" | "AppGallery";
|