@hifilabs/pixel 0.0.5 → 0.0.7

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.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  // src/react/BalanceAnalytics.tsx
3
- import { useEffect, Suspense } from "react";
3
+ import React, { useEffect, Suspense } from "react";
4
4
  import { usePathname, useSearchParams } from "next/navigation";
5
5
  function BalanceAnalyticsInner() {
6
6
  const pathname = usePathname();
package/dist/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  var BalancePixel = (() => {
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
7
9
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
@@ -22,16 +24,34 @@ var BalancePixel = (() => {
22
24
  }
23
25
  return to;
24
26
  };
27
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
28
+ // If the importer is in node compatibility mode or this is not an ESM
29
+ // file that has been converted to a CommonJS file using a Babel-
30
+ // compatible transform (i.e. "__esModule" has not been set), then set
31
+ // "default" to the CommonJS "module.exports" for node compatibility.
32
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
33
+ mod
34
+ ));
25
35
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
26
36
 
27
37
  // src/index.ts
28
38
  var src_exports = {};
29
39
  __export(src_exports, {
30
- BalanceAnalytics: () => BalanceAnalytics
40
+ BalanceAnalytics: () => BalanceAnalytics,
41
+ getAttribution: () => getAttribution,
42
+ getConsent: () => getConsent,
43
+ getFanIdHash: () => getFanIdHash,
44
+ getSessionId: () => getSessionId,
45
+ hasConsent: () => hasConsent,
46
+ identify: () => identify,
47
+ page: () => page,
48
+ purchase: () => purchase,
49
+ setConsent: () => setConsent,
50
+ track: () => track
31
51
  });
32
52
 
33
53
  // src/react/BalanceAnalytics.tsx
34
- var import_react = __require("react");
54
+ var import_react = __toESM(__require("react"));
35
55
  var import_navigation = __require("next/navigation");
36
56
  function BalanceAnalyticsInner() {
37
57
  const pathname = (0, import_navigation.usePathname)();
@@ -46,7 +66,7 @@ var BalancePixel = (() => {
46
66
  return null;
47
67
  }
48
68
  function BalanceAnalytics() {
49
- return /* @__PURE__ */ React.createElement(import_react.Suspense, { fallback: null }, /* @__PURE__ */ React.createElement(BalanceAnalyticsInner, null));
69
+ return /* @__PURE__ */ import_react.default.createElement(import_react.Suspense, { fallback: null }, /* @__PURE__ */ import_react.default.createElement(BalanceAnalyticsInner, null));
50
70
  }
51
71
 
52
72
  // src/index.ts
@@ -150,7 +170,7 @@ var BalancePixel = (() => {
150
170
  } catch (e) {
151
171
  }
152
172
  }
153
- function setConsent(preferences) {
173
+ function setConsent2(preferences) {
154
174
  const previousConsent = consent;
155
175
  consent = preferences;
156
176
  try {
@@ -174,10 +194,10 @@ var BalancePixel = (() => {
174
194
  });
175
195
  enqueueEvent(event);
176
196
  }
177
- function getConsent() {
197
+ function getConsent2() {
178
198
  return consent;
179
199
  }
180
- function hasConsent(type) {
200
+ function hasConsent2(type) {
181
201
  return consent?.[type] === true;
182
202
  }
183
203
  async function hashEmail(email) {
@@ -206,12 +226,6 @@ var BalancePixel = (() => {
206
226
  return base;
207
227
  }
208
228
  function enqueueEvent(event) {
209
- const essentialEvents = ["identify", "consent_updated"];
210
- const isEssential = essentialEvents.includes(event.event_name);
211
- if (!isEssential && !hasConsent("analytics")) {
212
- log(`Event '${event.event_name}' blocked - no analytics consent`);
213
- return;
214
- }
215
229
  eventQueue.push(event);
216
230
  log("Event queued:", event.event_name, "(queue:", eventQueue.length, ")");
217
231
  if (eventQueue.length >= 10) {
@@ -259,7 +273,7 @@ var BalancePixel = (() => {
259
273
  });
260
274
  enqueueEvent(event);
261
275
  }
262
- function track(eventName, properties = {}) {
276
+ function track2(eventName, properties = {}) {
263
277
  const event = buildEvent({
264
278
  event_name: "custom",
265
279
  metadata: {
@@ -269,7 +283,7 @@ var BalancePixel = (() => {
269
283
  });
270
284
  enqueueEvent(event);
271
285
  }
272
- async function identify(email, traits = {}) {
286
+ async function identify2(email, traits = {}) {
273
287
  try {
274
288
  fanIdHash = await hashEmail(email);
275
289
  localStorage.setItem(FAN_ID_KEY, fanIdHash);
@@ -295,7 +309,7 @@ var BalancePixel = (() => {
295
309
  console.error("[BALANCE Pixel] Failed to identify:", error);
296
310
  }
297
311
  }
298
- function purchase(revenue, currency = "USD", properties = {}) {
312
+ function purchase2(revenue, currency = "USD", properties = {}) {
299
313
  const event = buildEvent({
300
314
  event_name: "purchase",
301
315
  metadata: {
@@ -313,11 +327,11 @@ var BalancePixel = (() => {
313
327
  if (!consent) {
314
328
  consent = {
315
329
  analytics: true,
316
- marketing: false,
317
- personalization: false,
330
+ marketing: true,
331
+ personalization: true,
318
332
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
319
333
  };
320
- log("Using default consent (dev mode):", consent);
334
+ log("Default consent enabled (all tracking):", consent);
321
335
  }
322
336
  captureAttribution();
323
337
  startFlushTimer();
@@ -341,16 +355,16 @@ var BalancePixel = (() => {
341
355
  });
342
356
  }
343
357
  window.balance = {
344
- track,
345
- identify,
358
+ track: track2,
359
+ identify: identify2,
346
360
  page: trackPageView,
347
- purchase,
361
+ purchase: purchase2,
348
362
  getSessionId: () => sessionId,
349
363
  getFanIdHash: () => fanIdHash,
350
364
  getAttribution: () => attribution,
351
- setConsent,
352
- getConsent,
353
- hasConsent
365
+ setConsent: setConsent2,
366
+ getConsent: getConsent2,
367
+ hasConsent: hasConsent2
354
368
  };
355
369
  if (document.readyState === "loading") {
356
370
  document.addEventListener("DOMContentLoaded", init);
@@ -359,5 +373,76 @@ var BalancePixel = (() => {
359
373
  }
360
374
  log("Pixel script loaded");
361
375
  })();
376
+ var track = (eventName, properties) => {
377
+ if (typeof window === "undefined")
378
+ return;
379
+ if (window.balance) {
380
+ window.balance.track(eventName, properties);
381
+ } else {
382
+ console.warn("[Balance Pixel] track() called before pixel initialized:", eventName);
383
+ }
384
+ };
385
+ var identify = (email, traits) => {
386
+ if (typeof window === "undefined")
387
+ return Promise.resolve();
388
+ if (window.balance) {
389
+ return window.balance.identify(email, traits);
390
+ } else {
391
+ console.warn("[Balance Pixel] identify() called before pixel initialized");
392
+ return Promise.resolve();
393
+ }
394
+ };
395
+ var page = (options) => {
396
+ if (typeof window === "undefined")
397
+ return;
398
+ if (window.balance) {
399
+ window.balance.page(options);
400
+ } else {
401
+ console.warn("[Balance Pixel] page() called before pixel initialized");
402
+ }
403
+ };
404
+ var purchase = (revenue, currency, properties) => {
405
+ if (typeof window === "undefined")
406
+ return;
407
+ if (window.balance) {
408
+ window.balance.purchase(revenue, currency, properties);
409
+ } else {
410
+ console.warn("[Balance Pixel] purchase() called before pixel initialized");
411
+ }
412
+ };
413
+ var getSessionId = () => {
414
+ if (typeof window === "undefined")
415
+ return null;
416
+ return window.balance?.getSessionId() ?? null;
417
+ };
418
+ var getFanIdHash = () => {
419
+ if (typeof window === "undefined")
420
+ return null;
421
+ return window.balance?.getFanIdHash() ?? null;
422
+ };
423
+ var getAttribution = () => {
424
+ if (typeof window === "undefined")
425
+ return {};
426
+ return window.balance?.getAttribution() ?? {};
427
+ };
428
+ var setConsent = (preferences) => {
429
+ if (typeof window === "undefined")
430
+ return;
431
+ if (window.balance) {
432
+ window.balance.setConsent(preferences);
433
+ } else {
434
+ console.warn("[Balance Pixel] setConsent() called before pixel initialized");
435
+ }
436
+ };
437
+ var getConsent = () => {
438
+ if (typeof window === "undefined")
439
+ return null;
440
+ return window.balance?.getConsent() ?? null;
441
+ };
442
+ var hasConsent = (type) => {
443
+ if (typeof window === "undefined")
444
+ return false;
445
+ return window.balance?.hasConsent(type) ?? false;
446
+ };
362
447
  return __toCommonJS(src_exports);
363
448
  })();
package/dist/index.min.js CHANGED
@@ -1 +1 @@
1
- var BalancePixel=(()=>{var b=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var W=Object.prototype.hasOwnProperty;var L=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(o,s)=>(typeof require<"u"?require:o)[s]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var X=(n,o)=>{for(var s in o)b(n,s,{get:o[s],enumerable:!0})},Z=(n,o,s,u)=>{if(o&&typeof o=="object"||typeof o=="function")for(let g of V(o))!W.call(n,g)&&g!==s&&b(n,g,{get:()=>o[g],enumerable:!(u=Q(o,g))||u.enumerable});return n};var ee=n=>Z(b({},"__esModule",{value:!0}),n);var ne={};X(ne,{BalanceAnalytics:()=>R});var S=L("react"),_=L("next/navigation");function te(){let n=(0,_.usePathname)(),o=(0,_.useSearchParams)();return(0,S.useEffect)(()=>{if(typeof window<"u"&&window.balance){let s=window.location.href,u=document.title;window.balance.page({url:s,title:u})}},[n,o]),null}function R(){return React.createElement(S.Suspense,{fallback:null},React.createElement(te,null))}(function(){let n=document.currentScript,o=n?.dataset.artistId,s=n?.dataset.projectId,u=n?.dataset.emulator==="true",g=n?.dataset.debug==="true";if(!o){console.error("[BALANCE Pixel] Error: data-artist-id attribute is required");return}let w="balance_session_id",x="balance_session_timestamp",A="balance_attribution",P="balance_fan_id_hash",C="balance_consent",D=60*60*1e3,v=u?"http://localhost:5001/artist-os-distro/us-central1/pixelEndpoint":"https://us-central1-artist-os-distro.cloudfunctions.net/pixelEndpoint",h=null,l=null,c=null,f={},d=[],I=null,i=(...e)=>{g&&console.log("[BALANCE Pixel]",...e)};function N(){return crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function U(){try{let e=localStorage.getItem(w),t=localStorage.getItem(x);if(e&&t&&Date.now()-parseInt(t,10)<D)return localStorage.setItem(x,Date.now().toString()),e;let r=N();return localStorage.setItem(w,r),localStorage.setItem(x,Date.now().toString()),r}catch{return N()}}function B(){let e=new URLSearchParams(window.location.search),t={};return["source","medium","campaign","content","term"].forEach(r=>{let a=e.get(`utm_${r}`);a&&(t[`utm_${r}`]=a)}),t}function j(){try{let e=localStorage.getItem(A);if(e){f=JSON.parse(e),i("Loaded attribution:",f);return}let t=B();Object.keys(t).length>0&&(f=t,localStorage.setItem(A,JSON.stringify(t)),i("Captured attribution:",f))}catch{}}function F(){try{l=localStorage.getItem(P)}catch{}}function z(){try{let e=localStorage.getItem(C);e&&(c=JSON.parse(e).preferences||null,i("Loaded consent:",c))}catch{}}function H(e){let t=c;c=e;try{let a={preferences:e,method:"explicit",version:1};localStorage.setItem(C,JSON.stringify(a)),i("Consent saved:",e)}catch(a){console.error("[BALANCE Pixel] Could not save consent:",a)}let r=m({event_name:"consent_updated",metadata:{consent_preferences:e,consent_method:"explicit",previous_consent:t||void 0}});p(r)}function M(){return c}function O(e){return c?.[e]===!0}async function J(e){let t=e.toLowerCase().trim(),a=new TextEncoder().encode(t),E=await crypto.subtle.digest("SHA-256",a);return Array.from(new Uint8Array(E)).map(G=>G.toString(16).padStart(2,"0")).join("")}function m(e){let t={artist_id:o,fan_session_id:h,fan_id_hash:l||void 0,timestamp:new Date().toISOString(),source_url:window.location.href,referrer_url:document.referrer||void 0,user_agent:navigator.userAgent,...e,...f};return s&&!e.projectId&&(t.projectId=s),t}function p(e){if(!["identify","consent_updated"].includes(e.event_name)&&!O("analytics")){i(`Event '${e.event_name}' blocked - no analytics consent`);return}d.push(e),i("Event queued:",e.event_name,"(queue:",d.length,")"),d.length>=10&&y()}async function y(){if(d.length===0)return;let e=[...d];d=[],i("Flushing",e.length,"events to",v);try{let t=await fetch(v,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({events:e}),keepalive:!0});if(!t.ok)throw new Error(`HTTP ${t.status}`);i("Events sent successfully")}catch(t){console.error("[BALANCE Pixel] Failed to send events:",t),d.length<50&&d.push(...e)}}function K(){I&&clearInterval(I),I=window.setInterval(()=>{d.length>0&&y()},5e3)}function T(e={}){let t=m({event_name:"pageview",page_title:e.title||document.title,source_url:e.url||window.location.href});p(t)}function Y(e,t={}){let r=m({event_name:"custom",metadata:{event_type:e,...t}});p(r)}async function q(e,t={}){try{l=await J(e),localStorage.setItem(P,l);let r=e.split("@"),a=r[0].charAt(0)+"***@"+(r[1]||"");i("Fan identified:",{name:t.name||"(no name)",email:a,hash:l.substring(0,16)+"...",traits:t});let E=m({event_name:"identify",fan_id_hash:l,metadata:{email_sha256:l,traits:t,consent_preferences:c||void 0}});p(E)}catch(r){console.error("[BALANCE Pixel] Failed to identify:",r)}}function $(e,t="USD",r={}){let a=m({event_name:"purchase",metadata:{revenue:e,currency:t,...r}});p(a)}function k(){h=U(),F(),z(),c||(c={analytics:!0,marketing:!1,personalization:!1,timestamp:new Date().toISOString()},i("Using default consent (dev mode):",c)),j(),K(),i("Initialized",{artistId:o,projectId:s||"(none - will track to all projects)",sessionId:h,fanIdHash:l,consent:c,useEmulator:u,endpoint:v}),T(),window.addEventListener("beforeunload",()=>{y()}),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&y()})}window.balance={track:Y,identify:q,page:T,purchase:$,getSessionId:()=>h,getFanIdHash:()=>l,getAttribution:()=>f,setConsent:H,getConsent:M,hasConsent:O},document.readyState==="loading"?document.addEventListener("DOMContentLoaded",k):k(),i("Pixel script loaded")})();return ee(ne);})();
1
+ var BalancePixel=(()=>{var V=Object.create;var x=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var X=Object.getOwnPropertyNames;var Z=Object.getPrototypeOf,ee=Object.prototype.hasOwnProperty;var T=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(r,o)=>(typeof require<"u"?require:r)[o]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var ne=(n,r)=>{for(var o in r)x(n,o,{get:r[o],enumerable:!0})},B=(n,r,o,u)=>{if(r&&typeof r=="object"||typeof r=="function")for(let f of X(r))!ee.call(n,f)&&f!==o&&x(n,f,{get:()=>r[f],enumerable:!(u=W(r,f))||u.enumerable});return n};var te=(n,r,o)=>(o=n!=null?V(Z(n)):{},B(r||!n||!n.__esModule?x(o,"default",{value:n,enumerable:!0}):o,n)),re=n=>B(x({},"__esModule",{value:!0}),n);var me={};ne(me,{BalanceAnalytics:()=>R,getAttribution:()=>ue,getConsent:()=>ge,getFanIdHash:()=>de,getSessionId:()=>le,hasConsent:()=>pe,identify:()=>ae,page:()=>se,purchase:()=>ce,setConsent:()=>fe,track:()=>ie});var g=te(T("react")),b=T("next/navigation");function oe(){let n=(0,b.usePathname)(),r=(0,b.useSearchParams)();return(0,g.useEffect)(()=>{if(typeof window<"u"&&window.balance){let o=window.location.href,u=document.title;window.balance.page({url:o,title:u})}},[n,r]),null}function R(){return g.default.createElement(g.Suspense,{fallback:null},g.default.createElement(oe,null))}(function(){let n=document.currentScript,r=n?.dataset.artistId,o=n?.dataset.projectId,u=n?.dataset.emulator==="true",f=n?.dataset.debug==="true";if(!r){console.error("[BALANCE Pixel] Error: data-artist-id attribute is required");return}let P="balance_session_id",S="balance_session_timestamp",E="balance_attribution",C="balance_fan_id_hash",A="balance_consent",D=60*60*1e3,I=u?"http://localhost:5001/artist-os-distro/us-central1/pixelEndpoint":"https://us-central1-artist-os-distro.cloudfunctions.net/pixelEndpoint",h=null,l=null,s=null,p={},d=[],_=null,c=(...e)=>{f&&console.log("[BALANCE Pixel]",...e)};function N(){return crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function L(){try{let e=localStorage.getItem(P),t=localStorage.getItem(S);if(e&&t&&Date.now()-parseInt(t,10)<D)return localStorage.setItem(S,Date.now().toString()),e;let i=N();return localStorage.setItem(P,i),localStorage.setItem(S,Date.now().toString()),i}catch{return N()}}function z(){let e=new URLSearchParams(window.location.search),t={};return["source","medium","campaign","content","term"].forEach(i=>{let a=e.get(`utm_${i}`);a&&(t[`utm_${i}`]=a)}),t}function U(){try{let e=localStorage.getItem(E);if(e){p=JSON.parse(e),c("Loaded attribution:",p);return}let t=z();Object.keys(t).length>0&&(p=t,localStorage.setItem(E,JSON.stringify(t)),c("Captured attribution:",p))}catch{}}function F(){try{l=localStorage.getItem(C)}catch{}}function j(){try{let e=localStorage.getItem(A);e&&(s=JSON.parse(e).preferences||null,c("Loaded consent:",s))}catch{}}function H(e){let t=s;s=e;try{let a={preferences:e,method:"explicit",version:1};localStorage.setItem(A,JSON.stringify(a)),c("Consent saved:",e)}catch(a){console.error("[BALANCE Pixel] Could not save consent:",a)}let i=m({event_name:"consent_updated",metadata:{consent_preferences:e,consent_method:"explicit",previous_consent:t||void 0}});w(i)}function M(){return s}function J(e){return s?.[e]===!0}async function K(e){let t=e.toLowerCase().trim(),a=new TextEncoder().encode(t),v=await crypto.subtle.digest("SHA-256",a);return Array.from(new Uint8Array(v)).map(Q=>Q.toString(16).padStart(2,"0")).join("")}function m(e){let t={artist_id:r,fan_session_id:h,fan_id_hash:l||void 0,timestamp:new Date().toISOString(),source_url:window.location.href,referrer_url:document.referrer||void 0,user_agent:navigator.userAgent,...e,...p};return o&&!e.projectId&&(t.projectId=o),t}function w(e){d.push(e),c("Event queued:",e.event_name,"(queue:",d.length,")"),d.length>=10&&y()}async function y(){if(d.length===0)return;let e=[...d];d=[],c("Flushing",e.length,"events to",I);try{let t=await fetch(I,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({events:e}),keepalive:!0});if(!t.ok)throw new Error(`HTTP ${t.status}`);c("Events sent successfully")}catch(t){console.error("[BALANCE Pixel] Failed to send events:",t),d.length<50&&d.push(...e)}}function Y(){_&&clearInterval(_),_=window.setInterval(()=>{d.length>0&&y()},5e3)}function k(e={}){let t=m({event_name:"pageview",page_title:e.title||document.title,source_url:e.url||window.location.href});w(t)}function q(e,t={}){let i=m({event_name:"custom",metadata:{event_type:e,...t}});w(i)}async function $(e,t={}){try{l=await K(e),localStorage.setItem(C,l);let i=e.split("@"),a=i[0].charAt(0)+"***@"+(i[1]||"");c("Fan identified:",{name:t.name||"(no name)",email:a,hash:l.substring(0,16)+"...",traits:t});let v=m({event_name:"identify",fan_id_hash:l,metadata:{email_sha256:l,traits:t,consent_preferences:s||void 0}});w(v)}catch(i){console.error("[BALANCE Pixel] Failed to identify:",i)}}function G(e,t="USD",i={}){let a=m({event_name:"purchase",metadata:{revenue:e,currency:t,...i}});w(a)}function O(){h=L(),F(),j(),s||(s={analytics:!0,marketing:!0,personalization:!0,timestamp:new Date().toISOString()},c("Default consent enabled (all tracking):",s)),U(),Y(),c("Initialized",{artistId:r,projectId:o||"(none - will track to all projects)",sessionId:h,fanIdHash:l,consent:s,useEmulator:u,endpoint:I}),k(),window.addEventListener("beforeunload",()=>{y()}),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&y()})}window.balance={track:q,identify:$,page:k,purchase:G,getSessionId:()=>h,getFanIdHash:()=>l,getAttribution:()=>p,setConsent:H,getConsent:M,hasConsent:J},document.readyState==="loading"?document.addEventListener("DOMContentLoaded",O):O(),c("Pixel script loaded")})();var ie=(n,r)=>{typeof window>"u"||(window.balance?window.balance.track(n,r):console.warn("[Balance Pixel] track() called before pixel initialized:",n))},ae=(n,r)=>typeof window>"u"?Promise.resolve():window.balance?window.balance.identify(n,r):(console.warn("[Balance Pixel] identify() called before pixel initialized"),Promise.resolve()),se=n=>{typeof window>"u"||(window.balance?window.balance.page(n):console.warn("[Balance Pixel] page() called before pixel initialized"))},ce=(n,r,o)=>{typeof window>"u"||(window.balance?window.balance.purchase(n,r,o):console.warn("[Balance Pixel] purchase() called before pixel initialized"))},le=()=>typeof window>"u"?null:window.balance?.getSessionId()??null,de=()=>typeof window>"u"?null:window.balance?.getFanIdHash()??null,ue=()=>typeof window>"u"?{}:window.balance?.getAttribution()??{},fe=n=>{typeof window>"u"||(window.balance?window.balance.setConsent(n):console.warn("[Balance Pixel] setConsent() called before pixel initialized"))},ge=()=>typeof window>"u"?null:window.balance?.getConsent()??null,pe=n=>typeof window>"u"?!1:window.balance?.hasConsent(n)??!1;return re(me);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hifilabs/pixel",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "BALANCE Pixel - Lightweight browser tracking script for artist fan analytics",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.esm.js",