@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.js CHANGED
@@ -58,6 +58,14 @@ function useResolvedConfig(props) {
58
58
  ...DEFAULT_CONSENT_CONFIG,
59
59
  ...props.consent
60
60
  };
61
+ const metaPixelId = props.metaPixelId ?? getEnvVar("NEXT_PUBLIC_META_PIXEL_ID");
62
+ const tiktokPixelId = props.tiktokPixelId ?? getEnvVar("NEXT_PUBLIC_TIKTOK_PIXEL_ID");
63
+ const googleAdsId = props.googleAdsId ?? getEnvVar("NEXT_PUBLIC_GOOGLE_ADS_ID");
64
+ const googleAdsConversionLabel = props.googleAdsConversionLabel ?? getEnvVar("NEXT_PUBLIC_GOOGLE_ADS_CONVERSION_LABEL");
65
+ const forwardEvents = {
66
+ ...DEFAULT_FORWARDING_CONFIG,
67
+ ...props.forwardEvents
68
+ };
61
69
  return {
62
70
  artistId,
63
71
  gtmId,
@@ -67,7 +75,13 @@ function useResolvedConfig(props) {
67
75
  disabled,
68
76
  useEmulator,
69
77
  projectId,
70
- consent
78
+ consent,
79
+ // Platform pixels (v2)
80
+ metaPixelId,
81
+ tiktokPixelId,
82
+ googleAdsId,
83
+ googleAdsConversionLabel,
84
+ forwardEvents
71
85
  };
72
86
  }, [
73
87
  props.artistId,
@@ -78,10 +92,16 @@ function useResolvedConfig(props) {
78
92
  props.debug,
79
93
  props.disabled,
80
94
  props.useEmulator,
81
- props.consent
95
+ props.consent,
96
+ // Platform pixels (v2)
97
+ props.metaPixelId,
98
+ props.tiktokPixelId,
99
+ props.googleAdsId,
100
+ props.googleAdsConversionLabel,
101
+ props.forwardEvents
82
102
  ]);
83
103
  }
84
- var import_react, DEFAULT_SCRIPT_URL, DEFAULT_CONSENT_CONFIG;
104
+ var import_react, DEFAULT_SCRIPT_URL, DEFAULT_CONSENT_CONFIG, DEFAULT_FORWARDING_CONFIG;
85
105
  var init_useResolvedConfig = __esm({
86
106
  "src/react/ArtistOS/useResolvedConfig.ts"() {
87
107
  "use client";
@@ -96,6 +116,13 @@ var init_useResolvedConfig = __esm({
96
116
  storageKey: "artistos_consent",
97
117
  expiryDays: 365
98
118
  };
119
+ DEFAULT_FORWARDING_CONFIG = {
120
+ pageview: true,
121
+ purchase: true,
122
+ addToCart: true,
123
+ lead: true,
124
+ custom: []
125
+ };
99
126
  }
100
127
  });
101
128
 
@@ -1026,7 +1053,21 @@ function useArtistOSOptional() {
1026
1053
  return (0, import_react7.useContext)(ArtistOSContext);
1027
1054
  }
1028
1055
  function PixelScriptLoader({ config }) {
1029
- const { artistId, scriptUrl, endpoint, useEmulator, debug, projectId, disabled } = config;
1056
+ const {
1057
+ artistId,
1058
+ scriptUrl,
1059
+ endpoint,
1060
+ useEmulator,
1061
+ debug,
1062
+ projectId,
1063
+ disabled,
1064
+ // Platform pixels (v2)
1065
+ metaPixelId,
1066
+ tiktokPixelId,
1067
+ googleAdsId,
1068
+ googleAdsConversionLabel,
1069
+ forwardEvents
1070
+ } = config;
1030
1071
  if (disabled || !artistId) {
1031
1072
  if (debug && !artistId) {
1032
1073
  console.warn(
@@ -1044,10 +1085,26 @@ function PixelScriptLoader({ config }) {
1044
1085
  "data-endpoint": endpoint,
1045
1086
  "data-emulator": useEmulator ? "true" : void 0,
1046
1087
  "data-debug": debug ? "true" : void 0,
1088
+ "data-meta-pixel-id": metaPixelId,
1089
+ "data-tiktok-pixel-id": tiktokPixelId,
1090
+ "data-google-ads-id": googleAdsId,
1091
+ "data-google-ads-conversion-label": googleAdsConversionLabel,
1092
+ "data-forward-pageview": forwardEvents.pageview ? void 0 : "false",
1093
+ "data-forward-purchase": forwardEvents.purchase ? void 0 : "false",
1094
+ "data-forward-add-to-cart": forwardEvents.addToCart ? void 0 : "false",
1095
+ "data-forward-lead": forwardEvents.lead ? void 0 : "false",
1096
+ "data-forward-custom": forwardEvents.custom.length > 0 ? forwardEvents.custom.join(",") : void 0,
1047
1097
  strategy: "afterInteractive",
1048
1098
  onLoad: () => {
1049
1099
  if (debug) {
1050
1100
  console.log("[ArtistOS] Pixel script loaded for artist:", artistId);
1101
+ if (metaPixelId || tiktokPixelId || googleAdsId) {
1102
+ console.log("[ArtistOS] Platform pixels configured:", {
1103
+ meta: metaPixelId,
1104
+ tiktok: tiktokPixelId,
1105
+ googleAds: googleAdsId
1106
+ });
1107
+ }
1051
1108
  }
1052
1109
  },
1053
1110
  onError: (e) => {
@@ -1253,10 +1310,12 @@ var init_ArtistOS = __esm({
1253
1310
  var src_exports = {};
1254
1311
  __export(src_exports, {
1255
1312
  ArtistOS: () => ArtistOS,
1313
+ ArtistPixelAnalytics: () => ArtistPixelAnalytics,
1314
+ ArtistPixelContext: () => ArtistPixelContext,
1315
+ ArtistPixelProvider: () => ArtistPixelProvider,
1256
1316
  BALANCE_TO_C15T_MAP: () => BALANCE_TO_C15T_MAP,
1257
- BalanceAnalytics: () => BalanceAnalytics,
1258
- BalanceContext: () => BalanceContext,
1259
- BalanceProvider: () => BalanceProvider,
1317
+ BalanceContext: () => ArtistPixelContext,
1318
+ BalanceProvider: () => ArtistPixelProvider,
1260
1319
  C15T_TO_BALANCE_MAP: () => C15T_TO_BALANCE_MAP,
1261
1320
  ConsentBanner: () => ConsentBanner,
1262
1321
  ConsentBridge: () => ConsentBridge,
@@ -1280,23 +1339,27 @@ __export(src_exports, {
1280
1339
  track: () => track,
1281
1340
  useArtistOS: () => useArtistOS,
1282
1341
  useArtistOSOptional: () => useArtistOSOptional,
1283
- useBalance: () => useBalance,
1284
- useBalanceAB: () => useBalanceAB,
1285
- useBalanceAuth: () => useBalanceAuth,
1286
- useBalanceConsent: () => useBalanceConsent,
1287
- useBalanceEcommerce: () => useBalanceEcommerce,
1288
- useBalanceEngagement: () => useBalanceEngagement,
1289
- useBalanceError: () => useBalanceError,
1290
- useBalanceForm: () => useBalanceForm,
1291
- useBalanceIdentify: () => useBalanceIdentify,
1292
- useBalanceLive: () => useBalanceLive,
1293
- useBalanceMedia: () => useBalanceMedia,
1294
- useBalanceNotification: () => useBalanceNotification,
1295
- useBalanceOptional: () => useBalanceOptional,
1296
- useBalanceReady: () => useBalanceReady,
1297
- useBalanceSearch: () => useBalanceSearch,
1298
- useBalanceSocial: () => useBalanceSocial,
1299
- useBalanceSubscription: () => useBalanceSubscription,
1342
+ useArtistPixel: () => useArtistPixel,
1343
+ useArtistPixelAB: () => useArtistPixelAB,
1344
+ useArtistPixelAuth: () => useArtistPixelAuth,
1345
+ useArtistPixelConsent: () => useArtistPixelConsent,
1346
+ useArtistPixelEcommerce: () => useArtistPixelEcommerce,
1347
+ useArtistPixelEngagement: () => useArtistPixelEngagement,
1348
+ useArtistPixelError: () => useArtistPixelError,
1349
+ useArtistPixelForm: () => useArtistPixelForm,
1350
+ useArtistPixelIdentify: () => useArtistPixelIdentify,
1351
+ useArtistPixelLive: () => useArtistPixelLive,
1352
+ useArtistPixelMedia: () => useArtistPixelMedia,
1353
+ useArtistPixelNotification: () => useArtistPixelNotification,
1354
+ useArtistPixelOptional: () => useArtistPixelOptional,
1355
+ useArtistPixelReady: () => useArtistPixelReady,
1356
+ useArtistPixelSearch: () => useArtistPixelSearch,
1357
+ useArtistPixelSocial: () => useArtistPixelSocial,
1358
+ useArtistPixelSubscription: () => useArtistPixelSubscription,
1359
+ useBalance: () => useArtistPixel,
1360
+ useBalanceConsent: () => useArtistPixelConsent,
1361
+ useBalanceOptional: () => useArtistPixelOptional,
1362
+ useBalanceReady: () => useArtistPixelReady,
1300
1363
  useBuiltInConsent: () => useBuiltInConsent,
1301
1364
  useC15tConsent: () => useC15tConsent,
1302
1365
  useGTMConsent: () => useGTMConsent,
@@ -1313,12 +1376,12 @@ init_useResolvedConfig();
1313
1376
  init_useBuiltInConsent();
1314
1377
  init_useC15tConsent();
1315
1378
 
1316
- // src/react/BalanceContext.ts
1379
+ // src/react/ArtistPixelContext.ts
1317
1380
  var import_react8 = require("react");
1318
1381
  var warnNoProvider = (method) => {
1319
1382
  if (true) {
1320
1383
  console.warn(
1321
- `[BalanceContext] Called '${method}()' without <BalanceProvider>. Wrap your app with <BalanceProvider artistId="..."> to enable tracking.`
1384
+ `[ArtistPixelContext] Called '${method}()' without <ArtistPixelProvider>. Wrap your app with <ArtistPixelProvider artistId="..."> to enable tracking.`
1322
1385
  );
1323
1386
  }
1324
1387
  };
@@ -1345,10 +1408,10 @@ var defaultContextValue = {
1345
1408
  endpoint: void 0,
1346
1409
  debug: false
1347
1410
  };
1348
- var BalanceContext = (0, import_react8.createContext)(defaultContextValue);
1349
- BalanceContext.displayName = "BalanceContext";
1411
+ var ArtistPixelContext = (0, import_react8.createContext)(defaultContextValue);
1412
+ ArtistPixelContext.displayName = "ArtistPixelContext";
1350
1413
 
1351
- // src/react/BalanceProvider.tsx
1414
+ // src/react/ArtistPixelProvider.tsx
1352
1415
  var import_react11 = __toESM(require("react"));
1353
1416
  var import_script3 = __toESM(require("next/script"));
1354
1417
 
@@ -1502,18 +1565,19 @@ function GTMProvider({ gtmId, children, debug = false }) {
1502
1565
  )), children);
1503
1566
  }
1504
1567
 
1505
- // src/react/BalanceProvider.tsx
1506
- var DEFAULT_SCRIPT_URL2 = "https://cdn.hifilabs.co/balance-pixel.js";
1568
+ // src/react/ArtistPixelProvider.tsx
1569
+ var DEFAULT_SCRIPT_URL2 = "https://cdn.hifilabs.co/artist-pixel.js";
1507
1570
  function ensureGlobalStub() {
1508
1571
  if (typeof window === "undefined")
1509
1572
  return;
1510
- if (!window.balance) {
1511
- window.balance = function(...args) {
1512
- (window.balance.q = window.balance.q || []).push(args);
1573
+ if (!window.artistPixel) {
1574
+ window.artistPixel = function(...args) {
1575
+ (window.artistPixel.q = window.artistPixel.q || []).push(args);
1513
1576
  };
1577
+ window.balance = window.artistPixel;
1514
1578
  }
1515
1579
  }
1516
- function BalanceProvider({
1580
+ function ArtistPixelProvider({
1517
1581
  artistId,
1518
1582
  projectId,
1519
1583
  debug = false,
@@ -1534,11 +1598,11 @@ function BalanceProvider({
1534
1598
  (0, import_react11.useEffect)(() => {
1535
1599
  ensureGlobalStub();
1536
1600
  const existingScript = document.querySelector(
1537
- 'script[src*="balance-pixel"], script[data-artist-id]'
1601
+ 'script[src*="artist-pixel"], script[src*="balance-pixel"], script[data-artist-id]'
1538
1602
  );
1539
- if (existingScript || window.balance?.version) {
1603
+ if (existingScript || window.artistPixel?.version) {
1540
1604
  if (debug) {
1541
- console.log("[BalanceProvider] Pixel already loaded externally");
1605
+ console.log("[ArtistPixelProvider] Pixel already loaded externally");
1542
1606
  }
1543
1607
  setIsReady(true);
1544
1608
  return;
@@ -1548,77 +1612,77 @@ function BalanceProvider({
1548
1612
  const track2 = (0, import_react11.useCallback)((event, properties) => {
1549
1613
  if (typeof window === "undefined")
1550
1614
  return;
1551
- if (window.balance?.track) {
1552
- window.balance.track(event, properties || {});
1615
+ if (window.artistPixel?.track) {
1616
+ window.artistPixel.track(event, properties || {});
1553
1617
  } else {
1554
1618
  ensureGlobalStub();
1555
- window.balance("track", event, properties || {});
1619
+ window.artistPixel("track", event, properties || {});
1556
1620
  }
1557
1621
  }, []);
1558
1622
  const identify2 = (0, import_react11.useCallback)((email, traits) => {
1559
1623
  if (typeof window === "undefined")
1560
1624
  return;
1561
- if (window.balance?.identify) {
1562
- window.balance.identify(email, traits || {});
1625
+ if (window.artistPixel?.identify) {
1626
+ window.artistPixel.identify(email, traits || {});
1563
1627
  } else {
1564
1628
  ensureGlobalStub();
1565
- window.balance("identify", email, traits || {});
1629
+ window.artistPixel("identify", email, traits || {});
1566
1630
  }
1567
1631
  }, []);
1568
1632
  const page2 = (0, import_react11.useCallback)((options) => {
1569
1633
  if (typeof window === "undefined")
1570
1634
  return;
1571
- if (window.balance?.page) {
1572
- window.balance.page(options || {});
1635
+ if (window.artistPixel?.page) {
1636
+ window.artistPixel.page(options || {});
1573
1637
  } else {
1574
1638
  ensureGlobalStub();
1575
- window.balance("page", options || {});
1639
+ window.artistPixel("page", options || {});
1576
1640
  }
1577
1641
  }, []);
1578
1642
  const purchase2 = (0, import_react11.useCallback)((amount, currency, properties) => {
1579
1643
  if (typeof window === "undefined")
1580
1644
  return;
1581
- if (window.balance?.purchase) {
1582
- window.balance.purchase(amount, currency || "USD", properties || {});
1645
+ if (window.artistPixel?.purchase) {
1646
+ window.artistPixel.purchase(amount, currency || "USD", properties || {});
1583
1647
  } else {
1584
1648
  ensureGlobalStub();
1585
- window.balance("purchase", amount, currency || "USD", properties || {});
1649
+ window.artistPixel("purchase", amount, currency || "USD", properties || {});
1586
1650
  }
1587
1651
  }, []);
1588
1652
  const getSessionId2 = (0, import_react11.useCallback)(() => {
1589
1653
  if (typeof window === "undefined")
1590
1654
  return null;
1591
- return window.balance?.getSessionId?.() ?? null;
1655
+ return window.artistPixel?.getSessionId?.() ?? null;
1592
1656
  }, []);
1593
1657
  const getFanIdHash2 = (0, import_react11.useCallback)(() => {
1594
1658
  if (typeof window === "undefined")
1595
1659
  return null;
1596
- return window.balance?.getFanIdHash?.() ?? null;
1660
+ return window.artistPixel?.getFanIdHash?.() ?? null;
1597
1661
  }, []);
1598
1662
  const getAttribution2 = (0, import_react11.useCallback)(() => {
1599
1663
  if (typeof window === "undefined")
1600
1664
  return {};
1601
- return window.balance?.getAttribution?.() ?? {};
1665
+ return window.artistPixel?.getAttribution?.() ?? {};
1602
1666
  }, []);
1603
1667
  const setConsent2 = (0, import_react11.useCallback)((preferences) => {
1604
1668
  if (typeof window === "undefined")
1605
1669
  return;
1606
- if (window.balance?.setConsent) {
1607
- window.balance.setConsent(preferences);
1670
+ if (window.artistPixel?.setConsent) {
1671
+ window.artistPixel.setConsent(preferences);
1608
1672
  } else {
1609
1673
  ensureGlobalStub();
1610
- window.balance("setConsent", preferences);
1674
+ window.artistPixel("setConsent", preferences);
1611
1675
  }
1612
1676
  }, []);
1613
1677
  const getConsent2 = (0, import_react11.useCallback)(() => {
1614
1678
  if (typeof window === "undefined")
1615
1679
  return null;
1616
- return window.balance?.getConsent?.() ?? null;
1680
+ return window.artistPixel?.getConsent?.() ?? null;
1617
1681
  }, []);
1618
1682
  const hasConsent2 = (0, import_react11.useCallback)((type) => {
1619
1683
  if (typeof window === "undefined")
1620
1684
  return false;
1621
- return window.balance?.hasConsent?.(type) ?? false;
1685
+ return window.artistPixel?.hasConsent?.(type) ?? false;
1622
1686
  }, []);
1623
1687
  const contextValue = (0, import_react11.useMemo)(() => ({
1624
1688
  // Tracking methods (always usable via queue)
@@ -1663,12 +1727,12 @@ function BalanceProvider({
1663
1727
  ]);
1664
1728
  const handleScriptLoad = (0, import_react11.useCallback)(() => {
1665
1729
  if (debug) {
1666
- console.log("[BalanceProvider] Pixel script loaded");
1730
+ console.log("[ArtistPixelProvider] Pixel script loaded");
1667
1731
  }
1668
1732
  setIsReady(true);
1669
1733
  }, [debug]);
1670
1734
  const handleScriptError = (0, import_react11.useCallback)((e) => {
1671
- console.error("[BalanceProvider] Failed to load pixel script:", e);
1735
+ console.error("[ArtistPixelProvider] Failed to load pixel script:", e);
1672
1736
  setIsError(true);
1673
1737
  setError(e);
1674
1738
  }, []);
@@ -1676,11 +1740,11 @@ function BalanceProvider({
1676
1740
  (0, import_react11.useEffect)(() => {
1677
1741
  if (debug && !scriptUrl) {
1678
1742
  console.warn(
1679
- '[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.'
1743
+ '[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.'
1680
1744
  );
1681
1745
  }
1682
1746
  }, [debug, scriptUrl]);
1683
- const content = /* @__PURE__ */ import_react11.default.createElement(BalanceContext.Provider, { value: contextValue }, shouldLoadScript && /* @__PURE__ */ import_react11.default.createElement(
1747
+ const content = /* @__PURE__ */ import_react11.default.createElement(ArtistPixelContext.Provider, { value: contextValue }, shouldLoadScript && /* @__PURE__ */ import_react11.default.createElement(
1684
1748
  import_script3.default,
1685
1749
  {
1686
1750
  src: resolvedScriptUrl,
@@ -1705,29 +1769,29 @@ function BalanceProvider({
1705
1769
  return content;
1706
1770
  }
1707
1771
 
1708
- // src/react/useBalance.ts
1772
+ // src/react/useArtistPixel.ts
1709
1773
  var import_react12 = require("react");
1710
- function useBalance() {
1711
- const context = (0, import_react12.useContext)(BalanceContext);
1774
+ function useArtistPixel() {
1775
+ const context = (0, import_react12.useContext)(ArtistPixelContext);
1712
1776
  if (!context.artistId) {
1713
1777
  throw new Error(
1714
- '[useBalance] must be used within a BalanceProvider. Wrap your app with <BalanceProvider artistId="..."> or use useBalanceOptional() instead.'
1778
+ '[useArtistPixel] must be used within an ArtistPixelProvider. Wrap your app with <ArtistPixelProvider artistId="..."> or use useArtistPixelOptional() instead.'
1715
1779
  );
1716
1780
  }
1717
1781
  return context;
1718
1782
  }
1719
- function useBalanceOptional() {
1720
- const context = (0, import_react12.useContext)(BalanceContext);
1783
+ function useArtistPixelOptional() {
1784
+ const context = (0, import_react12.useContext)(ArtistPixelContext);
1721
1785
  if (!context.artistId) {
1722
1786
  return null;
1723
1787
  }
1724
1788
  return context;
1725
1789
  }
1726
1790
 
1727
- // src/react/useBalanceConsent.ts
1791
+ // src/react/useArtistPixelConsent.ts
1728
1792
  var import_react13 = require("react");
1729
- function useBalanceConsent() {
1730
- const { setConsent: setConsent2, getConsent: getConsent2, hasConsent: hasConsent2 } = useBalance();
1793
+ function useArtistPixelConsent() {
1794
+ const { setConsent: setConsent2, getConsent: getConsent2, hasConsent: hasConsent2 } = useArtistPixel();
1731
1795
  const acceptAll = (0, import_react13.useCallback)(() => {
1732
1796
  setConsent2({
1733
1797
  analytics: true,
@@ -1762,10 +1826,10 @@ function useBalanceConsent() {
1762
1826
  };
1763
1827
  }
1764
1828
 
1765
- // src/react/useBalanceReady.ts
1829
+ // src/react/useArtistPixelReady.ts
1766
1830
  var import_react14 = require("react");
1767
- function useBalanceReady() {
1768
- const context = (0, import_react14.useContext)(BalanceContext);
1831
+ function useArtistPixelReady() {
1832
+ const context = (0, import_react14.useContext)(ArtistPixelContext);
1769
1833
  return context.isReady;
1770
1834
  }
1771
1835
 
@@ -1773,7 +1837,7 @@ function useBalanceReady() {
1773
1837
  var import_react15 = require("react");
1774
1838
  var import_navigation = require("next/navigation");
1775
1839
  function usePageviewTracking(options) {
1776
- const { page: page2 } = useBalance();
1840
+ const { page: page2 } = useArtistPixel();
1777
1841
  const pathname = (0, import_navigation.usePathname)();
1778
1842
  const isFirstRender = (0, import_react15.useRef)(true);
1779
1843
  const previousPathRef = (0, import_react15.useRef)(null);
@@ -1798,10 +1862,10 @@ function usePageviewTracking(options) {
1798
1862
  }, [pathname, page2, options?.debug]);
1799
1863
  }
1800
1864
 
1801
- // src/react/useBalanceEcommerce.ts
1865
+ // src/react/useArtistPixelEcommerce.ts
1802
1866
  var import_react16 = require("react");
1803
- function useBalanceEcommerce() {
1804
- const { track: track2, purchase: purchase2 } = useBalance();
1867
+ function useArtistPixelEcommerce() {
1868
+ const { track: track2, purchase: purchase2 } = useArtistPixel();
1805
1869
  const formatProduct = (0, import_react16.useCallback)((product, quantity) => ({
1806
1870
  item_id: product.id,
1807
1871
  item_name: product.name,
@@ -1923,10 +1987,10 @@ function useBalanceEcommerce() {
1923
1987
  };
1924
1988
  }
1925
1989
 
1926
- // src/react/useBalanceMedia.ts
1990
+ // src/react/useArtistPixelMedia.ts
1927
1991
  var import_react17 = require("react");
1928
- function useBalanceMedia() {
1929
- const { track: track2 } = useBalance();
1992
+ function useArtistPixelMedia() {
1993
+ const { track: track2 } = useArtistPixel();
1930
1994
  const playStartRef = (0, import_react17.useRef)(null);
1931
1995
  const totalListenTimeRef = (0, import_react17.useRef)(0);
1932
1996
  const milestonesTrackedRef = (0, import_react17.useRef)(/* @__PURE__ */ new Set());
@@ -2066,10 +2130,10 @@ function useBalanceMedia() {
2066
2130
  };
2067
2131
  }
2068
2132
 
2069
- // src/react/useBalanceEngagement.ts
2133
+ // src/react/useArtistPixelEngagement.ts
2070
2134
  var import_react18 = require("react");
2071
- function useBalanceEngagement(contentId, contentTitle) {
2072
- const { track: track2 } = useBalance();
2135
+ function useArtistPixelEngagement(contentId, contentTitle) {
2136
+ const { track: track2 } = useArtistPixel();
2073
2137
  const scrollMilestonesRef = (0, import_react18.useRef)(/* @__PURE__ */ new Set());
2074
2138
  const pageLoadTimeRef = (0, import_react18.useRef)(null);
2075
2139
  const isTrackingTimeRef = (0, import_react18.useRef)(false);
@@ -2229,10 +2293,10 @@ function useBalanceEngagement(contentId, contentTitle) {
2229
2293
  };
2230
2294
  }
2231
2295
 
2232
- // src/react/useBalanceForm.ts
2296
+ // src/react/useArtistPixelForm.ts
2233
2297
  var import_react19 = require("react");
2234
- function useBalanceForm(formId, formName) {
2235
- const { track: track2, identify: identify2 } = useBalance();
2298
+ function useArtistPixelForm(formId, formName) {
2299
+ const { track: track2, identify: identify2 } = useArtistPixel();
2236
2300
  const startTimeRef = (0, import_react19.useRef)(null);
2237
2301
  const fieldsRef = (0, import_react19.useRef)(/* @__PURE__ */ new Map());
2238
2302
  const wasSubmittedRef = (0, import_react19.useRef)(false);
@@ -2406,10 +2470,10 @@ function useBalanceForm(formId, formName) {
2406
2470
  };
2407
2471
  }
2408
2472
 
2409
- // src/react/useBalanceSearch.ts
2473
+ // src/react/useArtistPixelSearch.ts
2410
2474
  var import_react20 = require("react");
2411
- function useBalanceSearch(searchContext) {
2412
- const { track: track2 } = useBalance();
2475
+ function useArtistPixelSearch(searchContext) {
2476
+ const { track: track2 } = useArtistPixel();
2413
2477
  const searchCountRef = (0, import_react20.useRef)(0);
2414
2478
  const clickCountRef = (0, import_react20.useRef)(0);
2415
2479
  const filterCountRef = (0, import_react20.useRef)(0);
@@ -2563,10 +2627,10 @@ function useBalanceSearch(searchContext) {
2563
2627
  };
2564
2628
  }
2565
2629
 
2566
- // src/react/useBalanceNotification.ts
2630
+ // src/react/useArtistPixelNotification.ts
2567
2631
  var import_react21 = require("react");
2568
- function useBalanceNotification() {
2569
- const { track: track2 } = useBalance();
2632
+ function useArtistPixelNotification() {
2633
+ const { track: track2 } = useArtistPixel();
2570
2634
  const shownCountRef = (0, import_react21.useRef)(0);
2571
2635
  const clickedCountRef = (0, import_react21.useRef)(0);
2572
2636
  const dismissedCountRef = (0, import_react21.useRef)(0);
@@ -2724,10 +2788,10 @@ function useBalanceNotification() {
2724
2788
  };
2725
2789
  }
2726
2790
 
2727
- // src/react/useBalanceSocial.ts
2791
+ // src/react/useArtistPixelSocial.ts
2728
2792
  var import_react22 = require("react");
2729
- function useBalanceSocial() {
2730
- const { track: track2 } = useBalance();
2793
+ function useArtistPixelSocial() {
2794
+ const { track: track2 } = useArtistPixel();
2731
2795
  const followsRef = (0, import_react22.useRef)(0);
2732
2796
  const unfollowsRef = (0, import_react22.useRef)(0);
2733
2797
  const profileViewsRef = (0, import_react22.useRef)(0);
@@ -2939,10 +3003,10 @@ function useBalanceSocial() {
2939
3003
  };
2940
3004
  }
2941
3005
 
2942
- // src/react/useBalanceAuth.ts
3006
+ // src/react/useArtistPixelAuth.ts
2943
3007
  var import_react23 = require("react");
2944
- function useBalanceAuth() {
2945
- const { track: track2, identify: identify2 } = useBalance();
3008
+ function useArtistPixelAuth() {
3009
+ const { track: track2, identify: identify2 } = useArtistPixel();
2946
3010
  const loginAttemptsRef = (0, import_react23.useRef)(0);
2947
3011
  const loginSuccessesRef = (0, import_react23.useRef)(0);
2948
3012
  const loginFailuresRef = (0, import_react23.useRef)(0);
@@ -3186,10 +3250,10 @@ function useBalanceAuth() {
3186
3250
  };
3187
3251
  }
3188
3252
 
3189
- // src/react/useBalanceError.ts
3253
+ // src/react/useArtistPixelError.ts
3190
3254
  var import_react24 = require("react");
3191
- function useBalanceError() {
3192
- const { track: track2 } = useBalance();
3255
+ function useArtistPixelError() {
3256
+ const { track: track2 } = useArtistPixel();
3193
3257
  const errorCountRef = (0, import_react24.useRef)(0);
3194
3258
  const apiErrorCountRef = (0, import_react24.useRef)(0);
3195
3259
  const userReportCountRef = (0, import_react24.useRef)(0);
@@ -3350,10 +3414,10 @@ function useBalanceError() {
3350
3414
  };
3351
3415
  }
3352
3416
 
3353
- // src/react/useBalanceAB.ts
3417
+ // src/react/useArtistPixelAB.ts
3354
3418
  var import_react25 = require("react");
3355
- function useBalanceAB() {
3356
- const { track: track2 } = useBalance();
3419
+ function useArtistPixelAB() {
3420
+ const { track: track2 } = useArtistPixel();
3357
3421
  const exposuresRef = (0, import_react25.useRef)(0);
3358
3422
  const conversionsRef = (0, import_react25.useRef)(0);
3359
3423
  const activeExperimentsRef = (0, import_react25.useRef)(/* @__PURE__ */ new Map());
@@ -3533,10 +3597,10 @@ function useBalanceAB() {
3533
3597
  };
3534
3598
  }
3535
3599
 
3536
- // src/react/useBalanceLive.ts
3600
+ // src/react/useArtistPixelLive.ts
3537
3601
  var import_react26 = require("react");
3538
- function useBalanceLive() {
3539
- const { track: track2 } = useBalance();
3602
+ function useArtistPixelLive() {
3603
+ const { track: track2 } = useArtistPixel();
3540
3604
  const currentStreamRef = (0, import_react26.useRef)(null);
3541
3605
  const streamStartTimeRef = (0, import_react26.useRef)(null);
3542
3606
  const totalWatchTimeRef = (0, import_react26.useRef)(0);
@@ -3785,10 +3849,10 @@ function useBalanceLive() {
3785
3849
  };
3786
3850
  }
3787
3851
 
3788
- // src/react/useBalanceSubscription.ts
3852
+ // src/react/useArtistPixelSubscription.ts
3789
3853
  var import_react27 = require("react");
3790
- function useBalanceSubscription() {
3791
- const { track: track2, purchase: purchase2 } = useBalance();
3854
+ function useArtistPixelSubscription() {
3855
+ const { track: track2, purchase: purchase2 } = useArtistPixel();
3792
3856
  const subscriptionCountRef = (0, import_react27.useRef)(0);
3793
3857
  const upgradeCountRef = (0, import_react27.useRef)(0);
3794
3858
  const downgradeCountRef = (0, import_react27.useRef)(0);
@@ -4068,15 +4132,15 @@ function useBalanceSubscription() {
4068
4132
  };
4069
4133
  }
4070
4134
 
4071
- // src/react/BalanceAnalytics.tsx
4135
+ // src/react/ArtistPixelAnalytics.tsx
4072
4136
  var import_react28 = __toESM(require("react"));
4073
4137
  var import_navigation2 = require("next/navigation");
4074
- function BalanceAnalyticsInner() {
4138
+ function ArtistPixelAnalyticsInner() {
4075
4139
  const pathname = (0, import_navigation2.usePathname)();
4076
4140
  const searchParams = (0, import_navigation2.useSearchParams)();
4077
4141
  const isFirstRender = (0, import_react28.useRef)(true);
4078
4142
  const lastTrackedPath = (0, import_react28.useRef)(null);
4079
- const balance = useBalanceOptional();
4143
+ const balance = useArtistPixelOptional();
4080
4144
  (0, import_react28.useEffect)(() => {
4081
4145
  if (typeof window === "undefined")
4082
4146
  return;
@@ -4091,7 +4155,7 @@ function BalanceAnalyticsInner() {
4091
4155
  isFirstRender.current = false;
4092
4156
  if (window._balanceInitialPageviewFired) {
4093
4157
  lastTrackedPath.current = currentPath;
4094
- console.log("[BalanceAnalytics] Skipping initial pageview (script already fired)");
4158
+ console.log("[ArtistPixelAnalytics] Skipping initial pageview (script already fired)");
4095
4159
  return;
4096
4160
  }
4097
4161
  }
@@ -4108,8 +4172,8 @@ function BalanceAnalyticsInner() {
4108
4172
  }, [pathname, searchParams, balance]);
4109
4173
  return null;
4110
4174
  }
4111
- function BalanceAnalytics() {
4112
- return /* @__PURE__ */ import_react28.default.createElement(import_react28.Suspense, { fallback: null }, /* @__PURE__ */ import_react28.default.createElement(BalanceAnalyticsInner, null));
4175
+ function ArtistPixelAnalytics() {
4176
+ return /* @__PURE__ */ import_react28.default.createElement(import_react28.Suspense, { fallback: null }, /* @__PURE__ */ import_react28.default.createElement(ArtistPixelAnalyticsInner, null));
4113
4177
  }
4114
4178
 
4115
4179
  // src/react/ConsentBridge.tsx
@@ -4119,7 +4183,7 @@ function ConsentBridge({
4119
4183
  marketing,
4120
4184
  personalization
4121
4185
  }) {
4122
- const { setConsent: setConsent2 } = useBalanceConsent();
4186
+ const { setConsent: setConsent2 } = useArtistPixelConsent();
4123
4187
  const isInitialized = (0, import_react29.useRef)(false);
4124
4188
  (0, import_react29.useEffect)(() => {
4125
4189
  if (analytics === void 0 && marketing === void 0 && personalization === void 0) {
@@ -4139,7 +4203,7 @@ function ConsentBridge({
4139
4203
  return null;
4140
4204
  }
4141
4205
 
4142
- // src/react/useBalanceIdentify.ts
4206
+ // src/react/useArtistPixelIdentify.ts
4143
4207
  var import_react30 = require("react");
4144
4208
 
4145
4209
  // src/storage/StorageManager.ts
@@ -4428,7 +4492,7 @@ function initStorageWithConsent(hasAnalyticsConsent) {
4428
4492
  return manager;
4429
4493
  }
4430
4494
 
4431
- // src/react/useBalanceIdentify.ts
4495
+ // src/react/useArtistPixelIdentify.ts
4432
4496
  var PENDING_IDENTIFY_KEY = "pending_identify";
4433
4497
  var MAX_PENDING_AGE_MS = 30 * 60 * 1e3;
4434
4498
  function checkAnalyticsConsent() {
@@ -4448,7 +4512,7 @@ function checkAnalyticsConsent() {
4448
4512
  return true;
4449
4513
  }
4450
4514
  }
4451
- function useBalanceIdentify() {
4515
+ function useArtistPixelIdentify() {
4452
4516
  const pollIntervalRef = (0, import_react30.useRef)(null);
4453
4517
  const hasProcessedPending = (0, import_react30.useRef)(false);
4454
4518
  const storageManager = typeof window !== "undefined" ? getStorageManager() : null;
@@ -4481,7 +4545,7 @@ function useBalanceIdentify() {
4481
4545
  const identify2 = (0, import_react30.useCallback)((email, traits) => {
4482
4546
  const hasConsent2 = checkAnalyticsConsent();
4483
4547
  if (!hasConsent2) {
4484
- console.log("[useBalanceIdentify] Skipping identify - user declined analytics consent");
4548
+ console.log("[useArtistPixelIdentify] Skipping identify - user declined analytics consent");
4485
4549
  return false;
4486
4550
  }
4487
4551
  if (storageManager) {
@@ -4489,11 +4553,11 @@ function useBalanceIdentify() {
4489
4553
  }
4490
4554
  if (typeof window !== "undefined" && window.balance?.identify) {
4491
4555
  window.balance.identify(email, traits);
4492
- console.log("[useBalanceIdentify] User identified:", email.split("@")[0] + "***");
4556
+ console.log("[useArtistPixelIdentify] User identified:", email.split("@")[0] + "***");
4493
4557
  clearPendingIdentify();
4494
4558
  return true;
4495
4559
  }
4496
- console.log("[useBalanceIdentify] Pixel not ready, queueing identify");
4560
+ console.log("[useArtistPixelIdentify] Pixel not ready, queueing identify");
4497
4561
  setPendingIdentify(email, traits);
4498
4562
  return false;
4499
4563
  }, [storageManager, clearPendingIdentify, setPendingIdentify]);
@@ -4506,7 +4570,7 @@ function useBalanceIdentify() {
4506
4570
  if (typeof window !== "undefined" && window.balance?.identify) {
4507
4571
  const hasConsent2 = checkAnalyticsConsent();
4508
4572
  if (!hasConsent2) {
4509
- console.log("[useBalanceIdentify] Clearing pending identify - user declined analytics consent");
4573
+ console.log("[useArtistPixelIdentify] Clearing pending identify - user declined analytics consent");
4510
4574
  clearPendingIdentify();
4511
4575
  hasProcessedPending.current = true;
4512
4576
  return;
@@ -4514,7 +4578,7 @@ function useBalanceIdentify() {
4514
4578
  if (storageManager) {
4515
4579
  initStorageWithConsent(hasConsent2);
4516
4580
  }
4517
- console.log("[useBalanceIdentify] Processing pending identify");
4581
+ console.log("[useArtistPixelIdentify] Processing pending identify");
4518
4582
  window.balance.identify(pending.email, pending.traits);
4519
4583
  clearPendingIdentify();
4520
4584
  hasProcessedPending.current = true;
@@ -4558,71 +4622,81 @@ function useBalanceIdentify() {
4558
4622
  var track = (eventName, properties) => {
4559
4623
  if (typeof window === "undefined")
4560
4624
  return;
4561
- if (window.balance) {
4625
+ if (window.artistPixel) {
4626
+ window.artistPixel.track(eventName, properties);
4627
+ } else if (window.balance) {
4562
4628
  window.balance.track(eventName, properties);
4563
4629
  } else {
4564
- console.warn("[Balance Pixel] track() called before pixel initialized:", eventName);
4630
+ console.warn("[artistPixel] track() called before pixel initialized:", eventName);
4565
4631
  }
4566
4632
  };
4567
4633
  var identify = (email, traits) => {
4568
4634
  if (typeof window === "undefined")
4569
4635
  return Promise.resolve();
4570
- if (window.balance) {
4636
+ if (window.artistPixel) {
4637
+ return window.artistPixel.identify(email, traits);
4638
+ } else if (window.balance) {
4571
4639
  return window.balance.identify(email, traits);
4572
4640
  } else {
4573
- console.warn("[Balance Pixel] identify() called before pixel initialized");
4641
+ console.warn("[artistPixel] identify() called before pixel initialized");
4574
4642
  return Promise.resolve();
4575
4643
  }
4576
4644
  };
4577
4645
  var page = (options) => {
4578
4646
  if (typeof window === "undefined")
4579
4647
  return;
4580
- if (window.balance) {
4648
+ if (window.artistPixel) {
4649
+ window.artistPixel.page(options);
4650
+ } else if (window.balance) {
4581
4651
  window.balance.page(options);
4582
4652
  } else {
4583
- console.warn("[Balance Pixel] page() called before pixel initialized");
4653
+ console.warn("[artistPixel] page() called before pixel initialized");
4584
4654
  }
4585
4655
  };
4586
4656
  var purchase = (revenue, currency, properties) => {
4587
4657
  if (typeof window === "undefined")
4588
4658
  return;
4589
- if (window.balance) {
4659
+ if (window.artistPixel) {
4660
+ window.artistPixel.purchase(revenue, currency, properties);
4661
+ } else if (window.balance) {
4590
4662
  window.balance.purchase(revenue, currency, properties);
4591
4663
  } else {
4592
- console.warn("[Balance Pixel] purchase() called before pixel initialized");
4664
+ console.warn("[artistPixel] purchase() called before pixel initialized");
4593
4665
  }
4594
4666
  };
4595
4667
  var getSessionId = () => {
4596
4668
  if (typeof window === "undefined")
4597
4669
  return null;
4598
- return window.balance?.getSessionId() ?? null;
4670
+ return window.artistPixel?.getSessionId() ?? window.balance?.getSessionId() ?? null;
4599
4671
  };
4600
4672
  var getFanIdHash = () => {
4601
4673
  if (typeof window === "undefined")
4602
4674
  return null;
4603
- return window.balance?.getFanIdHash() ?? null;
4675
+ return window.artistPixel?.getFanIdHash() ?? window.balance?.getFanIdHash() ?? null;
4604
4676
  };
4605
4677
  var getAttribution = () => {
4606
4678
  if (typeof window === "undefined")
4607
4679
  return {};
4608
- return window.balance?.getAttribution() ?? {};
4680
+ return window.artistPixel?.getAttribution() ?? window.balance?.getAttribution() ?? {};
4609
4681
  };
4610
4682
  var setConsent = (preferences) => {
4611
4683
  if (typeof window === "undefined")
4612
4684
  return;
4613
- if (window.balance) {
4685
+ if (window.artistPixel) {
4686
+ window.artistPixel.setConsent(preferences);
4687
+ } else if (window.balance) {
4614
4688
  window.balance.setConsent(preferences);
4615
4689
  } else {
4616
- console.warn("[Balance Pixel] setConsent() called before pixel initialized");
4690
+ console.warn("[artistPixel] setConsent() called before pixel initialized");
4617
4691
  }
4618
4692
  };
4619
4693
  var getConsent = () => {
4620
4694
  if (typeof window === "undefined")
4621
4695
  return null;
4622
- return window.balance?.getConsent() ?? null;
4696
+ return window.artistPixel?.getConsent() ?? window.balance?.getConsent() ?? null;
4623
4697
  };
4624
4698
  var hasConsent = (type) => {
4625
4699
  if (typeof window === "undefined")
4626
4700
  return false;
4627
- return window.balance?.hasConsent(type) ?? false;
4701
+ return window.artistPixel?.hasConsent(type) ?? window.balance?.hasConsent(type) ?? false;
4628
4702
  };