@magmamath/students-features 0.3.0-rc.18 → 0.3.0-rc.2

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 (152) hide show
  1. package/dist/commonjs/features/chatbot/components/Alternatives/Alternatives.js +9 -6
  2. package/dist/commonjs/features/chatbot/components/Alternatives/Alternatives.js.map +1 -1
  3. package/dist/commonjs/features/chatbot/components/ChatControls/ChatControls.js +5 -13
  4. package/dist/commonjs/features/chatbot/components/ChatControls/ChatControls.js.map +1 -1
  5. package/dist/commonjs/features/chatbot/components/ChatMessage/MessageLoader.js +3 -4
  6. package/dist/commonjs/features/chatbot/components/ChatMessage/MessageLoader.js.map +1 -1
  7. package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js +4 -5
  8. package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -1
  9. package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js +9 -6
  10. package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -1
  11. package/dist/commonjs/features/chatbot/components/Chatbot.js +9 -8
  12. package/dist/commonjs/features/chatbot/components/Chatbot.js.map +1 -1
  13. package/dist/commonjs/features/chatbot/model/ChatBotModel.js +108 -107
  14. package/dist/commonjs/features/chatbot/model/ChatBotModel.js.map +1 -1
  15. package/dist/commonjs/features/chatbot/model/api.js.map +1 -1
  16. package/dist/commonjs/features/chatbot/model/t2s.js +2 -1
  17. package/dist/commonjs/features/chatbot/model/t2s.js.map +1 -1
  18. package/dist/commonjs/features/chatbot/model/translation.js +140 -121
  19. package/dist/commonjs/features/chatbot/model/translation.js.map +1 -1
  20. package/dist/commonjs/features/chatbot/types/model.types.js.map +1 -1
  21. package/dist/commonjs/index.js +1 -9
  22. package/dist/commonjs/index.js.map +1 -1
  23. package/dist/commonjs/lib/effector/createEntityFieldStore.js +13 -14
  24. package/dist/commonjs/lib/effector/createEntityFieldStore.js.map +1 -1
  25. package/dist/commonjs/shared/icons/ChatbotIcon.js +106 -613
  26. package/dist/commonjs/shared/icons/ChatbotIcon.js.map +1 -1
  27. package/dist/module/features/chatbot/components/Alternatives/Alternatives.js +9 -6
  28. package/dist/module/features/chatbot/components/Alternatives/Alternatives.js.map +1 -1
  29. package/dist/module/features/chatbot/components/ChatControls/ChatControls.js +5 -13
  30. package/dist/module/features/chatbot/components/ChatControls/ChatControls.js.map +1 -1
  31. package/dist/module/features/chatbot/components/ChatMessage/MessageLoader.js +3 -4
  32. package/dist/module/features/chatbot/components/ChatMessage/MessageLoader.js.map +1 -1
  33. package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js +4 -5
  34. package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -1
  35. package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js +9 -6
  36. package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -1
  37. package/dist/module/features/chatbot/components/Chatbot.js +9 -8
  38. package/dist/module/features/chatbot/components/Chatbot.js.map +1 -1
  39. package/dist/module/features/chatbot/index.js.map +1 -1
  40. package/dist/module/features/chatbot/model/ChatBotModel.js +109 -108
  41. package/dist/module/features/chatbot/model/ChatBotModel.js.map +1 -1
  42. package/dist/module/features/chatbot/model/api.js.map +1 -1
  43. package/dist/module/features/chatbot/model/t2s.js +2 -1
  44. package/dist/module/features/chatbot/model/t2s.js.map +1 -1
  45. package/dist/module/features/chatbot/model/translation.js +141 -122
  46. package/dist/module/features/chatbot/model/translation.js.map +1 -1
  47. package/dist/module/features/chatbot/types/model.types.js.map +1 -1
  48. package/dist/module/index.js +0 -1
  49. package/dist/module/index.js.map +1 -1
  50. package/dist/module/lib/effector/createEntityFieldStore.js +13 -12
  51. package/dist/module/lib/effector/createEntityFieldStore.js.map +1 -1
  52. package/dist/module/shared/icons/ChatbotIcon.js +107 -614
  53. package/dist/module/shared/icons/ChatbotIcon.js.map +1 -1
  54. package/dist/typescript/commonjs/features/chatbot/components/Alternatives/Alternatives.d.ts.map +1 -1
  55. package/dist/typescript/commonjs/features/chatbot/components/ChatControls/ChatControls.d.ts +1 -5
  56. package/dist/typescript/commonjs/features/chatbot/components/ChatControls/ChatControls.d.ts.map +1 -1
  57. package/dist/typescript/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +1 -1
  58. package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts +1 -5
  59. package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts.map +1 -1
  60. package/dist/typescript/commonjs/features/chatbot/index.d.ts +1 -2
  61. package/dist/typescript/commonjs/features/chatbot/index.d.ts.map +1 -1
  62. package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts +49 -20
  63. package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
  64. package/dist/typescript/commonjs/features/chatbot/model/api.d.ts +7 -5
  65. package/dist/typescript/commonjs/features/chatbot/model/api.d.ts.map +1 -1
  66. package/dist/typescript/commonjs/features/chatbot/model/t2s.d.ts +1 -1
  67. package/dist/typescript/commonjs/features/chatbot/model/t2s.d.ts.map +1 -1
  68. package/dist/typescript/commonjs/features/chatbot/model/translation.d.ts +14 -30
  69. package/dist/typescript/commonjs/features/chatbot/model/translation.d.ts.map +1 -1
  70. package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts +0 -1
  71. package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts.map +1 -1
  72. package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts +7 -10
  73. package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts.map +1 -1
  74. package/dist/typescript/commonjs/features/chatbot/types/translation.types.d.ts +5 -20
  75. package/dist/typescript/commonjs/features/chatbot/types/translation.types.d.ts.map +1 -1
  76. package/dist/typescript/commonjs/index.d.ts +0 -1
  77. package/dist/typescript/commonjs/index.d.ts.map +1 -1
  78. package/dist/typescript/commonjs/lib/effector/createEntityFieldStore.d.ts +5 -6
  79. package/dist/typescript/commonjs/lib/effector/createEntityFieldStore.d.ts.map +1 -1
  80. package/dist/typescript/commonjs/shared/icons/ChatbotIcon.d.ts.map +1 -1
  81. package/dist/typescript/module/features/chatbot/components/Alternatives/Alternatives.d.ts.map +1 -1
  82. package/dist/typescript/module/features/chatbot/components/ChatControls/ChatControls.d.ts +1 -5
  83. package/dist/typescript/module/features/chatbot/components/ChatControls/ChatControls.d.ts.map +1 -1
  84. package/dist/typescript/module/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +1 -1
  85. package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts +1 -5
  86. package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts.map +1 -1
  87. package/dist/typescript/module/features/chatbot/index.d.ts +1 -2
  88. package/dist/typescript/module/features/chatbot/index.d.ts.map +1 -1
  89. package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts +49 -20
  90. package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
  91. package/dist/typescript/module/features/chatbot/model/api.d.ts +7 -5
  92. package/dist/typescript/module/features/chatbot/model/api.d.ts.map +1 -1
  93. package/dist/typescript/module/features/chatbot/model/t2s.d.ts +1 -1
  94. package/dist/typescript/module/features/chatbot/model/t2s.d.ts.map +1 -1
  95. package/dist/typescript/module/features/chatbot/model/translation.d.ts +14 -30
  96. package/dist/typescript/module/features/chatbot/model/translation.d.ts.map +1 -1
  97. package/dist/typescript/module/features/chatbot/types/api.types.d.ts +0 -1
  98. package/dist/typescript/module/features/chatbot/types/api.types.d.ts.map +1 -1
  99. package/dist/typescript/module/features/chatbot/types/model.types.d.ts +7 -10
  100. package/dist/typescript/module/features/chatbot/types/model.types.d.ts.map +1 -1
  101. package/dist/typescript/module/features/chatbot/types/translation.types.d.ts +5 -20
  102. package/dist/typescript/module/features/chatbot/types/translation.types.d.ts.map +1 -1
  103. package/dist/typescript/module/index.d.ts +0 -1
  104. package/dist/typescript/module/index.d.ts.map +1 -1
  105. package/dist/typescript/module/lib/effector/createEntityFieldStore.d.ts +5 -6
  106. package/dist/typescript/module/lib/effector/createEntityFieldStore.d.ts.map +1 -1
  107. package/dist/typescript/module/shared/icons/ChatbotIcon.d.ts.map +1 -1
  108. package/package.json +1 -1
  109. package/src/features/chatbot/components/Alternatives/Alternatives.tsx +9 -4
  110. package/src/features/chatbot/components/ChatControls/ChatControls.tsx +3 -6
  111. package/src/features/chatbot/components/ChatMessage/MessageLoader.tsx +2 -3
  112. package/src/features/chatbot/components/ChatMessage/ReceivedMessage.tsx +3 -4
  113. package/src/features/chatbot/components/ChatMessages/ChatbotMessages.tsx +9 -4
  114. package/src/features/chatbot/components/Chatbot.tsx +8 -5
  115. package/src/features/chatbot/index.ts +1 -7
  116. package/src/features/chatbot/model/ChatBotModel.ts +113 -102
  117. package/src/features/chatbot/model/api.ts +33 -24
  118. package/src/features/chatbot/model/t2s.ts +2 -1
  119. package/src/features/chatbot/model/translation.ts +161 -147
  120. package/src/features/chatbot/types/api.types.ts +0 -1
  121. package/src/features/chatbot/types/model.types.ts +7 -12
  122. package/src/features/chatbot/types/translation.types.ts +5 -21
  123. package/src/index.ts +0 -1
  124. package/src/lib/effector/createEntityFieldStore.ts +9 -11
  125. package/src/shared/icons/ChatbotIcon.tsx +85 -500
  126. package/dist/commonjs/features/chatbot/model/messagesHelper.js +0 -46
  127. package/dist/commonjs/features/chatbot/model/messagesHelper.js.map +0 -1
  128. package/dist/commonjs/features/chatbot/model/translation.helpers.js +0 -69
  129. package/dist/commonjs/features/chatbot/model/translation.helpers.js.map +0 -1
  130. package/dist/commonjs/lib/helpers/types.js +0 -2
  131. package/dist/commonjs/lib/helpers/types.js.map +0 -1
  132. package/dist/module/features/chatbot/model/messagesHelper.js +0 -41
  133. package/dist/module/features/chatbot/model/messagesHelper.js.map +0 -1
  134. package/dist/module/features/chatbot/model/translation.helpers.js +0 -63
  135. package/dist/module/features/chatbot/model/translation.helpers.js.map +0 -1
  136. package/dist/module/lib/helpers/types.js +0 -2
  137. package/dist/module/lib/helpers/types.js.map +0 -1
  138. package/dist/typescript/commonjs/features/chatbot/model/messagesHelper.d.ts +0 -21
  139. package/dist/typescript/commonjs/features/chatbot/model/messagesHelper.d.ts.map +0 -1
  140. package/dist/typescript/commonjs/features/chatbot/model/translation.helpers.d.ts +0 -10
  141. package/dist/typescript/commonjs/features/chatbot/model/translation.helpers.d.ts.map +0 -1
  142. package/dist/typescript/commonjs/lib/helpers/types.d.ts +0 -2
  143. package/dist/typescript/commonjs/lib/helpers/types.d.ts.map +0 -1
  144. package/dist/typescript/module/features/chatbot/model/messagesHelper.d.ts +0 -21
  145. package/dist/typescript/module/features/chatbot/model/messagesHelper.d.ts.map +0 -1
  146. package/dist/typescript/module/features/chatbot/model/translation.helpers.d.ts +0 -10
  147. package/dist/typescript/module/features/chatbot/model/translation.helpers.d.ts.map +0 -1
  148. package/dist/typescript/module/lib/helpers/types.d.ts +0 -2
  149. package/dist/typescript/module/lib/helpers/types.d.ts.map +0 -1
  150. package/src/features/chatbot/model/messagesHelper.ts +0 -48
  151. package/src/features/chatbot/model/translation.helpers.ts +0 -58
  152. package/src/lib/helpers/types.ts +0 -1
@@ -1,46 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.messagesHelper = void 0;
7
- var _helpers = require("../../../lib/helpers/helpers.js");
8
- class messagesHelper {
9
- static createAnswer(data) {
10
- return {
11
- id: (0, _helpers.generateRandomId)(),
12
- isOwnMessage: false,
13
- message: data.message,
14
- threadId: data.threadId,
15
- options: data.options,
16
- translatedMessage: data.translatedMessage
17
- };
18
- }
19
- static createLast(data) {
20
- return {
21
- id: (0, _helpers.generateRandomId)(),
22
- message: data.message,
23
- translatedMessage: data.translatedMessage,
24
- isOwnMessage: false,
25
- options: [],
26
- threadId: '',
27
- endMessage: true
28
- };
29
- }
30
- static createOwn({
31
- message = '',
32
- translatedMessage,
33
- threadId
34
- }) {
35
- return {
36
- id: (0, _helpers.generateRandomId)(),
37
- message,
38
- translatedMessage,
39
- threadId: threadId || '',
40
- isOwnMessage: true,
41
- options: []
42
- };
43
- }
44
- }
45
- exports.messagesHelper = messagesHelper;
46
- //# sourceMappingURL=messagesHelper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_helpers","require","messagesHelper","createAnswer","data","id","generateRandomId","isOwnMessage","message","threadId","options","translatedMessage","createLast","endMessage","createOwn","exports"],"sourceRoot":"../../../../../src","sources":["features/chatbot/model/messagesHelper.ts"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,cAAc,CAAC;EAC1B,OAAcC,YAAYA,CAACC,IAA2B,EAAuB;IAC3E,OAAO;MACLC,EAAE,EAAE,IAAAC,yBAAgB,EAAC,CAAC;MACtBC,YAAY,EAAE,KAAK;MACnBC,OAAO,EAAEJ,IAAI,CAACI,OAAO;MACrBC,QAAQ,EAAEL,IAAI,CAACK,QAAQ;MACvBC,OAAO,EAAEN,IAAI,CAACM,OAAO;MACrBC,iBAAiB,EAAEP,IAAI,CAACO;IAC1B,CAAC;EACH;EAEA,OAAcC,UAAUA,CAACR,IAA2B,EAAE;IACpD,OAAO;MACLC,EAAE,EAAE,IAAAC,yBAAgB,EAAC,CAAC;MACtBE,OAAO,EAAEJ,IAAI,CAACI,OAAO;MACrBG,iBAAiB,EAAEP,IAAI,CAACO,iBAAiB;MACzCJ,YAAY,EAAE,KAAK;MACnBG,OAAO,EAAE,EAAE;MACXD,QAAQ,EAAE,EAAE;MACZI,UAAU,EAAE;IACd,CAAC;EACH;EAEA,OAAcC,SAASA,CAAC;IACtBN,OAAO,GAAG,EAAE;IACZG,iBAAiB;IACjBF;EACe,CAAC,EAAuB;IACvC,OAAO;MACLJ,EAAE,EAAE,IAAAC,yBAAgB,EAAC,CAAC;MACtBE,OAAO;MACPG,iBAAiB;MACjBF,QAAQ,EAAEA,QAAQ,IAAI,EAAE;MACxBF,YAAY,EAAE,IAAI;MAClBG,OAAO,EAAE;IACX,CAAC;EACH;AACF;AAACK,OAAA,CAAAb,cAAA,GAAAA,cAAA","ignoreList":[]}
@@ -1,69 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.addTranslationToOptions = addTranslationToOptions;
7
- exports.addTranslationsToAlternative = addTranslationsToAlternative;
8
- exports.getOptionsForTranslation = getOptionsForTranslation;
9
- function getOptionsForTranslation({
10
- lastMessage,
11
- alternatives
12
- }) {
13
- if (!lastMessage) return {
14
- lastMessage: null,
15
- alternatives: null
16
- };
17
- if (!lastMessage.options.length) {
18
- if (!alternatives) return {
19
- lastMessage: null,
20
- alternatives: null
21
- };
22
- const hintAlternatives = alternatives.options.hints ?? [];
23
- const defaultAlternatives = alternatives.options.default ?? [];
24
- return {
25
- lastMessage: null,
26
- alternatives: {
27
- hints: hintAlternatives.map(({
28
- text
29
- }) => text),
30
- default: defaultAlternatives.map(({
31
- text
32
- }) => text)
33
- }
34
- };
35
- }
36
- return {
37
- lastMessage: lastMessage.options.map(({
38
- text
39
- }) => text),
40
- alternatives: null
41
- };
42
- }
43
- function addTranslationsToAlternative({
44
- alternatives,
45
- translatedHints,
46
- translatedDefaults
47
- }) {
48
- return {
49
- ...alternatives,
50
- options: {
51
- ...alternatives.options,
52
- hints: translatedHints.map((translatedText, index) => ({
53
- ...alternatives.options.hints[index],
54
- translatedText
55
- })),
56
- default: translatedDefaults.map((translatedText, index) => ({
57
- ...alternatives.options.default[index],
58
- translatedText
59
- }))
60
- }
61
- };
62
- }
63
- function addTranslationToOptions(options, translations) {
64
- return options.map((option, index) => ({
65
- ...option,
66
- translatedText: translations[index]
67
- }));
68
- }
69
- //# sourceMappingURL=translation.helpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["getOptionsForTranslation","lastMessage","alternatives","options","length","hintAlternatives","hints","defaultAlternatives","default","map","text","addTranslationsToAlternative","translatedHints","translatedDefaults","translatedText","index","addTranslationToOptions","translations","option"],"sourceRoot":"../../../../../src","sources":["features/chatbot/model/translation.helpers.ts"],"mappings":";;;;;;;;AAOO,SAASA,wBAAwBA,CAAC;EACvCC,WAAW;EACXC;AACe,CAAC,EAAoB;EACpC,IAAI,CAACD,WAAW,EAAE,OAAO;IAAEA,WAAW,EAAE,IAAI;IAAEC,YAAY,EAAE;EAAK,CAAC;EAClE,IAAI,CAACD,WAAW,CAACE,OAAO,CAACC,MAAM,EAAE;IAC/B,IAAI,CAACF,YAAY,EAAE,OAAO;MAAED,WAAW,EAAE,IAAI;MAAEC,YAAY,EAAE;IAAK,CAAC;IACnE,MAAMG,gBAAgB,GAAGH,YAAY,CAACC,OAAO,CAACG,KAAK,IAAI,EAAE;IACzD,MAAMC,mBAAmB,GAAGL,YAAY,CAACC,OAAO,CAACK,OAAO,IAAI,EAAE;IAC9D,OAAO;MACLP,WAAW,EAAE,IAAI;MACjBC,YAAY,EAAE;QACZI,KAAK,EAAED,gBAAgB,CAACI,GAAG,CAAC,CAAC;UAAEC;QAAK,CAAC,KAAKA,IAAI,CAAC;QAC/CF,OAAO,EAAED,mBAAmB,CAACE,GAAG,CAAC,CAAC;UAAEC;QAAK,CAAC,KAAKA,IAAI;MACrD;IACF,CAAC;EACH;EAEA,OAAO;IACLT,WAAW,EAAEA,WAAW,CAACE,OAAO,CAACM,GAAG,CAAC,CAAC;MAAEC;IAAK,CAAC,KAAKA,IAAI,CAAC;IACxDR,YAAY,EAAE;EAChB,CAAC;AACH;AAEO,SAASS,4BAA4BA,CAAC;EAC3CT,YAAY;EACZU,eAAe;EACfC;AACiC,CAAC,EAA2B;EAC7D,OAAO;IACL,GAAGX,YAAY;IACfC,OAAO,EAAE;MACP,GAAGD,YAAY,CAACC,OAAO;MACvBG,KAAK,EAAEM,eAAe,CAACH,GAAG,CAAC,CAACK,cAAc,EAAEC,KAAK,MAAM;QACrD,GAAGb,YAAY,CAACC,OAAO,CAACG,KAAK,CAACS,KAAK,CAAC;QACpCD;MACF,CAAC,CAAC,CAAC;MACHN,OAAO,EAAEK,kBAAkB,CAACJ,GAAG,CAAC,CAACK,cAAc,EAAEC,KAAK,MAAM;QAC1D,GAAGb,YAAY,CAACC,OAAO,CAACK,OAAO,CAACO,KAAK,CAAC;QACtCD;MACF,CAAC,CAAC;IACJ;EACF,CAAC;AACH;AAEO,SAASE,uBAAuBA,CAACb,OAAqB,EAAEc,YAAsB,EAAE;EACrF,OAAOd,OAAO,CAACM,GAAG,CAAC,CAACS,MAAM,EAAEH,KAAK,MAAM;IACrC,GAAGG,MAAM;IACTJ,cAAc,EAAEG,YAAY,CAACF,KAAK;EACpC,CAAC,CAAC,CAAC;AACL","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["lib/helpers/types.ts"],"mappings":"","ignoreList":[]}
@@ -1,41 +0,0 @@
1
- "use strict";
2
-
3
- import { generateRandomId } from "../../../lib/helpers/helpers.js";
4
- export class messagesHelper {
5
- static createAnswer(data) {
6
- return {
7
- id: generateRandomId(),
8
- isOwnMessage: false,
9
- message: data.message,
10
- threadId: data.threadId,
11
- options: data.options,
12
- translatedMessage: data.translatedMessage
13
- };
14
- }
15
- static createLast(data) {
16
- return {
17
- id: generateRandomId(),
18
- message: data.message,
19
- translatedMessage: data.translatedMessage,
20
- isOwnMessage: false,
21
- options: [],
22
- threadId: '',
23
- endMessage: true
24
- };
25
- }
26
- static createOwn({
27
- message = '',
28
- translatedMessage,
29
- threadId
30
- }) {
31
- return {
32
- id: generateRandomId(),
33
- message,
34
- translatedMessage,
35
- threadId: threadId || '',
36
- isOwnMessage: true,
37
- options: []
38
- };
39
- }
40
- }
41
- //# sourceMappingURL=messagesHelper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["generateRandomId","messagesHelper","createAnswer","data","id","isOwnMessage","message","threadId","options","translatedMessage","createLast","endMessage","createOwn"],"sourceRoot":"../../../../../src","sources":["features/chatbot/model/messagesHelper.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,iCAA8B;AAS/D,OAAO,MAAMC,cAAc,CAAC;EAC1B,OAAcC,YAAYA,CAACC,IAA2B,EAAuB;IAC3E,OAAO;MACLC,EAAE,EAAEJ,gBAAgB,CAAC,CAAC;MACtBK,YAAY,EAAE,KAAK;MACnBC,OAAO,EAAEH,IAAI,CAACG,OAAO;MACrBC,QAAQ,EAAEJ,IAAI,CAACI,QAAQ;MACvBC,OAAO,EAAEL,IAAI,CAACK,OAAO;MACrBC,iBAAiB,EAAEN,IAAI,CAACM;IAC1B,CAAC;EACH;EAEA,OAAcC,UAAUA,CAACP,IAA2B,EAAE;IACpD,OAAO;MACLC,EAAE,EAAEJ,gBAAgB,CAAC,CAAC;MACtBM,OAAO,EAAEH,IAAI,CAACG,OAAO;MACrBG,iBAAiB,EAAEN,IAAI,CAACM,iBAAiB;MACzCJ,YAAY,EAAE,KAAK;MACnBG,OAAO,EAAE,EAAE;MACXD,QAAQ,EAAE,EAAE;MACZI,UAAU,EAAE;IACd,CAAC;EACH;EAEA,OAAcC,SAASA,CAAC;IACtBN,OAAO,GAAG,EAAE;IACZG,iBAAiB;IACjBF;EACe,CAAC,EAAuB;IACvC,OAAO;MACLH,EAAE,EAAEJ,gBAAgB,CAAC,CAAC;MACtBM,OAAO;MACPG,iBAAiB;MACjBF,QAAQ,EAAEA,QAAQ,IAAI,EAAE;MACxBF,YAAY,EAAE,IAAI;MAClBG,OAAO,EAAE;IACX,CAAC;EACH;AACF","ignoreList":[]}
@@ -1,63 +0,0 @@
1
- "use strict";
2
-
3
- export function getOptionsForTranslation({
4
- lastMessage,
5
- alternatives
6
- }) {
7
- if (!lastMessage) return {
8
- lastMessage: null,
9
- alternatives: null
10
- };
11
- if (!lastMessage.options.length) {
12
- if (!alternatives) return {
13
- lastMessage: null,
14
- alternatives: null
15
- };
16
- const hintAlternatives = alternatives.options.hints ?? [];
17
- const defaultAlternatives = alternatives.options.default ?? [];
18
- return {
19
- lastMessage: null,
20
- alternatives: {
21
- hints: hintAlternatives.map(({
22
- text
23
- }) => text),
24
- default: defaultAlternatives.map(({
25
- text
26
- }) => text)
27
- }
28
- };
29
- }
30
- return {
31
- lastMessage: lastMessage.options.map(({
32
- text
33
- }) => text),
34
- alternatives: null
35
- };
36
- }
37
- export function addTranslationsToAlternative({
38
- alternatives,
39
- translatedHints,
40
- translatedDefaults
41
- }) {
42
- return {
43
- ...alternatives,
44
- options: {
45
- ...alternatives.options,
46
- hints: translatedHints.map((translatedText, index) => ({
47
- ...alternatives.options.hints[index],
48
- translatedText
49
- })),
50
- default: translatedDefaults.map((translatedText, index) => ({
51
- ...alternatives.options.default[index],
52
- translatedText
53
- }))
54
- }
55
- };
56
- }
57
- export function addTranslationToOptions(options, translations) {
58
- return options.map((option, index) => ({
59
- ...option,
60
- translatedText: translations[index]
61
- }));
62
- }
63
- //# sourceMappingURL=translation.helpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["getOptionsForTranslation","lastMessage","alternatives","options","length","hintAlternatives","hints","defaultAlternatives","default","map","text","addTranslationsToAlternative","translatedHints","translatedDefaults","translatedText","index","addTranslationToOptions","translations","option"],"sourceRoot":"../../../../../src","sources":["features/chatbot/model/translation.helpers.ts"],"mappings":";;AAOA,OAAO,SAASA,wBAAwBA,CAAC;EACvCC,WAAW;EACXC;AACe,CAAC,EAAoB;EACpC,IAAI,CAACD,WAAW,EAAE,OAAO;IAAEA,WAAW,EAAE,IAAI;IAAEC,YAAY,EAAE;EAAK,CAAC;EAClE,IAAI,CAACD,WAAW,CAACE,OAAO,CAACC,MAAM,EAAE;IAC/B,IAAI,CAACF,YAAY,EAAE,OAAO;MAAED,WAAW,EAAE,IAAI;MAAEC,YAAY,EAAE;IAAK,CAAC;IACnE,MAAMG,gBAAgB,GAAGH,YAAY,CAACC,OAAO,CAACG,KAAK,IAAI,EAAE;IACzD,MAAMC,mBAAmB,GAAGL,YAAY,CAACC,OAAO,CAACK,OAAO,IAAI,EAAE;IAC9D,OAAO;MACLP,WAAW,EAAE,IAAI;MACjBC,YAAY,EAAE;QACZI,KAAK,EAAED,gBAAgB,CAACI,GAAG,CAAC,CAAC;UAAEC;QAAK,CAAC,KAAKA,IAAI,CAAC;QAC/CF,OAAO,EAAED,mBAAmB,CAACE,GAAG,CAAC,CAAC;UAAEC;QAAK,CAAC,KAAKA,IAAI;MACrD;IACF,CAAC;EACH;EAEA,OAAO;IACLT,WAAW,EAAEA,WAAW,CAACE,OAAO,CAACM,GAAG,CAAC,CAAC;MAAEC;IAAK,CAAC,KAAKA,IAAI,CAAC;IACxDR,YAAY,EAAE;EAChB,CAAC;AACH;AAEA,OAAO,SAASS,4BAA4BA,CAAC;EAC3CT,YAAY;EACZU,eAAe;EACfC;AACiC,CAAC,EAA2B;EAC7D,OAAO;IACL,GAAGX,YAAY;IACfC,OAAO,EAAE;MACP,GAAGD,YAAY,CAACC,OAAO;MACvBG,KAAK,EAAEM,eAAe,CAACH,GAAG,CAAC,CAACK,cAAc,EAAEC,KAAK,MAAM;QACrD,GAAGb,YAAY,CAACC,OAAO,CAACG,KAAK,CAACS,KAAK,CAAC;QACpCD;MACF,CAAC,CAAC,CAAC;MACHN,OAAO,EAAEK,kBAAkB,CAACJ,GAAG,CAAC,CAACK,cAAc,EAAEC,KAAK,MAAM;QAC1D,GAAGb,YAAY,CAACC,OAAO,CAACK,OAAO,CAACO,KAAK,CAAC;QACtCD;MACF,CAAC,CAAC;IACJ;EACF,CAAC;AACH;AAEA,OAAO,SAASE,uBAAuBA,CAACb,OAAqB,EAAEc,YAAsB,EAAE;EACrF,OAAOd,OAAO,CAACM,GAAG,CAAC,CAACS,MAAM,EAAEH,KAAK,MAAM;IACrC,GAAGG,MAAM;IACTJ,cAAc,EAAEG,YAAY,CAACF,KAAK;EACpC,CAAC,CAAC,CAAC;AACL","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["lib/helpers/types.ts"],"mappings":"","ignoreList":[]}
@@ -1,21 +0,0 @@
1
- import { ConversationMessage, CreateMessageResponse } from '../types/model.types';
2
- type OwnMessageProps = {
3
- message?: string;
4
- translatedMessage?: string;
5
- threadId?: string | null;
6
- };
7
- export declare class messagesHelper {
8
- static createAnswer(data: CreateMessageResponse): ConversationMessage;
9
- static createLast(data: CreateMessageResponse): {
10
- id: string;
11
- message: string;
12
- translatedMessage: string | undefined;
13
- isOwnMessage: boolean;
14
- options: never[];
15
- threadId: string;
16
- endMessage: boolean;
17
- };
18
- static createOwn({ message, translatedMessage, threadId, }: OwnMessageProps): ConversationMessage;
19
- }
20
- export {};
21
- //# sourceMappingURL=messagesHelper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"messagesHelper.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/model/messagesHelper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAEjF,KAAK,eAAe,GAAG;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB,CAAA;AAED,qBAAa,cAAc;WACX,YAAY,CAAC,IAAI,EAAE,qBAAqB,GAAG,mBAAmB;WAW9D,UAAU,CAAC,IAAI,EAAE,qBAAqB;;;;;;;;;WAYtC,SAAS,CAAC,EACtB,OAAY,EACZ,iBAAiB,EACjB,QAAQ,GACT,EAAE,eAAe,GAAG,mBAAmB;CAUzC"}
@@ -1,10 +0,0 @@
1
- import { AddTranslationToAlternativesProps, GetOptionsProps, GetOptionsResult } from '../types/translation.types';
2
- import { ChatAnswer, GetAlternativesResponse } from '../types/api.types';
3
- export declare function getOptionsForTranslation({ lastMessage, alternatives, }: GetOptionsProps): GetOptionsResult;
4
- export declare function addTranslationsToAlternative({ alternatives, translatedHints, translatedDefaults, }: AddTranslationToAlternativesProps): GetAlternativesResponse;
5
- export declare function addTranslationToOptions(options: ChatAnswer[], translations: string[]): {
6
- translatedText: string;
7
- text: string;
8
- promptKey: string;
9
- }[];
10
- //# sourceMappingURL=translation.helpers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"translation.helpers.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/model/translation.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EACjC,eAAe,EACf,gBAAgB,EACjB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAExE,wBAAgB,wBAAwB,CAAC,EACvC,WAAW,EACX,YAAY,GACb,EAAE,eAAe,GAAG,gBAAgB,CAmBpC;AAED,wBAAgB,4BAA4B,CAAC,EAC3C,YAAY,EACZ,eAAe,EACf,kBAAkB,GACnB,EAAE,iCAAiC,GAAG,uBAAuB,CAe7D;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE;;;;IAKpF"}
@@ -1,2 +0,0 @@
1
- export type AccomplishTo<T, To> = Partial<Omit<To, keyof T>> & T;
2
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/helpers/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,CAAC,CAAC,EAAE,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA"}
@@ -1,21 +0,0 @@
1
- import { ConversationMessage, CreateMessageResponse } from '../types/model.types';
2
- type OwnMessageProps = {
3
- message?: string;
4
- translatedMessage?: string;
5
- threadId?: string | null;
6
- };
7
- export declare class messagesHelper {
8
- static createAnswer(data: CreateMessageResponse): ConversationMessage;
9
- static createLast(data: CreateMessageResponse): {
10
- id: string;
11
- message: string;
12
- translatedMessage: string | undefined;
13
- isOwnMessage: boolean;
14
- options: never[];
15
- threadId: string;
16
- endMessage: boolean;
17
- };
18
- static createOwn({ message, translatedMessage, threadId, }: OwnMessageProps): ConversationMessage;
19
- }
20
- export {};
21
- //# sourceMappingURL=messagesHelper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"messagesHelper.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/model/messagesHelper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAEjF,KAAK,eAAe,GAAG;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB,CAAA;AAED,qBAAa,cAAc;WACX,YAAY,CAAC,IAAI,EAAE,qBAAqB,GAAG,mBAAmB;WAW9D,UAAU,CAAC,IAAI,EAAE,qBAAqB;;;;;;;;;WAYtC,SAAS,CAAC,EACtB,OAAY,EACZ,iBAAiB,EACjB,QAAQ,GACT,EAAE,eAAe,GAAG,mBAAmB;CAUzC"}
@@ -1,10 +0,0 @@
1
- import { AddTranslationToAlternativesProps, GetOptionsProps, GetOptionsResult } from '../types/translation.types';
2
- import { ChatAnswer, GetAlternativesResponse } from '../types/api.types';
3
- export declare function getOptionsForTranslation({ lastMessage, alternatives, }: GetOptionsProps): GetOptionsResult;
4
- export declare function addTranslationsToAlternative({ alternatives, translatedHints, translatedDefaults, }: AddTranslationToAlternativesProps): GetAlternativesResponse;
5
- export declare function addTranslationToOptions(options: ChatAnswer[], translations: string[]): {
6
- translatedText: string;
7
- text: string;
8
- promptKey: string;
9
- }[];
10
- //# sourceMappingURL=translation.helpers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"translation.helpers.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/model/translation.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EACjC,eAAe,EACf,gBAAgB,EACjB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAExE,wBAAgB,wBAAwB,CAAC,EACvC,WAAW,EACX,YAAY,GACb,EAAE,eAAe,GAAG,gBAAgB,CAmBpC;AAED,wBAAgB,4BAA4B,CAAC,EAC3C,YAAY,EACZ,eAAe,EACf,kBAAkB,GACnB,EAAE,iCAAiC,GAAG,uBAAuB,CAe7D;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE;;;;IAKpF"}
@@ -1,2 +0,0 @@
1
- export type AccomplishTo<T, To> = Partial<Omit<To, keyof T>> & T;
2
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/helpers/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,CAAC,CAAC,EAAE,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA"}
@@ -1,48 +0,0 @@
1
- import { generateRandomId } from '../../../lib/helpers/helpers'
2
- import { ConversationMessage, CreateMessageResponse } from '../types/model.types'
3
-
4
- type OwnMessageProps = {
5
- message?: string
6
- translatedMessage?: string
7
- threadId?: string | null
8
- }
9
-
10
- export class messagesHelper {
11
- public static createAnswer(data: CreateMessageResponse): ConversationMessage {
12
- return {
13
- id: generateRandomId(),
14
- isOwnMessage: false,
15
- message: data.message,
16
- threadId: data.threadId,
17
- options: data.options,
18
- translatedMessage: data.translatedMessage,
19
- }
20
- }
21
-
22
- public static createLast(data: CreateMessageResponse) {
23
- return {
24
- id: generateRandomId(),
25
- message: data.message,
26
- translatedMessage: data.translatedMessage,
27
- isOwnMessage: false,
28
- options: [],
29
- threadId: '',
30
- endMessage: true,
31
- }
32
- }
33
-
34
- public static createOwn({
35
- message = '',
36
- translatedMessage,
37
- threadId,
38
- }: OwnMessageProps): ConversationMessage {
39
- return {
40
- id: generateRandomId(),
41
- message,
42
- translatedMessage,
43
- threadId: threadId || '',
44
- isOwnMessage: true,
45
- options: [],
46
- }
47
- }
48
- }
@@ -1,58 +0,0 @@
1
- import {
2
- AddTranslationToAlternativesProps,
3
- GetOptionsProps,
4
- GetOptionsResult,
5
- } from '../types/translation.types'
6
- import { ChatAnswer, GetAlternativesResponse } from '../types/api.types'
7
-
8
- export function getOptionsForTranslation({
9
- lastMessage,
10
- alternatives,
11
- }: GetOptionsProps): GetOptionsResult {
12
- if (!lastMessage) return { lastMessage: null, alternatives: null }
13
- if (!lastMessage.options.length) {
14
- if (!alternatives) return { lastMessage: null, alternatives: null }
15
- const hintAlternatives = alternatives.options.hints ?? []
16
- const defaultAlternatives = alternatives.options.default ?? []
17
- return {
18
- lastMessage: null,
19
- alternatives: {
20
- hints: hintAlternatives.map(({ text }) => text),
21
- default: defaultAlternatives.map(({ text }) => text),
22
- },
23
- }
24
- }
25
-
26
- return {
27
- lastMessage: lastMessage.options.map(({ text }) => text),
28
- alternatives: null,
29
- }
30
- }
31
-
32
- export function addTranslationsToAlternative({
33
- alternatives,
34
- translatedHints,
35
- translatedDefaults,
36
- }: AddTranslationToAlternativesProps): GetAlternativesResponse {
37
- return {
38
- ...alternatives,
39
- options: {
40
- ...alternatives.options,
41
- hints: translatedHints.map((translatedText, index) => ({
42
- ...alternatives.options.hints[index],
43
- translatedText,
44
- })),
45
- default: translatedDefaults.map((translatedText, index) => ({
46
- ...alternatives.options.default[index],
47
- translatedText,
48
- })),
49
- },
50
- }
51
- }
52
-
53
- export function addTranslationToOptions(options: ChatAnswer[], translations: string[]) {
54
- return options.map((option, index) => ({
55
- ...option,
56
- translatedText: translations[index],
57
- }))
58
- }
@@ -1 +0,0 @@
1
- export type AccomplishTo<T, To> = Partial<Omit<To, keyof T>> & T