manage-app-sdk 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/README.md +2 -0
  2. package/dist/Constants/Home.js +85 -0
  3. package/dist/assets/AppConstant.js +293 -0
  4. package/dist/assets/androidResources/Connectivity.java +52 -0
  5. package/dist/assets/androidResources/ConnectivityPackage.java +25 -0
  6. package/dist/assets/fonts/VoltePlay-Bold.ttf +0 -0
  7. package/dist/assets/fonts/VoltePlay-Light.ttf +0 -0
  8. package/dist/assets/fonts/VoltePlay-Medium.ttf +0 -0
  9. package/dist/assets/fonts/VoltePlay-Regular.ttf +0 -0
  10. package/dist/assets/fonts/VoltePlay-SemiBold.ttf +0 -0
  11. package/dist/assets/gif/loader.gif +0 -0
  12. package/dist/assets/images/PartnerLogosSmall.png +0 -0
  13. package/dist/assets/images/Union.png +0 -0
  14. package/dist/assets/images/appIcon.png +0 -0
  15. package/dist/assets/images/desktop-alert.png +0 -0
  16. package/dist/assets/images/desktop-cross.png +0 -0
  17. package/dist/assets/images/mobile-bg.png +0 -0
  18. package/dist/assets/images/stepper-one-small.png +0 -0
  19. package/dist/assets/images/stepper-one.png +0 -0
  20. package/dist/assets/images/stepper-two-small.png +0 -0
  21. package/dist/assets/images/stepper-two.png +0 -0
  22. package/dist/assets/images/tablet-bg.png +0 -0
  23. package/dist/assets/png/Tataplay-Binge.png +0 -0
  24. package/dist/assets/png/arrowBack.png +0 -0
  25. package/dist/assets/png/backArrowPng.png +0 -0
  26. package/dist/assets/svg/BingeLogoSvg.js +44 -0
  27. package/dist/assets/svg/CrossSvg.js +32 -0
  28. package/dist/assets/svg/OfferSvg.js +31 -0
  29. package/dist/assets/svg/PlansSvg.js +75 -0
  30. package/dist/assets/svg/TickSvg.js +28 -0
  31. package/dist/assets/svg/arrowBack.js +27 -0
  32. package/dist/assets/svg/arrowSvg.js +31 -0
  33. package/dist/components/AppIcon/AppIcon.js +70 -0
  34. package/dist/components/AppleBanner/AppleMusicBanner.js +36 -0
  35. package/dist/components/AppleBanner/AppleMusicBannerStyles.js +32 -0
  36. package/dist/components/AppleBanner/AppleMusicBlackBanner.js +66 -0
  37. package/dist/components/AppsContainer/AppsContainer.js +112 -0
  38. package/dist/components/BottomSheet/BottomSheet.js +173 -0
  39. package/dist/components/BottomSheet/BottomSheetStyles.js +48 -0
  40. package/dist/components/Buttons/PrimaryButton/PrimaryButton.js +50 -0
  41. package/dist/components/Buttons/RadioButton/RadioButton.js +24 -0
  42. package/dist/components/Buttons/TextButton/TextButton.js +44 -0
  43. package/dist/components/CheckButton/CheckButton.js +36 -0
  44. package/dist/components/CommonModal/CommonModel.js +79 -0
  45. package/dist/components/CommonModal/ModalTypes.js +10 -0
  46. package/dist/components/Confetti/ConfettiBurst.js +120 -0
  47. package/dist/components/Confetti/FallingConfetti.js +190 -0
  48. package/dist/components/Confetti/MultiConfettiBurst.js +73 -0
  49. package/dist/components/Coupon/CouponCard.js +47 -0
  50. package/dist/components/Coupon/CouponStyles.js +54 -0
  51. package/dist/components/Footer/Footer.js +177 -0
  52. package/dist/components/Footer/MServiceFooter/MServiceFooter.js +103 -0
  53. package/dist/components/Footer/OnButtonFooter/OneButtonFooter.js +65 -0
  54. package/dist/components/Footer/PlanSummaryFooter/SummaryFooter.js +180 -0
  55. package/dist/components/Footer/PrimeAoFooter/PrimeAoFooter.js +193 -0
  56. package/dist/components/Footer/UpgradeFooter/UpgradeFooter.js +89 -0
  57. package/dist/components/Footer/UpgradeFooter/styles.js +73 -0
  58. package/dist/components/GradientBorderContainer/GradientBorderContainer.js +79 -0
  59. package/dist/components/GradientText/GradientText.js +60 -0
  60. package/dist/components/Header/ManageAppHeader.js +71 -0
  61. package/dist/components/HighlightedText/HighlightedText.js +53 -0
  62. package/dist/components/Input/OtpInput.js +105 -0
  63. package/dist/components/Loader/Loader.js +39 -0
  64. package/dist/components/MServicePaymentMethod/MServicePaymentMethod.js +395 -0
  65. package/dist/components/MicroDrama/MicroDramaBanner.js +67 -0
  66. package/dist/components/MicroDrama/MicroDramaCard.js +33 -0
  67. package/dist/components/MicroDrama/styles.js +29 -0
  68. package/dist/components/OfferCard/OfferCard.js +100 -0
  69. package/dist/components/PaymentMethod/PaymentMethod.js +370 -0
  70. package/dist/components/Plan/CurrentPlanCard.js +138 -0
  71. package/dist/components/Plan/PlanCard.js +268 -0
  72. package/dist/components/Plan/PlanCardStyles.js +371 -0
  73. package/dist/components/Plan/RenderAppIcons.js +115 -0
  74. package/dist/components/Plan/SpecialPlanCard.js +272 -0
  75. package/dist/components/PopUps/CancelPopUp/CancelPopUp.js +190 -0
  76. package/dist/components/PopUps/ConfettiAnimation.js +172 -0
  77. package/dist/components/PopUps/ConfettiBurst.js +142 -0
  78. package/dist/components/PopUps/CouponPopUp/CouponPopUp.js +185 -0
  79. package/dist/components/PopUps/ErrorMsgPopup/ErrorMsgPopup.js +104 -0
  80. package/dist/components/PopUps/InternetErrorPopUp/InternetErrorPopUp.js +122 -0
  81. package/dist/components/PopUps/MServicePopUp/MServicePopUp.js +155 -0
  82. package/dist/components/PopUps/MpinPopUp/MpinPopUp.js +193 -0
  83. package/dist/components/PopUps/OtpPopup/OtpPopup.js +345 -0
  84. package/dist/components/PopUps/PlanCancelledPopUp/PlanCancelledPopUp.js +183 -0
  85. package/dist/components/PopUps/PlanDetailPopup/PlanDetailPopup.js +121 -0
  86. package/dist/components/PopUps/PopUp/PopUp.js +171 -0
  87. package/dist/components/PrimeAddOn/PrimeAddOn.js +72 -0
  88. package/dist/components/PrimeAddOn/PrimeAddOnStyles.js +79 -0
  89. package/dist/components/PrimeAddOn/SummaryPage/PrimeAddOnBanner.js +109 -0
  90. package/dist/components/PrimeBanner/PrimeBanner.js +27 -0
  91. package/dist/components/PrimeBanner/PrimeBannerStyles.js +36 -0
  92. package/dist/components/SectionItem/SectionItem.js +42 -0
  93. package/dist/components/Toast/Toast.js +71 -0
  94. package/dist/components/Toast/ToastStyle.js +62 -0
  95. package/dist/navigation/Routes.js +84 -0
  96. package/dist/navigation/RoutesConstants.js +18 -0
  97. package/dist/screens/AppDiscontinue/ChooseApp.js +325 -0
  98. package/dist/screens/AppDiscontinue/styles.js +89 -0
  99. package/dist/screens/AppsReplacement/AppsReplacement.js +359 -0
  100. package/dist/screens/AppsReplacement/styles.js +92 -0
  101. package/dist/screens/ChooseYourPlan/ChooseYourPlan.js +596 -0
  102. package/dist/screens/ChooseYourPlan/ChooseYourPlanStyles.js +28 -0
  103. package/dist/screens/ChooseYourPlan/OffersCarousel.js +146 -0
  104. package/dist/screens/CreateSession/CreateSession.js +620 -0
  105. package/dist/screens/MyPlan/MyPlan.js +429 -0
  106. package/dist/screens/MyPlan/MyPlanStyles.js +227 -0
  107. package/dist/screens/PaymentStatus/PaymentStatus.js +492 -0
  108. package/dist/screens/PaymentStatus/styles.js +68 -0
  109. package/dist/screens/PlanCancellation/CancelPlan.js +127 -0
  110. package/dist/screens/PlanCancellation/InfiniteAutoScroll.js +67 -0
  111. package/dist/screens/PlanCancellation/styles.js +83 -0
  112. package/dist/screens/PlanSummary/PlanSummary.js +748 -0
  113. package/dist/screens/PlanSummary/PlanSummaryStyles.js +385 -0
  114. package/dist/screens/PrimePlanSummary/PrimePlanSummary.js +252 -0
  115. package/dist/screens/PrimePlanSummary/PrimePlanSummaryStyles.js +102 -0
  116. package/dist/screens/SelectApps/SelectApps.js +513 -0
  117. package/dist/screens/SelectApps/SelectAppsStyles.js +165 -0
  118. package/dist/screens/SplashScreen/SplashScreen.js +82 -0
  119. package/dist/services/apiCall/action.js +718 -0
  120. package/dist/services/apiCall/apiServiceUtils.js +136 -0
  121. package/dist/services/apiCall/constants.js +42 -0
  122. package/dist/services/apiCall/parser.js +92 -0
  123. package/dist/services/apiCall/reducer.js +591 -0
  124. package/dist/services/global/action.js +111 -0
  125. package/dist/services/global/commonReducer.js +97 -0
  126. package/dist/services/global/constants.js +22 -0
  127. package/dist/services/serviceCommonHandler.js +220 -0
  128. package/dist/store/configureStore.js +13 -0
  129. package/dist/store/rootReducer.js +14 -0
  130. package/dist/utils/commonUtils.js +381 -0
  131. package/dist/utils/fontUtils.js +13 -0
  132. package/dist/utils/string.js +101 -0
  133. package/package.json +53 -0
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _reactNative = require("react-native");
8
+ var _AppConstant = require("../../assets/AppConstant");
9
+ const ratio = _AppConstant.AppConstant.dimension.aspectRatio;
10
+ var _default = exports.default = styles = _reactNative.StyleSheet.create({
11
+ wrapper: {
12
+ ..._reactNative.StyleSheet.absoluteFillObject,
13
+ justifyContent: "flex-end"
14
+ },
15
+ backdrop: {
16
+ ..._reactNative.StyleSheet.absoluteFillObject,
17
+ backgroundColor: "#000"
18
+ },
19
+ sheet: {
20
+ width: "100%",
21
+ borderTopLeftRadius: 20,
22
+ borderTopRightRadius: 20,
23
+ shadowColor: "#000",
24
+ shadowOffset: {
25
+ width: 0,
26
+ height: -4
27
+ },
28
+ shadowOpacity: 0.25,
29
+ shadowRadius: 4,
30
+ elevation: 10,
31
+ overflow: "hidden",
32
+ justifyContent: "flex-start"
33
+ },
34
+ handleContainer: {
35
+ alignItems: "center",
36
+ paddingVertical: 10
37
+ },
38
+ handle: {
39
+ width: 40,
40
+ height: 4,
41
+ backgroundColor: "#D1D5DB",
42
+ borderRadius: 2
43
+ },
44
+ content: {
45
+ // flex: 1,
46
+ // paddingHorizontal: 20,
47
+ }
48
+ });
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _reactNative = require("react-native");
10
+ var _AppConstant = require("../../../assets/AppConstant");
11
+ var _fontUtils = require("../../../utils/fontUtils");
12
+ const PrimaryButton = ({
13
+ title,
14
+ onPress,
15
+ disabled = false,
16
+ style,
17
+ textStyle
18
+ }) => {
19
+ return /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
20
+ style: [styles.button, disabled && styles.disabledButton, style],
21
+ onPress: onPress,
22
+ activeOpacity: 0.8,
23
+ disabled: disabled
24
+ }, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
25
+ style: [styles.text, textStyle]
26
+ }, title));
27
+ };
28
+ var _default = exports.default = PrimaryButton;
29
+ const ratio = _AppConstant.AppConstant.dimension.aspectRatio;
30
+ const styles = _reactNative.StyleSheet.create({
31
+ button: {
32
+ backgroundColor: "#e10192",
33
+ borderRadius: 4 * ratio,
34
+ width: 294 * ratio,
35
+ height: 45 * ratio,
36
+ justifyContent: "center",
37
+ alignItems: "center",
38
+ marginTop: 6 * ratio,
39
+ paddingHorizontal: 20
40
+ },
41
+ disabledButton: {
42
+ backgroundColor: "#8e80a1"
43
+ },
44
+ text: {
45
+ color: "#FFFFFF",
46
+ fontSize: (0, _AppConstant.normalizeFont)(16),
47
+ letterSpacing: 1,
48
+ fontFamily: _fontUtils.FONTS.SemiBold
49
+ }
50
+ });
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _reactNative = require("react-native");
10
+ var _PlanCardStyles = _interopRequireDefault(require("../../Plan/PlanCardStyles"));
11
+ const RadioButton = ({
12
+ selected,
13
+ onPress,
14
+ containerStyle
15
+ }) => {
16
+ return /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
17
+ style: [_PlanCardStyles.default.radioButton, selected && _PlanCardStyles.default.selectedRadioButton, containerStyle],
18
+ onPress: () => onPress(!selected),
19
+ activeOpacity: 0.7
20
+ }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
21
+ style: [_PlanCardStyles.default.radioButtonInner, selected && _PlanCardStyles.default.selectedRadioInner]
22
+ }));
23
+ };
24
+ var _default = exports.default = RadioButton;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _reactNative = require("react-native");
9
+ var _react = _interopRequireDefault(require("react"));
10
+ var _AppConstant = require("../../../assets/AppConstant");
11
+ var _fontUtils = require("../../../utils/fontUtils");
12
+ const TextButton = ({
13
+ title,
14
+ style,
15
+ textStyle,
16
+ onPress = null
17
+ }) => {
18
+ return /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
19
+ activeOpacity: 0.7,
20
+ style: [styles.button, style],
21
+ onPress: onPress
22
+ }, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
23
+ style: [styles.buttonText, textStyle]
24
+ }, title));
25
+ };
26
+ var _default = exports.default = TextButton;
27
+ const ratio = _AppConstant.AppConstant.dimension.aspectRatio;
28
+ const styles = _reactNative.StyleSheet.create({
29
+ button: {
30
+ width: 294 * ratio,
31
+ height: 45 * ratio,
32
+ justifyContent: "center",
33
+ alignItems: "center",
34
+ marginTop: 6 * ratio,
35
+ paddingHorizontal: 20
36
+ },
37
+ buttonText: {
38
+ width: "100%",
39
+ textAlign: "center",
40
+ color: "#F3CBE3",
41
+ fontSize: (0, _AppConstant.normalizeFont)(16),
42
+ fontFamily: _fontUtils.FONTS.SemiBold
43
+ }
44
+ });
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _reactNative = require("react-native");
9
+ var _AppConstant = require("../../assets/AppConstant");
10
+ var _TickSvg = _interopRequireDefault(require("../../assets/svg/TickSvg"));
11
+ const CheckButton = ({
12
+ checked,
13
+ onClick,
14
+ style
15
+ }) => {
16
+ return /*#__PURE__*/React.createElement(_reactNative.TouchableHighlight, {
17
+ activeOpacity: 0.7,
18
+ onPress: onClick,
19
+ style: [styles.container, checked && styles.checked, style]
20
+ }, checked ? /*#__PURE__*/React.createElement(_TickSvg.default, null) : /*#__PURE__*/React.createElement(_reactNative.View, null));
21
+ };
22
+ var _default = exports.default = CheckButton;
23
+ const ratio = _AppConstant.AppConstant.dimension.aspectRatio;
24
+ const styles = _reactNative.StyleSheet.create({
25
+ container: {
26
+ width: 18 * ratio,
27
+ height: 18 * ratio,
28
+ borderRadius: 4 * ratio,
29
+ justifyContent: "center",
30
+ alignItems: "center",
31
+ backgroundColor: "#FFFFFF"
32
+ },
33
+ checked: {
34
+ backgroundColor: "#E10092"
35
+ }
36
+ });
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _reactNative = require("react-native");
10
+ var _reactRedux = require("react-redux");
11
+ var _PopUp = _interopRequireDefault(require("../../components/PopUps/PopUp/PopUp"));
12
+ var _ModalTypes = require("./ModalTypes");
13
+ var _BottomSheet = _interopRequireDefault(require("../BottomSheet/BottomSheet"));
14
+ var _action = require("../../services/global/action");
15
+ const CommonModel = () => {
16
+ const dispatch = (0, _reactRedux.useDispatch)();
17
+ const {
18
+ modalParameter,
19
+ openModal
20
+ } = (0, _reactRedux.useSelector)(state => state.commonReducer);
21
+ const {
22
+ Component,
23
+ redirect,
24
+ type,
25
+ pageData,
26
+ modalData,
27
+ modalType = _ModalTypes.MODAL_TYPES.Modal,
28
+ options = {}
29
+ } = modalParameter ?? {};
30
+ const handleClose = () => dispatch((0, _action.hideModal)());
31
+ if (!openModal) return null;
32
+ if (modalType === _ModalTypes.MODAL_TYPES.Modal) {
33
+ return typeof Component === "function" ? /*#__PURE__*/React.createElement(_reactNative.View, {
34
+ style: styles.container
35
+ }, /*#__PURE__*/React.createElement(Component, (0, _extends2.default)({}, modalParameter, {
36
+ onClose: handleClose
37
+ }))) : /*#__PURE__*/React.createElement(_reactNative.View, {
38
+ style: styles.container
39
+ }, /*#__PURE__*/React.createElement(_PopUp.default, {
40
+ modalData: modalData,
41
+ type: type,
42
+ redirect: redirect,
43
+ onClose: handleClose
44
+ }));
45
+ }
46
+ if (modalType === _ModalTypes.MODAL_TYPES.BottomSheet) {
47
+ const {
48
+ gradientColors,
49
+ heightPercentage
50
+ } = options ?? {};
51
+ if (typeof Component !== "function") return null;
52
+ return /*#__PURE__*/React.createElement(_BottomSheet.default, {
53
+ backgroundGradientColors: gradientColors ?? ["#220046", "#020005"],
54
+ isVisible: openModal,
55
+ onClose: handleClose,
56
+ heightPercentage: heightPercentage ?? 73,
57
+ enablePanGesture: true
58
+ }, ({
59
+ requestClose
60
+ }) => /*#__PURE__*/React.createElement(Component, (0, _extends2.default)({}, modalParameter, {
61
+ onClose: requestClose
62
+ })));
63
+ }
64
+ };
65
+ var _default = exports.default = CommonModel;
66
+ const styles = _reactNative.StyleSheet.create({
67
+ container: {
68
+ position: "absolute",
69
+ top: 0,
70
+ left: 0,
71
+ right: 0,
72
+ bottom: 0,
73
+ flex: 1,
74
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
75
+ justifyContent: "center",
76
+ alignItems: "center",
77
+ zIndex: 999
78
+ }
79
+ });
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.MODAL_TYPES = void 0;
7
+ const MODAL_TYPES = exports.MODAL_TYPES = {
8
+ Modal: "Modal",
9
+ BottomSheet: "Bottom-Sheet"
10
+ };
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
9
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
10
+ const {
11
+ width,
12
+ height
13
+ } = _reactNative.Dimensions.get("window");
14
+ const COLORS = ["#A0752B", "#FDD551", "#FFFFBF", "#FDD551", "#A0752B", "#FDD551", "#FDD551"];
15
+ const ConfettiPiece = ({
16
+ originX,
17
+ originY,
18
+ color,
19
+ width: pieceWidth,
20
+ height: pieceHeight,
21
+ delay,
22
+ onComplete
23
+ }) => {
24
+ const translateX = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
25
+ const translateY = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
26
+ const opacity = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
27
+ const rotate = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
28
+ const angle = Math.random() * 2 * Math.PI;
29
+ const distance = Math.random() * 300 + 100;
30
+ const toX = Math.cos(angle) * distance;
31
+ const toY = Math.sin(angle) * distance;
32
+ const rotationDirection = Math.random() > 0.5 ? 1 : -1;
33
+ (0, _react.useEffect)(() => {
34
+ const DURATION = 1200;
35
+ _reactNative.Animated.sequence([_reactNative.Animated.delay(delay), _reactNative.Animated.parallel([_reactNative.Animated.timing(opacity, {
36
+ toValue: 1,
37
+ duration: 50,
38
+ useNativeDriver: true
39
+ })]), _reactNative.Animated.parallel([_reactNative.Animated.timing(translateX, {
40
+ toValue: toX,
41
+ duration: DURATION,
42
+ easing: _reactNative.Easing.out(_reactNative.Easing.quad),
43
+ useNativeDriver: true
44
+ }), _reactNative.Animated.timing(translateY, {
45
+ toValue: toY,
46
+ duration: DURATION,
47
+ easing: _reactNative.Easing.out(_reactNative.Easing.quad),
48
+ useNativeDriver: true
49
+ }), _reactNative.Animated.timing(opacity, {
50
+ toValue: 0,
51
+ duration: DURATION,
52
+ useNativeDriver: true
53
+ }), _reactNative.Animated.timing(rotate, {
54
+ toValue: rotationDirection * 360,
55
+ duration: DURATION,
56
+ easing: _reactNative.Easing.linear,
57
+ useNativeDriver: true
58
+ })])]).start(onComplete);
59
+ }, []);
60
+ const rotateInterpolate = rotate.interpolate({
61
+ inputRange: [0, 360],
62
+ outputRange: ["0deg", "360deg"]
63
+ });
64
+ return /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
65
+ style: {
66
+ position: "absolute",
67
+ top: originY,
68
+ left: originX,
69
+ width: pieceWidth,
70
+ height: pieceHeight,
71
+ borderRadius: pieceHeight / 2,
72
+ backgroundColor: color,
73
+ transform: [{
74
+ translateX
75
+ }, {
76
+ translateY
77
+ }, {
78
+ rotate: rotateInterpolate
79
+ }],
80
+ opacity
81
+ }
82
+ });
83
+ };
84
+ const ConfettiBurst = ({
85
+ originX = width / 2,
86
+ originY = height / 2,
87
+ numberOfPieces = 30,
88
+ onComplete
89
+ }) => {
90
+ const [pieces, setPieces] = (0, _react.useState)([]);
91
+ (0, _react.useEffect)(() => {
92
+ const newPieces = Array.from({
93
+ length: numberOfPieces
94
+ }).map(() => {
95
+ const w = Math.random() * 4 + 2;
96
+ const h = Math.random() * 12 + 4;
97
+ const swap = Math.random() > 0.5;
98
+ return {
99
+ color: COLORS[Math.floor(Math.random() * COLORS.length)],
100
+ width: swap ? h : w,
101
+ height: swap ? w : h,
102
+ delay: Math.random() * 90
103
+ };
104
+ });
105
+ setPieces(newPieces);
106
+ }, []);
107
+ return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
108
+ style: _reactNative.StyleSheet.absoluteFill
109
+ }, pieces.map((p, index) => /*#__PURE__*/_react.default.createElement(ConfettiPiece, {
110
+ key: index,
111
+ originX: originX,
112
+ originY: originY,
113
+ color: p.color,
114
+ width: p.width,
115
+ height: p.height,
116
+ delay: p.delay,
117
+ onComplete: index === pieces.length - 1 ? onComplete : undefined
118
+ })));
119
+ };
120
+ var _default = exports.default = ConfettiBurst;
@@ -0,0 +1,190 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
10
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
11
+ const {
12
+ width,
13
+ height
14
+ } = _reactNative.Dimensions.get("window");
15
+ const COLORS = ["#A0752B", "#FDD551", "#FFFFBF", "#FDD551", "#A0752B", "#FDD551", "#FDD551"];
16
+ const ConfettiPiece = ({
17
+ delay,
18
+ startX,
19
+ pieceWidth,
20
+ pieceHeight,
21
+ color,
22
+ duration,
23
+ shouldAnimate,
24
+ stopNewPieces
25
+ }) => {
26
+ const translateY = (0, _reactNativeReanimated.useSharedValue)(-50);
27
+ const translateX = (0, _reactNativeReanimated.useSharedValue)(0);
28
+ const rotateZ = (0, _reactNativeReanimated.useSharedValue)(0);
29
+ const rotateX = (0, _reactNativeReanimated.useSharedValue)(0);
30
+
31
+ // Random horizontal drift
32
+ const drift = (Math.random() - 0.5) * 100;
33
+ (0, _react.useEffect)(() => {
34
+ if (!shouldAnimate) {
35
+ return;
36
+ }
37
+ if (stopNewPieces) {
38
+ // Cancel the infinite repeat and let current piece fall to completion
39
+ (0, _reactNativeReanimated.cancelAnimation)(translateY);
40
+ (0, _reactNativeReanimated.cancelAnimation)(translateX);
41
+ (0, _reactNativeReanimated.cancelAnimation)(rotateZ);
42
+ (0, _reactNativeReanimated.cancelAnimation)(rotateX);
43
+
44
+ // Continue falling to the bottom (no repeat)
45
+ const remainingDistance = height * 1.5 - translateY.value;
46
+ const remainingTime = remainingDistance / (height * 1.5) * duration;
47
+ translateY.value = (0, _reactNativeReanimated.withTiming)(height * 1.5, {
48
+ duration: remainingTime,
49
+ easing: _reactNativeReanimated.Easing.linear
50
+ });
51
+ return;
52
+ }
53
+
54
+ // Falling animation with repeat to keep confetti falling continuously
55
+ translateY.value = (0, _reactNativeReanimated.withDelay)(delay, (0, _reactNativeReanimated.withRepeat)((0, _reactNativeReanimated.withSequence)((0, _reactNativeReanimated.withTiming)(height * 1.5, {
56
+ duration,
57
+ easing: _reactNativeReanimated.Easing.linear
58
+ }), (0, _reactNativeReanimated.withTiming)(-50, {
59
+ duration: 0
60
+ }) // Reset to top instantly
61
+ ), -1 // Infinite repeat
62
+ ));
63
+
64
+ // Horizontal drift/sway
65
+ translateX.value = (0, _reactNativeReanimated.withDelay)(delay, (0, _reactNativeReanimated.withRepeat)((0, _reactNativeReanimated.withSequence)((0, _reactNativeReanimated.withTiming)(drift, {
66
+ duration: duration / 2,
67
+ easing: _reactNativeReanimated.Easing.inOut(_reactNativeReanimated.Easing.ease)
68
+ }), (0, _reactNativeReanimated.withTiming)(-drift, {
69
+ duration: duration / 2,
70
+ easing: _reactNativeReanimated.Easing.inOut(_reactNativeReanimated.Easing.ease)
71
+ })), -1, true));
72
+
73
+ // Z-axis rotation (spinning)
74
+ rotateZ.value = (0, _reactNativeReanimated.withDelay)(delay, (0, _reactNativeReanimated.withRepeat)((0, _reactNativeReanimated.withTiming)(360, {
75
+ duration: 1000 + Math.random() * 1000,
76
+ easing: _reactNativeReanimated.Easing.linear
77
+ }), -1));
78
+
79
+ // X-axis rotation (flipping)
80
+ rotateX.value = (0, _reactNativeReanimated.withDelay)(delay, (0, _reactNativeReanimated.withRepeat)((0, _reactNativeReanimated.withTiming)(360, {
81
+ duration: 1500 + Math.random() * 1000,
82
+ easing: _reactNativeReanimated.Easing.linear
83
+ }), -1));
84
+ }, [shouldAnimate, stopNewPieces]);
85
+ const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
86
+ return {
87
+ transform: [{
88
+ translateY: translateY.value
89
+ }, {
90
+ translateX: translateX.value
91
+ }, {
92
+ rotateZ: `${rotateZ.value}deg`
93
+ }, {
94
+ rotateX: `${rotateX.value}deg`
95
+ }]
96
+ };
97
+ });
98
+ return /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
99
+ style: [{
100
+ position: "absolute",
101
+ top: -100,
102
+ left: startX,
103
+ width: pieceWidth,
104
+ height: pieceHeight,
105
+ backgroundColor: color,
106
+ borderRadius: 2
107
+ }, animatedStyle]
108
+ });
109
+ };
110
+ const FallingConfetti = /*#__PURE__*/(0, _react.forwardRef)(({
111
+ numberOfPieces = 100,
112
+ continuous = true,
113
+ confettiDuration = null
114
+ }, ref) => {
115
+ const [shouldAnimate, setShouldAnimate] = (0, _react.useState)(false);
116
+ const [stopNewPieces, setStopNewPieces] = (0, _react.useState)(false);
117
+ const timerRef = _react.default.useRef(null);
118
+ const cleanupTimerRef = _react.default.useRef(null);
119
+ const pieces = _react.default.useMemo(() => {
120
+ return Array.from({
121
+ length: numberOfPieces
122
+ }).map((_, index) => {
123
+ const w = Math.random() * 4 + 2;
124
+ const h = Math.random() * 10 + 4;
125
+ const swap = Math.random() > 0.5;
126
+ return {
127
+ id: index,
128
+ color: COLORS[Math.floor(Math.random() * COLORS.length)],
129
+ width: swap ? h : w,
130
+ height: swap ? w : h,
131
+ startX: Math.random() * width,
132
+ delay: continuous ? Math.random() * 3000 : Math.random() * 500,
133
+ duration: 2000 + Math.random() * 500
134
+ };
135
+ });
136
+ }, [numberOfPieces, continuous]);
137
+ const startConfetti = _react.default.useCallback(() => {
138
+ // Clear any existing timers
139
+ if (timerRef.current) clearTimeout(timerRef.current);
140
+ if (cleanupTimerRef.current) clearTimeout(cleanupTimerRef.current);
141
+ setShouldAnimate(true);
142
+ setStopNewPieces(false);
143
+ if (confettiDuration !== null) {
144
+ timerRef.current = setTimeout(() => {
145
+ setStopNewPieces(true);
146
+ cleanupTimerRef.current = setTimeout(() => {
147
+ setShouldAnimate(false);
148
+ }, 4500);
149
+ }, confettiDuration);
150
+ }
151
+ }, [confettiDuration]);
152
+ const stopConfetti = _react.default.useCallback(() => {
153
+ // Clear any existing timers
154
+ if (timerRef.current) clearTimeout(timerRef.current);
155
+ if (cleanupTimerRef.current) clearTimeout(cleanupTimerRef.current);
156
+ setStopNewPieces(true);
157
+ cleanupTimerRef.current = setTimeout(() => {
158
+ setShouldAnimate(false);
159
+ }, 4500);
160
+ }, []);
161
+ (0, _react.useImperativeHandle)(ref, () => ({
162
+ start: startConfetti,
163
+ stop: stopConfetti
164
+ }));
165
+ (0, _react.useEffect)(() => {
166
+ return () => {
167
+ if (timerRef.current) clearTimeout(timerRef.current);
168
+ if (cleanupTimerRef.current) clearTimeout(cleanupTimerRef.current);
169
+ };
170
+ }, []);
171
+ if (!shouldAnimate) {
172
+ return null;
173
+ }
174
+ return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
175
+ style: _reactNative.StyleSheet.absoluteFill,
176
+ pointerEvents: "none"
177
+ }, pieces.map(piece => /*#__PURE__*/_react.default.createElement(ConfettiPiece, {
178
+ key: piece.id,
179
+ delay: piece.delay,
180
+ startX: piece.startX,
181
+ pieceWidth: piece.width,
182
+ pieceHeight: piece.height,
183
+ color: piece.color,
184
+ duration: piece.duration,
185
+ shouldAnimate: shouldAnimate,
186
+ stopNewPieces: stopNewPieces
187
+ })));
188
+ });
189
+ FallingConfetti.displayName = "FallingConfetti";
190
+ var _default = exports.default = FallingConfetti;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ exports.startConfettiBursts = startConfettiBursts;
9
+ exports.stopConfettiBursts = stopConfettiBursts;
10
+ var _react = _interopRequireWildcard(require("react"));
11
+ var _reactNative = require("react-native");
12
+ var _ConfettiBurst = _interopRequireDefault(require("./ConfettiBurst"));
13
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
14
+ const {
15
+ width,
16
+ height
17
+ } = _reactNative.Dimensions.get("window");
18
+ const MULTI_BURST_COUNT = 10;
19
+ let burstIndexRefGlobal = null;
20
+ let timeoutRefGlobal = null;
21
+ let setBurstsGlobal = null;
22
+ let globalBurstId = 0; // simple global counter for unique keys
23
+
24
+ // Safe start function
25
+ function startConfettiBursts() {
26
+ if (!burstIndexRefGlobal || !timeoutRefGlobal || !setBurstsGlobal) return;
27
+ burstIndexRefGlobal.current = 0;
28
+ setBurstsGlobal([]);
29
+ const triggerNextBurst = () => {
30
+ if (burstIndexRefGlobal.current >= MULTI_BURST_COUNT) return;
31
+ const x = Math.random() * width;
32
+ const y = Math.random() * height;
33
+
34
+ // Use a global counter for unique key
35
+ setBurstsGlobal(prev => [...prev, {
36
+ id: globalBurstId++,
37
+ x,
38
+ y
39
+ }]);
40
+ burstIndexRefGlobal.current++;
41
+ timeoutRefGlobal.current = setTimeout(triggerNextBurst, 500);
42
+ };
43
+ triggerNextBurst();
44
+ }
45
+
46
+ // Safe stop function
47
+ function stopConfettiBursts() {
48
+ if (!timeoutRefGlobal || !setBurstsGlobal) return;
49
+ if (timeoutRefGlobal.current) {
50
+ clearTimeout(timeoutRefGlobal.current);
51
+ }
52
+ setBurstsGlobal([]); // remove all existing bursts
53
+ }
54
+ const MultiConfettiBurstComponent = () => {
55
+ const [bursts, setBursts] = (0, _react.useState)([]);
56
+ const burstIndexRef = (0, _react.useRef)(0);
57
+ const timeoutRef = (0, _react.useRef)(null);
58
+ burstIndexRefGlobal = burstIndexRef;
59
+ timeoutRefGlobal = timeoutRef;
60
+ setBurstsGlobal = setBursts;
61
+ return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
62
+ style: _reactNative.StyleSheet.absoluteFill
63
+ }, bursts.map(b => /*#__PURE__*/_react.default.createElement(_ConfettiBurst.default, {
64
+ key: b.id,
65
+ originX: b.x,
66
+ originY: b.y,
67
+ numberOfPieces: 40,
68
+ onComplete: () => {
69
+ setBursts(prev => prev.filter(burst => burst.id !== b.id));
70
+ }
71
+ })));
72
+ };
73
+ var _default = exports.default = MultiConfettiBurstComponent;