@journium/js 1.0.0 → 1.0.2

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.cjs CHANGED
@@ -427,9 +427,9 @@ const isNode = () => {
427
427
  var _a;
428
428
  return typeof process !== 'undefined' && !!((_a = process.versions) === null || _a === void 0 ? void 0 : _a.node);
429
429
  };
430
- const fetchRemoteConfig = async (apiHost, token, fetchFn) => {
430
+ const fetchRemoteOptions = async (apiHost, publishableKey, fetchFn) => {
431
431
  const endpoint = '/v1/configs';
432
- const url = `${apiHost}${endpoint}?ingestion_key=${encodeURIComponent(token)}`;
432
+ const url = `${apiHost}${endpoint}?ingestion_key=${encodeURIComponent(publishableKey)}`;
433
433
  try {
434
434
  let fetch = fetchFn;
435
435
  if (!fetch) {
@@ -449,36 +449,43 @@ const fetchRemoteConfig = async (apiHost, token, fetchFn) => {
449
449
  },
450
450
  });
451
451
  if (!response.ok) {
452
- throw new Error(`Config fetch failed: ${response.status} ${response.statusText}`);
452
+ throw new Error(`Options fetch failed: ${response.status} ${response.statusText}`);
453
453
  }
454
454
  const data = await response.json();
455
455
  return data;
456
456
  }
457
457
  catch (error) {
458
- console.warn('Failed to fetch remote config:', error);
458
+ console.warn('Failed to fetch remote options:', error);
459
459
  return null;
460
460
  }
461
461
  };
462
- const mergeConfigs = (localConfig, remoteConfig) => {
463
- if (!remoteConfig) {
464
- return localConfig;
462
+ const mergeOptions = (localOptions, remoteOptions) => {
463
+ if (!remoteOptions && !localOptions) {
464
+ return {};
465
465
  }
466
- // Deep merge remote config into local config
467
- // Remote config takes precedence over local config
468
- const merged = { ...localConfig };
466
+ if (!remoteOptions) {
467
+ return localOptions;
468
+ }
469
+ if (!localOptions) {
470
+ return remoteOptions;
471
+ }
472
+ // Deep merge local options into remote options
473
+ // Local options takes precedence over remote options
474
+ const merged = { ...remoteOptions };
469
475
  // Handle primitive values
470
- Object.keys(remoteConfig).forEach(key => {
471
- if (remoteConfig[key] !== undefined && remoteConfig[key] !== null) {
472
- if (typeof remoteConfig[key] === 'object' && !Array.isArray(remoteConfig[key])) {
473
- // Deep merge objects
476
+ Object.keys(localOptions).forEach(key => {
477
+ const localValue = localOptions[key];
478
+ if (localValue !== undefined && localValue !== null) {
479
+ if (typeof localValue === 'object' && !Array.isArray(localValue)) {
480
+ // Deep merge objects - local options overrides remote
474
481
  merged[key] = {
475
482
  ...(merged[key] || {}),
476
- ...remoteConfig[key]
483
+ ...localValue
477
484
  };
478
485
  }
479
486
  else {
480
- // Override primitive values and arrays
481
- merged[key] = remoteConfig[key];
487
+ // Override primitive values and arrays with local options
488
+ merged[key] = localValue;
482
489
  }
483
490
  }
484
491
  });
@@ -487,14 +494,14 @@ const mergeConfigs = (localConfig, remoteConfig) => {
487
494
 
488
495
  const DEFAULT_SESSION_TIMEOUT = 30 * 60 * 1000; // 30 minutes in ms
489
496
  class BrowserIdentityManager {
490
- constructor(sessionTimeout, token) {
497
+ constructor(sessionTimeout, publishableKey) {
491
498
  this.identity = null;
492
499
  this.sessionTimeout = DEFAULT_SESSION_TIMEOUT;
493
500
  if (sessionTimeout) {
494
501
  this.sessionTimeout = sessionTimeout;
495
502
  }
496
- // Generate storage key with token pattern: jrnm_<token>_journium
497
- this.storageKey = token ? `jrnm_${token}_journium` : '__journium_identity';
503
+ // Generate storage key with publishableKey pattern: jrnm_<publishableKey>_journium
504
+ this.storageKey = publishableKey ? `jrnm_${publishableKey}_journium` : '__journium_identity';
498
505
  this.loadOrCreateIdentity();
499
506
  }
500
507
  loadOrCreateIdentity() {
@@ -666,132 +673,122 @@ class JourniumClient {
666
673
  this.flushTimer = null;
667
674
  this.initialized = false;
668
675
  // Validate required configuration
669
- if (!config.token) {
670
- console.error('Journium: token is required but not provided. SDK will not function.');
676
+ if (!config.publishableKey) {
677
+ console.error('Journium: publishableKey is required but not provided. SDK will not function.');
671
678
  return;
672
679
  }
673
- if (!config.apiHost) {
674
- console.error('Journium: apiHost is required but not provided. SDK will not function.');
675
- return;
680
+ // Set default apiHost if not provided
681
+ this.config = {
682
+ ...config,
683
+ apiHost: config.apiHost || 'https://events.journium.app'
684
+ };
685
+ // Generate storage key for options caching
686
+ this.optionsStorageKey = `jrnm_${config.publishableKey}_options`;
687
+ // Generate default values
688
+ const defaultOptions = {
689
+ debug: false,
690
+ flushAt: 20,
691
+ flushInterval: 10000,
692
+ sessionTimeout: 30 * 60 * 1000, // 30 minutes
693
+ };
694
+ // Initialize effective options with local options taking precedence over defaults
695
+ this.effectiveOptions = { ...defaultOptions };
696
+ if (this.config.options) {
697
+ this.effectiveOptions = mergeOptions(defaultOptions, this.config.options);
676
698
  }
677
- this.config = config;
678
- // Generate storage key for config caching
679
- this.configStorageKey = `jrnm_${config.token}_config`;
680
699
  // Initialize identity manager
681
- this.identityManager = new BrowserIdentityManager(this.config.sessionTimeout, this.config.token);
700
+ this.identityManager = new BrowserIdentityManager(this.effectiveOptions.sessionTimeout, this.config.publishableKey);
682
701
  // Initialize synchronously with cached config, fetch fresh config in background
683
702
  this.initializeSync();
684
- this.fetchRemoteConfigAsync();
703
+ this.fetchRemoteOptionsAsync();
685
704
  }
686
- loadCachedConfig() {
705
+ loadCachedOptions() {
706
+ var _a;
687
707
  if (typeof window === 'undefined' || !window.localStorage) {
688
708
  return null;
689
709
  }
690
710
  try {
691
- const cached = window.localStorage.getItem(this.configStorageKey);
711
+ const cached = window.localStorage.getItem(this.optionsStorageKey);
692
712
  return cached ? JSON.parse(cached) : null;
693
713
  }
694
714
  catch (error) {
695
- if (this.config.debug) {
715
+ if ((_a = this.effectiveOptions) === null || _a === void 0 ? void 0 : _a.debug) {
696
716
  console.warn('Journium: Failed to load cached config:', error);
697
717
  }
698
718
  return null;
699
719
  }
700
720
  }
701
- saveCachedConfig(config) {
721
+ saveCachedOptions(options) {
722
+ var _a;
702
723
  if (typeof window === 'undefined' || !window.localStorage) {
703
724
  return;
704
725
  }
705
726
  try {
706
- window.localStorage.setItem(this.configStorageKey, JSON.stringify(config));
727
+ window.localStorage.setItem(this.optionsStorageKey, JSON.stringify(options));
707
728
  }
708
729
  catch (error) {
709
- if (this.config.debug) {
730
+ if ((_a = this.effectiveOptions) === null || _a === void 0 ? void 0 : _a.debug) {
710
731
  console.warn('Journium: Failed to save config to cache:', error);
711
732
  }
712
733
  }
713
734
  }
714
735
  initializeSync() {
715
- var _a, _b, _c;
716
- // Step 1: Load cached config from localStorage (synchronous)
717
- const cachedConfig = this.loadCachedConfig();
718
- // Step 2: Apply cached config immediately, or use defaults
719
- const localOnlyConfig = {
720
- apiHost: this.config.apiHost,
721
- token: this.config.token,
722
- };
723
- if (cachedConfig) {
724
- // Use cached remote config
725
- this.config = {
726
- ...localOnlyConfig,
727
- ...cachedConfig,
728
- };
729
- if (this.config.debug) {
730
- console.log('Journium: Using cached configuration:', cachedConfig);
736
+ // Step 1: Load cached remote options from localStorage (synchronous)
737
+ const cachedRemoteOptions = this.loadCachedOptions();
738
+ // Step 2: If no local options provided, use cached remote options
739
+ if (!this.config.options && cachedRemoteOptions) {
740
+ this.effectiveOptions = cachedRemoteOptions;
741
+ if (this.effectiveOptions.debug) {
742
+ console.log('Journium: Using cached remote options:', cachedRemoteOptions);
731
743
  }
732
744
  }
733
- else {
734
- // Use defaults for first-time initialization
735
- this.config = {
736
- ...this.config,
737
- debug: (_a = this.config.debug) !== null && _a !== void 0 ? _a : false,
738
- flushAt: (_b = this.config.flushAt) !== null && _b !== void 0 ? _b : 20,
739
- flushInterval: (_c = this.config.flushInterval) !== null && _c !== void 0 ? _c : 10000,
740
- };
741
- if (this.config.debug) {
742
- console.log('Journium: No cached config found, using defaults');
743
- }
744
- }
745
- // Update session timeout from config
746
- if (this.config.sessionTimeout) {
747
- this.identityManager.updateSessionTimeout(this.config.sessionTimeout);
748
- }
749
745
  // Step 3: Mark as initialized immediately - no need to wait for remote fetch
750
746
  this.initialized = true;
751
747
  // Step 4: Start flush timer immediately
752
- if (this.config.flushInterval && this.config.flushInterval > 0) {
748
+ if (this.effectiveOptions.flushInterval && this.effectiveOptions.flushInterval > 0) {
753
749
  this.startFlushTimer();
754
750
  }
755
- if (this.config.debug) {
756
- console.log('Journium: Client initialized and ready to track events');
751
+ if (this.effectiveOptions.debug) {
752
+ console.log('Journium: Client initialized with effective options:', this.effectiveOptions);
757
753
  }
758
754
  }
759
- async fetchRemoteConfigAsync() {
755
+ async fetchRemoteOptionsAsync() {
760
756
  // Fetch fresh config in background
761
- if (this.config.token) {
762
- await this.fetchAndCacheRemoteConfig();
757
+ if (this.config.publishableKey) {
758
+ await this.fetchAndCacheRemoteOptions();
763
759
  }
764
760
  }
765
- async fetchAndCacheRemoteConfig() {
761
+ async fetchAndCacheRemoteOptions() {
766
762
  try {
767
- if (this.config.debug) {
763
+ if (this.effectiveOptions.debug) {
768
764
  console.log('Journium: Fetching remote configuration in background...');
769
765
  }
770
- const remoteConfigResponse = await fetchRemoteConfig(this.config.apiHost, this.config.token);
771
- if (remoteConfigResponse && remoteConfigResponse.success) {
772
- // Save to cache for next session
773
- this.saveCachedConfig(remoteConfigResponse.config);
774
- // Apply fresh config to current session
775
- const localOnlyConfig = {
776
- apiHost: this.config.apiHost,
777
- token: this.config.token,
778
- };
779
- this.config = {
780
- ...localOnlyConfig,
781
- ...remoteConfigResponse.config,
782
- };
783
- // Update session timeout if provided in fresh config
784
- if (remoteConfigResponse.config.sessionTimeout) {
785
- this.identityManager.updateSessionTimeout(remoteConfigResponse.config.sessionTimeout);
766
+ const remoteOptionsResponse = await fetchRemoteOptions(this.config.apiHost, this.config.publishableKey);
767
+ if (remoteOptionsResponse && remoteOptionsResponse.success) {
768
+ // Save remote config to cache for next session
769
+ this.saveCachedOptions(remoteOptionsResponse.config);
770
+ // Update effective options: local options (if provided) overrides fresh remote options
771
+ if (!this.config.options) {
772
+ // No local options provided, use fresh remote options
773
+ this.effectiveOptions = remoteOptionsResponse.config;
774
+ }
775
+ else {
776
+ // Local options provided, merge it over fresh remote options
777
+ this.effectiveOptions = mergeOptions(remoteOptionsResponse.config, this.config.options);
786
778
  }
787
- if (this.config.debug) {
788
- console.log('Journium: Background remote configuration applied:', remoteConfigResponse.config);
779
+ // Update session timeout if provided in fresh effective options
780
+ if (this.effectiveOptions.sessionTimeout) {
781
+ this.identityManager.updateSessionTimeout(this.effectiveOptions.sessionTimeout);
782
+ }
783
+ if (this.effectiveOptions.debug) {
784
+ console.log('Journium: Background remote options applied:', remoteOptionsResponse.config);
785
+ console.log('Journium: New effective options:', this.effectiveOptions);
789
786
  }
790
787
  }
791
788
  }
792
789
  catch (error) {
793
- if (this.config.debug) {
794
- console.warn('Journium: Background remote config fetch failed:', error);
790
+ if (this.effectiveOptions.debug) {
791
+ console.warn('Journium: Background remote options fetch failed:', error);
795
792
  }
796
793
  }
797
794
  }
@@ -802,7 +799,7 @@ class JourniumClient {
802
799
  // Use universal setInterval (works in both browser and Node.js)
803
800
  this.flushTimer = setInterval(() => {
804
801
  this.flush();
805
- }, this.config.flushInterval);
802
+ }, this.effectiveOptions.flushInterval);
806
803
  }
807
804
  async sendEvents(events) {
808
805
  if (!events.length)
@@ -812,7 +809,7 @@ class JourniumClient {
812
809
  method: 'POST',
813
810
  headers: {
814
811
  'Content-Type': 'application/json',
815
- 'Authorization': `Bearer ${this.config.token}`,
812
+ 'Authorization': `Bearer ${this.config.publishableKey}`,
816
813
  },
817
814
  body: JSON.stringify({
818
815
  events,
@@ -821,12 +818,12 @@ class JourniumClient {
821
818
  if (!response.ok) {
822
819
  throw new Error(`HTTP ${response.status}: ${response.statusText}`);
823
820
  }
824
- if (this.config.debug) {
821
+ if (this.effectiveOptions.debug) {
825
822
  console.log('Journium: Successfully sent events', events);
826
823
  }
827
824
  }
828
825
  catch (error) {
829
- if (this.config.debug) {
826
+ if (this.effectiveOptions.debug) {
830
827
  console.error('Journium: Failed to send events', error);
831
828
  }
832
829
  throw error;
@@ -835,8 +832,8 @@ class JourniumClient {
835
832
  identify(distinctId, attributes = {}) {
836
833
  var _a;
837
834
  // Don't identify if SDK is not properly configured
838
- if (!this.config || !this.config.token || !this.config.apiHost || !this.initialized) {
839
- if ((_a = this.config) === null || _a === void 0 ? void 0 : _a.debug) {
835
+ if (!this.config || !this.config.publishableKey || !this.initialized) {
836
+ if ((_a = this.effectiveOptions) === null || _a === void 0 ? void 0 : _a.debug) {
840
837
  console.warn('Journium: identify() call rejected - SDK not ready');
841
838
  }
842
839
  return;
@@ -849,30 +846,30 @@ class JourniumClient {
849
846
  $anon_distinct_id: previousDistinctId,
850
847
  };
851
848
  this.track('$identify', identifyProperties);
852
- if (this.config.debug) {
849
+ if (this.effectiveOptions.debug) {
853
850
  console.log('Journium: User identified', { distinctId, attributes, previousDistinctId });
854
851
  }
855
852
  }
856
853
  reset() {
857
854
  var _a;
858
855
  // Don't reset if SDK is not properly configured
859
- if (!this.config || !this.config.token || !this.config.apiHost || !this.initialized) {
860
- if ((_a = this.config) === null || _a === void 0 ? void 0 : _a.debug) {
856
+ if (!this.config || !this.config.publishableKey || !this.initialized) {
857
+ if ((_a = this.effectiveOptions) === null || _a === void 0 ? void 0 : _a.debug) {
861
858
  console.warn('Journium: reset() call rejected - SDK not ready');
862
859
  }
863
860
  return;
864
861
  }
865
862
  // Reset identity in identity manager
866
863
  this.identityManager.reset();
867
- if (this.config.debug) {
864
+ if (this.effectiveOptions.debug) {
868
865
  console.log('Journium: User identity reset');
869
866
  }
870
867
  }
871
868
  track(event, properties = {}) {
872
869
  var _a;
873
870
  // Don't track if SDK is not properly configured
874
- if (!this.config || !this.config.token || !this.config.apiHost || !this.initialized) {
875
- if ((_a = this.config) === null || _a === void 0 ? void 0 : _a.debug) {
871
+ if (!this.config || !this.config.publishableKey || !this.initialized) {
872
+ if ((_a = this.effectiveOptions) === null || _a === void 0 ? void 0 : _a.debug) {
876
873
  console.warn('Journium: track() call rejected - SDK not ready');
877
874
  }
878
875
  return;
@@ -894,22 +891,22 @@ class JourniumClient {
894
891
  };
895
892
  const journiumEvent = {
896
893
  uuid: generateUuidv7(),
897
- ingestion_key: this.config.token,
894
+ ingestion_key: this.config.publishableKey,
898
895
  client_timestamp: getCurrentTimestamp(),
899
896
  event,
900
897
  properties: eventProperties,
901
898
  };
902
899
  this.queue.push(journiumEvent);
903
- if (this.config.debug) {
900
+ if (this.effectiveOptions.debug) {
904
901
  console.log('Journium: Event tracked', journiumEvent);
905
902
  }
906
- if (this.queue.length >= this.config.flushAt) {
903
+ if (this.queue.length >= this.effectiveOptions.flushAt) {
907
904
  this.flush();
908
905
  }
909
906
  }
910
907
  async flush() {
911
908
  // Don't flush if SDK is not properly configured
912
- if (!this.config || !this.config.token || !this.config.apiHost) {
909
+ if (!this.config || !this.config.publishableKey) {
913
910
  return;
914
911
  }
915
912
  if (this.queue.length === 0)
@@ -931,6 +928,9 @@ class JourniumClient {
931
928
  }
932
929
  this.flush();
933
930
  }
931
+ getEffectiveOptions() {
932
+ return this.effectiveOptions;
933
+ }
934
934
  }
935
935
 
936
936
  class PageviewTracker {
@@ -956,7 +956,7 @@ class PageviewTracker {
956
956
  this.client.track('$pageview', properties);
957
957
  this.lastUrl = currentUrl;
958
958
  }
959
- startAutoCapture() {
959
+ startAutocapture() {
960
960
  this.capturePageview();
961
961
  if (typeof window !== 'undefined') {
962
962
  // Store original methods for cleanup
@@ -976,7 +976,7 @@ class PageviewTracker {
976
976
  window.addEventListener('popstate', this.popStateHandler);
977
977
  }
978
978
  }
979
- stopAutoCapture() {
979
+ stopAutocapture() {
980
980
  if (typeof window !== 'undefined') {
981
981
  // Restore original methods
982
982
  if (this.originalPushState) {
@@ -996,11 +996,11 @@ class PageviewTracker {
996
996
  }
997
997
 
998
998
  class AutocaptureTracker {
999
- constructor(client, config = {}) {
999
+ constructor(client, options = {}) {
1000
1000
  this.listeners = new Map();
1001
1001
  this.isActive = false;
1002
1002
  this.client = client;
1003
- this.config = {
1003
+ this.options = {
1004
1004
  captureClicks: true,
1005
1005
  captureFormSubmits: true,
1006
1006
  captureFormChanges: true,
@@ -1008,7 +1008,7 @@ class AutocaptureTracker {
1008
1008
  ignoreClasses: ['journium-ignore'],
1009
1009
  ignoreElements: ['script', 'style', 'noscript'],
1010
1010
  captureContentText: true,
1011
- ...config,
1011
+ ...options,
1012
1012
  };
1013
1013
  }
1014
1014
  start() {
@@ -1016,16 +1016,16 @@ class AutocaptureTracker {
1016
1016
  return;
1017
1017
  }
1018
1018
  this.isActive = true;
1019
- if (this.config.captureClicks) {
1019
+ if (this.options.captureClicks) {
1020
1020
  this.addClickListener();
1021
1021
  }
1022
- if (this.config.captureFormSubmits) {
1022
+ if (this.options.captureFormSubmits) {
1023
1023
  this.addFormSubmitListener();
1024
1024
  }
1025
- if (this.config.captureFormChanges) {
1025
+ if (this.options.captureFormChanges) {
1026
1026
  this.addFormChangeListener();
1027
1027
  }
1028
- if (this.config.captureTextSelection) {
1028
+ if (this.options.captureTextSelection) {
1029
1029
  this.addTextSelectionListener();
1030
1030
  }
1031
1031
  }
@@ -1109,17 +1109,17 @@ class AutocaptureTracker {
1109
1109
  return true;
1110
1110
  }
1111
1111
  // Check if element should be ignored by tag name
1112
- if ((_a = this.config.ignoreElements) === null || _a === void 0 ? void 0 : _a.includes(element.tagName.toLowerCase())) {
1112
+ if ((_a = this.options.ignoreElements) === null || _a === void 0 ? void 0 : _a.includes(element.tagName.toLowerCase())) {
1113
1113
  return true;
1114
1114
  }
1115
1115
  // Check if element has ignore classes
1116
- if ((_b = this.config.ignoreClasses) === null || _b === void 0 ? void 0 : _b.some(cls => element.classList.contains(cls))) {
1116
+ if ((_b = this.options.ignoreClasses) === null || _b === void 0 ? void 0 : _b.some(cls => element.classList.contains(cls))) {
1117
1117
  return true;
1118
1118
  }
1119
1119
  // Check parent elements for ignore classes
1120
1120
  let parent = element.parentElement;
1121
1121
  while (parent) {
1122
- if ((_c = this.config.ignoreClasses) === null || _c === void 0 ? void 0 : _c.some(cls => parent.classList.contains(cls))) {
1122
+ if ((_c = this.options.ignoreClasses) === null || _c === void 0 ? void 0 : _c.some(cls => parent.classList.contains(cls))) {
1123
1123
  return true;
1124
1124
  }
1125
1125
  parent = parent.parentElement;
@@ -1151,7 +1151,7 @@ class AutocaptureTracker {
1151
1151
  }
1152
1152
  });
1153
1153
  // Element content
1154
- if (this.config.captureContentText) {
1154
+ if (this.options.captureContentText) {
1155
1155
  const text = this.getElementText(element);
1156
1156
  if (text) {
1157
1157
  properties.$element_text = text.substring(0, 200); // Limit text length
@@ -1338,17 +1338,18 @@ class AutocaptureTracker {
1338
1338
  }
1339
1339
  }
1340
1340
 
1341
- class Journium {
1341
+ class JourniumAnalytics {
1342
1342
  constructor(config) {
1343
+ var _a, _b;
1343
1344
  this.config = config;
1344
1345
  this.client = new JourniumClient(config);
1345
1346
  this.pageviewTracker = new PageviewTracker(this.client);
1346
- const autocaptureConfig = this.resolveAutocaptureConfig(config.autocapture);
1347
- this.autocaptureTracker = new AutocaptureTracker(this.client, autocaptureConfig);
1348
- // Store resolved autocapture state for startAutoCapture method
1349
- this.autocaptureEnabled = config.autocapture !== false;
1347
+ const autocaptureOptions = this.resolveAutocaptureOptions((_a = config.options) === null || _a === void 0 ? void 0 : _a.autocapture);
1348
+ this.autocaptureTracker = new AutocaptureTracker(this.client, autocaptureOptions);
1349
+ // Store resolved autocapture state for startAutocapture method
1350
+ this.autocaptureEnabled = ((_b = config.options) === null || _b === void 0 ? void 0 : _b.autocapture) !== false;
1350
1351
  }
1351
- resolveAutocaptureConfig(autocapture) {
1352
+ resolveAutocaptureOptions(autocapture) {
1352
1353
  if (autocapture === false) {
1353
1354
  return {
1354
1355
  captureClicks: false,
@@ -1374,44 +1375,43 @@ class Journium {
1374
1375
  capturePageview(properties) {
1375
1376
  this.pageviewTracker.capturePageview(properties);
1376
1377
  }
1377
- startAutoCapture() {
1378
- this.pageviewTracker.startAutoCapture();
1378
+ startAutocapture() {
1379
+ // Check if automatic pageview tracking is enabled (defaults to true)
1380
+ const effectiveOptions = this.client.getEffectiveOptions();
1381
+ const autoTrackPageviews = effectiveOptions.autoTrackPageviews !== false;
1382
+ if (autoTrackPageviews) {
1383
+ this.pageviewTracker.startAutocapture();
1384
+ }
1379
1385
  if (this.autocaptureEnabled) {
1380
1386
  this.autocaptureTracker.start();
1381
1387
  }
1382
1388
  }
1383
- stopAutoCapture() {
1384
- this.pageviewTracker.stopAutoCapture();
1385
- this.autocaptureTracker.stop();
1386
- }
1387
- // Aliases for consistency (deprecated - use startAutoCapture)
1388
- /** @deprecated Use startAutoCapture() instead */
1389
- startAutocapture() {
1390
- this.startAutoCapture();
1391
- }
1392
- /** @deprecated Use stopAutoCapture() instead */
1393
1389
  stopAutocapture() {
1394
- this.stopAutoCapture();
1390
+ this.pageviewTracker.stopAutocapture();
1391
+ this.autocaptureTracker.stop();
1395
1392
  }
1396
1393
  async flush() {
1397
1394
  return this.client.flush();
1398
1395
  }
1396
+ getEffectiveOptions() {
1397
+ return this.client.getEffectiveOptions();
1398
+ }
1399
1399
  destroy() {
1400
- this.pageviewTracker.stopAutoCapture();
1400
+ this.pageviewTracker.stopAutocapture();
1401
1401
  this.autocaptureTracker.stop();
1402
1402
  this.client.destroy();
1403
1403
  }
1404
1404
  }
1405
1405
  const init = (config) => {
1406
- return new Journium(config);
1406
+ return new JourniumAnalytics(config);
1407
1407
  };
1408
1408
 
1409
1409
  exports.AutocaptureTracker = AutocaptureTracker;
1410
1410
  exports.BrowserIdentityManager = BrowserIdentityManager;
1411
- exports.Journium = Journium;
1411
+ exports.JourniumAnalytics = JourniumAnalytics;
1412
1412
  exports.JourniumClient = JourniumClient;
1413
1413
  exports.PageviewTracker = PageviewTracker;
1414
- exports.fetchRemoteConfig = fetchRemoteConfig;
1414
+ exports.fetchRemoteOptions = fetchRemoteOptions;
1415
1415
  exports.generateId = generateId;
1416
1416
  exports.generateUuidv7 = generateUuidv7;
1417
1417
  exports.getCurrentTimestamp = getCurrentTimestamp;
@@ -1421,5 +1421,5 @@ exports.getReferrer = getReferrer;
1421
1421
  exports.init = init;
1422
1422
  exports.isBrowser = isBrowser;
1423
1423
  exports.isNode = isNode;
1424
- exports.mergeConfigs = mergeConfigs;
1424
+ exports.mergeOptions = mergeOptions;
1425
1425
  //# sourceMappingURL=index.cjs.map