@magmamath/students-features 0.6.7-rc.2 → 0.6.7-rc.4
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.
- package/dist/commonjs/features/endOfAssignment/components/Modal/Modal.js +0 -1
- package/dist/commonjs/features/endOfAssignment/components/Modal/Modal.js.map +1 -1
- package/dist/commonjs/features/gifCelebrations/GifCelebrations.js +62 -0
- package/dist/commonjs/features/gifCelebrations/GifCelebrations.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/assets/confetti.webp +0 -0
- package/dist/commonjs/features/gifCelebrations/assets/gifFallback.gif +0 -0
- package/dist/commonjs/features/gifCelebrations/components/Backdrop.js +44 -0
- package/dist/commonjs/features/gifCelebrations/components/Backdrop.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/components/ContentContainer.js +46 -0
- package/dist/commonjs/features/gifCelebrations/components/ContentContainer.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/components/Gif.js +90 -0
- package/dist/commonjs/features/gifCelebrations/components/Gif.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/components/Progress.js +96 -0
- package/dist/commonjs/features/gifCelebrations/components/Progress.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/constants.js +34 -0
- package/dist/commonjs/features/gifCelebrations/constants.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/helpers.js +114 -0
- package/dist/commonjs/features/gifCelebrations/helpers.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/index.js +20 -0
- package/dist/commonjs/features/gifCelebrations/index.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/model/GifCelebrations.cache.js +30 -0
- package/dist/commonjs/features/gifCelebrations/model/GifCelebrations.cache.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/model/GifCelebrations.model.js +138 -0
- package/dist/commonjs/features/gifCelebrations/model/GifCelebrations.model.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/model/GifCelebrationsApi.js +27 -0
- package/dist/commonjs/features/gifCelebrations/model/GifCelebrationsApi.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/types/model.types.js +6 -0
- package/dist/commonjs/features/gifCelebrations/types/model.types.js.map +1 -0
- package/dist/commonjs/index.js +12 -0
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/lib/effector/createControllerEffect.js.map +1 -1
- package/dist/commonjs/lib/helpers/helpers.js.map +1 -1
- package/dist/commonjs/react-app-env.d.js +2 -0
- package/dist/commonjs/react-app-env.d.js.map +1 -0
- package/dist/commonjs/shared/translation/localization/en.json +5 -0
- package/dist/commonjs/shared/translation/localization/gb.json +5 -0
- package/dist/commonjs/shared/translation/localization/sw.json +5 -0
- package/dist/commonjs/types/common.types.js +2 -0
- package/dist/commonjs/types/common.types.js.map +1 -0
- package/dist/module/features/endOfAssignment/components/Modal/Modal.js +1 -2
- package/dist/module/features/endOfAssignment/components/Modal/Modal.js.map +1 -1
- package/dist/module/features/gifCelebrations/GifCelebrations.js +55 -0
- package/dist/module/features/gifCelebrations/GifCelebrations.js.map +1 -0
- package/dist/module/features/gifCelebrations/assets/confetti.webp +0 -0
- package/dist/module/features/gifCelebrations/assets/gifFallback.gif +0 -0
- package/dist/module/features/gifCelebrations/components/Backdrop.js +36 -0
- package/dist/module/features/gifCelebrations/components/Backdrop.js.map +1 -0
- package/dist/module/features/gifCelebrations/components/ContentContainer.js +38 -0
- package/dist/module/features/gifCelebrations/components/ContentContainer.js.map +1 -0
- package/dist/module/features/gifCelebrations/components/Gif.js +82 -0
- package/dist/module/features/gifCelebrations/components/Gif.js.map +1 -0
- package/dist/module/features/gifCelebrations/components/Progress.js +88 -0
- package/dist/module/features/gifCelebrations/components/Progress.js.map +1 -0
- package/dist/module/features/gifCelebrations/constants.js +30 -0
- package/dist/module/features/gifCelebrations/constants.js.map +1 -0
- package/dist/module/features/gifCelebrations/helpers.js +103 -0
- package/dist/module/features/gifCelebrations/helpers.js.map +1 -0
- package/dist/module/features/gifCelebrations/index.js +5 -0
- package/dist/module/features/gifCelebrations/index.js.map +1 -0
- package/dist/module/features/gifCelebrations/model/GifCelebrations.cache.js +25 -0
- package/dist/module/features/gifCelebrations/model/GifCelebrations.cache.js.map +1 -0
- package/dist/module/features/gifCelebrations/model/GifCelebrations.model.js +133 -0
- package/dist/module/features/gifCelebrations/model/GifCelebrations.model.js.map +1 -0
- package/dist/module/features/gifCelebrations/model/GifCelebrationsApi.js +22 -0
- package/dist/module/features/gifCelebrations/model/GifCelebrationsApi.js.map +1 -0
- package/dist/module/features/gifCelebrations/types/model.types.js +4 -0
- package/dist/module/features/gifCelebrations/types/model.types.js.map +1 -0
- package/dist/module/index.js +1 -0
- package/dist/module/index.js.map +1 -1
- package/dist/module/lib/effector/createControllerEffect.js.map +1 -1
- package/dist/module/react-app-env.d.js +2 -0
- package/dist/module/react-app-env.d.js.map +1 -0
- package/dist/module/shared/translation/localization/en.json +5 -0
- package/dist/module/shared/translation/localization/gb.json +5 -0
- package/dist/module/shared/translation/localization/sw.json +5 -0
- package/dist/module/types/common.types.js +2 -0
- package/dist/module/types/common.types.js.map +1 -0
- package/dist/typescript/commonjs/features/endOfAssignment/components/Modal/Modal.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/gifCelebrations/GifCelebrations.d.ts +10 -0
- package/dist/typescript/commonjs/features/gifCelebrations/GifCelebrations.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/components/Backdrop.d.ts +10 -0
- package/dist/typescript/commonjs/features/gifCelebrations/components/Backdrop.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/components/ContentContainer.d.ts +10 -0
- package/dist/typescript/commonjs/features/gifCelebrations/components/ContentContainer.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/components/Gif.d.ts +10 -0
- package/dist/typescript/commonjs/features/gifCelebrations/components/Gif.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/components/Progress.d.ts +10 -0
- package/dist/typescript/commonjs/features/gifCelebrations/components/Progress.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/constants.d.ts +26 -0
- package/dist/typescript/commonjs/features/gifCelebrations/constants.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/helpers.d.ts +29 -0
- package/dist/typescript/commonjs/features/gifCelebrations/helpers.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/index.d.ts +3 -0
- package/dist/typescript/commonjs/features/gifCelebrations/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/model/GifCelebrations.cache.d.ts +18 -0
- package/dist/typescript/commonjs/features/gifCelebrations/model/GifCelebrations.cache.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/model/GifCelebrations.model.d.ts +25 -0
- package/dist/typescript/commonjs/features/gifCelebrations/model/GifCelebrations.model.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/model/GifCelebrationsApi.d.ts +7 -0
- package/dist/typescript/commonjs/features/gifCelebrations/model/GifCelebrationsApi.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/types/model.types.d.ts +45 -0
- package/dist/typescript/commonjs/features/gifCelebrations/types/model.types.d.ts.map +1 -0
- package/dist/typescript/commonjs/index.d.ts +1 -0
- package/dist/typescript/commonjs/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/lib/effector/createControllerEffect.d.ts +1 -1
- package/dist/typescript/commonjs/lib/effector/createControllerEffect.d.ts.map +1 -1
- package/dist/typescript/commonjs/lib/helpers/helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/constants.d.ts +15 -0
- package/dist/typescript/commonjs/shared/translation/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/model.d.ts +10 -0
- package/dist/typescript/commonjs/shared/translation/model.d.ts.map +1 -1
- package/dist/typescript/commonjs/types/common.types.d.ts +5 -0
- package/dist/typescript/commonjs/types/common.types.d.ts.map +1 -0
- package/dist/typescript/module/features/endOfAssignment/components/Modal/Modal.d.ts.map +1 -1
- package/dist/typescript/module/features/gifCelebrations/GifCelebrations.d.ts +10 -0
- package/dist/typescript/module/features/gifCelebrations/GifCelebrations.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/components/Backdrop.d.ts +10 -0
- package/dist/typescript/module/features/gifCelebrations/components/Backdrop.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/components/ContentContainer.d.ts +10 -0
- package/dist/typescript/module/features/gifCelebrations/components/ContentContainer.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/components/Gif.d.ts +10 -0
- package/dist/typescript/module/features/gifCelebrations/components/Gif.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/components/Progress.d.ts +10 -0
- package/dist/typescript/module/features/gifCelebrations/components/Progress.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/constants.d.ts +26 -0
- package/dist/typescript/module/features/gifCelebrations/constants.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/helpers.d.ts +29 -0
- package/dist/typescript/module/features/gifCelebrations/helpers.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/index.d.ts +3 -0
- package/dist/typescript/module/features/gifCelebrations/index.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/model/GifCelebrations.cache.d.ts +18 -0
- package/dist/typescript/module/features/gifCelebrations/model/GifCelebrations.cache.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/model/GifCelebrations.model.d.ts +25 -0
- package/dist/typescript/module/features/gifCelebrations/model/GifCelebrations.model.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/model/GifCelebrationsApi.d.ts +7 -0
- package/dist/typescript/module/features/gifCelebrations/model/GifCelebrationsApi.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/types/model.types.d.ts +45 -0
- package/dist/typescript/module/features/gifCelebrations/types/model.types.d.ts.map +1 -0
- package/dist/typescript/module/index.d.ts +1 -0
- package/dist/typescript/module/index.d.ts.map +1 -1
- package/dist/typescript/module/lib/effector/createControllerEffect.d.ts +1 -1
- package/dist/typescript/module/lib/effector/createControllerEffect.d.ts.map +1 -1
- package/dist/typescript/module/lib/helpers/helpers.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/constants.d.ts +15 -0
- package/dist/typescript/module/shared/translation/constants.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/model.d.ts +10 -0
- package/dist/typescript/module/shared/translation/model.d.ts.map +1 -1
- package/dist/typescript/module/types/common.types.d.ts +5 -0
- package/dist/typescript/module/types/common.types.d.ts.map +1 -0
- package/package.json +3 -5
- package/src/features/endOfAssignment/components/Modal/Modal.tsx +1 -2
- package/src/features/gifCelebrations/GifCelebrations.tsx +75 -0
- package/src/features/gifCelebrations/assets/confetti.webp +0 -0
- package/src/features/gifCelebrations/assets/gifFallback.gif +0 -0
- package/src/features/gifCelebrations/components/Backdrop.tsx +41 -0
- package/src/features/gifCelebrations/components/ContentContainer.tsx +44 -0
- package/src/features/gifCelebrations/components/Gif.tsx +88 -0
- package/src/features/gifCelebrations/components/Progress.tsx +106 -0
- package/src/features/gifCelebrations/constants.ts +32 -0
- package/src/features/gifCelebrations/helpers.ts +144 -0
- package/src/features/gifCelebrations/index.ts +2 -0
- package/src/features/gifCelebrations/model/GifCelebrations.cache.ts +41 -0
- package/src/features/gifCelebrations/model/GifCelebrations.model.ts +177 -0
- package/src/features/gifCelebrations/model/GifCelebrationsApi.ts +26 -0
- package/src/features/gifCelebrations/types/model.types.ts +53 -0
- package/src/index.ts +1 -0
- package/src/lib/effector/createControllerEffect.ts +41 -41
- package/src/lib/helpers/helpers.ts +1 -1
- package/src/react-app-env.d.ts +6 -0
- package/src/shared/translation/localization/en.json +5 -0
- package/src/shared/translation/localization/gb.json +5 -0
- package/src/shared/translation/localization/sw.json +5 -0
- package/src/types/common.types.ts +4 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["StyleSheet","View","Image","React","useLayoutEffect","useState","BORDER_RADIUS","COLORS","IS_WEB","SPACING","MAX_GIF_SIZE","MIN_GIF_SIZE","useText","constrainDimension","getGifLabel","getImagePath","gifFallback","jsx","_jsx","jsxs","_jsxs","Gif","gifObject","getCachePathMethod","TextComponent","size","setSize","pathOrUri","setPathOrUri","t","gifGroupNumber","Number","group","replace","gifLabel","loadImageSize","localPath","url","error","resolveAssetSource","uri","console","getSize","width","height","WIDTH","HEIGHT","style","styles","backgroundContainer","children","container","alt","source","image","textContainer","create","backgroundColor","borderRadius","padding","NEUTRAL_1","position","bottom","alignSelf"],"sourceRoot":"../../../../../src","sources":["features/gifCelebrations/components/Gif.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,IAAI,EAAEC,KAAK,QAAQ,cAAc;AACtD,OAAOC,KAAK,IAAIC,eAAe,EAAEC,QAAQ,QAAQ,OAAO;AACxD,SAASC,aAAa,EAAEC,MAAM,EAAEC,MAAM,EAAEC,OAAO,QAAQ,4BAA4B;AAEnF,SAASC,YAAY,EAAEC,YAAY,QAAQ,iBAAc;AACzD,SAASC,OAAO,QAAQ,sCAA6B;AACrD,SAASC,kBAAkB,EAAEC,WAAW,EAAEC,YAAY,QAAQ,eAAY;AAC1E,OAAOC,WAAW,MAAM,2BAA2B;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AASnD,OAAO,MAAMC,GAAG,GAAGA,CAAC;EAAEC,SAAS;EAAEC,kBAAkB;EAAEC;AAAwB,CAAC,KAAK;EACjF,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAGrB,QAAQ,CAAc,IAAI,CAAC;EACnD,MAAM,CAACsB,SAAS,EAAEC,YAAY,CAAC,GAAGvB,QAAQ,CAAC,EAAE,CAAC;EAE9C,MAAMwB,CAAC,GAAGjB,OAAO,CAAC,CAAC;EAEnB,MAAMkB,cAAc,GAAGC,MAAM,CAACT,SAAS,CAACU,KAAK,CAACC,OAAO,CAAC,OA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,CAACkB,KAAM;QAClBC,MAAM,EAAEnB,IAAI,CAACmB,MAAO;QACpBG,KAAK,EAAE,CAACC,MAAM,CAACM,KAAK,EAAE;UAAEX,KAAK,EAAElB,IAAI,CAACkB,KAAK;UAAEC,MAAM,EAAEnB,IAAI,CAACmB;QAAO,CAAC,CAAE,CAAC;MAAA,CACpE,CACF,eACD1B,IAAA,CAACjB,IAAI;QAAC8C,KAAK,EAAEC,MAAM,CAACO,aAAc;QAAAL,QAAA,EAAE1B,aAAa,CAACK,CAAC,CAACK,QAAQ,CAAC;MAAC,CAAO,CAAC;IAAA,CAClE;EAAC,CACH,CAAC;AAEX,CAAC;AAED,MAAMc,MAAM,GAAGhD,UAAU,CAACwD,MAAM,CAAC;EAC/BP,mBAAmB,EAAE;IACnBQ,eAAe,EAAE,0BAA0B;IAC3CC,YAAY,EAAE,EAAE;IAChBC,OAAO,EAAElD,OAAO,CAAC,GAAG;EACtB,CAAC;EACD0C,SAAS,EAAE;IACTQ,OAAO,EAAElD,OAAO,CAAC,IAAI,CAAC;IACtBiD,YAAY,EAAEpD,aAAa,CAAC,GAAG,CAAC;IAChCmD,eAAe,EAAElD,MAAM,CAACqD;EAC1B,CAAC;EACDN,KAAK,EAAE;IACLI,YAAY,EAAEpD,aAAa,CAAC,GAAG;EACjC,CAAC;EACDiD,aAAa,EAAE;IACbM,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,EAAE;IACVC,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { StyleSheet, View, Image } from 'react-native';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { BORDER_RADIUS, COLORS, HeadingVariants, IS_WEB, SPACING, Typography } from '@magmamath/react-native-ui';
|
|
6
|
+
import Animated, { useAnimatedStyle, interpolate } from 'react-native-reanimated';
|
|
7
|
+
import confettiImage from '../assets/confetti.webp';
|
|
8
|
+
import { getProgressLineWidth } from "../helpers.js";
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
export const Progress = ({
|
|
11
|
+
progress,
|
|
12
|
+
completedPercent
|
|
13
|
+
}) => {
|
|
14
|
+
const progressLineWidth = getProgressLineWidth(completedPercent);
|
|
15
|
+
const animatedStyles = useAnimatedStyle(() => ({
|
|
16
|
+
width: `${interpolate(progress.value, [0, 1, 2], [0, progressLineWidth, progressLineWidth])}%`
|
|
17
|
+
}), [progress, progressLineWidth]);
|
|
18
|
+
return /*#__PURE__*/_jsx(View, {
|
|
19
|
+
style: styles.backgroundContainer,
|
|
20
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
21
|
+
style: styles.container,
|
|
22
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
23
|
+
style: styles.progressContainer,
|
|
24
|
+
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
25
|
+
style: [styles.progress, animatedStyles],
|
|
26
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
|
27
|
+
variant: HeadingVariants.H1,
|
|
28
|
+
style: styles.percent,
|
|
29
|
+
children: `${completedPercent}%`
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
}), /*#__PURE__*/_jsx(Image, {
|
|
33
|
+
source: IS_WEB ? {
|
|
34
|
+
uri: confettiImage
|
|
35
|
+
} : require('../assets/confetti.webp'),
|
|
36
|
+
style: styles.confetti
|
|
37
|
+
})]
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
const styles = StyleSheet.create({
|
|
42
|
+
backgroundContainer: {
|
|
43
|
+
backgroundColor: 'rgba(255, 255, 255, 0.6)',
|
|
44
|
+
borderRadius: 23,
|
|
45
|
+
padding: SPACING[200],
|
|
46
|
+
width: '100%'
|
|
47
|
+
},
|
|
48
|
+
container: {
|
|
49
|
+
width: '100%',
|
|
50
|
+
height: 116,
|
|
51
|
+
flexDirection: 'row',
|
|
52
|
+
alignItems: 'center',
|
|
53
|
+
borderRadius: BORDER_RADIUS[400],
|
|
54
|
+
backgroundColor: COLORS.NEUTRAL_1,
|
|
55
|
+
paddingLeft: SPACING[400],
|
|
56
|
+
paddingRight: SPACING[200],
|
|
57
|
+
gap: SPACING[100]
|
|
58
|
+
},
|
|
59
|
+
progressContainer: {
|
|
60
|
+
height: 50,
|
|
61
|
+
flexGrow: 1,
|
|
62
|
+
backgroundColor: COLORS.NEUTRAL_5,
|
|
63
|
+
borderRadius: 90,
|
|
64
|
+
overflow: 'hidden'
|
|
65
|
+
},
|
|
66
|
+
progress: {
|
|
67
|
+
position: 'absolute',
|
|
68
|
+
height: '100%',
|
|
69
|
+
backgroundColor: COLORS.PRIMARY_BLUE,
|
|
70
|
+
borderRadius: BORDER_RADIUS[200],
|
|
71
|
+
justifyContent: 'center',
|
|
72
|
+
alignItems: 'flex-end',
|
|
73
|
+
paddingRight: 10.6,
|
|
74
|
+
overflow: 'hidden'
|
|
75
|
+
},
|
|
76
|
+
confetti: {
|
|
77
|
+
width: 75,
|
|
78
|
+
height: 70,
|
|
79
|
+
marginHorizontal: SPACING[200]
|
|
80
|
+
},
|
|
81
|
+
percent: {
|
|
82
|
+
position: 'absolute',
|
|
83
|
+
paddingRight: 10,
|
|
84
|
+
color: COLORS.NEUTRAL_1,
|
|
85
|
+
fontWeight: '700'
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
//# sourceMappingURL=Progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["StyleSheet","View","Image","React","BORDER_RADIUS","COLORS","HeadingVariants","IS_WEB","SPACING","Typography","Animated","useAnimatedStyle","interpolate","confettiImage","getProgressLineWidth","jsx","_jsx","jsxs","_jsxs","Progress","progress","completedPercent","progressLineWidth","animatedStyles","width","value","style","styles","backgroundContainer","children","container","progressContainer","variant","H1","percent","source","uri","require","confetti","create","backgroundColor","borderRadius","padding","height","flexDirection","alignItems","NEUTRAL_1","paddingLeft","paddingRight","gap","flexGrow","NEUTRAL_5","overflow","position","PRIMARY_BLUE","justifyContent","marginHorizontal","color","fontWeight"],"sourceRoot":"../../../../../src","sources":["features/gifCelebrations/components/Progress.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,IAAI,EAAEC,KAAK,QAAQ,cAAc;AACtD,OAAOC,KAAK,MAAM,OAAO;AACzB,SACEC,aAAa,EACbC,MAAM,EACNC,eAAe,EACfC,MAAM,EACNC,OAAO,EACPC,UAAU,QACL,4BAA4B;AACnC,OAAOC,QAAQ,IAAIC,gBAAgB,EAAeC,WAAW,QAAQ,yBAAyB;AAC9F,OAAOC,aAAa,MAAM,yBAAyB;AAEnD,SAASC,oBAAoB,QAAQ,eAAY;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAOjD,OAAO,MAAMC,QAAQ,GAAGA,CAAC;EAAEC,QAAQ;EAAEC;AAAgC,CAAC,KAAK;EACzE,MAAMC,iBAAiB,GAAGR,oBAAoB,CAACO,gBAAgB,CAAC;EAEhE,MAAME,cAAc,GAAGZ,gBAAgB,CACrC,OAAO;IACLa,KAAK,EAAE,GAAGZ,WAAW,CACnBQ,QAAQ,CAACK,KAAK,EACd,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EACT,CAAC,CAAC,EAAEH,iBAAiB,EAAEA,iBAAiB,CAC1C,CAAC;EACH,CAAC,CAAC,EACF,CAACF,QAAQ,EAAEE,iBAAiB,CAC9B,CAAC;EAED,oBACEN,IAAA,CAACf,IAAI;IAACyB,KAAK,EAAEC,MAAM,CAACC,mBAAoB;IAAAC,QAAA,eACtCX,KAAA,CAACjB,IAAI;MAACyB,KAAK,EAAEC,MAAM,CAACG,SAAU;MAAAD,QAAA,gBAC5Bb,IAAA,CAACf,IAAI;QAACyB,KAAK,EAAEC,MAAM,CAACI,iBAAkB;QAAAF,QAAA,eACpCb,IAAA,CAACN,QAAQ,CAACT,IAAI;UAACyB,KAAK,EA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BV,MAAM,EAAE,MAAM;IACdH,eAAe,EAAEnC,MAAM,CAACiD,YAAY;IACpCb,YAAY,EAAErC,aAAa,CAAC,GAAG,CAAC;IAChCmD,cAAc,EAAE,QAAQ;IACxBV,UAAU,EAAE,UAAU;IACtBG,YAAY,EAAE,IAAI;IAClBI,QAAQ,EAAE;EACZ,CAAC;EACDd,QAAQ,EAAE;IACRd,KAAK,EAAE,EAAE;IACTmB,MAAM,EAAE,EAAE;IACVa,gBAAgB,EAAEhD,OAAO,CAAC,GAAG;EAC/B,CAAC;EACD0B,OAAO,EAAE;IACPmB,QAAQ,EAAE,UAAU;IACpBL,YAAY,EAAE,EAAE;IAChBS,KAAK,EAAEpD,MAAM,CAACyC,SAAS;IACvBY,UAAU,EAAE;EACd;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export const BACKDROP_COLOR = {
|
|
4
|
+
INITIAL: 'rgba(51, 51, 51, 0)',
|
|
5
|
+
FINAL: 'rgba(51, 51, 51, 0.66)'
|
|
6
|
+
};
|
|
7
|
+
export const CONTENT_CONTAINER = {
|
|
8
|
+
ANGLE: 5,
|
|
9
|
+
CONTAINER_WIDTH: 769,
|
|
10
|
+
ROTATION_PADDING: 44 // to be sure that the content is not cut off on the edges because of rotate transform
|
|
11
|
+
};
|
|
12
|
+
export const ANIMATION_DURATION = 1750;
|
|
13
|
+
export const MIN_PROBLEMS_TO_SHOW_GIF = 7;
|
|
14
|
+
export const MAX_GIF_SIZE = {
|
|
15
|
+
WIDTH: 480,
|
|
16
|
+
HEIGHT: 300
|
|
17
|
+
};
|
|
18
|
+
export const MIN_GIF_SIZE = 300;
|
|
19
|
+
export const GROUPS_PERCENTAGES = {
|
|
20
|
+
group1: [15, 20, 25, 30],
|
|
21
|
+
// Early celebrations
|
|
22
|
+
group2: [33, 40, 45, 50],
|
|
23
|
+
// Mid celebrations
|
|
24
|
+
group3: [60, 66, 75, 80] // Party
|
|
25
|
+
};
|
|
26
|
+
export const MIN_WIDTH_FOR_ONE_DIGIT = 12;
|
|
27
|
+
export const MIN_WIDTH_FOR_TWO_DIGITS = 15;
|
|
28
|
+
export const GET_GIFS_TIMEOUT = 5000;
|
|
29
|
+
export const GIFS_FETCHED_KEY = 'gifsFetchedTimestamp';
|
|
30
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["BACKDROP_COLOR","INITIAL","FINAL","CONTENT_CONTAINER","ANGLE","CONTAINER_WIDTH","ROTATION_PADDING","ANIMATION_DURATION","MIN_PROBLEMS_TO_SHOW_GIF","MAX_GIF_SIZE","WIDTH","HEIGHT","MIN_GIF_SIZE","GROUPS_PERCENTAGES","group1","group2","group3","MIN_WIDTH_FOR_ONE_DIGIT","MIN_WIDTH_FOR_TWO_DIGITS","GET_GIFS_TIMEOUT","GIFS_FETCHED_KEY"],"sourceRoot":"../../../../src","sources":["features/gifCelebrations/constants.ts"],"mappings":";;AAAA,OAAO,MAAMA,cAAc,GAAG;EAC5BC,OAAO,EAAE,qBAAqB;EAC9BC,KAAK,EAAE;AACT,CAAC;AAED,OAAO,MAAMC,iBAAiB,GAAG;EAC/BC,KAAK,EAAE,CAAC;EACRC,eAAe,EAAE,GAAG;EACpBC,gBAAgB,EAAE,EAAE,CAAE;AACxB,CAAC;AAED,OAAO,MAAMC,kBAAkB,GAAG,IAAI;AACtC,OAAO,MAAMC,wBAAwB,GAAG,CAAC;AAEzC,OAAO,MAAMC,YAAY,GAAG;EAC1BC,KAAK,EAAE,GAAG;EACVC,MAAM,EAAE;AACV,CAAC;AACD,OAAO,MAAMC,YAAY,GAAG,GAAG;AAE/B,OAAO,MAAMC,kBAAkB,GAAG;EAChCC,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;EAAE;EAC1BC,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;EAAE;EAC1BC,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAE;AAC5B,CAAC;AAED,OAAO,MAAMC,uBAAuB,GAAG,EAAE;AACzC,OAAO,MAAMC,wBAAwB,GAAG,EAAE;AAE1C,OAAO,MAAMC,gBAAgB,GAAG,IAAI;AAEpC,OAAO,MAAMC,gBAAgB,GAAG,sBAAsB","ignoreList":[]}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { MIN_WIDTH_FOR_ONE_DIGIT, MIN_WIDTH_FOR_TWO_DIGITS } from "./constants.js";
|
|
4
|
+
import { Image } from 'react-native';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Number of problems When we show gif
|
|
8
|
+
* <6 Never
|
|
9
|
+
* 7-12 50% completion
|
|
10
|
+
* 13-18 33%, 66% completion
|
|
11
|
+
* 19-24 25%, 50%, 75 completion
|
|
12
|
+
* 25-30 20%, 40%, 60%, 80% completion
|
|
13
|
+
* .>30 15%, 30%, 45%, 60%, 75% completion
|
|
14
|
+
*
|
|
15
|
+
* We are also going to have different buckets with different gifs. The logic is as follows:
|
|
16
|
+
* Group 1: 15%, 20%, 25%, 30% - Early celebrations
|
|
17
|
+
* Group 2: 33%, 40%, 45%, 50% - Mid celebrations
|
|
18
|
+
* Group 3: 60%, 66%, 75%, 80% - Party
|
|
19
|
+
* or
|
|
20
|
+
* Group 1: <=30% - Early celebrations
|
|
21
|
+
* Group 2: >30% <60% - Mid celebrations
|
|
22
|
+
* Group 3: >=60% - Party
|
|
23
|
+
*/
|
|
24
|
+
export const generateProblemsGifsTable = (problemsAmount, resolvedProblems, gifs) => {
|
|
25
|
+
const percentageMilestones = getPercentageMilestones(problemsAmount);
|
|
26
|
+
const result = {};
|
|
27
|
+
for (const percentage of percentageMilestones) {
|
|
28
|
+
const problemNumber = Math.ceil(problemsAmount * (percentage / 100));
|
|
29
|
+
if (problemNumber <= resolvedProblems) continue;
|
|
30
|
+
const groupKey = findGroupForPercentage(percentage);
|
|
31
|
+
const gifsInGroup = gifs[groupKey];
|
|
32
|
+
if (!gifsInGroup || gifsInGroup.length === 0) continue;
|
|
33
|
+
const unshownGif = gifsInGroup.find(gif => !gif.isShown);
|
|
34
|
+
const selectedGif = unshownGif || gifsInGroup[0];
|
|
35
|
+
if (selectedGif) {
|
|
36
|
+
result[problemNumber] = {
|
|
37
|
+
url: selectedGif.url,
|
|
38
|
+
group: groupKey
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
const getPercentageMilestones = problemsAmount => {
|
|
45
|
+
if (problemsAmount <= 12) return [50];
|
|
46
|
+
if (problemsAmount <= 18) return [33, 66];
|
|
47
|
+
if (problemsAmount <= 24) return [25, 50, 75];
|
|
48
|
+
if (problemsAmount <= 30) return [20, 40, 60, 80];
|
|
49
|
+
return [15, 30, 45, 60, 75];
|
|
50
|
+
};
|
|
51
|
+
export const generateGifsStructure = gifs => Object.fromEntries(Object.entries(gifs).map(([key, value]) => [key, value.map(url => ({
|
|
52
|
+
url,
|
|
53
|
+
isShown: false,
|
|
54
|
+
group: key
|
|
55
|
+
}))]));
|
|
56
|
+
export const getGifLabel = relatedGroup => {
|
|
57
|
+
if (relatedGroup === 2) {
|
|
58
|
+
return 'gifCelebrations.onTheWay';
|
|
59
|
+
}
|
|
60
|
+
if (relatedGroup === 3) {
|
|
61
|
+
return 'gifCelebrations.almostThere';
|
|
62
|
+
}
|
|
63
|
+
return 'gifCelebrations.greatStart';
|
|
64
|
+
};
|
|
65
|
+
export const getProgressLineWidth = completedPercent => {
|
|
66
|
+
if (completedPercent <= 9) {
|
|
67
|
+
return MIN_WIDTH_FOR_ONE_DIGIT;
|
|
68
|
+
}
|
|
69
|
+
if (completedPercent <= 15) {
|
|
70
|
+
return MIN_WIDTH_FOR_TWO_DIGITS;
|
|
71
|
+
}
|
|
72
|
+
return completedPercent;
|
|
73
|
+
};
|
|
74
|
+
export const findGroupForPercentage = percentage => {
|
|
75
|
+
if (percentage <= 30) {
|
|
76
|
+
return 'group1';
|
|
77
|
+
}
|
|
78
|
+
if (percentage < 60) {
|
|
79
|
+
return 'group2';
|
|
80
|
+
}
|
|
81
|
+
return 'group3';
|
|
82
|
+
};
|
|
83
|
+
export const getImagePath = async (url, cacheMethod) => {
|
|
84
|
+
if (cacheMethod) {
|
|
85
|
+
const path = await cacheMethod(url);
|
|
86
|
+
if (path) return path;
|
|
87
|
+
} else {
|
|
88
|
+
// @ts-ignore
|
|
89
|
+
const isImagesStored = await Image.queryCache([url]).then(images => !!images[url]);
|
|
90
|
+
if (isImagesStored) return url;
|
|
91
|
+
}
|
|
92
|
+
throw new Error('Image not found in cache');
|
|
93
|
+
};
|
|
94
|
+
export const constrainDimension = (value, min, max) => Math.max(min, Math.min(max, value));
|
|
95
|
+
export const shouldRefreshGifs = timestamp => {
|
|
96
|
+
if (!timestamp) return true;
|
|
97
|
+
const REFRESH_INTERVAL_HOURS = 24;
|
|
98
|
+
const lastFetchedDate = new Date(timestamp);
|
|
99
|
+
const currentDate = new Date();
|
|
100
|
+
const diffInHours = (currentDate.getTime() - lastFetchedDate.getTime()) / (1000 * 60 * 60);
|
|
101
|
+
return diffInHours > REFRESH_INTERVAL_HOURS;
|
|
102
|
+
};
|
|
103
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MIN_WIDTH_FOR_ONE_DIGIT","MIN_WIDTH_FOR_TWO_DIGITS","Image","generateProblemsGifsTable","problemsAmount","resolvedProblems","gifs","percentageMilestones","getPercentageMilestones","result","percentage","problemNumber","Math","ceil","groupKey","findGroupForPercentage","gifsInGroup","length","unshownGif","find","gif","isShown","selectedGif","url","group","generateGifsStructure","Object","fromEntries","entries","map","key","value","getGifLabel","relatedGroup","getProgressLineWidth","completedPercent","getImagePath","cacheMethod","path","isImagesStored","queryCache","then","images","Error","constrainDimension","min","max","shouldRefreshGifs","timestamp","REFRESH_INTERVAL_HOURS","lastFetchedDate","Date","currentDate","diffInHours","getTime"],"sourceRoot":"../../../../src","sources":["features/gifCelebrations/helpers.ts"],"mappings":";;AASA,SAASA,uBAAuB,EAAEC,wBAAwB,QAAQ,gBAAa;AAC/E,SAASC,KAAK,QAAQ,cAAc;;AAEpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,yBAAyB,GAAGA,CACvCC,cAAsB,EACtBC,gBAAwB,EACxBC,IAAmB,KACG;EACtB,MAAMC,oBAAoB,GAAGC,uBAAuB,CAACJ,cAAc,CAAC;EAEpE,MAAMK,MAAyB,GAAG,CAAC,CAAC;EAEpC,KAAK,MAAMC,UAAU,IAAIH,oBAAoB,EAAE;IAC7C,MAAMI,aAAa,GAAGC,IAAI,CAACC,IAAI,CAACT,cAAc,IAAIM,UAAU,GAAG,GAAG,CAAC,CAAC;IAEpE,IAAIC,aAAa,IAAIN,gBAAgB,EAAE;IAEvC,MAAMS,QAAQ,GAAGC,sBAAsB,CAACL,UAAU,CAAC;IACnD,MAAMM,WAAW,GAAGV,IAAI,CAACQ,QAAQ,CAAC;IAElC,IAAI,CAACE,WAAW,IAAIA,WAAW,CAACC,MAAM,KAAK,CAAC,EAAE;IAE9C,MAAMC,UAAU,GAAGF,WAAW,CAACG,IAAI,CAAEC,GAAG,IAAK,CAACA,GAAG,CAACC,OAAO,CAAC;IAE1D,MAAMC,WAAW,GAAGJ,UAAU,IAAIF,WAAW,CAAC,CAAC,CAAC;IAEhD,IAAIM,WAAW,EAAE;MACfb,MAAM,CAACE,aAAa,CAAC,GAAG;QACtBY,GAAG,EAAED,WAAW,CAACC,GAAG;QACpBC,KAAK,EAAEV;MACT,CAAC;IACH;EACF;EAEA,OAAOL,MAAM;AACf,CAAC;AACD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,sBAAsB;AAC7C,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["GifCelebrations","GifCelebrationsModel"],"sourceRoot":"../../../../src","sources":["features/gifCelebrations/index.ts"],"mappings":";;AAAA,SAASA,eAAe,QAAQ,sBAAmB;AACnD,SAASC,oBAAoB,QAAQ,kCAA+B","ignoreList":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createEffect, createEvent, createStore } from 'effector';
|
|
4
|
+
import { generateGifsStructure } from "../helpers.js";
|
|
5
|
+
import { Image } from 'react-native';
|
|
6
|
+
export class GifCelebrationsCache {
|
|
7
|
+
initialSet = createEvent();
|
|
8
|
+
set = createEvent();
|
|
9
|
+
reset = createEvent();
|
|
10
|
+
prefetchGifs = createEffect(gifs => {
|
|
11
|
+
if (!gifs || gifs.length === 0) return;
|
|
12
|
+
gifs.forEach(gifUrl => {
|
|
13
|
+
this.prefetchMethod(gifUrl);
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
$gifs = createStore(null).reset(this.reset).on(this.initialSet, (_, gifs) => generateGifsStructure(gifs)).on(this.set, (_, gifs) => gifs);
|
|
17
|
+
constructor({
|
|
18
|
+
customGetCachePathMethod,
|
|
19
|
+
customPrefetchMethod
|
|
20
|
+
}) {
|
|
21
|
+
this.prefetchMethod = customPrefetchMethod || Image.prefetch;
|
|
22
|
+
this.getCachePathMethod = customGetCachePathMethod;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=GifCelebrations.cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createEffect","createEvent","createStore","generateGifsStructure","Image","GifCelebrationsCache","initialSet","set","reset","prefetchGifs","gifs","length","forEach","gifUrl","prefetchMethod","$gifs","on","_","constructor","customGetCachePathMethod","customPrefetchMethod","prefetch","getCachePathMethod"],"sourceRoot":"../../../../../src","sources":["features/gifCelebrations/model/GifCelebrations.cache.ts"],"mappings":";;AAAA,SAASA,YAAY,EAAEC,WAAW,EAAEC,WAAW,QAAQ,UAAU;AAOjE,SAASC,qBAAqB,QAAQ,eAAY;AAClD,SAASC,KAAK,QAAQ,cAAc;AAOpC,OAAO,MAAMC,oBAAoB,CAAC;EAChBC,UAAU,GAAGL,WAAW,CAAa,CAAC;EACtCM,GAAG,GAAGN,WAAW,CAAgB,CAAC;EAClCO,KAAK,GAAGP,WAAW,CAAC,CAAC;EAKrBQ,YAAY,GAAGT,YAAY,CAAkBU,IAAI,IAAK;IACpE,IAAI,CAACA,IAAI,IAAIA,IAAI,CAACC,MAAM,KAAK,CAAC,EAAE;IAEhCD,IAAI,CAACE,OAAO,CAAEC,MAAM,IAAK;MACvB,IAAI,CAACC,cAAc,CAACD,MAAM,CAAC;IAC7B,CAAC,CAAC;EACJ,CAAC,CAAC;EAEcE,KAAK,GAAGb,WAAW,CAAuB,IAAI,CAAC,CAC5DM,KAAK,CAAC,IAAI,CAACA,KAAK,CAAC,CACjBQ,EAAE,CAAC,IAAI,CAACV,UAAU,EAAE,CAACW,CAAC,EAAEP,IAAI,KAAKP,qBAAqB,CAACO,IAAI,CAAC,CAAC,CAC7DM,EAAE,CAAC,IAAI,CAACT,GAAG,EAAE,CAACU,CAAC,EAAEP,IAAI,KAAKA,IAAI,CAAC;EAElCQ,WAAWA,CAAC;IAAEC,wBAAwB;IAAEC;EAAgD,CAAC,EAAE;IACzF,IAAI,CAACN,cAAc,GAAGM,oBAAoB,IAAIhB,KAAK,CAACiB,QAAQ;IAC5D,IAAI,CAACC,kBAAkB,GAAGH,wBAAwB;EACpD;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createEffect, createEvent, createStore, sample } from 'effector';
|
|
4
|
+
import { GifCelebrationsApi } from "./GifCelebrationsApi.js";
|
|
5
|
+
import { GifCelebrationsCache } from "./GifCelebrations.cache.js";
|
|
6
|
+
import { generateProblemsGifsTable, shouldRefreshGifs } from "../helpers.js";
|
|
7
|
+
import { MIN_PROBLEMS_TO_SHOW_GIF, GIFS_FETCHED_KEY } from "../constants.js";
|
|
8
|
+
export class GifCelebrationsModel {
|
|
9
|
+
play = createEvent();
|
|
10
|
+
stop = createEvent();
|
|
11
|
+
resetGifTriggerable = createEvent();
|
|
12
|
+
setGifTriggerable = createEvent();
|
|
13
|
+
$isGifTriggerable = createStore(false).reset(this.resetGifTriggerable).reset(this.stop).on(this.setGifTriggerable, (_, isGifCelebrationMayBeTriggered) => isGifCelebrationMayBeTriggered);
|
|
14
|
+
resetProblemsGifsTable = createEvent();
|
|
15
|
+
$problemsGifsTable = createStore(null).reset(this.resetProblemsGifsTable);
|
|
16
|
+
setActiveGif = createEvent();
|
|
17
|
+
$activeGif = createStore(null).reset(this.stop).reset(this.resetGifTriggerable).on(this.setActiveGif, (_, gif) => gif);
|
|
18
|
+
initialize = createEvent();
|
|
19
|
+
constructor({
|
|
20
|
+
api,
|
|
21
|
+
problemsAmount,
|
|
22
|
+
resolvedProblemsAmount,
|
|
23
|
+
customLocalStorage,
|
|
24
|
+
customGetCachePathMethod,
|
|
25
|
+
customPrefetchMethod
|
|
26
|
+
}) {
|
|
27
|
+
this.api = new GifCelebrationsApi(api);
|
|
28
|
+
this.cache = new GifCelebrationsCache({
|
|
29
|
+
customGetCachePathMethod,
|
|
30
|
+
customPrefetchMethod
|
|
31
|
+
});
|
|
32
|
+
this.$problemsAmount = problemsAmount;
|
|
33
|
+
this.$resolvedProblemsAmount = resolvedProblemsAmount;
|
|
34
|
+
this.localStorage = customLocalStorage || localStorage;
|
|
35
|
+
this.setupEventHandlers();
|
|
36
|
+
}
|
|
37
|
+
setupEventHandlers() {
|
|
38
|
+
sample({
|
|
39
|
+
clock: this.initialize,
|
|
40
|
+
source: this.cache.$gifs,
|
|
41
|
+
filter: gifs => {
|
|
42
|
+
if (!gifs) return true;
|
|
43
|
+
const gifsFetchedTimestamp = this.localStorage.getItem(GIFS_FETCHED_KEY);
|
|
44
|
+
return shouldRefreshGifs(gifsFetchedTimestamp);
|
|
45
|
+
},
|
|
46
|
+
target: this.api.getGifsFx
|
|
47
|
+
});
|
|
48
|
+
sample({
|
|
49
|
+
source: this.api.getGifsFx.doneData,
|
|
50
|
+
filter: response => response.ok,
|
|
51
|
+
fn: response => response.data,
|
|
52
|
+
target: this.cache.initialSet
|
|
53
|
+
});
|
|
54
|
+
sample({
|
|
55
|
+
source: this.api.getGifsFx.doneData,
|
|
56
|
+
filter: response => response.ok,
|
|
57
|
+
target: createEffect(() => {
|
|
58
|
+
this.localStorage.setItem(GIFS_FETCHED_KEY, new Date().toISOString());
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
sample({
|
|
62
|
+
clock: [this.initialize, this.api.getGifsFx.doneData],
|
|
63
|
+
source: {
|
|
64
|
+
gifs: this.cache.$gifs,
|
|
65
|
+
problemsAmount: this.$problemsAmount,
|
|
66
|
+
resolvedProblemsAmount: this.$resolvedProblemsAmount
|
|
67
|
+
},
|
|
68
|
+
filter: ({
|
|
69
|
+
problemsAmount,
|
|
70
|
+
gifs
|
|
71
|
+
}) => !!(problemsAmount >= MIN_PROBLEMS_TO_SHOW_GIF && gifs),
|
|
72
|
+
fn: ({
|
|
73
|
+
problemsAmount,
|
|
74
|
+
resolvedProblemsAmount,
|
|
75
|
+
gifs
|
|
76
|
+
}) => {
|
|
77
|
+
if (!gifs) return null;
|
|
78
|
+
return generateProblemsGifsTable(problemsAmount, resolvedProblemsAmount, gifs);
|
|
79
|
+
},
|
|
80
|
+
target: this.$problemsGifsTable
|
|
81
|
+
});
|
|
82
|
+
sample({
|
|
83
|
+
source: this.$problemsGifsTable,
|
|
84
|
+
filter: problemsGifsTable => !!problemsGifsTable,
|
|
85
|
+
fn: problemsGifsTable => {
|
|
86
|
+
if (!problemsGifsTable) return [];
|
|
87
|
+
return Object.values(problemsGifsTable).map(gif => gif.url);
|
|
88
|
+
},
|
|
89
|
+
target: this.cache.prefetchGifs
|
|
90
|
+
});
|
|
91
|
+
sample({
|
|
92
|
+
clock: this.play,
|
|
93
|
+
source: {
|
|
94
|
+
isGifCelebrationMayBeTriggered: this.$isGifTriggerable,
|
|
95
|
+
gifsGroups: this.cache.$gifs,
|
|
96
|
+
resolvedProblemsAmount: this.$resolvedProblemsAmount,
|
|
97
|
+
problemsGifsTable: this.$problemsGifsTable
|
|
98
|
+
},
|
|
99
|
+
filter: ({
|
|
100
|
+
isGifCelebrationMayBeTriggered,
|
|
101
|
+
gifsGroups,
|
|
102
|
+
resolvedProblemsAmount,
|
|
103
|
+
problemsGifsTable
|
|
104
|
+
}) => !!(isGifCelebrationMayBeTriggered && gifsGroups && resolvedProblemsAmount !== undefined && problemsGifsTable),
|
|
105
|
+
fn: sources => sources,
|
|
106
|
+
target: this.updateGifShownStatus
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
updateGifShownStatus = createEffect(({
|
|
110
|
+
gifsGroups,
|
|
111
|
+
resolvedProblemsAmount,
|
|
112
|
+
problemsGifsTable
|
|
113
|
+
}) => {
|
|
114
|
+
const gifToShow = problemsGifsTable[resolvedProblemsAmount];
|
|
115
|
+
const groupName = gifToShow.group;
|
|
116
|
+
const gifsInGroup = gifsGroups[groupName];
|
|
117
|
+
const selectedGifIndex = gifsInGroup?.findIndex(gif => gif.url === gifToShow.url);
|
|
118
|
+
if (!gifsInGroup || selectedGifIndex === -1) {
|
|
119
|
+
console.warn(`Gif with URL ${gifToShow.url} not found in group ${groupName}`);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const updatedGifsInGroup = gifsInGroup.map((gif, index) => ({
|
|
123
|
+
...gif,
|
|
124
|
+
isShown: index === selectedGifIndex ? true : gif.isShown
|
|
125
|
+
}));
|
|
126
|
+
this.cache.set({
|
|
127
|
+
...gifsGroups,
|
|
128
|
+
[groupName]: updatedGifsInGroup
|
|
129
|
+
});
|
|
130
|
+
this.setActiveGif(gifToShow);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=GifCelebrations.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createEffect","createEvent","createStore","sample","GifCelebrationsApi","GifCelebrationsCache","generateProblemsGifsTable","shouldRefreshGifs","MIN_PROBLEMS_TO_SHOW_GIF","GIFS_FETCHED_KEY","GifCelebrationsModel","play","stop","resetGifTriggerable","setGifTriggerable","$isGifTriggerable","reset","on","_","isGifCelebrationMayBeTriggered","resetProblemsGifsTable","$problemsGifsTable","setActiveGif","$activeGif","gif","initialize","constructor","api","problemsAmount","resolvedProblemsAmount","customLocalStorage","customGetCachePathMethod","customPrefetchMethod","cache","$problemsAmount","$resolvedProblemsAmount","localStorage","setupEventHandlers","clock","source","$gifs","filter","gifs","gifsFetchedTimestamp","getItem","target","getGifsFx","doneData","response","ok","fn","data","initialSet","setItem","Date","toISOString","problemsGifsTable","Object","values","map","url","prefetchGifs","gifsGroups","undefined","sources","updateGifShownStatus","gifToShow","groupName","group","gifsInGroup","selectedGifIndex","findIndex","console","warn","updatedGifsInGroup","index","isShown","set"],"sourceRoot":"../../../../../src","sources":["features/gifCelebrations/model/GifCelebrations.model.ts"],"mappings":";;AAAA,SAASA,YAAY,EAAEC,WAAW,EAAEC,WAAW,EAAEC,MAAM,QAAe,UAAU;AAChF,SAASC,kBAAkB,QAAQ,yBAAsB;AAQzD,SAASC,oBAAoB,QAAQ,4BAAyB;AAC9D,SAASC,yBAAyB,EAAEC,iBAAiB,QAAQ,eAAY;AACzE,SAASC,wBAAwB,EAAEC,gBAAgB,QAAQ,iBAAc;AAQzE,OAAO,MAAMC,oBAAoB,CAAC;EAOhBC,IAAI,GAAGV,WAAW,CAAC,CAAC;EACpBW,IAAI,GAAGX,WAAW,CAAC,CAAC;EAEpBY,mBAAmB,GAAGZ,WAAW,CAAC,CAAC;EACnCa,iBAAiB,GAAGb,WAAW,CAAU,CAAC;EAC1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ACoB;IACf,CAAC,CAAC;EACJ;EAEiBA,oBAAoB,GAAGjE,YAAY,CAClD,CAAC;IAAE8D,UAAU;IAAEjC,sBAAsB;IAAE2B;EAA2C,CAAC,KAAK;IACtF,MAAMU,SAAS,GAAGV,iBAAiB,CAAC3B,sBAAsB,CAAC;IAC3D,MAAMsC,SAAS,GAAGD,SAAS,CAACE,KAAK;IAEjC,MAAMC,WAAW,GAAGP,UAAU,CAACK,SAAS,CAAC;IACzC,MAAMG,gBAAgB,GAAGD,WAAW,EAAEE,SAAS,CAAE/C,GAAG,IAAKA,GAAG,CAACoC,GAAG,KAAKM,SAAS,CAACN,GAAG,CAAC;IAEnF,IAAI,CAACS,WAAW,IAAIC,gBAAgB,KAAK,CAAC,CAAC,EAAE;MAC3CE,OAAO,CAACC,IAAI,CAAC,gBAAgBP,SAAS,CAACN,GAAG,uBAAuBO,SAAS,EAAE,CAAC;MAC7E;IACF;IAEA,MAAMO,kBAAkB,GAAGL,WAAW,CAACV,GAAG,CAAC,CAACnC,GAAG,EAAEmD,KAAK,MAAM;MAC1D,GAAGnD,GAAG;MACNoD,OAAO,EAAED,KAAK,KAAKL,gBAAgB,GAAG,IAAI,GAAG9C,GAAG,CAACoD;IACnD,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC3C,KAAK,CAAC4C,GAAG,CAAC;MACb,GAAGf,UAAU;MACb,CAACK,SAAS,GAAGO;IACf,CAAC,CAAC;IAEF,IAAI,CAACpD,YAAY,CAAC4C,SAAS,CAAC;EAC9B,CACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createControllerEffect } from "./../../../lib/effector/createControllerEffect.js";
|
|
4
|
+
import { GET_GIFS_TIMEOUT } from "../constants.js";
|
|
5
|
+
export class GifCelebrationsApi {
|
|
6
|
+
failedGetGifxTimeout = null;
|
|
7
|
+
constructor(api) {
|
|
8
|
+
this.getGifsFx = createControllerEffect(() => api.getGifs());
|
|
9
|
+
this.getGifsFx.fail.watch(() => {
|
|
10
|
+
this.failedGetGifxTimeout = setTimeout(() => {
|
|
11
|
+
this.getGifsFx();
|
|
12
|
+
}, GET_GIFS_TIMEOUT);
|
|
13
|
+
});
|
|
14
|
+
this.getGifsFx.done.watch(() => {
|
|
15
|
+
if (this.failedGetGifxTimeout) {
|
|
16
|
+
clearTimeout(this.failedGetGifxTimeout);
|
|
17
|
+
this.failedGetGifxTimeout = null;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=GifCelebrationsApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createControllerEffect","GET_GIFS_TIMEOUT","GifCelebrationsApi","failedGetGifxTimeout","constructor","api","getGifsFx","getGifs","fail","watch","setTimeout","done","clearTimeout"],"sourceRoot":"../../../../../src","sources":["features/gifCelebrations/model/GifCelebrationsApi.ts"],"mappings":";;AAAA,SAASA,sBAAsB,QAAQ,mDAAgD;AAEvF,SAASC,gBAAgB,QAAQ,iBAAc;AAE/C,OAAO,MAAMC,kBAAkB,CAAC;EAGtBC,oBAAoB,GAA0B,IAAI;EAE1DC,WAAWA,CAACC,GAA8B,EAAE;IAC1C,IAAI,CAACC,SAAS,GAAGN,sBAAsB,CAAC,MAAMK,GAAG,CAACE,OAAO,CAAC,CAAC,CAAC;IAE5D,IAAI,CAACD,SAAS,CAACE,IAAI,CAACC,KAAK,CAAC,MAAM;MAC9B,IAAI,CAACN,oBAAoB,GAAGO,UAAU,CAAC,MAAM;QAC3C,IAAI,CAACJ,SAAS,CAAC,CAAC;MAClB,CAAC,EAAEL,gBAAgB,CAAC;IACtB,CAAC,CAAC;IAEF,IAAI,CAACK,SAAS,CAACK,IAAI,CAACF,KAAK,CAAC,MAAM;MAC9B,IAAI,IAAI,CAACN,oBAAoB,EAAE;QAC7BS,YAAY,CAAC,IAAI,CAACT,oBAAoB,CAAC;QACvC,IAAI,CAACA,oBAAoB,GAAG,IAAI;MAClC;IACF,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["features/gifCelebrations/types/model.types.ts"],"mappings":"","ignoreList":[]}
|
package/dist/module/index.js
CHANGED
|
@@ -8,4 +8,5 @@ export * from "./features/celebrations/index.js";
|
|
|
8
8
|
export * from "./features/endOfAssignment/index.js";
|
|
9
9
|
export * from "./features/formulaSheet/index.js";
|
|
10
10
|
export * from "./features/problemSelector/index.js";
|
|
11
|
+
export * from "./features/gifCelebrations/index.js";
|
|
11
12
|
//# sourceMappingURL=index.js.map
|
package/dist/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useFeaturesLocalization","setFeaturesLocalization","Locale","generateRandomId"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,uBAAuB,EAAEC,uBAAuB,EAAEC,MAAM,QAAQ,+BAAsB;AAC/F,SAASC,gBAAgB,QAAQ,0BAAuB;AACxD,cAAc,6BAAoB;AAClC,cAAc,8BAAqB;AACnC,cAAc,kCAAyB;AACvC,cAAc,qCAA4B;AAC1C,cAAc,kCAAyB;AACvC,cAAc,qCAA4B","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useFeaturesLocalization","setFeaturesLocalization","Locale","generateRandomId"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,uBAAuB,EAAEC,uBAAuB,EAAEC,MAAM,QAAQ,+BAAsB;AAC/F,SAASC,gBAAgB,QAAQ,0BAAuB;AACxD,cAAc,6BAAoB;AAClC,cAAc,8BAAqB;AACnC,cAAc,kCAAyB;AACvC,cAAc,qCAA4B;AAC1C,cAAc,kCAAyB;AACvC,cAAc,qCAA4B;AAC1C,cAAc,qCAA4B","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createEffect","controlledRequest","request","data","controller","AbortController","abortAfter","timeout","setTimeout","abort","response","signal","clearTimeout","error","code","reason","Error","createControllerEffect","fn","effect","fail","watch"],"sourceRoot":"../../../../src","sources":["lib/effector/createControllerEffect.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAqB,UAAU;AAkBpD,OAAO,SAASC,iBAAiBA,
|
|
1
|
+
{"version":3,"names":["createEffect","controlledRequest","request","data","controller","AbortController","abortAfter","timeout","setTimeout","abort","response","signal","clearTimeout","error","code","reason","Error","createControllerEffect","fn","effect","fail","watch"],"sourceRoot":"../../../../src","sources":["lib/effector/createControllerEffect.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAqB,UAAU;AAkBpD,OAAO,SAASC,iBAAiBA,CAC/BC,OAAiE,EACjE;EACA,OAAO,OAAO;IACZC,IAAI;IACJC,UAAU,GAAG,IAAIC,eAAe,CAAC,CAAC;IAClCC,UAAU,GAAG;EACY,CAAC,KAAK;IAC/B,IAAIC,OAA6C,GAAG,IAAI;IAExD,IAAID,UAAU,EAAE;MACdC,OAAO,GAAGC,UAAU,CAAC,MAAM;QACzBJ,UAAU,CAACK,KAAK,CAAC,SAAS,CAAC;MAC7B,CAAC,EAAEH,UAAU,CAAC;IAChB;IAEA,IAAI;MACF,MAAMI,QAAQ,GAAG,MAAMR,OAAO,CAACC,IAAI,EAAE;QAAEQ,MAAM,EAAEP,UAAU,EAAEO;MAAO,CAAC,CAAC;MACpE,IAAIJ,OAAO,KAAK,IAAI,EAAEK,YAAY,CAACL,OAAO,CAAC;MAC3C,OAAOG,QAAQ;IACjB,CAAC,CAAC,OAAOG,KAAc,EAAE;MACvB,IAAKA,KAAK,CAAuBC,IAAI,KAAK,cAAc,EAAE;QACxD,IAAIV,UAAU,CAACO,MAAM,CAACI,MAAM,KAAK,SAAS,EAAE;UAC1C,MAAM,IAAIC,KAAK,CAAC,mBAAmB,CAAC;QACtC;QACA,MAAM,IAAIA,KAAK,CAAC,0BAA0B,CAAC;MAC7C;MAEA,MAAMH,KAAK;IACb;EACF,CAAC;AACH;AAEA,OAAO,MAAMI,sBAAsB,GACjCC,EAA4D,IACzD;EACH,MAAMhB,OAAO,GAAGD,iBAAiB,CAAOiB,EAAE,CAAC;EAC3C,MAAMC,MAAM,GAAGnB,YAAY,CAAEG,IAAO,IAClCD,OAAO,CAAC;IAAEC,IAAI;IAAEC,UAAU,EAAEe,MAAM,CAACf;EAAW,CAAC,CACjD,CAA2B;EAC3Be,MAAM,CAACf,UAAU,GAAG,IAAIC,eAAe,CAAC,CAAC;EAEzCc,MAAM,CAACC,IAAI,CAACC,KAAK,CAAC,MAAM;IACtBF,MAAM,CAACf,UAAU,GAAG,IAAIC,eAAe,CAAC,CAAC;EAC3C,CAAC,CAAC;EAEF,OAAOc,MAAM;AACf,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["react-app-env.d.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -18,5 +18,10 @@
|
|
|
18
18
|
"errorMessage": "Something went wrong! Try again",
|
|
19
19
|
"howCanIHelp": "Hi! Do you want help?",
|
|
20
20
|
"showError": "Show error"
|
|
21
|
+
},
|
|
22
|
+
"gifCelebrations": {
|
|
23
|
+
"greatStart": "Great start!",
|
|
24
|
+
"onTheWay": "On the way!",
|
|
25
|
+
"almostThere": "Almost there"
|
|
21
26
|
}
|
|
22
27
|
}
|
|
@@ -18,5 +18,10 @@
|
|
|
18
18
|
"errorMessage": "Something went wrong! Try again",
|
|
19
19
|
"howCanIHelp": "Hi! Do you want help?",
|
|
20
20
|
"showError": "Show error"
|
|
21
|
+
},
|
|
22
|
+
"gifCelebrations": {
|
|
23
|
+
"greatStart": "Great start!",
|
|
24
|
+
"onTheWay": "On the way!",
|
|
25
|
+
"almostThere": "Almost there"
|
|
21
26
|
}
|
|
22
27
|
}
|
|
@@ -18,5 +18,10 @@
|
|
|
18
18
|
"errorMessage": "Något gick snett! Försök igen",
|
|
19
19
|
"howCanIHelp": "Hej! Hur kan jag hjälpa dig?",
|
|
20
20
|
"showError": "Visa fel"
|
|
21
|
+
},
|
|
22
|
+
"gifCelebrations": {
|
|
23
|
+
"greatStart": "Bra start!",
|
|
24
|
+
"onTheWay": "På god väg!",
|
|
25
|
+
"almostThere": "Nästan där"
|
|
21
26
|
}
|
|
22
27
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/common.types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/endOfAssignment/components/Modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAuB,MAAM,OAAO,CAAA;AAC7D,OAAO,EAGL,SAAS,EAET,SAAS,EAGT,SAAS,EACV,MAAM,cAAc,CAAA;AAwBrB,MAAM,MAAM,UAAU,GAAG;IACvB,SAAS,EAAE,OAAO,CAAA;IAClB,OAAO,EAAE,SAAS,CAAA;IAClB,aAAa,EAAE,OAAO,CAAA;IACtB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,KAAK,CAAC,EAAE;QACN,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;QAC9B,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;QAChC,MAAM,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC,SAAS,CAAC,CAAA;QACpD,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC,SAAS,CAAC,CAAA;QACrD,MAAM,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;QAC7B,WAAW,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;KACnC,CAAA;CACF,CAAA;AAED,eAAO,MAAM,KAAK,2EAOf,UAAU,
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/endOfAssignment/components/Modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAuB,MAAM,OAAO,CAAA;AAC7D,OAAO,EAGL,SAAS,EAET,SAAS,EAGT,SAAS,EACV,MAAM,cAAc,CAAA;AAwBrB,MAAM,MAAM,UAAU,GAAG;IACvB,SAAS,EAAE,OAAO,CAAA;IAClB,OAAO,EAAE,SAAS,CAAA;IAClB,aAAa,EAAE,OAAO,CAAA;IACtB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,KAAK,CAAC,EAAE;QACN,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;QAC9B,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;QAChC,MAAM,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC,SAAS,CAAC,CAAA;QACpD,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC,SAAS,CAAC,CAAA;QACrD,MAAM,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;QAC7B,WAAW,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;KACnC,CAAA;CACF,CAAA;AAED,eAAO,MAAM,KAAK,2EAOf,UAAU,6BA+BZ,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { GifCelebrationsModel } from './model/GifCelebrations.model';
|
|
3
|
+
import { TextComponentType } from './types/model.types';
|
|
4
|
+
type GifCelebrationsProps = {
|
|
5
|
+
model: GifCelebrationsModel;
|
|
6
|
+
TextComponent: TextComponentType;
|
|
7
|
+
};
|
|
8
|
+
export declare const GifCelebrations: ({ model, TextComponent }: GifCelebrationsProps) => React.JSX.Element | null;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=GifCelebrations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GifCelebrations.d.ts","sourceRoot":"","sources":["../../../../../src/features/gifCelebrations/GifCelebrations.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAA;AAQxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,EAAiB,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEtE,KAAK,oBAAoB,GAAG;IAC1B,KAAK,EAAE,oBAAoB,CAAA;IAC3B,aAAa,EAAE,iBAAiB,CAAA;CACjC,CAAA;AAED,eAAO,MAAM,eAAe,6BAA8B,oBAAoB,6BA0D7E,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SharedValue } from 'react-native-reanimated';
|
|
3
|
+
import { ProgressValue } from '../types/model.types';
|
|
4
|
+
type BackdropProps = {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
progress: SharedValue<ProgressValue>;
|
|
7
|
+
};
|
|
8
|
+
export declare const Backdrop: ({ children, progress }: BackdropProps) => React.JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=Backdrop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Backdrop.d.ts","sourceRoot":"","sources":["../../../../../../src/features/gifCelebrations/components/Backdrop.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAiB,EAAsC,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAEnG,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEpD,KAAK,aAAa,GAAG;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,QAAQ,EAAE,WAAW,CAAC,aAAa,CAAC,CAAA;CACrC,CAAA;AAED,eAAO,MAAM,QAAQ,2BAA4B,aAAa,sBAmB7D,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SharedValue } from 'react-native-reanimated';
|
|
3
|
+
import { ProgressValue } from '../types/model.types';
|
|
4
|
+
type ContentContainerProps = {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
progress: SharedValue<ProgressValue>;
|
|
7
|
+
};
|
|
8
|
+
export declare const ContentContainer: ({ children, progress }: ContentContainerProps) => React.JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=ContentContainer.d.ts.map
|
package/dist/typescript/commonjs/features/gifCelebrations/components/ContentContainer.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentContainer.d.ts","sourceRoot":"","sources":["../../../../../../src/features/gifCelebrations/components/ContentContainer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAiB,EAAiC,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAE9F,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEpD,KAAK,qBAAqB,GAAG;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,QAAQ,EAAE,WAAW,CAAC,aAAa,CAAC,CAAA;CACrC,CAAA;AAED,eAAO,MAAM,gBAAgB,2BAA4B,qBAAqB,sBAsB7E,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CustomGetCachePathMethod, GifObject, TextComponentType } from '../types/model.types';
|
|
3
|
+
type GifProps = {
|
|
4
|
+
gifObject: GifObject;
|
|
5
|
+
getCachePathMethod?: CustomGetCachePathMethod;
|
|
6
|
+
TextComponent: TextComponentType;
|
|
7
|
+
};
|
|
8
|
+
export declare const Gif: ({ gifObject, getCachePathMethod, TextComponent }: GifProps) => React.JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=Gif.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Gif.d.ts","sourceRoot":"","sources":["../../../../../../src/features/gifCelebrations/components/Gif.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoC,MAAM,OAAO,CAAA;AAExD,OAAO,EAAE,wBAAwB,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAO7F,KAAK,QAAQ,GAAG;IACd,SAAS,EAAE,SAAS,CAAA;IACpB,kBAAkB,CAAC,EAAE,wBAAwB,CAAA;IAC7C,aAAa,EAAE,iBAAiB,CAAA;CACjC,CAAA;AAED,eAAO,MAAM,GAAG,qDAAsD,QAAQ,sBAkD7E,CAAA"}
|