@purpleschool/gptbot 0.11.5 → 0.11.7

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 (121) hide show
  1. package/api/controllers/http/community.ts +1 -0
  2. package/api/controllers/http/index.ts +1 -0
  3. package/api/controllers/http/spell-corrector.ts +14 -0
  4. package/api/controllers/http/unregistered-user.ts +5 -0
  5. package/api/controllers/http/user.ts +1 -0
  6. package/api/routes.ts +36 -0
  7. package/build/api/controllers/http/community.js +1 -0
  8. package/build/api/controllers/http/index.js +1 -0
  9. package/build/api/controllers/http/spell-corrector.js +16 -0
  10. package/build/api/controllers/http/unregistered-user.js +5 -1
  11. package/build/api/controllers/http/user.js +1 -0
  12. package/build/api/routes.js +25 -0
  13. package/build/commands/community/index.js +1 -0
  14. package/build/commands/community/set-visibility-community-post.command.js +21 -0
  15. package/build/commands/subscription/find-subscription.command.js +4 -1
  16. package/build/commands/subscription/get-available-upgrades.command.js +3 -1
  17. package/build/commands/tools/index.js +1 -0
  18. package/build/commands/tools/presentation/create-presentation.command.js +3 -0
  19. package/build/commands/tools/presentation/update-presentation.command.js +1 -0
  20. package/build/commands/tools/spell-corrector/delete-all-spell-corrector-jobs.command.js +8 -0
  21. package/build/commands/tools/spell-corrector/delete-spell-corrector-job-by-uuid.command.js +11 -0
  22. package/build/commands/tools/spell-corrector/find-spell-corrector-job-by-uuid.command.js +14 -0
  23. package/build/commands/tools/spell-corrector/find-spell-corrector-jobs.command.js +18 -0
  24. package/build/commands/tools/spell-corrector/get-spell-corrector-tool-config.command.js +11 -0
  25. package/build/commands/tools/spell-corrector/index.js +25 -0
  26. package/build/commands/tools/spell-corrector/retry-spell-corrector-job.command.js +14 -0
  27. package/build/commands/tools/spell-corrector/set-reaction-to-spell-corrector-job.command.js +28 -0
  28. package/build/commands/tools/spell-corrector/spell-corrector.command.js +15 -0
  29. package/build/commands/tools/spell-corrector/update-spell-corrector-job-title.command.js +17 -0
  30. package/build/commands/tools/video-editor/edit-video.command.js +2 -0
  31. package/build/commands/tools/video-editor/retry-video-editor-job.command.js +2 -0
  32. package/build/commands/unregistered-user/index.js +1 -0
  33. package/build/commands/unregistered-user/patch-locale.command.js +16 -0
  34. package/build/commands/user/get-me.command.js +1 -0
  35. package/build/commands/user/index.js +1 -0
  36. package/build/commands/user/patch-locale.command.js +16 -0
  37. package/build/constants/ai-model/enums/ai-model-strategy.enum.js +1 -0
  38. package/build/constants/model/enums/unified-model-content-type.enum.js +2 -0
  39. package/build/constants/presentation/enums/index.js +1 -0
  40. package/build/constants/presentation/enums/presentation-target-audience.enum.js +10 -0
  41. package/build/constants/subscription/enums/subscription-feature-type.enum.js +11 -1
  42. package/build/constants/tool-video-editor/enums/index.js +1 -0
  43. package/build/constants/tool-video-editor/enums/video-editor-pricing-rule-type.enum.js +8 -0
  44. package/build/constants/user/enums/index.js +1 -0
  45. package/build/constants/user/enums/locale.enum.js +8 -0
  46. package/build/helpers/video-editor/calculate-video-editing-price.helper.js +27 -2
  47. package/build/models/subscription-feature.schema.js +42 -1
  48. package/build/models/subscription.schema.js +7 -1
  49. package/build/models/tools/image-editor/image-editor-model.schema.js +2 -0
  50. package/build/models/tools/image-generation/image-generation-model.schema.js +1 -0
  51. package/build/models/tools/index.js +1 -0
  52. package/build/models/tools/presentation/index.js +1 -0
  53. package/build/models/tools/presentation/presentation-template.schema.js +1 -0
  54. package/build/models/tools/presentation/presentation-title-page.schema.js +9 -0
  55. package/build/models/tools/presentation/presentation.schema.js +3 -0
  56. package/build/models/tools/presentation/slide-content-edit.schema.js +18 -12
  57. package/build/models/tools/presentation/slide-content.schema.js +16 -12
  58. package/build/models/tools/spell-corrector/index.js +19 -0
  59. package/build/models/tools/spell-corrector/spell-corrector-config.schema.js +9 -0
  60. package/build/models/tools/spell-corrector/spell-corrector-job.schema.js +13 -0
  61. package/build/models/tools/spell-corrector/spell-corrector-model.schema.js +17 -0
  62. package/build/models/tools/stt/stt-response.schema.js +2 -0
  63. package/build/models/tools/video/video-config.schema.js +10 -2
  64. package/build/models/tools/video-editor/video-editor-job.schema.js +6 -1
  65. package/build/models/tools/video-editor/video-editor-model.schema.js +27 -2
  66. package/build/models/user.schema.js +2 -0
  67. package/commands/community/index.ts +1 -0
  68. package/commands/community/set-visibility-community-post.command.ts +24 -0
  69. package/commands/subscription/find-subscription.command.ts +11 -1
  70. package/commands/subscription/get-available-upgrades.command.ts +3 -1
  71. package/commands/tools/index.ts +1 -0
  72. package/commands/tools/presentation/create-presentation.command.ts +7 -1
  73. package/commands/tools/presentation/update-presentation.command.ts +1 -0
  74. package/commands/tools/spell-corrector/delete-all-spell-corrector-jobs.command.ts +6 -0
  75. package/commands/tools/spell-corrector/delete-spell-corrector-job-by-uuid.command.ts +11 -0
  76. package/commands/tools/spell-corrector/find-spell-corrector-job-by-uuid.command.ts +16 -0
  77. package/commands/tools/spell-corrector/find-spell-corrector-jobs.command.ts +18 -0
  78. package/commands/tools/spell-corrector/get-spell-corrector-tool-config.command.ts +10 -0
  79. package/commands/tools/spell-corrector/index.ts +9 -0
  80. package/commands/tools/spell-corrector/retry-spell-corrector-job.command.ts +14 -0
  81. package/commands/tools/spell-corrector/set-reaction-to-spell-corrector-job.command.ts +33 -0
  82. package/commands/tools/spell-corrector/spell-corrector.command.ts +17 -0
  83. package/commands/tools/spell-corrector/update-spell-corrector-job-title.command.ts +19 -0
  84. package/commands/tools/video-editor/edit-video.command.ts +2 -0
  85. package/commands/tools/video-editor/retry-video-editor-job.command.ts +2 -0
  86. package/commands/unregistered-user/index.ts +1 -0
  87. package/commands/unregistered-user/patch-locale.command.ts +18 -0
  88. package/commands/user/get-me.command.ts +2 -1
  89. package/commands/user/index.ts +1 -0
  90. package/commands/user/patch-locale.command.ts +18 -0
  91. package/constants/ai-model/enums/ai-model-strategy.enum.ts +1 -0
  92. package/constants/model/enums/unified-model-content-type.enum.ts +2 -0
  93. package/constants/presentation/enums/index.ts +1 -0
  94. package/constants/presentation/enums/presentation-target-audience.enum.ts +6 -0
  95. package/constants/subscription/enums/subscription-feature-type.enum.ts +11 -1
  96. package/constants/tool-video-editor/enums/index.ts +1 -0
  97. package/constants/tool-video-editor/enums/video-editor-pricing-rule-type.enum.ts +4 -0
  98. package/constants/user/enums/index.ts +1 -0
  99. package/constants/user/enums/locale.enum.ts +4 -0
  100. package/helpers/video-editor/calculate-video-editing-price.helper.ts +52 -2
  101. package/models/subscription-feature.schema.ts +57 -0
  102. package/models/subscription.schema.ts +11 -0
  103. package/models/tools/image-editor/image-editor-model.schema.ts +2 -0
  104. package/models/tools/image-generation/image-generation-model.schema.ts +1 -0
  105. package/models/tools/index.ts +1 -0
  106. package/models/tools/presentation/index.ts +1 -0
  107. package/models/tools/presentation/presentation-template.schema.ts +1 -0
  108. package/models/tools/presentation/presentation-title-page.schema.ts +9 -0
  109. package/models/tools/presentation/presentation.schema.ts +8 -1
  110. package/models/tools/presentation/slide-content-edit.schema.ts +18 -12
  111. package/models/tools/presentation/slide-content.schema.ts +25 -21
  112. package/models/tools/spell-corrector/index.ts +3 -0
  113. package/models/tools/spell-corrector/spell-corrector-config.schema.ts +7 -0
  114. package/models/tools/spell-corrector/spell-corrector-job.schema.ts +11 -0
  115. package/models/tools/spell-corrector/spell-corrector-model.schema.ts +15 -0
  116. package/models/tools/stt/stt-response.schema.ts +2 -0
  117. package/models/tools/video/video-config.schema.ts +14 -1
  118. package/models/tools/video-editor/video-editor-job.schema.ts +8 -0
  119. package/models/tools/video-editor/video-editor-model.schema.ts +36 -1
  120. package/models/user.schema.ts +2 -0
  121. package/package.json +1 -1
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace DeleteSpellCorrectorJobByUUIDCommand {
4
+ export const RequestParamsSchema = z.object({
5
+ uuid: z.string().uuid(),
6
+ });
7
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
8
+
9
+ export const ResponseSchema = z.void();
10
+ export type Response = z.infer<typeof ResponseSchema>;
11
+ }
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import { SpellCorrectorToolJobSchema } from '../../../models';
3
+
4
+ export namespace FindSpellCorrectorJobByUUIDCommand {
5
+ export const RequestParamsSchema = SpellCorrectorToolJobSchema.pick({
6
+ uuid: true,
7
+ });
8
+
9
+ export type Request = z.infer<typeof RequestParamsSchema>;
10
+
11
+ export const ResponseSchema = z.object({
12
+ data: SpellCorrectorToolJobSchema,
13
+ });
14
+
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ import { SpellCorrectorToolJobSchema } from '../../../models';
3
+
4
+ export namespace FindSpellCorrectorJobsCommand {
5
+ export const RequestQuerySchema = z.object({
6
+ limit: z.coerce.number().min(1).optional(),
7
+ offset: z.coerce.number().min(0).default(0).optional(),
8
+ title: z.string().optional(),
9
+ });
10
+ export type RequestQuery = z.infer<typeof RequestQuerySchema>;
11
+
12
+ export const ResponseSchema = z.object({
13
+ data: z.array(SpellCorrectorToolJobSchema),
14
+ totalPages: z.number(),
15
+ page: z.number(),
16
+ });
17
+ export type Response = z.infer<typeof ResponseSchema>;
18
+ }
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+ import { SpellCorrectorToolConfigSchema } from '../../../models';
3
+
4
+ export namespace GetSpellCorrectorToolConfigCommand {
5
+ export const ResponseSchema = z.object({
6
+ data: SpellCorrectorToolConfigSchema,
7
+ });
8
+
9
+ export type Response = z.infer<typeof ResponseSchema>;
10
+ }
@@ -0,0 +1,9 @@
1
+ export * from './spell-corrector.command';
2
+ export * from './delete-spell-corrector-job-by-uuid.command';
3
+ export * from './delete-all-spell-corrector-jobs.command';
4
+ export * from './set-reaction-to-spell-corrector-job.command';
5
+ export * from './update-spell-corrector-job-title.command';
6
+ export * from './retry-spell-corrector-job.command';
7
+ export * from './find-spell-corrector-job-by-uuid.command';
8
+ export * from './find-spell-corrector-jobs.command';
9
+ export * from './get-spell-corrector-tool-config.command';
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ import { SpellCorrectorToolJobSchema } from '../../../models';
3
+
4
+ export namespace RetrySpellCorrectorJobCommand {
5
+ export const RequestParamsSchema = z.object({
6
+ uuid: z.string().uuid(),
7
+ });
8
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
9
+
10
+ export const ResponseSchema = z.object({
11
+ data: SpellCorrectorToolJobSchema,
12
+ });
13
+ export type Response = z.infer<typeof ResponseSchema>;
14
+ }
@@ -0,0 +1,33 @@
1
+ import { z } from 'zod';
2
+ import { SpellCorrectorToolJobSchema } from '../../../models';
3
+ import { USER_REACTION } from '../../../constants';
4
+
5
+ export namespace SetReactionToSpellCorrectorJobCommand {
6
+ export const RequestSchema = z
7
+ .object({
8
+ reaction: z.nativeEnum(USER_REACTION).nullable(),
9
+ dislikeReason: z.string().nullable().default(null),
10
+ })
11
+ .refine(
12
+ (data) => {
13
+ if (data.reaction !== USER_REACTION.DISLIKED && data.dislikeReason) {
14
+ return false;
15
+ }
16
+ return true;
17
+ },
18
+ {
19
+ message: 'Dislike reason is not allowed when reaction is not DISLIKED',
20
+ },
21
+ );
22
+ export type Request = z.infer<typeof RequestSchema>;
23
+
24
+ export const RequestParamsSchema = z.object({
25
+ uuid: z.string().uuid(),
26
+ });
27
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
28
+
29
+ export const ResponseSchema = z.object({
30
+ data: SpellCorrectorToolJobSchema,
31
+ });
32
+ export type Response = z.infer<typeof ResponseSchema>;
33
+ }
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+ import { ToolJobSchema } from '../../../models';
3
+
4
+ export namespace SpellCorrectorCommand {
5
+ export const RequestSchema = z.object({
6
+ modelId: z.string().uuid(),
7
+ prompt: z.string().min(1).max(100000),
8
+ });
9
+
10
+ export type Request = z.infer<typeof RequestSchema>;
11
+
12
+ export const ResponseSchema = z.object({
13
+ data: ToolJobSchema,
14
+ });
15
+
16
+ export type Response = z.infer<typeof ResponseSchema>;
17
+ }
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ import { SpellCorrectorToolJobSchema } from '../../../models';
3
+
4
+ export namespace UpdateSpellCorrectorJobTitleCommand {
5
+ export const RequestSchema = z.object({
6
+ title: z.string().min(1).max(40).trim(),
7
+ });
8
+ export type Request = z.infer<typeof RequestSchema>;
9
+
10
+ export const RequestParamsSchema = z.object({
11
+ uuid: z.string().uuid(),
12
+ });
13
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
14
+
15
+ export const ResponseSchema = z.object({
16
+ data: SpellCorrectorToolJobSchema,
17
+ });
18
+ export type Response = z.infer<typeof ResponseSchema>;
19
+ }
@@ -6,6 +6,8 @@ export namespace EditVideoCommand {
6
6
  modelId: z.string().uuid(),
7
7
  prompt: z.string(),
8
8
  fileId: z.string().uuid(),
9
+ resolution: z.string().optional(),
10
+ duration: z.number().optional(),
9
11
  });
10
12
 
11
13
  export type Request = z.infer<typeof RequestSchema>;
@@ -12,6 +12,8 @@ export namespace RetryVideoEditorJobCommand {
12
12
  modelId: z.string().uuid().optional(),
13
13
  prompt: z.string().optional(),
14
14
  fileId: z.string().uuid().optional(),
15
+ resolution: z.string().optional(),
16
+ duration: z.number().optional(),
15
17
  });
16
18
  export type RequestBody = z.infer<typeof RequestBodySchema>;
17
19
 
@@ -1 +1,2 @@
1
1
  export * from './create-unregistered-user.command';
2
+ export * from './patch-locale.command';
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ import { LOCALE } from '../../constants';
3
+
4
+ export namespace PatchUnregisteredUserLocaleCommand {
5
+ export const RequestSchema = z.object({
6
+ locale: z.nativeEnum(LOCALE),
7
+ });
8
+
9
+ export type Request = z.infer<typeof RequestSchema>;
10
+
11
+ export const ResponseSchema = z.object({
12
+ data: z.object({
13
+ locale: z.nativeEnum(LOCALE),
14
+ }),
15
+ });
16
+
17
+ export type Response = z.infer<typeof ResponseSchema>;
18
+ }
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { ROLE, SIGNUP_METHOD, USER_STATUS } from '../../constants';
2
+ import { LOCALE, ROLE, SIGNUP_METHOD, USER_STATUS } from '../../constants';
3
3
  import { UserProfileResponseSchema } from '../../models';
4
4
 
5
5
  export namespace GetMeCommand {
@@ -17,6 +17,7 @@ export namespace GetMeCommand {
17
17
  telegramId: z.number().nullable(),
18
18
  telegramUserName: z.string().nullable(),
19
19
  webmasterId: z.string().uuid().nullable(),
20
+ locale: z.nativeEnum(LOCALE),
20
21
  profile: UserProfileResponseSchema,
21
22
  }),
22
23
  });
@@ -1,6 +1,7 @@
1
1
  export * from './check-email.command';
2
2
  export * from './find-user-by-uuid.command';
3
3
  export * from './get-me.command';
4
+ export * from './patch-locale.command';
4
5
  export * from './up-token-bonus-balance.command';
5
6
  export * from './find-users-by-criteria.command';
6
7
  export * from './get-user-balance.command';
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ import { LOCALE } from '../../constants';
3
+
4
+ export namespace PatchUserLocaleCommand {
5
+ export const RequestSchema = z.object({
6
+ locale: z.nativeEnum(LOCALE),
7
+ });
8
+
9
+ export type Request = z.infer<typeof RequestSchema>;
10
+
11
+ export const ResponseSchema = z.object({
12
+ data: z.object({
13
+ locale: z.nativeEnum(LOCALE),
14
+ }),
15
+ });
16
+
17
+ export type Response = z.infer<typeof ResponseSchema>;
18
+ }
@@ -10,6 +10,7 @@ export enum AI_MODEL_STRATEGY {
10
10
  STABLE_DIFFUSION_IMAGE_GENERATION = 'stable_diffusion_image_generation',
11
11
  LLAMA_TEXT_GENERATION = 'llama_text_generation',
12
12
  QWEN_TEXT_GENERATION = 'qwen_text_generation',
13
+ KIE_OPENAI_TEXT_GENERATION = 'kie_openai_text_generation',
13
14
  GROK_IMAGE_GENERATION = 'grok_image_generation',
14
15
  GEMINI_TEXT_GENERATION = 'gemini_text_generation',
15
16
  GEMINI_IMAGE_GENERATION = 'gemini_image_generation',
@@ -15,4 +15,6 @@ export enum UNIFIED_MODEL_CONTENT_TYPE {
15
15
  IMAGE_GENERATION = 'IMAGE_GENERATION',
16
16
  INTERIOR_DESIGN = 'INTERIOR_DESIGN',
17
17
  MARKETPLACE_CARD = 'MARKETPLACE_CARD',
18
+ SOLVING_EDU_TASK = 'SOLVING_EDU_TASK',
19
+ SPELL_CORRECTOR = 'SPELL_CORRECTOR',
18
20
  }
@@ -7,3 +7,4 @@ export * from './slide-image-slot-action.enum';
7
7
  export * from './presentation-ai-action-type.enum';
8
8
  export * from './presentation-ai-action-pricing-type.enum';
9
9
  export * from './presentation-ai-action-call-status.enum';
10
+ export * from './presentation-target-audience.enum';
@@ -0,0 +1,6 @@
1
+ export enum PRESENTATION_TARGET_AUDIENCE {
2
+ NONE = 'NONE',
3
+ SCHOOL = 'SCHOOL',
4
+ UNIVERSITY = 'UNIVERSITY',
5
+ BUSINESS = 'BUSINESS',
6
+ }
@@ -25,6 +25,12 @@ export enum SUBSCRIPTION_FEATURE_TYPE {
25
25
  IMAGE_EDITOR_MODEL_ACCESS = 'image_editor_model_access',
26
26
  INTERIOR_DESIGN_QUOTA = 'interior_design_quota',
27
27
  INTERIOR_DESIGN_MODEL_ACCESS = 'interior_design_model_access',
28
+ SPELL_CORRECTOR_QUOTA = 'spell_corrector_quota',
29
+ SPELL_CORRECTOR_MODEL_ACCESS = 'spell_corrector_model_access',
30
+ PARAPHRASE_TYPE_ACCESS = 'paraphrase_type_access',
31
+ MARKETPLACE_CARD_MODEL_ACCESS = 'marketplace_card_model_access',
32
+ EDU_TASK_MODEL_ACCESS = 'edu_task_model_access',
33
+ VIDEO_EDITOR_MODEL_ACCESS = 'video_editor_model_access',
28
34
  }
29
35
 
30
36
  export enum SUBSCRIPTION_FEATURE_KIND {
@@ -33,7 +39,6 @@ export enum SUBSCRIPTION_FEATURE_KIND {
33
39
  IMAGE_GENERATION = 'image_generation',
34
40
  TTS = 'tts',
35
41
  STT = 'stt',
36
- PRESENTATIONS = 'presentations',
37
42
  VIDEO = 'video',
38
43
  PRESENTATION = 'presentation',
39
44
  BASE = 'base',
@@ -41,4 +46,9 @@ export enum SUBSCRIPTION_FEATURE_KIND {
41
46
  WRITER = 'writer',
42
47
  IMAGE_EDITOR = 'image_editor',
43
48
  INTERIOR_DESIGN = 'interior_design',
49
+ SPELL_CORRECTOR = 'spell_corrector',
50
+ PARAPHRASE = 'paraphrase',
51
+ MARKETPLACE_CARD = 'marketplace_card',
52
+ EDU_TASK = 'edu_task',
53
+ VIDEO_EDITOR = 'video_editor',
44
54
  }
@@ -1 +1,2 @@
1
1
  export * from './video-editor-model-strategy.enum';
2
+ export * from './video-editor-pricing-rule-type.enum';
@@ -0,0 +1,4 @@
1
+ export enum VIDEO_EDITOR_PRICING_RULE_TYPE {
2
+ FLAT = 'flat',
3
+ PER_SECOND = 'per_second',
4
+ }
@@ -2,3 +2,4 @@ export * from './singup-method.enum';
2
2
  export * from './user-status';
3
3
  export * from './user-sort-by.enum';
4
4
  export * from './sort-order.enum';
5
+ export * from './locale.enum';
@@ -0,0 +1,4 @@
1
+ export enum LOCALE {
2
+ RU = 'ru',
3
+ EN = 'en',
4
+ }
@@ -1,3 +1,53 @@
1
- export function calculateVideoEditingPrice({ pricePerCall }: { pricePerCall: number }) {
2
- return pricePerCall;
1
+ import { VIDEO_EDITOR_PRICING_RULE_TYPE } from '../../constants';
2
+ import {
3
+ VideoEditorModelPricingRuleCondition,
4
+ VideoEditorModelPricingRules,
5
+ VideoEditorPricingRequestParams,
6
+ } from '../../models';
7
+
8
+ function matchesCondition(
9
+ condition: VideoEditorModelPricingRuleCondition,
10
+ params: VideoEditorPricingRequestParams,
11
+ ): boolean {
12
+ const keys = Object.keys(condition) as (keyof VideoEditorModelPricingRuleCondition)[];
13
+
14
+ return keys.every((key) => {
15
+ const expected = condition[key];
16
+ if (expected === undefined || expected === null || expected === '') {
17
+ return true;
18
+ }
19
+
20
+ const value = params[key];
21
+ if (value === undefined || value === null) {
22
+ return false;
23
+ }
24
+
25
+ return value === expected;
26
+ });
27
+ }
28
+
29
+ export function calculateVideoEditingPrice({
30
+ pricePerCall,
31
+ params,
32
+ rules,
33
+ }: {
34
+ pricePerCall: number;
35
+ params: VideoEditorPricingRequestParams;
36
+ rules: VideoEditorModelPricingRules;
37
+ }): number {
38
+ const perSecondRule = rules
39
+ .filter((r) => r.type === VIDEO_EDITOR_PRICING_RULE_TYPE.PER_SECOND)
40
+ .find((r) => matchesCondition(r.condition, params));
41
+
42
+ const base = perSecondRule ? perSecondRule.value * params.duration : pricePerCall;
43
+
44
+ const flatMarkup = rules.reduce((sum, r) => {
45
+ if (r.type !== VIDEO_EDITOR_PRICING_RULE_TYPE.FLAT) {
46
+ return sum;
47
+ }
48
+
49
+ return matchesCondition(r.condition, params) ? sum + r.value : sum;
50
+ }, 0);
51
+
52
+ return Math.ceil(base + flatMarkup);
3
53
  }
@@ -214,6 +214,57 @@ export type InteriorDesignModelAccessFeature = z.infer<
214
214
  typeof InteriorDesignModelAccessFeatureSchema
215
215
  >;
216
216
 
217
+ export const SpellCorrectorQuotaFeatureSchema = SubscriptionFeatureBaseSchema.extend({
218
+ kind: z.literal(SUBSCRIPTION_FEATURE_KIND.SPELL_CORRECTOR),
219
+ type: z.literal(SUBSCRIPTION_FEATURE_TYPE.SPELL_CORRECTOR_QUOTA),
220
+ value: z.number(),
221
+ });
222
+ export type SpellCorrectorQuotaFeature = z.infer<typeof SpellCorrectorQuotaFeatureSchema>;
223
+
224
+ export const SpellCorrectorModelAccessFeatureSchema = SubscriptionFeatureBaseSchema.extend({
225
+ kind: z.literal(SUBSCRIPTION_FEATURE_KIND.SPELL_CORRECTOR),
226
+ type: z.literal(SUBSCRIPTION_FEATURE_TYPE.SPELL_CORRECTOR_MODEL_ACCESS),
227
+ isAvailable: z.boolean(),
228
+ modelId: z.string(),
229
+ });
230
+ export type SpellCorrectorModelAccessFeature = z.infer<
231
+ typeof SpellCorrectorModelAccessFeatureSchema
232
+ >;
233
+
234
+ export const ParaphraseTypeAccessFeatureSchema = SubscriptionFeatureBaseSchema.extend({
235
+ kind: z.literal(SUBSCRIPTION_FEATURE_KIND.PARAPHRASE),
236
+ type: z.literal(SUBSCRIPTION_FEATURE_TYPE.PARAPHRASE_TYPE_ACCESS),
237
+ isAvailable: z.boolean(),
238
+ modelId: z.string(),
239
+ });
240
+ export type ParaphraseTypeAccessFeature = z.infer<typeof ParaphraseTypeAccessFeatureSchema>;
241
+
242
+ export const MarketplaceCardModelAccessFeatureSchema = SubscriptionFeatureBaseSchema.extend({
243
+ kind: z.literal(SUBSCRIPTION_FEATURE_KIND.MARKETPLACE_CARD),
244
+ type: z.literal(SUBSCRIPTION_FEATURE_TYPE.MARKETPLACE_CARD_MODEL_ACCESS),
245
+ isAvailable: z.boolean(),
246
+ modelId: z.string(),
247
+ });
248
+ export type MarketplaceCardModelAccessFeature = z.infer<
249
+ typeof MarketplaceCardModelAccessFeatureSchema
250
+ >;
251
+
252
+ export const EduTaskModelAccessFeatureSchema = SubscriptionFeatureBaseSchema.extend({
253
+ kind: z.literal(SUBSCRIPTION_FEATURE_KIND.EDU_TASK),
254
+ type: z.literal(SUBSCRIPTION_FEATURE_TYPE.EDU_TASK_MODEL_ACCESS),
255
+ isAvailable: z.boolean(),
256
+ modelId: z.string(),
257
+ });
258
+ export type EduTaskModelAccessFeature = z.infer<typeof EduTaskModelAccessFeatureSchema>;
259
+
260
+ export const VideoEditorModelAccessFeatureSchema = SubscriptionFeatureBaseSchema.extend({
261
+ kind: z.literal(SUBSCRIPTION_FEATURE_KIND.VIDEO_EDITOR),
262
+ type: z.literal(SUBSCRIPTION_FEATURE_TYPE.VIDEO_EDITOR_MODEL_ACCESS),
263
+ isAvailable: z.boolean(),
264
+ modelId: z.string(),
265
+ });
266
+ export type VideoEditorModelAccessFeature = z.infer<typeof VideoEditorModelAccessFeatureSchema>;
267
+
217
268
  export const SubscriptionFeatureSchema = z.union([
218
269
  AiModelAccessFeatureSchema,
219
270
  RequestsQuotaFeatureSchema,
@@ -240,6 +291,12 @@ export const SubscriptionFeatureSchema = z.union([
240
291
  InteriorDesignQuotaFeatureSchema,
241
292
  InteriorDesignModelAccessFeatureSchema,
242
293
  ImageGenerationAccessFeatureSchema,
294
+ SpellCorrectorQuotaFeatureSchema,
295
+ SpellCorrectorModelAccessFeatureSchema,
296
+ ParaphraseTypeAccessFeatureSchema,
297
+ MarketplaceCardModelAccessFeatureSchema,
298
+ EduTaskModelAccessFeatureSchema,
299
+ VideoEditorModelAccessFeatureSchema,
243
300
  ]);
244
301
 
245
302
  export type SubscriptionFeature = z.infer<typeof SubscriptionFeatureSchema>;
@@ -58,3 +58,14 @@ export const SubscriptionWithSubTypesSchema = z.intersection(
58
58
  export const SubscriptionWithFeaturesSchema = SubscriptionSchema.extend({
59
59
  features: z.array(SubscriptionFeatureSchema),
60
60
  });
61
+
62
+ export const SubscriptionWithoutFeaturesSchema = SubscriptionSchema.omit({
63
+ features: true,
64
+ });
65
+
66
+ export const SubscriptionWithSubTypesWithoutFeaturesSchema = z.intersection(
67
+ SubscriptionWithoutFeaturesSchema,
68
+ z.object({
69
+ subTypes: z.array(SubscriptionWithoutFeaturesSchema),
70
+ }),
71
+ );
@@ -40,6 +40,8 @@ export const ImageEditorModelSchema = z.object({
40
40
  uuid: z.string(),
41
41
  title: z.string(),
42
42
  description: z.string(),
43
+ isNew: z.boolean(),
44
+ tierLabel: z.string(),
43
45
  pricePerImage: z.number(),
44
46
  order: z.number(),
45
47
  icons: IconVariantsSchema,
@@ -43,6 +43,7 @@ export const ImageGenerationModelSchema = z.object({
43
43
  order: z.number(),
44
44
  status: z.string(),
45
45
  price: z.number(),
46
+ isNew: z.boolean(),
46
47
  params: ImageGenerationModelParamsSchema,
47
48
  supportsImageAttachment: z.boolean(),
48
49
  maxAttachedImages: z.number(),
@@ -13,3 +13,4 @@ export * from './image-generation';
13
13
  export * from './marketplace-card';
14
14
  export * from './interior-design';
15
15
  export * from './solving-edu-task';
16
+ export * from './spell-corrector';
@@ -6,3 +6,4 @@ export * from './slide.schema';
6
6
  export * from './slide-content.schema';
7
7
  export * from './presentation-config.schema';
8
8
  export * from './presentation-ai-action.schema';
9
+ export * from './presentation-title-page.schema';
@@ -6,6 +6,7 @@ export const PresentationTemplateSchema = z.object({
6
6
  image: z.string(),
7
7
  order: z.number(),
8
8
  imagePlaceholder: z.string(),
9
+ price: z.number(),
9
10
  createdAt: z.date(),
10
11
  updatedAt: z.date(),
11
12
  });
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+
3
+ export const PresentationTitlePageSchema = z.object({
4
+ author: z.string().optional().nullable(),
5
+ createdAt: z.coerce.date().optional().nullable(),
6
+ email: z.string().email().optional().nullable(),
7
+ });
8
+
9
+ export type PresentationTitlePage = z.infer<typeof PresentationTitlePageSchema>;
@@ -1,7 +1,12 @@
1
1
  import { z } from 'zod';
2
- import { PRESENTATION_STAGE, USER_REACTION } from '../../../constants';
2
+ import {
3
+ PRESENTATION_STAGE,
4
+ PRESENTATION_TARGET_AUDIENCE,
5
+ USER_REACTION,
6
+ } from '../../../constants';
3
7
  import { SlideOutlineSchema } from './slide-outline.schema';
4
8
  import { SlideSchema } from './slide.schema';
9
+ import { PresentationTitlePageSchema } from './presentation-title-page.schema';
5
10
 
6
11
  export const PresentationSchema = z.object({
7
12
  uuid: z.string().uuid(),
@@ -17,6 +22,8 @@ export const PresentationSchema = z.object({
17
22
  slideCount: z.number(),
18
23
  lastContentUpdateAt: z.date().nullable(),
19
24
  lastPptxExportedAt: z.date().nullable(),
25
+ titlePage: PresentationTitlePageSchema.nullable(),
26
+ targetAudience: z.nativeEnum(PRESENTATION_TARGET_AUDIENCE),
20
27
  createdAt: z.date(),
21
28
  updatedAt: z.date(),
22
29
  });
@@ -19,18 +19,24 @@ import { SLIDE_CONTENT_TYPE } from '../../../constants';
19
19
  export const CoverSlideDataUserEditSchema = z.object({
20
20
  contentType: z.literal(SLIDE_CONTENT_TYPE.COVER),
21
21
  title: z.string().max(1000),
22
- author: z.object({
23
- label: z.string().max(200),
24
- value: z.string().max(500),
25
- }),
26
- date: z.object({
27
- label: z.string().max(200),
28
- value: z.string().max(500),
29
- }),
30
- email: z.object({
31
- label: z.string().max(200),
32
- value: z.string().max(500),
33
- }),
22
+ author: z
23
+ .object({
24
+ label: z.string().min(1).max(100),
25
+ value: z.string().min(1).max(200),
26
+ })
27
+ .optional(),
28
+ date: z
29
+ .object({
30
+ label: z.string().min(1).max(100),
31
+ value: z.string().min(1).max(200),
32
+ })
33
+ .optional(),
34
+ email: z
35
+ .object({
36
+ label: z.string().min(1).max(100),
37
+ value: z.string().min(1).max(200),
38
+ })
39
+ .optional(),
34
40
  version: z.literal(1),
35
41
  }) satisfies z.ZodType<ICoverSlideDataStructure>;
36
42
 
@@ -26,9 +26,9 @@ export type IconSlot = z.infer<typeof IconSlotSchema>;
26
26
  export interface ICoverSlideDataStructure {
27
27
  contentType: SLIDE_CONTENT_TYPE.COVER;
28
28
  title: string;
29
- author: { label: string; value: string };
30
- date: { label: string; value: string };
31
- email: { label: string; value: string };
29
+ author?: { label: string; value: string };
30
+ date?: { label: string; value: string };
31
+ email?: { label: string; value: string };
32
32
  version: 1;
33
33
  }
34
34
 
@@ -125,24 +125,28 @@ export interface ITimelineSlideDataStructure {
125
125
  export const CoverSlideDataSchema = z.object({
126
126
  contentType: z.literal(SLIDE_CONTENT_TYPE.COVER),
127
127
  title: z.string().describe('Slide title in about 6 words').min(10).max(150),
128
- author: z.object({
129
- label: z.string().describe('Literal "Author" in presentation\'s language'),
130
- value: z
131
- .string()
132
- .describe('Literal "Author of the presentation" in presentation\'s language'),
133
- }),
134
- date: z.object({
135
- label: z.string().describe('Literal "Date" in presentation\'s language'),
136
- value: z
137
- .string()
138
- .describe(
139
- 'Date of the presentation in the "dd month yyyy" format in presentation\'s locale',
140
- ),
141
- }),
142
- email: z.object({
143
- label: z.string().describe('Just default word "Email"'),
144
- value: z.string().describe('Just default "email@example.com"'),
145
- }),
128
+ author: z
129
+ .object({
130
+ label: z.string().describe('Literal "Author" in presentation\'s language'),
131
+ value: z.string().describe('Author value from titlePage if provided'),
132
+ })
133
+ .optional(),
134
+ date: z
135
+ .object({
136
+ label: z.string().describe('Literal "Date" in presentation\'s language'),
137
+ value: z
138
+ .string()
139
+ .describe(
140
+ 'Date from titlePage in the "dd month yyyy" format in presentation\'s locale',
141
+ ),
142
+ })
143
+ .optional(),
144
+ email: z
145
+ .object({
146
+ label: z.string().describe('Localized contact/email label'),
147
+ value: z.string().describe('Email value from titlePage if provided'),
148
+ })
149
+ .optional(),
146
150
  version: z.literal(1),
147
151
  }) satisfies z.ZodType<ICoverSlideDataStructure>;
148
152
  export type CoverSlideData = z.infer<typeof CoverSlideDataSchema>;