@purpleschool/gptbot 0.5.54 → 0.5.56

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 (43) hide show
  1. package/api/controllers/http/index.ts +1 -0
  2. package/api/controllers/http/ui-notification.ts +7 -0
  3. package/build/api/controllers/http/index.js +1 -0
  4. package/build/api/controllers/http/ui-notification.js +9 -0
  5. package/build/commands/auth/register-user.command.js +7 -3
  6. package/build/commands/index.js +1 -0
  7. package/build/commands/promocode/create-promocode.command.js +2 -0
  8. package/build/commands/telegram-profile/auth-with-telegram-web-app.command.js +2 -0
  9. package/build/commands/ui-notification/complete-ui-notification.command.js +15 -0
  10. package/build/commands/ui-notification/find-active-ui-notifications-by-page-and-user.command.js +18 -0
  11. package/build/commands/ui-notification/index.js +18 -0
  12. package/build/constants/errors/errors.js +35 -0
  13. package/build/constants/index.js +1 -0
  14. package/build/constants/promocode/enums/promocode-promotion.enum.js +1 -1
  15. package/build/constants/promocode/enums/promocode-status.enum.js +2 -2
  16. package/build/constants/ui-notification/enums/index.js +19 -0
  17. package/build/constants/ui-notification/enums/ui-notification-condition-of-execution.enum.js +8 -0
  18. package/build/constants/ui-notification/enums/ui-notification-status.enum.js +9 -0
  19. package/build/constants/ui-notification/enums/ui-notification-type.enum.js +7 -0
  20. package/build/constants/ui-notification/index.js +17 -0
  21. package/build/models/index.js +2 -0
  22. package/build/models/ui-notification.schema.js +10 -0
  23. package/build/models/utm.schema.js +15 -0
  24. package/commands/auth/register-user.command.ts +8 -7
  25. package/commands/index.ts +1 -0
  26. package/commands/promocode/create-promocode.command.ts +2 -0
  27. package/commands/telegram-profile/auth-with-telegram-web-app.command.ts +2 -0
  28. package/commands/ui-notification/complete-ui-notification.command.ts +16 -0
  29. package/commands/ui-notification/find-active-ui-notifications-by-page-and-user.command.ts +21 -0
  30. package/commands/ui-notification/index.ts +2 -0
  31. package/constants/errors/errors.ts +35 -0
  32. package/constants/index.ts +1 -0
  33. package/constants/promocode/enums/promocode-promotion.enum.ts +1 -1
  34. package/constants/promocode/enums/promocode-status.enum.ts +2 -2
  35. package/constants/ui-notification/enums/index.ts +3 -0
  36. package/constants/ui-notification/enums/ui-notification-condition-of-execution.enum.ts +4 -0
  37. package/constants/ui-notification/enums/ui-notification-status.enum.ts +5 -0
  38. package/constants/ui-notification/enums/ui-notification-type.enum.ts +3 -0
  39. package/constants/ui-notification/index.ts +1 -0
  40. package/models/index.ts +2 -0
  41. package/models/ui-notification.schema.ts +8 -0
  42. package/models/utm.schema.ts +15 -0
  43. package/package.json +1 -1
@@ -26,3 +26,4 @@ export * from './user-to-task-private';
26
26
  export * from './user-to-task-public';
27
27
  export * from './user';
28
28
  export * from './promocode';
29
+ export * from './ui-notification';
@@ -0,0 +1,7 @@
1
+ export const UI_NOTIFICATION_PRIVATE_CONTROLLER = 'private/ui-notification' as const;
2
+ export const UI_NOTIFICATION_PUBLIC_CONTROLLER = 'public/ui-notification' as const;
3
+
4
+ export const UI_NOTIFICATION_ROUTES = {
5
+ GET_BY_PAGE: 'by/page',
6
+ COMPLETE: 'complete/:uuid',
7
+ } as const;
@@ -42,3 +42,4 @@ __exportStar(require("./user-to-task-private"), exports);
42
42
  __exportStar(require("./user-to-task-public"), exports);
43
43
  __exportStar(require("./user"), exports);
44
44
  __exportStar(require("./promocode"), exports);
45
+ __exportStar(require("./ui-notification"), exports);
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UI_NOTIFICATION_ROUTES = exports.UI_NOTIFICATION_PUBLIC_CONTROLLER = exports.UI_NOTIFICATION_PRIVATE_CONTROLLER = void 0;
4
+ exports.UI_NOTIFICATION_PRIVATE_CONTROLLER = 'private/ui-notification';
5
+ exports.UI_NOTIFICATION_PUBLIC_CONTROLLER = 'public/ui-notification';
6
+ exports.UI_NOTIFICATION_ROUTES = {
7
+ GET_BY_PAGE: 'by/page',
8
+ COMPLETE: 'complete/:uuid',
9
+ };
@@ -5,9 +5,13 @@ const models_1 = require("../../models");
5
5
  const zod_1 = require("zod");
6
6
  var RegisterUserCommand;
7
7
  (function (RegisterUserCommand) {
8
- RegisterUserCommand.RequestSchema = zod_1.z.intersection(models_1.UserSchema.pick({ email: true, password: true }), zod_1.z.object({
9
- partnerId: zod_1.z.string().uuid().optional(),
10
- }));
8
+ RegisterUserCommand.RequestSchema = models_1.UserSchema.pick({ email: true, password: true })
9
+ .extend({
10
+ partnerId: zod_1.z.string().optional(),
11
+ })
12
+ .extend({
13
+ utm: models_1.UtmSchema.optional(),
14
+ });
11
15
  RegisterUserCommand.ResponseSchema = zod_1.z.object({
12
16
  data: zod_1.z.object({
13
17
  accessToken: zod_1.z.string(),
@@ -40,3 +40,4 @@ __exportStar(require("./user"), exports);
40
40
  __exportStar(require("./user-to-subscription"), exports);
41
41
  __exportStar(require("./user-to-task"), exports);
42
42
  __exportStar(require("./promocode"), exports);
43
+ __exportStar(require("./ui-notification"), exports);
@@ -9,6 +9,8 @@ var CreatePromocodeCommand;
9
9
  uuid: true,
10
10
  createdAt: true,
11
11
  updatedAt: true,
12
+ }).extend({
13
+ code: zod_1.z.string().optional(),
12
14
  });
13
15
  CreatePromocodeCommand.ResponseSchema = zod_1.z.object({
14
16
  data: models_1.PromocodeSchema,
@@ -2,12 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AuthWithTelegramWebAppCommand = void 0;
4
4
  const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
5
6
  var AuthWithTelegramWebAppCommand;
6
7
  (function (AuthWithTelegramWebAppCommand) {
7
8
  AuthWithTelegramWebAppCommand.RequestBodySchema = zod_1.z.object({
8
9
  initData: zod_1.z.string(),
9
10
  platform: zod_1.z.string().nullable(),
10
11
  partnerId: zod_1.z.string().optional(),
12
+ utm: models_1.UtmSchema.optional(),
11
13
  });
12
14
  AuthWithTelegramWebAppCommand.ResponseSchema = zod_1.z.object({
13
15
  data: zod_1.z.object({
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CompelteUiNotificationCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ var CompelteUiNotificationCommand;
6
+ (function (CompelteUiNotificationCommand) {
7
+ CompelteUiNotificationCommand.RequestParamsSchema = zod_1.z.object({
8
+ uuid: zod_1.z.string().uuid(),
9
+ });
10
+ CompelteUiNotificationCommand.ResponseSchema = zod_1.z.object({
11
+ data: zod_1.z.object({
12
+ isCompleted: zod_1.z.boolean(),
13
+ }),
14
+ });
15
+ })(CompelteUiNotificationCommand || (exports.CompelteUiNotificationCommand = CompelteUiNotificationCommand = {}));
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FindActiveUiNotificationsByPageAndUserCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ var FindActiveUiNotificationsByPageAndUserCommand;
6
+ (function (FindActiveUiNotificationsByPageAndUserCommand) {
7
+ FindActiveUiNotificationsByPageAndUserCommand.RequestQuerySchema = zod_1.z.object({
8
+ page: zod_1.z.string(),
9
+ });
10
+ FindActiveUiNotificationsByPageAndUserCommand.ResponseSchema = zod_1.z.object({
11
+ data: zod_1.z.array(zod_1.z.object({
12
+ uuid: zod_1.z.string().uuid(),
13
+ dynamicUiContent: zod_1.z.record(zod_1.z.unknown()),
14
+ endDate: zod_1.z.date().nullable(),
15
+ serverTime: zod_1.z.date().optional(),
16
+ })),
17
+ });
18
+ })(FindActiveUiNotificationsByPageAndUserCommand || (exports.FindActiveUiNotificationsByPageAndUserCommand = FindActiveUiNotificationsByPageAndUserCommand = {}));
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./find-active-ui-notifications-by-page-and-user.command"), exports);
18
+ __exportStar(require("./complete-ui-notification.command"), exports);
@@ -960,4 +960,39 @@ exports.ERRORS = {
960
960
  message: 'Произошла ошибка при проверке ограничений на длину запроса для чата',
961
961
  httpCode: 500,
962
962
  },
963
+ UTM_SAVE_ERROR: {
964
+ code: 'A218',
965
+ message: 'Произошла ошибка при сохранении UTM',
966
+ httpCode: 500,
967
+ },
968
+ UI_NOTIFICATIONS_FIND_ERROR: {
969
+ code: 'A219',
970
+ message: 'Прозошла ошибка при поиске UI уведомлений',
971
+ httpCode: 500,
972
+ },
973
+ UI_NOTIFICATION_CREATE_ERROR: {
974
+ code: 'A220',
975
+ message: 'Прозошла ошибка при создании UI уведомления',
976
+ httpCode: 500,
977
+ },
978
+ UI_NOTIFICATION_DELETE_ERROR: {
979
+ code: 'A221',
980
+ message: 'Прозошла ошибка при удалении UI уведомления',
981
+ httpCode: 500,
982
+ },
983
+ UI_NOTIFICATION_COMPLETE_ERROR: {
984
+ code: 'A222',
985
+ message: 'Прозошла ошибка при завершении UI уведомления',
986
+ httpCode: 500,
987
+ },
988
+ UI_NOTIFICATION_FIND_ERROR: {
989
+ code: 'A223',
990
+ message: 'UI уведомление не найдено',
991
+ httpCode: 404,
992
+ },
993
+ PROMOCODE_GENERATE_ERROR: {
994
+ code: 'A224',
995
+ message: 'Промокод не сгенерирован',
996
+ httpCode: 500,
997
+ },
963
998
  };
@@ -39,3 +39,4 @@ __exportStar(require("./transaction"), exports);
39
39
  __exportStar(require("./unregistered-user"), exports);
40
40
  __exportStar(require("./user"), exports);
41
41
  __exportStar(require("./promocode"), exports);
42
+ __exportStar(require("./ui-notification"), exports);
@@ -3,5 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PROMOCODE_PROMOTION = void 0;
4
4
  var PROMOCODE_PROMOTION;
5
5
  (function (PROMOCODE_PROMOTION) {
6
- PROMOCODE_PROMOTION["bonus"] = "bonus";
6
+ PROMOCODE_PROMOTION["BONUS"] = "bonus";
7
7
  })(PROMOCODE_PROMOTION || (exports.PROMOCODE_PROMOTION = PROMOCODE_PROMOTION = {}));
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PROMOCODE_STATUS = void 0;
4
4
  var PROMOCODE_STATUS;
5
5
  (function (PROMOCODE_STATUS) {
6
- PROMOCODE_STATUS["active"] = "active";
7
- PROMOCODE_STATUS["inactive"] = "inactive";
6
+ PROMOCODE_STATUS["ACTIVE"] = "active";
7
+ PROMOCODE_STATUS["INACTIVE"] = "inactive";
8
8
  })(PROMOCODE_STATUS || (exports.PROMOCODE_STATUS = PROMOCODE_STATUS = {}));
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./ui-notification-condition-of-execution.enum"), exports);
18
+ __exportStar(require("./ui-notification-status.enum"), exports);
19
+ __exportStar(require("./ui-notification-type.enum"), exports);
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UI_NOTIFICATION_CONDITION_OF_EXECUTION = void 0;
4
+ var UI_NOTIFICATION_CONDITION_OF_EXECUTION;
5
+ (function (UI_NOTIFICATION_CONDITION_OF_EXECUTION) {
6
+ UI_NOTIFICATION_CONDITION_OF_EXECUTION["EVENT"] = "EVENT";
7
+ UI_NOTIFICATION_CONDITION_OF_EXECUTION["USER_ACTION"] = "USER_ACTION";
8
+ })(UI_NOTIFICATION_CONDITION_OF_EXECUTION || (exports.UI_NOTIFICATION_CONDITION_OF_EXECUTION = UI_NOTIFICATION_CONDITION_OF_EXECUTION = {}));
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UI_NOTIFICATION_STATUS = void 0;
4
+ var UI_NOTIFICATION_STATUS;
5
+ (function (UI_NOTIFICATION_STATUS) {
6
+ UI_NOTIFICATION_STATUS["ACTIVE"] = "ACTIVE";
7
+ UI_NOTIFICATION_STATUS["EXPIRED"] = "EXPIRED";
8
+ UI_NOTIFICATION_STATUS["CLAIMED"] = "CLAIMED";
9
+ })(UI_NOTIFICATION_STATUS || (exports.UI_NOTIFICATION_STATUS = UI_NOTIFICATION_STATUS = {}));
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UI_NOTIFICATION_TYPE = void 0;
4
+ var UI_NOTIFICATION_TYPE;
5
+ (function (UI_NOTIFICATION_TYPE) {
6
+ UI_NOTIFICATION_TYPE["CONNECT_TELEGRAM_BONUS"] = "CONNECT_TELEGRAM_BONUS";
7
+ })(UI_NOTIFICATION_TYPE || (exports.UI_NOTIFICATION_TYPE = UI_NOTIFICATION_TYPE = {}));
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./enums"), exports);
@@ -46,3 +46,5 @@ __exportStar(require("./user-task.schema"), exports);
46
46
  __exportStar(require("./user-to-product.schema"), exports);
47
47
  __exportStar(require("./user-to-subscription.schema"), exports);
48
48
  __exportStar(require("./user.schema"), exports);
49
+ __exportStar(require("./utm.schema"), exports);
50
+ __exportStar(require("./ui-notification.schema"), exports);
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.uiNotificationSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.uiNotificationSchema = zod_1.z.object({
6
+ promocode: zod_1.z.string(),
7
+ text: zod_1.z.string().optional(),
8
+ endDate: zod_1.z.date().nullable(),
9
+ serverTime: zod_1.z.date().optional(),
10
+ });
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UtmSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.UtmSchema = zod_1.z
6
+ .object({
7
+ utmSource: zod_1.z.string().optional().nullable(),
8
+ utmMedium: zod_1.z.string().optional().nullable(),
9
+ utmCampaign: zod_1.z.string().optional().nullable(),
10
+ utmContent: zod_1.z.string().optional().nullable(),
11
+ utmTerm: zod_1.z.string().optional().nullable(),
12
+ })
13
+ .refine((data) => Object.values(data).some((value) => value != null && value !== ''), {
14
+ message: 'At least one UTM parameter must be provided',
15
+ });
@@ -1,13 +1,14 @@
1
- import { UserSchema } from '../../models';
1
+ import { UserSchema, UtmSchema } from '../../models';
2
2
  import { z } from 'zod';
3
3
 
4
4
  export namespace RegisterUserCommand {
5
- export const RequestSchema = z.intersection(
6
- UserSchema.pick({ email: true, password: true }),
7
- z.object({
8
- partnerId: z.string().uuid().optional(),
9
- }),
10
- );
5
+ export const RequestSchema = UserSchema.pick({ email: true, password: true })
6
+ .extend({
7
+ partnerId: z.string().optional(),
8
+ })
9
+ .extend({
10
+ utm: UtmSchema.optional(),
11
+ });
11
12
 
12
13
  export type Request = z.infer<typeof RequestSchema>;
13
14
 
package/commands/index.ts CHANGED
@@ -24,3 +24,4 @@ export * from './user';
24
24
  export * from './user-to-subscription';
25
25
  export * from './user-to-task';
26
26
  export * from './promocode';
27
+ export * from './ui-notification';
@@ -6,6 +6,8 @@ export namespace CreatePromocodeCommand {
6
6
  uuid: true,
7
7
  createdAt: true,
8
8
  updatedAt: true,
9
+ }).extend({
10
+ code: z.string().optional(),
9
11
  });
10
12
 
11
13
  export type Request = z.infer<typeof RequestSchema>;
@@ -1,10 +1,12 @@
1
1
  import { z } from 'zod';
2
+ import { UtmSchema } from '../../models';
2
3
 
3
4
  export namespace AuthWithTelegramWebAppCommand {
4
5
  export const RequestBodySchema = z.object({
5
6
  initData: z.string(),
6
7
  platform: z.string().nullable(),
7
8
  partnerId: z.string().optional(),
9
+ utm: UtmSchema.optional(),
8
10
  });
9
11
 
10
12
  export type Request = z.infer<typeof RequestBodySchema>;
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace CompelteUiNotificationCommand {
4
+ export const RequestParamsSchema = z.object({
5
+ uuid: z.string().uuid(),
6
+ });
7
+
8
+ export type Request = z.infer<typeof RequestParamsSchema>;
9
+
10
+ export const ResponseSchema = z.object({
11
+ data: z.object({
12
+ isCompleted: z.boolean(),
13
+ }),
14
+ });
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -0,0 +1,21 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace FindActiveUiNotificationsByPageAndUserCommand {
4
+ export const RequestQuerySchema = z.object({
5
+ page: z.string(),
6
+ });
7
+
8
+ export type Request = z.infer<typeof RequestQuerySchema>;
9
+
10
+ export const ResponseSchema = z.object({
11
+ data: z.array(
12
+ z.object({
13
+ uuid: z.string().uuid(),
14
+ dynamicUiContent: z.record(z.unknown()),
15
+ endDate: z.date().nullable(),
16
+ serverTime: z.date().optional(),
17
+ }),
18
+ ),
19
+ });
20
+ export type Response = z.infer<typeof ResponseSchema>;
21
+ }
@@ -0,0 +1,2 @@
1
+ export * from './find-active-ui-notifications-by-page-and-user.command';
2
+ export * from './complete-ui-notification.command';
@@ -963,4 +963,39 @@ export const ERRORS = {
963
963
  message: 'Произошла ошибка при проверке ограничений на длину запроса для чата',
964
964
  httpCode: 500,
965
965
  },
966
+ UTM_SAVE_ERROR: {
967
+ code: 'A218',
968
+ message: 'Произошла ошибка при сохранении UTM',
969
+ httpCode: 500,
970
+ },
971
+ UI_NOTIFICATIONS_FIND_ERROR: {
972
+ code: 'A219',
973
+ message: 'Прозошла ошибка при поиске UI уведомлений',
974
+ httpCode: 500,
975
+ },
976
+ UI_NOTIFICATION_CREATE_ERROR: {
977
+ code: 'A220',
978
+ message: 'Прозошла ошибка при создании UI уведомления',
979
+ httpCode: 500,
980
+ },
981
+ UI_NOTIFICATION_DELETE_ERROR: {
982
+ code: 'A221',
983
+ message: 'Прозошла ошибка при удалении UI уведомления',
984
+ httpCode: 500,
985
+ },
986
+ UI_NOTIFICATION_COMPLETE_ERROR: {
987
+ code: 'A222',
988
+ message: 'Прозошла ошибка при завершении UI уведомления',
989
+ httpCode: 500,
990
+ },
991
+ UI_NOTIFICATION_FIND_ERROR: {
992
+ code: 'A223',
993
+ message: 'UI уведомление не найдено',
994
+ httpCode: 404,
995
+ },
996
+ PROMOCODE_GENERATE_ERROR: {
997
+ code: 'A224',
998
+ message: 'Промокод не сгенерирован',
999
+ httpCode: 500,
1000
+ },
966
1001
  };
@@ -23,3 +23,4 @@ export * from './transaction';
23
23
  export * from './unregistered-user';
24
24
  export * from './user';
25
25
  export * from './promocode';
26
+ export * from './ui-notification';
@@ -1,3 +1,3 @@
1
1
  export enum PROMOCODE_PROMOTION {
2
- bonus = 'bonus',
2
+ BONUS = 'bonus',
3
3
  }
@@ -1,4 +1,4 @@
1
1
  export enum PROMOCODE_STATUS {
2
- active = 'active',
3
- inactive = 'inactive',
2
+ ACTIVE = 'active',
3
+ INACTIVE = 'inactive',
4
4
  }
@@ -0,0 +1,3 @@
1
+ export * from './ui-notification-condition-of-execution.enum';
2
+ export * from './ui-notification-status.enum';
3
+ export * from './ui-notification-type.enum';
@@ -0,0 +1,4 @@
1
+ export enum UI_NOTIFICATION_CONDITION_OF_EXECUTION {
2
+ EVENT = 'EVENT',
3
+ USER_ACTION = 'USER_ACTION',
4
+ }
@@ -0,0 +1,5 @@
1
+ export enum UI_NOTIFICATION_STATUS {
2
+ ACTIVE = 'ACTIVE',
3
+ EXPIRED = 'EXPIRED',
4
+ CLAIMED = 'CLAIMED',
5
+ }
@@ -0,0 +1,3 @@
1
+ export enum UI_NOTIFICATION_TYPE {
2
+ CONNECT_TELEGRAM_BONUS = 'CONNECT_TELEGRAM_BONUS',
3
+ }
@@ -0,0 +1 @@
1
+ export * from './enums';
package/models/index.ts CHANGED
@@ -30,3 +30,5 @@ export * from './user-task.schema';
30
30
  export * from './user-to-product.schema';
31
31
  export * from './user-to-subscription.schema';
32
32
  export * from './user.schema';
33
+ export * from './utm.schema';
34
+ export * from './ui-notification.schema';
@@ -0,0 +1,8 @@
1
+ import { z } from 'zod';
2
+
3
+ export const uiNotificationSchema = z.object({
4
+ promocode: z.string(),
5
+ text: z.string().optional(),
6
+ endDate: z.date().nullable(),
7
+ serverTime: z.date().optional(),
8
+ });
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+
3
+ export const UtmSchema = z
4
+ .object({
5
+ utmSource: z.string().optional().nullable(),
6
+ utmMedium: z.string().optional().nullable(),
7
+ utmCampaign: z.string().optional().nullable(),
8
+ utmContent: z.string().optional().nullable(),
9
+ utmTerm: z.string().optional().nullable(),
10
+ })
11
+ .refine((data) => Object.values(data).some((value) => value != null && value !== ''), {
12
+ message: 'At least one UTM parameter must be provided',
13
+ });
14
+
15
+ export type Utm = z.infer<typeof UtmSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.5.54",
3
+ "version": "0.5.56",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",