@journium/js 1.1.0 → 1.1.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/README.md +49 -5
- package/dist/JourniumAnalytics.d.ts +0 -1
- package/dist/JourniumAnalytics.d.ts.map +1 -1
- package/dist/JourniumClient.d.ts +0 -1
- package/dist/JourniumClient.d.ts.map +1 -1
- package/dist/cdn.d.ts +40 -0
- package/dist/cdn.d.ts.map +1 -0
- package/dist/index.cjs +31 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +32 -52
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +32 -53
- package/dist/index.umd.js.map +1 -1
- package/dist/journium.js +1871 -0
- package/dist/journium.js.map +1 -0
- package/dist/journium.min.js +2 -0
- package/dist/journium.min.js.map +1 -0
- package/package.json +10 -5
package/README.md
CHANGED
|
@@ -18,10 +18,9 @@ Learn how to use Journium to power your application:
|
|
|
18
18
|
|
|
19
19
|
### Prerequisites
|
|
20
20
|
- Modern browser (ES2017+)
|
|
21
|
-
- Node.js `>=18.17.0` or later
|
|
22
21
|
- An existing Journium application. [Create your account for free](https://dashboard.journium.app/sign-up?utm_source=github&utm_medium=journium_js).
|
|
23
22
|
|
|
24
|
-
## Installation
|
|
23
|
+
## Installation Option 1: Via package manager
|
|
25
24
|
|
|
26
25
|
```bash
|
|
27
26
|
npm install @journium/js
|
|
@@ -35,13 +34,58 @@ import { init } from '@journium/js';
|
|
|
35
34
|
const journium = init({
|
|
36
35
|
publishableKey: "your-publishable-key"
|
|
37
36
|
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
For more detailed examples and configuration options, visit the [Journium documentation](https://journium.app/docs/js/).
|
|
38
40
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
## Installation Option 2: Adding the JavaScript snippet to your HTML
|
|
42
|
+
|
|
43
|
+
For websites without module bundlers (Shopify, WordPress, static HTML), use the CDN version with a single global `journium` object.
|
|
44
|
+
|
|
45
|
+
### Script Tag
|
|
46
|
+
|
|
47
|
+
```html
|
|
48
|
+
<script>
|
|
49
|
+
!function(j,o,u,r,n,i,u,m){
|
|
50
|
+
if(!o.__JV){
|
|
51
|
+
window.journium=o;
|
|
52
|
+
o._q=[];
|
|
53
|
+
o._i=null;
|
|
54
|
+
o.init=function(c,n){o._i=[c,n]};
|
|
55
|
+
var methods="track identify reset capturePageview startAutocapture stopAutocapture flush getEffectiveOptions onOptionsChange destroy".split(" ");
|
|
56
|
+
for(var k=0;k<methods.length;k++){
|
|
57
|
+
!function(method){
|
|
58
|
+
o[method]=function(){o._q.push([method].concat(Array.prototype.slice.call(arguments)));return o}
|
|
59
|
+
}(methods[k])
|
|
60
|
+
}
|
|
61
|
+
o.__JV=1;
|
|
62
|
+
(m=j.createElement("script")).type="text/javascript";
|
|
63
|
+
m.async=!0;
|
|
64
|
+
m.src="https://cdn.jsdelivr.net/npm/@journium/js@1/dist/journium.min.js";
|
|
65
|
+
m.onerror=function(){console.warn("Journium: Failed to load SDK from CDN")};
|
|
66
|
+
(i=j.getElementsByTagName("script")[0]).parentNode.insertBefore(m,i);
|
|
67
|
+
}
|
|
68
|
+
}(document,window.journium||[]);
|
|
69
|
+
|
|
70
|
+
journium.init({
|
|
71
|
+
publishableKey: 'YOUR_PUBLISHABLE_KEY'
|
|
41
72
|
});
|
|
73
|
+
</script>
|
|
42
74
|
```
|
|
43
75
|
|
|
44
|
-
|
|
76
|
+
### Usage Examples
|
|
77
|
+
|
|
78
|
+
```javascript
|
|
79
|
+
// Track events
|
|
80
|
+
journium.track('page_view', { page: 'home' });
|
|
81
|
+
journium.track('button_click', { button: 'signup' });
|
|
82
|
+
|
|
83
|
+
// Identify users
|
|
84
|
+
journium.identify('user123', {
|
|
85
|
+
email: 'user@example.com',
|
|
86
|
+
plan: 'pro'
|
|
87
|
+
});
|
|
88
|
+
```
|
|
45
89
|
|
|
46
90
|
## Other SDKs
|
|
47
91
|
|
|
@@ -34,7 +34,6 @@ export declare class JourniumAnalytics {
|
|
|
34
34
|
export declare const init: (config: JourniumConfig) => JourniumAnalytics;
|
|
35
35
|
declare const _default: {
|
|
36
36
|
init: (config: JourniumConfig) => JourniumAnalytics;
|
|
37
|
-
JourniumAnalytics: typeof JourniumAnalytics;
|
|
38
37
|
};
|
|
39
38
|
export default _default;
|
|
40
39
|
//# sourceMappingURL=JourniumAnalytics.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JourniumAnalytics.d.ts","sourceRoot":"","sources":["../src/JourniumAnalytics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAsB,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAK1F,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,kBAAkB,CAAkB;IAC5C,OAAO,CAAC,wBAAwB,CAAC,CAAa;gBAElC,MAAM,EAAE,cAAc;IAqBlC,OAAO,CAAC,yBAAyB;IAiBjC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAIhE,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAIxE,KAAK,IAAI,IAAI;IAIb,eAAe,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAI3D,gBAAgB,IAAI,IAAI;IA4BxB,eAAe,IAAI,IAAI;IAMvB;;;OAGG;IACH,OAAO,CAAC,yBAAyB;IAkCjC;;OAEG;IACH,OAAO,CAAC,mBAAmB;IA6BrB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,mBAAmB;IAInB;;OAEG;IACH,eAAe,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,IAAI,GAAG,MAAM,IAAI;IAI9E,OAAO,IAAI,IAAI;CAQhB;AAED,eAAO,MAAM,IAAI,GAAI,QAAQ,cAAc,KAAG,iBAE7C,CAAC;;mBAF2B,cAAc,KAAG,iBAAiB
|
|
1
|
+
{"version":3,"file":"JourniumAnalytics.d.ts","sourceRoot":"","sources":["../src/JourniumAnalytics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAsB,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAK1F,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,kBAAkB,CAAkB;IAC5C,OAAO,CAAC,wBAAwB,CAAC,CAAa;gBAElC,MAAM,EAAE,cAAc;IAqBlC,OAAO,CAAC,yBAAyB;IAiBjC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAIhE,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAIxE,KAAK,IAAI,IAAI;IAIb,eAAe,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAI3D,gBAAgB,IAAI,IAAI;IA4BxB,eAAe,IAAI,IAAI;IAMvB;;;OAGG;IACH,OAAO,CAAC,yBAAyB;IAkCjC;;OAEG;IACH,OAAO,CAAC,mBAAmB;IA6BrB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,mBAAmB;IAInB;;OAEG;IACH,eAAe,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,IAAI,GAAG,MAAM,IAAI;IAI9E,OAAO,IAAI,IAAI;CAQhB;AAED,eAAO,MAAM,IAAI,GAAI,QAAQ,cAAc,KAAG,iBAE7C,CAAC;;mBAF2B,cAAc,KAAG,iBAAiB;;AAI/D,wBAAwB"}
|
package/dist/JourniumClient.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JourniumClient.d.ts","sourceRoot":"","sources":["../src/JourniumClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,cAAc,
|
|
1
|
+
{"version":3,"file":"JourniumClient.d.ts","sourceRoot":"","sources":["../src/JourniumClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,cAAc,EAAyB,oBAAoB,EAAyG,MAAM,gBAAgB,CAAC;AAEnN,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,gBAAgB,CAAwB;IAChD,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,UAAU,CAA+C;IACjE,OAAO,CAAC,sBAAsB,CAAkB;IAChD,OAAO,CAAC,oBAAoB,CAAkB;IAC9C,OAAO,CAAC,eAAe,CAA0B;IACjD,OAAO,CAAC,iBAAiB,CAAU;IACnC,OAAO,CAAC,sBAAsB,CAA2D;gBAE7E,MAAM,EAAE,cAAc;IAiClC,OAAO,CAAC,iBAAiB;IAczB,OAAO,CAAC,iBAAiB;YAYX,eAAe;YAyEf,2BAA2B;IAiDzC;;OAEG;IACH,eAAe,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,IAAI,GAAG,MAAM,IAAI;IAQ9E,OAAO,CAAC,mBAAmB;IAU3B,OAAO,CAAC,mBAAmB;IA0C3B,OAAO,CAAC,eAAe;YAYT,UAAU;IA0BxB,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,IAAI;IAqB5E,KAAK,IAAI,IAAI;IAab,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,IAAI;IA2D9D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAoB5B,OAAO,IAAI,IAAI;IAQf,mBAAmB,IAAI,oBAAoB;CAG5C"}
|
package/dist/cdn.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CDN Entry Point for Journium Analytics
|
|
3
|
+
* This file provides global browser integration for script snippet usage
|
|
4
|
+
* Features: auto method stubbing, error handling, improved queue processing
|
|
5
|
+
*/
|
|
6
|
+
import { init } from './index';
|
|
7
|
+
type JourniumAnalyticsInstance = ReturnType<typeof init>;
|
|
8
|
+
interface JourniumSnippetQueue {
|
|
9
|
+
_q?: any[][];
|
|
10
|
+
_i?: [any, string?];
|
|
11
|
+
__JV?: boolean;
|
|
12
|
+
_error?: Error | null;
|
|
13
|
+
_retry?: boolean;
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}
|
|
16
|
+
interface GlobalJournium {
|
|
17
|
+
init: (config: any, instanceName?: string) => JourniumAnalyticsInstance;
|
|
18
|
+
track?: (event: string, properties?: any) => void;
|
|
19
|
+
identify?: (distinctId: string, attributes?: any) => void;
|
|
20
|
+
reset?: () => void;
|
|
21
|
+
capturePageview?: (properties?: any) => void;
|
|
22
|
+
startAutocapture?: () => void;
|
|
23
|
+
stopAutocapture?: () => void;
|
|
24
|
+
flush?: () => Promise<void>;
|
|
25
|
+
getEffectiveOptions?: () => any;
|
|
26
|
+
onOptionsChange?: (callback: (options: any) => void) => () => void;
|
|
27
|
+
destroy?: () => void;
|
|
28
|
+
[key: string]: any;
|
|
29
|
+
}
|
|
30
|
+
declare global {
|
|
31
|
+
interface Window {
|
|
32
|
+
journium?: JourniumSnippetQueue | GlobalJournium;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export { init };
|
|
36
|
+
declare const _default: {
|
|
37
|
+
init: (config: import("@journium/core").JourniumConfig) => import("./JourniumAnalytics").JourniumAnalytics;
|
|
38
|
+
};
|
|
39
|
+
export default _default;
|
|
40
|
+
//# sourceMappingURL=cdn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cdn.d.ts","sourceRoot":"","sources":["../src/cdn.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG/B,KAAK,yBAAyB,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC;AASzD,UAAU,oBAAoB;IAC5B,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC;IACb,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAGD,UAAU,cAAc;IACtB,IAAI,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,yBAAyB,CAAC;IACxE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAClD,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAC1D,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;IACnB,eAAe,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAC7C,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,mBAAmB,CAAC,EAAE,MAAM,GAAG,CAAC;IAChC,eAAe,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,KAAK,MAAM,IAAI,CAAC;IACnE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAGD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,QAAQ,CAAC,EAAE,oBAAoB,GAAG,cAAc,CAAC;KAClD;CACF;AA6OD,OAAO,EAAE,IAAI,EAAE,CAAC;;;;AAChB,wBAAwB"}
|
package/dist/index.cjs
CHANGED
|
@@ -448,9 +448,9 @@ const fetchRemoteOptions = async (apiHost, publishableKey, fetchFn) => {
|
|
|
448
448
|
'Content-Type': 'application/json',
|
|
449
449
|
},
|
|
450
450
|
});
|
|
451
|
-
if (!response.ok) {
|
|
452
|
-
|
|
453
|
-
}
|
|
451
|
+
// if (!response.ok) {
|
|
452
|
+
// throw new Error(`Options fetch failed: ${response.status} ${response.statusText}`);
|
|
453
|
+
// }
|
|
454
454
|
const data = await response.json();
|
|
455
455
|
return data;
|
|
456
456
|
}
|
|
@@ -705,18 +705,14 @@ class JourniumClient {
|
|
|
705
705
|
this.flushTimer = null;
|
|
706
706
|
this.initializationComplete = false;
|
|
707
707
|
this.initializationFailed = false;
|
|
708
|
-
this.disabled = false;
|
|
709
708
|
this.optionsChangeCallbacks = new Set();
|
|
710
|
-
// Validate required configuration
|
|
709
|
+
// Validate required configuration
|
|
711
710
|
if (!config.publishableKey || config.publishableKey.trim() === '') {
|
|
712
|
-
|
|
711
|
+
// Reject initialization with clear error
|
|
712
|
+
const errorMsg = 'Journium: publishableKey is required but not provided or is empty. SDK cannot be initialized.';
|
|
713
713
|
Logger.setDebug(true);
|
|
714
|
-
Logger.error(
|
|
715
|
-
|
|
716
|
-
this.config = { publishableKey: '', apiHost: 'https://events.journium.app' };
|
|
717
|
-
this.effectiveOptions = { debug: true };
|
|
718
|
-
this.optionsStorageKey = 'jrnm_invalid_options';
|
|
719
|
-
return;
|
|
714
|
+
Logger.error(errorMsg);
|
|
715
|
+
throw new Error(errorMsg);
|
|
720
716
|
}
|
|
721
717
|
// Set default apiHost if not provided
|
|
722
718
|
this.config = {
|
|
@@ -780,24 +776,23 @@ class JourniumClient {
|
|
|
780
776
|
}
|
|
781
777
|
else {
|
|
782
778
|
// Step 4: Fallback to cached config if fresh fetch failed
|
|
783
|
-
const cachedRemoteOptions = this.loadCachedOptions();
|
|
779
|
+
/* const cachedRemoteOptions = this.loadCachedOptions();
|
|
780
|
+
|
|
784
781
|
if (cachedRemoteOptions) {
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
return;
|
|
800
|
-
}
|
|
782
|
+
if (this.config.options) {
|
|
783
|
+
this.effectiveOptions = mergeOptions(this.config.options, cachedRemoteOptions);
|
|
784
|
+
Logger.log('Journium: Fresh config failed, using cached remote config merged with local options:', this.effectiveOptions);
|
|
785
|
+
} else {
|
|
786
|
+
this.effectiveOptions = cachedRemoteOptions;
|
|
787
|
+
Logger.log('Journium: Fresh config failed, using cached remote config:', this.effectiveOptions);
|
|
788
|
+
}
|
|
789
|
+
} else {
|
|
790
|
+
// Step 5: No remote config and no cached config - initialization fails
|
|
791
|
+
Logger.error('Journium: Initialization failed - no remote config available and no cached config found');
|
|
792
|
+
this.initializationFailed = true;
|
|
793
|
+
this.initializationComplete = false;
|
|
794
|
+
return;
|
|
795
|
+
} */
|
|
801
796
|
}
|
|
802
797
|
// Step 6: Update identity manager session timeout if provided
|
|
803
798
|
if (this.effectiveOptions.sessionTimeout) {
|
|
@@ -837,11 +832,15 @@ class JourniumClient {
|
|
|
837
832
|
// Race fetch against timeout
|
|
838
833
|
const fetchPromise = fetchRemoteOptions(this.config.apiHost, this.config.publishableKey);
|
|
839
834
|
const remoteOptionsResponse = await Promise.race([fetchPromise, timeoutPromise]);
|
|
840
|
-
if (remoteOptionsResponse && remoteOptionsResponse.success) {
|
|
835
|
+
if (remoteOptionsResponse && remoteOptionsResponse.status === 'success') {
|
|
841
836
|
Logger.log('Journium: Successfully fetched fresh remote config:', remoteOptionsResponse.config);
|
|
842
|
-
return remoteOptionsResponse.config;
|
|
837
|
+
return remoteOptionsResponse.config || null;
|
|
843
838
|
}
|
|
844
|
-
else {
|
|
839
|
+
else if (remoteOptionsResponse && remoteOptionsResponse.status === 'error' && remoteOptionsResponse.errorCode === 'J_ERR_TENANT_NOT_FOUND') {
|
|
840
|
+
Logger.error('Journium: Invalid publishableKey is being used.');
|
|
841
|
+
return null;
|
|
842
|
+
}
|
|
843
|
+
{
|
|
845
844
|
throw new Error('Remote config fetch unsuccessful');
|
|
846
845
|
}
|
|
847
846
|
}
|
|
@@ -949,11 +948,6 @@ class JourniumClient {
|
|
|
949
948
|
}
|
|
950
949
|
}
|
|
951
950
|
identify(distinctId, attributes = {}) {
|
|
952
|
-
// Don't identify if SDK is not properly configured or disabled
|
|
953
|
-
if (this.disabled || !this.config || !this.config.publishableKey) {
|
|
954
|
-
Logger.warn('Journium: identify() call rejected - SDK not ready or disabled');
|
|
955
|
-
return;
|
|
956
|
-
}
|
|
957
951
|
// Don't identify if initialization failed
|
|
958
952
|
if (this.initializationFailed) {
|
|
959
953
|
Logger.warn('Journium: identify() call rejected - initialization failed');
|
|
@@ -970,11 +964,6 @@ class JourniumClient {
|
|
|
970
964
|
Logger.log('Journium: User identified', { distinctId, attributes, previousDistinctId });
|
|
971
965
|
}
|
|
972
966
|
reset() {
|
|
973
|
-
// Don't reset if SDK is not properly configured or disabled
|
|
974
|
-
if (this.disabled || !this.config || !this.config.publishableKey) {
|
|
975
|
-
Logger.warn('Journium: reset() call rejected - SDK not ready or disabled');
|
|
976
|
-
return;
|
|
977
|
-
}
|
|
978
967
|
// Don't reset if initialization failed
|
|
979
968
|
if (this.initializationFailed) {
|
|
980
969
|
Logger.warn('Journium: reset() call rejected - initialization failed');
|
|
@@ -985,11 +974,6 @@ class JourniumClient {
|
|
|
985
974
|
Logger.log('Journium: User identity reset');
|
|
986
975
|
}
|
|
987
976
|
track(event, properties = {}) {
|
|
988
|
-
// Don't track if SDK is not properly configured or disabled
|
|
989
|
-
if (this.disabled || !this.config || !this.config.publishableKey) {
|
|
990
|
-
Logger.warn('Journium: track() call rejected - SDK not ready or disabled');
|
|
991
|
-
return;
|
|
992
|
-
}
|
|
993
977
|
// Create minimal event without identity properties (will be added later if staging)
|
|
994
978
|
const journiumEvent = {
|
|
995
979
|
uuid: generateUuidv7(),
|
|
@@ -1041,10 +1025,6 @@ class JourniumClient {
|
|
|
1041
1025
|
}
|
|
1042
1026
|
}
|
|
1043
1027
|
async flush() {
|
|
1044
|
-
// Don't flush if SDK is not properly configured
|
|
1045
|
-
if (!this.config || !this.config.publishableKey) {
|
|
1046
|
-
return;
|
|
1047
|
-
}
|
|
1048
1028
|
// Don't flush if initialization failed
|
|
1049
1029
|
if (this.initializationFailed) {
|
|
1050
1030
|
Logger.warn('Journium: flush() call rejected - initialization failed');
|
|
@@ -1669,7 +1649,6 @@ const init = (config) => {
|
|
|
1669
1649
|
|
|
1670
1650
|
exports.AutocaptureTracker = AutocaptureTracker;
|
|
1671
1651
|
exports.BrowserIdentityManager = BrowserIdentityManager;
|
|
1672
|
-
exports.JourniumAnalytics = JourniumAnalytics;
|
|
1673
1652
|
exports.JourniumClient = JourniumClient;
|
|
1674
1653
|
exports.Logger = Logger;
|
|
1675
1654
|
exports.PageviewTracker = PageviewTracker;
|