@hifilabs/pixel 0.9.0 → 0.10.0

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/dist/index.mjs CHANGED
@@ -39,6 +39,14 @@ function useResolvedConfig(props) {
39
39
  ...DEFAULT_CONSENT_CONFIG,
40
40
  ...props.consent
41
41
  };
42
+ const metaPixelId = props.metaPixelId ?? getEnvVar("NEXT_PUBLIC_META_PIXEL_ID");
43
+ const tiktokPixelId = props.tiktokPixelId ?? getEnvVar("NEXT_PUBLIC_TIKTOK_PIXEL_ID");
44
+ const googleAdsId = props.googleAdsId ?? getEnvVar("NEXT_PUBLIC_GOOGLE_ADS_ID");
45
+ const googleAdsConversionLabel = props.googleAdsConversionLabel ?? getEnvVar("NEXT_PUBLIC_GOOGLE_ADS_CONVERSION_LABEL");
46
+ const forwardEvents = {
47
+ ...DEFAULT_FORWARDING_CONFIG,
48
+ ...props.forwardEvents
49
+ };
42
50
  return {
43
51
  artistId,
44
52
  gtmId,
@@ -48,7 +56,13 @@ function useResolvedConfig(props) {
48
56
  disabled,
49
57
  useEmulator,
50
58
  projectId,
51
- consent
59
+ consent,
60
+ // Platform pixels (v2)
61
+ metaPixelId,
62
+ tiktokPixelId,
63
+ googleAdsId,
64
+ googleAdsConversionLabel,
65
+ forwardEvents
52
66
  };
53
67
  }, [
54
68
  props.artistId,
@@ -59,10 +73,16 @@ function useResolvedConfig(props) {
59
73
  props.debug,
60
74
  props.disabled,
61
75
  props.useEmulator,
62
- props.consent
76
+ props.consent,
77
+ // Platform pixels (v2)
78
+ props.metaPixelId,
79
+ props.tiktokPixelId,
80
+ props.googleAdsId,
81
+ props.googleAdsConversionLabel,
82
+ props.forwardEvents
63
83
  ]);
64
84
  }
65
- var DEFAULT_SCRIPT_URL, DEFAULT_CONSENT_CONFIG;
85
+ var DEFAULT_SCRIPT_URL, DEFAULT_CONSENT_CONFIG, DEFAULT_FORWARDING_CONFIG;
66
86
  var init_useResolvedConfig = __esm({
67
87
  "src/react/ArtistOS/useResolvedConfig.ts"() {
68
88
  "use client";
@@ -76,6 +96,13 @@ var init_useResolvedConfig = __esm({
76
96
  storageKey: "artistos_consent",
77
97
  expiryDays: 365
78
98
  };
99
+ DEFAULT_FORWARDING_CONFIG = {
100
+ pageview: true,
101
+ purchase: true,
102
+ addToCart: true,
103
+ lead: true,
104
+ custom: []
105
+ };
79
106
  }
80
107
  });
81
108
 
@@ -1007,7 +1034,21 @@ function useArtistOSOptional() {
1007
1034
  return useContext(ArtistOSContext);
1008
1035
  }
1009
1036
  function PixelScriptLoader({ config }) {
1010
- const { artistId, scriptUrl, endpoint, useEmulator, debug, projectId, disabled } = config;
1037
+ const {
1038
+ artistId,
1039
+ scriptUrl,
1040
+ endpoint,
1041
+ useEmulator,
1042
+ debug,
1043
+ projectId,
1044
+ disabled,
1045
+ // Platform pixels (v2)
1046
+ metaPixelId,
1047
+ tiktokPixelId,
1048
+ googleAdsId,
1049
+ googleAdsConversionLabel,
1050
+ forwardEvents
1051
+ } = config;
1011
1052
  if (disabled || !artistId) {
1012
1053
  if (debug && !artistId) {
1013
1054
  console.warn(
@@ -1025,10 +1066,26 @@ function PixelScriptLoader({ config }) {
1025
1066
  "data-endpoint": endpoint,
1026
1067
  "data-emulator": useEmulator ? "true" : void 0,
1027
1068
  "data-debug": debug ? "true" : void 0,
1069
+ "data-meta-pixel-id": metaPixelId,
1070
+ "data-tiktok-pixel-id": tiktokPixelId,
1071
+ "data-google-ads-id": googleAdsId,
1072
+ "data-google-ads-conversion-label": googleAdsConversionLabel,
1073
+ "data-forward-pageview": forwardEvents.pageview ? void 0 : "false",
1074
+ "data-forward-purchase": forwardEvents.purchase ? void 0 : "false",
1075
+ "data-forward-add-to-cart": forwardEvents.addToCart ? void 0 : "false",
1076
+ "data-forward-lead": forwardEvents.lead ? void 0 : "false",
1077
+ "data-forward-custom": forwardEvents.custom.length > 0 ? forwardEvents.custom.join(",") : void 0,
1028
1078
  strategy: "afterInteractive",
1029
1079
  onLoad: () => {
1030
1080
  if (debug) {
1031
1081
  console.log("[ArtistOS] Pixel script loaded for artist:", artistId);
1082
+ if (metaPixelId || tiktokPixelId || googleAdsId) {
1083
+ console.log("[ArtistOS] Platform pixels configured:", {
1084
+ meta: metaPixelId,
1085
+ tiktok: tiktokPixelId,
1086
+ googleAds: googleAdsId
1087
+ });
1088
+ }
1032
1089
  }
1033
1090
  },
1034
1091
  onError: (e) => {
@@ -1237,12 +1294,12 @@ init_useResolvedConfig();
1237
1294
  init_useBuiltInConsent();
1238
1295
  init_useC15tConsent();
1239
1296
 
1240
- // src/react/BalanceContext.ts
1297
+ // src/react/ArtistPixelContext.ts
1241
1298
  import { createContext as createContext2 } from "react";
1242
1299
  var warnNoProvider = (method) => {
1243
1300
  if (true) {
1244
1301
  console.warn(
1245
- `[BalanceContext] Called '${method}()' without <BalanceProvider>. Wrap your app with <BalanceProvider artistId="..."> to enable tracking.`
1302
+ `[ArtistPixelContext] Called '${method}()' without <ArtistPixelProvider>. Wrap your app with <ArtistPixelProvider artistId="..."> to enable tracking.`
1246
1303
  );
1247
1304
  }
1248
1305
  };
@@ -1269,10 +1326,10 @@ var defaultContextValue = {
1269
1326
  endpoint: void 0,
1270
1327
  debug: false
1271
1328
  };
1272
- var BalanceContext = createContext2(defaultContextValue);
1273
- BalanceContext.displayName = "BalanceContext";
1329
+ var ArtistPixelContext = createContext2(defaultContextValue);
1330
+ ArtistPixelContext.displayName = "ArtistPixelContext";
1274
1331
 
1275
- // src/react/BalanceProvider.tsx
1332
+ // src/react/ArtistPixelProvider.tsx
1276
1333
  import React7, { useState as useState4, useEffect as useEffect7, useCallback as useCallback4, useMemo as useMemo6 } from "react";
1277
1334
  import Script3 from "next/script";
1278
1335
 
@@ -1426,18 +1483,19 @@ function GTMProvider({ gtmId, children, debug = false }) {
1426
1483
  )), children);
1427
1484
  }
1428
1485
 
1429
- // src/react/BalanceProvider.tsx
1430
- var DEFAULT_SCRIPT_URL2 = "https://cdn.hifilabs.co/balance-pixel.js";
1486
+ // src/react/ArtistPixelProvider.tsx
1487
+ var DEFAULT_SCRIPT_URL2 = "https://cdn.hifilabs.co/artist-pixel.js";
1431
1488
  function ensureGlobalStub() {
1432
1489
  if (typeof window === "undefined")
1433
1490
  return;
1434
- if (!window.balance) {
1435
- window.balance = function(...args) {
1436
- (window.balance.q = window.balance.q || []).push(args);
1491
+ if (!window.artistPixel) {
1492
+ window.artistPixel = function(...args) {
1493
+ (window.artistPixel.q = window.artistPixel.q || []).push(args);
1437
1494
  };
1495
+ window.balance = window.artistPixel;
1438
1496
  }
1439
1497
  }
1440
- function BalanceProvider({
1498
+ function ArtistPixelProvider({
1441
1499
  artistId,
1442
1500
  projectId,
1443
1501
  debug = false,
@@ -1458,11 +1516,11 @@ function BalanceProvider({
1458
1516
  useEffect7(() => {
1459
1517
  ensureGlobalStub();
1460
1518
  const existingScript = document.querySelector(
1461
- 'script[src*="balance-pixel"], script[data-artist-id]'
1519
+ 'script[src*="artist-pixel"], script[src*="balance-pixel"], script[data-artist-id]'
1462
1520
  );
1463
- if (existingScript || window.balance?.version) {
1521
+ if (existingScript || window.artistPixel?.version) {
1464
1522
  if (debug) {
1465
- console.log("[BalanceProvider] Pixel already loaded externally");
1523
+ console.log("[ArtistPixelProvider] Pixel already loaded externally");
1466
1524
  }
1467
1525
  setIsReady(true);
1468
1526
  return;
@@ -1472,77 +1530,77 @@ function BalanceProvider({
1472
1530
  const track2 = useCallback4((event, properties) => {
1473
1531
  if (typeof window === "undefined")
1474
1532
  return;
1475
- if (window.balance?.track) {
1476
- window.balance.track(event, properties || {});
1533
+ if (window.artistPixel?.track) {
1534
+ window.artistPixel.track(event, properties || {});
1477
1535
  } else {
1478
1536
  ensureGlobalStub();
1479
- window.balance("track", event, properties || {});
1537
+ window.artistPixel("track", event, properties || {});
1480
1538
  }
1481
1539
  }, []);
1482
1540
  const identify2 = useCallback4((email, traits) => {
1483
1541
  if (typeof window === "undefined")
1484
1542
  return;
1485
- if (window.balance?.identify) {
1486
- window.balance.identify(email, traits || {});
1543
+ if (window.artistPixel?.identify) {
1544
+ window.artistPixel.identify(email, traits || {});
1487
1545
  } else {
1488
1546
  ensureGlobalStub();
1489
- window.balance("identify", email, traits || {});
1547
+ window.artistPixel("identify", email, traits || {});
1490
1548
  }
1491
1549
  }, []);
1492
1550
  const page2 = useCallback4((options) => {
1493
1551
  if (typeof window === "undefined")
1494
1552
  return;
1495
- if (window.balance?.page) {
1496
- window.balance.page(options || {});
1553
+ if (window.artistPixel?.page) {
1554
+ window.artistPixel.page(options || {});
1497
1555
  } else {
1498
1556
  ensureGlobalStub();
1499
- window.balance("page", options || {});
1557
+ window.artistPixel("page", options || {});
1500
1558
  }
1501
1559
  }, []);
1502
1560
  const purchase2 = useCallback4((amount, currency, properties) => {
1503
1561
  if (typeof window === "undefined")
1504
1562
  return;
1505
- if (window.balance?.purchase) {
1506
- window.balance.purchase(amount, currency || "USD", properties || {});
1563
+ if (window.artistPixel?.purchase) {
1564
+ window.artistPixel.purchase(amount, currency || "USD", properties || {});
1507
1565
  } else {
1508
1566
  ensureGlobalStub();
1509
- window.balance("purchase", amount, currency || "USD", properties || {});
1567
+ window.artistPixel("purchase", amount, currency || "USD", properties || {});
1510
1568
  }
1511
1569
  }, []);
1512
1570
  const getSessionId2 = useCallback4(() => {
1513
1571
  if (typeof window === "undefined")
1514
1572
  return null;
1515
- return window.balance?.getSessionId?.() ?? null;
1573
+ return window.artistPixel?.getSessionId?.() ?? null;
1516
1574
  }, []);
1517
1575
  const getFanIdHash2 = useCallback4(() => {
1518
1576
  if (typeof window === "undefined")
1519
1577
  return null;
1520
- return window.balance?.getFanIdHash?.() ?? null;
1578
+ return window.artistPixel?.getFanIdHash?.() ?? null;
1521
1579
  }, []);
1522
1580
  const getAttribution2 = useCallback4(() => {
1523
1581
  if (typeof window === "undefined")
1524
1582
  return {};
1525
- return window.balance?.getAttribution?.() ?? {};
1583
+ return window.artistPixel?.getAttribution?.() ?? {};
1526
1584
  }, []);
1527
1585
  const setConsent2 = useCallback4((preferences) => {
1528
1586
  if (typeof window === "undefined")
1529
1587
  return;
1530
- if (window.balance?.setConsent) {
1531
- window.balance.setConsent(preferences);
1588
+ if (window.artistPixel?.setConsent) {
1589
+ window.artistPixel.setConsent(preferences);
1532
1590
  } else {
1533
1591
  ensureGlobalStub();
1534
- window.balance("setConsent", preferences);
1592
+ window.artistPixel("setConsent", preferences);
1535
1593
  }
1536
1594
  }, []);
1537
1595
  const getConsent2 = useCallback4(() => {
1538
1596
  if (typeof window === "undefined")
1539
1597
  return null;
1540
- return window.balance?.getConsent?.() ?? null;
1598
+ return window.artistPixel?.getConsent?.() ?? null;
1541
1599
  }, []);
1542
1600
  const hasConsent2 = useCallback4((type) => {
1543
1601
  if (typeof window === "undefined")
1544
1602
  return false;
1545
- return window.balance?.hasConsent?.(type) ?? false;
1603
+ return window.artistPixel?.hasConsent?.(type) ?? false;
1546
1604
  }, []);
1547
1605
  const contextValue = useMemo6(() => ({
1548
1606
  // Tracking methods (always usable via queue)
@@ -1587,12 +1645,12 @@ function BalanceProvider({
1587
1645
  ]);
1588
1646
  const handleScriptLoad = useCallback4(() => {
1589
1647
  if (debug) {
1590
- console.log("[BalanceProvider] Pixel script loaded");
1648
+ console.log("[ArtistPixelProvider] Pixel script loaded");
1591
1649
  }
1592
1650
  setIsReady(true);
1593
1651
  }, [debug]);
1594
1652
  const handleScriptError = useCallback4((e) => {
1595
- console.error("[BalanceProvider] Failed to load pixel script:", e);
1653
+ console.error("[ArtistPixelProvider] Failed to load pixel script:", e);
1596
1654
  setIsError(true);
1597
1655
  setError(e);
1598
1656
  }, []);
@@ -1600,11 +1658,11 @@ function BalanceProvider({
1600
1658
  useEffect7(() => {
1601
1659
  if (debug && !scriptUrl) {
1602
1660
  console.warn(
1603
- '[BalanceProvider] Using default CDN URL. For production, consider hosting the pixel script locally:\n1. Copy index.js from artist-os-distro/apps/web/public/scripts/\n2. Place it in your public/scripts/index.js\n3. Set scriptUrl="/scripts/index.js"\n\nThis avoids external dependencies and CSP issues.'
1661
+ '[ArtistPixelProvider] Using default CDN URL. For production, consider hosting the pixel script locally:\n1. Copy index.js from artist-os-distro/apps/web/public/scripts/\n2. Place it in your public/scripts/index.js\n3. Set scriptUrl="/scripts/index.js"\n\nThis avoids external dependencies and CSP issues.'
1604
1662
  );
1605
1663
  }
1606
1664
  }, [debug, scriptUrl]);
1607
- const content = /* @__PURE__ */ React7.createElement(BalanceContext.Provider, { value: contextValue }, shouldLoadScript && /* @__PURE__ */ React7.createElement(
1665
+ const content = /* @__PURE__ */ React7.createElement(ArtistPixelContext.Provider, { value: contextValue }, shouldLoadScript && /* @__PURE__ */ React7.createElement(
1608
1666
  Script3,
1609
1667
  {
1610
1668
  src: resolvedScriptUrl,
@@ -1629,29 +1687,29 @@ function BalanceProvider({
1629
1687
  return content;
1630
1688
  }
1631
1689
 
1632
- // src/react/useBalance.ts
1690
+ // src/react/useArtistPixel.ts
1633
1691
  import { useContext as useContext2 } from "react";
1634
- function useBalance() {
1635
- const context = useContext2(BalanceContext);
1692
+ function useArtistPixel() {
1693
+ const context = useContext2(ArtistPixelContext);
1636
1694
  if (!context.artistId) {
1637
1695
  throw new Error(
1638
- '[useBalance] must be used within a BalanceProvider. Wrap your app with <BalanceProvider artistId="..."> or use useBalanceOptional() instead.'
1696
+ '[useArtistPixel] must be used within an ArtistPixelProvider. Wrap your app with <ArtistPixelProvider artistId="..."> or use useArtistPixelOptional() instead.'
1639
1697
  );
1640
1698
  }
1641
1699
  return context;
1642
1700
  }
1643
- function useBalanceOptional() {
1644
- const context = useContext2(BalanceContext);
1701
+ function useArtistPixelOptional() {
1702
+ const context = useContext2(ArtistPixelContext);
1645
1703
  if (!context.artistId) {
1646
1704
  return null;
1647
1705
  }
1648
1706
  return context;
1649
1707
  }
1650
1708
 
1651
- // src/react/useBalanceConsent.ts
1709
+ // src/react/useArtistPixelConsent.ts
1652
1710
  import { useCallback as useCallback5 } from "react";
1653
- function useBalanceConsent() {
1654
- const { setConsent: setConsent2, getConsent: getConsent2, hasConsent: hasConsent2 } = useBalance();
1711
+ function useArtistPixelConsent() {
1712
+ const { setConsent: setConsent2, getConsent: getConsent2, hasConsent: hasConsent2 } = useArtistPixel();
1655
1713
  const acceptAll = useCallback5(() => {
1656
1714
  setConsent2({
1657
1715
  analytics: true,
@@ -1686,10 +1744,10 @@ function useBalanceConsent() {
1686
1744
  };
1687
1745
  }
1688
1746
 
1689
- // src/react/useBalanceReady.ts
1747
+ // src/react/useArtistPixelReady.ts
1690
1748
  import { useContext as useContext3 } from "react";
1691
- function useBalanceReady() {
1692
- const context = useContext3(BalanceContext);
1749
+ function useArtistPixelReady() {
1750
+ const context = useContext3(ArtistPixelContext);
1693
1751
  return context.isReady;
1694
1752
  }
1695
1753
 
@@ -1697,7 +1755,7 @@ function useBalanceReady() {
1697
1755
  import { useEffect as useEffect8, useRef as useRef5 } from "react";
1698
1756
  import { usePathname } from "next/navigation";
1699
1757
  function usePageviewTracking(options) {
1700
- const { page: page2 } = useBalance();
1758
+ const { page: page2 } = useArtistPixel();
1701
1759
  const pathname = usePathname();
1702
1760
  const isFirstRender = useRef5(true);
1703
1761
  const previousPathRef = useRef5(null);
@@ -1722,10 +1780,10 @@ function usePageviewTracking(options) {
1722
1780
  }, [pathname, page2, options?.debug]);
1723
1781
  }
1724
1782
 
1725
- // src/react/useBalanceEcommerce.ts
1783
+ // src/react/useArtistPixelEcommerce.ts
1726
1784
  import { useCallback as useCallback6 } from "react";
1727
- function useBalanceEcommerce() {
1728
- const { track: track2, purchase: purchase2 } = useBalance();
1785
+ function useArtistPixelEcommerce() {
1786
+ const { track: track2, purchase: purchase2 } = useArtistPixel();
1729
1787
  const formatProduct = useCallback6((product, quantity) => ({
1730
1788
  item_id: product.id,
1731
1789
  item_name: product.name,
@@ -1847,10 +1905,10 @@ function useBalanceEcommerce() {
1847
1905
  };
1848
1906
  }
1849
1907
 
1850
- // src/react/useBalanceMedia.ts
1908
+ // src/react/useArtistPixelMedia.ts
1851
1909
  import { useCallback as useCallback7, useRef as useRef6 } from "react";
1852
- function useBalanceMedia() {
1853
- const { track: track2 } = useBalance();
1910
+ function useArtistPixelMedia() {
1911
+ const { track: track2 } = useArtistPixel();
1854
1912
  const playStartRef = useRef6(null);
1855
1913
  const totalListenTimeRef = useRef6(0);
1856
1914
  const milestonesTrackedRef = useRef6(/* @__PURE__ */ new Set());
@@ -1990,10 +2048,10 @@ function useBalanceMedia() {
1990
2048
  };
1991
2049
  }
1992
2050
 
1993
- // src/react/useBalanceEngagement.ts
2051
+ // src/react/useArtistPixelEngagement.ts
1994
2052
  import { useCallback as useCallback8, useRef as useRef7, useEffect as useEffect9 } from "react";
1995
- function useBalanceEngagement(contentId, contentTitle) {
1996
- const { track: track2 } = useBalance();
2053
+ function useArtistPixelEngagement(contentId, contentTitle) {
2054
+ const { track: track2 } = useArtistPixel();
1997
2055
  const scrollMilestonesRef = useRef7(/* @__PURE__ */ new Set());
1998
2056
  const pageLoadTimeRef = useRef7(null);
1999
2057
  const isTrackingTimeRef = useRef7(false);
@@ -2153,10 +2211,10 @@ function useBalanceEngagement(contentId, contentTitle) {
2153
2211
  };
2154
2212
  }
2155
2213
 
2156
- // src/react/useBalanceForm.ts
2214
+ // src/react/useArtistPixelForm.ts
2157
2215
  import { useCallback as useCallback9, useRef as useRef8 } from "react";
2158
- function useBalanceForm(formId, formName) {
2159
- const { track: track2, identify: identify2 } = useBalance();
2216
+ function useArtistPixelForm(formId, formName) {
2217
+ const { track: track2, identify: identify2 } = useArtistPixel();
2160
2218
  const startTimeRef = useRef8(null);
2161
2219
  const fieldsRef = useRef8(/* @__PURE__ */ new Map());
2162
2220
  const wasSubmittedRef = useRef8(false);
@@ -2330,10 +2388,10 @@ function useBalanceForm(formId, formName) {
2330
2388
  };
2331
2389
  }
2332
2390
 
2333
- // src/react/useBalanceSearch.ts
2391
+ // src/react/useArtistPixelSearch.ts
2334
2392
  import { useCallback as useCallback10, useRef as useRef9 } from "react";
2335
- function useBalanceSearch(searchContext) {
2336
- const { track: track2 } = useBalance();
2393
+ function useArtistPixelSearch(searchContext) {
2394
+ const { track: track2 } = useArtistPixel();
2337
2395
  const searchCountRef = useRef9(0);
2338
2396
  const clickCountRef = useRef9(0);
2339
2397
  const filterCountRef = useRef9(0);
@@ -2487,10 +2545,10 @@ function useBalanceSearch(searchContext) {
2487
2545
  };
2488
2546
  }
2489
2547
 
2490
- // src/react/useBalanceNotification.ts
2548
+ // src/react/useArtistPixelNotification.ts
2491
2549
  import { useCallback as useCallback11, useRef as useRef10 } from "react";
2492
- function useBalanceNotification() {
2493
- const { track: track2 } = useBalance();
2550
+ function useArtistPixelNotification() {
2551
+ const { track: track2 } = useArtistPixel();
2494
2552
  const shownCountRef = useRef10(0);
2495
2553
  const clickedCountRef = useRef10(0);
2496
2554
  const dismissedCountRef = useRef10(0);
@@ -2648,10 +2706,10 @@ function useBalanceNotification() {
2648
2706
  };
2649
2707
  }
2650
2708
 
2651
- // src/react/useBalanceSocial.ts
2709
+ // src/react/useArtistPixelSocial.ts
2652
2710
  import { useCallback as useCallback12, useRef as useRef11 } from "react";
2653
- function useBalanceSocial() {
2654
- const { track: track2 } = useBalance();
2711
+ function useArtistPixelSocial() {
2712
+ const { track: track2 } = useArtistPixel();
2655
2713
  const followsRef = useRef11(0);
2656
2714
  const unfollowsRef = useRef11(0);
2657
2715
  const profileViewsRef = useRef11(0);
@@ -2863,10 +2921,10 @@ function useBalanceSocial() {
2863
2921
  };
2864
2922
  }
2865
2923
 
2866
- // src/react/useBalanceAuth.ts
2924
+ // src/react/useArtistPixelAuth.ts
2867
2925
  import { useCallback as useCallback13, useRef as useRef12 } from "react";
2868
- function useBalanceAuth() {
2869
- const { track: track2, identify: identify2 } = useBalance();
2926
+ function useArtistPixelAuth() {
2927
+ const { track: track2, identify: identify2 } = useArtistPixel();
2870
2928
  const loginAttemptsRef = useRef12(0);
2871
2929
  const loginSuccessesRef = useRef12(0);
2872
2930
  const loginFailuresRef = useRef12(0);
@@ -3110,10 +3168,10 @@ function useBalanceAuth() {
3110
3168
  };
3111
3169
  }
3112
3170
 
3113
- // src/react/useBalanceError.ts
3171
+ // src/react/useArtistPixelError.ts
3114
3172
  import { useCallback as useCallback14, useRef as useRef13 } from "react";
3115
- function useBalanceError() {
3116
- const { track: track2 } = useBalance();
3173
+ function useArtistPixelError() {
3174
+ const { track: track2 } = useArtistPixel();
3117
3175
  const errorCountRef = useRef13(0);
3118
3176
  const apiErrorCountRef = useRef13(0);
3119
3177
  const userReportCountRef = useRef13(0);
@@ -3274,10 +3332,10 @@ function useBalanceError() {
3274
3332
  };
3275
3333
  }
3276
3334
 
3277
- // src/react/useBalanceAB.ts
3335
+ // src/react/useArtistPixelAB.ts
3278
3336
  import { useCallback as useCallback15, useRef as useRef14, useEffect as useEffect10 } from "react";
3279
- function useBalanceAB() {
3280
- const { track: track2 } = useBalance();
3337
+ function useArtistPixelAB() {
3338
+ const { track: track2 } = useArtistPixel();
3281
3339
  const exposuresRef = useRef14(0);
3282
3340
  const conversionsRef = useRef14(0);
3283
3341
  const activeExperimentsRef = useRef14(/* @__PURE__ */ new Map());
@@ -3457,10 +3515,10 @@ function useBalanceAB() {
3457
3515
  };
3458
3516
  }
3459
3517
 
3460
- // src/react/useBalanceLive.ts
3518
+ // src/react/useArtistPixelLive.ts
3461
3519
  import { useCallback as useCallback16, useRef as useRef15, useEffect as useEffect11 } from "react";
3462
- function useBalanceLive() {
3463
- const { track: track2 } = useBalance();
3520
+ function useArtistPixelLive() {
3521
+ const { track: track2 } = useArtistPixel();
3464
3522
  const currentStreamRef = useRef15(null);
3465
3523
  const streamStartTimeRef = useRef15(null);
3466
3524
  const totalWatchTimeRef = useRef15(0);
@@ -3709,10 +3767,10 @@ function useBalanceLive() {
3709
3767
  };
3710
3768
  }
3711
3769
 
3712
- // src/react/useBalanceSubscription.ts
3770
+ // src/react/useArtistPixelSubscription.ts
3713
3771
  import { useCallback as useCallback17, useRef as useRef16 } from "react";
3714
- function useBalanceSubscription() {
3715
- const { track: track2, purchase: purchase2 } = useBalance();
3772
+ function useArtistPixelSubscription() {
3773
+ const { track: track2, purchase: purchase2 } = useArtistPixel();
3716
3774
  const subscriptionCountRef = useRef16(0);
3717
3775
  const upgradeCountRef = useRef16(0);
3718
3776
  const downgradeCountRef = useRef16(0);
@@ -3992,15 +4050,15 @@ function useBalanceSubscription() {
3992
4050
  };
3993
4051
  }
3994
4052
 
3995
- // src/react/BalanceAnalytics.tsx
4053
+ // src/react/ArtistPixelAnalytics.tsx
3996
4054
  import React8, { useEffect as useEffect12, useRef as useRef17, Suspense } from "react";
3997
4055
  import { usePathname as usePathname2, useSearchParams } from "next/navigation";
3998
- function BalanceAnalyticsInner() {
4056
+ function ArtistPixelAnalyticsInner() {
3999
4057
  const pathname = usePathname2();
4000
4058
  const searchParams = useSearchParams();
4001
4059
  const isFirstRender = useRef17(true);
4002
4060
  const lastTrackedPath = useRef17(null);
4003
- const balance = useBalanceOptional();
4061
+ const balance = useArtistPixelOptional();
4004
4062
  useEffect12(() => {
4005
4063
  if (typeof window === "undefined")
4006
4064
  return;
@@ -4015,7 +4073,7 @@ function BalanceAnalyticsInner() {
4015
4073
  isFirstRender.current = false;
4016
4074
  if (window._balanceInitialPageviewFired) {
4017
4075
  lastTrackedPath.current = currentPath;
4018
- console.log("[BalanceAnalytics] Skipping initial pageview (script already fired)");
4076
+ console.log("[ArtistPixelAnalytics] Skipping initial pageview (script already fired)");
4019
4077
  return;
4020
4078
  }
4021
4079
  }
@@ -4032,8 +4090,8 @@ function BalanceAnalyticsInner() {
4032
4090
  }, [pathname, searchParams, balance]);
4033
4091
  return null;
4034
4092
  }
4035
- function BalanceAnalytics() {
4036
- return /* @__PURE__ */ React8.createElement(Suspense, { fallback: null }, /* @__PURE__ */ React8.createElement(BalanceAnalyticsInner, null));
4093
+ function ArtistPixelAnalytics() {
4094
+ return /* @__PURE__ */ React8.createElement(Suspense, { fallback: null }, /* @__PURE__ */ React8.createElement(ArtistPixelAnalyticsInner, null));
4037
4095
  }
4038
4096
 
4039
4097
  // src/react/ConsentBridge.tsx
@@ -4043,7 +4101,7 @@ function ConsentBridge({
4043
4101
  marketing,
4044
4102
  personalization
4045
4103
  }) {
4046
- const { setConsent: setConsent2 } = useBalanceConsent();
4104
+ const { setConsent: setConsent2 } = useArtistPixelConsent();
4047
4105
  const isInitialized = useRef18(false);
4048
4106
  useEffect13(() => {
4049
4107
  if (analytics === void 0 && marketing === void 0 && personalization === void 0) {
@@ -4063,7 +4121,7 @@ function ConsentBridge({
4063
4121
  return null;
4064
4122
  }
4065
4123
 
4066
- // src/react/useBalanceIdentify.ts
4124
+ // src/react/useArtistPixelIdentify.ts
4067
4125
  import { useCallback as useCallback18, useEffect as useEffect14, useRef as useRef19 } from "react";
4068
4126
 
4069
4127
  // src/storage/StorageManager.ts
@@ -4352,7 +4410,7 @@ function initStorageWithConsent(hasAnalyticsConsent) {
4352
4410
  return manager;
4353
4411
  }
4354
4412
 
4355
- // src/react/useBalanceIdentify.ts
4413
+ // src/react/useArtistPixelIdentify.ts
4356
4414
  var PENDING_IDENTIFY_KEY = "pending_identify";
4357
4415
  var MAX_PENDING_AGE_MS = 30 * 60 * 1e3;
4358
4416
  function checkAnalyticsConsent() {
@@ -4372,7 +4430,7 @@ function checkAnalyticsConsent() {
4372
4430
  return true;
4373
4431
  }
4374
4432
  }
4375
- function useBalanceIdentify() {
4433
+ function useArtistPixelIdentify() {
4376
4434
  const pollIntervalRef = useRef19(null);
4377
4435
  const hasProcessedPending = useRef19(false);
4378
4436
  const storageManager = typeof window !== "undefined" ? getStorageManager() : null;
@@ -4405,7 +4463,7 @@ function useBalanceIdentify() {
4405
4463
  const identify2 = useCallback18((email, traits) => {
4406
4464
  const hasConsent2 = checkAnalyticsConsent();
4407
4465
  if (!hasConsent2) {
4408
- console.log("[useBalanceIdentify] Skipping identify - user declined analytics consent");
4466
+ console.log("[useArtistPixelIdentify] Skipping identify - user declined analytics consent");
4409
4467
  return false;
4410
4468
  }
4411
4469
  if (storageManager) {
@@ -4413,11 +4471,11 @@ function useBalanceIdentify() {
4413
4471
  }
4414
4472
  if (typeof window !== "undefined" && window.balance?.identify) {
4415
4473
  window.balance.identify(email, traits);
4416
- console.log("[useBalanceIdentify] User identified:", email.split("@")[0] + "***");
4474
+ console.log("[useArtistPixelIdentify] User identified:", email.split("@")[0] + "***");
4417
4475
  clearPendingIdentify();
4418
4476
  return true;
4419
4477
  }
4420
- console.log("[useBalanceIdentify] Pixel not ready, queueing identify");
4478
+ console.log("[useArtistPixelIdentify] Pixel not ready, queueing identify");
4421
4479
  setPendingIdentify(email, traits);
4422
4480
  return false;
4423
4481
  }, [storageManager, clearPendingIdentify, setPendingIdentify]);
@@ -4430,7 +4488,7 @@ function useBalanceIdentify() {
4430
4488
  if (typeof window !== "undefined" && window.balance?.identify) {
4431
4489
  const hasConsent2 = checkAnalyticsConsent();
4432
4490
  if (!hasConsent2) {
4433
- console.log("[useBalanceIdentify] Clearing pending identify - user declined analytics consent");
4491
+ console.log("[useArtistPixelIdentify] Clearing pending identify - user declined analytics consent");
4434
4492
  clearPendingIdentify();
4435
4493
  hasProcessedPending.current = true;
4436
4494
  return;
@@ -4438,7 +4496,7 @@ function useBalanceIdentify() {
4438
4496
  if (storageManager) {
4439
4497
  initStorageWithConsent(hasConsent2);
4440
4498
  }
4441
- console.log("[useBalanceIdentify] Processing pending identify");
4499
+ console.log("[useArtistPixelIdentify] Processing pending identify");
4442
4500
  window.balance.identify(pending.email, pending.traits);
4443
4501
  clearPendingIdentify();
4444
4502
  hasProcessedPending.current = true;
@@ -4482,80 +4540,92 @@ function useBalanceIdentify() {
4482
4540
  var track = (eventName, properties) => {
4483
4541
  if (typeof window === "undefined")
4484
4542
  return;
4485
- if (window.balance) {
4543
+ if (window.artistPixel) {
4544
+ window.artistPixel.track(eventName, properties);
4545
+ } else if (window.balance) {
4486
4546
  window.balance.track(eventName, properties);
4487
4547
  } else {
4488
- console.warn("[Balance Pixel] track() called before pixel initialized:", eventName);
4548
+ console.warn("[artistPixel] track() called before pixel initialized:", eventName);
4489
4549
  }
4490
4550
  };
4491
4551
  var identify = (email, traits) => {
4492
4552
  if (typeof window === "undefined")
4493
4553
  return Promise.resolve();
4494
- if (window.balance) {
4554
+ if (window.artistPixel) {
4555
+ return window.artistPixel.identify(email, traits);
4556
+ } else if (window.balance) {
4495
4557
  return window.balance.identify(email, traits);
4496
4558
  } else {
4497
- console.warn("[Balance Pixel] identify() called before pixel initialized");
4559
+ console.warn("[artistPixel] identify() called before pixel initialized");
4498
4560
  return Promise.resolve();
4499
4561
  }
4500
4562
  };
4501
4563
  var page = (options) => {
4502
4564
  if (typeof window === "undefined")
4503
4565
  return;
4504
- if (window.balance) {
4566
+ if (window.artistPixel) {
4567
+ window.artistPixel.page(options);
4568
+ } else if (window.balance) {
4505
4569
  window.balance.page(options);
4506
4570
  } else {
4507
- console.warn("[Balance Pixel] page() called before pixel initialized");
4571
+ console.warn("[artistPixel] page() called before pixel initialized");
4508
4572
  }
4509
4573
  };
4510
4574
  var purchase = (revenue, currency, properties) => {
4511
4575
  if (typeof window === "undefined")
4512
4576
  return;
4513
- if (window.balance) {
4577
+ if (window.artistPixel) {
4578
+ window.artistPixel.purchase(revenue, currency, properties);
4579
+ } else if (window.balance) {
4514
4580
  window.balance.purchase(revenue, currency, properties);
4515
4581
  } else {
4516
- console.warn("[Balance Pixel] purchase() called before pixel initialized");
4582
+ console.warn("[artistPixel] purchase() called before pixel initialized");
4517
4583
  }
4518
4584
  };
4519
4585
  var getSessionId = () => {
4520
4586
  if (typeof window === "undefined")
4521
4587
  return null;
4522
- return window.balance?.getSessionId() ?? null;
4588
+ return window.artistPixel?.getSessionId() ?? window.balance?.getSessionId() ?? null;
4523
4589
  };
4524
4590
  var getFanIdHash = () => {
4525
4591
  if (typeof window === "undefined")
4526
4592
  return null;
4527
- return window.balance?.getFanIdHash() ?? null;
4593
+ return window.artistPixel?.getFanIdHash() ?? window.balance?.getFanIdHash() ?? null;
4528
4594
  };
4529
4595
  var getAttribution = () => {
4530
4596
  if (typeof window === "undefined")
4531
4597
  return {};
4532
- return window.balance?.getAttribution() ?? {};
4598
+ return window.artistPixel?.getAttribution() ?? window.balance?.getAttribution() ?? {};
4533
4599
  };
4534
4600
  var setConsent = (preferences) => {
4535
4601
  if (typeof window === "undefined")
4536
4602
  return;
4537
- if (window.balance) {
4603
+ if (window.artistPixel) {
4604
+ window.artistPixel.setConsent(preferences);
4605
+ } else if (window.balance) {
4538
4606
  window.balance.setConsent(preferences);
4539
4607
  } else {
4540
- console.warn("[Balance Pixel] setConsent() called before pixel initialized");
4608
+ console.warn("[artistPixel] setConsent() called before pixel initialized");
4541
4609
  }
4542
4610
  };
4543
4611
  var getConsent = () => {
4544
4612
  if (typeof window === "undefined")
4545
4613
  return null;
4546
- return window.balance?.getConsent() ?? null;
4614
+ return window.artistPixel?.getConsent() ?? window.balance?.getConsent() ?? null;
4547
4615
  };
4548
4616
  var hasConsent = (type) => {
4549
4617
  if (typeof window === "undefined")
4550
4618
  return false;
4551
- return window.balance?.hasConsent(type) ?? false;
4619
+ return window.artistPixel?.hasConsent(type) ?? window.balance?.hasConsent(type) ?? false;
4552
4620
  };
4553
4621
  export {
4554
4622
  ArtistOS,
4623
+ ArtistPixelAnalytics,
4624
+ ArtistPixelContext,
4625
+ ArtistPixelProvider,
4555
4626
  BALANCE_TO_C15T_MAP,
4556
- BalanceAnalytics,
4557
- BalanceContext,
4558
- BalanceProvider,
4627
+ ArtistPixelContext as BalanceContext,
4628
+ ArtistPixelProvider as BalanceProvider,
4559
4629
  C15T_TO_BALANCE_MAP,
4560
4630
  ConsentBanner,
4561
4631
  ConsentBridge,
@@ -4579,23 +4649,27 @@ export {
4579
4649
  track,
4580
4650
  useArtistOS,
4581
4651
  useArtistOSOptional,
4582
- useBalance,
4583
- useBalanceAB,
4584
- useBalanceAuth,
4585
- useBalanceConsent,
4586
- useBalanceEcommerce,
4587
- useBalanceEngagement,
4588
- useBalanceError,
4589
- useBalanceForm,
4590
- useBalanceIdentify,
4591
- useBalanceLive,
4592
- useBalanceMedia,
4593
- useBalanceNotification,
4594
- useBalanceOptional,
4595
- useBalanceReady,
4596
- useBalanceSearch,
4597
- useBalanceSocial,
4598
- useBalanceSubscription,
4652
+ useArtistPixel,
4653
+ useArtistPixelAB,
4654
+ useArtistPixelAuth,
4655
+ useArtistPixelConsent,
4656
+ useArtistPixelEcommerce,
4657
+ useArtistPixelEngagement,
4658
+ useArtistPixelError,
4659
+ useArtistPixelForm,
4660
+ useArtistPixelIdentify,
4661
+ useArtistPixelLive,
4662
+ useArtistPixelMedia,
4663
+ useArtistPixelNotification,
4664
+ useArtistPixelOptional,
4665
+ useArtistPixelReady,
4666
+ useArtistPixelSearch,
4667
+ useArtistPixelSocial,
4668
+ useArtistPixelSubscription,
4669
+ useArtistPixel as useBalance,
4670
+ useArtistPixelConsent as useBalanceConsent,
4671
+ useArtistPixelOptional as useBalanceOptional,
4672
+ useArtistPixelReady as useBalanceReady,
4599
4673
  useBuiltInConsent,
4600
4674
  useC15tConsent,
4601
4675
  useGTMConsent,