@hifilabs/pixel 0.14.0 → 0.14.1

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.11.0";
11
+ const PIXEL_VERSION = "0.14.0";
12
12
  function parseUserAgent(ua) {
13
13
  let device_type = "desktop";
14
14
  if (/ipad|tablet|android(?!.*mobile)/i.test(ua))
@@ -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.11.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.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:`
2
2
  :host {
3
3
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
4
4
  position: fixed;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hifilabs/pixel",
3
- "version": "0.14.0",
3
+ "version": "0.14.1",
4
4
  "description": "artistPixel - Lightweight browser tracking script for artist fan analytics",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",