@mobilon-dev/chotto 0.3.110 → 0.3.111

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 (28) hide show
  1. package/dist/chotto.css +1 -1
  2. package/dist/components/2_feed_elements/FeedReplyQuote/FeedReplyQuote.vue.js +2 -2
  3. package/dist/components/2_feed_elements/FeedReplyQuote/FeedReplyQuote.vue2.js +14 -11
  4. package/dist/components/2_feed_elements/ImageMessage/ImageMessage.vue.js +3 -3
  5. package/dist/components/2_feed_elements/ImageMessage/ImageMessage.vue2.js +170 -170
  6. package/dist/components/2_feed_elements/ReplyImageMessage/ReplyImageMessage.vue.js +3 -3
  7. package/dist/components/2_feed_elements/ReplyImageMessage/ReplyImageMessage.vue2.js +27 -27
  8. package/dist/components/2_feed_elements/ReplyVideoMessage/ReplyVideoMessage.vue.js +1 -1
  9. package/dist/components/2_feed_elements/ReplyVideoMessage/ReplyVideoMessage.vue2.js +48 -35
  10. package/dist/components/2_feed_elements/VideoMessage/VideoMessage.vue.js +3 -3
  11. package/dist/components/2_feed_elements/VideoMessage/VideoMessage.vue2.js +297 -286
  12. package/dist/hooks/messages/buildReplyPayload.js +12 -9
  13. package/dist/hooks/validators/messages/messageValidator.js +48 -48
  14. package/dist/themes/dark.css +1 -1
  15. package/dist/themes/default.css +1 -1
  16. package/dist/themes/glass.css +1 -1
  17. package/dist/themes/green.css +1 -1
  18. package/dist/themes/mobilon1.css +1 -1
  19. package/dist/types/src/apps/data/messages.d.ts +288 -0
  20. package/dist/types/src/components/2_feed_elements/ImageMessage/stories/ImageMessage.stories.d.ts +2 -0
  21. package/dist/types/src/components/2_feed_elements/ReplyVideoMessage/styles/types.d.ts +32 -0
  22. package/dist/types/src/components/2_feed_elements/VideoMessage/stories/VideoMessage.stories.d.ts +3 -0
  23. package/dist/types/src/components/2_feed_elements/VideoMessage/styles/types.d.ts +32 -0
  24. package/dist/types/src/components/2_feed_elements/types/components.d.ts +6 -0
  25. package/dist/types/src/components/2_feed_elements/types/messages.d.ts +12 -0
  26. package/dist/types/src/hooks/messages/buildReplyPayload.d.ts +3 -0
  27. package/dist/types/src/hooks/validators/messages/types.d.ts +6 -0
  28. package/package.json +1 -1
@@ -1,14 +1,17 @@
1
- function r(t, l) {
1
+ function e(r, l) {
2
2
  return {
3
- messageId: String(t.messageId),
4
- type: t.type ?? l,
5
- text: t.text,
6
- filename: t.filename,
7
- url: t.url,
8
- header: t.header,
9
- callDuration: t.callDuration
3
+ messageId: String(r.messageId),
4
+ type: r.type ?? l,
5
+ text: r.text,
6
+ filename: r.filename,
7
+ url: r.url,
8
+ imagePreviewUrl: r.imagePreviewUrl,
9
+ videoPreviewUrl: r.videoPreviewUrl,
10
+ coverUrl: r.coverUrl,
11
+ header: r.header,
12
+ callDuration: r.callDuration
10
13
  };
11
14
  }
12
15
  export {
13
- r as buildReplyPayload
16
+ e as buildReplyPayload
14
17
  };
@@ -1,78 +1,78 @@
1
- function h(t, d) {
2
- const e = [], i = `messages[${d}].reply`;
3
- return typeof t != "object" || t === null ? (e.push({ path: i, message: "Reply должен быть объектом", value: t }), e) : (t.messageId === void 0 ? e.push({ path: `${i}.messageId`, message: "Поле messageId обязательно", value: t.messageId }) : typeof t.messageId != "string" && typeof t.messageId != "number" && e.push({ path: `${i}.messageId`, message: "Поле messageId должно быть строкой или числом", value: t.messageId }), (!t.type || typeof t.type != "string") && e.push({ path: `${i}.type`, message: "Поле type обязательно и должно быть строкой", value: t.type }), t.text !== void 0 && typeof t.text != "string" && e.push({ path: `${i}.text`, message: "Поле text должно быть строкой", value: t.text }), t.url !== void 0 && typeof t.url != "string" && e.push({ path: `${i}.url`, message: "Поле url должно быть строкой", value: t.url }), t.filename !== void 0 && typeof t.filename != "string" && e.push({ path: `${i}.filename`, message: "Поле filename должно быть строкой", value: t.filename }), e);
1
+ function v(e, o) {
2
+ const t = [], i = `messages[${o}].reply`;
3
+ return typeof e != "object" || e === null ? (t.push({ path: i, message: "Reply должен быть объектом", value: e }), t) : (e.messageId === void 0 ? t.push({ path: `${i}.messageId`, message: "Поле messageId обязательно", value: e.messageId }) : typeof e.messageId != "string" && typeof e.messageId != "number" && t.push({ path: `${i}.messageId`, message: "Поле messageId должно быть строкой или числом", value: e.messageId }), (!e.type || typeof e.type != "string") && t.push({ path: `${i}.type`, message: "Поле type обязательно и должно быть строкой", value: e.type }), e.text !== void 0 && typeof e.text != "string" && t.push({ path: `${i}.text`, message: "Поле text должно быть строкой", value: e.text }), e.url !== void 0 && typeof e.url != "string" && t.push({ path: `${i}.url`, message: "Поле url должно быть строкой", value: e.url }), e.imagePreviewUrl !== void 0 && typeof e.imagePreviewUrl != "string" && t.push({ path: `${i}.imagePreviewUrl`, message: "Поле imagePreviewUrl должно быть строкой", value: e.imagePreviewUrl }), e.videoPreviewUrl !== void 0 && typeof e.videoPreviewUrl != "string" && t.push({ path: `${i}.videoPreviewUrl`, message: "Поле videoPreviewUrl должно быть строкой", value: e.videoPreviewUrl }), e.coverUrl !== void 0 && typeof e.coverUrl != "string" && t.push({ path: `${i}.coverUrl`, message: "Поле coverUrl должно быть строкой", value: e.coverUrl }), e.filename !== void 0 && typeof e.filename != "string" && t.push({ path: `${i}.filename`, message: "Поле filename должно быть строкой", value: e.filename }), t);
4
4
  }
5
- function n(t, d) {
6
- const e = [], i = `messages[${d}]`;
7
- if (typeof t != "object" || t === null)
8
- return e.push({ path: i, message: "Сообщение должно быть объектом", value: t }), e;
9
- if (t.chatId !== void 0 && typeof t.chatId != "string" && e.push({ path: `${i}.chatId`, message: "Поле chatId должно быть строкой", value: t.chatId }), t.type !== "system.date" && (t.messageId === void 0 ? e.push({ path: `${i}.messageId`, message: "Поле messageId обязательно", value: t.messageId }) : typeof t.messageId != "string" && typeof t.messageId != "number" && e.push({ path: `${i}.messageId`, message: "Поле messageId должно быть строкой или числом", value: t.messageId })), (!t.type || typeof t.type != "string") && e.push({ path: `${i}.type`, message: "Поле type обязательно и должно быть строкой", value: t.type }), t.type !== "system.date" && (t.timestamp === void 0 ? e.push({ path: `${i}.timestamp`, message: "Поле timestamp обязательно", value: t.timestamp }) : typeof t.timestamp != "string" && typeof t.timestamp != "number" && e.push({ path: `${i}.timestamp`, message: "Поле timestamp должно быть строкой или числом", value: t.timestamp })), t.dialogId !== void 0 && typeof t.dialogId != "string" && e.push({ path: `${i}.dialogId`, message: "Поле dialogId должно быть строкой", value: t.dialogId }), t.direction !== void 0) {
5
+ function s(e, o) {
6
+ const t = [], i = `messages[${o}]`;
7
+ if (typeof e != "object" || e === null)
8
+ return t.push({ path: i, message: "Сообщение должно быть объектом", value: e }), t;
9
+ if (e.chatId !== void 0 && typeof e.chatId != "string" && t.push({ path: `${i}.chatId`, message: "Поле chatId должно быть строкой", value: e.chatId }), e.type !== "system.date" && (e.messageId === void 0 ? t.push({ path: `${i}.messageId`, message: "Поле messageId обязательно", value: e.messageId }) : typeof e.messageId != "string" && typeof e.messageId != "number" && t.push({ path: `${i}.messageId`, message: "Поле messageId должно быть строкой или числом", value: e.messageId })), (!e.type || typeof e.type != "string") && t.push({ path: `${i}.type`, message: "Поле type обязательно и должно быть строкой", value: e.type }), e.type !== "system.date" && (e.timestamp === void 0 ? t.push({ path: `${i}.timestamp`, message: "Поле timestamp обязательно", value: e.timestamp }) : typeof e.timestamp != "string" && typeof e.timestamp != "number" && t.push({ path: `${i}.timestamp`, message: "Поле timestamp должно быть строкой или числом", value: e.timestamp })), e.dialogId !== void 0 && typeof e.dialogId != "string" && t.push({ path: `${i}.dialogId`, message: "Поле dialogId должно быть строкой", value: e.dialogId }), e.direction !== void 0) {
10
10
  const a = ["incoming", "outgoing"];
11
- a.includes(t.direction) || e.push({
11
+ a.includes(e.direction) || t.push({
12
12
  path: `${i}.direction`,
13
13
  message: `Поле direction должно быть одним из: ${a.join(", ")}`,
14
- value: t.direction
14
+ value: e.direction
15
15
  });
16
16
  }
17
- if (t.status !== void 0) {
17
+ if (e.status !== void 0) {
18
18
  const a = ["read", "sent", "received"];
19
- a.includes(t.status) || e.push({
19
+ a.includes(e.status) || t.push({
20
20
  path: `${i}.status`,
21
21
  message: `Поле status должно быть одним из: ${a.join(", ")}`,
22
- value: t.status
22
+ value: e.status
23
23
  });
24
24
  }
25
- return t.text !== void 0 && typeof t.text != "string" && e.push({ path: `${i}.text`, message: "Поле text должно быть строкой", value: t.text }), t.header !== void 0 && typeof t.header != "string" && e.push({ path: `${i}.header`, message: "Поле header должно быть строкой", value: t.header }), t.subText !== void 0 && typeof t.subText != "string" && e.push({ path: `${i}.subText`, message: "Поле subText должно быть строкой", value: t.subText }), t.avatar !== void 0 && typeof t.avatar != "string" && e.push({ path: `${i}.avatar`, message: "Поле avatar должно быть строкой", value: t.avatar }), t.url !== void 0 && typeof t.url != "string" && e.push({ path: `${i}.url`, message: "Поле url должно быть строкой", value: t.url }), t.filename !== void 0 && typeof t.filename != "string" && e.push({ path: `${i}.filename`, message: "Поле filename должно быть строкой", value: t.filename }), t.views !== void 0 && typeof t.views != "number" && e.push({ path: `${i}.views`, message: "Поле views должно быть числом", value: t.views }), t.reply !== void 0 && e.push(...h(t.reply, d)), t.embed !== void 0 && (typeof t.embed != "object" || t.embed === null ? e.push({ path: `${i}.embed`, message: "Поле embed должно быть объектом", value: t.embed }) : ((!t.embed.type || typeof t.embed.type != "string") && e.push({ path: `${i}.embed.type`, message: "Поле embed.type обязательно и должно быть строкой", value: t.embed.type }), (!t.embed.url || typeof t.embed.url != "string") && e.push({ path: `${i}.embed.url`, message: "Поле embed.url обязательно и должно быть строкой", value: t.embed.url }))), e;
25
+ return e.text !== void 0 && typeof e.text != "string" && t.push({ path: `${i}.text`, message: "Поле text должно быть строкой", value: e.text }), e.header !== void 0 && typeof e.header != "string" && t.push({ path: `${i}.header`, message: "Поле header должно быть строкой", value: e.header }), e.subText !== void 0 && typeof e.subText != "string" && t.push({ path: `${i}.subText`, message: "Поле subText должно быть строкой", value: e.subText }), e.avatar !== void 0 && typeof e.avatar != "string" && t.push({ path: `${i}.avatar`, message: "Поле avatar должно быть строкой", value: e.avatar }), e.url !== void 0 && typeof e.url != "string" && t.push({ path: `${i}.url`, message: "Поле url должно быть строкой", value: e.url }), e.imagePreviewUrl !== void 0 && typeof e.imagePreviewUrl != "string" && t.push({ path: `${i}.imagePreviewUrl`, message: "Поле imagePreviewUrl должно быть строкой", value: e.imagePreviewUrl }), e.videoPreviewUrl !== void 0 && typeof e.videoPreviewUrl != "string" && t.push({ path: `${i}.videoPreviewUrl`, message: "Поле videoPreviewUrl должно быть строкой", value: e.videoPreviewUrl }), e.coverUrl !== void 0 && typeof e.coverUrl != "string" && t.push({ path: `${i}.coverUrl`, message: "Поле coverUrl должно быть строкой", value: e.coverUrl }), e.filename !== void 0 && typeof e.filename != "string" && t.push({ path: `${i}.filename`, message: "Поле filename должно быть строкой", value: e.filename }), e.views !== void 0 && typeof e.views != "number" && t.push({ path: `${i}.views`, message: "Поле views должно быть числом", value: e.views }), e.reply !== void 0 && t.push(...v(e.reply, o)), e.embed !== void 0 && (typeof e.embed != "object" || e.embed === null ? t.push({ path: `${i}.embed`, message: "Поле embed должно быть объектом", value: e.embed }) : ((!e.embed.type || typeof e.embed.type != "string") && t.push({ path: `${i}.embed.type`, message: "Поле embed.type обязательно и должно быть строкой", value: e.embed.type }), (!e.embed.url || typeof e.embed.url != "string") && t.push({ path: `${i}.embed.url`, message: "Поле embed.url обязательно и должно быть строкой", value: e.embed.url }))), t;
26
26
  }
27
- function f(t) {
28
- const d = [], e = [];
29
- if (!Array.isArray(t))
27
+ function h(e) {
28
+ const o = [], t = [];
29
+ if (!Array.isArray(e))
30
30
  return {
31
31
  isValid: !1,
32
- errors: [{ path: "messages", message: "Данные должны быть массивом", value: t }],
32
+ errors: [{ path: "messages", message: "Данные должны быть массивом", value: e }],
33
33
  warnings: []
34
34
  };
35
- t.length === 0 && e.push({ path: "messages", message: "Массив сообщений пустой" });
35
+ e.length === 0 && t.push({ path: "messages", message: "Массив сообщений пустой" });
36
36
  const i = /* @__PURE__ */ new Map();
37
- return t.forEach((a, p) => {
37
+ return e.forEach((a, d) => {
38
38
  if (a && typeof a == "object" && a.chatId !== void 0 && a.messageId !== void 0) {
39
- const u = a.dialogId ? `${a.chatId}:${a.dialogId}` : `${a.chatId}`;
40
- i.has(u) || i.set(u, /* @__PURE__ */ new Set());
41
- const s = i.get(u);
42
- if (s.has(a.messageId)) {
43
- const o = a.dialogId ? `в чате ${a.chatId}, диалоге ${a.dialogId}` : `в чате ${a.chatId}`;
44
- d.push({
45
- path: `messages[${p}].messageId`,
46
- message: `Дублирующийся messageId ${o}`,
39
+ const r = a.dialogId ? `${a.chatId}:${a.dialogId}` : `${a.chatId}`;
40
+ i.has(r) || i.set(r, /* @__PURE__ */ new Set());
41
+ const u = i.get(r);
42
+ if (u.has(a.messageId)) {
43
+ const p = a.dialogId ? `в чате ${a.chatId}, диалоге ${a.dialogId}` : `в чате ${a.chatId}`;
44
+ o.push({
45
+ path: `messages[${d}].messageId`,
46
+ message: `Дублирующийся messageId ${p}`,
47
47
  value: a.messageId
48
48
  });
49
49
  } else
50
- s.add(a.messageId);
50
+ u.add(a.messageId);
51
51
  }
52
- }), t.forEach((a, p) => {
53
- d.push(...n(a, p));
52
+ }), e.forEach((a, d) => {
53
+ o.push(...s(a, d));
54
54
  }), {
55
- isValid: d.length === 0,
56
- errors: d,
57
- warnings: e
55
+ isValid: o.length === 0,
56
+ errors: o,
57
+ warnings: t
58
58
  };
59
59
  }
60
- function l(t) {
61
- const d = [];
62
- return d.push(`=== РЕЗУЛЬТАТ ВАЛИДАЦИИ СООБЩЕНИЙ ===
63
- `), t.isValid ? d.push(`✅ Данные валидны!
64
- `) : d.push(`❌ Обнаружены ошибки!
65
- `), t.errors.length > 0 && (d.push(`
66
- 🔴 ОШИБКИ (${t.errors.length}):`), t.errors.forEach((e, i) => {
67
- d.push(` ${i + 1}. [${e.path}] ${e.message}`), e.value !== void 0 && d.push(` Значение: ${JSON.stringify(e.value)}`);
68
- })), t.warnings.length > 0 && (d.push(`
69
- ⚠️ ПРЕДУПРЕЖДЕНИЯ (${t.warnings.length}):`), t.warnings.forEach((e, i) => {
70
- d.push(` ${i + 1}. [${e.path}] ${e.message}`), e.value !== void 0 && d.push(` Значение: ${JSON.stringify(e.value)}`);
71
- })), d.push(`
72
- ` + "=".repeat(40)), d.join(`
60
+ function l(e) {
61
+ const o = [];
62
+ return o.push(`=== РЕЗУЛЬТАТ ВАЛИДАЦИИ СООБЩЕНИЙ ===
63
+ `), e.isValid ? o.push(`✅ Данные валидны!
64
+ `) : o.push(`❌ Обнаружены ошибки!
65
+ `), e.errors.length > 0 && (o.push(`
66
+ 🔴 ОШИБКИ (${e.errors.length}):`), e.errors.forEach((t, i) => {
67
+ o.push(` ${i + 1}. [${t.path}] ${t.message}`), t.value !== void 0 && o.push(` Значение: ${JSON.stringify(t.value)}`);
68
+ })), e.warnings.length > 0 && (o.push(`
69
+ ⚠️ ПРЕДУПРЕЖДЕНИЯ (${e.warnings.length}):`), e.warnings.forEach((t, i) => {
70
+ o.push(` ${i + 1}. [${t.path}] ${t.message}`), t.value !== void 0 && o.push(` Значение: ${JSON.stringify(t.value)}`);
71
+ })), o.push(`
72
+ ` + "=".repeat(40)), o.join(`
73
73
  `);
74
74
  }
75
75
  export {
76
76
  l as getMessageValidationReport,
77
- f as validateMessages
77
+ h as validateMessages
78
78
  };