@magmamath/students-features 0.3.0-rc.9 → 0.3.0

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 (139) hide show
  1. package/dist/commonjs/features/chatbot/components/Alternatives/Alternatives.js +6 -9
  2. package/dist/commonjs/features/chatbot/components/Alternatives/Alternatives.js.map +1 -1
  3. package/dist/commonjs/features/chatbot/components/ChatControls/ChatControls.js +13 -5
  4. package/dist/commonjs/features/chatbot/components/ChatControls/ChatControls.js.map +1 -1
  5. package/dist/commonjs/features/chatbot/components/ChatMessage/MessageLoader.js +4 -3
  6. package/dist/commonjs/features/chatbot/components/ChatMessage/MessageLoader.js.map +1 -1
  7. package/dist/commonjs/features/chatbot/components/ChatMessage/MessageTextToSpeech.js +2 -3
  8. package/dist/commonjs/features/chatbot/components/ChatMessage/MessageTextToSpeech.js.map +1 -1
  9. package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js +5 -4
  10. package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -1
  11. package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js +6 -9
  12. package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -1
  13. package/dist/commonjs/features/chatbot/components/Chatbot.js +8 -9
  14. package/dist/commonjs/features/chatbot/components/Chatbot.js.map +1 -1
  15. package/dist/commonjs/features/chatbot/model/ChatBotModel.js +70 -88
  16. package/dist/commonjs/features/chatbot/model/ChatBotModel.js.map +1 -1
  17. package/dist/commonjs/features/chatbot/model/api.js.map +1 -1
  18. package/dist/commonjs/features/chatbot/model/messagesHelper.js +46 -0
  19. package/dist/commonjs/features/chatbot/model/messagesHelper.js.map +1 -0
  20. package/dist/commonjs/features/chatbot/model/translation.helpers.js +69 -0
  21. package/dist/commonjs/features/chatbot/model/translation.helpers.js.map +1 -0
  22. package/dist/commonjs/features/chatbot/model/translation.js +106 -135
  23. package/dist/commonjs/features/chatbot/model/translation.js.map +1 -1
  24. package/dist/commonjs/features/chatbot/types/model.types.js.map +1 -1
  25. package/dist/commonjs/index.js +9 -1
  26. package/dist/commonjs/index.js.map +1 -1
  27. package/dist/commonjs/lib/helpers/types.js +2 -0
  28. package/dist/commonjs/lib/helpers/types.js.map +1 -0
  29. package/dist/commonjs/shared/icons/ChatbotIcon.js +613 -106
  30. package/dist/commonjs/shared/icons/ChatbotIcon.js.map +1 -1
  31. package/dist/module/features/chatbot/components/Alternatives/Alternatives.js +6 -9
  32. package/dist/module/features/chatbot/components/Alternatives/Alternatives.js.map +1 -1
  33. package/dist/module/features/chatbot/components/ChatControls/ChatControls.js +13 -5
  34. package/dist/module/features/chatbot/components/ChatControls/ChatControls.js.map +1 -1
  35. package/dist/module/features/chatbot/components/ChatMessage/MessageLoader.js +4 -3
  36. package/dist/module/features/chatbot/components/ChatMessage/MessageLoader.js.map +1 -1
  37. package/dist/module/features/chatbot/components/ChatMessage/MessageTextToSpeech.js +2 -3
  38. package/dist/module/features/chatbot/components/ChatMessage/MessageTextToSpeech.js.map +1 -1
  39. package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js +5 -4
  40. package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -1
  41. package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js +6 -9
  42. package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -1
  43. package/dist/module/features/chatbot/components/Chatbot.js +8 -9
  44. package/dist/module/features/chatbot/components/Chatbot.js.map +1 -1
  45. package/dist/module/features/chatbot/index.js.map +1 -1
  46. package/dist/module/features/chatbot/model/ChatBotModel.js +71 -89
  47. package/dist/module/features/chatbot/model/ChatBotModel.js.map +1 -1
  48. package/dist/module/features/chatbot/model/api.js.map +1 -1
  49. package/dist/module/features/chatbot/model/messagesHelper.js +41 -0
  50. package/dist/module/features/chatbot/model/messagesHelper.js.map +1 -0
  51. package/dist/module/features/chatbot/model/translation.helpers.js +63 -0
  52. package/dist/module/features/chatbot/model/translation.helpers.js.map +1 -0
  53. package/dist/module/features/chatbot/model/translation.js +107 -136
  54. package/dist/module/features/chatbot/model/translation.js.map +1 -1
  55. package/dist/module/features/chatbot/types/model.types.js.map +1 -1
  56. package/dist/module/index.js +1 -0
  57. package/dist/module/index.js.map +1 -1
  58. package/dist/module/lib/helpers/types.js +2 -0
  59. package/dist/module/lib/helpers/types.js.map +1 -0
  60. package/dist/module/shared/icons/ChatbotIcon.js +614 -107
  61. package/dist/module/shared/icons/ChatbotIcon.js.map +1 -1
  62. package/dist/typescript/commonjs/features/chatbot/components/Alternatives/Alternatives.d.ts.map +1 -1
  63. package/dist/typescript/commonjs/features/chatbot/components/ChatControls/ChatControls.d.ts +5 -1
  64. package/dist/typescript/commonjs/features/chatbot/components/ChatControls/ChatControls.d.ts.map +1 -1
  65. package/dist/typescript/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +1 -1
  66. package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts +5 -1
  67. package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts.map +1 -1
  68. package/dist/typescript/commonjs/features/chatbot/index.d.ts +2 -1
  69. package/dist/typescript/commonjs/features/chatbot/index.d.ts.map +1 -1
  70. package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts +12 -6
  71. package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
  72. package/dist/typescript/commonjs/features/chatbot/model/api.d.ts +5 -7
  73. package/dist/typescript/commonjs/features/chatbot/model/api.d.ts.map +1 -1
  74. package/dist/typescript/commonjs/features/chatbot/model/messagesHelper.d.ts +21 -0
  75. package/dist/typescript/commonjs/features/chatbot/model/messagesHelper.d.ts.map +1 -0
  76. package/dist/typescript/commonjs/features/chatbot/model/translation.d.ts +9 -9
  77. package/dist/typescript/commonjs/features/chatbot/model/translation.d.ts.map +1 -1
  78. package/dist/typescript/commonjs/features/chatbot/model/translation.helpers.d.ts +10 -0
  79. package/dist/typescript/commonjs/features/chatbot/model/translation.helpers.d.ts.map +1 -0
  80. package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts +1 -0
  81. package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts.map +1 -1
  82. package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts +6 -3
  83. package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts.map +1 -1
  84. package/dist/typescript/commonjs/features/chatbot/types/translation.types.d.ts +20 -5
  85. package/dist/typescript/commonjs/features/chatbot/types/translation.types.d.ts.map +1 -1
  86. package/dist/typescript/commonjs/index.d.ts +1 -0
  87. package/dist/typescript/commonjs/index.d.ts.map +1 -1
  88. package/dist/typescript/commonjs/lib/helpers/types.d.ts +2 -0
  89. package/dist/typescript/commonjs/lib/helpers/types.d.ts.map +1 -0
  90. package/dist/typescript/commonjs/shared/icons/ChatbotIcon.d.ts.map +1 -1
  91. package/dist/typescript/module/features/chatbot/components/Alternatives/Alternatives.d.ts.map +1 -1
  92. package/dist/typescript/module/features/chatbot/components/ChatControls/ChatControls.d.ts +5 -1
  93. package/dist/typescript/module/features/chatbot/components/ChatControls/ChatControls.d.ts.map +1 -1
  94. package/dist/typescript/module/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +1 -1
  95. package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts +5 -1
  96. package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts.map +1 -1
  97. package/dist/typescript/module/features/chatbot/index.d.ts +2 -1
  98. package/dist/typescript/module/features/chatbot/index.d.ts.map +1 -1
  99. package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts +12 -6
  100. package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
  101. package/dist/typescript/module/features/chatbot/model/api.d.ts +5 -7
  102. package/dist/typescript/module/features/chatbot/model/api.d.ts.map +1 -1
  103. package/dist/typescript/module/features/chatbot/model/messagesHelper.d.ts +21 -0
  104. package/dist/typescript/module/features/chatbot/model/messagesHelper.d.ts.map +1 -0
  105. package/dist/typescript/module/features/chatbot/model/translation.d.ts +9 -9
  106. package/dist/typescript/module/features/chatbot/model/translation.d.ts.map +1 -1
  107. package/dist/typescript/module/features/chatbot/model/translation.helpers.d.ts +10 -0
  108. package/dist/typescript/module/features/chatbot/model/translation.helpers.d.ts.map +1 -0
  109. package/dist/typescript/module/features/chatbot/types/api.types.d.ts +1 -0
  110. package/dist/typescript/module/features/chatbot/types/api.types.d.ts.map +1 -1
  111. package/dist/typescript/module/features/chatbot/types/model.types.d.ts +6 -3
  112. package/dist/typescript/module/features/chatbot/types/model.types.d.ts.map +1 -1
  113. package/dist/typescript/module/features/chatbot/types/translation.types.d.ts +20 -5
  114. package/dist/typescript/module/features/chatbot/types/translation.types.d.ts.map +1 -1
  115. package/dist/typescript/module/index.d.ts +1 -0
  116. package/dist/typescript/module/index.d.ts.map +1 -1
  117. package/dist/typescript/module/lib/helpers/types.d.ts +2 -0
  118. package/dist/typescript/module/lib/helpers/types.d.ts.map +1 -0
  119. package/dist/typescript/module/shared/icons/ChatbotIcon.d.ts.map +1 -1
  120. package/package.json +1 -1
  121. package/src/features/chatbot/components/Alternatives/Alternatives.tsx +4 -9
  122. package/src/features/chatbot/components/ChatControls/ChatControls.tsx +6 -3
  123. package/src/features/chatbot/components/ChatMessage/MessageLoader.tsx +3 -2
  124. package/src/features/chatbot/components/ChatMessage/MessageTextToSpeech.tsx +1 -2
  125. package/src/features/chatbot/components/ChatMessage/ReceivedMessage.tsx +4 -3
  126. package/src/features/chatbot/components/ChatMessages/ChatbotMessages.tsx +4 -9
  127. package/src/features/chatbot/components/Chatbot.tsx +5 -8
  128. package/src/features/chatbot/index.ts +7 -1
  129. package/src/features/chatbot/model/ChatBotModel.ts +63 -88
  130. package/src/features/chatbot/model/api.ts +24 -33
  131. package/src/features/chatbot/model/messagesHelper.ts +48 -0
  132. package/src/features/chatbot/model/translation.helpers.ts +58 -0
  133. package/src/features/chatbot/model/translation.ts +112 -160
  134. package/src/features/chatbot/types/api.types.ts +1 -0
  135. package/src/features/chatbot/types/model.types.ts +7 -3
  136. package/src/features/chatbot/types/translation.types.ts +21 -5
  137. package/src/index.ts +1 -0
  138. package/src/lib/helpers/types.ts +1 -0
  139. package/src/shared/icons/ChatbotIcon.tsx +500 -85
@@ -0,0 +1,21 @@
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
@@ -0,0 +1 @@
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,5 +1,5 @@
1
- import { type Effect, Store, EventCallable } from 'effector';
2
- import { TranslateAlternativesFxProps, TranslateBatchFxProps, TranslateMessageFxProps } from '../types/translation.types';
1
+ import { EventCallable, Store } from 'effector';
2
+ import { TranslateMessageFxProps } from '../types/translation.types';
3
3
  import { ChatbotModelProps, ConversationMessage } from '../types/model.types';
4
4
  import { GetAlternativesResponse } from '../types/api.types';
5
5
  import { ChatbotAPI } from './api';
@@ -22,16 +22,16 @@ export declare class ChatbotTranslation {
22
22
  private readonly alternativesModel;
23
23
  readonly setIsTranslated: EventCallable<boolean>;
24
24
  readonly $isTranslated: import("effector").StoreWritable<boolean>;
25
- readonly translateMessageFx: Effect<TranslateMessageFxProps, ConversationMessage>;
26
- readonly translateBatchFx: Effect<TranslateBatchFxProps['params'], ConversationMessage[]>;
27
- readonly translateAlternativesFx: Effect<TranslateAlternativesFxProps['params'], GetAlternativesResponse | null>;
25
+ readonly translateAllMessagesFx: import("effector").Effect<{
26
+ targetLanguage: string;
27
+ }, ConversationMessage[], Error>;
28
28
  constructor({ api, $key, defaultMessages, messagesModel, alternativesModel, }: ChatbotTranslationProps);
29
29
  private shouldSkipTranslation;
30
30
  private initTranslationSamples;
31
- private createTranslateAlternativesEffect;
32
- private createTranslateMessageEffect;
33
- private createTranslateBatchEffect;
34
- private translateMessageOptions;
31
+ private translateRequest;
32
+ private addTranslationToAlternatives;
33
+ private readonly translateBatchFx;
34
+ readonly translateMessagesFx: import("effector").Effect<TranslateMessageFxProps, ConversationMessage[], Error>;
35
35
  reset(): void;
36
36
  }
37
37
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"translation.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/model/translation.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,MAAM,EAEX,KAAK,EACL,aAAa,EACd,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,4BAA4B,EAC5B,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,iBAAiB,EAAE,mB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AAO,CAAC,QAAQ,CAAC,iBAAiB,CAAA;IAElC,QAAQ,CAAC,eAAe,yBAAyB;IACjD,QAAQ,CAAC,aAAa,4CAAuC;IAE7D,QAAQ,CAAC,sBAAsB;;qCAAA;gBAEnB,EACV,GAAG,EACH,IAAI,EACJ,eAAe,EACf,aAAa,EACb,iBAAiB,GAClB,EAAE,uBAAuB;IAmB1B,OAAO,CAAC,qBAAqB;IAe7B,OAAO,CAAC,sBAAsB;YAShB,gBAAgB;IAmB9B,OAAO,CAAC,4BAA4B;IAIpC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAkDhC;IAED,SAAgB,mBAAmB,mFA0BlC;IAEM,KAAK;CAGb"}
@@ -0,0 +1,10 @@
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
@@ -0,0 +1 @@
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"}
@@ -32,6 +32,7 @@ export type PostMessageResponse = {
32
32
  message: string;
33
33
  threadId: string;
34
34
  options: ChatAnswer[];
35
+ endMessage?: boolean;
35
36
  };
36
37
  export type GoogleTranslatePayload = {
37
38
  text: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"api.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/api.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,cAAc,EAAE,MAAM,CAAA;IACtB,oBAAoB,EAAE,MAAM,CAAA;CAC7B,GAAG,IAAI,CAAA;AAER,MAAM,MAAM,uBAAuB,GAAG;IACpC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,OAAO,EAAE;QACP,OAAO,EAAE,UAAU,EAAE,CAAA;QACrB,KAAK,EAAE,UAAU,EAAE,CAAA;KACpB,CAAA;CACF,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,cAAc,EAAE;QAAE,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAA;IAChD,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC1B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,UAAU,EAAE,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,cAAc,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE;QACJ,YAAY,EAAE;YAAE,cAAc,EAAE,MAAM,CAAC;YAAC,sBAAsB,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;KAC3E,CAAA;CACF,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;IACD,KAAK,EAAE;QACL,YAAY,EAAE,MAAM,CAAA;QACpB,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;IACD,WAAW,EAAE;QACX,aAAa,EAAE,MAAM,CAAA;QACrB,KAAK,EAAE,MAAM,CAAA;QACb,YAAY,EAAE,MAAM,CAAA;KACrB,CAAA;CACF,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG,MAAM,GAAG,SAAS,GAAG;IAAE,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA"}
1
+ {"version":3,"file":"api.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/api.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,cAAc,EAAE,MAAM,CAAA;IACtB,oBAAoB,EAAE,MAAM,CAAA;CAC7B,GAAG,IAA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Y,EAAE,MAAM,CAAA;QACpB,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;IACD,WAAW,EAAE;QACX,aAAa,EAAE,MAAM,CAAA;QACrB,KAAK,EAAE,MAAM,CAAA;QACb,YAAY,EAAE,MAAM,CAAA;KACrB,CAAA;CACF,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG,MAAM,GAAG,SAAS,GAAG;IAAE,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA"}
@@ -1,5 +1,6 @@
1
1
  import type { Store } from 'effector';
2
2
  import { GetAlternativesResponse, PostMessagePayload, PostMessageResponse, GoogleTranslatePayload, GoogleTranslateResponse, GoogleText2SpeechPayload, GoogleText2SpeechResponse, ChatAnswer, GetAlternativesPayload } from './api.types';
3
+ import { AccomplishTo } from '../../../lib/helpers/types';
3
4
  export type ConversationMessage = {
4
5
  id: string;
5
6
  message: string;
@@ -7,6 +8,7 @@ export type ConversationMessage = {
7
8
  options: ChatAnswer[];
8
9
  isOwnMessage: boolean;
9
10
  translatedMessage?: string;
11
+ endMessage?: boolean;
10
12
  };
11
13
  export type ChatbotModelProps = {
12
14
  $key?: Store<string>;
@@ -19,6 +21,8 @@ export type ChatbotModelProps = {
19
21
  messages: {
20
22
  error: ConversationMessage;
21
23
  start: ConversationMessage;
24
+ endMessage: ConversationMessage;
25
+ anotherHintOption: ChatAnswer;
22
26
  };
23
27
  };
24
28
  export type SendHelpParams = {
@@ -29,12 +33,10 @@ export type SendHelpParams = {
29
33
  };
30
34
  export type SendHelpProps = SendHelpParams & {
31
35
  key: string;
32
- messages: Record<string, ConversationMessage[]>;
33
36
  isTranslated: boolean;
34
37
  };
35
38
  export type SetHintMessageProps = {
36
- entityId: string;
37
- fieldId: string;
39
+ key: string;
38
40
  } & ConversationMessage;
39
41
  export type StartConversationFxData = {
40
42
  key: string;
@@ -49,4 +51,5 @@ export type ChatbotRenderer = {
49
51
  variant: MessageVariant;
50
52
  withTextToSpeech: boolean;
51
53
  };
54
+ export type CreateMessageResponse = AccomplishTo<PostMessageResponse, ConversationMessage>;
52
55
  //# sourceMappingURL=model.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"model.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/model.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,UAAU,EACV,sBAAsB,EACvB,MAAM,aAAa,CAAA;AAEpB,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,UAAU,EAAE,CAAA;IACrB,YAAY,EAAE,OAAO,CAAA;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IACpB,GAAG,EAAE;QACH,eAAe,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAA;QACpF,WAAW,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAA;QACxE,iBAAiB,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAA;QACtF,gBAAgB,EAAE,CAAC,KAAK,EAAE,wBAAwB,KAAK,OAAO,CAAC,yBAAyB,CAAC,CAAA;KAC1F,CAAA;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,mBAAmB,CAAA;QAC1B,KAAK,EAAE,mBAAmB,CAAA;KAC3B,CAAA;CACF,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,kBAAkB,CAAA;IAC3B,OAAO,EAAE,MAAM,CAAA;IACf,yBAAyB,EAAE,MAAM,CAAA;IACjC,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG;IAC3C,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,EAAE,CAAC,CAAA;IAC/C,YAAY,EAAE,OAAO,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAChB,GAAG,mBAAmB,CAAA;AAEvB,MAAM,MAAM,uBAAuB,GAAG;IACpC,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,mBAAmB,EAAE,CAAA;CAChC,CAAA;AAED,oBAAY,cAAc;IACxB,IAAI,SAAS;IACb,QAAQ,aAAa;CACtB;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,cAAc,CAAA;IACvB,gBAAgB,EAAE,OAAO,CAAA;CAC1B,CAAA"}
1
+ {"version":3,"file":"model.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/model.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,UAAU,EACV,sBAAsB,EACvB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAEzD,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IACh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EAAE,mBAAmB,EAAE,CAAA;CAChC,CAAA;AAED,oBAAY,cAAc;IACxB,IAAI,SAAS;IACb,QAAQ,aAAa;CACtB;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,cAAc,CAAA;IACvB,gBAAgB,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG,YAAY,CAAC,mBAAmB,EAAE,mBAAmB,CAAC,CAAA"}
@@ -5,15 +5,30 @@ export type TranslateBatchFxProps = {
5
5
  params: {
6
6
  targetLanguage: string;
7
7
  };
8
+ alternatives: GetAlternativesResponse | null;
8
9
  };
9
10
  export type TranslateMessageFxProps = {
10
- message: ConversationMessage;
11
+ messages: ConversationMessage[];
11
12
  targetLanguage: string;
12
13
  };
13
- export type TranslateAlternativesFxProps = {
14
+ export type AddTranslationToAlternativesProps = {
15
+ alternatives: GetAlternativesResponse;
16
+ translatedHints: string[];
17
+ translatedDefaults: string[];
18
+ };
19
+ export type GetOptionsProps = {
14
20
  alternatives: GetAlternativesResponse | null;
15
- params: {
16
- targetLanguage: string;
17
- };
21
+ lastMessage: ConversationMessage | undefined;
22
+ };
23
+ export type GetOptionsResult = {
24
+ lastMessage: string[] | null;
25
+ alternatives: {
26
+ hints: string[];
27
+ default: string[];
28
+ } | null;
29
+ };
30
+ export type TranslateRequestProps<List extends Record<string, string[]>> = {
31
+ textList: List;
32
+ targetLanguage: string;
18
33
  };
19
34
  //# sourceMappingURL=translation.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"translation.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/translation.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAErD,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,mBAAmB,EAAE,CAAA;IAC/B,MAAM,EAAE;QACN,cAAc,EAAE,MAAM,CAAA;KACvB,CAAA;CACF,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,mBAAmB,CAAA;IAC5B,cAAc,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG;IACzC,YAAY,EAAE,uBAAuB,GAAG,IAAI,CAAA;IAC5C,MAAM,EAAE;QACN,cAAc,EAAE,MAAM,CAAA;KACvB,CAAA;CACF,CAAA"}
1
+ {"version":3,"file":"translation.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/translation.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAErD,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,mBAAmB,EAAE,CAAA;IAC/B,MAAM,EAAE;QACN,cAAc,EAAE,MAAM,CAAA;KACvB,CAAA;IACD,YAAY,EAAE,uBAAuB,GAAG,IAAI,CAAA;CAC7C,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,mBAAmB,EAAE,CAAA;IAC/B,cAAc,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,iCAAiC,GAAG;IAC9C,YAAY,EAAE,uBAAuB,CAAA;IACrC,eAAe,EAAE,MAAM,EAAE,CAAA;IACzB,kBAAkB,EAAE,MAAM,EAAE,CAAA;CAC7B,CAAA;AACD,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY,EAAE,uBAAuB,GAAG,IAAI,CAAA;IAC5C,WAAW,EAAE,mBAAmB,GAAG,SAAS,CAAA;CAC7C,CAAA;AACD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,WAAW,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IAC5B,YAAY,EAAE;QACZ,KAAK,EAAE,MAAM,EAAE,CAAA;QACf,OAAO,EAAE,MAAM,EAAE,CAAA;KAClB,GAAG,IAAI,CAAA;CACT,CAAA;AAED,MAAM,MAAM,qBAAqB,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,IAAI;IACzE,QAAQ,EAAE,IAAI,CAAA;IACd,cAAc,EAAE,MAAM,CAAA;CACvB,CAAA"}
@@ -1,5 +1,6 @@
1
1
  export { useFeaturesLocalization, setFeaturesLocalization, Locale } from './shared/translation';
2
2
  export type { LocalizationConfig } from './shared/translation';
3
+ export { generateRandomId } from './lib/helpers/helpers';
3
4
  export * from './features/chatbot';
4
5
  export * from './features/feedback';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC/F,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAC9D,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC/F,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export type AccomplishTo<T, To> = Partial<Omit<To, keyof T>> & T;
2
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
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 +1 @@
1
- {"version":3,"file":"ChatbotIcon.d.ts","sourceRoot":"","sources":["../../../../../src/shared/icons/ChatbotIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,eAAO,MAAM,WAAW,sBAAiC,SAAS,sBAwGjE,CAAA"}
1
+ {"version":3,"file":"ChatbotIcon.d.ts","sourceRoot":"","sources":["../../../../../src/shared/icons/ChatbotIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,eAAO,MAAM,WAAW,sBAAiC,SAAS,sBAugBjE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magmamath/students-features",
3
- "version": "0.3.0-rc.9",
3
+ "version": "0.3.0",
4
4
  "description": "Magmamath features library",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/commonjs/index.js",
@@ -18,17 +18,12 @@ export const Alternatives = ({
18
18
  hasMessages,
19
19
  isHintFeedback,
20
20
  }: AlternativesProps) => {
21
- const key = useUnit(model.$currentKey)
22
21
  const isTranslated = useUnit(model.translation.$isTranslated)
23
22
  const alternatives = useUnit(model.$alternatives)
24
- const isTranslationPending = useUnit(model.translation.translateBatchFx.pending)
25
- const lastMessageOptions = useStoreMap({
26
- store: model.messages.$state,
27
- keys: [key],
28
- fn: (state) => {
29
- const lastMessage = state[key]?.at(-1)
30
- return lastMessage ? lastMessage.options : []
31
- },
23
+ const isTranslationPending = useUnit(model.translation.translateAllMessagesFx.pending)
24
+ const lastMessageOptions = useStoreMap(model.$currentChatData, ({ messages }) => {
25
+ const lastMessage = messages.at(-1)
26
+ return lastMessage?.options ?? []
32
27
  })
33
28
 
34
29
  const options = (() => {
@@ -22,6 +22,7 @@ type ChatControlsProps = {
22
22
  onPressClose: () => void
23
23
  isTranslationEnabled: boolean
24
24
  ButtonWrapper: ComponentType<PropsWithChildren>
25
+ iconSize?: { width: number; height: number }
25
26
  }
26
27
 
27
28
  export const ChatControls = ({
@@ -31,10 +32,11 @@ export const ChatControls = ({
31
32
  onPressClose,
32
33
  isTranslationEnabled,
33
34
  ButtonWrapper,
35
+ iconSize = { width: 80, height: 100 },
34
36
  }: ChatControlsProps) => {
35
37
  const isOpen = useUnit(model.$isOpen)
36
38
  const isTranslated = useUnit(model.translation.$isTranslated)
37
- const isTranslationPending = useUnit(model.translation.translateBatchFx.pending)
39
+ const isTranslationPending = useUnit(model.translation.translateAllMessagesFx.pending)
38
40
  const isHelpRequestPending = useUnit(model.sendHelpRequestFx.pending)
39
41
 
40
42
  if (isOpen) {
@@ -85,7 +87,7 @@ export const ChatControls = ({
85
87
  <View style={styles.container}>
86
88
  <ButtonWrapper>
87
89
  <Pressable onPress={onPressChatIcon}>
88
- <ChatbotIcon />
90
+ <ChatbotIcon width={iconSize?.width} height={iconSize?.height} />
89
91
  </Pressable>
90
92
  </ButtonWrapper>
91
93
  </View>
@@ -97,8 +99,9 @@ const styles = StyleSheet.create({
97
99
  alignItems: 'center',
98
100
  justifyContent: 'flex-end',
99
101
  flexDirection: 'row',
100
- height: 60,
102
+ maxHeight: 100,
101
103
  gap: 8,
104
+ paddingBottom: 5,
102
105
  },
103
106
  buttonClose: {
104
107
  width: 50,
@@ -6,7 +6,7 @@ import { ThreeDotsLoader } from '../ThreeDotsLoader/ThreeDotsLoader'
6
6
  export const MessageLoader = () => (
7
7
  <View style={styles.container}>
8
8
  <View style={styles.icon}>
9
- <ChatbotIcon width={38} height={38} />
9
+ <ChatbotIcon width={60} height={80} />
10
10
  </View>
11
11
  <View style={styles.loader}>
12
12
  <ThreeDotsLoader />
@@ -17,7 +17,8 @@ export const MessageLoader = () => (
17
17
  const styles = StyleSheet.create({
18
18
  container: {
19
19
  flexDirection: 'row',
20
- width: 305,
20
+ width: 327,
21
+ alignItems: 'flex-end',
21
22
  },
22
23
  icon: {
23
24
  alignSelf: 'flex-end',
@@ -53,10 +53,9 @@ export const MessageTextToSpeech = ({
53
53
 
54
54
  const styles = StyleSheet.create({
55
55
  container: {
56
- alignSelf: 'flex-end',
56
+ alignSelf: 'stretch',
57
57
  justifyContent: 'flex-end',
58
58
  width: 45,
59
- height: '100%',
60
59
  },
61
60
  button: {
62
61
  alignItems: 'center',
@@ -16,7 +16,7 @@ export const ReceivedMessage = ({
16
16
  }: VariantProps) => (
17
17
  <View style={styles.container}>
18
18
  <View style={styles.icon}>
19
- <ChatbotIcon width={38} height={38} />
19
+ <ChatbotIcon width={60} height={80} />
20
20
  </View>
21
21
 
22
22
  <View style={styles.message}>
@@ -42,8 +42,9 @@ const styles = StyleSheet.create({
42
42
  container: {
43
43
  flex: 1,
44
44
  flexDirection: 'row',
45
- maxWidth: 350,
46
- width: 350,
45
+ maxWidth: 372,
46
+ width: 372,
47
+ alignItems: 'flex-end',
47
48
  },
48
49
  icon: {
49
50
  alignSelf: 'flex-end',
@@ -25,8 +25,8 @@ type ChatbotMessagesProps = {
25
25
 
26
26
  const TOOLBAR_HEIGHT = 140
27
27
  const BOTTOM_OFFSET = Platform.select({
28
- web: 250,
29
- default: 284,
28
+ web: 265,
29
+ default: 294,
30
30
  })
31
31
 
32
32
  export const ChatbotMessages = ({
@@ -41,7 +41,6 @@ export const ChatbotMessages = ({
41
41
  }: ChatbotMessagesProps) => {
42
42
  const dimensions = useWindowDimensions()
43
43
  const ref = useRef<ScrollView>(null)
44
- const currentKey = useUnit(model.$currentKey)
45
44
  const isOpen = useUnit(model.$isOpen)
46
45
 
47
46
  const isHelpRequestPending = useUnit(model.sendHelpRequestFx.pending)
@@ -53,11 +52,7 @@ export const ChatbotMessages = ({
53
52
 
54
53
  const MAX_HEIGHT = dimensions.height - TOOLBAR_HEIGHT - BOTTOM_OFFSET
55
54
 
56
- const messages = useStoreMap({
57
- store: model.messages.$state,
58
- keys: [currentKey],
59
- fn: state => state[currentKey] ?? [],
60
- })
55
+ const messages = useStoreMap(model.$currentChatData, ({ messages }) => messages)
61
56
 
62
57
  const playTextToSpeech = (id: string, message: string, translatedMessage?: string) => {
63
58
  const text = isTranslated ? (translatedMessage as string) : message
@@ -128,7 +123,7 @@ const styles = StyleSheet.create({
128
123
  container: {
129
124
  flex: 1,
130
125
  alignItems: 'flex-end',
131
- width: 350,
126
+ width: 372,
132
127
  height: '100%',
133
128
  },
134
129
  list: {
@@ -22,6 +22,7 @@ type ChatbotProps = {
22
22
  }
23
23
  ButtonWrapper: ComponentType<PropsWithChildren>
24
24
  renderer?: (props: ChatbotRenderer) => ReactNode
25
+ iconSize?: { width: number; height: number } // TODO: use number instead
25
26
  }
26
27
 
27
28
  export const Chatbot = ({
@@ -35,18 +36,13 @@ export const Chatbot = ({
35
36
  isTranslationEnabled,
36
37
  renderer,
37
38
  ButtonWrapper,
39
+ iconSize,
38
40
  }: ChatbotProps) => {
39
- const currentKey = useUnit(model.$currentKey)
40
41
  const alternatives = useUnit(model.$alternatives)
41
-
42
- const isAvailable = useStoreMap({
43
- store: model.availableChats.$state,
44
- keys: [currentKey],
45
- fn: state => !!state[currentKey],
46
- })
42
+ const isAvailable = useStoreMap(model.$currentChatData, ({ isAvailable }) => isAvailable)
47
43
 
48
44
  const translateMessages = () => {
49
- void model.translation.translateBatchFx({
45
+ void model.translation.translateAllMessagesFx({
50
46
  targetLanguage: translationTargetLanguage,
51
47
  })
52
48
  }
@@ -78,6 +74,7 @@ export const Chatbot = ({
78
74
  onPressClose={closeChat}
79
75
  isTranslationEnabled={isTranslationEnabled}
80
76
  ButtonWrapper={ButtonWrapper}
77
+ iconSize={iconSize}
81
78
  />
82
79
  </>
83
80
  )
@@ -1,4 +1,10 @@
1
1
  export { Chatbot } from './components/Chatbot'
2
2
  export { ChatbotModel } from './model/ChatBotModel'
3
3
  export { AudioStatus, type AudioProvider } from './types/t2s.types'
4
- export { MessageVariant, type ConversationMessage, type ChatbotRenderer } from './types/model.types'
4
+ export {
5
+ MessageVariant,
6
+ type ConversationMessage,
7
+ type ChatbotRenderer,
8
+ type ChatbotModelProps,
9
+ } from './types/model.types'
10
+ export type { PostMessageResponse, ChatAnswer } from './types/api.types'