@hifilabs/pixel 0.6.0 → 0.6.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.
@@ -576,3 +576,39 @@ export interface UseBalanceSubscriptionReturn {
576
576
  }
577
577
 
578
578
  export declare function useBalanceSubscription(): UseBalanceSubscriptionReturn;
579
+
580
+ // ============================================
581
+ // usePageviewTracking Hook
582
+ // ============================================
583
+
584
+ export declare function usePageviewTracking(): void;
585
+
586
+ // ============================================
587
+ // ConsentBridge Component
588
+ // ============================================
589
+
590
+ export interface ConsentBridgeProps {
591
+ /**
592
+ * Analytics consent (pageviews, clicks, engagement)
593
+ */
594
+ analytics?: boolean;
595
+
596
+ /**
597
+ * Marketing consent (email notifications, ads)
598
+ */
599
+ marketing?: boolean;
600
+
601
+ /**
602
+ * Personalization consent (recommendations, preferences)
603
+ */
604
+ personalization?: boolean;
605
+ }
606
+
607
+ /**
608
+ * ConsentBridge - Vendor-agnostic consent sync for Balance Pixel
609
+ *
610
+ * Accepts generic boolean props and syncs to Balance Pixel.
611
+ * The mapping from your consent manager (c15t, OneTrust, etc.) to these
612
+ * props happens in your app code, not in the SDK.
613
+ */
614
+ export declare function ConsentBridge(props: ConsentBridgeProps): null;
package/dist/index.js CHANGED
@@ -37,6 +37,7 @@ __export(src_exports, {
37
37
  BalanceAnalytics: () => BalanceAnalytics,
38
38
  BalanceContext: () => BalanceContext,
39
39
  BalanceProvider: () => BalanceProvider,
40
+ ConsentBridge: () => ConsentBridge,
40
41
  DEFAULT_GTM_CONSENT: () => DEFAULT_GTM_CONSENT,
41
42
  GTMProvider: () => GTMProvider,
42
43
  StorageManager: () => StorageManager,
@@ -2849,6 +2850,30 @@ function BalanceAnalytics() {
2849
2850
 
2850
2851
  // src/react/ConsentBridge.tsx
2851
2852
  var import_react22 = require("react");
2853
+ function ConsentBridge({
2854
+ analytics,
2855
+ marketing,
2856
+ personalization
2857
+ }) {
2858
+ const { setConsent: setConsent2 } = useBalanceConsent();
2859
+ const isInitialized = (0, import_react22.useRef)(false);
2860
+ (0, import_react22.useEffect)(() => {
2861
+ if (analytics === void 0 && marketing === void 0 && personalization === void 0) {
2862
+ return;
2863
+ }
2864
+ setConsent2({
2865
+ analytics: analytics ?? false,
2866
+ marketing: marketing ?? false,
2867
+ personalization: personalization ?? false,
2868
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
2869
+ });
2870
+ if (!isInitialized.current) {
2871
+ console.log("[ConsentBridge] Initial sync:", { analytics, marketing, personalization });
2872
+ isInitialized.current = true;
2873
+ }
2874
+ }, [analytics, marketing, personalization, setConsent2]);
2875
+ return null;
2876
+ }
2852
2877
 
2853
2878
  // src/react/useBalanceIdentify.ts
2854
2879
  var import_react23 = require("react");
package/dist/index.mjs CHANGED
@@ -2781,6 +2781,30 @@ function BalanceAnalytics() {
2781
2781
 
2782
2782
  // src/react/ConsentBridge.tsx
2783
2783
  import { useEffect as useEffect8, useRef as useRef15 } from "react";
2784
+ function ConsentBridge({
2785
+ analytics,
2786
+ marketing,
2787
+ personalization
2788
+ }) {
2789
+ const { setConsent: setConsent2 } = useBalanceConsent();
2790
+ const isInitialized = useRef15(false);
2791
+ useEffect8(() => {
2792
+ if (analytics === void 0 && marketing === void 0 && personalization === void 0) {
2793
+ return;
2794
+ }
2795
+ setConsent2({
2796
+ analytics: analytics ?? false,
2797
+ marketing: marketing ?? false,
2798
+ personalization: personalization ?? false,
2799
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
2800
+ });
2801
+ if (!isInitialized.current) {
2802
+ console.log("[ConsentBridge] Initial sync:", { analytics, marketing, personalization });
2803
+ isInitialized.current = true;
2804
+ }
2805
+ }, [analytics, marketing, personalization, setConsent2]);
2806
+ return null;
2807
+ }
2784
2808
 
2785
2809
  // src/react/useBalanceIdentify.ts
2786
2810
  import { useCallback as useCallback16, useEffect as useEffect9, useRef as useRef16 } from "react";
@@ -3188,6 +3212,7 @@ export {
3188
3212
  BalanceAnalytics,
3189
3213
  BalanceContext,
3190
3214
  BalanceProvider,
3215
+ ConsentBridge,
3191
3216
  DEFAULT_GTM_CONSENT,
3192
3217
  GTMProvider,
3193
3218
  StorageManager,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hifilabs/pixel",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "BALANCE Pixel - Lightweight browser tracking script for artist fan analytics",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",