saasco-sdk 0.1.38 → 0.1.39

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 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.38";
10
+ var version = "0.1.39";
11
11
 
12
12
  const timezones = {
13
13
  'Asia/Barnaul': 'RU',
@@ -626,17 +626,17 @@ function createFacebookPixelIntegration(config) {
626
626
  track: (eventName, properties, context) => {
627
627
  if (!isPixelReady || !window.fbq) return;
628
628
  const fbEventName = getFacebookEventName(eventName, config.eventMapping);
629
- // Standard Facebook events that support parameters
630
629
  const eventsWithParams = ['Purchase', 'StartTrial', 'Subscribe'];
630
+ const isStandardEvent = standardFacebookEvents.includes(fbEventName);
631
+ const trackType = isStandardEvent ? 'track' : 'trackCustom';
631
632
  if (eventsWithParams.includes(fbEventName) && properties) {
632
- // Extract standard Facebook parameters
633
633
  const fbParams = {};
634
634
  if (properties['value'] !== undefined) fbParams['value'] = properties['value'];
635
635
  if (properties['currency'] !== undefined) fbParams['currency'] = properties['currency'];
636
636
  if (properties['predicted_ltv'] !== undefined) fbParams['predicted_ltv'] = properties['predicted_ltv'];
637
- window.fbq('track', fbEventName, Object.assign(Object.assign({}, properties), fbParams));
637
+ window.fbq(trackType, fbEventName, fbParams);
638
638
  } else {
639
- window.fbq('track', fbEventName);
639
+ window.fbq(trackType, fbEventName);
640
640
  }
641
641
  },
642
642
  identify: (userId, properties, context) => tslib.__awaiter(this, void 0, void 0, function* () {
@@ -673,32 +673,6 @@ function getFacebookEventName(eventName, eventMapping) {
673
673
  if (!eventMapping) return eventName;
674
674
  return eventMapping[eventName] || eventName;
675
675
  }
676
- // Legacy functions for backward compatibility (deprecated)
677
- function initializeFacebookPixel(pixelId) {
678
- var _a;
679
- console.warn('initializeFacebookPixel is deprecated. Use createFacebookPixelIntegration instead.');
680
- const integration = createFacebookPixelIntegration({
681
- pixelId
682
- });
683
- (_a = integration.init) === null || _a === void 0 ? void 0 : _a.call(integration);
684
- }
685
- function trackFacebookEvent(eventName, properties, eventMapping) {
686
- console.warn('trackFacebookEvent is deprecated. Use IntegrationManager instead.');
687
- if (isServer$1 || !window.fbq) return;
688
- const fbEventName = getFacebookEventName(eventName, eventMapping);
689
- const eventsWithParams = ['Purchase', 'StartTrial', 'Subscribe'];
690
- const isStandardEvent = standardFacebookEvents.includes(fbEventName);
691
- const trackType = isStandardEvent ? 'track' : 'trackCustom';
692
- if (eventsWithParams.includes(fbEventName) && properties) {
693
- const fbParams = {};
694
- if (properties['value'] !== undefined) fbParams['value'] = properties['value'];
695
- if (properties['currency'] !== undefined) fbParams['currency'] = properties['currency'];
696
- if (properties['predicted_ltv'] !== undefined) fbParams['predicted_ltv'] = properties['predicted_ltv'];
697
- window.fbq(trackType, fbEventName, fbParams);
698
- } else {
699
- window.fbq(trackType, fbEventName);
700
- }
701
- }
702
676
  function coerceMetaConversionsAmValues(properties) {
703
677
  const coerce = [{
704
678
  key: 'em',
@@ -1633,7 +1607,5 @@ exports.Saasco = Saasco;
1633
1607
  exports.browserContextSchema = browserContextSchema;
1634
1608
  exports.createFacebookPixelIntegration = createFacebookPixelIntegration;
1635
1609
  exports.getBrowserContext = getBrowserContext;
1636
- exports.initializeFacebookPixel = initializeFacebookPixel;
1637
1610
  exports.standardFacebookEvents = standardFacebookEvents;
1638
1611
  exports.timezones = timezones;
1639
- exports.trackFacebookEvent = trackFacebookEvent;
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.38";
6
+ var version = "0.1.39";
7
7
 
8
8
  const timezones = {
9
9
  'Asia/Barnaul': 'RU',
@@ -622,17 +622,17 @@ function createFacebookPixelIntegration(config) {
622
622
  track: (eventName, properties, context) => {
623
623
  if (!isPixelReady || !window.fbq) return;
624
624
  const fbEventName = getFacebookEventName(eventName, config.eventMapping);
625
- // Standard Facebook events that support parameters
626
625
  const eventsWithParams = ['Purchase', 'StartTrial', 'Subscribe'];
626
+ const isStandardEvent = standardFacebookEvents.includes(fbEventName);
627
+ const trackType = isStandardEvent ? 'track' : 'trackCustom';
627
628
  if (eventsWithParams.includes(fbEventName) && properties) {
628
- // Extract standard Facebook parameters
629
629
  const fbParams = {};
630
630
  if (properties['value'] !== undefined) fbParams['value'] = properties['value'];
631
631
  if (properties['currency'] !== undefined) fbParams['currency'] = properties['currency'];
632
632
  if (properties['predicted_ltv'] !== undefined) fbParams['predicted_ltv'] = properties['predicted_ltv'];
633
- window.fbq('track', fbEventName, Object.assign(Object.assign({}, properties), fbParams));
633
+ window.fbq(trackType, fbEventName, fbParams);
634
634
  } else {
635
- window.fbq('track', fbEventName);
635
+ window.fbq(trackType, fbEventName);
636
636
  }
637
637
  },
638
638
  identify: (userId, properties, context) => __awaiter(this, void 0, void 0, function* () {
@@ -669,32 +669,6 @@ function getFacebookEventName(eventName, eventMapping) {
669
669
  if (!eventMapping) return eventName;
670
670
  return eventMapping[eventName] || eventName;
671
671
  }
672
- // Legacy functions for backward compatibility (deprecated)
673
- function initializeFacebookPixel(pixelId) {
674
- var _a;
675
- console.warn('initializeFacebookPixel is deprecated. Use createFacebookPixelIntegration instead.');
676
- const integration = createFacebookPixelIntegration({
677
- pixelId
678
- });
679
- (_a = integration.init) === null || _a === void 0 ? void 0 : _a.call(integration);
680
- }
681
- function trackFacebookEvent(eventName, properties, eventMapping) {
682
- console.warn('trackFacebookEvent is deprecated. Use IntegrationManager instead.');
683
- if (isServer$1 || !window.fbq) return;
684
- const fbEventName = getFacebookEventName(eventName, eventMapping);
685
- const eventsWithParams = ['Purchase', 'StartTrial', 'Subscribe'];
686
- const isStandardEvent = standardFacebookEvents.includes(fbEventName);
687
- const trackType = isStandardEvent ? 'track' : 'trackCustom';
688
- if (eventsWithParams.includes(fbEventName) && properties) {
689
- const fbParams = {};
690
- if (properties['value'] !== undefined) fbParams['value'] = properties['value'];
691
- if (properties['currency'] !== undefined) fbParams['currency'] = properties['currency'];
692
- if (properties['predicted_ltv'] !== undefined) fbParams['predicted_ltv'] = properties['predicted_ltv'];
693
- window.fbq(trackType, fbEventName, fbParams);
694
- } else {
695
- window.fbq(trackType, fbEventName);
696
- }
697
- }
698
672
  function coerceMetaConversionsAmValues(properties) {
699
673
  const coerce = [{
700
674
  key: 'em',
@@ -1623,4 +1597,4 @@ const browserContextSchema = z.object({
1623
1597
  $utmAdId: z.string().nullable()
1624
1598
  });
1625
1599
 
1626
- export { IntegrationManager, Logger, Saasco, browserContextSchema, createFacebookPixelIntegration, getBrowserContext, initializeFacebookPixel, standardFacebookEvents, timezones, trackFacebookEvent };
1600
+ export { IntegrationManager, Logger, Saasco, browserContextSchema, createFacebookPixelIntegration, getBrowserContext, standardFacebookEvents, timezones };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saasco-sdk",
3
- "version": "0.1.38",
3
+ "version": "0.1.39",
4
4
  "dependencies": {
5
5
  "tslib": "^2.3.0",
6
6
  "@lukeed/uuid": "^2.0.1",
@@ -32,5 +32,3 @@ export type StandardFacebookEvent = (typeof standardFacebookEvents)[number];
32
32
  * Create a Facebook Pixel integration instance
33
33
  */
34
34
  export declare function createFacebookPixelIntegration(config: FacebookPixelConfig): Integration;
35
- export declare function initializeFacebookPixel(pixelId: string): void;
36
- export declare function trackFacebookEvent(eventName: string, properties?: Record<string, any>, eventMapping?: FacebookEventMapping): void;