@hifilabs/pixel 0.17.3 → 0.17.4

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/browser.js CHANGED
@@ -8,7 +8,7 @@ var ArtistPixel = (() => {
8
8
 
9
9
  // src/browser.ts
10
10
  (function() {
11
- const PIXEL_VERSION = "0.17.3";
11
+ const PIXEL_VERSION = "0.17.4";
12
12
  const currentScript = document.currentScript;
13
13
  const debug = currentScript?.dataset.debug === "true";
14
14
  const SILENT_MODE = !debug;
@@ -1,4 +1,4 @@
1
- var ArtistPixel=(()=>{var He=Object.defineProperty;var Ne=(k,o,C)=>o in k?He(k,o,{enumerable:!0,configurable:!0,writable:!0,value:C}):k[o]=C;var X=(k,o,C)=>(Ne(k,typeof o!="symbol"?o+"":o,C),C);(function(){let k="0.17.3",o=document.currentScript,C=o?.dataset.debug==="true",Yt=!C,a=(...t)=>{C&&console.log("[artistPixel]",...t)},S=(...t)=>{Yt||console.error("[artistPixel]",...t)};function Jt(t){let e="desktop";/ipad|tablet|android(?!.*mobile)/i.test(t)?e="tablet":/mobile|iphone|android.*mobile|blackberry|iemobile/i.test(t)&&(e="mobile");let n="Unknown";/edg/i.test(t)?n="Edge":/opr|opera/i.test(t)?n="Opera":/firefox/i.test(t)?n="Firefox":/chrome/i.test(t)?n="Chrome":/safari/i.test(t)&&(n="Safari");let i="Unknown";return/iphone|ipad/i.test(t)?i="iOS":/android/i.test(t)?i="Android":/windows/i.test(t)?i="Windows":/mac os/i.test(t)?i="macOS":/linux/i.test(t)?i="Linux":/cros/i.test(t)&&(i="ChromeOS"),{device_type:e,browser:n,os:i}}let W=null;function Kt(){if(!W)try{W=Jt(navigator.userAgent)}catch{W={device_type:"desktop",browser:"Unknown",os:"Unknown"}}return W}let M=o?.dataset.artistId,Q=o?.dataset.projectId,Z=Q?Xt(Q):void 0;function Xt(t){return!t||t.startsWith("release_")||t.startsWith("merch_")||t.startsWith("link_")||t.startsWith("custom_")?t:`custom_${t}`}let tt=o?.dataset.emulator==="true",et=parseInt(o?.dataset.heartbeatInterval||"120000",10),bt=o?.dataset.heartbeat!=="false",vt=o?.dataset.source,_t=o?.dataset.endpoint,f=window.__artistPixelConfig||{},O=o?.dataset.metaPixelId||f.metaPixelId,T=o?.dataset.tiktokPixelId||f.tiktokPixelId,p=o?.dataset.googleAdsId||f.googleAdsId,kt=o?.dataset.googleAdsConversionLabel||f.googleAdsConversionLabel,j=o?.dataset.googleTagManagerId||f.googleTagManagerId,h=o?.dataset.googleAnalyticsId||f.googleAnalyticsId,w={pageview:(o?.dataset.forwardPageview??f.forwardPageview)!=="false",purchase:(o?.dataset.forwardPurchase??f.forwardPurchase)!=="false",addToCart:(o?.dataset.forwardAddToCart??f.forwardAddToCart)!=="false",lead:(o?.dataset.forwardLead??f.forwardLead)!=="false",viewContent:(o?.dataset.forwardViewContent??f.forwardViewContent)!=="false",initiateCheckout:(o?.dataset.forwardInitiateCheckout??f.forwardInitiateCheckout)!=="false",completeRegistration:(o?.dataset.forwardCompleteRegistration??f.forwardCompleteRegistration)!=="false",subscribe:(o?.dataset.forwardSubscribe??f.forwardSubscribe)!=="false",search:(o?.dataset.forwardSearch??f.forwardSearch)!=="false",contact:(o?.dataset.forwardContact??f.forwardContact)!=="false",custom:(o?.dataset.forwardCustom||f.forwardCustom||"").split(",").filter(Boolean)},q=!!(O||T||p||j||h),nt=o?.dataset.consentUi==="true",Qt=o?.dataset.consentStyle||"brutalist",Zt=o?.dataset.primaryColor,te=o?.dataset.bannerPosition||"bottom",It=o?.dataset.excludePages?.split(",").filter(Boolean)||[],xt=o?.dataset.trackFileDownloads==="true",ee=o?.dataset.hashRouting==="true";function ne(){if(vt)return vt;let t=typeof window.dataLayer<"u"&&Array.isArray(window.dataLayer),e=typeof window.gtag=="function";return t&&e?"gtm":"pixel"}let Y="pixel";if(!M){S(" Error: data-artist-id attribute is required");return}let Ct="session_id",at="session_timestamp",St="attribution",y="fan_id_hash",F="visitor_id",J="artistPixel_consent",ae=365*24*60*60*1e3,ie=30*24*60*60*1e3,oe=60*60*1e3,m="balance_";function re(t){let e=t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp("^"+e+"$")}function se(t){if(It.length===0)return!1;try{let e=new URL(t,window.location.origin).pathname;return It.some(n=>re(n).test(e))}catch{return!1}}let ce=[".pdf",".zip",".tar",".gz",".rar",".7z",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".mp3",".wav",".flac",".aac",".ogg",".mp4",".mov",".avi",".mkv",".webm",".exe",".dmg",".pkg",".deb",".rpm",".csv",".json",".xml",".txt"];function Pt(t){try{let e=new URL(t,window.location.origin).pathname.toLowerCase();return ce.some(n=>e.endsWith(n))}catch{return!1}}function de(t,e){try{let i=new URL(t,window.location.origin).pathname.split("/").pop()||"unknown",c=i.includes(".")?i.split(".").pop():"unknown";a("File download tracked:",{url:t,fileName:i,fileExtension:c});let l=P({event_name:"custom",metadata:{event_type:"file_download",file_url:t,file_name:i,file_extension:c,link_text:e?.textContent?.trim().substring(0,100)||""}});I(l)}catch(n){S("Failed to track file download:",n)}}let le="https://e.os.xyz",Et="https://us-central1-artist-os-distro.cloudfunctions.net/ingestEvents",ge="https://us-central1-artist-os-distro.cloudfunctions.net/identityHashIdentity",L=_t||(tt?"http://localhost:5001/artist-os-distro/us-central1/ingestEvents":le),U=null,b=null,g=null,H=!1,d=null,A={},it={},v=[],ot=null,_="session",R=null,rt=0,st=0,D=0,N=!0,ct=0,dt=!1,ue=2*60*1e3,Tt=Date.now(),z=!1,lt={base:`
1
+ var ArtistPixel=(()=>{var He=Object.defineProperty;var Ne=(k,o,C)=>o in k?He(k,o,{enumerable:!0,configurable:!0,writable:!0,value:C}):k[o]=C;var X=(k,o,C)=>(Ne(k,typeof o!="symbol"?o+"":o,C),C);(function(){let k="0.17.4",o=document.currentScript,C=o?.dataset.debug==="true",Yt=!C,a=(...t)=>{C&&console.log("[artistPixel]",...t)},S=(...t)=>{Yt||console.error("[artistPixel]",...t)};function Jt(t){let e="desktop";/ipad|tablet|android(?!.*mobile)/i.test(t)?e="tablet":/mobile|iphone|android.*mobile|blackberry|iemobile/i.test(t)&&(e="mobile");let n="Unknown";/edg/i.test(t)?n="Edge":/opr|opera/i.test(t)?n="Opera":/firefox/i.test(t)?n="Firefox":/chrome/i.test(t)?n="Chrome":/safari/i.test(t)&&(n="Safari");let i="Unknown";return/iphone|ipad/i.test(t)?i="iOS":/android/i.test(t)?i="Android":/windows/i.test(t)?i="Windows":/mac os/i.test(t)?i="macOS":/linux/i.test(t)?i="Linux":/cros/i.test(t)&&(i="ChromeOS"),{device_type:e,browser:n,os:i}}let W=null;function Kt(){if(!W)try{W=Jt(navigator.userAgent)}catch{W={device_type:"desktop",browser:"Unknown",os:"Unknown"}}return W}let M=o?.dataset.artistId,Q=o?.dataset.projectId,Z=Q?Xt(Q):void 0;function Xt(t){return!t||t.startsWith("release_")||t.startsWith("merch_")||t.startsWith("link_")||t.startsWith("custom_")?t:`custom_${t}`}let tt=o?.dataset.emulator==="true",et=parseInt(o?.dataset.heartbeatInterval||"120000",10),bt=o?.dataset.heartbeat!=="false",vt=o?.dataset.source,_t=o?.dataset.endpoint,f=window.__artistPixelConfig||{},O=o?.dataset.metaPixelId||f.metaPixelId,T=o?.dataset.tiktokPixelId||f.tiktokPixelId,p=o?.dataset.googleAdsId||f.googleAdsId,kt=o?.dataset.googleAdsConversionLabel||f.googleAdsConversionLabel,j=o?.dataset.googleTagManagerId||f.googleTagManagerId,h=o?.dataset.googleAnalyticsId||f.googleAnalyticsId,w={pageview:(o?.dataset.forwardPageview??f.forwardPageview)!=="false",purchase:(o?.dataset.forwardPurchase??f.forwardPurchase)!=="false",addToCart:(o?.dataset.forwardAddToCart??f.forwardAddToCart)!=="false",lead:(o?.dataset.forwardLead??f.forwardLead)!=="false",viewContent:(o?.dataset.forwardViewContent??f.forwardViewContent)!=="false",initiateCheckout:(o?.dataset.forwardInitiateCheckout??f.forwardInitiateCheckout)!=="false",completeRegistration:(o?.dataset.forwardCompleteRegistration??f.forwardCompleteRegistration)!=="false",subscribe:(o?.dataset.forwardSubscribe??f.forwardSubscribe)!=="false",search:(o?.dataset.forwardSearch??f.forwardSearch)!=="false",contact:(o?.dataset.forwardContact??f.forwardContact)!=="false",custom:(o?.dataset.forwardCustom||f.forwardCustom||"").split(",").filter(Boolean)},q=!!(O||T||p||j||h),nt=o?.dataset.consentUi==="true",Qt=o?.dataset.consentStyle||"brutalist",Zt=o?.dataset.primaryColor,te=o?.dataset.bannerPosition||"bottom",It=o?.dataset.excludePages?.split(",").filter(Boolean)||[],xt=o?.dataset.trackFileDownloads==="true",ee=o?.dataset.hashRouting==="true";function ne(){if(vt)return vt;let t=typeof window.dataLayer<"u"&&Array.isArray(window.dataLayer),e=typeof window.gtag=="function";return t&&e?"gtm":"pixel"}let Y="pixel";if(!M){S(" Error: data-artist-id attribute is required");return}let Ct="session_id",at="session_timestamp",St="attribution",y="fan_id_hash",F="visitor_id",J="artistPixel_consent",ae=365*24*60*60*1e3,ie=30*24*60*60*1e3,oe=60*60*1e3,m="balance_";function re(t){let e=t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp("^"+e+"$")}function se(t){if(It.length===0)return!1;try{let e=new URL(t,window.location.origin).pathname;return It.some(n=>re(n).test(e))}catch{return!1}}let ce=[".pdf",".zip",".tar",".gz",".rar",".7z",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".mp3",".wav",".flac",".aac",".ogg",".mp4",".mov",".avi",".mkv",".webm",".exe",".dmg",".pkg",".deb",".rpm",".csv",".json",".xml",".txt"];function Pt(t){try{let e=new URL(t,window.location.origin).pathname.toLowerCase();return ce.some(n=>e.endsWith(n))}catch{return!1}}function de(t,e){try{let i=new URL(t,window.location.origin).pathname.split("/").pop()||"unknown",c=i.includes(".")?i.split(".").pop():"unknown";a("File download tracked:",{url:t,fileName:i,fileExtension:c});let l=P({event_name:"custom",metadata:{event_type:"file_download",file_url:t,file_name:i,file_extension:c,link_text:e?.textContent?.trim().substring(0,100)||""}});I(l)}catch(n){S("Failed to track file download:",n)}}let le="https://e.os.xyz",Et="https://us-central1-artist-os-distro.cloudfunctions.net/ingestEvents",ge="https://us-central1-artist-os-distro.cloudfunctions.net/identityHashIdentity",L=_t||(tt?"http://localhost:5001/artist-os-distro/us-central1/ingestEvents":le),U=null,b=null,g=null,H=!1,d=null,A={},it={},v=[],ot=null,_="session",R=null,rt=0,st=0,D=0,N=!0,ct=0,dt=!1,ue=2*60*1e3,Tt=Date.now(),z=!1,lt={base:`
2
2
  :host {
3
3
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
4
4
  position: fixed;
@@ -76,6 +76,27 @@ export interface BalanceProviderProps {
76
76
  endpoint?: string;
77
77
  gtmId?: string;
78
78
  useEmulator?: boolean;
79
+ exclude?: string[];
80
+ trackFileDownloads?: boolean;
81
+ hashRouting?: boolean;
82
+ autoTrackLinks?: boolean;
83
+ integrity?: string;
84
+ metaPixelId?: string;
85
+ tiktokPixelId?: string;
86
+ googleAdsId?: string;
87
+ googleAdsConversionLabel?: string;
88
+ googleAnalyticsId?: string;
89
+ forwardPageview?: boolean;
90
+ forwardPurchase?: boolean;
91
+ forwardAddToCart?: boolean;
92
+ forwardLead?: boolean;
93
+ forwardViewContent?: boolean;
94
+ forwardInitiateCheckout?: boolean;
95
+ forwardCompleteRegistration?: boolean;
96
+ forwardSubscribe?: boolean;
97
+ forwardSearch?: boolean;
98
+ forwardContact?: boolean;
99
+ forwardCustom?: string[];
79
100
  children: React.ReactNode;
80
101
  }
81
102
 
package/dist/index.js CHANGED
@@ -1602,6 +1602,7 @@ function ArtistPixelProvider({
1602
1602
  exclude,
1603
1603
  trackFileDownloads = false,
1604
1604
  hashRouting = false,
1605
+ autoTrackLinks = false,
1605
1606
  integrity,
1606
1607
  // Third-party pixels
1607
1608
  metaPixelId,
@@ -1788,6 +1789,7 @@ function ArtistPixelProvider({
1788
1789
  "data-exclude-pages": exclude?.join(",") || void 0,
1789
1790
  "data-track-file-downloads": trackFileDownloads ? "true" : void 0,
1790
1791
  "data-hash-routing": hashRouting ? "true" : void 0,
1792
+ "data-auto-track-links": autoTrackLinks ? "true" : void 0,
1791
1793
  "data-meta-pixel-id": metaPixelId,
1792
1794
  "data-tiktok-pixel-id": tiktokPixelId,
1793
1795
  "data-google-ads-id": googleAdsId,
package/dist/index.mjs CHANGED
@@ -1506,6 +1506,7 @@ function ArtistPixelProvider({
1506
1506
  exclude,
1507
1507
  trackFileDownloads = false,
1508
1508
  hashRouting = false,
1509
+ autoTrackLinks = false,
1509
1510
  integrity,
1510
1511
  // Third-party pixels
1511
1512
  metaPixelId,
@@ -1692,6 +1693,7 @@ function ArtistPixelProvider({
1692
1693
  "data-exclude-pages": exclude?.join(",") || void 0,
1693
1694
  "data-track-file-downloads": trackFileDownloads ? "true" : void 0,
1694
1695
  "data-hash-routing": hashRouting ? "true" : void 0,
1696
+ "data-auto-track-links": autoTrackLinks ? "true" : void 0,
1695
1697
  "data-meta-pixel-id": metaPixelId,
1696
1698
  "data-tiktok-pixel-id": tiktokPixelId,
1697
1699
  "data-google-ads-id": googleAdsId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hifilabs/pixel",
3
- "version": "0.17.3",
3
+ "version": "0.17.4",
4
4
  "description": "artistPixel - Lightweight browser tracking script for artist fan analytics",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",