@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.
- package/lib/module/components/Auth/QrLogin/QrLogin.js +304 -138
- package/lib/module/components/Auth/QrLogin/QrLogin.js.map +1 -1
- package/lib/module/components/Auth/QrLogin/components/QrViewArea.js +193 -141
- package/lib/module/components/Auth/QrLogin/components/QrViewArea.js.map +1 -1
- package/lib/module/components/Content/Card/Category/Category.js +83 -11
- package/lib/module/components/Content/Card/Category/Category.js.map +1 -1
- package/lib/module/components/Content/Card/NowWatching/NowWatching.js +237 -108
- package/lib/module/components/Content/Card/NowWatching/NowWatching.js.map +1 -1
- package/lib/module/components/Content/Card/Sliders/Styles/One.js +185 -126
- package/lib/module/components/Content/Card/Sliders/Styles/One.js.map +1 -1
- package/lib/module/components/Content/Card/Sliders/Styles/Two.js +139 -92
- package/lib/module/components/Content/Card/Sliders/Styles/Two.js.map +1 -1
- package/lib/module/components/Content/Card/Styles/Five.js +131 -48
- package/lib/module/components/Content/Card/Styles/Five.js.map +1 -1
- package/lib/module/components/Content/Card/Styles/Four.js +126 -59
- package/lib/module/components/Content/Card/Styles/Four.js.map +1 -1
- package/lib/module/components/Content/Card/Styles/One.js +125 -50
- package/lib/module/components/Content/Card/Styles/One.js.map +1 -1
- package/lib/module/components/Content/Card/Styles/RotateInOut.js +138 -53
- package/lib/module/components/Content/Card/Styles/RotateInOut.js.map +1 -1
- package/lib/module/components/Content/Card/Styles/Six.js +207 -115
- package/lib/module/components/Content/Card/Styles/Six.js.map +1 -1
- package/lib/module/components/Content/Card/Styles/Three.js +134 -79
- package/lib/module/components/Content/Card/Styles/Three.js.map +1 -1
- package/lib/module/components/Content/Card/Styles/TopTen.js +186 -171
- package/lib/module/components/Content/Card/Styles/TopTen.js.map +1 -1
- package/lib/module/components/Content/Card/Styles/Two.js +144 -64
- package/lib/module/components/Content/Card/Styles/Two.js.map +1 -1
- package/lib/module/components/Content/Card/components/AdsPoster.js +162 -0
- package/lib/module/components/Content/Card/components/AdsPoster.js.map +1 -0
- package/lib/module/components/Content/Card/components/CardPoster.js +120 -136
- package/lib/module/components/Content/Card/components/CardPoster.js.map +1 -1
- package/lib/module/components/Content/Card/components/index.js +4 -0
- package/lib/module/components/Content/Card/components/index.js.map +1 -0
- package/lib/module/components/Content/Content.js +67 -27
- package/lib/module/components/Content/Content.js.map +1 -1
- package/lib/module/components/Content/Sections.js +32 -11
- package/lib/module/components/Content/Sections.js.map +1 -1
- package/lib/module/constants/dummySections.js +44 -4
- package/lib/module/constants/dummySections.js.map +1 -1
- package/lib/module/hooks/Images/index.js +5 -0
- package/lib/module/hooks/Images/index.js.map +1 -0
- package/lib/module/hooks/Images/useImageLoader.js +168 -0
- package/lib/module/hooks/Images/useImageLoader.js.map +1 -0
- package/lib/module/hooks/Images/useImageValidation.js +36 -0
- package/lib/module/hooks/Images/useImageValidation.js.map +1 -0
- package/lib/module/hooks/index.js +3 -0
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useAdTracking.js +270 -0
- package/lib/module/hooks/useAdTracking.js.map +1 -0
- package/lib/module/hooks/useCards.js +164 -0
- package/lib/module/hooks/useCards.js.map +1 -0
- package/lib/module/hooks/usePaginatedSection.js +11 -6
- package/lib/module/hooks/usePaginatedSection.js.map +1 -1
- package/lib/typescript/src/components/Auth/QrLogin/QrLogin.d.ts +2 -0
- package/lib/typescript/src/components/Auth/QrLogin/QrLogin.d.ts.map +1 -1
- package/lib/typescript/src/components/Auth/QrLogin/components/QrViewArea.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Card/Category/Category.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Card/NowWatching/NowWatching.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Card/Sliders/Styles/One.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Card/Sliders/Styles/Two.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Card/Styles/Five.d.ts +13 -1
- package/lib/typescript/src/components/Content/Card/Styles/Five.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Card/Styles/Four.d.ts +13 -1
- package/lib/typescript/src/components/Content/Card/Styles/Four.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Card/Styles/One.d.ts +15 -3
- package/lib/typescript/src/components/Content/Card/Styles/One.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Card/Styles/RotateInOut.d.ts +13 -1
- package/lib/typescript/src/components/Content/Card/Styles/RotateInOut.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Card/Styles/Six.d.ts +1 -0
- package/lib/typescript/src/components/Content/Card/Styles/Six.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Card/Styles/Three.d.ts +13 -5
- package/lib/typescript/src/components/Content/Card/Styles/Three.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Card/Styles/TopTen.d.ts +1 -0
- package/lib/typescript/src/components/Content/Card/Styles/TopTen.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Card/Styles/Two.d.ts +13 -1
- package/lib/typescript/src/components/Content/Card/Styles/Two.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Card/components/AdsPoster.d.ts +26 -0
- package/lib/typescript/src/components/Content/Card/components/AdsPoster.d.ts.map +1 -0
- package/lib/typescript/src/components/Content/Card/components/CardPoster.d.ts +3 -1
- package/lib/typescript/src/components/Content/Card/components/CardPoster.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Card/components/index.d.ts +2 -0
- package/lib/typescript/src/components/Content/Card/components/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Content/Card/index.d.ts +76 -6
- package/lib/typescript/src/components/Content/Card/index.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Content.d.ts +4 -3
- package/lib/typescript/src/components/Content/Content.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Sections.d.ts +20 -6
- package/lib/typescript/src/components/Content/Sections.d.ts.map +1 -1
- package/lib/typescript/src/constants/dummySections.d.ts +5 -0
- package/lib/typescript/src/constants/dummySections.d.ts.map +1 -1
- package/lib/typescript/src/hooks/Images/index.d.ts +3 -0
- package/lib/typescript/src/hooks/Images/index.d.ts.map +1 -0
- package/lib/typescript/src/hooks/Images/useImageLoader.d.ts +36 -0
- package/lib/typescript/src/hooks/Images/useImageLoader.d.ts.map +1 -0
- package/lib/typescript/src/hooks/Images/useImageValidation.d.ts +17 -0
- package/lib/typescript/src/hooks/Images/useImageValidation.d.ts.map +1 -0
- package/lib/typescript/src/hooks/index.d.ts +3 -0
- package/lib/typescript/src/hooks/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useAdTracking.d.ts +39 -0
- package/lib/typescript/src/hooks/useAdTracking.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useCards.d.ts +36 -0
- package/lib/typescript/src/hooks/useCards.d.ts.map +1 -0
- package/lib/typescript/src/hooks/usePaginatedSection.d.ts +12 -2
- package/lib/typescript/src/hooks/usePaginatedSection.d.ts.map +1 -1
- package/lib/typescript/src/types/sections/index.d.ts +7 -4
- package/lib/typescript/src/types/sections/index.d.ts.map +1 -1
- package/package.json +6 -3
- package/src/components/Auth/QrLogin/QrLogin.tsx +382 -122
- package/src/components/Auth/QrLogin/components/QrViewArea.tsx +291 -197
- package/src/components/Content/Card/Category/Category.tsx +95 -8
- package/src/components/Content/Card/NowWatching/NowWatching.tsx +281 -136
- package/src/components/Content/Card/Sliders/Styles/One.tsx +244 -148
- package/src/components/Content/Card/Sliders/Styles/Two.tsx +171 -102
- package/src/components/Content/Card/Styles/Five.tsx +161 -62
- package/src/components/Content/Card/Styles/Four.tsx +164 -85
- package/src/components/Content/Card/Styles/One.tsx +161 -71
- package/src/components/Content/Card/Styles/RotateInOut.tsx +157 -60
- package/src/components/Content/Card/Styles/Six.tsx +242 -142
- package/src/components/Content/Card/Styles/Three.tsx +166 -133
- package/src/components/Content/Card/Styles/TopTen.tsx +230 -191
- package/src/components/Content/Card/Styles/Two.tsx +182 -79
- package/src/components/Content/Card/components/AdsPoster.tsx +202 -0
- package/src/components/Content/Card/components/CardPoster.tsx +134 -154
- package/src/components/Content/Card/components/index.ts +1 -0
- package/src/components/Content/Content.tsx +83 -45
- package/src/components/Content/Sections.tsx +51 -10
- package/src/constants/dummySections.ts +48 -1
- package/src/hooks/Images/index.ts +2 -0
- package/src/hooks/Images/useImageLoader.ts +206 -0
- package/src/hooks/Images/useImageValidation.ts +36 -0
- package/src/hooks/index.ts +3 -0
- package/src/hooks/useAdTracking.ts +349 -0
- package/src/hooks/useCards.ts +228 -0
- package/src/hooks/usePaginatedSection.ts +26 -7
- package/src/types/sections/index.ts +7 -4
|
@@ -2,15 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @author Naresh Dhamu
|
|
5
|
-
* @lastModified Sun 08 Jun 2025
|
|
5
|
+
* @lastModified Sun 08 Jun 2025
|
|
6
6
|
*/
|
|
7
7
|
import React, { useMemo } from 'react';
|
|
8
8
|
import Sliders from "./Card/Sliders/index.js";
|
|
9
9
|
import Cards from "./Card/index.js";
|
|
10
10
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
|
-
// Memoized common props creator to prevent object recreation
|
|
12
11
|
const createCommonProps = (type, props) => {
|
|
13
12
|
const effectiveIsLoading = props.isLoading?.section || props.section_id === `dummy-${type}`;
|
|
13
|
+
const onPressMoreHandler = props.events?.onPressMore ? params => {
|
|
14
|
+
props.events?.onPressMore?.({
|
|
15
|
+
section_id: params.section_id,
|
|
16
|
+
name: params.name,
|
|
17
|
+
type
|
|
18
|
+
});
|
|
19
|
+
} : undefined;
|
|
14
20
|
return {
|
|
15
21
|
theme: props.theme,
|
|
16
22
|
title: props.name,
|
|
@@ -19,10 +25,14 @@ const createCommonProps = (type, props) => {
|
|
|
19
25
|
data: props.data?.sectionData || null,
|
|
20
26
|
index: props.index,
|
|
21
27
|
onPressItem: props.events?.onPressItem,
|
|
22
|
-
onPressMore:
|
|
28
|
+
onPressMore: onPressMoreHandler,
|
|
29
|
+
onAdVisible: props.events?.onAdVisible,
|
|
23
30
|
isLoading: effectiveIsLoading,
|
|
24
31
|
moreFetchDataHistory: props.moreFetchDataHistory,
|
|
25
|
-
moreFetchData: props.moreFetchData
|
|
32
|
+
moreFetchData: props.moreFetchData,
|
|
33
|
+
onDisplayAds: props.onDisplayAds || props.events?.onDisplayAds,
|
|
34
|
+
screenDimensions: props.screenDimensions,
|
|
35
|
+
viewportOffsets: props.viewportOffsets
|
|
26
36
|
};
|
|
27
37
|
};
|
|
28
38
|
const renderDefaultComponent = (type, props) => {
|
|
@@ -83,6 +93,10 @@ const renderDefaultComponent = (type, props) => {
|
|
|
83
93
|
return null;
|
|
84
94
|
}
|
|
85
95
|
};
|
|
96
|
+
|
|
97
|
+
// ----------------------------------------
|
|
98
|
+
// Sections Component
|
|
99
|
+
// ----------------------------------------
|
|
86
100
|
const Sections = ({
|
|
87
101
|
type,
|
|
88
102
|
data,
|
|
@@ -95,7 +109,10 @@ const Sections = ({
|
|
|
95
109
|
sectionProps,
|
|
96
110
|
isLoading,
|
|
97
111
|
moreFetchData,
|
|
98
|
-
moreFetchDataHistory
|
|
112
|
+
moreFetchDataHistory,
|
|
113
|
+
onDisplayAds,
|
|
114
|
+
screenDimensions,
|
|
115
|
+
viewportOffsets
|
|
99
116
|
}) => {
|
|
100
117
|
const commonProps = useMemo(() => ({
|
|
101
118
|
data: data.sectionData,
|
|
@@ -112,10 +129,11 @@ const Sections = ({
|
|
|
112
129
|
sectionProps,
|
|
113
130
|
isLoading,
|
|
114
131
|
moreFetchData,
|
|
115
|
-
moreFetchDataHistory
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
132
|
+
moreFetchDataHistory,
|
|
133
|
+
onDisplayAds,
|
|
134
|
+
screenDimensions,
|
|
135
|
+
viewportOffsets
|
|
136
|
+
}), [type, data, name, section_id, index, theme, events, sectionProps, isLoading, moreFetchData, moreFetchDataHistory, onDisplayAds, screenDimensions, viewportOffsets]);
|
|
119
137
|
const filterProps = useMemo(() => ({
|
|
120
138
|
data,
|
|
121
139
|
name,
|
|
@@ -126,8 +144,11 @@ const Sections = ({
|
|
|
126
144
|
sectionProps,
|
|
127
145
|
isLoading,
|
|
128
146
|
moreFetchData,
|
|
129
|
-
moreFetchDataHistory
|
|
130
|
-
|
|
147
|
+
moreFetchDataHistory,
|
|
148
|
+
onDisplayAds,
|
|
149
|
+
screenDimensions,
|
|
150
|
+
viewportOffsets
|
|
151
|
+
}), [data, name, section_id, index, theme, events, sectionProps, isLoading, moreFetchData, moreFetchDataHistory, onDisplayAds, screenDimensions, viewportOffsets]);
|
|
131
152
|
const fallbackComponents = useMemo(() => customComponents.filter(({
|
|
132
153
|
type: customType
|
|
133
154
|
}) => renderDefaultComponent(customType, filterProps) === null), [customComponents, filterProps]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useMemo","Sliders","Cards","jsx","_jsx","Fragment","_Fragment","createCommonProps","type","props","effectiveIsLoading","isLoading","section","section_id","
|
|
1
|
+
{"version":3,"names":["React","useMemo","Sliders","Cards","jsx","_jsx","Fragment","_Fragment","createCommonProps","type","props","effectiveIsLoading","isLoading","section","section_id","onPressMoreHandler","events","onPressMore","params","name","undefined","theme","title","data","sectionData","index","onPressItem","onAdVisible","moreFetchDataHistory","moreFetchData","onDisplayAds","screenDimensions","viewportOffsets","renderDefaultComponent","commonProps","Styles","One","showPlayIcon","sectionProps","showPlayBtn","Two","Three","Four","Five","Six","NowWatching","historyData","isLoadingHistory","history","RotateCarousel","TopTen","Sections","customComponents","customComponent","find","c","defaultRendered","filterProps","fallbackComponents","filter","customType","cloneElement","component","children","map","key","memo"],"sourceRoot":"../../../../src","sources":["components/Content/Sections.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,OAAOC,OAAO,MAAM,yBAAgB;AACpC,OAAOC,KA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EF,SAAS;MAAErD,IAAI,EAAEwD;IAAI,CAAC,kBAC/CjE,KAAK,CAAC6D,YAAY,CAACC,SAAS,EAAE;MAC5B,IAAIA,SAAS,EAAEpD,KAAK,IAAI,CAAC,CAAC,CAAC;MAC3BuD,GAAG;MACH,GAAG/B;IACL,CAAC,CACH;EAAC,CACD,CAAC;AAEP,CAAC;AAED,4BAAelC,KAAK,CAACkE,IAAI,CAACf,QAAQ,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Creates a dummy content data object for skeleton loading states
|
|
5
|
+
*/
|
|
6
|
+
export const dummyContentData = (id = 'dummy-content-id') => {
|
|
7
|
+
return {
|
|
8
|
+
_id: id,
|
|
9
|
+
poster: '',
|
|
10
|
+
thumbnail: '',
|
|
11
|
+
content_offering_type: 'movie',
|
|
12
|
+
name: '',
|
|
13
|
+
slug: '',
|
|
14
|
+
u_age: '',
|
|
15
|
+
description: '',
|
|
16
|
+
release_date: '',
|
|
17
|
+
runtime: '',
|
|
18
|
+
duration: '',
|
|
19
|
+
genre: '',
|
|
20
|
+
director: '',
|
|
21
|
+
cast: [],
|
|
22
|
+
rating: '',
|
|
23
|
+
language: '',
|
|
24
|
+
subtitles: [],
|
|
25
|
+
audio_tracks: [],
|
|
26
|
+
type: 'movie',
|
|
27
|
+
year: '',
|
|
28
|
+
tags: [],
|
|
29
|
+
trailer: '',
|
|
30
|
+
trailer_source_link: '',
|
|
31
|
+
banner: '',
|
|
32
|
+
logo: '',
|
|
33
|
+
source_link: '',
|
|
34
|
+
source_type: '',
|
|
35
|
+
is_featured: false,
|
|
36
|
+
is_premium: false,
|
|
37
|
+
status: 'active',
|
|
38
|
+
views: 0,
|
|
39
|
+
likes: 0,
|
|
40
|
+
created_at: new Date().toISOString(),
|
|
41
|
+
updated_at: new Date().toISOString()
|
|
42
|
+
};
|
|
43
|
+
};
|
|
3
44
|
const generateDummySection = type => {
|
|
4
45
|
return {
|
|
5
46
|
_id: `dummy-${type}`,
|
|
@@ -12,10 +53,9 @@ const generateDummySection = type => {
|
|
|
12
53
|
slug: 'dummy'
|
|
13
54
|
},
|
|
14
55
|
content: {
|
|
15
|
-
data: Array
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}),
|
|
56
|
+
data: Array.from({
|
|
57
|
+
length: 5
|
|
58
|
+
}, (_, i) => dummyContentData(`dummy-content-${i}`)),
|
|
19
59
|
meta: {
|
|
20
60
|
pagination: {
|
|
21
61
|
total: 5,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["dummyContentData","id","_id","poster","thumbnail","content_offering_type","name","slug","u_age","description","release_date","runtime","duration","genre","director","cast","rating","language","subtitles","audio_tracks","type","year","tags","trailer","trailer_source_link","banner","logo","source_link","source_type","is_featured","is_premium","status","views","likes","created_at","Date","toISOString","updated_at","generateDummySection","charAt","toUpperCase","slice","content_ids","Array","fill","category","content","data","from","length","_","i","meta","pagination","total","limit","page","hasNextPage","nextPage","label","order","createdAt","updatedAt","dummySections"],"sourceRoot":"../../../src","sources":["constants/dummySections.ts"],"mappings":";;AAGA;AACA;AACA;AACA,OAAO,MAAMA,gBAAgB,GAAGA,CAC9BC,EAAU,GAAG,kBAAkB,KACd;EACjB,OAAO;IACLC,GAAG,EAAED,EAAE;IACPE,MAAM,EAAE,EAAE;IACVC,SAAS,EAAE,EAAE;IACbC,qBAAqB,EAAE,OAAO;IAC9BC,IAAI,EAAE,EAAE;IACRC,IAAI,EAAE,EAAE;IACRC,KAAK,EAAE,EAAE;IACTC,WAAW,EAAE,EAAE;IACfC,YAAY,EAAE,EAAE;IAChBC,OAAO,EAAE,EAAE;IACXC,QAAQ,EAAE,EAAE;IACZC,KAAK,EAAE,EAAE;IACTC,QAAQ,EAAE,EAAE;IACZC,IAAI,EAAE,EAAE;IACRC,MAAM,EAAE,EAAE;IACVC,QAAQ,EAAE,E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AE,CAAC;UACRC,IAAI,EAAE,CAAC;UACPC,WAAW,EAAE,IAAI;UACjBR,MAAM,EAAE,CAAC;UACTS,QAAQ,EAAE;QACZ;MACF;IACF,CAAC;IACDC,KAAK,EAAE,EAAE;IACTC,KAAK,EAAE,CAAC;IACR7B,MAAM,EAAE,KAAK;IACb8B,SAAS,EAAE,IAAI1B,IAAI,CAAC,CAAC;IACrB2B,SAAS,EAAE,IAAI3B,IAAI,CAAC;EACtB,CAAC;AACH,CAAC;AAED,OAAO,MAAM4B,aAAgC,GAAG,CAC9CzB,oBAAoB,CAAC,QAAQ,CAAC,EAC9BA,oBAAoB,CAAC,QAAQ,CAAC,EAC9BA,oBAAoB,CAAC,mBAAmB,CAAC,EACzCA,oBAAoB,CAAC,cAAc,CAAC,EACpCA,oBAAoB,CAAC,cAAc,CAAC,EACpCA,oBAAoB,CAAC,cAAc,CAAC,EACpCA,oBAAoB,CAAC,cAAc,CAAC,EACpCA,oBAAoB,CAAC,cAAc,CAAC,EACpCA,oBAAoB,CAAC,QAAQ,CAAC,CAC/B","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["hooks/Images/index.ts"],"mappings":";;AAAA,cAAc,qBAAkB;AAChC,cAAc,yBAAsB","ignoreList":[]}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @author Naresh Dhamu
|
|
5
|
+
* @lastModified Wed 26 Nov 2025 at 02:19 PM
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { useState, useEffect, useMemo, useCallback, useRef } from 'react';
|
|
9
|
+
import FastImage from 'react-native-fast-image';
|
|
10
|
+
import { isValidImageUrl, isLocalFile } from "./useImageValidation.js";
|
|
11
|
+
|
|
12
|
+
// Module-level cache to track successfully loaded images
|
|
13
|
+
const loadedImageCache = new Set();
|
|
14
|
+
/**
|
|
15
|
+
* Custom hook to manage image loading state, caching, and validation
|
|
16
|
+
* @param options - Configuration options for image loading
|
|
17
|
+
* @returns Object containing image state and handlers
|
|
18
|
+
*/
|
|
19
|
+
export const useImageLoader = ({
|
|
20
|
+
imageUri,
|
|
21
|
+
isLoading = false,
|
|
22
|
+
enablePreload = false,
|
|
23
|
+
onError,
|
|
24
|
+
onLoad,
|
|
25
|
+
onLoadStart
|
|
26
|
+
}) => {
|
|
27
|
+
const [imageLoading, setImageLoading] = useState(true);
|
|
28
|
+
const [imageError, setImageError] = useState(false);
|
|
29
|
+
const previousUriRef = useRef('');
|
|
30
|
+
const onErrorRef = useRef(onError);
|
|
31
|
+
|
|
32
|
+
// Keep onError ref updated
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
onErrorRef.current = onError;
|
|
35
|
+
}, [onError]);
|
|
36
|
+
|
|
37
|
+
// Validate image URL
|
|
38
|
+
const hasValidImage = useMemo(() => isValidImageUrl(imageUri), [imageUri]);
|
|
39
|
+
|
|
40
|
+
// Check if image is already cached
|
|
41
|
+
const isImageCached = useMemo(() => loadedImageCache.has(imageUri), [imageUri]);
|
|
42
|
+
|
|
43
|
+
// Handle image state changes
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
const uriChanged = previousUriRef.current !== imageUri;
|
|
46
|
+
|
|
47
|
+
// Update ref when URI changes
|
|
48
|
+
if (uriChanged) {
|
|
49
|
+
previousUriRef.current = imageUri;
|
|
50
|
+
// Reset error state when URI changes to allow new image to load
|
|
51
|
+
setImageError(false);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Reset states when loading
|
|
55
|
+
if (isLoading) {
|
|
56
|
+
setImageLoading(true);
|
|
57
|
+
setImageError(false);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Handle valid image URL
|
|
62
|
+
if (hasValidImage) {
|
|
63
|
+
const isLocal = isLocalFile(imageUri);
|
|
64
|
+
if (isImageCached) {
|
|
65
|
+
// Image is cached, mark as loaded
|
|
66
|
+
setImageLoading(false);
|
|
67
|
+
setImageError(false);
|
|
68
|
+
} else {
|
|
69
|
+
// Image not cached, start loading
|
|
70
|
+
setImageLoading(true);
|
|
71
|
+
setImageError(false);
|
|
72
|
+
// Preload image if enabled (only for remote URLs, not local files)
|
|
73
|
+
if (enablePreload && !isLocal && uriChanged) {
|
|
74
|
+
FastImage.preload([{
|
|
75
|
+
uri: imageUri
|
|
76
|
+
}]);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
} else {
|
|
80
|
+
// For empty or invalid URLs
|
|
81
|
+
if (!imageUri || imageUri.trim() === '') {
|
|
82
|
+
// Empty URI - show error immediately (no point in trying to load)
|
|
83
|
+
setImageLoading(false);
|
|
84
|
+
setImageError(true);
|
|
85
|
+
} else {
|
|
86
|
+
// Invalid URL format - attempt to load anyway
|
|
87
|
+
// FastImage might still be able to load it, so keep loading state
|
|
88
|
+
setImageLoading(true);
|
|
89
|
+
setImageError(false);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}, [imageUri, hasValidImage, isLoading, isImageCached, enablePreload]);
|
|
93
|
+
|
|
94
|
+
// Determine if skeleton should be shown
|
|
95
|
+
const showSkeleton = useMemo(() => isLoading || imageLoading && !imageError, [isLoading, imageLoading, imageError]);
|
|
96
|
+
|
|
97
|
+
// Determine if fallback should be shown
|
|
98
|
+
// Show fallback when:
|
|
99
|
+
// 1. Not showing skeleton
|
|
100
|
+
// 2. AND (imageError is true OR URI is empty/invalid)
|
|
101
|
+
// This allows images with invalid format to attempt loading, but shows fallback for empty URIs
|
|
102
|
+
const showFallback = useMemo(() => {
|
|
103
|
+
if (showSkeleton) return false;
|
|
104
|
+
// Empty URI - show fallback immediately
|
|
105
|
+
if (!imageUri || imageUri.trim() === '') return true;
|
|
106
|
+
// Show fallback only after actual error (not just invalid format)
|
|
107
|
+
return imageError && !imageLoading;
|
|
108
|
+
}, [showSkeleton, imageError, imageLoading, imageUri]);
|
|
109
|
+
|
|
110
|
+
// Check if image is a local file
|
|
111
|
+
const isLocal = useMemo(() => isLocalFile(imageUri), [imageUri]);
|
|
112
|
+
|
|
113
|
+
// Image source configuration
|
|
114
|
+
// Local files don't need cache control, cloud URIs do
|
|
115
|
+
const imageSource = useMemo(() => {
|
|
116
|
+
const source = {
|
|
117
|
+
uri: imageUri
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
// Only add cache control for remote URLs, not local files
|
|
121
|
+
if (!isLocal) {
|
|
122
|
+
source.cache = FastImage.cacheControl.immutable;
|
|
123
|
+
source.priority = FastImage.priority.normal;
|
|
124
|
+
}
|
|
125
|
+
return source;
|
|
126
|
+
}, [imageUri, isLocal]);
|
|
127
|
+
|
|
128
|
+
// Image event handlers
|
|
129
|
+
const handleLoad = useCallback(() => {
|
|
130
|
+
setImageLoading(false);
|
|
131
|
+
setImageError(false);
|
|
132
|
+
if (imageUri) {
|
|
133
|
+
loadedImageCache.add(imageUri);
|
|
134
|
+
}
|
|
135
|
+
if (onLoad) {
|
|
136
|
+
onLoad();
|
|
137
|
+
}
|
|
138
|
+
}, [imageUri, onLoad]);
|
|
139
|
+
const handleError = useCallback(() => {
|
|
140
|
+
setImageLoading(false);
|
|
141
|
+
setImageError(true);
|
|
142
|
+
if (onError) {
|
|
143
|
+
onError();
|
|
144
|
+
}
|
|
145
|
+
}, [onError]);
|
|
146
|
+
const handleLoadStart = useCallback(() => {
|
|
147
|
+
if (!isImageCached) {
|
|
148
|
+
setImageLoading(true);
|
|
149
|
+
setImageError(false);
|
|
150
|
+
if (onLoadStart) {
|
|
151
|
+
onLoadStart();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}, [isImageCached, onLoadStart]);
|
|
155
|
+
return {
|
|
156
|
+
imageLoading,
|
|
157
|
+
imageError,
|
|
158
|
+
hasValidImage,
|
|
159
|
+
isImageCached,
|
|
160
|
+
showSkeleton,
|
|
161
|
+
showFallback,
|
|
162
|
+
imageSource,
|
|
163
|
+
handleLoad,
|
|
164
|
+
handleError,
|
|
165
|
+
handleLoadStart: enablePreload ? handleLoadStart : undefined
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
//# sourceMappingURL=useImageLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useState","useEffect","useMemo","useCallback","useRef","FastImage","isValidImageUrl","isLocalFile","loadedImageCache","Set","useImageLoader","imageUri","isLoading","enablePreload","onError","onLoad","onLoadStart","imageLoading","setImageLoading","imageError","setImageError","previousUriRef","onErrorRef","current","hasValidImage","isImageCached","has","uriChanged","isLocal","preload","uri","trim","showSkeleton","showFallback","imageSource","source","cache","cacheControl","immutable","priority","normal","handleLoad","add","handleError","handleLoadStart","undefined"],"sourceRoot":"../../../../src","sources":["hooks/Images/useImageLoader.ts"],"mappings":";;AAAA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,EAAEC,SAAS,EAAEC,OAAO,EAAEC,WAAW,EAAEC,MAAM,QAAQ,OAAO;AACzE,OAAOC,SAAS,MAAM,yBAAyB;AAC/C,SAASC,eAAe,EAAEC,WAAW,QAAQ,yBAAsB;;AAEnE;AACA,MAAMC,gBAAgB,GAAG,IAAIC,GAAG,CAAS,CAAC;AA4B1C;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,cAAc,GAAGA,CAAC;EAC7BC,QAAQ;EACRC,SAAS,GAAG,KAAK;EACjBC,aAAa,GAAG,KAAK;EACrBC,OAAO;EACPC,MAAM;EACNC;AACqB,CAAC,KAA2B;EACjD,MAAM,CAACC,YAAY,EAAEC,eAAe,CAAC,GAAGlB,QAAQ,CAAC,IAAI,CAAC;EACtD,MAAM,CAACmB,UAAU,EAAEC,aAAa,CAAC,GAAGpB,QAAQ,CAAC,KAAK,CAAC;EACnD,MAAMqB,cAAc,GAAGjB,MAAM,CAAS,EAAE,CAAC;EACzC,MAAMkB,UAAU,GAAGlB,MAAM,CAACU,OAAO,CAAC;;EAElC;EACAb,SAAS,CAAC,MAAM;IACdqB,UAAU,C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CAAC,KAAK,CAAC;IACpB,IAAIT,QAAQ,EAAE;MACZH,gBAAgB,CAACkC,GAAG,CAAC/B,QAAQ,CAAC;IAChC;IACA,IAAII,MAAM,EAAE;MACVA,MAAM,CAAC,CAAC;IACV;EACF,CAAC,EAAE,CAACJ,QAAQ,EAAEI,MAAM,CAAC,CAAC;EAEtB,MAAM4B,WAAW,GAAGxC,WAAW,CAAC,MAAM;IACpCe,eAAe,CAAC,KAAK,CAAC;IAEtBE,aAAa,CAAC,IAAI,CAAC;IACnB,IAAIN,OAAO,EAAE;MACXA,OAAO,CAAC,CAAC;IACX;EACF,CAAC,EAAE,CAACA,OAAO,CAAC,CAAC;EAEb,MAAM8B,eAAe,GAAGzC,WAAW,CAAC,MAAM;IACxC,IAAI,CAACsB,aAAa,EAAE;MAClBP,eAAe,CAAC,IAAI,CAAC;MACrBE,aAAa,CAAC,KAAK,CAAC;MACpB,IAAIJ,WAAW,EAAE;QACfA,WAAW,CAAC,CAAC;MACf;IACF;EACF,CAAC,EAAE,CAACS,aAAa,EAAET,WAAW,CAAC,CAAC;EAEhC,OAAO;IACLC,YAAY;IACZE,UAAU;IACVK,aAAa;IACbC,aAAa;IACbO,YAAY;IACZC,YAAY;IACZC,WAAW;IACXO,UAAU;IACVE,WAAW;IACXC,eAAe,EAAE/B,aAAa,GAAG+B,eAAe,GAAGC;EACrD,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @author Naresh Dhamu
|
|
5
|
+
* @lastModified Wed 26 Nov 2025 at 02:19 PM
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const IMAGE_URL_REGEX = /\.(jpg|jpeg|png|webp|gif|bmp)$/i;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Utility function to check if URL is a local file path
|
|
12
|
+
* @param url - The URL to check
|
|
13
|
+
* @returns true if the URL is a local file path, false otherwise
|
|
14
|
+
*/
|
|
15
|
+
export const isLocalFile = url => {
|
|
16
|
+
return url?.startsWith?.('file://') || url?.startsWith?.('/');
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Utility function to validate image URL (supports both cloud URIs and local file paths)
|
|
21
|
+
* @param url - The URL to validate
|
|
22
|
+
* @returns true if the URL is a valid image URL, false otherwise
|
|
23
|
+
*/
|
|
24
|
+
export const isValidImageUrl = url => {
|
|
25
|
+
if (!url || typeof url !== 'string') return false;
|
|
26
|
+
const cleaned = url.trim();
|
|
27
|
+
|
|
28
|
+
// Check for local file paths
|
|
29
|
+
if (isLocalFile(cleaned)) {
|
|
30
|
+
return IMAGE_URL_REGEX.test(cleaned) || cleaned.length > 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Check for cloud URIs (http/https)
|
|
34
|
+
return (cleaned?.startsWith?.('http://') || cleaned?.startsWith?.('https://')) && IMAGE_URL_REGEX.test(cleaned);
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=useImageValidation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["IMAGE_URL_REGEX","isLocalFile","url","startsWith","isValidImageUrl","cleaned","trim","test","length"],"sourceRoot":"../../../../src","sources":["hooks/Images/useImageValidation.ts"],"mappings":";;AAAA;AACA;AACA;AACA;;AAEA,MAAMA,eAAe,GAAG,iCAAiC;;AAEzD;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAW,GAAIC,GAAW,IAAc;EACnD,OAAOA,GAAG,EAAEC,UAAU,GAAG,SAAS,CAAC,IAAID,GAAG,EAAEC,UAAU,GAAG,GAAG,CAAC;AAC/D,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,eAAe,GAAIF,GAA8B,IAAc;EAC1E,IAAI,CAACA,GAAG,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAE,OAAO,KAAK;EACjD,MAAMG,OAAO,GAAGH,GAAG,CAACI,IAAI,CAAC,CAAC;;EAE1B;EACA,IAAIL,WAAW,CAACI,OAAO,CAAC,EAAE;IACxB,OAAOL,eAAe,CAACO,IAAI,CAACF,OAAO,CAAC,IAAIA,OAAO,CAACG,MAAM,GAAG,CAAC;EAC5D;;EAEA;EACA,OACE,CAACH,OAAO,EAAEF,UAAU,GAAG,SAAS,CAAC,IAAIE,OAAO,EAAEF,UAAU,GAAG,UAAU,CAAC,KACtEH,eAAe,CAACO,IAAI,CAACF,OAAO,CAAC;AAEjC,CAAC","ignoreList":[]}
|
|
@@ -14,4 +14,7 @@ export * from "./usePrevious.js";
|
|
|
14
14
|
export * from "./useSafeCallback.js";
|
|
15
15
|
export * from "./useSkeletonItems.js";
|
|
16
16
|
export * from "./useThemeColors.js";
|
|
17
|
+
export * from "./useCards.js";
|
|
18
|
+
export * from "./Images/index.js";
|
|
19
|
+
export * from "./useAdTracking.js";
|
|
17
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["hooks/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;;AAEA,cAAc,kBAAe;AAC7B,cAAc,kBAAe;AAC7B,cAAc,wBAAqB;AACnC,cAAc,0BAAuB;AACrC,cAAc,qBAAkB;AAChC,cAAc,kBAAe;AAC7B,cAAc,sBAAmB;AACjC,cAAc,uBAAoB;AAClC,cAAc,qBAAkB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["hooks/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;;AAEA,cAAc,kBAAe;AAC7B,cAAc,kBAAe;AAC7B,cAAc,wBAAqB;AACnC,cAAc,0BAAuB;AACrC,cAAc,qBAAkB;AAChC,cAAc,kBAAe;AAC7B,cAAc,sBAAmB;AACjC,cAAc,uBAAoB;AAClC,cAAc,qBAAkB;AAChC,cAAc,eAAY;AAC1B,cAAc,mBAAU;AACxB,cAAc,oBAAiB","ignoreList":[]}
|