@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.cjs.js CHANGED
@@ -958,7 +958,7 @@ function toError(err) {
958
958
 
959
959
  var DEFAULT_API_VERSION = 'v3';
960
960
 
961
- var SDK_VERSION = '6.1.1';
961
+ var SDK_VERSION = '6.1.3';
962
962
 
963
963
  function datePlusMinutes(minutes) {
964
964
  if (minutes === void 0) { minutes = 30; }
@@ -1116,6 +1116,7 @@ var Builder = /** @class */ (function () {
1116
1116
  this.hasOverriddenCanTrack = false;
1117
1117
  this.apiKey$ = new BehaviorSubject(null);
1118
1118
  this.authToken$ = new BehaviorSubject(null);
1119
+ this.contentId$ = new BehaviorSubject(null);
1119
1120
  this.userAttributesChanged = new BehaviorSubject(null);
1120
1121
  this.editingMode$ = new BehaviorSubject(isIframe);
1121
1122
  // TODO: decorator to do this stuff with the get/set (how do with typing too? compiler?)
@@ -1711,7 +1712,21 @@ var Builder = /** @class */ (function () {
1711
1712
  }
1712
1713
  var meta = typeof contentId === 'object' ? contentId : customProperties;
1713
1714
  var useContentId = typeof contentId === 'string' ? contentId : undefined;
1714
- this.track('conversion', { amount: amount, variationId: variationId, meta: meta, contentId: useContentId }, context);
1715
+ if (!useContentId && !contentId && this.contentId) {
1716
+ useContentId = this.contentId;
1717
+ }
1718
+ var useVariationId = variationId;
1719
+ if (!useVariationId && useContentId) {
1720
+ useVariationId = this.getTestCookie(useContentId);
1721
+ }
1722
+ this.track('conversion', {
1723
+ amount: amount,
1724
+ variationId: useVariationId && useContentId && useVariationId !== useContentId
1725
+ ? useVariationId
1726
+ : undefined,
1727
+ meta: meta,
1728
+ contentId: useContentId,
1729
+ }, context);
1715
1730
  };
1716
1731
  Object.defineProperty(Builder.prototype, "isDevelopmentEnv", {
1717
1732
  // TODO: set this for QA
@@ -1789,6 +1804,16 @@ var Builder = /** @class */ (function () {
1789
1804
  enumerable: false,
1790
1805
  configurable: true
1791
1806
  });
1807
+ Object.defineProperty(Builder.prototype, "contentId", {
1808
+ get: function () {
1809
+ return this.contentId$.value;
1810
+ },
1811
+ set: function (id) {
1812
+ this.contentId$.next(id);
1813
+ },
1814
+ enumerable: false,
1815
+ configurable: true
1816
+ });
1792
1817
  Object.defineProperty(Builder.prototype, "authToken", {
1793
1818
  get: function () {
1794
1819
  return this.authToken$.value;