@escapenavigator/types 1.10.138 → 1.10.140

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.
@@ -39,8 +39,7 @@ class OpenapiBatchCreatePreorderDto {
39
39
  }
40
40
  exports.OpenapiBatchCreatePreorderDto = OpenapiBatchCreatePreorderDto;
41
41
  __decorate([
42
- (0, class_validator_1.ArrayMinSize)(2),
43
- (0, class_validator_1.ArrayMaxSize)(5),
42
+ (0, class_validator_1.IsArray)(),
44
43
  (0, class_validator_1.ValidateNested)({ each: true }),
45
44
  (0, class_transformer_1.Type)(() => openapi_create_preorder_dto_1.OpenapiCreatePreorderDto),
46
45
  (0, class_transformer_1.Expose)(),
@@ -26,7 +26,7 @@ __decorate([
26
26
  ], Participant.prototype, "name", void 0);
27
27
  __decorate([
28
28
  (0, class_transformer_1.Expose)(),
29
- (0, class_transformer_1.Transform)(({ value }) => `${value.slice(0, 1)}.`),
29
+ (0, class_transformer_1.Transform)(({ value }) => (value ? `${value.slice(0, 1)}.` : '')),
30
30
  __metadata("design:type", String)
31
31
  ], Participant.prototype, "surname", void 0);
32
32
  __decorate([
@@ -49,7 +49,7 @@ __decorate([
49
49
  ], Participant.prototype, "name", void 0);
50
50
  __decorate([
51
51
  (0, class_transformer_1.Expose)(),
52
- (0, class_transformer_1.Transform)(({ value }) => `${value.slice(0, 1)}.`),
52
+ (0, class_transformer_1.Transform)(({ value }) => (value ? `${value.slice(0, 1)}.` : '')),
53
53
  __metadata("design:type", String)
54
54
  ], Participant.prototype, "surname", void 0);
55
55
  __decorate([
@@ -14,6 +14,7 @@ exports.CrossSaleDto = exports.CrossSaleLocaleDto = void 0;
14
14
  const class_transformer_1 = require("class-transformer");
15
15
  const class_validator_1 = require("class-validator");
16
16
  const languages_enum_1 = require("../../shared/enum/languages.enum");
17
+ const feedback_validators_1 = require("../../shared/feedback-validators");
17
18
  const is_not_blank_1 = require("../../shared/is-not-blank");
18
19
  const cross_sale_status_enum_1 = require("./cross-sale-status.enum");
19
20
  const crossale_discount_type_enum_1 = require("./crossale-discount-type.enum");
@@ -29,6 +30,7 @@ __decorate([
29
30
  (0, is_not_blank_1.IsNotBlank)(),
30
31
  (0, class_validator_1.MinLength)(50),
31
32
  (0, class_validator_1.MaxLength)(3000),
33
+ (0, feedback_validators_1.IsIfIncorrect)(),
32
34
  (0, class_transformer_1.Expose)(),
33
35
  __metadata("design:type", String)
34
36
  ], CrossSaleLocaleDto.prototype, "feedbackText", void 0);
@@ -12,8 +12,14 @@ function IsIfIncorrect(property, validationOptions) {
12
12
  options: validationOptions,
13
13
  validator: {
14
14
  validate(text) {
15
- const openTags = (text.match(/\{\{#if [^}]+\}\}/g) || []).length;
16
- const closeTags = (text.match(/\{\{\/if\}\}/g) || []).length;
15
+ // Quill отдаёт `{{#if}}` с неразрывными пробелами
16
+ // (`{{#if X}}`), поэтому без нормализации regex не
17
+ // находит open-тег и валидатор ложно ругается на дисбаланс.
18
+ // Приводим nbsp к обычному пробелу — тот же контракт, что у
19
+ // `stripNonBreakingSpaces` редакторов и `transformText`.
20
+ const normalized = String(text !== null && text !== void 0 ? text : '').replace(/ | | |\u00A0/gi, ' ');
21
+ const openTags = (normalized.match(/\{\{#if [^}]+\}\}/g) || []).length;
22
+ const closeTags = (normalized.match(/\{\{\/if\}\}/g) || []).length;
17
23
  return openTags === closeTags;
18
24
  },
19
25
  defaultMessage() {