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