@zezosoft/zezo-ott-react-native-ui-kit 1.1.2 → 1.1.3

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 (136) hide show
  1. package/lib/module/components/Auth/QrLogin/QrLogin.js +304 -138
  2. package/lib/module/components/Auth/QrLogin/QrLogin.js.map +1 -1
  3. package/lib/module/components/Auth/QrLogin/components/QrViewArea.js +193 -141
  4. package/lib/module/components/Auth/QrLogin/components/QrViewArea.js.map +1 -1
  5. package/lib/module/components/Content/Card/Category/Category.js +83 -11
  6. package/lib/module/components/Content/Card/Category/Category.js.map +1 -1
  7. package/lib/module/components/Content/Card/NowWatching/NowWatching.js +237 -108
  8. package/lib/module/components/Content/Card/NowWatching/NowWatching.js.map +1 -1
  9. package/lib/module/components/Content/Card/Sliders/Styles/One.js +185 -126
  10. package/lib/module/components/Content/Card/Sliders/Styles/One.js.map +1 -1
  11. package/lib/module/components/Content/Card/Sliders/Styles/Two.js +139 -92
  12. package/lib/module/components/Content/Card/Sliders/Styles/Two.js.map +1 -1
  13. package/lib/module/components/Content/Card/Styles/Five.js +131 -48
  14. package/lib/module/components/Content/Card/Styles/Five.js.map +1 -1
  15. package/lib/module/components/Content/Card/Styles/Four.js +126 -59
  16. package/lib/module/components/Content/Card/Styles/Four.js.map +1 -1
  17. package/lib/module/components/Content/Card/Styles/One.js +125 -50
  18. package/lib/module/components/Content/Card/Styles/One.js.map +1 -1
  19. package/lib/module/components/Content/Card/Styles/RotateInOut.js +138 -53
  20. package/lib/module/components/Content/Card/Styles/RotateInOut.js.map +1 -1
  21. package/lib/module/components/Content/Card/Styles/Six.js +207 -115
  22. package/lib/module/components/Content/Card/Styles/Six.js.map +1 -1
  23. package/lib/module/components/Content/Card/Styles/Three.js +134 -79
  24. package/lib/module/components/Content/Card/Styles/Three.js.map +1 -1
  25. package/lib/module/components/Content/Card/Styles/TopTen.js +186 -171
  26. package/lib/module/components/Content/Card/Styles/TopTen.js.map +1 -1
  27. package/lib/module/components/Content/Card/Styles/Two.js +144 -64
  28. package/lib/module/components/Content/Card/Styles/Two.js.map +1 -1
  29. package/lib/module/components/Content/Card/components/AdsPoster.js +162 -0
  30. package/lib/module/components/Content/Card/components/AdsPoster.js.map +1 -0
  31. package/lib/module/components/Content/Card/components/CardPoster.js +120 -136
  32. package/lib/module/components/Content/Card/components/CardPoster.js.map +1 -1
  33. package/lib/module/components/Content/Card/components/index.js +4 -0
  34. package/lib/module/components/Content/Card/components/index.js.map +1 -0
  35. package/lib/module/components/Content/Content.js +67 -27
  36. package/lib/module/components/Content/Content.js.map +1 -1
  37. package/lib/module/components/Content/Sections.js +32 -11
  38. package/lib/module/components/Content/Sections.js.map +1 -1
  39. package/lib/module/constants/dummySections.js +44 -4
  40. package/lib/module/constants/dummySections.js.map +1 -1
  41. package/lib/module/hooks/Images/index.js +5 -0
  42. package/lib/module/hooks/Images/index.js.map +1 -0
  43. package/lib/module/hooks/Images/useImageLoader.js +168 -0
  44. package/lib/module/hooks/Images/useImageLoader.js.map +1 -0
  45. package/lib/module/hooks/Images/useImageValidation.js +36 -0
  46. package/lib/module/hooks/Images/useImageValidation.js.map +1 -0
  47. package/lib/module/hooks/index.js +3 -0
  48. package/lib/module/hooks/index.js.map +1 -1
  49. package/lib/module/hooks/useAdTracking.js +270 -0
  50. package/lib/module/hooks/useAdTracking.js.map +1 -0
  51. package/lib/module/hooks/useCards.js +164 -0
  52. package/lib/module/hooks/useCards.js.map +1 -0
  53. package/lib/module/hooks/usePaginatedSection.js +11 -6
  54. package/lib/module/hooks/usePaginatedSection.js.map +1 -1
  55. package/lib/typescript/src/components/Auth/QrLogin/QrLogin.d.ts +2 -0
  56. package/lib/typescript/src/components/Auth/QrLogin/QrLogin.d.ts.map +1 -1
  57. package/lib/typescript/src/components/Auth/QrLogin/components/QrViewArea.d.ts.map +1 -1
  58. package/lib/typescript/src/components/Content/Card/Category/Category.d.ts.map +1 -1
  59. package/lib/typescript/src/components/Content/Card/NowWatching/NowWatching.d.ts.map +1 -1
  60. package/lib/typescript/src/components/Content/Card/Sliders/Styles/One.d.ts.map +1 -1
  61. package/lib/typescript/src/components/Content/Card/Sliders/Styles/Two.d.ts.map +1 -1
  62. package/lib/typescript/src/components/Content/Card/Styles/Five.d.ts +13 -1
  63. package/lib/typescript/src/components/Content/Card/Styles/Five.d.ts.map +1 -1
  64. package/lib/typescript/src/components/Content/Card/Styles/Four.d.ts +13 -1
  65. package/lib/typescript/src/components/Content/Card/Styles/Four.d.ts.map +1 -1
  66. package/lib/typescript/src/components/Content/Card/Styles/One.d.ts +15 -3
  67. package/lib/typescript/src/components/Content/Card/Styles/One.d.ts.map +1 -1
  68. package/lib/typescript/src/components/Content/Card/Styles/RotateInOut.d.ts +13 -1
  69. package/lib/typescript/src/components/Content/Card/Styles/RotateInOut.d.ts.map +1 -1
  70. package/lib/typescript/src/components/Content/Card/Styles/Six.d.ts +1 -0
  71. package/lib/typescript/src/components/Content/Card/Styles/Six.d.ts.map +1 -1
  72. package/lib/typescript/src/components/Content/Card/Styles/Three.d.ts +13 -5
  73. package/lib/typescript/src/components/Content/Card/Styles/Three.d.ts.map +1 -1
  74. package/lib/typescript/src/components/Content/Card/Styles/TopTen.d.ts +1 -0
  75. package/lib/typescript/src/components/Content/Card/Styles/TopTen.d.ts.map +1 -1
  76. package/lib/typescript/src/components/Content/Card/Styles/Two.d.ts +13 -1
  77. package/lib/typescript/src/components/Content/Card/Styles/Two.d.ts.map +1 -1
  78. package/lib/typescript/src/components/Content/Card/components/AdsPoster.d.ts +26 -0
  79. package/lib/typescript/src/components/Content/Card/components/AdsPoster.d.ts.map +1 -0
  80. package/lib/typescript/src/components/Content/Card/components/CardPoster.d.ts +3 -1
  81. package/lib/typescript/src/components/Content/Card/components/CardPoster.d.ts.map +1 -1
  82. package/lib/typescript/src/components/Content/Card/components/index.d.ts +2 -0
  83. package/lib/typescript/src/components/Content/Card/components/index.d.ts.map +1 -0
  84. package/lib/typescript/src/components/Content/Card/index.d.ts +76 -6
  85. package/lib/typescript/src/components/Content/Card/index.d.ts.map +1 -1
  86. package/lib/typescript/src/components/Content/Content.d.ts +4 -3
  87. package/lib/typescript/src/components/Content/Content.d.ts.map +1 -1
  88. package/lib/typescript/src/components/Content/Sections.d.ts +20 -6
  89. package/lib/typescript/src/components/Content/Sections.d.ts.map +1 -1
  90. package/lib/typescript/src/constants/dummySections.d.ts +5 -0
  91. package/lib/typescript/src/constants/dummySections.d.ts.map +1 -1
  92. package/lib/typescript/src/hooks/Images/index.d.ts +3 -0
  93. package/lib/typescript/src/hooks/Images/index.d.ts.map +1 -0
  94. package/lib/typescript/src/hooks/Images/useImageLoader.d.ts +36 -0
  95. package/lib/typescript/src/hooks/Images/useImageLoader.d.ts.map +1 -0
  96. package/lib/typescript/src/hooks/Images/useImageValidation.d.ts +17 -0
  97. package/lib/typescript/src/hooks/Images/useImageValidation.d.ts.map +1 -0
  98. package/lib/typescript/src/hooks/index.d.ts +3 -0
  99. package/lib/typescript/src/hooks/index.d.ts.map +1 -1
  100. package/lib/typescript/src/hooks/useAdTracking.d.ts +39 -0
  101. package/lib/typescript/src/hooks/useAdTracking.d.ts.map +1 -0
  102. package/lib/typescript/src/hooks/useCards.d.ts +36 -0
  103. package/lib/typescript/src/hooks/useCards.d.ts.map +1 -0
  104. package/lib/typescript/src/hooks/usePaginatedSection.d.ts +12 -2
  105. package/lib/typescript/src/hooks/usePaginatedSection.d.ts.map +1 -1
  106. package/lib/typescript/src/types/sections/index.d.ts +7 -4
  107. package/lib/typescript/src/types/sections/index.d.ts.map +1 -1
  108. package/package.json +6 -3
  109. package/src/components/Auth/QrLogin/QrLogin.tsx +382 -122
  110. package/src/components/Auth/QrLogin/components/QrViewArea.tsx +291 -197
  111. package/src/components/Content/Card/Category/Category.tsx +95 -8
  112. package/src/components/Content/Card/NowWatching/NowWatching.tsx +281 -136
  113. package/src/components/Content/Card/Sliders/Styles/One.tsx +244 -148
  114. package/src/components/Content/Card/Sliders/Styles/Two.tsx +171 -102
  115. package/src/components/Content/Card/Styles/Five.tsx +161 -62
  116. package/src/components/Content/Card/Styles/Four.tsx +164 -85
  117. package/src/components/Content/Card/Styles/One.tsx +161 -71
  118. package/src/components/Content/Card/Styles/RotateInOut.tsx +157 -60
  119. package/src/components/Content/Card/Styles/Six.tsx +242 -142
  120. package/src/components/Content/Card/Styles/Three.tsx +166 -133
  121. package/src/components/Content/Card/Styles/TopTen.tsx +230 -191
  122. package/src/components/Content/Card/Styles/Two.tsx +182 -79
  123. package/src/components/Content/Card/components/AdsPoster.tsx +202 -0
  124. package/src/components/Content/Card/components/CardPoster.tsx +134 -154
  125. package/src/components/Content/Card/components/index.ts +1 -0
  126. package/src/components/Content/Content.tsx +83 -45
  127. package/src/components/Content/Sections.tsx +51 -10
  128. package/src/constants/dummySections.ts +48 -1
  129. package/src/hooks/Images/index.ts +2 -0
  130. package/src/hooks/Images/useImageLoader.ts +206 -0
  131. package/src/hooks/Images/useImageValidation.ts +36 -0
  132. package/src/hooks/index.ts +3 -0
  133. package/src/hooks/useAdTracking.ts +349 -0
  134. package/src/hooks/useCards.ts +228 -0
  135. package/src/hooks/usePaginatedSection.ts +26 -7
  136. package/src/types/sections/index.ts +7 -4
@@ -6,6 +6,7 @@
6
6
  import React, {
7
7
  useRef,
8
8
  useLayoutEffect,
9
+ useEffect,
9
10
  useCallback,
10
11
  useMemo,
11
12
  useState,
@@ -17,6 +18,8 @@ import {
17
18
  StyleSheet,
18
19
  Dimensions,
19
20
  InteractionManager,
21
+ Platform,
22
+ Vibration,
20
23
  type LayoutChangeEvent,
21
24
  type ListRenderItemInfo,
22
25
  } from 'react-native';
@@ -52,6 +55,7 @@ const { width: SCREEN_WIDTH } = Dimensions.get('window');
52
55
 
53
56
  import { usePrevious } from '../../../../hooks/usePrevious';
54
57
  import { useSkeletonItems } from '../../../../hooks/useSkeletonItems';
58
+ import { debounce } from 'lodash';
55
59
 
56
60
  const CategoryCard = React.memo(
57
61
  ({
@@ -65,6 +69,8 @@ const CategoryCard = React.memo(
65
69
  const { theme: appliedTheme } = useInternalTheme(theme);
66
70
  const flatListRef = useRef<FlatList<ICategory>>(null);
67
71
  const [itemWidths, setItemWidths] = useState<number[]>([]);
72
+ const isScrollingRef = useRef(false);
73
+ const lastPressedIndexRef = useRef<number | null>(null);
68
74
 
69
75
  // Memoize theme colors
70
76
  const themeColors = useMemo(
@@ -106,11 +112,28 @@ const CategoryCard = React.memo(
106
112
  []
107
113
  );
108
114
 
115
+ // Haptic feedback utility
116
+ const triggerHapticFeedback = useCallback(() => {
117
+ if (Platform.OS === 'ios') {
118
+ // iOS haptic feedback (light impact)
119
+ Vibration.vibrate(1);
120
+ } else if (Platform.OS === 'android') {
121
+ // Android haptic feedback (short vibration)
122
+ Vibration.vibrate(10);
123
+ }
124
+ }, []);
125
+
109
126
  const scrollToCategory = useCallback(
110
127
  (index: number, animated: boolean) => {
111
- if (!flatListRef.current || index < 0 || index >= category.length)
128
+ if (
129
+ !flatListRef.current ||
130
+ index < 0 ||
131
+ index >= category.length ||
132
+ isScrollingRef.current
133
+ )
112
134
  return;
113
135
 
136
+ isScrollingRef.current = true;
114
137
  const RIGHT_SCROLL_BIAS = scale(40);
115
138
  const offset = itemWidths.length
116
139
  ? itemWidths.slice(0, index).reduce((sum, w) => sum + w, 0) +
@@ -127,11 +150,35 @@ const CategoryCard = React.memo(
127
150
  offset: Math.max(0, offset),
128
151
  animated,
129
152
  });
153
+ // Reset scrolling flag after animation completes
154
+ if (animated) {
155
+ setTimeout(() => {
156
+ isScrollingRef.current = false;
157
+ }, 300);
158
+ } else {
159
+ isScrollingRef.current = false;
160
+ }
130
161
  });
131
162
  },
132
163
  [category, itemWidths]
133
164
  );
134
165
 
166
+ // Debounced scroll function to prevent rapid scrolling
167
+ const debouncedScrollToCategory = useMemo(
168
+ () =>
169
+ debounce((index: number, animated: boolean) => {
170
+ scrollToCategory(index, animated);
171
+ }, 100),
172
+ [scrollToCategory]
173
+ );
174
+
175
+ // Cleanup debounced function on unmount
176
+ useEffect(() => {
177
+ return () => {
178
+ debouncedScrollToCategory.cancel();
179
+ };
180
+ }, [debouncedScrollToCategory]);
181
+
135
182
  const onItemLayout = useCallback(
136
183
  (event: LayoutChangeEvent, index: number) => {
137
184
  const { width } = event.nativeEvent.layout;
@@ -153,19 +200,38 @@ const CategoryCard = React.memo(
153
200
  const index = category.findIndex(
154
201
  (cat) => cat._id === selectedCategory._id
155
202
  );
156
- if (index >= 0) scrollToCategory(index, true);
203
+ if (index >= 0 && index !== lastPressedIndexRef.current) {
204
+ // Use debounced scroll for external category changes
205
+ debouncedScrollToCategory(index, true);
206
+ }
157
207
  }
158
- }, [selectedCategory, category, scrollToCategory, prevCategoryId]);
208
+ }, [selectedCategory, category, debouncedScrollToCategory, prevCategoryId]);
159
209
 
160
210
  const handlePress = useCallback(
161
211
  (item: ICategory) => {
162
- onPressCategory?.(item);
212
+ // Prevent rapid successive taps on the same item
163
213
  const index = category.findIndex((cat) => cat._id === item._id);
164
- if (index >= 0) {
165
- setTimeout(() => scrollToCategory(index, true), 10);
214
+ if (index < 0) return;
215
+
216
+ // Check if same item is being pressed rapidly
217
+ if (lastPressedIndexRef.current === index && isScrollingRef.current) {
218
+ return;
166
219
  }
220
+
221
+ lastPressedIndexRef.current = index;
222
+
223
+ // Trigger haptic feedback for better UX
224
+ triggerHapticFeedback();
225
+
226
+ // Call the callback
227
+ onPressCategory?.(item);
228
+
229
+ // Scroll to category with slight delay for smoother UX
230
+ requestAnimationFrame(() => {
231
+ scrollToCategory(index, true);
232
+ });
167
233
  },
168
- [category, onPressCategory, scrollToCategory]
234
+ [category, onPressCategory, scrollToCategory, triggerHapticFeedback]
169
235
  );
170
236
 
171
237
  // Memoize filled mode selected style
@@ -219,11 +285,18 @@ const CategoryCard = React.memo(
219
285
 
220
286
  return (
221
287
  <TouchableOpacity
222
- activeOpacity={0.9}
288
+ activeOpacity={0.7}
223
289
  onPress={() => handlePress(item)}
224
290
  style={containerStyle}
225
291
  onLayout={(event) => onItemLayout(event, index)}
226
292
  accessibilityLabel={`Select category ${item.name}`}
293
+ accessibilityRole="button"
294
+ accessibilityState={{ selected: isSelected }}
295
+ accessibilityHint={
296
+ isSelected
297
+ ? `${item.name} is currently selected`
298
+ : `Double tap to select ${item.name} category`
299
+ }
227
300
  >
228
301
  <Text style={textStyle}>{item.name}</Text>
229
302
  {mode === 'text' && isSelected && <View style={underlineStyle} />}
@@ -294,6 +367,20 @@ const CategoryCard = React.memo(
294
367
  maxToRenderPerBatch={12}
295
368
  windowSize={5}
296
369
  removeClippedSubviews
370
+ onScrollBeginDrag={() => {
371
+ isScrollingRef.current = true;
372
+ }}
373
+ onScrollEndDrag={() => {
374
+ // Reset after a short delay to allow momentum scrolling
375
+ setTimeout(() => {
376
+ isScrollingRef.current = false;
377
+ }, 200);
378
+ }}
379
+ onMomentumScrollEnd={() => {
380
+ isScrollingRef.current = false;
381
+ }}
382
+ accessibilityLabel="Category selection list"
383
+ accessibilityRole="list"
297
384
  />
298
385
  )}
299
386
  </View>