@purpleschool/gptbot-tools 0.0.64 → 0.0.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/common/errors/errors.js +10 -89
- package/build/image-editor/routes/image-editor.http.routes.js +1 -1
- package/build/music/enums/music-strategy.enum.js +1 -0
- package/build/music/routes/index.js +1 -0
- package/build/music/routes/music.http.routes.js +7 -0
- package/build/presentation/commands/index.js +0 -7
- package/build/presentation/enums/index.js +0 -4
- package/build/presentation/index.js +0 -1
- package/build/presentation/models/index.js +0 -1
- package/build/presentation/models/presentation-config.schema.js +0 -3
- package/build/presentation/models/presentation.schema.js +1 -4
- package/build/presentation/models/slide-content.schema.js +1 -5
- package/build/presentation/models/slide.schema.js +1 -39
- package/build/presentation/routes/presentation.routes.js +0 -7
- package/build/tools/enums/tool-type.enum.js +0 -1
- package/common/errors/errors.ts +10 -89
- package/image-editor/routes/image-editor.http.routes.ts +1 -1
- package/music/enums/music-strategy.enum.ts +1 -0
- package/music/routes/index.ts +1 -0
- package/music/routes/music.http.routes.ts +5 -0
- package/package.json +1 -1
- package/presentation/commands/index.ts +0 -7
- package/presentation/enums/index.ts +0 -4
- package/presentation/index.ts +0 -1
- package/presentation/models/index.ts +0 -1
- package/presentation/models/presentation-config.schema.ts +0 -3
- package/presentation/models/presentation.schema.ts +1 -4
- package/presentation/models/slide-content.schema.ts +11 -104
- package/presentation/models/slide-image-slot.schema.ts +0 -1
- package/presentation/models/slide.schema.ts +0 -47
- package/presentation/routes/presentation.routes.ts +0 -7
- package/tools/enums/tool-type.enum.ts +0 -1
- package/build/presentation/commands/build-blank-slide.command.js +0 -15
- package/build/presentation/commands/generate-and-insert-slide.command.js +0 -22
- package/build/presentation/commands/presentation-generate-report.command.js +0 -18
- package/build/presentation/commands/presentation-paraphrase.command.js +0 -19
- package/build/presentation/commands/update-presentation-slides.command.js +0 -16
- package/build/presentation/commands/update-slide-image-slot.command.js +0 -34
- package/build/presentation/commands/update-slide.command.js +0 -17
- package/build/presentation/enums/presentation-ai-action-call-status.enum.js +0 -9
- package/build/presentation/enums/presentation-ai-action-pricing-type.enum.js +0 -8
- package/build/presentation/enums/presentation-ai-action-type.enum.js +0 -8
- package/build/presentation/enums/slide-image-slot-action.enum.js +0 -8
- package/build/presentation/models/presentation-ai-action.schema.js +0 -27
- package/build/presentation/models/slide-content-edit.schema.js +0 -135
- package/build/presentation/utils/calculate-presentation-ai-action-price.util.js +0 -16
- package/build/presentation/utils/index.js +0 -17
- package/presentation/commands/build-blank-slide.command.ts +0 -15
- package/presentation/commands/generate-and-insert-slide.command.ts +0 -22
- package/presentation/commands/presentation-generate-report.command.ts +0 -20
- package/presentation/commands/presentation-paraphrase.command.ts +0 -21
- package/presentation/commands/update-presentation-slides.command.ts +0 -16
- package/presentation/commands/update-slide-image-slot.command.ts +0 -39
- package/presentation/commands/update-slide.command.ts +0 -17
- package/presentation/enums/presentation-ai-action-call-status.enum.ts +0 -5
- package/presentation/enums/presentation-ai-action-pricing-type.enum.ts +0 -4
- package/presentation/enums/presentation-ai-action-type.enum.ts +0 -4
- package/presentation/enums/slide-image-slot-action.enum.ts +0 -4
- package/presentation/models/presentation-ai-action.schema.ts +0 -30
- package/presentation/models/slide-content-edit.schema.ts +0 -160
- package/presentation/utils/calculate-presentation-ai-action-price.util.ts +0 -20
- package/presentation/utils/index.ts +0 -1
|
@@ -1,17 +0,0 @@
|
|
|
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("./calculate-presentation-ai-action-price.util"), exports);
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ICommandResponseSchema } from '../../common';
|
|
2
|
-
import { SLIDE_CONTENT_TYPE, SLIDE_LAYOUT } from '../enums';
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
import { SlideSchema } from '../models';
|
|
5
|
-
|
|
6
|
-
export namespace BuildBlankSlideCommand {
|
|
7
|
-
export const RequestSchema = z.object({
|
|
8
|
-
slideContentType: z.nativeEnum(SLIDE_CONTENT_TYPE),
|
|
9
|
-
layoutId: z.nativeEnum(SLIDE_LAYOUT).optional(),
|
|
10
|
-
});
|
|
11
|
-
export type Request = z.infer<typeof RequestSchema>;
|
|
12
|
-
|
|
13
|
-
export const ResponseSchema = ICommandResponseSchema(SlideSchema);
|
|
14
|
-
export type Response = z.infer<typeof ResponseSchema>;
|
|
15
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { ICommandResponseSchema } from '../../common';
|
|
3
|
-
import { SLIDE_CONTENT_TYPE, SLIDE_LAYOUT } from '../enums';
|
|
4
|
-
import { SlideSchema } from '../models';
|
|
5
|
-
|
|
6
|
-
export namespace GenerateAndInsertSlideCommand {
|
|
7
|
-
export const RequestSchema = z.object({
|
|
8
|
-
userId: z.string().uuid().nullable().optional(),
|
|
9
|
-
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
10
|
-
userBalance: z.number(),
|
|
11
|
-
presentationId: z.string().uuid(),
|
|
12
|
-
contentTypeId: z.nativeEnum(SLIDE_CONTENT_TYPE),
|
|
13
|
-
prompt: z.string().min(1).max(1000).optional(),
|
|
14
|
-
title: z.string().max(80),
|
|
15
|
-
position: z.number().int().min(0),
|
|
16
|
-
layoutId: z.nativeEnum(SLIDE_LAYOUT).optional(),
|
|
17
|
-
});
|
|
18
|
-
export type Request = z.infer<typeof RequestSchema>;
|
|
19
|
-
|
|
20
|
-
export const ResponseSchema = ICommandResponseSchema(SlideSchema.array());
|
|
21
|
-
export type Response = z.infer<typeof ResponseSchema>;
|
|
22
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { ICommandResponseSchema } from '../../common';
|
|
3
|
-
|
|
4
|
-
export namespace PresentationGenerateReportCommand {
|
|
5
|
-
export const RequestSchema = z.object({
|
|
6
|
-
userId: z.string().uuid().nullable().optional(),
|
|
7
|
-
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
8
|
-
presentationId: z.string().uuid(),
|
|
9
|
-
userBalance: z.number(),
|
|
10
|
-
});
|
|
11
|
-
export type Request = z.infer<typeof RequestSchema>;
|
|
12
|
-
|
|
13
|
-
export const ResponseSchema = ICommandResponseSchema(
|
|
14
|
-
z.object({
|
|
15
|
-
output: z.string(),
|
|
16
|
-
docxUrl: z.string(),
|
|
17
|
-
}),
|
|
18
|
-
);
|
|
19
|
-
export type Response = z.infer<typeof ResponseSchema>;
|
|
20
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { ICommandResponseSchema } from '../../common';
|
|
3
|
-
|
|
4
|
-
export namespace PresentationParaphraseCommand {
|
|
5
|
-
export const RequestSchema = z.object({
|
|
6
|
-
userId: z.string().uuid().nullable().optional(),
|
|
7
|
-
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
8
|
-
presentationId: z.string().uuid(),
|
|
9
|
-
slideId: z.string().uuid(),
|
|
10
|
-
selectionText: z.string(),
|
|
11
|
-
userBalance: z.number(),
|
|
12
|
-
});
|
|
13
|
-
export type Request = z.infer<typeof RequestSchema>;
|
|
14
|
-
|
|
15
|
-
export const ResponseSchema = ICommandResponseSchema(
|
|
16
|
-
z.object({
|
|
17
|
-
output: z.string(),
|
|
18
|
-
}),
|
|
19
|
-
);
|
|
20
|
-
export type Response = z.infer<typeof ResponseSchema>;
|
|
21
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { SlideSchema, SlideBulkUpdateSchema } from '../models';
|
|
3
|
-
import { ICommandResponseSchema } from '../../common';
|
|
4
|
-
|
|
5
|
-
export namespace UpdatePresentationSlidesCommand {
|
|
6
|
-
export const RequestSchema = z.object({
|
|
7
|
-
userId: z.string().uuid().nullable().optional(),
|
|
8
|
-
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
9
|
-
presentationId: z.string().uuid(),
|
|
10
|
-
data: SlideBulkUpdateSchema,
|
|
11
|
-
});
|
|
12
|
-
export type Request = z.infer<typeof RequestSchema>;
|
|
13
|
-
|
|
14
|
-
export const ResponseSchema = ICommandResponseSchema(z.array(SlideSchema));
|
|
15
|
-
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { ICommandResponseSchema } from '../../common';
|
|
3
|
-
import { SlideImageSlotSchema } from '../models';
|
|
4
|
-
import { SLIDE_IMAGE_SLOT_ACTION } from '../enums';
|
|
5
|
-
|
|
6
|
-
export namespace UpdateSlideImageSlotCommand {
|
|
7
|
-
const ReplacePayload = z.object({
|
|
8
|
-
action: z.literal(SLIDE_IMAGE_SLOT_ACTION.REPLACE),
|
|
9
|
-
url: z.string().url(),
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
const GeneratePayload = z.object({
|
|
13
|
-
action: z.literal(SLIDE_IMAGE_SLOT_ACTION.GENERATE),
|
|
14
|
-
prompt: z.string().min(1).max(1000).optional(),
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const UpdateImageSlotPayload = z.discriminatedUnion('action', [
|
|
18
|
-
ReplacePayload,
|
|
19
|
-
GeneratePayload,
|
|
20
|
-
]);
|
|
21
|
-
|
|
22
|
-
export const RequestSchema = z.object({
|
|
23
|
-
userId: z.string().uuid().nullable().optional(),
|
|
24
|
-
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
25
|
-
presentationId: z.string().uuid(),
|
|
26
|
-
slideId: z.string().uuid(),
|
|
27
|
-
slotId: z.string().uuid().optional(),
|
|
28
|
-
payload: UpdateImageSlotPayload,
|
|
29
|
-
userBalance: z.number(),
|
|
30
|
-
});
|
|
31
|
-
export type Request = z.infer<typeof RequestSchema>;
|
|
32
|
-
|
|
33
|
-
export const ResponseSchema = ICommandResponseSchema(
|
|
34
|
-
z.object({
|
|
35
|
-
imageSlot: SlideImageSlotSchema,
|
|
36
|
-
}),
|
|
37
|
-
);
|
|
38
|
-
export type Response = z.infer<typeof ResponseSchema>;
|
|
39
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { SlideSchema, SlideUpdateSchema } from '../models';
|
|
3
|
-
import { ICommandResponseSchema } from '../../common';
|
|
4
|
-
|
|
5
|
-
export namespace UpdateSlideCommand {
|
|
6
|
-
export const RequestSchema = z.object({
|
|
7
|
-
userId: z.string().uuid().nullable().optional(),
|
|
8
|
-
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
9
|
-
presentationId: z.string().uuid(),
|
|
10
|
-
slideId: z.string().uuid(),
|
|
11
|
-
data: SlideUpdateSchema,
|
|
12
|
-
});
|
|
13
|
-
export type Request = z.infer<typeof RequestSchema>;
|
|
14
|
-
|
|
15
|
-
export const ResponseSchema = ICommandResponseSchema(SlideSchema);
|
|
16
|
-
export type Response = z.infer<typeof ResponseSchema>;
|
|
17
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { PRESENTATION_AI_ACTION_PRICING_TYPE, PRESENTATION_AI_ACTION_TYPE } from '../enums';
|
|
3
|
-
|
|
4
|
-
export const PresentationAiActionPricingRulesSchema = z.discriminatedUnion('type', [
|
|
5
|
-
z.object({
|
|
6
|
-
type: z.literal(PRESENTATION_AI_ACTION_PRICING_TYPE.PER_CHARACTER),
|
|
7
|
-
price: z.number(),
|
|
8
|
-
}),
|
|
9
|
-
z.object({
|
|
10
|
-
type: z.literal(PRESENTATION_AI_ACTION_PRICING_TYPE.FLAT),
|
|
11
|
-
price: z.number(),
|
|
12
|
-
}),
|
|
13
|
-
]);
|
|
14
|
-
export type PresentationAiActionPricingRules = z.infer<
|
|
15
|
-
typeof PresentationAiActionPricingRulesSchema
|
|
16
|
-
>;
|
|
17
|
-
|
|
18
|
-
export const PresentationAiActionSchema = z.object({
|
|
19
|
-
uuid: z.string(),
|
|
20
|
-
type: z.nativeEnum(PRESENTATION_AI_ACTION_TYPE),
|
|
21
|
-
pricingRules: PresentationAiActionPricingRulesSchema,
|
|
22
|
-
maxPromptLength: z.number(),
|
|
23
|
-
aiModel: z.string(),
|
|
24
|
-
title: z.string(),
|
|
25
|
-
icon: z.string(),
|
|
26
|
-
order: z.number(),
|
|
27
|
-
createdAt: z.date(),
|
|
28
|
-
updatedAt: z.date(),
|
|
29
|
-
});
|
|
30
|
-
export type PresentationAiAction = z.infer<typeof PresentationAiActionSchema>;
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import z from 'zod';
|
|
2
|
-
import { SLIDE_CONTENT_TYPE } from '../enums';
|
|
3
|
-
import {
|
|
4
|
-
ICoverSlideDataStructure,
|
|
5
|
-
IThankYouSlideDataStructure,
|
|
6
|
-
ITextSlideDataStructure,
|
|
7
|
-
IStructuredListSlideDataStructure,
|
|
8
|
-
IContentsSlideDataStructure,
|
|
9
|
-
IImageSlideDataStructure,
|
|
10
|
-
ISectionBreakSlideDataStructure,
|
|
11
|
-
ITableSlideDataStructure,
|
|
12
|
-
SLIDE_CHART_TYPE,
|
|
13
|
-
IBarChartSlideDataStructure,
|
|
14
|
-
IChartSlideDataStructure,
|
|
15
|
-
ImageSlotSchema,
|
|
16
|
-
} from './slide-content.schema';
|
|
17
|
-
|
|
18
|
-
export const CoverSlideDataUserEditSchema = z.object({
|
|
19
|
-
contentType: z.literal(SLIDE_CONTENT_TYPE.COVER),
|
|
20
|
-
title: z.string().min(1).max(500),
|
|
21
|
-
author: z.object({
|
|
22
|
-
label: z.string().min(1).max(100),
|
|
23
|
-
value: z.string().min(1).max(200),
|
|
24
|
-
}),
|
|
25
|
-
date: z.object({
|
|
26
|
-
label: z.string().min(1).max(100),
|
|
27
|
-
value: z.string().min(1).max(200),
|
|
28
|
-
}),
|
|
29
|
-
email: z.object({
|
|
30
|
-
label: z.string().min(1).max(100),
|
|
31
|
-
value: z.string().min(1).max(200),
|
|
32
|
-
}),
|
|
33
|
-
version: z.literal(1),
|
|
34
|
-
}) satisfies z.ZodType<ICoverSlideDataStructure>;
|
|
35
|
-
|
|
36
|
-
export const ThankYouSlideDataUserEditSchema = z.object({
|
|
37
|
-
contentType: z.literal(SLIDE_CONTENT_TYPE.THANK_YOU),
|
|
38
|
-
title: z.string().min(1).max(500),
|
|
39
|
-
author: z.object({
|
|
40
|
-
label: z.string().min(1).max(100),
|
|
41
|
-
value: z.string().min(1).max(200),
|
|
42
|
-
}),
|
|
43
|
-
date: z.object({
|
|
44
|
-
label: z.string().min(1).max(100),
|
|
45
|
-
value: z.string().min(1).max(200),
|
|
46
|
-
}),
|
|
47
|
-
email: z.object({
|
|
48
|
-
label: z.string().min(1).max(100),
|
|
49
|
-
value: z.string().min(1).max(200),
|
|
50
|
-
}),
|
|
51
|
-
version: z.literal(1),
|
|
52
|
-
}) satisfies z.ZodType<IThankYouSlideDataStructure>;
|
|
53
|
-
|
|
54
|
-
export const TextSlideDataUserEditSchema = z.object({
|
|
55
|
-
contentType: z.literal(SLIDE_CONTENT_TYPE.TEXT),
|
|
56
|
-
title: z.string().min(1).max(500),
|
|
57
|
-
description: z.string().min(1).max(3000),
|
|
58
|
-
version: z.literal(1),
|
|
59
|
-
}) satisfies z.ZodType<ITextSlideDataStructure>;
|
|
60
|
-
|
|
61
|
-
export const StructuredListSlideDataUserEditSchema = z.object({
|
|
62
|
-
contentType: z.literal(SLIDE_CONTENT_TYPE.STRUCTURED_LIST),
|
|
63
|
-
title: z.string().min(1).max(500),
|
|
64
|
-
description: z.string().min(1).max(1000),
|
|
65
|
-
list: z
|
|
66
|
-
.array(
|
|
67
|
-
z.object({
|
|
68
|
-
title: z.string().min(1).max(200),
|
|
69
|
-
description: z.string().min(1).max(500),
|
|
70
|
-
}),
|
|
71
|
-
)
|
|
72
|
-
.min(1)
|
|
73
|
-
.max(10),
|
|
74
|
-
version: z.literal(1),
|
|
75
|
-
}) satisfies z.ZodType<IStructuredListSlideDataStructure>;
|
|
76
|
-
|
|
77
|
-
export const ContentsSlideDataUserEditSchema = z.object({
|
|
78
|
-
contentType: z.literal(SLIDE_CONTENT_TYPE.CONTENTS),
|
|
79
|
-
title: z.string().min(1).max(500),
|
|
80
|
-
items: z
|
|
81
|
-
.array(
|
|
82
|
-
z.object({
|
|
83
|
-
pageNumber: z.number(),
|
|
84
|
-
title: z.string().min(1).max(500),
|
|
85
|
-
}),
|
|
86
|
-
)
|
|
87
|
-
.min(1)
|
|
88
|
-
.max(50),
|
|
89
|
-
version: z.literal(1),
|
|
90
|
-
}) satisfies z.ZodType<IContentsSlideDataStructure>;
|
|
91
|
-
|
|
92
|
-
export const ImageSlideDataUserEditSchema = z.object({
|
|
93
|
-
contentType: z.literal(SLIDE_CONTENT_TYPE.TEXT_WITH_IMAGE),
|
|
94
|
-
title: z.string().min(1).max(500),
|
|
95
|
-
description: z.string().min(1).max(2000),
|
|
96
|
-
imageSlot: ImageSlotSchema,
|
|
97
|
-
version: z.literal(1),
|
|
98
|
-
}) satisfies z.ZodType<IImageSlideDataStructure>;
|
|
99
|
-
|
|
100
|
-
export const SectionBreakSlideDataUserEditSchema = z.object({
|
|
101
|
-
contentType: z.literal(SLIDE_CONTENT_TYPE.SECTION_BREAK),
|
|
102
|
-
title: z.string().min(1).max(500),
|
|
103
|
-
description: z.string().min(1).max(500),
|
|
104
|
-
version: z.literal(1),
|
|
105
|
-
}) satisfies z.ZodType<ISectionBreakSlideDataStructure>;
|
|
106
|
-
|
|
107
|
-
export const TableSlideDataUserEditSchema = z.object({
|
|
108
|
-
contentType: z.literal(SLIDE_CONTENT_TYPE.TABLE),
|
|
109
|
-
title: z.string().min(1).max(500),
|
|
110
|
-
description: z.string().min(1).max(1000),
|
|
111
|
-
table: z.object({
|
|
112
|
-
columnHeaders: z.array(z.string().min(1).max(200)).min(1).max(20),
|
|
113
|
-
rows: z
|
|
114
|
-
.array(z.array(z.string().min(1).max(500)))
|
|
115
|
-
.min(1)
|
|
116
|
-
.max(20),
|
|
117
|
-
hasRowHeaders: z.boolean(),
|
|
118
|
-
hasSummaryRow: z.boolean(),
|
|
119
|
-
}),
|
|
120
|
-
version: z.literal(1),
|
|
121
|
-
}) satisfies z.ZodType<ITableSlideDataStructure>;
|
|
122
|
-
|
|
123
|
-
export const BarChartSlideDataUserEditSchema = z.object({
|
|
124
|
-
type: z.literal(SLIDE_CHART_TYPE.BAR),
|
|
125
|
-
categories: z.array(z.string().min(1).max(200)).min(1).max(50),
|
|
126
|
-
series: z
|
|
127
|
-
.array(
|
|
128
|
-
z.object({
|
|
129
|
-
name: z.string().min(1).max(200),
|
|
130
|
-
data: z.array(z.number()),
|
|
131
|
-
type: z.number().min(0).max(11),
|
|
132
|
-
}),
|
|
133
|
-
)
|
|
134
|
-
.min(1)
|
|
135
|
-
.max(5),
|
|
136
|
-
yAxisLabel: z.string().max(200).optional(),
|
|
137
|
-
unit: z.string().max(50).optional(),
|
|
138
|
-
version: z.literal(1),
|
|
139
|
-
}) satisfies z.ZodType<IBarChartSlideDataStructure>;
|
|
140
|
-
|
|
141
|
-
export const ChartSlideDataUserEditSchema = z.object({
|
|
142
|
-
contentType: z.literal(SLIDE_CONTENT_TYPE.CHART),
|
|
143
|
-
title: z.string().min(1).max(500),
|
|
144
|
-
description: z.string().min(1).max(2000),
|
|
145
|
-
chart: z.discriminatedUnion('type', [BarChartSlideDataUserEditSchema]),
|
|
146
|
-
version: z.literal(1),
|
|
147
|
-
}) satisfies z.ZodType<IChartSlideDataStructure>;
|
|
148
|
-
|
|
149
|
-
export const SlideContentUserEditSchema = z.discriminatedUnion('contentType', [
|
|
150
|
-
CoverSlideDataUserEditSchema,
|
|
151
|
-
StructuredListSlideDataUserEditSchema,
|
|
152
|
-
TextSlideDataUserEditSchema,
|
|
153
|
-
ContentsSlideDataUserEditSchema,
|
|
154
|
-
SectionBreakSlideDataUserEditSchema,
|
|
155
|
-
ImageSlideDataUserEditSchema,
|
|
156
|
-
ThankYouSlideDataUserEditSchema,
|
|
157
|
-
TableSlideDataUserEditSchema,
|
|
158
|
-
ChartSlideDataUserEditSchema,
|
|
159
|
-
]);
|
|
160
|
-
export type SlideContentUserEdit = z.infer<typeof SlideContentUserEditSchema>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { PRESENTATION_AI_ACTION_PRICING_TYPE } from '../enums';
|
|
2
|
-
import { PresentationAiActionPricingRules } from '../models';
|
|
3
|
-
|
|
4
|
-
export function calculatePresentationAiActionPrice(
|
|
5
|
-
pricingRules: PresentationAiActionPricingRules,
|
|
6
|
-
selectionText: string,
|
|
7
|
-
): number {
|
|
8
|
-
switch (pricingRules.type) {
|
|
9
|
-
case PRESENTATION_AI_ACTION_PRICING_TYPE.PER_CHARACTER:
|
|
10
|
-
const characterCount = selectionText.length;
|
|
11
|
-
const price = characterCount * pricingRules.price;
|
|
12
|
-
return Math.max(1, Math.ceil(price));
|
|
13
|
-
|
|
14
|
-
case PRESENTATION_AI_ACTION_PRICING_TYPE.FLAT:
|
|
15
|
-
return Math.max(1, Math.ceil(pricingRules.price));
|
|
16
|
-
|
|
17
|
-
default:
|
|
18
|
-
throw new Error(`Unknown pricing type`);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './calculate-presentation-ai-action-price.util';
|