@builder.io/sdk 6.1.1 → 6.1.3

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
@@ -950,7 +950,7 @@ function toError(err) {
950
950
 
951
951
  var DEFAULT_API_VERSION = 'v3';
952
952
 
953
- var SDK_VERSION = '6.1.1';
953
+ var SDK_VERSION = '6.1.3';
954
954
 
955
955
  function datePlusMinutes(minutes) {
956
956
  if (minutes === void 0) { minutes = 30; }
@@ -1108,6 +1108,7 @@ var Builder = /** @class */ (function () {
1108
1108
  this.hasOverriddenCanTrack = false;
1109
1109
  this.apiKey$ = new BehaviorSubject(null);
1110
1110
  this.authToken$ = new BehaviorSubject(null);
1111
+ this.contentId$ = new BehaviorSubject(null);
1111
1112
  this.userAttributesChanged = new BehaviorSubject(null);
1112
1113
  this.editingMode$ = new BehaviorSubject(isIframe);
1113
1114
  // TODO: decorator to do this stuff with the get/set (how do with typing too? compiler?)
@@ -1703,7 +1704,21 @@ var Builder = /** @class */ (function () {
1703
1704
  }
1704
1705
  var meta = typeof contentId === 'object' ? contentId : customProperties;
1705
1706
  var useContentId = typeof contentId === 'string' ? contentId : undefined;
1706
- this.track('conversion', { amount: amount, variationId: variationId, meta: meta, contentId: useContentId }, context);
1707
+ if (!useContentId && !contentId && this.contentId) {
1708
+ useContentId = this.contentId;
1709
+ }
1710
+ var useVariationId = variationId;
1711
+ if (!useVariationId && useContentId) {
1712
+ useVariationId = this.getTestCookie(useContentId);
1713
+ }
1714
+ this.track('conversion', {
1715
+ amount: amount,
1716
+ variationId: useVariationId && useContentId && useVariationId !== useContentId
1717
+ ? useVariationId
1718
+ : undefined,
1719
+ meta: meta,
1720
+ contentId: useContentId,
1721
+ }, context);
1707
1722
  };
1708
1723
  Object.defineProperty(Builder.prototype, "isDevelopmentEnv", {
1709
1724
  // TODO: set this for QA
@@ -1781,6 +1796,16 @@ var Builder = /** @class */ (function () {
1781
1796
  enumerable: false,
1782
1797
  configurable: true
1783
1798
  });
1799
+ Object.defineProperty(Builder.prototype, "contentId", {
1800
+ get: function () {
1801
+ return this.contentId$.value;
1802
+ },
1803
+ set: function (id) {
1804
+ this.contentId$.next(id);
1805
+ },
1806
+ enumerable: false,
1807
+ configurable: true
1808
+ });
1784
1809
  Object.defineProperty(Builder.prototype, "authToken", {
1785
1810
  get: function () {
1786
1811
  return this.authToken$.value;