saasco-sdk 0.1.35 → 0.1.37
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 +6 -9
- package/index.esm.js +6 -9
- package/package.json +1 -1
- package/src/lib/integrations/facebook-pixel.d.ts +10 -3
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.37";
|
|
11
11
|
|
|
12
12
|
const timezones = {
|
|
13
13
|
'Asia/Barnaul': 'RU',
|
|
@@ -556,7 +556,7 @@ function getBrowserContext() {
|
|
|
556
556
|
|
|
557
557
|
const isBrowser$1 = typeof window !== 'undefined';
|
|
558
558
|
const isServer$1 = !isBrowser$1;
|
|
559
|
-
const standardFacebookEvents = ['AddPaymentInfo', 'AddToCart', 'AddToWishlist', 'CompleteRegistration', 'Contact', 'CustomizeProduct', 'Donate', 'FindLocation', 'InitiateCheckout', 'Lead', 'Purchase', 'Schedule', 'Search', 'StartTrial', 'SubmitApplication', 'Subscribe', 'ViewContent'];
|
|
559
|
+
const standardFacebookEvents = ['AddPaymentInfo', 'AddToCart', 'AddToWishlist', 'CompleteRegistration', 'Contact', 'CustomizeProduct', 'Donate', 'FindLocation', 'InitiateCheckout', 'Lead', 'Purchase', 'Schedule', 'Search', 'StartTrial', 'SubmitApplication', 'Subscribe', 'ViewContent', 'PageView'];
|
|
560
560
|
/**
|
|
561
561
|
* Create a Facebook Pixel integration instance
|
|
562
562
|
*/
|
|
@@ -604,7 +604,7 @@ function createFacebookPixelIntegration(config) {
|
|
|
604
604
|
s = b.getElementsByTagName(e)[0];
|
|
605
605
|
s.parentNode.insertBefore(t, s);
|
|
606
606
|
})(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js');
|
|
607
|
-
// Initialize pixel
|
|
607
|
+
// Initialize pixel
|
|
608
608
|
window.fbq('init', config.pixelId);
|
|
609
609
|
// If script loads synchronously, mark as ready
|
|
610
610
|
if (window.fbq && typeof window.fbq === 'function') {
|
|
@@ -661,11 +661,8 @@ function createFacebookPixelIntegration(config) {
|
|
|
661
661
|
};
|
|
662
662
|
}
|
|
663
663
|
function getFacebookEventName(eventName, eventMapping) {
|
|
664
|
-
// Convert default saasco
|
|
665
|
-
if (eventName === 'Page View')
|
|
666
|
-
const mappedEvent = 'ViewContent';
|
|
667
|
-
return mappedEvent;
|
|
668
|
-
}
|
|
664
|
+
// Convert default saasco Page View event by default
|
|
665
|
+
if (eventName === 'Page View') return 'PageView';
|
|
669
666
|
if (!eventMapping) return eventName;
|
|
670
667
|
return eventMapping[eventName] || eventName;
|
|
671
668
|
}
|
|
@@ -944,7 +941,7 @@ class IntegrationManager {
|
|
|
944
941
|
this.logger.warn(`skipping ${integration.name}: requires ${integration.environments.join(' or ')} but running in ${this.currentEnvironment}`);
|
|
945
942
|
return;
|
|
946
943
|
}
|
|
947
|
-
this.logger.log(`registering ${integration.name}
|
|
944
|
+
this.logger.log(`registering ${integration.name})`);
|
|
948
945
|
const state = {
|
|
949
946
|
integration,
|
|
950
947
|
status: 'idle'
|
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.37";
|
|
7
7
|
|
|
8
8
|
const timezones = {
|
|
9
9
|
'Asia/Barnaul': 'RU',
|
|
@@ -552,7 +552,7 @@ function getBrowserContext() {
|
|
|
552
552
|
|
|
553
553
|
const isBrowser$1 = typeof window !== 'undefined';
|
|
554
554
|
const isServer$1 = !isBrowser$1;
|
|
555
|
-
const standardFacebookEvents = ['AddPaymentInfo', 'AddToCart', 'AddToWishlist', 'CompleteRegistration', 'Contact', 'CustomizeProduct', 'Donate', 'FindLocation', 'InitiateCheckout', 'Lead', 'Purchase', 'Schedule', 'Search', 'StartTrial', 'SubmitApplication', 'Subscribe', 'ViewContent'];
|
|
555
|
+
const standardFacebookEvents = ['AddPaymentInfo', 'AddToCart', 'AddToWishlist', 'CompleteRegistration', 'Contact', 'CustomizeProduct', 'Donate', 'FindLocation', 'InitiateCheckout', 'Lead', 'Purchase', 'Schedule', 'Search', 'StartTrial', 'SubmitApplication', 'Subscribe', 'ViewContent', 'PageView'];
|
|
556
556
|
/**
|
|
557
557
|
* Create a Facebook Pixel integration instance
|
|
558
558
|
*/
|
|
@@ -600,7 +600,7 @@ function createFacebookPixelIntegration(config) {
|
|
|
600
600
|
s = b.getElementsByTagName(e)[0];
|
|
601
601
|
s.parentNode.insertBefore(t, s);
|
|
602
602
|
})(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js');
|
|
603
|
-
// Initialize pixel
|
|
603
|
+
// Initialize pixel
|
|
604
604
|
window.fbq('init', config.pixelId);
|
|
605
605
|
// If script loads synchronously, mark as ready
|
|
606
606
|
if (window.fbq && typeof window.fbq === 'function') {
|
|
@@ -657,11 +657,8 @@ function createFacebookPixelIntegration(config) {
|
|
|
657
657
|
};
|
|
658
658
|
}
|
|
659
659
|
function getFacebookEventName(eventName, eventMapping) {
|
|
660
|
-
// Convert default saasco
|
|
661
|
-
if (eventName === 'Page View')
|
|
662
|
-
const mappedEvent = 'ViewContent';
|
|
663
|
-
return mappedEvent;
|
|
664
|
-
}
|
|
660
|
+
// Convert default saasco Page View event by default
|
|
661
|
+
if (eventName === 'Page View') return 'PageView';
|
|
665
662
|
if (!eventMapping) return eventName;
|
|
666
663
|
return eventMapping[eventName] || eventName;
|
|
667
664
|
}
|
|
@@ -940,7 +937,7 @@ class IntegrationManager {
|
|
|
940
937
|
this.logger.warn(`skipping ${integration.name}: requires ${integration.environments.join(' or ')} but running in ${this.currentEnvironment}`);
|
|
941
938
|
return;
|
|
942
939
|
}
|
|
943
|
-
this.logger.log(`registering ${integration.name}
|
|
940
|
+
this.logger.log(`registering ${integration.name})`);
|
|
944
941
|
const state = {
|
|
945
942
|
integration,
|
|
946
943
|
status: 'idle'
|
package/package.json
CHANGED
|
@@ -2,8 +2,15 @@ import { IntegrationConfigBase } from '../analytics';
|
|
|
2
2
|
import { Integration } from './integration-manager';
|
|
3
3
|
declare global {
|
|
4
4
|
interface Window {
|
|
5
|
-
fbq?:
|
|
6
|
-
_fbq?:
|
|
5
|
+
fbq?: Fbq;
|
|
6
|
+
_fbq?: Fbq;
|
|
7
|
+
}
|
|
8
|
+
interface Fbq {
|
|
9
|
+
(...args: any[]): void;
|
|
10
|
+
queue?: any[];
|
|
11
|
+
loaded?: boolean;
|
|
12
|
+
version?: string;
|
|
13
|
+
disablePushState?: boolean;
|
|
7
14
|
}
|
|
8
15
|
}
|
|
9
16
|
export type FacebookEventMapping = {
|
|
@@ -17,7 +24,7 @@ export type FacebookPixelConfig = {
|
|
|
17
24
|
pixelId: string;
|
|
18
25
|
eventMapping?: FacebookEventMapping;
|
|
19
26
|
};
|
|
20
|
-
export declare const standardFacebookEvents: readonly ["AddPaymentInfo", "AddToCart", "AddToWishlist", "CompleteRegistration", "Contact", "CustomizeProduct", "Donate", "FindLocation", "InitiateCheckout", "Lead", "Purchase", "Schedule", "Search", "StartTrial", "SubmitApplication", "Subscribe", "ViewContent"];
|
|
27
|
+
export declare const standardFacebookEvents: readonly ["AddPaymentInfo", "AddToCart", "AddToWishlist", "CompleteRegistration", "Contact", "CustomizeProduct", "Donate", "FindLocation", "InitiateCheckout", "Lead", "Purchase", "Schedule", "Search", "StartTrial", "SubmitApplication", "Subscribe", "ViewContent", "PageView"];
|
|
21
28
|
export type StandardFacebookEvent = (typeof standardFacebookEvents)[number];
|
|
22
29
|
/**
|
|
23
30
|
* Create a Facebook Pixel integration instance
|