@hifilabs/pixel 0.14.1 → 0.14.3

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 CHANGED
@@ -83,7 +83,7 @@ The CDN version automatically includes your pixel configuration (Meta, TikTok, G
83
83
 
84
84
  ```html
85
85
  <script
86
- src="https://balance-pixel-proxy.hifilabs.workers.dev/pixel.js"
86
+ src="https://e.os.xyz/pixel.js"
87
87
  data-artist-id="your-artist-id"
88
88
  data-meta-pixel-id="123456789"
89
89
  data-tiktok-pixel-id="ABC123DEF"
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.14.0";
11
+ const PIXEL_VERSION = "0.14.1";
12
12
  function parseUserAgent(ua) {
13
13
  let device_type = "desktop";
14
14
  if (/ipad|tablet|android(?!.*mobile)/i.test(ua))
@@ -196,7 +196,7 @@ var ArtistPixel = (() => {
196
196
  logError("Failed to track file download:", e);
197
197
  }
198
198
  }
199
- const PIXEL_PROXY_URL = "https://balance-pixel-proxy.hifilabs.workers.dev";
199
+ const PIXEL_PROXY_URL = "https://e.os.xyz";
200
200
  const FIREBASE_DIRECT_URL = "https://us-central1-artist-os-distro.cloudfunctions.net/ingestEvents";
201
201
  const API_ENDPOINT = customEndpoint ? customEndpoint : useEmulator ? `http://localhost:5001/artist-os-distro/us-central1/ingestEvents` : PIXEL_PROXY_URL;
202
202
  let sessionId = null;
@@ -1,4 +1,4 @@
1
- var ArtistPixel=(()=>{var je=Object.defineProperty;var Ue=(y,h,p)=>h in y?je(y,h,{enumerable:!0,configurable:!0,writable:!0,value:p}):y[h]=p;var W=(y,h,p)=>(Ue(y,typeof h!="symbol"?h+"":h,p),p);(function(){let y="0.14.0";function h(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 o="Unknown";return/iphone|ipad/i.test(t)?o="iOS":/android/i.test(t)?o="Android":/windows/i.test(t)?o="Windows":/mac os/i.test(t)?o="macOS":/linux/i.test(t)?o="Linux":/cros/i.test(t)&&(o="ChromeOS"),{device_type:e,browser:n,os:o}}let p=null;function Kt(){if(!p)try{p=h(navigator.userAgent)}catch{p={device_type:"desktop",browser:"Unknown",os:"Unknown"}}return p}let s=document.currentScript,K=s?.dataset.artistId,Y=s?.dataset.projectId,J=Y?Yt(Y):void 0;function Yt(t){return!t||t.startsWith("release_")||t.startsWith("merch_")||t.startsWith("link_")||t.startsWith("custom_")?t:`custom_${t}`}let X=s?.dataset.emulator==="true",yt=s?.dataset.debug==="true",Q=parseInt(s?.dataset.heartbeatInterval||"120000",10),ht=s?.dataset.heartbeat!=="false",bt=s?.dataset.source,vt=s?.dataset.endpoint,m=window.__artistPixelConfig||{},D=s?.dataset.metaPixelId||m.metaPixelId,P=s?.dataset.tiktokPixelId||m.tiktokPixelId,u=s?.dataset.googleAdsId||m.googleAdsId,_t=s?.dataset.googleAdsConversionLabel||m.googleAdsConversionLabel,M=s?.dataset.googleTagManagerId||m.googleTagManagerId,f=s?.dataset.googleAnalyticsId||m.googleAnalyticsId,x={pageview:(s?.dataset.forwardPageview??m.forwardPageview)!=="false",purchase:(s?.dataset.forwardPurchase??m.forwardPurchase)!=="false",addToCart:(s?.dataset.forwardAddToCart??m.forwardAddToCart)!=="false",lead:(s?.dataset.forwardLead??m.forwardLead)!=="false",custom:(s?.dataset.forwardCustom||m.forwardCustom||"").split(",").filter(Boolean)},O=!!(D||P||u||M||f),Z=s?.dataset.consentUi==="true",Jt=s?.dataset.consentStyle||"brutalist",Xt=s?.dataset.primaryColor,Qt=s?.dataset.bannerPosition||"bottom",kt=s?.dataset.excludePages?.split(",").filter(Boolean)||[],xt=s?.dataset.trackFileDownloads==="true",Zt=s?.dataset.hashRouting==="true";function te(){if(bt)return bt;let t=typeof window.dataLayer<"u"&&Array.isArray(window.dataLayer),e=typeof window.gtag=="function";return t&&e?"gtm":"pixel"}let H="pixel";if(!K){S(" Error: data-artist-id attribute is required");return}let It="session_id",tt="session_timestamp",Ct="attribution",St="fan_id_hash",et="visitor_id",G="artistPixel_consent",ee=365*24*60*60*1e3,ne=30*24*60*60*1e3,ae=60*60*1e3,E="balance_";function oe(t){let e=t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp("^"+e+"$")}function ie(t){if(kt.length===0)return!1;try{let e=new URL(t,window.location.origin).pathname;return kt.some(n=>oe(n).test(e))}catch{return!1}}let re=[".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 re.some(n=>e.endsWith(n))}catch{return!1}}function se(t,e){try{let o=new URL(t,window.location.origin).pathname.split("/").pop()||"unknown",c=o.includes(".")?o.split(".").pop():"unknown";a("File download tracked:",{url:t,fileName:o,fileExtension:c});let d=I({event_name:"custom",metadata:{event_type:"file_download",file_url:t,file_name:o,file_extension:c,link_text:e?.textContent?.trim().substring(0,100)||""}});C(d)}catch(n){S("Failed to track file download:",n)}}let ce="https://balance-pixel-proxy.hifilabs.workers.dev",Et="https://us-central1-artist-os-distro.cloudfunctions.net/ingestEvents",T=vt||(X?"http://localhost:5001/artist-os-distro/us-central1/ingestEvents":ce),j=null,w=null,b=null,g=null,L={},nt={},v=[],at=null,_="session",A=null,ot=0,it=0,R=0,U=!0,rt=0,st=!1,de=2*60*1e3,Tt=Date.now(),q=!1,le=!yt,a=(...t)=>{yt&&console.log("[artistPixel]",...t)},S=(...t)=>{le||console.error("[artistPixel]",...t)},ct={base:`
1
+ var ArtistPixel=(()=>{var je=Object.defineProperty;var Ue=(y,h,p)=>h in y?je(y,h,{enumerable:!0,configurable:!0,writable:!0,value:p}):y[h]=p;var W=(y,h,p)=>(Ue(y,typeof h!="symbol"?h+"":h,p),p);(function(){let y="0.14.1";function h(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 o="Unknown";return/iphone|ipad/i.test(t)?o="iOS":/android/i.test(t)?o="Android":/windows/i.test(t)?o="Windows":/mac os/i.test(t)?o="macOS":/linux/i.test(t)?o="Linux":/cros/i.test(t)&&(o="ChromeOS"),{device_type:e,browser:n,os:o}}let p=null;function Kt(){if(!p)try{p=h(navigator.userAgent)}catch{p={device_type:"desktop",browser:"Unknown",os:"Unknown"}}return p}let s=document.currentScript,K=s?.dataset.artistId,Y=s?.dataset.projectId,J=Y?Yt(Y):void 0;function Yt(t){return!t||t.startsWith("release_")||t.startsWith("merch_")||t.startsWith("link_")||t.startsWith("custom_")?t:`custom_${t}`}let X=s?.dataset.emulator==="true",yt=s?.dataset.debug==="true",Q=parseInt(s?.dataset.heartbeatInterval||"120000",10),ht=s?.dataset.heartbeat!=="false",bt=s?.dataset.source,vt=s?.dataset.endpoint,m=window.__artistPixelConfig||{},D=s?.dataset.metaPixelId||m.metaPixelId,P=s?.dataset.tiktokPixelId||m.tiktokPixelId,u=s?.dataset.googleAdsId||m.googleAdsId,_t=s?.dataset.googleAdsConversionLabel||m.googleAdsConversionLabel,M=s?.dataset.googleTagManagerId||m.googleTagManagerId,f=s?.dataset.googleAnalyticsId||m.googleAnalyticsId,x={pageview:(s?.dataset.forwardPageview??m.forwardPageview)!=="false",purchase:(s?.dataset.forwardPurchase??m.forwardPurchase)!=="false",addToCart:(s?.dataset.forwardAddToCart??m.forwardAddToCart)!=="false",lead:(s?.dataset.forwardLead??m.forwardLead)!=="false",custom:(s?.dataset.forwardCustom||m.forwardCustom||"").split(",").filter(Boolean)},O=!!(D||P||u||M||f),Z=s?.dataset.consentUi==="true",Jt=s?.dataset.consentStyle||"brutalist",Xt=s?.dataset.primaryColor,Qt=s?.dataset.bannerPosition||"bottom",kt=s?.dataset.excludePages?.split(",").filter(Boolean)||[],xt=s?.dataset.trackFileDownloads==="true",Zt=s?.dataset.hashRouting==="true";function te(){if(bt)return bt;let t=typeof window.dataLayer<"u"&&Array.isArray(window.dataLayer),e=typeof window.gtag=="function";return t&&e?"gtm":"pixel"}let H="pixel";if(!K){S(" Error: data-artist-id attribute is required");return}let It="session_id",tt="session_timestamp",Ct="attribution",St="fan_id_hash",et="visitor_id",G="artistPixel_consent",ee=365*24*60*60*1e3,ne=30*24*60*60*1e3,ae=60*60*1e3,E="balance_";function oe(t){let e=t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp("^"+e+"$")}function ie(t){if(kt.length===0)return!1;try{let e=new URL(t,window.location.origin).pathname;return kt.some(n=>oe(n).test(e))}catch{return!1}}let re=[".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 re.some(n=>e.endsWith(n))}catch{return!1}}function se(t,e){try{let o=new URL(t,window.location.origin).pathname.split("/").pop()||"unknown",c=o.includes(".")?o.split(".").pop():"unknown";a("File download tracked:",{url:t,fileName:o,fileExtension:c});let d=I({event_name:"custom",metadata:{event_type:"file_download",file_url:t,file_name:o,file_extension:c,link_text:e?.textContent?.trim().substring(0,100)||""}});C(d)}catch(n){S("Failed to track file download:",n)}}let ce="https://e.os.xyz",Et="https://us-central1-artist-os-distro.cloudfunctions.net/ingestEvents",T=vt||(X?"http://localhost:5001/artist-os-distro/us-central1/ingestEvents":ce),j=null,w=null,b=null,g=null,L={},nt={},v=[],at=null,_="session",A=null,ot=0,it=0,R=0,U=!0,rt=0,st=!1,de=2*60*1e3,Tt=Date.now(),q=!1,le=!yt,a=(...t)=>{yt&&console.log("[artistPixel]",...t)},S=(...t)=>{le||console.error("[artistPixel]",...t)},ct={base:`
2
2
  :host {
3
3
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
4
4
  position: fixed;
package/dist/index.js CHANGED
@@ -1433,7 +1433,7 @@ function useGTMConsent(options = {}) {
1433
1433
  [debug]
1434
1434
  );
1435
1435
  const mapPixelConsentToGTM = (0, import_react9.useCallback)(() => {
1436
- if (typeof window === "undefined" || !window.balance) {
1436
+ if (typeof window === "undefined" || !window.balance || typeof window.balance.hasConsent !== "function") {
1437
1437
  return {
1438
1438
  ad_storage: "denied",
1439
1439
  ad_user_data: "denied",
package/dist/index.mjs CHANGED
@@ -1351,7 +1351,7 @@ function useGTMConsent(options = {}) {
1351
1351
  [debug]
1352
1352
  );
1353
1353
  const mapPixelConsentToGTM = useCallback3(() => {
1354
- if (typeof window === "undefined" || !window.balance) {
1354
+ if (typeof window === "undefined" || !window.balance || typeof window.balance.hasConsent !== "function") {
1355
1355
  return {
1356
1356
  ad_storage: "denied",
1357
1357
  ad_user_data: "denied",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hifilabs/pixel",
3
- "version": "0.14.1",
3
+ "version": "0.14.3",
4
4
  "description": "artistPixel - Lightweight browser tracking script for artist fan analytics",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",