saasco-sdk 0.1.33 → 0.1.34
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/index.cjs.js +12 -7
- package/index.esm.js +12 -7
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -7,7 +7,7 @@ var psl = require('psl');
|
|
|
7
7
|
var uuid$1 = require('@lukeed/uuid');
|
|
8
8
|
var zod = require('zod');
|
|
9
9
|
|
|
10
|
-
var version = "0.1.
|
|
10
|
+
var version = "0.1.34";
|
|
11
11
|
|
|
12
12
|
const timezones = {
|
|
13
13
|
'Asia/Barnaul': 'RU',
|
|
@@ -566,7 +566,9 @@ function createFacebookPixelIntegration(config) {
|
|
|
566
566
|
environments: ['client'],
|
|
567
567
|
init: () => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
568
568
|
if (isServer$1) {
|
|
569
|
-
|
|
569
|
+
// On server, Facebook Pixel is a no-op but doesn't throw
|
|
570
|
+
// This allows the integration to be registered but remain inactive
|
|
571
|
+
return;
|
|
570
572
|
}
|
|
571
573
|
// Check if Facebook Pixel is already loaded
|
|
572
574
|
if (window.fbq || window._fbq) {
|
|
@@ -659,7 +661,10 @@ function createFacebookPixelIntegration(config) {
|
|
|
659
661
|
}
|
|
660
662
|
function getFacebookEventName(eventName, eventMapping) {
|
|
661
663
|
// Convert default saasco page view event by default
|
|
662
|
-
if (eventName === 'Page View')
|
|
664
|
+
if (eventName === 'Page View') {
|
|
665
|
+
const mappedEvent = 'ViewContent';
|
|
666
|
+
return mappedEvent;
|
|
667
|
+
}
|
|
663
668
|
if (!eventMapping) return eventName;
|
|
664
669
|
return eventMapping[eventName] || eventName;
|
|
665
670
|
}
|
|
@@ -1317,6 +1322,10 @@ class Saasco {
|
|
|
1317
1322
|
});
|
|
1318
1323
|
// Set initial context
|
|
1319
1324
|
this.integrationManager.setContext({});
|
|
1325
|
+
// Initialize integrations immediately (works on both client and server)
|
|
1326
|
+
this.initIntegrations().catch(error => {
|
|
1327
|
+
this.logger.log('Error initializing integrations:', error);
|
|
1328
|
+
});
|
|
1320
1329
|
}
|
|
1321
1330
|
init() {
|
|
1322
1331
|
if (this.isInitialized) {
|
|
@@ -1332,10 +1341,6 @@ class Saasco {
|
|
|
1332
1341
|
this.logger.log('Saasco initialized', this.config);
|
|
1333
1342
|
if (this.config.debug) this.logger.log('Debug mode active. This will log all events to the console.');
|
|
1334
1343
|
if (!this.config.enabled) this.logger.log('Analytics is disabled. No requests will be sent to the server.');
|
|
1335
|
-
// Initialize integrations asynchronously
|
|
1336
|
-
this.initIntegrations().catch(error => {
|
|
1337
|
-
this.logger.log('Error initializing integrations:', error);
|
|
1338
|
-
});
|
|
1339
1344
|
this.initAutoPageTracking();
|
|
1340
1345
|
this.isInitialized = true;
|
|
1341
1346
|
}
|
package/index.esm.js
CHANGED
|
@@ -3,7 +3,7 @@ import { isValid, parse } from 'psl';
|
|
|
3
3
|
import { v4 } from '@lukeed/uuid';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
|
|
6
|
-
var version = "0.1.
|
|
6
|
+
var version = "0.1.34";
|
|
7
7
|
|
|
8
8
|
const timezones = {
|
|
9
9
|
'Asia/Barnaul': 'RU',
|
|
@@ -562,7 +562,9 @@ function createFacebookPixelIntegration(config) {
|
|
|
562
562
|
environments: ['client'],
|
|
563
563
|
init: () => __awaiter(this, void 0, void 0, function* () {
|
|
564
564
|
if (isServer$1) {
|
|
565
|
-
|
|
565
|
+
// On server, Facebook Pixel is a no-op but doesn't throw
|
|
566
|
+
// This allows the integration to be registered but remain inactive
|
|
567
|
+
return;
|
|
566
568
|
}
|
|
567
569
|
// Check if Facebook Pixel is already loaded
|
|
568
570
|
if (window.fbq || window._fbq) {
|
|
@@ -655,7 +657,10 @@ function createFacebookPixelIntegration(config) {
|
|
|
655
657
|
}
|
|
656
658
|
function getFacebookEventName(eventName, eventMapping) {
|
|
657
659
|
// Convert default saasco page view event by default
|
|
658
|
-
if (eventName === 'Page View')
|
|
660
|
+
if (eventName === 'Page View') {
|
|
661
|
+
const mappedEvent = 'ViewContent';
|
|
662
|
+
return mappedEvent;
|
|
663
|
+
}
|
|
659
664
|
if (!eventMapping) return eventName;
|
|
660
665
|
return eventMapping[eventName] || eventName;
|
|
661
666
|
}
|
|
@@ -1313,6 +1318,10 @@ class Saasco {
|
|
|
1313
1318
|
});
|
|
1314
1319
|
// Set initial context
|
|
1315
1320
|
this.integrationManager.setContext({});
|
|
1321
|
+
// Initialize integrations immediately (works on both client and server)
|
|
1322
|
+
this.initIntegrations().catch(error => {
|
|
1323
|
+
this.logger.log('Error initializing integrations:', error);
|
|
1324
|
+
});
|
|
1316
1325
|
}
|
|
1317
1326
|
init() {
|
|
1318
1327
|
if (this.isInitialized) {
|
|
@@ -1328,10 +1337,6 @@ class Saasco {
|
|
|
1328
1337
|
this.logger.log('Saasco initialized', this.config);
|
|
1329
1338
|
if (this.config.debug) this.logger.log('Debug mode active. This will log all events to the console.');
|
|
1330
1339
|
if (!this.config.enabled) this.logger.log('Analytics is disabled. No requests will be sent to the server.');
|
|
1331
|
-
// Initialize integrations asynchronously
|
|
1332
|
-
this.initIntegrations().catch(error => {
|
|
1333
|
-
this.logger.log('Error initializing integrations:', error);
|
|
1334
|
-
});
|
|
1335
1340
|
this.initAutoPageTracking();
|
|
1336
1341
|
this.isInitialized = true;
|
|
1337
1342
|
}
|