@up-im/medotvet_sdk 0.0.6 → 0.0.8

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 (37) hide show
  1. package/dist/api/abstract.d.ts +1 -0
  2. package/dist/api/abstract.js +4 -4
  3. package/dist/api/bookmarks.d.ts +10 -9
  4. package/dist/api/bookmarks.js +24 -28
  5. package/dist/interfaces/itemType.d.ts +1 -0
  6. package/dist/interfaces/itemType.js +1 -0
  7. package/dist/storage/user.d.ts +2 -0
  8. package/dist/storage/user.js +10 -3
  9. package/package.json +2 -2
  10. package/src/api/abstract.ts +4 -3
  11. package/src/api/bookmarks.ts +24 -27
  12. package/src/interfaces/itemType.ts +1 -0
  13. package/src/storage/user.ts +10 -3
  14. package/dist/api/receipt.d.ts +0 -34
  15. package/dist/api/receipt.js +0 -60
  16. package/dist/interfaces/iAppVersionCheck.d.ts +0 -5
  17. package/dist/interfaces/iAppVersionCheck.js +0 -2
  18. package/dist/interfaces/iBrand.d.ts +0 -6
  19. package/dist/interfaces/iBrand.js +0 -2
  20. package/dist/interfaces/iCatalog.d.ts +0 -50
  21. package/dist/interfaces/iCatalog.js +0 -2
  22. package/dist/interfaces/iCatalogNode.d.ts +0 -3
  23. package/dist/interfaces/iCatalogNode.js +0 -2
  24. package/dist/interfaces/iCatalogPreview.d.ts +0 -17
  25. package/dist/interfaces/iCatalogPreview.js +0 -2
  26. package/dist/interfaces/iReceipt.d.ts +0 -20
  27. package/dist/interfaces/iReceipt.js +0 -2
  28. package/dist/interfaces/iReceiptAddProps.d.ts +0 -8
  29. package/dist/interfaces/iReceiptAddProps.js +0 -2
  30. package/dist/interfaces/iReceiptProduct.d.ts +0 -7
  31. package/dist/interfaces/iReceiptProduct.js +0 -2
  32. package/dist/interfaces/iShop.d.ts +0 -6
  33. package/dist/interfaces/iShop.js +0 -2
  34. package/dist/interfaces/iShopAddress.d.ts +0 -5
  35. package/dist/interfaces/iShopAddress.js +0 -2
  36. package/dist/interfaces/receiptStatus.d.ts +0 -7
  37. package/dist/interfaces/receiptStatus.js +0 -9
@@ -3,6 +3,7 @@ export declare class ApiAbstract {
3
3
  protected host: string;
4
4
  protected userStorage: UserStorage;
5
5
  private static isTokenUpdating;
6
+ static testHeaders: Record<string, string>;
6
7
  constructor({ host, userStorage }: {
7
8
  host: string;
8
9
  userStorage: UserStorage;
@@ -13,7 +13,7 @@ class ApiAbstract {
13
13
  const formData = new FormData();
14
14
  if (postBody) {
15
15
  for (let key in postBody) {
16
- if (postBody[key] instanceof FileList) {
16
+ if (typeof FileList !== "undefined" && postBody[key] instanceof FileList) {
17
17
  for (const value of postBody[key]) {
18
18
  formData.append(key + '[]', value);
19
19
  }
@@ -36,7 +36,7 @@ class ApiAbstract {
36
36
  }
37
37
  }
38
38
  }
39
- const headers = {};
39
+ const headers = { ...ApiAbstract.testHeaders };
40
40
  if (options?.addToken) {
41
41
  const token = await this.getToken();
42
42
  headers["Authorization"] = `Bearer ${token}`;
@@ -71,8 +71,6 @@ class ApiAbstract {
71
71
  }
72
72
  catch (error) {
73
73
  //ошибка расшифровки json
74
- if (!options?.noConsoleError)
75
- console.warn({ url: this.host + "/api" + route });
76
74
  if (!(error instanceof apiError_1.ApiError))
77
75
  throw new apiError_1.ApiError(res.status, res.statusText);
78
76
  throw error;
@@ -123,3 +121,5 @@ class ApiAbstract {
123
121
  }
124
122
  exports.ApiAbstract = ApiAbstract;
125
123
  ApiAbstract.isTokenUpdating = false;
124
+ // Дополнительные заголовки для тестов (например, x-real-ip)
125
+ ApiAbstract.testHeaders = {};
@@ -5,20 +5,21 @@ export declare class ApiBookmarks extends ApiAbstract {
5
5
  private requestKeys;
6
6
  private total;
7
7
  /**
8
- * принимает id акции (не товара) который находится в поле id метода возвращаемых товаров getCatalogList. В методе есть дебаунсер, что позволяет его вызвать для каждого товара на странице сделав только 1 запрос на сервер
9
- * @param {number} props.sku - id акции (не товара)
8
+ * Проверяет находится ли опрос в избранном. В методе есть дебаунсер,
9
+ * что позволяет его вызвать для каждого опроса на странице сделав только 1 запрос на сервер
10
+ * @param {number} props.surveyId - id опроса
10
11
  */
11
- inBookmarks({ skuId }: {
12
- skuId: number;
12
+ inBookmarks({ surveyId }: {
13
+ surveyId: number;
13
14
  }): Promise<boolean>;
14
15
  private collectKeys;
15
16
  /**
16
- * добавление \ удаление из избранного
17
- * @param {number} props.sku - id акции (не товара)
18
- * @param {UserStatEvent} props.isAdd - признак добавление или удаление
17
+ * добавление \ удаление опроса из избранного
18
+ * @param {number} props.surveyId - id опроса
19
+ * @param {boolean} props.isAdd - признак добавление или удаление
19
20
  */
20
- mutate({ skuId, isAdd }: {
21
- skuId: number;
21
+ mutate({ surveyId, isAdd }: {
22
+ surveyId: number;
22
23
  isAdd: boolean;
23
24
  }): Promise<void>;
24
25
  /**
@@ -14,15 +14,16 @@ class ApiBookmarks extends abstract_1.ApiAbstract {
14
14
  this.total = null;
15
15
  }
16
16
  /**
17
- * принимает id акции (не товара) который находится в поле id метода возвращаемых товаров getCatalogList. В методе есть дебаунсер, что позволяет его вызвать для каждого товара на странице сделав только 1 запрос на сервер
18
- * @param {number} props.sku - id акции (не товара)
17
+ * Проверяет находится ли опрос в избранном. В методе есть дебаунсер,
18
+ * что позволяет его вызвать для каждого опроса на странице сделав только 1 запрос на сервер
19
+ * @param {number} props.surveyId - id опроса
19
20
  */
20
- async inBookmarks({ skuId }) {
21
- if (!skuId || skuId <= 0)
21
+ async inBookmarks({ surveyId }) {
22
+ if (!surveyId || surveyId <= 0)
22
23
  return false;
23
24
  if (!await this.userStorage.isAuth())
24
25
  return false;
25
- const key = `${itemType_1.ItemType.CATALOG_SKU}-${skuId}`;
26
+ const key = `${itemType_1.ItemType.SURVEY}-${surveyId}`;
26
27
  return await this.collectKeys(key);
27
28
  }
28
29
  async collectKeys(key) {
@@ -67,33 +68,28 @@ class ApiBookmarks extends abstract_1.ApiAbstract {
67
68
  return await this.collectKeys(key); //на следующем крузе вернется результат из кэша
68
69
  }
69
70
  /**
70
- * добавление \ удаление из избранного
71
- * @param {number} props.sku - id акции (не товара)
72
- * @param {UserStatEvent} props.isAdd - признак добавление или удаление
71
+ * добавление \ удаление опроса из избранного
72
+ * @param {number} props.surveyId - id опроса
73
+ * @param {boolean} props.isAdd - признак добавление или удаление
73
74
  */
74
- async mutate({ skuId, isAdd }) {
75
- if (!skuId || skuId <= 0)
75
+ async mutate({ surveyId, isAdd }) {
76
+ if (!surveyId || surveyId <= 0)
76
77
  return;
77
78
  if (!await this.userStorage.isAuth())
78
79
  throw new apiError_1.ApiError(401, "Пользователь не авторизован");
79
- try {
80
- await this.fetcher({
81
- route: isAdd
82
- ? apiRoute_1.apiRouteBookmarksAdd
83
- : apiRoute_1.apiRouteBookmarksRemove,
84
- postBody: {
85
- itemType: itemType_1.ItemType.CATALOG_SKU,
86
- itemId: skuId
87
- },
88
- options: {
89
- addToken: true
90
- }
91
- });
92
- }
93
- catch (error) {
94
- console.error(error);
95
- }
96
- const key = `${itemType_1.ItemType.CATALOG_SKU}-${skuId}`;
80
+ await this.fetcher({
81
+ route: isAdd
82
+ ? apiRoute_1.apiRouteBookmarksAdd
83
+ : apiRoute_1.apiRouteBookmarksRemove,
84
+ postBody: {
85
+ itemType: itemType_1.ItemType.SURVEY,
86
+ itemId: surveyId
87
+ },
88
+ options: {
89
+ addToken: true
90
+ }
91
+ });
92
+ const key = `${itemType_1.ItemType.SURVEY}-${surveyId}`;
97
93
  this.cache.set(key, isAdd ? key : false);
98
94
  this.total = (this.total ?? 0) + (isAdd ? 1 : -1);
99
95
  }
@@ -2,6 +2,7 @@ export declare const ItemType: {
2
2
  CATALOG_SKU: number;
3
3
  BRAND: number;
4
4
  ARTICLES: number;
5
+ SURVEY: number;
5
6
  USER: number;
6
7
  BANNER: number;
7
8
  STORIES: number;
@@ -5,6 +5,7 @@ exports.ItemType = {
5
5
  CATALOG_SKU: 1,
6
6
  BRAND: 2,
7
7
  ARTICLES: 3,
8
+ SURVEY: 4,
8
9
  USER: 5,
9
10
  BANNER: 6,
10
11
  STORIES: 7,
@@ -6,7 +6,9 @@ export declare class UserStorage {
6
6
  private accessToken;
7
7
  private accessTokenExp;
8
8
  private localTimeDiff;
9
+ static disableSSRCheck: boolean;
9
10
  constructor(storage?: iStorage);
11
+ private isSSR;
10
12
  getUser(): Promise<iUserData | null>;
11
13
  setUser(accessToken: string, refreshToken: string): Promise<iUserData | null>;
12
14
  saveUser({ firstname, lastname }: {
@@ -12,10 +12,15 @@ class UserStorage {
12
12
  this.localTimeDiff = 0; //смещение локального времени в браузере
13
13
  this.storage = storage || default_1.storageDefault;
14
14
  }
15
+ isSSR() {
16
+ if (UserStorage.disableSSRCheck)
17
+ return false;
18
+ return typeof window === "undefined";
19
+ }
15
20
  async getUser() {
16
21
  if (this.user)
17
22
  return this.user;
18
- if (typeof window === 'undefined')
23
+ if (this.isSSR())
19
24
  return null; //SSR
20
25
  const userStorage = await this.storage.get('user');
21
26
  if (typeof userStorage != "string" && userStorage !== null && userStorage !== undefined) {
@@ -65,7 +70,7 @@ class UserStorage {
65
70
  return Date.now() + this.localTimeDiff;
66
71
  }
67
72
  async getAccessToken() {
68
- if (typeof window === 'undefined')
73
+ if (this.isSSR())
69
74
  return null; //SSR
70
75
  //кэш с проверкой срока действия
71
76
  if (this.accessToken && this.accessTokenExp && this.localTimeDiff && this.getCurrentTime() < this.accessTokenExp * 1000) {
@@ -87,7 +92,7 @@ class UserStorage {
87
92
  return null;
88
93
  }
89
94
  async getRefreshToken() {
90
- if (typeof window === 'undefined')
95
+ if (this.isSSR())
91
96
  return null; //SSR
92
97
  const refreshTokenData = await this.getUser(); //возвращает раскодированный refreshToken и проверяет его дату
93
98
  if (refreshTokenData) {
@@ -105,3 +110,5 @@ class UserStorage {
105
110
  }
106
111
  }
107
112
  exports.UserStorage = UserStorage;
113
+ // Флаг для отключения SSR-проверок (для Node.js тестов)
114
+ UserStorage.disableSSRCheck = false;
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@up-im/medotvet_sdk",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1",
7
+ "test": "tsc && node --test dist/**/*.test.js",
8
8
  "build": "tsc"
9
9
  },
10
10
  "repository": {
@@ -8,6 +8,8 @@ export class ApiAbstract {
8
8
  protected host: string
9
9
  protected userStorage: UserStorage
10
10
  private static isTokenUpdating = false
11
+ // Дополнительные заголовки для тестов (например, x-real-ip)
12
+ static testHeaders: Record<string, string> = {}
11
13
 
12
14
  constructor({
13
15
  host,
@@ -35,7 +37,7 @@ export class ApiAbstract {
35
37
  const formData = new FormData();
36
38
  if (postBody) {
37
39
  for (let key in postBody) {
38
- if (postBody[key] instanceof FileList) {
40
+ if (typeof FileList !== "undefined" && postBody[key] instanceof FileList) {
39
41
  for (const value of postBody[key]) {
40
42
  formData.append(key + '[]', value);
41
43
  }
@@ -54,7 +56,7 @@ export class ApiAbstract {
54
56
  }
55
57
  }
56
58
  }
57
- const headers: { [key: string]: string } = {}
59
+ const headers: { [key: string]: string } = { ...ApiAbstract.testHeaders }
58
60
  if (options?.addToken) {
59
61
  const token = await this.getToken()
60
62
  headers["Authorization"] = `Bearer ${token}`
@@ -87,7 +89,6 @@ export class ApiAbstract {
87
89
  throw error
88
90
  } catch (error: unknown) {
89
91
  //ошибка расшифровки json
90
- if (!options?.noConsoleError) console.warn({ url: this.host + "/api" + route })
91
92
  if (!(error instanceof ApiError)) throw new ApiError(res.status, res.statusText)
92
93
  throw error
93
94
  }
@@ -12,13 +12,14 @@ export class ApiBookmarks extends ApiAbstract {
12
12
  private total: number | null = null
13
13
 
14
14
  /**
15
- * принимает id акции (не товара) который находится в поле id метода возвращаемых товаров getCatalogList. В методе есть дебаунсер, что позволяет его вызвать для каждого товара на странице сделав только 1 запрос на сервер
16
- * @param {number} props.sku - id акции (не товара)
15
+ * Проверяет находится ли опрос в избранном. В методе есть дебаунсер,
16
+ * что позволяет его вызвать для каждого опроса на странице сделав только 1 запрос на сервер
17
+ * @param {number} props.surveyId - id опроса
17
18
  */
18
- async inBookmarks({ skuId }: { skuId: number }) {
19
- if (!skuId || skuId <= 0) return false
19
+ async inBookmarks({ surveyId }: { surveyId: number }) {
20
+ if (!surveyId || surveyId <= 0) return false
20
21
  if (!await this.userStorage.isAuth()) return false
21
- const key = `${ItemType.CATALOG_SKU}-${skuId}`
22
+ const key = `${ItemType.SURVEY}-${surveyId}`
22
23
  return await this.collectKeys(key)
23
24
  }
24
25
 
@@ -61,30 +62,26 @@ export class ApiBookmarks extends ApiAbstract {
61
62
  }
62
63
 
63
64
  /**
64
- * добавление \ удаление из избранного
65
- * @param {number} props.sku - id акции (не товара)
66
- * @param {UserStatEvent} props.isAdd - признак добавление или удаление
65
+ * добавление \ удаление опроса из избранного
66
+ * @param {number} props.surveyId - id опроса
67
+ * @param {boolean} props.isAdd - признак добавление или удаление
67
68
  */
68
- async mutate({ skuId, isAdd }: { skuId: number, isAdd: boolean }) {
69
- if (!skuId || skuId <= 0) return
69
+ async mutate({ surveyId, isAdd }: { surveyId: number, isAdd: boolean }) {
70
+ if (!surveyId || surveyId <= 0) return
70
71
  if (!await this.userStorage.isAuth()) throw new ApiError(401, "Пользователь не авторизован")
71
- try {
72
- await this.fetcher({
73
- route: isAdd
74
- ? apiRouteBookmarksAdd
75
- : apiRouteBookmarksRemove,
76
- postBody: {
77
- itemType: ItemType.CATALOG_SKU,
78
- itemId: skuId
79
- },
80
- options: {
81
- addToken: true
82
- }
83
- })
84
- } catch (error: unknown) {
85
- console.error(error)
86
- }
87
- const key = `${ItemType.CATALOG_SKU}-${skuId}`
72
+ await this.fetcher({
73
+ route: isAdd
74
+ ? apiRouteBookmarksAdd
75
+ : apiRouteBookmarksRemove,
76
+ postBody: {
77
+ itemType: ItemType.SURVEY,
78
+ itemId: surveyId
79
+ },
80
+ options: {
81
+ addToken: true
82
+ }
83
+ })
84
+ const key = `${ItemType.SURVEY}-${surveyId}`
88
85
  this.cache.set(key, isAdd ? key : false)
89
86
  this.total = (this.total ?? 0) + (isAdd ? 1 : -1)
90
87
  }
@@ -2,6 +2,7 @@ export const ItemType = {
2
2
  CATALOG_SKU: 1,
3
3
  BRAND: 2,
4
4
  ARTICLES: 3,
5
+ SURVEY: 4,
5
6
  USER: 5,
6
7
  BANNER: 6,
7
8
  STORIES: 7,
@@ -10,14 +10,21 @@ export class UserStorage {
10
10
  private accessToken: string | null = null
11
11
  private accessTokenExp: number | null = null//строк действия accessToken
12
12
  private localTimeDiff: number = 0//смещение локального времени в браузере
13
+ // Флаг для отключения SSR-проверок (для Node.js тестов)
14
+ static disableSSRCheck = false
13
15
 
14
16
  constructor(storage?: iStorage) {
15
17
  this.storage = storage || storageDefault
16
18
  }
17
19
 
20
+ private isSSR() {
21
+ if (UserStorage.disableSSRCheck) return false
22
+ return typeof window === "undefined"
23
+ }
24
+
18
25
  async getUser() {
19
26
  if (this.user) return this.user
20
- if (typeof window === 'undefined') return null//SSR
27
+ if (this.isSSR()) return null//SSR
21
28
  const userStorage = await this.storage.get('user')
22
29
  if (typeof userStorage != "string" && userStorage !== null && userStorage !== undefined) {
23
30
  throw new Error("Из storage получено некорректное значение пользователя. Должно быть строкой или null")
@@ -68,7 +75,7 @@ export class UserStorage {
68
75
  }
69
76
 
70
77
  async getAccessToken(): Promise<string | null> {
71
- if (typeof window === 'undefined') return null//SSR
78
+ if (this.isSSR()) return null//SSR
72
79
 
73
80
  //кэш с проверкой срока действия
74
81
  if (this.accessToken && this.accessTokenExp && this.localTimeDiff && this.getCurrentTime() < this.accessTokenExp * 1000) {
@@ -90,7 +97,7 @@ export class UserStorage {
90
97
  }
91
98
 
92
99
  async getRefreshToken(): Promise<string | null> {
93
- if (typeof window === 'undefined') return null//SSR
100
+ if (this.isSSR()) return null//SSR
94
101
 
95
102
  const refreshTokenData = await this.getUser()//возвращает раскодированный refreshToken и проверяет его дату
96
103
  if (refreshTokenData) {
@@ -1,34 +0,0 @@
1
- import { ApiAbstract } from "./abstract";
2
- import { iReceiptAddProps } from "../interfaces/iReceiptAddProps";
3
- import { iReceipt } from "../interfaces/iReceipt";
4
- import { iPagingItems } from "../interfaces/iPagingItems";
5
- export declare class ApiReceipt extends ApiAbstract {
6
- /**
7
- * регистрация чека
8
- * @param {number} props.fn: ФД
9
- * @param {number} props.fd: ФД
10
- * @param {number} props.fp: ФП
11
- * @param {number} props.sum: Сумма чека
12
- * @param {keyof iReceipt} props.t Дата в формате 20240715T1322 (как в QR коде)
13
- * @param {AbortSignal} signal
14
- */
15
- add(props: iReceiptAddProps, signal: AbortSignal | null | undefined): Promise<iReceipt>;
16
- /**
17
- * список чеков
18
- * @param {number} props.page - страница, отсчет с первой, чтобы не было путаницы
19
- * @param {keyof iReceipt} props.select - выбор полей ответа
20
- */
21
- getList<Keys extends keyof Omit<iReceipt, "products">>({ page, select, }: {
22
- page: number;
23
- select: Keys[];
24
- }): Promise<iPagingItems<Pick<Omit<iReceipt, "products">, Keys>, {
25
- [key: string]: unknown;
26
- } | undefined>>;
27
- /**
28
- * один чек с товарами внутри
29
- * * @param {number} id - id чека
30
- */
31
- getOne({ id }: {
32
- id: number;
33
- }): Promise<iReceipt>;
34
- }
@@ -1,60 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ApiReceipt = void 0;
4
- const abstract_1 = require("./abstract");
5
- const apiRoute_1 = require("../http/apiRoute");
6
- const apiError_1 = require("../http/apiError");
7
- class ApiReceipt extends abstract_1.ApiAbstract {
8
- /**
9
- * регистрация чека
10
- * @param {number} props.fn: ФД
11
- * @param {number} props.fd: ФД
12
- * @param {number} props.fp: ФП
13
- * @param {number} props.sum: Сумма чека
14
- * @param {keyof iReceipt} props.t Дата в формате 20240715T1322 (как в QR коде)
15
- * @param {AbortSignal} signal
16
- */
17
- async add(props, signal) {
18
- if (!await this.userStorage.isAuth())
19
- throw new apiError_1.ApiError(401, "Пользователь не авторизован");
20
- const data = await this.fetcher({
21
- route: apiRoute_1.apiRouteReceiptAdd,
22
- postBody: props,
23
- options: {
24
- addToken: true,
25
- signal
26
- }
27
- });
28
- return data.receipt;
29
- }
30
- /**
31
- * список чеков
32
- * @param {number} props.page - страница, отсчет с первой, чтобы не было путаницы
33
- * @param {keyof iReceipt} props.select - выбор полей ответа
34
- */
35
- async getList({ page = 1, select, }) {
36
- if (!await this.userStorage.isAuth())
37
- throw new apiError_1.ApiError(401, "Пользователь не авторизован");
38
- return await this.fetcher({
39
- route: (0, apiRoute_1.apiRouteReceiptList)({
40
- page,
41
- sorters: ["id desc"],
42
- select: select?.filter(it => it != "payments" && it != "cashback_sum")
43
- }),
44
- options: { addToken: true }
45
- });
46
- }
47
- /**
48
- * один чек с товарами внутри
49
- * * @param {number} id - id чека
50
- */
51
- async getOne({ id }) {
52
- if (!await this.userStorage.isAuth())
53
- throw new apiError_1.ApiError(401, "Пользователь не авторизован");
54
- return (await this.fetcher({
55
- route: (0, apiRoute_1.apiRouteReceiptItem)(id),
56
- options: { addToken: true }
57
- })).item;
58
- }
59
- }
60
- exports.ApiReceipt = ApiReceipt;
@@ -1,5 +0,0 @@
1
- export interface iAppVersionCheck {
2
- isActual: boolean;
3
- currentVersion: string | null;
4
- file: string | null;
5
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +0,0 @@
1
- export interface iBrand {
2
- id: number;
3
- title: string;
4
- code: string;
5
- image?: string;
6
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,50 +0,0 @@
1
- import { iBrand } from "./iBrand";
2
- import { iQuestion } from "./iQuestion";
3
- import { iSubstance } from "./iSubstance";
4
- import { iSymptoms } from "./iSymptoms";
5
- export interface iCatalog {
6
- pub_date: string;
7
- pub_date_original: string;
8
- node: number;
9
- title: string;
10
- disclaimer: {
11
- title: string;
12
- } | null;
13
- code: string;
14
- image: string;
15
- video?: string;
16
- brand?: iBrand;
17
- symptoms?: iSymptoms[];
18
- substance?: iSubstance[];
19
- id: number;
20
- shop_all: 1 | 0;
21
- cashback_percent: boolean;
22
- cashback_level_1: number;
23
- cashback_level_2?: number;
24
- cashback_level_3?: number;
25
- presentation_title?: string;
26
- presentation_text?: string;
27
- presentation?: string[];
28
- questions_title?: string;
29
- questions_text?: string;
30
- questions?: iQuestion[];
31
- date_start: string;
32
- date_end: string;
33
- text: string;
34
- text_full: string;
35
- region: {
36
- id: number;
37
- title: string;
38
- }[] | null;
39
- promo_title: string;
40
- promo_subtitle: string;
41
- promo_image: string;
42
- promo_disclaimer: string;
43
- promo_text: string;
44
- boost_type?: string | null;
45
- boost_start_date?: string | null;
46
- boost_end_date?: string | null;
47
- cashback_level_1_boost?: number;
48
- cashback_level_2_boost?: number;
49
- cashback_level_3_boost?: number;
50
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +0,0 @@
1
- export interface iCatalogNode {
2
- text: string;
3
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,17 +0,0 @@
1
- export interface iCatalogPreview {
2
- id: number;
3
- title: string;
4
- image: string;
5
- disclaimer: string | null;
6
- promo_title: string;
7
- date_start: string;
8
- date_end: string;
9
- cashback_max: number;
10
- cashback_percent: 1 | 0;
11
- many_cashback: 1 | 0;
12
- shop_all: 1 | 0;
13
- max_cashback_level: 0 | 1 | 2 | 3;
14
- boost_type?: string | null;
15
- boost_start_date?: string | null;
16
- boost_end_date?: string | null;
17
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,20 +0,0 @@
1
- import { iPayment } from "./iPayment";
2
- import { iReceiptProduct } from "./iReceiptProduct";
3
- import { ReceiptStatus, ReceiptStatusKeys } from "./receiptStatus";
4
- export interface iReceipt {
5
- id: number;
6
- reg_date: string;
7
- status: typeof ReceiptStatus[ReceiptStatusKeys];
8
- fn: string;
9
- fd: string;
10
- fp: string;
11
- date: string | null;
12
- sum: number;
13
- address?: string;
14
- address_name?: string;
15
- inn?: string;
16
- last_error?: string;
17
- products: iReceiptProduct[] | null;
18
- payments: iPayment[] | null;
19
- cashback_sum: number;
20
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +0,0 @@
1
- export interface iReceiptAddProps {
2
- fn: string;
3
- fd: string;
4
- fp: string;
5
- sum: number;
6
- t: string;
7
- isManual: boolean;
8
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +0,0 @@
1
- export interface iReceiptProduct {
2
- id: number;
3
- title: string;
4
- price: number;
5
- count: number;
6
- sum: number;
7
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +0,0 @@
1
- export interface iShop {
2
- id: number;
3
- title: string;
4
- inn: string;
5
- address: string;
6
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +0,0 @@
1
- export interface iShopAddress {
2
- id: number;
3
- shop: number | null;
4
- address_standardized: string;
5
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +0,0 @@
1
- export declare const ReceiptStatus: {
2
- queue: number;
3
- moderation: number;
4
- ok: number;
5
- fail: number;
6
- };
7
- export type ReceiptStatusKeys = keyof typeof ReceiptStatus;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ReceiptStatus = void 0;
4
- exports.ReceiptStatus = {
5
- queue: 1, //В очереди (на проверку)
6
- moderation: 2,
7
- ok: 3,
8
- fail: 4,
9
- };