@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.
Files changed (250) hide show
  1. package/.cursor/rules/apcheki_sdk.mdc +90 -0
  2. package/README.md +136 -0
  3. package/dist/api/abstract.d.ts +21 -0
  4. package/dist/api/abstract.js +125 -0
  5. package/dist/api/bookmarks.d.ts +28 -0
  6. package/dist/api/bookmarks.js +121 -0
  7. package/dist/api/chat.d.ts +30 -0
  8. package/dist/api/chat.js +118 -0
  9. package/dist/api/content.d.ts +154 -0
  10. package/dist/api/content.js +237 -0
  11. package/dist/api/geoIp.d.ts +8 -0
  12. package/dist/api/geoIp.js +14 -0
  13. package/dist/api/index.d.ts +27 -0
  14. package/dist/api/index.js +31 -0
  15. package/dist/api/payment.d.ts +54 -0
  16. package/dist/api/payment.js +90 -0
  17. package/dist/api/promocode.d.ts +9 -0
  18. package/dist/api/promocode.js +22 -0
  19. package/dist/api/push.d.ts +54 -0
  20. package/dist/api/push.js +99 -0
  21. package/dist/api/receipt.d.ts +34 -0
  22. package/dist/api/receipt.js +60 -0
  23. package/dist/api/stat.d.ts +21 -0
  24. package/dist/api/stat.js +75 -0
  25. package/dist/api/survey.d.ts +82 -0
  26. package/dist/api/survey.js +122 -0
  27. package/dist/api/user.d.ts +80 -0
  28. package/dist/api/user.js +167 -0
  29. package/dist/eventBus/abstract.d.ts +4 -0
  30. package/dist/eventBus/abstract.js +29 -0
  31. package/dist/eventBus/userLogin.d.ts +5 -0
  32. package/dist/eventBus/userLogin.js +11 -0
  33. package/dist/eventBus/userLogout.d.ts +4 -0
  34. package/dist/eventBus/userLogout.js +11 -0
  35. package/dist/http/apiError.d.ts +4 -0
  36. package/dist/http/apiError.js +10 -0
  37. package/dist/http/apiRoute.d.ts +98 -0
  38. package/dist/http/apiRoute.js +197 -0
  39. package/dist/index.d.ts +2 -0
  40. package/dist/index.js +7 -0
  41. package/dist/interfaces/BannerType.d.ts +5 -0
  42. package/dist/interfaces/BannerType.js +7 -0
  43. package/dist/interfaces/apiStatEvents.d.ts +1 -0
  44. package/dist/interfaces/apiStatEvents.js +18 -0
  45. package/dist/interfaces/diplomaStatus.d.ts +8 -0
  46. package/dist/interfaces/diplomaStatus.js +9 -0
  47. package/dist/interfaces/iAppStore.d.ts +1 -0
  48. package/dist/interfaces/iAppStore.js +2 -0
  49. package/dist/interfaces/iAppVersionCheck.d.ts +5 -0
  50. package/dist/interfaces/iAppVersionCheck.js +2 -0
  51. package/dist/interfaces/iArticle.d.ts +15 -0
  52. package/dist/interfaces/iArticle.js +2 -0
  53. package/dist/interfaces/iBalance.d.ts +6 -0
  54. package/dist/interfaces/iBalance.js +2 -0
  55. package/dist/interfaces/iBank.d.ts +4 -0
  56. package/dist/interfaces/iBank.js +2 -0
  57. package/dist/interfaces/iBanner.d.ts +6 -0
  58. package/dist/interfaces/iBanner.js +2 -0
  59. package/dist/interfaces/iBookmark.d.ts +3 -0
  60. package/dist/interfaces/iBookmark.js +2 -0
  61. package/dist/interfaces/iBrand.d.ts +6 -0
  62. package/dist/interfaces/iBrand.js +2 -0
  63. package/dist/interfaces/iCatalog.d.ts +50 -0
  64. package/dist/interfaces/iCatalog.js +2 -0
  65. package/dist/interfaces/iCatalogNode.d.ts +3 -0
  66. package/dist/interfaces/iCatalogNode.js +2 -0
  67. package/dist/interfaces/iCatalogPreview.d.ts +17 -0
  68. package/dist/interfaces/iCatalogPreview.js +2 -0
  69. package/dist/interfaces/iCity.d.ts +4 -0
  70. package/dist/interfaces/iCity.js +2 -0
  71. package/dist/interfaces/iContentItem.d.ts +7 -0
  72. package/dist/interfaces/iContentItem.js +2 -0
  73. package/dist/interfaces/iEnv.d.ts +6 -0
  74. package/dist/interfaces/iEnv.js +2 -0
  75. package/dist/interfaces/iFilter.d.ts +11 -0
  76. package/dist/interfaces/iFilter.js +2 -0
  77. package/dist/interfaces/iGetNodeListProps.d.ts +8 -0
  78. package/dist/interfaces/iGetNodeListProps.js +2 -0
  79. package/dist/interfaces/iInstruction.d.ts +6 -0
  80. package/dist/interfaces/iInstruction.js +2 -0
  81. package/dist/interfaces/iIntro.d.ts +6 -0
  82. package/dist/interfaces/iIntro.js +2 -0
  83. package/dist/interfaces/iMessage.d.ts +25 -0
  84. package/dist/interfaces/iMessage.js +2 -0
  85. package/dist/interfaces/iNode.d.ts +26 -0
  86. package/dist/interfaces/iNode.js +2 -0
  87. package/dist/interfaces/iNodeTree.d.ts +14 -0
  88. package/dist/interfaces/iNodeTree.js +2 -0
  89. package/dist/interfaces/iPagingItems.d.ts +9 -0
  90. package/dist/interfaces/iPagingItems.js +2 -0
  91. package/dist/interfaces/iPayment.d.ts +20 -0
  92. package/dist/interfaces/iPayment.js +2 -0
  93. package/dist/interfaces/iPush.d.ts +14 -0
  94. package/dist/interfaces/iPush.js +2 -0
  95. package/dist/interfaces/iQuestion.d.ts +7 -0
  96. package/dist/interfaces/iQuestion.js +2 -0
  97. package/dist/interfaces/iReceipt.d.ts +20 -0
  98. package/dist/interfaces/iReceipt.js +2 -0
  99. package/dist/interfaces/iReceiptAddProps.d.ts +8 -0
  100. package/dist/interfaces/iReceiptAddProps.js +2 -0
  101. package/dist/interfaces/iReceiptProduct.d.ts +7 -0
  102. package/dist/interfaces/iReceiptProduct.js +2 -0
  103. package/dist/interfaces/iSearchParams.d.ts +11 -0
  104. package/dist/interfaces/iSearchParams.js +2 -0
  105. package/dist/interfaces/iShop.d.ts +6 -0
  106. package/dist/interfaces/iShop.js +2 -0
  107. package/dist/interfaces/iShopAddress.d.ts +5 -0
  108. package/dist/interfaces/iShopAddress.js +2 -0
  109. package/dist/interfaces/iSorter.d.ts +7 -0
  110. package/dist/interfaces/iSorter.js +2 -0
  111. package/dist/interfaces/iSpecialization.d.ts +4 -0
  112. package/dist/interfaces/iSpecialization.js +2 -0
  113. package/dist/interfaces/iStatView.d.ts +4 -0
  114. package/dist/interfaces/iStatView.js +2 -0
  115. package/dist/interfaces/iStorage.d.ts +5 -0
  116. package/dist/interfaces/iStorage.js +2 -0
  117. package/dist/interfaces/iStories.d.ts +13 -0
  118. package/dist/interfaces/iStories.js +2 -0
  119. package/dist/interfaces/iSubstance.d.ts +4 -0
  120. package/dist/interfaces/iSubstance.js +2 -0
  121. package/dist/interfaces/iSurvey.d.ts +36 -0
  122. package/dist/interfaces/iSurvey.js +2 -0
  123. package/dist/interfaces/iSurveyQuestion.d.ts +11 -0
  124. package/dist/interfaces/iSurveyQuestion.js +2 -0
  125. package/dist/interfaces/iSymptoms.d.ts +4 -0
  126. package/dist/interfaces/iSymptoms.js +2 -0
  127. package/dist/interfaces/iTestQuestion.d.ts +20 -0
  128. package/dist/interfaces/iTestQuestion.js +2 -0
  129. package/dist/interfaces/iTestResult.d.ts +17 -0
  130. package/dist/interfaces/iTestResult.js +2 -0
  131. package/dist/interfaces/iText.d.ts +3 -0
  132. package/dist/interfaces/iText.js +2 -0
  133. package/dist/interfaces/iUser.d.ts +35 -0
  134. package/dist/interfaces/iUser.js +2 -0
  135. package/dist/interfaces/iUserData.d.ts +10 -0
  136. package/dist/interfaces/iUserData.js +2 -0
  137. package/dist/interfaces/iUserEditProps.d.ts +20 -0
  138. package/dist/interfaces/iUserEditProps.js +2 -0
  139. package/dist/interfaces/iUserStat.d.ts +7 -0
  140. package/dist/interfaces/iUserStat.js +2 -0
  141. package/dist/interfaces/iUserSurvey.d.ts +21 -0
  142. package/dist/interfaces/iUserSurvey.js +11 -0
  143. package/dist/interfaces/iUserTokens.d.ts +4 -0
  144. package/dist/interfaces/iUserTokens.js +2 -0
  145. package/dist/interfaces/intRange.d.ts +3 -0
  146. package/dist/interfaces/intRange.js +2 -0
  147. package/dist/interfaces/itemType.d.ts +9 -0
  148. package/dist/interfaces/itemType.js +11 -0
  149. package/dist/interfaces/paymentStatus.d.ts +7 -0
  150. package/dist/interfaces/paymentStatus.js +9 -0
  151. package/dist/interfaces/paymentType.d.ts +5 -0
  152. package/dist/interfaces/paymentType.js +7 -0
  153. package/dist/interfaces/payoutType.d.ts +5 -0
  154. package/dist/interfaces/payoutType.js +7 -0
  155. package/dist/interfaces/pushStatus.d.ts +6 -0
  156. package/dist/interfaces/pushStatus.js +8 -0
  157. package/dist/interfaces/receiptStatus.d.ts +7 -0
  158. package/dist/interfaces/receiptStatus.js +9 -0
  159. package/dist/interfaces/testStatus.d.ts +6 -0
  160. package/dist/interfaces/testStatus.js +7 -0
  161. package/dist/interfaces/userRole.d.ts +6 -0
  162. package/dist/interfaces/userRole.js +14 -0
  163. package/dist/interfaces/userStatEvent.d.ts +5 -0
  164. package/dist/interfaces/userStatEvent.js +7 -0
  165. package/dist/interfaces/viewEventType.d.ts +13 -0
  166. package/dist/interfaces/viewEventType.js +19 -0
  167. package/dist/service/webSocketClient.d.ts +21 -0
  168. package/dist/service/webSocketClient.js +87 -0
  169. package/dist/storage/default.d.ts +2 -0
  170. package/dist/storage/default.js +8 -0
  171. package/dist/storage/user.d.ts +21 -0
  172. package/dist/storage/user.js +107 -0
  173. package/dist/utils/queryString.d.ts +3 -0
  174. package/dist/utils/queryString.js +21 -0
  175. package/package.json +31 -0
  176. package/src/api/abstract.ts +136 -0
  177. package/src/api/bookmarks.ts +109 -0
  178. package/src/api/chat.ts +127 -0
  179. package/src/api/content.ts +258 -0
  180. package/src/api/geoIp.ts +12 -0
  181. package/src/api/index.ts +38 -0
  182. package/src/api/payment.ts +105 -0
  183. package/src/api/promocode.ts +18 -0
  184. package/src/api/push.ts +102 -0
  185. package/src/api/stat.ts +74 -0
  186. package/src/api/survey.ts +164 -0
  187. package/src/api/user.ts +176 -0
  188. package/src/eventBus/abstract.ts +33 -0
  189. package/src/eventBus/userLogin.ts +13 -0
  190. package/src/eventBus/userLogout.ts +12 -0
  191. package/src/http/apiError.ts +9 -0
  192. package/src/http/apiRoute.ts +234 -0
  193. package/src/index.ts +2 -0
  194. package/src/interfaces/BannerType.ts +6 -0
  195. package/src/interfaces/apiStatEvents.ts +18 -0
  196. package/src/interfaces/diplomaStatus.ts +10 -0
  197. package/src/interfaces/iAppStore.ts +1 -0
  198. package/src/interfaces/iArticle.ts +12 -0
  199. package/src/interfaces/iBalance.ts +6 -0
  200. package/src/interfaces/iBank.ts +4 -0
  201. package/src/interfaces/iBanner.ts +6 -0
  202. package/src/interfaces/iBookmark.ts +3 -0
  203. package/src/interfaces/iCity.ts +4 -0
  204. package/src/interfaces/iContentItem.ts +6 -0
  205. package/src/interfaces/iEnv.ts +6 -0
  206. package/src/interfaces/iFilter.ts +16 -0
  207. package/src/interfaces/iGetNodeListProps.ts +9 -0
  208. package/src/interfaces/iInstruction.ts +6 -0
  209. package/src/interfaces/iIntro.ts +6 -0
  210. package/src/interfaces/iMessage.ts +25 -0
  211. package/src/interfaces/iNode.ts +24 -0
  212. package/src/interfaces/iNodeTree.ts +14 -0
  213. package/src/interfaces/iPagingItems.ts +8 -0
  214. package/src/interfaces/iPayment.ts +28 -0
  215. package/src/interfaces/iPush.ts +15 -0
  216. package/src/interfaces/iQuestion.ts +4 -0
  217. package/src/interfaces/iSearchParams.ts +12 -0
  218. package/src/interfaces/iSorter.ts +10 -0
  219. package/src/interfaces/iSpecialization.ts +4 -0
  220. package/src/interfaces/iStatView.ts +4 -0
  221. package/src/interfaces/iStorage.ts +5 -0
  222. package/src/interfaces/iStories.ts +10 -0
  223. package/src/interfaces/iSubstance.ts +4 -0
  224. package/src/interfaces/iSurvey.ts +38 -0
  225. package/src/interfaces/iSurveyQuestion.ts +15 -0
  226. package/src/interfaces/iSymptoms.ts +4 -0
  227. package/src/interfaces/iTestQuestion.ts +21 -0
  228. package/src/interfaces/iTestResult.ts +20 -0
  229. package/src/interfaces/iText.ts +3 -0
  230. package/src/interfaces/iUser.ts +37 -0
  231. package/src/interfaces/iUserData.ts +10 -0
  232. package/src/interfaces/iUserEditProps.ts +16 -0
  233. package/src/interfaces/iUserStat.ts +8 -0
  234. package/src/interfaces/iUserSurvey.ts +23 -0
  235. package/src/interfaces/iUserTokens.ts +4 -0
  236. package/src/interfaces/intRange.ts +5 -0
  237. package/src/interfaces/itemType.ts +10 -0
  238. package/src/interfaces/paymentStatus.ts +8 -0
  239. package/src/interfaces/paymentType.ts +6 -0
  240. package/src/interfaces/payoutType.ts +6 -0
  241. package/src/interfaces/pushStatus.ts +7 -0
  242. package/src/interfaces/testStatus.ts +8 -0
  243. package/src/interfaces/userRole.ts +13 -0
  244. package/src/interfaces/userStatEvent.ts +6 -0
  245. package/src/interfaces/viewEventType.ts +17 -0
  246. package/src/service/webSocketClient.ts +94 -0
  247. package/src/storage/default.ts +7 -0
  248. package/src/storage/user.ts +109 -0
  249. package/src/utils/queryString.ts +22 -0
  250. package/tsconfig.json +27 -0
@@ -0,0 +1 @@
1
+ export type iAppStore = "App Store" | "Google Play" | "RuStore" | "AppGallery"
@@ -0,0 +1,12 @@
1
+ export interface iArticle {
2
+ id: number
3
+ title: string
4
+ code: string
5
+ date: string
6
+ image_preview: string
7
+ image_head: string
8
+ video?: string
9
+ sku: { id: number, title: string } | null
10
+ announce: string
11
+ text: string
12
+ }
@@ -0,0 +1,6 @@
1
+ export interface iBalance {
2
+ accrued: number//за все время начислено
3
+ paid: number//за все время выплачено
4
+ invite_user: number//начислено кэшбека от друзей (+ реф. привлечение)
5
+ balance: number//баланс
6
+ }
@@ -0,0 +1,4 @@
1
+ export interface iBank {
2
+ id: number
3
+ title: string
4
+ }
@@ -0,0 +1,6 @@
1
+ export interface iBanner {
2
+ banner_id: number
3
+ sku_id: number
4
+ image: string
5
+ adv_info: string
6
+ }
@@ -0,0 +1,3 @@
1
+ export interface iBookmark {
2
+ item_key: string,
3
+ }
@@ -0,0 +1,4 @@
1
+ export interface iCity {
2
+ id: number
3
+ title: string
4
+ }
@@ -0,0 +1,6 @@
1
+ import { iNode } from "./iNode"
2
+
3
+ export interface iContentItem<TItem, TNode = { [key: string]: unknown } | undefined>{
4
+ node: iNode<TNode>
5
+ item: TItem
6
+ }
@@ -0,0 +1,6 @@
1
+ export interface iEnv {
2
+ referrer_cashback_percent: number
3
+ referrer_register_bonus: number
4
+ root_catalog_id: number
5
+ payout_min_price: number
6
+ }
@@ -0,0 +1,16 @@
1
+ export type iFilterValue = (string | number)[]
2
+
3
+ type ExcludeMethods<T> =
4
+ { [K in keyof T as (T[K] extends Function ? never : K)]: T[K] }
5
+
6
+ type iFilterKey<TKey> =
7
+ TKey |
8
+ (TKey extends string ? `!${TKey}` : never) |
9
+ (TKey extends string ? `>${TKey}` : never) |
10
+ (TKey extends string ? `<${TKey}` : never) |
11
+ (TKey extends string ? `*${TKey}` : never)
12
+
13
+ export type iFilter<T> = {//может содержать один вложенный фильтр для фильтрации по другой таблице
14
+ [key in iFilterKey<keyof ExcludeMethods<T>>]?: iFilterValue |
15
+ { [key in iFilterKey<keyof ExcludeMethods<T>>]?: iFilterValue }[]
16
+ }
@@ -0,0 +1,9 @@
1
+ import { iFilter } from "./iFilter"
2
+
3
+ export interface iGetNodeListProps<T> {
4
+ page?: number,
5
+ filters?: iFilter<T>,
6
+ sorter?: string | string[]
7
+ perPage?: number
8
+ setParams?: boolean // устанавливать ли переменную paramsDisplay с доп полями раздела или нет
9
+ }
@@ -0,0 +1,6 @@
1
+ export interface iInstruction {
2
+ id: number
3
+ title: string
4
+ text: string
5
+ image: string
6
+ }
@@ -0,0 +1,6 @@
1
+ export interface iIntro {
2
+ id: number
3
+ title?: string
4
+ text: string
5
+ image: string
6
+ }
@@ -0,0 +1,25 @@
1
+ export interface iMessageView {
2
+ route: "/view"
3
+ message_id: number
4
+ }
5
+ export interface iMessageError {
6
+ route: "/error"
7
+ text: string
8
+ }
9
+ export interface iMessageOutgoing {
10
+ route: "/message"
11
+ text: string
12
+ file: string | undefined
13
+ }
14
+ export interface iMessageIncome extends iMessageOutgoing {
15
+ id: number
16
+ date: Date
17
+ from_user_id: number
18
+ from_user_name: string
19
+ view: 0 | 1
20
+ }
21
+ export interface iMessageUnread {
22
+ route: "/unread"
23
+ unread: number
24
+ }
25
+ export type iMessage = iMessageIncome | iMessageUnread | iMessageView | iMessageError
@@ -0,0 +1,24 @@
1
+ export interface iNode<ParamsT = { [key: string]: unknown } | undefined> {
2
+ id: number
3
+ pub_date: string
4
+ type: string
5
+ parent: number
6
+ code: string
7
+ title: string
8
+ h1?:string
9
+ menutitle: string;
10
+ sorter: number
11
+ image: string
12
+ icon: string
13
+ redirect: string
14
+ meta_title: string
15
+ meta_keywords: string
16
+ meta_description: string
17
+ meta_title_element_tpl: string
18
+ meta_keywords_element_tpl: string
19
+ meta_description_element_tpl: string
20
+ no_search: boolean
21
+ no_menu: boolean
22
+ public: boolean
23
+ paramsDisplay: ParamsT
24
+ }
@@ -0,0 +1,14 @@
1
+ export interface iNodeTree {
2
+ id: number
3
+ type: string
4
+ parent: number
5
+ code: string
6
+ title: string
7
+ menutitle: string
8
+ image: string
9
+ icon: string
10
+ sorter: number
11
+ redirect: string
12
+ no_menu: boolean
13
+ children?: iNodeTree[]
14
+ }
@@ -0,0 +1,8 @@
1
+ import { iNode } from "./iNode"
2
+
3
+ export interface iPagingItems<TItems, TNode = { [key: string]: unknown } | undefined>{
4
+ node?: iNode<TNode>
5
+ totalItems: number,
6
+ perPage: number,
7
+ items:TItems[]
8
+ }
@@ -0,0 +1,28 @@
1
+ import { PaymentStatus, PaymentStatusKeys } from "./paymentStatus";
2
+ import { PaymentType, PaymentTypeKeys } from "./paymentType";
3
+ import { PayoutType, PayoutTypeKeys } from "./payoutType";
4
+
5
+
6
+ export interface iPayment {
7
+ id: number
8
+ reg_date: string//дата создания
9
+ status: typeof PaymentStatus[PaymentStatusKeys]
10
+ pay_type: typeof PaymentType[PaymentTypeKeys]//тип операции, начисление или выплата
11
+ title: string//краткое описание для вывода пользователю
12
+
13
+ //начисление
14
+ receipt: number | null//чек
15
+ receipt_product: number | null//товар чека
16
+ catalog: number | null//id товара каталога
17
+ sku: number | null//id акции
18
+ shop: number | null//id аптеки
19
+ cashback_level: 0 | 1 | 2 | 3//уровень кэшбека по которому произошло начисление
20
+ max_cashback_level: null | 0 | 1 | 2 | 3 //макс. возможный уровень кэшбека по акции, поле есть только у начислений в чеках
21
+
22
+ //списание
23
+ payout_type: typeof PayoutType[PayoutTypeKeys] | null //способ выплаты
24
+ last_error: string//текст ошибки выплаты
25
+
26
+ //размер
27
+ price: number //если больше 0 начисление, меньше 0 списание
28
+ }
@@ -0,0 +1,15 @@
1
+ import { PushStatus, PushStatusKeys } from "./pushStatus"
2
+
3
+ export interface iPush {
4
+ id: number
5
+ reg_date: string
6
+ send_date: string | null
7
+ user: number
8
+ status: typeof PushStatus[PushStatusKeys]
9
+ mailing: number | null
10
+ priority: number
11
+ title: string
12
+ text: string
13
+ route: string
14
+ view: boolean
15
+ }
@@ -0,0 +1,4 @@
1
+ export interface iQuestion {
2
+ title: string
3
+ answers: { title: string, correct: boolean }[]
4
+ }
@@ -0,0 +1,12 @@
1
+ import { iFilter } from "./iFilter"
2
+ import { iSorter } from "./iSorter"
3
+
4
+ export type iSearchParams<Data extends object, Keys extends keyof Data> = {
5
+ nodeCode?: string | undefined
6
+ select: Keys[],
7
+ page?: number
8
+ filters?: iFilter<Data>,
9
+ sorters?: iSorter<Data>
10
+ perPage?: number
11
+ subNodes?: boolean
12
+ }
@@ -0,0 +1,10 @@
1
+ export type iSorterValue = string
2
+
3
+ type ExcludeMethods<T> =
4
+ { [K in keyof T as (T[K] extends Function ? never : K)]: T[K] }
5
+
6
+ type iSorterKey<TKey> =
7
+ (TKey extends string ? `${TKey} asc` : never) |
8
+ (TKey extends string ? `${TKey} desc` : never)
9
+
10
+ export type iSorter<T> = (iSorterKey<keyof ExcludeMethods<T>>)[]
@@ -0,0 +1,4 @@
1
+ export interface iSpecialization {
2
+ id: number
3
+ title: string
4
+ }
@@ -0,0 +1,4 @@
1
+ export interface iStatView {
2
+ item_key: string,
3
+ count: number,
4
+ }
@@ -0,0 +1,5 @@
1
+ export interface iStorage {
2
+ set: (key: string, data: string) => Promise<void>
3
+ get: (key: string) => Promise<string | null>
4
+ remove: (key: string) => Promise<void>
5
+ }
@@ -0,0 +1,10 @@
1
+ export interface iStories {
2
+ id: number
3
+ title: string
4
+ image: string//Обложка
5
+ video: string[]//Видео-сторисы
6
+ photo: string[]//Картинки-сторисы
7
+ sku: { id: number, title: string } | null//Акция
8
+ sorter: number
9
+ is_view?: 1 | 0
10
+ }
@@ -0,0 +1,4 @@
1
+ export interface iSubstance {
2
+ id: number
3
+ title: string
4
+ }
@@ -0,0 +1,38 @@
1
+ import { iSurveyQuestion } from "./iSurveyQuestion"
2
+
3
+ // Тип для данных из связующих таблиц multiselectExtTable
4
+ interface iRefItem {
5
+ id: number
6
+ title: string
7
+ }
8
+
9
+ export interface iSurvey {
10
+ id: number
11
+ node: number
12
+ title: string
13
+ partner: number | null
14
+ budget: number
15
+ budget_min: number
16
+ date_start: string | null
17
+ date_end: string | null
18
+ reward_base: number
19
+ reward_max: number
20
+ questions: iSurveyQuestion[] | null
21
+ slots: number
22
+ slots_taken?: number // Из VIEW survey_slots_taken
23
+ specialization: iRefItem[] | null // Специализации врачей
24
+ city: iRefItem[] | null // Только эти города
25
+ city_not: iRefItem[] | null // Кроме этих городов
26
+ region: iRefItem[] | null // Только эти регионы
27
+ region_not: iRefItem[] | null // Кроме этих регионов
28
+ promo_title: string
29
+ promo_subtitle: string
30
+ promo_image: string
31
+ promo_text: string
32
+ promo_disclaimer: string
33
+ text: string
34
+ text_full: string
35
+ public: boolean
36
+ priority?: number // Приоритет для спецразмещения (1-4)
37
+ payment_total?: number // Из VIEW payment_survey_sum
38
+ }
@@ -0,0 +1,15 @@
1
+ export type tSurveyNextStep = number | "default" | "terminate"
2
+
3
+ export type tSurveyQuestionType = "single" | "multiple" | "text"
4
+
5
+ export interface iSurveyAnswer {
6
+ title: string
7
+ next_step: tSurveyNextStep
8
+ }
9
+
10
+ export interface iSurveyQuestion {
11
+ title: string
12
+ type: tSurveyQuestionType
13
+ answers: iSurveyAnswer[]
14
+ }
15
+
@@ -0,0 +1,4 @@
1
+ export interface iSymptoms {
2
+ id: number
3
+ title: string
4
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Вопрос теста для пользователя (без правильных ответов)
3
+ */
4
+ export interface iTestQuestionForUser {
5
+ specialization: number
6
+ questionIndex: number // индекс вопроса в массиве questions специализации
7
+ question: string
8
+ answers: { title: string }[]
9
+ }
10
+
11
+ /**
12
+ * Ответ пользователя на вопрос
13
+ */
14
+ export interface iTestUserAnswer {
15
+ specialization: number
16
+ questionIndex: number // индекс вопроса в массиве questions специализации
17
+ answer_indices: number[] // индексы выбранных ответов
18
+ answer_time?: number // время ответа в секундах
19
+ }
20
+
21
+
@@ -0,0 +1,20 @@
1
+ export interface iTestResult {
2
+ id: number
3
+ user: number | null
4
+ test_date: Date | null
5
+ specialization: number | null
6
+ question_index: number | null // индекс вопроса в массиве questions специализации
7
+ question_text: string
8
+ user_answer: number[]
9
+ is_correct: boolean
10
+ answer_time: number
11
+ }
12
+
13
+ export interface iTestResultBySpecialization {
14
+ [specializationId: number]: {
15
+ correct: number
16
+ total: number
17
+ }
18
+ }
19
+
20
+
@@ -0,0 +1,3 @@
1
+ export interface iText {
2
+ text: string
3
+ }
@@ -0,0 +1,37 @@
1
+ import { iCity } from "./iCity"
2
+ import { iUserData } from "./iUserData"
3
+ import { UserRole, UserRoleKeys } from "./userRole"
4
+
5
+ export interface iUser {
6
+ id: number
7
+ register_date: string | null
8
+ register_date_original: string | null
9
+ role: typeof UserRole[UserRoleKeys]
10
+ phone: string | null
11
+ phone_confirm: boolean
12
+ email: string | null
13
+ email_confirm: boolean
14
+ firstname: string
15
+ lastname: string
16
+ middlename: string
17
+ photo: string
18
+ password?: string
19
+ isSubscribe?: boolean
20
+ soc_tg_id: number | null
21
+ soc_tg_username: string
22
+ soc_vk_id: number | null
23
+ soc_vk_username: string
24
+
25
+ city: iCity | null
26
+ specialization: number[] | null // специализации врача (Medotvet)
27
+ birthdate: string | null // дата рождения (Medotvet)
28
+ workplace_type: number | null // тип учреждения (ID) (Medotvet)
29
+ workplace_name: string | null // название учреждения (Medotvet)
30
+ diploma_status: number | null // 0-не загружен, 1-на проверке, 2-подтвержден, 3-отклонен (Medotvet)
31
+ diploma_files: string[] | null // массив путей к файлам диплома (Medotvet)
32
+ diploma_reject_reason: string | null // причина отклонения диплома (Medotvet)
33
+ test_status: number | null // 0-не пройден, 1-пройден (Medotvet)
34
+ ref: iUserData | null // друг, если не пустой то ввести промокод нельзя
35
+ my_ref_code: string | null
36
+ agreement: boolean | null
37
+ }
@@ -0,0 +1,10 @@
1
+ export interface iUserData {
2
+ id: number
3
+ role: number
4
+ firstname: string
5
+ lastname: string
6
+ photo: string
7
+ exp?: number | undefined;
8
+ iat?: number
9
+ localTimeDiff: number | undefined;
10
+ }
@@ -0,0 +1,16 @@
1
+ interface iUserEditPropsBase {
2
+ email?: string;
3
+ city?: number; // id города
4
+ email_code?: string; // код отправленный на email
5
+ agreement?: boolean; // согласие с пользовательским соглашением
6
+ birthdate?: string | null; // дата рождения (формат YYYY-MM-DD)
7
+ specialization?: number[] | null; // специализации врача (массив ID)
8
+ workplace_type?: number | null; // тип учреждения (ID)
9
+ workplace_name?: string | null; // название учреждения
10
+ }
11
+
12
+ // Логика: либо все три имени заданы, либо ни одно
13
+ export type iUserEditProps = iUserEditPropsBase & (
14
+ | { firstname: string; lastname: string; middlename: string } // Все три имени присутствуют
15
+ | { firstname?: never; lastname?: never; middlename?: never } // Ни одно не задано
16
+ );
@@ -0,0 +1,8 @@
1
+ import { UserStatEvent, UserStatEventKeys } from "./userStatEvent"
2
+
3
+ export interface iUserStat {
4
+ user: number
5
+ sku: number
6
+ event: typeof UserStatEvent[UserStatEventKeys]
7
+ date?: Date
8
+ }
@@ -0,0 +1,23 @@
1
+ export enum UserSurveyStatus {
2
+ queue = 0, // в очереди (создан, но не начат)
3
+ in_progress = 1, // в процессе прохождения
4
+ success = 2, // успешно завершен
5
+ cancelled = 3, // отменен пользователем
6
+ timeout = 4 // таймаут (не завершен за 1 час)
7
+ }
8
+
9
+ export type UserSurveyStatusKeys = keyof typeof UserSurveyStatus
10
+
11
+ export interface iUserSurvey {
12
+ id: number
13
+ reg_date: string
14
+ user: number
15
+ survey: number
16
+ status: typeof UserSurveyStatus[UserSurveyStatusKeys]
17
+ date_start: string | null
18
+ date_end: string | null
19
+ timeout_at: string | null
20
+ survey_title?: string // Для отображения в истории
21
+ reward_base?: number // Для отображения в истории
22
+ reward_max?: number // Для отображения в истории
23
+ }
@@ -0,0 +1,4 @@
1
+ export type iUserTokens = {
2
+ accessToken:string,
3
+ refreshToken: string
4
+ }
@@ -0,0 +1,5 @@
1
+ type Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N
2
+ ? Acc[number]
3
+ : Enumerate<N, [...Acc, Acc['length']]>
4
+
5
+ export type IntRange<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>
@@ -0,0 +1,10 @@
1
+ export const ItemType = {
2
+ CATALOG_SKU: 1,
3
+ BRAND: 2,
4
+ ARTICLES: 3,
5
+ USER: 5,
6
+ BANNER: 6,
7
+ STORIES: 7,
8
+ }
9
+
10
+ export type ItemTypeKeys = keyof typeof ItemType;
@@ -0,0 +1,8 @@
1
+ export const PaymentStatus = {
2
+ queue: 1,//В очереди (на проверку)
3
+ moderation: 2,
4
+ ok: 3,
5
+ fail: 4,
6
+ }
7
+
8
+ export type PaymentStatusKeys = keyof typeof PaymentStatus;
@@ -0,0 +1,6 @@
1
+ export const PaymentType = {
2
+ accrual: 1,//начисление
3
+ payout: 2,//выплата
4
+ }
5
+
6
+ export type PaymentTypeKeys = keyof typeof PaymentType;
@@ -0,0 +1,6 @@
1
+ export const PayoutType = {
2
+ sbp: 1,
3
+ card: 2,
4
+ }
5
+
6
+ export type PayoutTypeKeys = keyof typeof PayoutType;
@@ -0,0 +1,7 @@
1
+ export const PushStatus = {
2
+ queue: 1,
3
+ ok: 2,
4
+ fail: 3,
5
+ }
6
+
7
+ export type PushStatusKeys = keyof typeof PushStatus;
@@ -0,0 +1,8 @@
1
+ export const TestStatus = {
2
+ not_passed: 1,
3
+ passed: 2,
4
+ } as const
5
+
6
+ export type TestStatusKeys = keyof typeof TestStatus
7
+ export type TestStatusValue = typeof TestStatus[TestStatusKeys]
8
+
@@ -0,0 +1,13 @@
1
+ export const UserRole = {
2
+ NONE: 0,
3
+ ADMIN: 1000,
4
+ }
5
+
6
+ export type UserRoleKeys = keyof typeof UserRole;
7
+
8
+ export function getUserRoleTitle(role?: typeof UserRole[UserRoleKeys]) {
9
+ switch (role) {
10
+ case UserRole.ADMIN: return "Админ"
11
+ default: return ""
12
+ }
13
+ }
@@ -0,0 +1,6 @@
1
+ export const UserStatEvent = {
2
+ presentation: 1,
3
+ quiz: 2,
4
+ }
5
+
6
+ export type UserStatEventKeys = keyof typeof UserStatEvent;
@@ -0,0 +1,17 @@
1
+ export const ViewEventType = {
2
+ //базовый тип
3
+ VIEW: 1,
4
+ //Акция
5
+ FAVORITE: 2,
6
+ PROMO_BLOCK: 3,
7
+ PRESENTATION_CLICK: 4,
8
+ PRESENTATION_SUCCESS: 5,
9
+ QUESTIONS_CLICK: 6,
10
+ QUESTIONS_SUCCESS: 7,
11
+ //Блог
12
+ SKU_BTN: 8,
13
+ READ: 9,
14
+ //Баннеры
15
+ CLICK: 10,
16
+ }
17
+ export type ViewEventTypeKeys = keyof typeof ViewEventType;