@zuzjs/ui 0.8.0 → 0.8.1
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/README.md +1 -1
- package/dist/cjs/comps/Crumb/index.d.ts +1 -1
- package/dist/cjs/comps/List/index.d.ts +1 -1
- package/dist/cjs/hooks/index.d.ts +2 -0
- package/dist/cjs/hooks/index.js +2 -0
- package/dist/cjs/hooks/useFacebookPixel.d.ts +11 -0
- package/dist/cjs/hooks/useFacebookPixel.js +64 -0
- package/dist/cjs/hooks/useGoogleTagManager.d.ts +9 -0
- package/dist/cjs/hooks/useGoogleTagManager.js +53 -0
- package/dist/cjs/hooks/useSlider.d.ts +1 -1
- package/dist/esm/comps/Crumb/index.d.ts +1 -1
- package/dist/esm/comps/List/index.d.ts +1 -1
- package/dist/esm/hooks/index.d.ts +2 -0
- package/dist/esm/hooks/index.js +2 -0
- package/dist/esm/hooks/useFacebookPixel.d.ts +11 -0
- package/dist/esm/hooks/useFacebookPixel.js +64 -0
- package/dist/esm/hooks/useGoogleTagManager.d.ts +9 -0
- package/dist/esm/hooks/useGoogleTagManager.js +53 -0
- package/dist/esm/hooks/useSlider.d.ts +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
declare const Crumb: import("react").ForwardRefExoticComponent<import("..").BoxProps & {
|
|
2
2
|
items: import("./types").CrumbItem[];
|
|
3
|
-
} & import("react").RefAttributes<
|
|
3
|
+
} & import("react").RefAttributes<HTMLUListElement | HTMLOListElement>>;
|
|
4
4
|
export default Crumb;
|
|
@@ -6,5 +6,5 @@ declare const List: import("react").ForwardRefExoticComponent<import("../..").Zu
|
|
|
6
6
|
direction?: "cols" | "rows";
|
|
7
7
|
seperator?: import("react").ReactNode;
|
|
8
8
|
ol?: boolean;
|
|
9
|
-
} & import("react").RefAttributes<
|
|
9
|
+
} & import("react").RefAttributes<HTMLUListElement | HTMLOListElement>>;
|
|
10
10
|
export default List;
|
|
@@ -16,6 +16,8 @@ export { default as useMergedRefs } from './useMergedRefs';
|
|
|
16
16
|
export { default as useMutationObserver, type MutationCallback } from './useMutationObserver';
|
|
17
17
|
export { default as useDrag, type DragOptions } from './useDrag';
|
|
18
18
|
export { default as useFileManager } from './useFileManager';
|
|
19
|
+
export { default as useFacebookPixel } from './useFacebookPixel';
|
|
20
|
+
export { default as useGoogleTagManager } from './useGoogleTagManager';
|
|
19
21
|
export { default as useImage } from './useImage';
|
|
20
22
|
export { default as useIntersectionObserver } from './useIntersectionObserver';
|
|
21
23
|
export { default as useScrollbar } from './useScrollbar';
|
package/dist/cjs/hooks/index.js
CHANGED
|
@@ -17,6 +17,8 @@ export { default as useMutationObserver } from './useMutationObserver';
|
|
|
17
17
|
export { default as useDrag } from './useDrag';
|
|
18
18
|
export { default as useFileManager } from './useFileManager';
|
|
19
19
|
//useFilter
|
|
20
|
+
export { default as useFacebookPixel } from './useFacebookPixel';
|
|
21
|
+
export { default as useGoogleTagManager } from './useGoogleTagManager';
|
|
20
22
|
export { default as useImage } from './useImage';
|
|
21
23
|
export { default as useIntersectionObserver } from './useIntersectionObserver';
|
|
22
24
|
export { default as useScrollbar } from './useScrollbar';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom hook for Facebook Pixel tracking
|
|
3
|
+
* @param pixelId - Facebook Pixel ID (e.g., '123456789012345')
|
|
4
|
+
* @param debug - Optional debug mode (default: false)
|
|
5
|
+
*/
|
|
6
|
+
declare const useFacebookPixel: (pixelId?: string, debug?: boolean) => {
|
|
7
|
+
trackPageView: () => void;
|
|
8
|
+
trackEvent: (eventName: string, params?: Record<string, any>) => void;
|
|
9
|
+
trackCustom: (eventName: string, params?: Record<string, any>) => void;
|
|
10
|
+
};
|
|
11
|
+
export default useFacebookPixel;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Custom hook for Facebook Pixel tracking
|
|
4
|
+
* @param pixelId - Facebook Pixel ID (e.g., '123456789012345')
|
|
5
|
+
* @param debug - Optional debug mode (default: false)
|
|
6
|
+
*/
|
|
7
|
+
const useFacebookPixel = (pixelId, debug = false) => {
|
|
8
|
+
// Initialize Facebook Pixel
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (!pixelId)
|
|
11
|
+
return;
|
|
12
|
+
// Load Facebook Pixel script if not already loaded
|
|
13
|
+
if (!window.fbq) {
|
|
14
|
+
const script = document.createElement('script');
|
|
15
|
+
script.async = true;
|
|
16
|
+
script.src = `https://connect.facebook.net/en_US/fbevents.js`;
|
|
17
|
+
document.head.appendChild(script);
|
|
18
|
+
window._fbq = window._fbq || [];
|
|
19
|
+
window.fbq = function () {
|
|
20
|
+
window._fbq.push(arguments);
|
|
21
|
+
};
|
|
22
|
+
window.fbq('init', pixelId);
|
|
23
|
+
if (debug) {
|
|
24
|
+
window.fbq('set', 'debug', true);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
// Track initial page view
|
|
28
|
+
window.fbq('track', 'PageView');
|
|
29
|
+
}, [pixelId, debug]);
|
|
30
|
+
/**
|
|
31
|
+
* Track a page view
|
|
32
|
+
*/
|
|
33
|
+
const trackPageView = () => {
|
|
34
|
+
if (!pixelId)
|
|
35
|
+
return;
|
|
36
|
+
window.fbq('track', 'PageView');
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Track a custom event
|
|
40
|
+
* @param eventName - Standard or custom event name
|
|
41
|
+
* @param params - Optional event parameters
|
|
42
|
+
*/
|
|
43
|
+
const trackEvent = (eventName, params) => {
|
|
44
|
+
if (!pixelId)
|
|
45
|
+
return;
|
|
46
|
+
window.fbq('track', eventName, params);
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Track a custom conversion
|
|
50
|
+
* @param eventName - Conversion event name
|
|
51
|
+
* @param params - Optional conversion parameters
|
|
52
|
+
*/
|
|
53
|
+
const trackCustom = (eventName, params) => {
|
|
54
|
+
if (!pixelId)
|
|
55
|
+
return;
|
|
56
|
+
window.fbq('trackCustom', eventName, params);
|
|
57
|
+
};
|
|
58
|
+
return {
|
|
59
|
+
trackPageView,
|
|
60
|
+
trackEvent,
|
|
61
|
+
trackCustom,
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export default useFacebookPixel;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom hook for Google gtag (Global Site Tag) tracking
|
|
3
|
+
* @param id - Google Analytics tracking ID (e.g., 'G-XXXXXXXXXX')
|
|
4
|
+
*/
|
|
5
|
+
declare const useGtag: (id?: string) => {
|
|
6
|
+
trackPageView: (path?: string) => void;
|
|
7
|
+
trackEvent: (eventName: string, params?: Record<string, any>) => void;
|
|
8
|
+
};
|
|
9
|
+
export default useGtag;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Custom hook for Google gtag (Global Site Tag) tracking
|
|
4
|
+
* @param id - Google Analytics tracking ID (e.g., 'G-XXXXXXXXXX')
|
|
5
|
+
*/
|
|
6
|
+
const useGtag = (id) => {
|
|
7
|
+
// Initialize gtag.js
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
if (!id)
|
|
10
|
+
return;
|
|
11
|
+
// Load gtag.js script if not already loaded
|
|
12
|
+
if (!window.gtag) {
|
|
13
|
+
const script = document.createElement('script');
|
|
14
|
+
script.async = true;
|
|
15
|
+
script.src = `https://www.googletagmanager.com/gtag/js?id=${id}`;
|
|
16
|
+
document.head.appendChild(script);
|
|
17
|
+
window.dataLayer = window.dataLayer || [];
|
|
18
|
+
window.gtag = function () {
|
|
19
|
+
window.dataLayer.push(arguments);
|
|
20
|
+
};
|
|
21
|
+
// Set the current date/time
|
|
22
|
+
window.gtag('js', new Date());
|
|
23
|
+
}
|
|
24
|
+
// Configure the tracker
|
|
25
|
+
window.gtag('config', id);
|
|
26
|
+
}, [id]);
|
|
27
|
+
/**
|
|
28
|
+
* Track a page view
|
|
29
|
+
* @param path - URL path to track (defaults to current location)
|
|
30
|
+
*/
|
|
31
|
+
const trackPageView = (path) => {
|
|
32
|
+
if (!id)
|
|
33
|
+
return;
|
|
34
|
+
window.gtag('config', id, {
|
|
35
|
+
page_path: path || window.location.pathname,
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Track an event
|
|
40
|
+
* @param eventName - Event name (e.g., 'login', 'sign_up')
|
|
41
|
+
* @param params - Additional event parameters
|
|
42
|
+
*/
|
|
43
|
+
const trackEvent = (eventName, params) => {
|
|
44
|
+
if (!id)
|
|
45
|
+
return;
|
|
46
|
+
window.gtag('event', eventName, params);
|
|
47
|
+
};
|
|
48
|
+
return {
|
|
49
|
+
trackPageView,
|
|
50
|
+
trackEvent,
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export default useGtag;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
declare const Crumb: import("react").ForwardRefExoticComponent<import("..").BoxProps & {
|
|
2
2
|
items: import("./types").CrumbItem[];
|
|
3
|
-
} & import("react").RefAttributes<
|
|
3
|
+
} & import("react").RefAttributes<HTMLUListElement | HTMLOListElement>>;
|
|
4
4
|
export default Crumb;
|
|
@@ -6,5 +6,5 @@ declare const List: import("react").ForwardRefExoticComponent<import("../..").Zu
|
|
|
6
6
|
direction?: "cols" | "rows";
|
|
7
7
|
seperator?: import("react").ReactNode;
|
|
8
8
|
ol?: boolean;
|
|
9
|
-
} & import("react").RefAttributes<
|
|
9
|
+
} & import("react").RefAttributes<HTMLUListElement | HTMLOListElement>>;
|
|
10
10
|
export default List;
|
|
@@ -16,6 +16,8 @@ export { default as useMergedRefs } from './useMergedRefs';
|
|
|
16
16
|
export { default as useMutationObserver, type MutationCallback } from './useMutationObserver';
|
|
17
17
|
export { default as useDrag, type DragOptions } from './useDrag';
|
|
18
18
|
export { default as useFileManager } from './useFileManager';
|
|
19
|
+
export { default as useFacebookPixel } from './useFacebookPixel';
|
|
20
|
+
export { default as useGoogleTagManager } from './useGoogleTagManager';
|
|
19
21
|
export { default as useImage } from './useImage';
|
|
20
22
|
export { default as useIntersectionObserver } from './useIntersectionObserver';
|
|
21
23
|
export { default as useScrollbar } from './useScrollbar';
|
package/dist/esm/hooks/index.js
CHANGED
|
@@ -17,6 +17,8 @@ export { default as useMutationObserver } from './useMutationObserver';
|
|
|
17
17
|
export { default as useDrag } from './useDrag';
|
|
18
18
|
export { default as useFileManager } from './useFileManager';
|
|
19
19
|
//useFilter
|
|
20
|
+
export { default as useFacebookPixel } from './useFacebookPixel';
|
|
21
|
+
export { default as useGoogleTagManager } from './useGoogleTagManager';
|
|
20
22
|
export { default as useImage } from './useImage';
|
|
21
23
|
export { default as useIntersectionObserver } from './useIntersectionObserver';
|
|
22
24
|
export { default as useScrollbar } from './useScrollbar';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom hook for Facebook Pixel tracking
|
|
3
|
+
* @param pixelId - Facebook Pixel ID (e.g., '123456789012345')
|
|
4
|
+
* @param debug - Optional debug mode (default: false)
|
|
5
|
+
*/
|
|
6
|
+
declare const useFacebookPixel: (pixelId?: string, debug?: boolean) => {
|
|
7
|
+
trackPageView: () => void;
|
|
8
|
+
trackEvent: (eventName: string, params?: Record<string, any>) => void;
|
|
9
|
+
trackCustom: (eventName: string, params?: Record<string, any>) => void;
|
|
10
|
+
};
|
|
11
|
+
export default useFacebookPixel;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Custom hook for Facebook Pixel tracking
|
|
4
|
+
* @param pixelId - Facebook Pixel ID (e.g., '123456789012345')
|
|
5
|
+
* @param debug - Optional debug mode (default: false)
|
|
6
|
+
*/
|
|
7
|
+
const useFacebookPixel = (pixelId, debug = false) => {
|
|
8
|
+
// Initialize Facebook Pixel
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (!pixelId)
|
|
11
|
+
return;
|
|
12
|
+
// Load Facebook Pixel script if not already loaded
|
|
13
|
+
if (!window.fbq) {
|
|
14
|
+
const script = document.createElement('script');
|
|
15
|
+
script.async = true;
|
|
16
|
+
script.src = `https://connect.facebook.net/en_US/fbevents.js`;
|
|
17
|
+
document.head.appendChild(script);
|
|
18
|
+
window._fbq = window._fbq || [];
|
|
19
|
+
window.fbq = function () {
|
|
20
|
+
window._fbq.push(arguments);
|
|
21
|
+
};
|
|
22
|
+
window.fbq('init', pixelId);
|
|
23
|
+
if (debug) {
|
|
24
|
+
window.fbq('set', 'debug', true);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
// Track initial page view
|
|
28
|
+
window.fbq('track', 'PageView');
|
|
29
|
+
}, [pixelId, debug]);
|
|
30
|
+
/**
|
|
31
|
+
* Track a page view
|
|
32
|
+
*/
|
|
33
|
+
const trackPageView = () => {
|
|
34
|
+
if (!pixelId)
|
|
35
|
+
return;
|
|
36
|
+
window.fbq('track', 'PageView');
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Track a custom event
|
|
40
|
+
* @param eventName - Standard or custom event name
|
|
41
|
+
* @param params - Optional event parameters
|
|
42
|
+
*/
|
|
43
|
+
const trackEvent = (eventName, params) => {
|
|
44
|
+
if (!pixelId)
|
|
45
|
+
return;
|
|
46
|
+
window.fbq('track', eventName, params);
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Track a custom conversion
|
|
50
|
+
* @param eventName - Conversion event name
|
|
51
|
+
* @param params - Optional conversion parameters
|
|
52
|
+
*/
|
|
53
|
+
const trackCustom = (eventName, params) => {
|
|
54
|
+
if (!pixelId)
|
|
55
|
+
return;
|
|
56
|
+
window.fbq('trackCustom', eventName, params);
|
|
57
|
+
};
|
|
58
|
+
return {
|
|
59
|
+
trackPageView,
|
|
60
|
+
trackEvent,
|
|
61
|
+
trackCustom,
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export default useFacebookPixel;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom hook for Google gtag (Global Site Tag) tracking
|
|
3
|
+
* @param id - Google Analytics tracking ID (e.g., 'G-XXXXXXXXXX')
|
|
4
|
+
*/
|
|
5
|
+
declare const useGtag: (id?: string) => {
|
|
6
|
+
trackPageView: (path?: string) => void;
|
|
7
|
+
trackEvent: (eventName: string, params?: Record<string, any>) => void;
|
|
8
|
+
};
|
|
9
|
+
export default useGtag;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Custom hook for Google gtag (Global Site Tag) tracking
|
|
4
|
+
* @param id - Google Analytics tracking ID (e.g., 'G-XXXXXXXXXX')
|
|
5
|
+
*/
|
|
6
|
+
const useGtag = (id) => {
|
|
7
|
+
// Initialize gtag.js
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
if (!id)
|
|
10
|
+
return;
|
|
11
|
+
// Load gtag.js script if not already loaded
|
|
12
|
+
if (!window.gtag) {
|
|
13
|
+
const script = document.createElement('script');
|
|
14
|
+
script.async = true;
|
|
15
|
+
script.src = `https://www.googletagmanager.com/gtag/js?id=${id}`;
|
|
16
|
+
document.head.appendChild(script);
|
|
17
|
+
window.dataLayer = window.dataLayer || [];
|
|
18
|
+
window.gtag = function () {
|
|
19
|
+
window.dataLayer.push(arguments);
|
|
20
|
+
};
|
|
21
|
+
// Set the current date/time
|
|
22
|
+
window.gtag('js', new Date());
|
|
23
|
+
}
|
|
24
|
+
// Configure the tracker
|
|
25
|
+
window.gtag('config', id);
|
|
26
|
+
}, [id]);
|
|
27
|
+
/**
|
|
28
|
+
* Track a page view
|
|
29
|
+
* @param path - URL path to track (defaults to current location)
|
|
30
|
+
*/
|
|
31
|
+
const trackPageView = (path) => {
|
|
32
|
+
if (!id)
|
|
33
|
+
return;
|
|
34
|
+
window.gtag('config', id, {
|
|
35
|
+
page_path: path || window.location.pathname,
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Track an event
|
|
40
|
+
* @param eventName - Event name (e.g., 'login', 'sign_up')
|
|
41
|
+
* @param params - Additional event parameters
|
|
42
|
+
*/
|
|
43
|
+
const trackEvent = (eventName, params) => {
|
|
44
|
+
if (!id)
|
|
45
|
+
return;
|
|
46
|
+
window.gtag('event', eventName, params);
|
|
47
|
+
};
|
|
48
|
+
return {
|
|
49
|
+
trackPageView,
|
|
50
|
+
trackEvent,
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export default useGtag;
|