@magmamath/students-features 0.6.6-rc.8 → 0.6.6

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 (192) hide show
  1. package/dist/commonjs/features/chatbot/components/ChatMessage/ChatMessage.js.map +1 -1
  2. package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js +5 -3
  3. package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -1
  4. package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js +3 -1
  5. package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -1
  6. package/dist/commonjs/features/feedback/model/comments.js +5 -3
  7. package/dist/commonjs/features/feedback/model/comments.js.map +1 -1
  8. package/dist/commonjs/features/feedback/model/model.js +7 -9
  9. package/dist/commonjs/features/feedback/model/model.js.map +1 -1
  10. package/dist/commonjs/index.js +0 -12
  11. package/dist/commonjs/index.js.map +1 -1
  12. package/dist/commonjs/lib/helpers/helpers.js.map +1 -1
  13. package/dist/commonjs/shared/translation/localization/en.json +0 -5
  14. package/dist/commonjs/shared/translation/localization/gb.json +0 -5
  15. package/dist/commonjs/shared/translation/localization/sw.json +0 -5
  16. package/dist/module/features/chatbot/components/ChatMessage/ChatMessage.js.map +1 -1
  17. package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js +5 -3
  18. package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -1
  19. package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js +3 -1
  20. package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -1
  21. package/dist/module/features/feedback/model/comments.js +5 -3
  22. package/dist/module/features/feedback/model/comments.js.map +1 -1
  23. package/dist/module/features/feedback/model/model.js +7 -9
  24. package/dist/module/features/feedback/model/model.js.map +1 -1
  25. package/dist/module/index.js +0 -1
  26. package/dist/module/index.js.map +1 -1
  27. package/dist/module/shared/translation/localization/en.json +0 -5
  28. package/dist/module/shared/translation/localization/gb.json +0 -5
  29. package/dist/module/shared/translation/localization/sw.json +0 -5
  30. package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ChatMessage.d.ts +2 -1
  31. package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ChatMessage.d.ts.map +1 -1
  32. package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.d.ts +1 -1
  33. package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.d.ts.map +1 -1
  34. package/dist/typescript/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +1 -1
  35. package/dist/typescript/commonjs/index.d.ts +0 -1
  36. package/dist/typescript/commonjs/index.d.ts.map +1 -1
  37. package/dist/typescript/commonjs/lib/helpers/helpers.d.ts.map +1 -1
  38. package/dist/typescript/commonjs/shared/translation/constants.d.ts +0 -15
  39. package/dist/typescript/commonjs/shared/translation/constants.d.ts.map +1 -1
  40. package/dist/typescript/commonjs/shared/translation/model.d.ts +0 -10
  41. package/dist/typescript/commonjs/shared/translation/model.d.ts.map +1 -1
  42. package/dist/typescript/module/features/chatbot/components/ChatMessage/ChatMessage.d.ts +2 -1
  43. package/dist/typescript/module/features/chatbot/components/ChatMessage/ChatMessage.d.ts.map +1 -1
  44. package/dist/typescript/module/features/chatbot/components/ChatMessage/ReceivedMessage.d.ts +1 -1
  45. package/dist/typescript/module/features/chatbot/components/ChatMessage/ReceivedMessage.d.ts.map +1 -1
  46. package/dist/typescript/module/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +1 -1
  47. package/dist/typescript/module/index.d.ts +0 -1
  48. package/dist/typescript/module/index.d.ts.map +1 -1
  49. package/dist/typescript/module/lib/helpers/helpers.d.ts.map +1 -1
  50. package/dist/typescript/module/shared/translation/constants.d.ts +0 -15
  51. package/dist/typescript/module/shared/translation/constants.d.ts.map +1 -1
  52. package/dist/typescript/module/shared/translation/model.d.ts +0 -10
  53. package/dist/typescript/module/shared/translation/model.d.ts.map +1 -1
  54. package/package.json +5 -3
  55. package/src/features/chatbot/components/ChatMessage/ChatMessage.tsx +2 -1
  56. package/src/features/chatbot/components/ChatMessage/ReceivedMessage.tsx +7 -4
  57. package/src/features/chatbot/components/ChatMessages/ChatbotMessages.tsx +4 -2
  58. package/src/features/feedback/model/comments.ts +7 -7
  59. package/src/features/feedback/model/model.ts +6 -6
  60. package/src/index.ts +0 -1
  61. package/src/lib/helpers/helpers.ts +1 -1
  62. package/src/shared/translation/localization/en.json +0 -5
  63. package/src/shared/translation/localization/gb.json +0 -5
  64. package/src/shared/translation/localization/sw.json +0 -5
  65. package/dist/commonjs/features/gifCelebrations/GifCelebrations.js +0 -65
  66. package/dist/commonjs/features/gifCelebrations/GifCelebrations.js.map +0 -1
  67. package/dist/commonjs/features/gifCelebrations/assets/confetti.webp +0 -0
  68. package/dist/commonjs/features/gifCelebrations/assets/gifFallback.gif +0 -0
  69. package/dist/commonjs/features/gifCelebrations/components/Backdrop.js +0 -44
  70. package/dist/commonjs/features/gifCelebrations/components/Backdrop.js.map +0 -1
  71. package/dist/commonjs/features/gifCelebrations/components/ContentContainer.js +0 -46
  72. package/dist/commonjs/features/gifCelebrations/components/ContentContainer.js.map +0 -1
  73. package/dist/commonjs/features/gifCelebrations/components/Gif.js +0 -94
  74. package/dist/commonjs/features/gifCelebrations/components/Gif.js.map +0 -1
  75. package/dist/commonjs/features/gifCelebrations/components/Progress.js +0 -96
  76. package/dist/commonjs/features/gifCelebrations/components/Progress.js.map +0 -1
  77. package/dist/commonjs/features/gifCelebrations/constants.js +0 -32
  78. package/dist/commonjs/features/gifCelebrations/constants.js.map +0 -1
  79. package/dist/commonjs/features/gifCelebrations/helpers.js +0 -111
  80. package/dist/commonjs/features/gifCelebrations/helpers.js.map +0 -1
  81. package/dist/commonjs/features/gifCelebrations/index.js +0 -20
  82. package/dist/commonjs/features/gifCelebrations/index.js.map +0 -1
  83. package/dist/commonjs/features/gifCelebrations/model/GifCelebrations.cache.js +0 -35
  84. package/dist/commonjs/features/gifCelebrations/model/GifCelebrations.cache.js.map +0 -1
  85. package/dist/commonjs/features/gifCelebrations/model/GifCelebrations.model.js +0 -120
  86. package/dist/commonjs/features/gifCelebrations/model/GifCelebrations.model.js.map +0 -1
  87. package/dist/commonjs/features/gifCelebrations/model/GifCelebrationsApi.js +0 -14
  88. package/dist/commonjs/features/gifCelebrations/model/GifCelebrationsApi.js.map +0 -1
  89. package/dist/commonjs/features/gifCelebrations/types/model.types.js +0 -6
  90. package/dist/commonjs/features/gifCelebrations/types/model.types.js.map +0 -1
  91. package/dist/commonjs/react-app-env.d.js +0 -2
  92. package/dist/commonjs/react-app-env.d.js.map +0 -1
  93. package/dist/commonjs/shared/constants.js +0 -9
  94. package/dist/commonjs/shared/constants.js.map +0 -1
  95. package/dist/module/features/gifCelebrations/GifCelebrations.js +0 -58
  96. package/dist/module/features/gifCelebrations/GifCelebrations.js.map +0 -1
  97. package/dist/module/features/gifCelebrations/assets/confetti.webp +0 -0
  98. package/dist/module/features/gifCelebrations/assets/gifFallback.gif +0 -0
  99. package/dist/module/features/gifCelebrations/components/Backdrop.js +0 -36
  100. package/dist/module/features/gifCelebrations/components/Backdrop.js.map +0 -1
  101. package/dist/module/features/gifCelebrations/components/ContentContainer.js +0 -38
  102. package/dist/module/features/gifCelebrations/components/ContentContainer.js.map +0 -1
  103. package/dist/module/features/gifCelebrations/components/Gif.js +0 -86
  104. package/dist/module/features/gifCelebrations/components/Gif.js.map +0 -1
  105. package/dist/module/features/gifCelebrations/components/Progress.js +0 -88
  106. package/dist/module/features/gifCelebrations/components/Progress.js.map +0 -1
  107. package/dist/module/features/gifCelebrations/constants.js +0 -28
  108. package/dist/module/features/gifCelebrations/constants.js.map +0 -1
  109. package/dist/module/features/gifCelebrations/helpers.js +0 -101
  110. package/dist/module/features/gifCelebrations/helpers.js.map +0 -1
  111. package/dist/module/features/gifCelebrations/index.js +0 -5
  112. package/dist/module/features/gifCelebrations/index.js.map +0 -1
  113. package/dist/module/features/gifCelebrations/model/GifCelebrations.cache.js +0 -30
  114. package/dist/module/features/gifCelebrations/model/GifCelebrations.cache.js.map +0 -1
  115. package/dist/module/features/gifCelebrations/model/GifCelebrations.model.js +0 -115
  116. package/dist/module/features/gifCelebrations/model/GifCelebrations.model.js.map +0 -1
  117. package/dist/module/features/gifCelebrations/model/GifCelebrationsApi.js +0 -9
  118. package/dist/module/features/gifCelebrations/model/GifCelebrationsApi.js.map +0 -1
  119. package/dist/module/features/gifCelebrations/types/model.types.js +0 -4
  120. package/dist/module/features/gifCelebrations/types/model.types.js.map +0 -1
  121. package/dist/module/react-app-env.d.js +0 -2
  122. package/dist/module/react-app-env.d.js.map +0 -1
  123. package/dist/module/shared/constants.js +0 -5
  124. package/dist/module/shared/constants.js.map +0 -1
  125. package/dist/typescript/commonjs/features/gifCelebrations/GifCelebrations.d.ts +0 -10
  126. package/dist/typescript/commonjs/features/gifCelebrations/GifCelebrations.d.ts.map +0 -1
  127. package/dist/typescript/commonjs/features/gifCelebrations/components/Backdrop.d.ts +0 -10
  128. package/dist/typescript/commonjs/features/gifCelebrations/components/Backdrop.d.ts.map +0 -1
  129. package/dist/typescript/commonjs/features/gifCelebrations/components/ContentContainer.d.ts +0 -10
  130. package/dist/typescript/commonjs/features/gifCelebrations/components/ContentContainer.d.ts.map +0 -1
  131. package/dist/typescript/commonjs/features/gifCelebrations/components/Gif.d.ts +0 -10
  132. package/dist/typescript/commonjs/features/gifCelebrations/components/Gif.d.ts.map +0 -1
  133. package/dist/typescript/commonjs/features/gifCelebrations/components/Progress.d.ts +0 -10
  134. package/dist/typescript/commonjs/features/gifCelebrations/components/Progress.d.ts.map +0 -1
  135. package/dist/typescript/commonjs/features/gifCelebrations/constants.d.ts +0 -24
  136. package/dist/typescript/commonjs/features/gifCelebrations/constants.d.ts.map +0 -1
  137. package/dist/typescript/commonjs/features/gifCelebrations/helpers.d.ts +0 -28
  138. package/dist/typescript/commonjs/features/gifCelebrations/helpers.d.ts.map +0 -1
  139. package/dist/typescript/commonjs/features/gifCelebrations/index.d.ts +0 -3
  140. package/dist/typescript/commonjs/features/gifCelebrations/index.d.ts.map +0 -1
  141. package/dist/typescript/commonjs/features/gifCelebrations/model/GifCelebrations.cache.d.ts +0 -16
  142. package/dist/typescript/commonjs/features/gifCelebrations/model/GifCelebrations.cache.d.ts.map +0 -1
  143. package/dist/typescript/commonjs/features/gifCelebrations/model/GifCelebrations.model.d.ts +0 -24
  144. package/dist/typescript/commonjs/features/gifCelebrations/model/GifCelebrations.model.d.ts.map +0 -1
  145. package/dist/typescript/commonjs/features/gifCelebrations/model/GifCelebrationsApi.d.ts +0 -6
  146. package/dist/typescript/commonjs/features/gifCelebrations/model/GifCelebrationsApi.d.ts.map +0 -1
  147. package/dist/typescript/commonjs/features/gifCelebrations/types/model.types.d.ts +0 -37
  148. package/dist/typescript/commonjs/features/gifCelebrations/types/model.types.d.ts.map +0 -1
  149. package/dist/typescript/commonjs/shared/constants.d.ts +0 -2
  150. package/dist/typescript/commonjs/shared/constants.d.ts.map +0 -1
  151. package/dist/typescript/module/features/gifCelebrations/GifCelebrations.d.ts +0 -10
  152. package/dist/typescript/module/features/gifCelebrations/GifCelebrations.d.ts.map +0 -1
  153. package/dist/typescript/module/features/gifCelebrations/components/Backdrop.d.ts +0 -10
  154. package/dist/typescript/module/features/gifCelebrations/components/Backdrop.d.ts.map +0 -1
  155. package/dist/typescript/module/features/gifCelebrations/components/ContentContainer.d.ts +0 -10
  156. package/dist/typescript/module/features/gifCelebrations/components/ContentContainer.d.ts.map +0 -1
  157. package/dist/typescript/module/features/gifCelebrations/components/Gif.d.ts +0 -10
  158. package/dist/typescript/module/features/gifCelebrations/components/Gif.d.ts.map +0 -1
  159. package/dist/typescript/module/features/gifCelebrations/components/Progress.d.ts +0 -10
  160. package/dist/typescript/module/features/gifCelebrations/components/Progress.d.ts.map +0 -1
  161. package/dist/typescript/module/features/gifCelebrations/constants.d.ts +0 -24
  162. package/dist/typescript/module/features/gifCelebrations/constants.d.ts.map +0 -1
  163. package/dist/typescript/module/features/gifCelebrations/helpers.d.ts +0 -28
  164. package/dist/typescript/module/features/gifCelebrations/helpers.d.ts.map +0 -1
  165. package/dist/typescript/module/features/gifCelebrations/index.d.ts +0 -3
  166. package/dist/typescript/module/features/gifCelebrations/index.d.ts.map +0 -1
  167. package/dist/typescript/module/features/gifCelebrations/model/GifCelebrations.cache.d.ts +0 -16
  168. package/dist/typescript/module/features/gifCelebrations/model/GifCelebrations.cache.d.ts.map +0 -1
  169. package/dist/typescript/module/features/gifCelebrations/model/GifCelebrations.model.d.ts +0 -24
  170. package/dist/typescript/module/features/gifCelebrations/model/GifCelebrations.model.d.ts.map +0 -1
  171. package/dist/typescript/module/features/gifCelebrations/model/GifCelebrationsApi.d.ts +0 -6
  172. package/dist/typescript/module/features/gifCelebrations/model/GifCelebrationsApi.d.ts.map +0 -1
  173. package/dist/typescript/module/features/gifCelebrations/types/model.types.d.ts +0 -37
  174. package/dist/typescript/module/features/gifCelebrations/types/model.types.d.ts.map +0 -1
  175. package/dist/typescript/module/shared/constants.d.ts +0 -2
  176. package/dist/typescript/module/shared/constants.d.ts.map +0 -1
  177. package/src/features/gifCelebrations/GifCelebrations.tsx +0 -77
  178. package/src/features/gifCelebrations/assets/confetti.webp +0 -0
  179. package/src/features/gifCelebrations/assets/gifFallback.gif +0 -0
  180. package/src/features/gifCelebrations/components/Backdrop.tsx +0 -41
  181. package/src/features/gifCelebrations/components/ContentContainer.tsx +0 -44
  182. package/src/features/gifCelebrations/components/Gif.tsx +0 -95
  183. package/src/features/gifCelebrations/components/Progress.tsx +0 -106
  184. package/src/features/gifCelebrations/constants.ts +0 -28
  185. package/src/features/gifCelebrations/helpers.ts +0 -123
  186. package/src/features/gifCelebrations/index.ts +0 -2
  187. package/src/features/gifCelebrations/model/GifCelebrations.cache.ts +0 -41
  188. package/src/features/gifCelebrations/model/GifCelebrations.model.ts +0 -167
  189. package/src/features/gifCelebrations/model/GifCelebrationsApi.ts +0 -10
  190. package/src/features/gifCelebrations/types/model.types.ts +0 -45
  191. package/src/react-app-env.d.ts +0 -6
  192. package/src/shared/constants.ts +0 -3
@@ -1,24 +0,0 @@
1
- import { Store } from 'effector';
2
- import { GifCelebrationsApi } from './GifCelebrationsApi';
3
- import { GifCelebrationsModelProps, GifObject, ProblemsPercentageTable } from '../types/model.types';
4
- import { GifCelebrationsCache } from './GifCelebrations.cache';
5
- export declare class GifCelebrationsModel {
6
- readonly api: GifCelebrationsApi;
7
- readonly cache: GifCelebrationsCache;
8
- readonly $totalProblems: Store<number>;
9
- readonly $resolvedProblems: Store<number>;
10
- readonly play: import("effector").EventCallable<void>;
11
- readonly stop: import("effector").EventCallable<void>;
12
- readonly resetGifTriggerable: import("effector").EventCallable<void>;
13
- readonly setGifTriggerable: import("effector").EventCallable<boolean>;
14
- readonly $isGifTriggerable: import("effector").StoreWritable<boolean>;
15
- readonly resetPercentageTable: import("effector").EventCallable<void>;
16
- readonly $problemsPercentageTable: import("effector").StoreWritable<ProblemsPercentageTable | null>;
17
- readonly setActiveGif: import("effector").EventCallable<GifObject>;
18
- readonly $activeGif: import("effector").StoreWritable<GifObject | null>;
19
- readonly initialize: import("effector").EventCallable<void>;
20
- constructor({ api, totalProblems, resolvedProblems, customGetCachePathMethod, }: GifCelebrationsModelProps);
21
- private setupEventHandlers;
22
- private readonly handleGifSelection;
23
- }
24
- //# sourceMappingURL=GifCelebrations.model.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GifCelebrations.model.d.ts","sourceRoot":"","sources":["../../../../../../src/features/gifCelebrations/model/GifCelebrations.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkD,KAAK,EAAE,MAAM,UAAU,CAAA;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EACL,yBAAyB,EACzB,SAAS,EAET,uBAAuB,EACxB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAU9D,qBAAa,oBAAoB;IAC/B,SAAgB,GAAG,EAAE,kBAAkB,CAAA;IACvC,SAAgB,KAAK,EAAE,oBAAoB,CAAA;IAE3C,SAAgB,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IAC7C,SAAgB,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IAEhD,SAAgB,IAAI,yCAAgB;IACpC,SAAgB,IAAI,yCAAgB;IAEpC,SAAgB,mBAAmB,yCAAgB;IACnD,SAAgB,iBAAiB,4CAAyB;IAC1D,SAAgB,iBAAiB,4CAM9B;IAEH,SAAgB,oBAAoB,yCAAgB;IACpD,SAAgB,wBAAwB,mEAEN;IAElC,SAAgB,YAAY,8CAA2B;IACvD,SAAgB,UAAU,qDAGe;IAEzC,SAAgB,UAAU,yCAAgB;gBAE9B,EACV,GAAG,EACH,aAAa,EACb,gBAAgB,EAChB,wBAAwB,GACzB,EAAE,yBAAyB;IAU5B,OAAO,CAAC,kBAAkB;IAyD1B,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CA0ClC;CACF"}
@@ -1,6 +0,0 @@
1
- import { GifCelebrationApiRequests } from '../types/model.types';
2
- export declare class GifCelebrationsApi {
3
- readonly getGifsFx: import("./../../../lib/effector/createControllerEffect").ControlledEffect<unknown, import("../types/model.types").GifResponse>;
4
- constructor(api: GifCelebrationApiRequests);
5
- }
6
- //# sourceMappingURL=GifCelebrationsApi.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GifCelebrationsApi.d.ts","sourceRoot":"","sources":["../../../../../../src/features/gifCelebrations/model/GifCelebrationsApi.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AAEhE,qBAAa,kBAAkB;IAC7B,SAAgB,SAAS,iIAAA;gBAEb,GAAG,EAAE,yBAAyB;CAG3C"}
@@ -1,37 +0,0 @@
1
- import { Store } from 'effector';
2
- export type CustomGetCachePathMethod = (uri: string) => Promise<string | null>;
3
- export type GroupNumber = number;
4
- export type GifCelebrationApiRequests = {
5
- getGifs: () => Promise<GifResponse>;
6
- };
7
- export type GifCelebrationsModelProps = {
8
- api: GifCelebrationApiRequests;
9
- totalProblems: Store<number>;
10
- resolvedProblems: Store<number>;
11
- customGetCachePathMethod?: CustomGetCachePathMethod;
12
- };
13
- export type GifsGroup = string[];
14
- export type GifsGroups = Record<`group${GroupNumber}`, GifsGroup>;
15
- export type GifObject = {
16
- url: string;
17
- isShown: boolean;
18
- group: `group${GroupNumber}`;
19
- };
20
- export type GifsStructure = Record<`group${GroupNumber}`, GifObject[]>;
21
- /**
22
- * Usually, the response contains 3 groups of gifs:
23
- * - group1: early celebrations
24
- * - group2: mid celebrations
25
- * - group3: party
26
- */
27
- export type GifResponse = {
28
- data: GifsGroups;
29
- ok: boolean;
30
- };
31
- export type GifsPayload = {
32
- group: number;
33
- };
34
- export type ProblemsPercentageTable = Record<number, number>;
35
- export type ProgressValue = 0 | 1 | 2;
36
- export type TextComponentType = (text: string) => React.ReactNode;
37
- //# sourceMappingURL=model.types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"model.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/gifCelebrations/types/model.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAEhC,MAAM,MAAM,wBAAwB,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;AAE9E,MAAM,MAAM,WAAW,GAAG,MAAM,CAAA;AAEhC,MAAM,MAAM,yBAAyB,GAAG;IACtC,OAAO,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAA;CACpC,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG;IACtC,GAAG,EAAE,yBAAyB,CAAA;IAC9B,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IAC5B,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IAC/B,wBAAwB,CAAC,EAAE,wBAAwB,CAAA;CACpD,CAAA;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,EAAE,CAAA;AAChC,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,WAAW,EAAE,EAAE,SAAS,CAAC,CAAA;AAEjE,MAAM,MAAM,SAAS,GAAG;IACtB,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,QAAQ,WAAW,EAAE,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,QAAQ,WAAW,EAAE,EAAE,SAAS,EAAE,CAAC,CAAA;AACtE;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,UAAU,CAAA;IAChB,EAAE,EAAE,OAAO,CAAA;CACZ,CAAA;AACD,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAC5D,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AAErC,MAAM,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAA"}
@@ -1,2 +0,0 @@
1
- export declare const IS_WEB: boolean;
2
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/shared/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,SAAwB,CAAA"}
@@ -1,77 +0,0 @@
1
- import React, { useEffect } from 'react'
2
- import { Gif } from './components/Gif'
3
- import { Progress } from './components/Progress'
4
- import { ContentContainer } from './components/ContentContainer'
5
- import { Backdrop } from './components/Backdrop'
6
- import { Easing, runOnJS, useSharedValue, withSequence, withTiming } from 'react-native-reanimated'
7
- import { useUnit } from 'effector-react'
8
- import { ANIMATION_DURATION } from './constants'
9
- import { GifCelebrationsModel } from './model/GifCelebrations.model'
10
- import { ProgressValue, TextComponentType } from './types/model.types'
11
-
12
- type GifCelebrationsProps = {
13
- model: GifCelebrationsModel
14
- TextComponent: TextComponentType
15
- }
16
-
17
- export const GifCelebrations = ({ model, TextComponent }: GifCelebrationsProps) => {
18
- const [totalProblems, resolvedProblems, activeGif] = useUnit([
19
- model.$totalProblems,
20
- model.$resolvedProblems,
21
- model.$activeGif,
22
- ])
23
-
24
- const completedPercent =
25
- resolvedProblems && totalProblems && Math.round((resolvedProblems / totalProblems) * 100)
26
-
27
- const progress = useSharedValue<ProgressValue>(0)
28
-
29
- const stopAnimation = () => {
30
- model.stop()
31
- progress.value = 0
32
- }
33
-
34
- const playAnimation = () => {
35
- progress.value = withSequence(
36
- withTiming(1, {
37
- duration: ANIMATION_DURATION,
38
- easing: Easing.bezier(0.52, 0.16, 0.26, 0.77),
39
- }),
40
- withTiming(
41
- 2,
42
- {
43
- duration: ANIMATION_DURATION,
44
- easing: Easing.bezier(0.71, 0.09, 0.49, 0.89),
45
- },
46
- () => runOnJS(stopAnimation)(),
47
- ),
48
- )
49
- }
50
-
51
- useEffect(() => {
52
- model.initialize()
53
- }, [])
54
-
55
- useEffect(() => {
56
- if (activeGif) {
57
- playAnimation()
58
- }
59
- }, [activeGif])
60
-
61
- if (!activeGif) {
62
- return null
63
- }
64
-
65
- return (
66
- <Backdrop progress={progress}>
67
- <ContentContainer progress={progress}>
68
- <Gif
69
- gifObject={activeGif}
70
- getCachePathMethod={model.cache.getCachePathMethod}
71
- TextComponent={TextComponent}
72
- />
73
- <Progress progress={progress} completedPercent={completedPercent} />
74
- </ContentContainer>
75
- </Backdrop>
76
- )
77
- }
@@ -1,41 +0,0 @@
1
- import { StyleSheet, useWindowDimensions } from 'react-native'
2
- import React from 'react'
3
- import Animated, { useAnimatedStyle, interpolateColor, SharedValue } from 'react-native-reanimated'
4
- import { BACKDROP_COLOR } from '../constants'
5
- import { ProgressValue } from '../types/model.types'
6
-
7
- type BackdropProps = {
8
- children: React.ReactNode
9
- progress: SharedValue<ProgressValue>
10
- }
11
-
12
- export const Backdrop = ({ children, progress }: BackdropProps) => {
13
- const { width, height } = useWindowDimensions()
14
-
15
- const backdropAnimatedStyle = useAnimatedStyle(
16
- () => ({
17
- backgroundColor: interpolateColor(
18
- progress.value,
19
- [0, 1, 2],
20
- [BACKDROP_COLOR.INITIAL, BACKDROP_COLOR.FINAL, BACKDROP_COLOR.INITIAL],
21
- ),
22
- }),
23
- [progress],
24
- )
25
-
26
- return (
27
- <Animated.View style={[styles.backdrop, { width, height }, backdropAnimatedStyle]}>
28
- {children}
29
- </Animated.View>
30
- )
31
- }
32
-
33
- const styles = StyleSheet.create({
34
- backdrop: {
35
- position: 'absolute',
36
- zIndex: 10100,
37
- justifyContent: 'center',
38
- alignItems: 'center',
39
- backgroundColor: 'rgba(51, 51, 51, 0.33);',
40
- },
41
- })
@@ -1,44 +0,0 @@
1
- import { StyleSheet, useWindowDimensions } from 'react-native'
2
- import React from 'react'
3
- import { SPACING } from '@magmamath/react-native-ui'
4
- import Animated, { useAnimatedStyle, interpolate, SharedValue } from 'react-native-reanimated'
5
- import { CONTENT_CONTAINER } from '../constants'
6
- import { ProgressValue } from '../types/model.types'
7
-
8
- type ContentContainerProps = {
9
- children: React.ReactNode
10
- progress: SharedValue<ProgressValue>
11
- }
12
-
13
- export const ContentContainer = ({ children, progress }: ContentContainerProps) => {
14
- const { width } = useWindowDimensions()
15
-
16
- const RIGHT_POSITION =
17
- width / 2 + CONTENT_CONTAINER.CONTAINER_WIDTH / 2 + CONTENT_CONTAINER.ROTATION_PADDING
18
- const LEFT_POSITION = -RIGHT_POSITION - CONTENT_CONTAINER.ROTATION_PADDING
19
-
20
- const animatedStyles = useAnimatedStyle(
21
- () => ({
22
- transform: [
23
- {
24
- translateX: interpolate(progress.value, [0, 1, 2], [LEFT_POSITION, 0, RIGHT_POSITION]),
25
- },
26
- {
27
- rotate: `${interpolate(progress.value, [0, 1, 2], [-CONTENT_CONTAINER.ANGLE, 0, CONTENT_CONTAINER.ANGLE])}deg`,
28
- },
29
- ],
30
- }),
31
- [progress, RIGHT_POSITION, LEFT_POSITION],
32
- )
33
-
34
- return <Animated.View style={[styles.container, animatedStyles]}>{children}</Animated.View>
35
- }
36
-
37
- const styles = StyleSheet.create({
38
- container: {
39
- width: CONTENT_CONTAINER.CONTAINER_WIDTH,
40
- alignItems: 'center',
41
- gap: SPACING[800],
42
- position: 'absolute',
43
- },
44
- })
@@ -1,95 +0,0 @@
1
- import { StyleSheet, View, Image } from 'react-native'
2
- import React, { useLayoutEffect, useState } from 'react'
3
- import { BORDER_RADIUS, COLORS, SPACING } from '@magmamath/react-native-ui'
4
- import { CustomGetCachePathMethod, GifObject, TextComponentType } from '../types/model.types'
5
- import { MAX_GIF_SIZE, MIN_GIF_SIZE } from '../constants'
6
- import { useText } from '../../../shared/translation'
7
- import { constrainDimension, getGifLabel, getImagePath } from '../helpers'
8
- import gifFallback from '../assets/gifFallback.gif'
9
- import { IS_WEB } from '../../../shared/constants'
10
-
11
- type GifProps = {
12
- gifObject: GifObject
13
- getCachePathMethod?: CustomGetCachePathMethod //it is used for RN
14
- TextComponent: TextComponentType
15
- }
16
-
17
- type Size = {
18
- width: number
19
- height: number
20
- }
21
-
22
- export const Gif = ({ gifObject, getCachePathMethod, TextComponent }: GifProps) => {
23
- const [size, setSize] = useState<Size | null>(null)
24
- const [pathOrUri, setPathOrUri] = useState<string>('')
25
-
26
- const t = useText()
27
-
28
- const gifGroupNumber = Number(gifObject.group.replace('group', ''))
29
- const gifLabel = getGifLabel(gifGroupNumber)
30
-
31
- useLayoutEffect(() => {
32
- const loadImageSize = async () => {
33
- let localPath
34
-
35
- try {
36
- // Get image path based on platform (React Native or Web)
37
- localPath = await getImagePath(gifObject.url, getCachePathMethod)
38
- } catch (error) {
39
- // Use fallback if image not found in cache
40
- localPath = IS_WEB ? gifFallback : Image.resolveAssetSource(gifFallback).uri
41
- }
42
-
43
- // Get and set image dimensions
44
- Image.getSize(localPath, (width, height) => {
45
- setSize({
46
- width: constrainDimension(width, MIN_GIF_SIZE, MAX_GIF_SIZE.WIDTH),
47
- height: constrainDimension(height, MIN_GIF_SIZE, MAX_GIF_SIZE.HEIGHT),
48
- })
49
- setPathOrUri(localPath)
50
- })
51
- }
52
-
53
- loadImageSize()
54
- }, [gifObject.url])
55
-
56
- return (
57
- <View style={styles.backgroundContainer}>
58
- <View style={styles.container}>
59
- {size && pathOrUri && (
60
- <Image
61
- alt="Funny celebration animated image"
62
- source={{
63
- uri: pathOrUri,
64
- }}
65
- width={size.width}
66
- height={size.height}
67
- style={[styles.image, { width: size.width, height: size.height }]} //this sizes duplication is needed for compatibility with web and rn
68
- />
69
- )}
70
- <View style={styles.textContainer}>{TextComponent(t(gifLabel))}</View>
71
- </View>
72
- </View>
73
- )
74
- }
75
-
76
- const styles = StyleSheet.create({
77
- backgroundContainer: {
78
- backgroundColor: 'rgba(255, 255, 255, 0.6)',
79
- borderRadius: 23,
80
- padding: SPACING[200],
81
- },
82
- container: {
83
- padding: SPACING[1600],
84
- borderRadius: BORDER_RADIUS[400],
85
- backgroundColor: COLORS.NEUTRAL_1,
86
- },
87
- image: {
88
- borderRadius: BORDER_RADIUS[100],
89
- },
90
- textContainer: {
91
- position: 'absolute',
92
- bottom: 74,
93
- alignSelf: 'center',
94
- },
95
- })
@@ -1,106 +0,0 @@
1
- import { StyleSheet, View, Image, Platform } from 'react-native'
2
- import React from 'react'
3
- import {
4
- BORDER_RADIUS,
5
- COLORS,
6
- HeadingVariants,
7
- IS_WEB,
8
- SPACING,
9
- Typography,
10
- } from '@magmamath/react-native-ui'
11
- import Animated, { useAnimatedStyle, SharedValue, interpolate } from 'react-native-reanimated'
12
- import confettiImage from '../assets/confetti.webp'
13
- import { ProgressValue } from '../types/model.types'
14
- import { getProgressLineWidth } from '../helpers'
15
-
16
- type ProgressProps = {
17
- progress: SharedValue<ProgressValue>
18
- completedPercent: number
19
- }
20
-
21
- export const Progress = ({ progress, completedPercent }: ProgressProps) => {
22
- const progressLineWidth = getProgressLineWidth(completedPercent)
23
-
24
- const animatedStyles = useAnimatedStyle(
25
- () => ({
26
- width: `${interpolate(
27
- progress.value,
28
- [0, 1, 2],
29
- [0, progressLineWidth, progressLineWidth],
30
- )}%`,
31
- }),
32
- [progress, progressLineWidth],
33
- )
34
-
35
- return (
36
- <View style={styles.backgroundContainer}>
37
- <View style={styles.container}>
38
- <View style={styles.progressContainer}>
39
- <Animated.View style={[styles.progress, animatedStyles]}>
40
- <Typography variant={HeadingVariants.H1} style={styles.percent}>
41
- {`${completedPercent}%`}
42
- </Typography>
43
- </Animated.View>
44
- </View>
45
- <Image
46
- source={
47
- IS_WEB
48
- ? {
49
- uri: confettiImage,
50
- }
51
- : require('../assets/confetti.webp')
52
- }
53
- style={styles.confetti}
54
- />
55
- </View>
56
- </View>
57
- )
58
- }
59
-
60
- const styles = StyleSheet.create({
61
- backgroundContainer: {
62
- backgroundColor: 'rgba(255, 255, 255, 0.6)',
63
- borderRadius: 23,
64
- padding: SPACING[200],
65
- width: '100%',
66
- },
67
- container: {
68
- width: '100%',
69
- height: 116,
70
- flexDirection: 'row',
71
- alignItems: 'center',
72
- borderRadius: BORDER_RADIUS[400],
73
- backgroundColor: COLORS.NEUTRAL_1,
74
- paddingLeft: SPACING[400],
75
- paddingRight: SPACING[200],
76
- gap: SPACING[100],
77
- },
78
- progressContainer: {
79
- height: 50,
80
- flexGrow: 1,
81
- backgroundColor: COLORS.NEUTRAL_5,
82
- borderRadius: 90,
83
- overflow: 'hidden',
84
- },
85
- progress: {
86
- position: 'absolute',
87
- height: '100%',
88
- backgroundColor: COLORS.PRIMARY_BLUE,
89
- borderRadius: BORDER_RADIUS[200],
90
- justifyContent: 'center',
91
- alignItems: 'flex-end',
92
- paddingRight: 10.6,
93
- overflow: 'hidden',
94
- },
95
- confetti: {
96
- width: 75,
97
- height: 70,
98
- marginHorizontal: SPACING[200],
99
- },
100
- percent: {
101
- position: 'absolute',
102
- paddingRight: 10,
103
- color: COLORS.NEUTRAL_1,
104
- fontWeight: '700',
105
- },
106
- })
@@ -1,28 +0,0 @@
1
- export const BACKDROP_COLOR = {
2
- INITIAL: 'rgba(51, 51, 51, 0)',
3
- FINAL: 'rgba(51, 51, 51, 0.66)',
4
- }
5
-
6
- export const CONTENT_CONTAINER = {
7
- ANGLE: 5,
8
- CONTAINER_WIDTH: 769,
9
- ROTATION_PADDING: 44, // to be sure that the content is not cut off on the edges because of rotate transform
10
- }
11
-
12
- export const ANIMATION_DURATION = 1750
13
- export const MIN_PROBLEMS_TO_SHOW_GIF = 7
14
-
15
- export const MAX_GIF_SIZE = {
16
- WIDTH: 480,
17
- HEIGHT: 300,
18
- }
19
- export const MIN_GIF_SIZE = 300
20
-
21
- export const GROUPS_PERCENTAGES = {
22
- group1: [15, 20, 25, 30], // Early celebrations
23
- group2: [33, 40, 45, 50], // Mid celebrations
24
- group3: [60, 66, 75, 80], // Party
25
- }
26
-
27
- export const MIN_WIDTH_FOR_ONE_DIGIT = 12
28
- export const MIN_WIDTH_FOR_TWO_DIGITS = 15
@@ -1,123 +0,0 @@
1
- import { TranslationKeys } from 'src/shared/translation/types'
2
- import {
3
- CustomGetCachePathMethod,
4
- GifsGroups,
5
- GifsStructure,
6
- GroupNumber,
7
- ProblemsPercentageTable,
8
- } from './types/model.types'
9
- import { MIN_WIDTH_FOR_ONE_DIGIT, MIN_WIDTH_FOR_TWO_DIGITS } from './constants'
10
-
11
- /**
12
- * Number of problems When we show gif
13
- * <6 Never
14
- * 7-12 50% completion
15
- * 13-18 33%, 66% completion
16
- * 19-24 25%, 50%, 75 completion
17
- * 25-30 20%, 40%, 60%, 80% completion
18
- * .>30 15%, 30%, 45%, 60%, 75% completion
19
- *
20
- * We are also going to have different buckets with different gifs. The logic is as follows:
21
- * Group 1: 15%, 20%, 25%, 30% - Early celebrations
22
- * Group 2: 33%, 40%, 45%, 50% - Mid celebrations
23
- * Group 3: 60%, 66%, 75%, 80% - Party
24
- * or
25
- * Group 1: <=30% - Early celebrations
26
- * Group 2: >30% <60% - Mid celebrations
27
- * Group 3: >=60% - Party
28
- */
29
- export const calculatePercentageTable = (totalProblems: number): ProblemsPercentageTable => {
30
- if (totalProblems <= 12) return { 50: Math.ceil(totalProblems * 0.5) }
31
-
32
- if (totalProblems <= 18) {
33
- return {
34
- 33: Math.ceil(totalProblems * 0.33),
35
- 66: Math.ceil(totalProblems * 0.66),
36
- }
37
- }
38
-
39
- if (totalProblems <= 24) {
40
- return {
41
- 25: Math.ceil(totalProblems * 0.25),
42
- 50: Math.ceil(totalProblems * 0.5),
43
- 75: Math.ceil(totalProblems * 0.75),
44
- }
45
- }
46
-
47
- if (totalProblems <= 30) {
48
- return {
49
- 20: Math.ceil(totalProblems * 0.2),
50
- 40: Math.ceil(totalProblems * 0.4),
51
- 60: Math.ceil(totalProblems * 0.6),
52
- 80: Math.ceil(totalProblems * 0.8),
53
- }
54
- }
55
-
56
- return {
57
- 15: Math.ceil(totalProblems * 0.15),
58
- 30: Math.ceil(totalProblems * 0.3),
59
- 45: Math.ceil(totalProblems * 0.45),
60
- 60: Math.ceil(totalProblems * 0.6),
61
- 75: Math.ceil(totalProblems * 0.75),
62
- }
63
- }
64
-
65
- export const generateGifsStructure = (gifs: GifsGroups): GifsStructure =>
66
- Object.fromEntries(
67
- Object.entries(gifs).map(([key, value]) => [
68
- key,
69
- value.map((url) => ({
70
- url,
71
- isShown: false,
72
- group: key as `group${GroupNumber}`,
73
- })),
74
- ]),
75
- )
76
-
77
- export const getGifLabel = (relatedGroup: GroupNumber): TranslationKeys => {
78
- if (relatedGroup === 2) {
79
- return 'gifCelebrations.onTheWay'
80
- }
81
- if (relatedGroup === 3) {
82
- return 'gifCelebrations.almostThere'
83
- }
84
-
85
- return 'gifCelebrations.greatStart'
86
- }
87
-
88
- export const getProgressLineWidth = (completedPercent: number) => {
89
- if (completedPercent <= 9) {
90
- return MIN_WIDTH_FOR_ONE_DIGIT
91
- }
92
- if (completedPercent <= 15) {
93
- return MIN_WIDTH_FOR_TWO_DIGITS
94
- }
95
- return completedPercent
96
- }
97
-
98
- export const findGroupForPercentage = (percentage: number) => {
99
- if (percentage <= 30) {
100
- return 'group1'
101
- }
102
- if (percentage < 60) {
103
- return 'group2'
104
- }
105
- return 'group3'
106
- }
107
-
108
- export const getImagePath = async (url: string, cacheMethod?: CustomGetCachePathMethod) => {
109
- if (cacheMethod) {
110
- const path = await cacheMethod(url)
111
- if (path) return path
112
- } else {
113
- // @ts-ignore - Image.queryCache works only in web
114
- const cachedImage = await Image.queryCache([url])
115
- const path = cachedImage[url]
116
- if (path) return path
117
- }
118
-
119
- throw new Error('Image not found in cache')
120
- }
121
-
122
- export const constrainDimension = (value: number, min: number, max: number) =>
123
- Math.max(min, Math.min(max, value))
@@ -1,2 +0,0 @@
1
- export { GifCelebrations } from './GifCelebrations'
2
- export { GifCelebrationsModel } from './model/GifCelebrations.model'
@@ -1,41 +0,0 @@
1
- import { createEffect, createEvent, createStore } from 'effector'
2
- import { GifsGroups, GifsStructure, CustomGetCachePathMethod } from '../types/model.types'
3
- import { generateGifsStructure } from '../helpers'
4
- import { Image } from 'react-native'
5
-
6
- type GifCelebrationsCacheProps = {
7
- customGetCachePathMethod?: CustomGetCachePathMethod
8
- }
9
-
10
- export class GifCelebrationsCache {
11
- public readonly initialSet = createEvent<GifsGroups>()
12
- public readonly set = createEvent<GifsStructure>()
13
- public readonly reset = createEvent()
14
-
15
- public readonly getCachePathMethod?: CustomGetCachePathMethod
16
-
17
- public readonly prefetchAllGifs = createEffect<GifsGroups, void>((data) => {
18
- Object.values(data).forEach((group) => {
19
- group.forEach((gifUrl) => {
20
- Image.prefetch(gifUrl)
21
- })
22
- })
23
-
24
- this.initialSet(data)
25
- })
26
-
27
- public readonly prefetchGifs = createEffect<string[], void>((gifs) => {
28
- gifs.forEach((gifUrl) => {
29
- Image.prefetch(gifUrl)
30
- })
31
- })
32
-
33
- public readonly $gifs = createStore<GifsStructure | null>(null)
34
- .reset(this.reset)
35
- .on(this.initialSet, (_, gifs) => generateGifsStructure(gifs))
36
- .on(this.set, (_, gifs) => gifs)
37
-
38
- constructor({ customGetCachePathMethod }: GifCelebrationsCacheProps) {
39
- this.getCachePathMethod = customGetCachePathMethod
40
- }
41
- }