@escapenavigator/types 1.10.141 → 1.10.143

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 (30) hide show
  1. package/dist/email-builder/index.js +1 -1
  2. package/dist/profile/cross-sale/cross-sale-status.enum.d.ts +6 -0
  3. package/dist/profile/cross-sale/cross-sale-status.enum.js +6 -0
  4. package/dist/profile/cross-sale/crossale-discount-type.enum.d.ts +6 -0
  5. package/dist/profile/cross-sale/crossale-discount-type.enum.js +6 -0
  6. package/dist/profile/marketing-automation/marketing-automation-capabilities.d.ts +18 -0
  7. package/dist/profile/marketing-automation/marketing-automation-capabilities.js +41 -0
  8. package/dist/profile/marketing-automation/marketing-automation-config.dto.d.ts +26 -0
  9. package/dist/profile/marketing-automation/marketing-automation-config.dto.js +41 -0
  10. package/dist/profile/marketing-automation/marketing-automation-default-template.dto.d.ts +18 -0
  11. package/dist/profile/marketing-automation/marketing-automation-default-template.dto.js +45 -0
  12. package/dist/profile/marketing-automation/marketing-automation-discount-type.enum.d.ts +5 -0
  13. package/dist/profile/marketing-automation/marketing-automation-discount-type.enum.js +9 -0
  14. package/dist/profile/marketing-automation/marketing-automation-status.enum.d.ts +5 -0
  15. package/dist/profile/marketing-automation/marketing-automation-status.enum.js +9 -0
  16. package/dist/profile/marketing-automation/marketing-automation-timing.d.ts +30 -0
  17. package/dist/profile/marketing-automation/marketing-automation-timing.js +40 -0
  18. package/dist/profile/marketing-automation/marketing-automation-type.enum.d.ts +22 -0
  19. package/dist/profile/marketing-automation/marketing-automation-type.enum.js +26 -0
  20. package/dist/profile/marketing-automation/marketing-automation.dto.d.ts +36 -0
  21. package/dist/profile/marketing-automation/marketing-automation.dto.js +117 -0
  22. package/dist/profile/marketing-automation/marketing-automation.ro.d.ts +25 -0
  23. package/dist/profile/marketing-automation/marketing-automation.ro.js +84 -0
  24. package/dist/profile/marketing-email/test-send-email-v2.dto.d.ts +56 -0
  25. package/dist/profile/marketing-email/test-send-email-v2.dto.js +85 -0
  26. package/dist/questroom/create-questroom.dto.js +1 -0
  27. package/dist/shared/export-limits.d.ts +18 -0
  28. package/dist/shared/export-limits.js +19 -1
  29. package/dist/tsconfig.build.tsbuildinfo +1 -1
  30. package/package.json +2 -2
@@ -250,7 +250,7 @@ const createDefaultEmailContent = (options = {}) => {
250
250
  }, {
251
251
  type: 'button',
252
252
  attrs: {
253
- text: 'Перейти к редактору →',
253
+ text: 'Пример кнопки →',
254
254
  url: '',
255
255
  alignment: 'left',
256
256
  variant: 'filled',
@@ -1,3 +1,9 @@
1
+ /**
2
+ * @deprecated Используйте `MarketingAutomationStatusEnum` из
3
+ * `profile/marketing-automation/marketing-automation-status.enum`.
4
+ * Значения совпадают 1-в-1; этот enum будет удалён после backfill'а
5
+ * старых таблиц в единый `marketing-automation`.
6
+ */
1
7
  export declare enum CrossSaleStatusEnum {
2
8
  NONE = "none",
3
9
  ENABLED = "enabled",
@@ -1,6 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CrossSaleStatusEnum = void 0;
4
+ /**
5
+ * @deprecated Используйте `MarketingAutomationStatusEnum` из
6
+ * `profile/marketing-automation/marketing-automation-status.enum`.
7
+ * Значения совпадают 1-в-1; этот enum будет удалён после backfill'а
8
+ * старых таблиц в единый `marketing-automation`.
9
+ */
4
10
  var CrossSaleStatusEnum;
5
11
  (function (CrossSaleStatusEnum) {
6
12
  CrossSaleStatusEnum["NONE"] = "none";
@@ -1,3 +1,9 @@
1
+ /**
2
+ * @deprecated Используйте `MarketingAutomationDiscountTypeEnum` из
3
+ * `profile/marketing-automation/marketing-automation-discount-type.enum`.
4
+ * Значения совпадают 1-в-1; этот enum будет удалён после backfill'а
5
+ * старых таблиц в единый `marketing-automation`.
6
+ */
1
7
  export declare enum CrossSaleDiscountTypeEnum {
2
8
  FIXED = "fixed",
3
9
  PERCENT = "percent",
@@ -1,6 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CrossSaleDiscountTypeEnum = void 0;
4
+ /**
5
+ * @deprecated Используйте `MarketingAutomationDiscountTypeEnum` из
6
+ * `profile/marketing-automation/marketing-automation-discount-type.enum`.
7
+ * Значения совпадают 1-в-1; этот enum будет удалён после backfill'а
8
+ * старых таблиц в единый `marketing-automation`.
9
+ */
4
10
  var CrossSaleDiscountTypeEnum;
5
11
  (function (CrossSaleDiscountTypeEnum) {
6
12
  CrossSaleDiscountTypeEnum["FIXED"] = "fixed";
@@ -0,0 +1,18 @@
1
+ import { MarketingAutomationTypeEnum } from './marketing-automation-type.enum';
2
+ export type MarketingAutomationTimingDirection = 'before' | 'after';
3
+ export type MarketingAutomationTimingUnit = 'hours' | 'days';
4
+ export type MarketingAutomationTiming = {
5
+ direction: MarketingAutomationTimingDirection;
6
+ unit: MarketingAutomationTimingUnit;
7
+ min: number;
8
+ max: number;
9
+ default: number;
10
+ };
11
+ export type MarketingAutomationCapability = {
12
+ timing: MarketingAutomationTiming | null;
13
+ /** Показывать ли тумблер «отправить сразу» (`config.sendImmediately`). */
14
+ supportsSendImmediately: boolean;
15
+ /** Есть ли у типа блок промокода (discount / discountType / validity). */
16
+ supportsDiscount: boolean;
17
+ };
18
+ export declare const MARKETING_AUTOMATION_CAPABILITIES: Record<MarketingAutomationTypeEnum, MarketingAutomationCapability>;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MARKETING_AUTOMATION_CAPABILITIES = void 0;
4
+ const marketing_automation_type_enum_1 = require("./marketing-automation-type.enum");
5
+ exports.MARKETING_AUTOMATION_CAPABILITIES = {
6
+ [marketing_automation_type_enum_1.MarketingAutomationTypeEnum.CROSS_SALE]: {
7
+ timing: { direction: 'after', unit: 'hours', min: 1, max: 24, default: 24 },
8
+ supportsSendImmediately: false,
9
+ supportsDiscount: true,
10
+ },
11
+ [marketing_automation_type_enum_1.MarketingAutomationTypeEnum.UP_SALE]: {
12
+ timing: { direction: 'before', unit: 'hours', min: 1, max: 72, default: 2 },
13
+ supportsSendImmediately: true,
14
+ supportsDiscount: false,
15
+ },
16
+ [marketing_automation_type_enum_1.MarketingAutomationTypeEnum.EARLY_BOOKING]: {
17
+ timing: { direction: 'before', unit: 'days', min: 2, max: 7, default: 3 },
18
+ supportsSendImmediately: false,
19
+ supportsDiscount: false,
20
+ },
21
+ [marketing_automation_type_enum_1.MarketingAutomationTypeEnum.RETARGETING]: {
22
+ timing: null,
23
+ supportsSendImmediately: false,
24
+ supportsDiscount: true,
25
+ },
26
+ [marketing_automation_type_enum_1.MarketingAutomationTypeEnum.BIRTHDAY_ADULT]: {
27
+ timing: { direction: 'before', unit: 'days', min: 2, max: 7, default: 3 },
28
+ supportsSendImmediately: false,
29
+ supportsDiscount: true,
30
+ },
31
+ [marketing_automation_type_enum_1.MarketingAutomationTypeEnum.BIRTHDAY_CHILD]: {
32
+ timing: { direction: 'before', unit: 'days', min: 2, max: 7, default: 3 },
33
+ supportsSendImmediately: false,
34
+ supportsDiscount: true,
35
+ },
36
+ [marketing_automation_type_enum_1.MarketingAutomationTypeEnum.CUSTOM_BOOKING]: {
37
+ timing: null,
38
+ supportsSendImmediately: false,
39
+ supportsDiscount: false,
40
+ },
41
+ };
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Type-variant конфигурация автоматизации (то, чем типы реально
3
+ * отличаются друг от друга). Хранится как `jsonb` — точка расширения:
4
+ * новый тип может добавить свои ключи без ALTER TABLE.
5
+ *
6
+ * Здесь умышленно НЕТ направления (до/после события) и единицы
7
+ * (часы/дни) для `sendOffset` — это свойство ТИПА, а не записи, и
8
+ * живёт в `MARKETING_AUTOMATION_CAPABILITIES`. Границы значения
9
+ * (min/max) валидируются динамически по типу там же, поэтому тут
10
+ * достаточно базовой проверки «положительное целое».
11
+ */
12
+ export declare class MarketingAutomationConfigDto {
13
+ /**
14
+ * Единое поле тайминга: заменяет `sendAfter` / `sendBefore` /
15
+ * `sendBeforeDays`. Величина в натуральной единице типа (capabilities
16
+ * определяет, часы это или дни и в какую сторону от события).
17
+ * `undefined` — у типов без настраиваемого тайминга
18
+ * (`retargeting` — фикс +1 день, `custom_booking` — транзакционно).
19
+ */
20
+ sendOffset?: number;
21
+ /**
22
+ * Отправить сразу, если расчётный момент уже в прошлом. Осмысленно
23
+ * только для типов с `supportsSendImmediately` (сейчас `up_sale`).
24
+ */
25
+ sendImmediately?: boolean;
26
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.MarketingAutomationConfigDto = void 0;
13
+ const class_transformer_1 = require("class-transformer");
14
+ const class_validator_1 = require("class-validator");
15
+ /**
16
+ * Type-variant конфигурация автоматизации (то, чем типы реально
17
+ * отличаются друг от друга). Хранится как `jsonb` — точка расширения:
18
+ * новый тип может добавить свои ключи без ALTER TABLE.
19
+ *
20
+ * Здесь умышленно НЕТ направления (до/после события) и единицы
21
+ * (часы/дни) для `sendOffset` — это свойство ТИПА, а не записи, и
22
+ * живёт в `MARKETING_AUTOMATION_CAPABILITIES`. Границы значения
23
+ * (min/max) валидируются динамически по типу там же, поэтому тут
24
+ * достаточно базовой проверки «положительное целое».
25
+ */
26
+ class MarketingAutomationConfigDto {
27
+ }
28
+ exports.MarketingAutomationConfigDto = MarketingAutomationConfigDto;
29
+ __decorate([
30
+ (0, class_validator_1.IsOptional)(),
31
+ (0, class_validator_1.IsInt)(),
32
+ (0, class_validator_1.IsPositive)(),
33
+ (0, class_transformer_1.Expose)(),
34
+ __metadata("design:type", Number)
35
+ ], MarketingAutomationConfigDto.prototype, "sendOffset", void 0);
36
+ __decorate([
37
+ (0, class_validator_1.IsOptional)(),
38
+ (0, class_validator_1.IsBoolean)(),
39
+ (0, class_transformer_1.Expose)(),
40
+ __metadata("design:type", Boolean)
41
+ ], MarketingAutomationConfigDto.prototype, "sendImmediately", void 0);
@@ -0,0 +1,18 @@
1
+ import { Languages } from '../../shared/enum/languages.enum';
2
+ /**
3
+ * Запрос генерации дефолтного v2-шаблона письма на бэке (эндпоинт
4
+ * `POST /marketing-automation/:type/default-template`). `type` идёт
5
+ * path-параметром, тут — данные профиля для подстановки в шаблон.
6
+ *
7
+ * Профиль (название/логотип/языки) приходит с фронта
8
+ * (`useCurrentUser().profile`), потому что в `request.user` полного
9
+ * профиля нет — только `profileId`.
10
+ */
11
+ export declare class MarketingAutomationDefaultTemplateDto {
12
+ /** Языки, под которые нужно собрать локали (profile.availableLanguages). */
13
+ languages: Languages[];
14
+ /** Название компании — подставляется в шаблон (подпись и т.п.). */
15
+ companyTitle: string;
16
+ /** URL логотипа — первая нода документа (опционально). */
17
+ logo?: string;
18
+ }
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.MarketingAutomationDefaultTemplateDto = void 0;
13
+ const class_transformer_1 = require("class-transformer");
14
+ const class_validator_1 = require("class-validator");
15
+ const languages_enum_1 = require("../../shared/enum/languages.enum");
16
+ /**
17
+ * Запрос генерации дефолтного v2-шаблона письма на бэке (эндпоинт
18
+ * `POST /marketing-automation/:type/default-template`). `type` идёт
19
+ * path-параметром, тут — данные профиля для подстановки в шаблон.
20
+ *
21
+ * Профиль (название/логотип/языки) приходит с фронта
22
+ * (`useCurrentUser().profile`), потому что в `request.user` полного
23
+ * профиля нет — только `profileId`.
24
+ */
25
+ class MarketingAutomationDefaultTemplateDto {
26
+ }
27
+ exports.MarketingAutomationDefaultTemplateDto = MarketingAutomationDefaultTemplateDto;
28
+ __decorate([
29
+ (0, class_validator_1.IsArray)(),
30
+ (0, class_validator_1.ArrayNotEmpty)(),
31
+ (0, class_validator_1.IsEnum)(languages_enum_1.Languages, { each: true }),
32
+ (0, class_transformer_1.Expose)(),
33
+ __metadata("design:type", Array)
34
+ ], MarketingAutomationDefaultTemplateDto.prototype, "languages", void 0);
35
+ __decorate([
36
+ (0, class_validator_1.IsString)(),
37
+ (0, class_transformer_1.Expose)(),
38
+ __metadata("design:type", String)
39
+ ], MarketingAutomationDefaultTemplateDto.prototype, "companyTitle", void 0);
40
+ __decorate([
41
+ (0, class_validator_1.IsOptional)(),
42
+ (0, class_validator_1.IsString)(),
43
+ (0, class_transformer_1.Expose)(),
44
+ __metadata("design:type", String)
45
+ ], MarketingAutomationDefaultTemplateDto.prototype, "logo", void 0);
@@ -0,0 +1,5 @@
1
+ export declare enum MarketingAutomationDiscountTypeEnum {
2
+ FIXED = "fixed",
3
+ PERCENT = "percent",
4
+ NONE = "none"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MarketingAutomationDiscountTypeEnum = void 0;
4
+ var MarketingAutomationDiscountTypeEnum;
5
+ (function (MarketingAutomationDiscountTypeEnum) {
6
+ MarketingAutomationDiscountTypeEnum["FIXED"] = "fixed";
7
+ MarketingAutomationDiscountTypeEnum["PERCENT"] = "percent";
8
+ MarketingAutomationDiscountTypeEnum["NONE"] = "none";
9
+ })(MarketingAutomationDiscountTypeEnum || (exports.MarketingAutomationDiscountTypeEnum = MarketingAutomationDiscountTypeEnum = {}));
@@ -0,0 +1,5 @@
1
+ export declare enum MarketingAutomationStatusEnum {
2
+ NONE = "none",
3
+ ENABLED = "enabled",
4
+ DISABLED = "disabled"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MarketingAutomationStatusEnum = void 0;
4
+ var MarketingAutomationStatusEnum;
5
+ (function (MarketingAutomationStatusEnum) {
6
+ MarketingAutomationStatusEnum["NONE"] = "none";
7
+ MarketingAutomationStatusEnum["ENABLED"] = "enabled";
8
+ MarketingAutomationStatusEnum["DISABLED"] = "disabled";
9
+ })(MarketingAutomationStatusEnum || (exports.MarketingAutomationStatusEnum = MarketingAutomationStatusEnum = {}));
@@ -0,0 +1,30 @@
1
+ import { MarketingAutomationTiming } from './marketing-automation-capabilities';
2
+ /**
3
+ * Единый источник правды для расчёта тайминга автоматизаций.
4
+ *
5
+ * Величина смещения хранится в `config.sendOffset` (всегда положительное
6
+ * число), а направление (`before`/`after`) и единица (`hours`/`days`)
7
+ * задаются типом письма через `MARKETING_AUTOMATION_CAPABILITIES`. Функция
8
+ * сводит их к знаковому смещению В ЧАСАХ относительно опорного события
9
+ * (для order-linked — `order.utcDate`, т.е. дата игры):
10
+ *
11
+ * - `after` → положительные часы (письмо ПОСЛЕ события);
12
+ * - `before` → отрицательные часы (письмо ДО события);
13
+ * - `days` → величина умножается на 24.
14
+ *
15
+ * Эквивалентно прежней легаси-карте `CrossSaleMainService.getHours`:
16
+ * crossSale = `+sendAfter`, upSale = `-sendBefore`,
17
+ * earlyBooking = `-sendBefore*24`.
18
+ *
19
+ * Используется и на бэкенде (вычисление `sendAt` планировщиком), и на
20
+ * фронте (превью «письмо уйдёт через …»), чтобы логика не разъезжалась.
21
+ */
22
+ export declare function resolveSendOffsetHours(timing: MarketingAutomationTiming, sendOffset: number): number;
23
+ /**
24
+ * Defensive-кламп величины смещения в допустимый диапазон типа
25
+ * (`[min, max]` из capabilities). Нечисловое/пустое значение → `default`.
26
+ * Нужен на чтении из БД: до backfill'а (Фаза 6) `config.sendOffset` у
27
+ * мигрированных строк может быть не заполнен, а у руками-созданных —
28
+ * выходить за границы из-за рассинхрона со старым UI.
29
+ */
30
+ export declare function clampSendOffset(timing: MarketingAutomationTiming, value?: number): number;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveSendOffsetHours = resolveSendOffsetHours;
4
+ exports.clampSendOffset = clampSendOffset;
5
+ /**
6
+ * Единый источник правды для расчёта тайминга автоматизаций.
7
+ *
8
+ * Величина смещения хранится в `config.sendOffset` (всегда положительное
9
+ * число), а направление (`before`/`after`) и единица (`hours`/`days`)
10
+ * задаются типом письма через `MARKETING_AUTOMATION_CAPABILITIES`. Функция
11
+ * сводит их к знаковому смещению В ЧАСАХ относительно опорного события
12
+ * (для order-linked — `order.utcDate`, т.е. дата игры):
13
+ *
14
+ * - `after` → положительные часы (письмо ПОСЛЕ события);
15
+ * - `before` → отрицательные часы (письмо ДО события);
16
+ * - `days` → величина умножается на 24.
17
+ *
18
+ * Эквивалентно прежней легаси-карте `CrossSaleMainService.getHours`:
19
+ * crossSale = `+sendAfter`, upSale = `-sendBefore`,
20
+ * earlyBooking = `-sendBefore*24`.
21
+ *
22
+ * Используется и на бэкенде (вычисление `sendAt` планировщиком), и на
23
+ * фронте (превью «письмо уйдёт через …»), чтобы логика не разъезжалась.
24
+ */
25
+ function resolveSendOffsetHours(timing, sendOffset) {
26
+ const magnitude = timing.unit === 'days' ? sendOffset * 24 : sendOffset;
27
+ return timing.direction === 'before' ? -magnitude : magnitude;
28
+ }
29
+ /**
30
+ * Defensive-кламп величины смещения в допустимый диапазон типа
31
+ * (`[min, max]` из capabilities). Нечисловое/пустое значение → `default`.
32
+ * Нужен на чтении из БД: до backfill'а (Фаза 6) `config.sendOffset` у
33
+ * мигрированных строк может быть не заполнен, а у руками-созданных —
34
+ * выходить за границы из-за рассинхрона со старым UI.
35
+ */
36
+ function clampSendOffset(timing, value) {
37
+ if (value == null || !Number.isFinite(value))
38
+ return timing.default;
39
+ return Math.min(Math.max(value, timing.min), timing.max);
40
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Единый перечень всех trigger-based маркетинговых автоматизаций.
3
+ *
4
+ * До унификации каждый тип жил в собственной таблице/модуле
5
+ * (`cross-sales`, `upsale-sales`, `retargeting`, `early-booking`,
6
+ * `birthday-marketing`, `custom-client-booking-email`). Теперь это
7
+ * один `MarketingAutomationEntity`, а `type` — дискриминатор.
8
+ *
9
+ * ДР вынесены в ДВА самостоятельных значения (`BIRTHDAY_ADULT` /
10
+ * `BIRTHDAY_CHILD`) вместо одного типа с под-аудиторией: так у каждой
11
+ * аудитории своя запись/карточка без отдельного `discriminator`-поля,
12
+ * а добавить новый тип = добавить значение сюда + строку в capabilities.
13
+ */
14
+ export declare enum MarketingAutomationTypeEnum {
15
+ CROSS_SALE = "cross_sale",
16
+ UP_SALE = "up_sale",
17
+ RETARGETING = "retargeting",
18
+ EARLY_BOOKING = "early_booking",
19
+ BIRTHDAY_ADULT = "birthday_adult",
20
+ BIRTHDAY_CHILD = "birthday_child",
21
+ CUSTOM_BOOKING = "custom_booking"
22
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MarketingAutomationTypeEnum = void 0;
4
+ /**
5
+ * Единый перечень всех trigger-based маркетинговых автоматизаций.
6
+ *
7
+ * До унификации каждый тип жил в собственной таблице/модуле
8
+ * (`cross-sales`, `upsale-sales`, `retargeting`, `early-booking`,
9
+ * `birthday-marketing`, `custom-client-booking-email`). Теперь это
10
+ * один `MarketingAutomationEntity`, а `type` — дискриминатор.
11
+ *
12
+ * ДР вынесены в ДВА самостоятельных значения (`BIRTHDAY_ADULT` /
13
+ * `BIRTHDAY_CHILD`) вместо одного типа с под-аудиторией: так у каждой
14
+ * аудитории своя запись/карточка без отдельного `discriminator`-поля,
15
+ * а добавить новый тип = добавить значение сюда + строку в capabilities.
16
+ */
17
+ var MarketingAutomationTypeEnum;
18
+ (function (MarketingAutomationTypeEnum) {
19
+ MarketingAutomationTypeEnum["CROSS_SALE"] = "cross_sale";
20
+ MarketingAutomationTypeEnum["UP_SALE"] = "up_sale";
21
+ MarketingAutomationTypeEnum["RETARGETING"] = "retargeting";
22
+ MarketingAutomationTypeEnum["EARLY_BOOKING"] = "early_booking";
23
+ MarketingAutomationTypeEnum["BIRTHDAY_ADULT"] = "birthday_adult";
24
+ MarketingAutomationTypeEnum["BIRTHDAY_CHILD"] = "birthday_child";
25
+ MarketingAutomationTypeEnum["CUSTOM_BOOKING"] = "custom_booking";
26
+ })(MarketingAutomationTypeEnum || (exports.MarketingAutomationTypeEnum = MarketingAutomationTypeEnum = {}));
@@ -0,0 +1,36 @@
1
+ import { EmailContentJsonV2 } from '../../email-builder';
2
+ import { Languages } from '../../shared/enum/languages.enum';
3
+ import { MarketingAutomationConfigDto } from './marketing-automation-config.dto';
4
+ import { MarketingAutomationDiscountTypeEnum } from './marketing-automation-discount-type.enum';
5
+ import { MarketingAutomationStatusEnum } from './marketing-automation-status.enum';
6
+ import { MarketingAutomationTypeEnum } from './marketing-automation-type.enum';
7
+ /**
8
+ * Контент-поля локали намеренно необязательны: энтити может храниться
9
+ * как выключенный черновик с неполным содержимым. Жёсткая валидация
10
+ * (заполнен ли нужный по версии контент во всех языках) выполняется на
11
+ * фронте в момент активации канала, а не при сохранении.
12
+ */
13
+ export declare class MarketingAutomationLocaleDto {
14
+ language: Languages;
15
+ /** Legacy HTML (Quill) с `{var}`-плейсхолдерами. Используется при `isV2 === false`. */
16
+ feedbackText?: string;
17
+ title?: string;
18
+ /** v2-документ Maily/TipTap. Используется при `isV2 === true`. */
19
+ contentJson?: EmailContentJsonV2 | null;
20
+ }
21
+ export declare class MarketingAutomationDto {
22
+ type: MarketingAutomationTypeEnum;
23
+ status: MarketingAutomationStatusEnum;
24
+ isV2: boolean;
25
+ discount: number;
26
+ discountValidityDays: number;
27
+ discountType: MarketingAutomationDiscountTypeEnum;
28
+ sendToAllParticipants?: boolean;
29
+ /**
30
+ * Универсальный флаг (раньше был только у birthday-маркетинга):
31
+ * требовать согласие на рекламу у получателя.
32
+ */
33
+ requireSendAds: boolean;
34
+ config: MarketingAutomationConfigDto;
35
+ locales: MarketingAutomationLocaleDto[];
36
+ }
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.MarketingAutomationDto = exports.MarketingAutomationLocaleDto = void 0;
13
+ /* eslint-disable max-classes-per-file */
14
+ const class_transformer_1 = require("class-transformer");
15
+ const class_validator_1 = require("class-validator");
16
+ const languages_enum_1 = require("../../shared/enum/languages.enum");
17
+ const marketing_automation_config_dto_1 = require("./marketing-automation-config.dto");
18
+ const marketing_automation_discount_type_enum_1 = require("./marketing-automation-discount-type.enum");
19
+ const marketing_automation_status_enum_1 = require("./marketing-automation-status.enum");
20
+ const marketing_automation_type_enum_1 = require("./marketing-automation-type.enum");
21
+ /**
22
+ * Контент-поля локали намеренно необязательны: энтити может храниться
23
+ * как выключенный черновик с неполным содержимым. Жёсткая валидация
24
+ * (заполнен ли нужный по версии контент во всех языках) выполняется на
25
+ * фронте в момент активации канала, а не при сохранении.
26
+ */
27
+ class MarketingAutomationLocaleDto {
28
+ }
29
+ exports.MarketingAutomationLocaleDto = MarketingAutomationLocaleDto;
30
+ __decorate([
31
+ (0, class_validator_1.IsEnum)(languages_enum_1.Languages),
32
+ (0, class_transformer_1.Expose)(),
33
+ __metadata("design:type", String)
34
+ ], MarketingAutomationLocaleDto.prototype, "language", void 0);
35
+ __decorate([
36
+ (0, class_validator_1.IsOptional)(),
37
+ (0, class_validator_1.IsString)(),
38
+ (0, class_validator_1.MaxLength)(3000),
39
+ (0, class_transformer_1.Expose)(),
40
+ __metadata("design:type", String)
41
+ ], MarketingAutomationLocaleDto.prototype, "feedbackText", void 0);
42
+ __decorate([
43
+ (0, class_validator_1.IsOptional)(),
44
+ (0, class_validator_1.IsString)(),
45
+ (0, class_validator_1.MaxLength)(200),
46
+ (0, class_transformer_1.Expose)(),
47
+ __metadata("design:type", String)
48
+ ], MarketingAutomationLocaleDto.prototype, "title", void 0);
49
+ __decorate([
50
+ (0, class_validator_1.IsOptional)(),
51
+ (0, class_validator_1.IsObject)(),
52
+ (0, class_transformer_1.Expose)(),
53
+ __metadata("design:type", Object)
54
+ ], MarketingAutomationLocaleDto.prototype, "contentJson", void 0);
55
+ class MarketingAutomationDto {
56
+ }
57
+ exports.MarketingAutomationDto = MarketingAutomationDto;
58
+ __decorate([
59
+ (0, class_validator_1.IsEnum)(marketing_automation_type_enum_1.MarketingAutomationTypeEnum),
60
+ (0, class_transformer_1.Expose)(),
61
+ __metadata("design:type", String)
62
+ ], MarketingAutomationDto.prototype, "type", void 0);
63
+ __decorate([
64
+ (0, class_validator_1.IsEnum)(marketing_automation_status_enum_1.MarketingAutomationStatusEnum),
65
+ (0, class_transformer_1.Expose)(),
66
+ __metadata("design:type", String)
67
+ ], MarketingAutomationDto.prototype, "status", void 0);
68
+ __decorate([
69
+ (0, class_validator_1.IsOptional)(),
70
+ (0, class_validator_1.IsBoolean)(),
71
+ (0, class_transformer_1.Expose)(),
72
+ __metadata("design:type", Boolean)
73
+ ], MarketingAutomationDto.prototype, "isV2", void 0);
74
+ __decorate([
75
+ (0, class_validator_1.IsPositive)(),
76
+ (0, class_validator_1.ValidateIf)((o) => o.discountType !== marketing_automation_discount_type_enum_1.MarketingAutomationDiscountTypeEnum.NONE),
77
+ (0, class_transformer_1.Expose)(),
78
+ __metadata("design:type", Number)
79
+ ], MarketingAutomationDto.prototype, "discount", void 0);
80
+ __decorate([
81
+ (0, class_validator_1.IsPositive)(),
82
+ (0, class_validator_1.ValidateIf)((o) => o.discountType !== marketing_automation_discount_type_enum_1.MarketingAutomationDiscountTypeEnum.NONE),
83
+ (0, class_transformer_1.Expose)(),
84
+ __metadata("design:type", Number)
85
+ ], MarketingAutomationDto.prototype, "discountValidityDays", void 0);
86
+ __decorate([
87
+ (0, class_validator_1.IsEnum)(marketing_automation_discount_type_enum_1.MarketingAutomationDiscountTypeEnum),
88
+ (0, class_transformer_1.Expose)(),
89
+ __metadata("design:type", String)
90
+ ], MarketingAutomationDto.prototype, "discountType", void 0);
91
+ __decorate([
92
+ (0, class_validator_1.IsBoolean)(),
93
+ (0, class_transformer_1.Transform)(({ value }) => value !== null && value !== void 0 ? value : true),
94
+ (0, class_transformer_1.Expose)(),
95
+ __metadata("design:type", Boolean)
96
+ ], MarketingAutomationDto.prototype, "sendToAllParticipants", void 0);
97
+ __decorate([
98
+ (0, class_validator_1.IsBoolean)(),
99
+ (0, class_transformer_1.Transform)(({ value }) => value !== null && value !== void 0 ? value : false),
100
+ (0, class_transformer_1.Expose)(),
101
+ __metadata("design:type", Boolean)
102
+ ], MarketingAutomationDto.prototype, "requireSendAds", void 0);
103
+ __decorate([
104
+ (0, class_validator_1.IsObject)(),
105
+ (0, class_validator_1.ValidateNested)(),
106
+ (0, class_transformer_1.Type)(() => marketing_automation_config_dto_1.MarketingAutomationConfigDto),
107
+ (0, class_transformer_1.Transform)(({ value }) => value !== null && value !== void 0 ? value : {}),
108
+ (0, class_transformer_1.Expose)(),
109
+ __metadata("design:type", marketing_automation_config_dto_1.MarketingAutomationConfigDto)
110
+ ], MarketingAutomationDto.prototype, "config", void 0);
111
+ __decorate([
112
+ (0, class_transformer_1.Type)(() => MarketingAutomationLocaleDto),
113
+ (0, class_validator_1.IsArray)(),
114
+ (0, class_validator_1.ValidateNested)({ context: this }),
115
+ (0, class_transformer_1.Expose)(),
116
+ __metadata("design:type", Array)
117
+ ], MarketingAutomationDto.prototype, "locales", void 0);
@@ -0,0 +1,25 @@
1
+ import { EmailContentJsonV2 } from '../../email-builder';
2
+ import { Languages } from '../../shared/enum/languages.enum';
3
+ import { RO } from '../../shared/ro-class';
4
+ import { MarketingAutomationConfigDto } from './marketing-automation-config.dto';
5
+ import { MarketingAutomationDiscountTypeEnum } from './marketing-automation-discount-type.enum';
6
+ import { MarketingAutomationStatusEnum } from './marketing-automation-status.enum';
7
+ import { MarketingAutomationTypeEnum } from './marketing-automation-type.enum';
8
+ export declare class MarketingAutomationLocaleRO {
9
+ language: Languages;
10
+ feedbackText: string;
11
+ title: string;
12
+ contentJson?: EmailContentJsonV2 | null;
13
+ }
14
+ export declare class MarketingAutomationRO extends RO {
15
+ type: MarketingAutomationTypeEnum;
16
+ status: MarketingAutomationStatusEnum;
17
+ isV2: boolean;
18
+ discount: number;
19
+ discountValidityDays: number;
20
+ discountType: MarketingAutomationDiscountTypeEnum;
21
+ sendToAllParticipants: boolean;
22
+ requireSendAds: boolean;
23
+ config: MarketingAutomationConfigDto;
24
+ locales: MarketingAutomationLocaleRO[];
25
+ }