@builder.io/sdk 3.0.2-2 → 3.0.2

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.
Files changed (40) hide show
  1. package/.yarnrc.yml +1 -0
  2. package/CHANGELOG.md +6 -0
  3. package/dist/index.browser.js +13 -5
  4. package/dist/index.browser.js.map +1 -1
  5. package/dist/index.cjs.js +13 -5
  6. package/dist/index.cjs.js.map +1 -1
  7. package/dist/index.esm.js +13 -5
  8. package/dist/index.esm.js.map +1 -1
  9. package/dist/index.js +13 -49
  10. package/dist/index.umd.js +13 -5
  11. package/dist/index.umd.js.map +1 -1
  12. package/dist/package.json +3 -3
  13. package/dist/src/builder.class.js +12 -4
  14. package/dist/src/builder.class.js.map +1 -1
  15. package/dist/src/builder.class.test.js +153 -171
  16. package/dist/src/classes/animator.class.js +195 -218
  17. package/dist/src/classes/observable.class.js +97 -102
  18. package/dist/src/classes/promise.class.js +154 -150
  19. package/dist/src/classes/query-string.class.js +74 -73
  20. package/dist/src/classes/query-string.class.test.js +20 -20
  21. package/dist/src/constants/builder.js +4 -4
  22. package/dist/src/functions/assign.function.js +19 -19
  23. package/dist/src/functions/fetch.function.js +75 -97
  24. package/dist/src/functions/finder.function.js +274 -389
  25. package/dist/src/functions/next-tick.function.js +23 -26
  26. package/dist/src/functions/omit.function.js +13 -13
  27. package/dist/src/functions/server-only-require.function.js +9 -10
  28. package/dist/src/functions/throttle.function.js +37 -35
  29. package/dist/src/functions/to-error.js +6 -5
  30. package/dist/src/functions/uuid.js +8 -9
  31. package/dist/src/types/api-version.js +3 -3
  32. package/dist/src/types/content.js +3 -3
  33. package/dist/src/types/element.js +3 -3
  34. package/dist/src/url.js +42 -41
  35. package/dist/src/url.test.js +118 -222
  36. package/dist/tsconfig.tsbuildinfo +1 -1
  37. package/package.json +5 -6
  38. package/dist/src/functions/get-top-level-domain.d.ts +0 -6
  39. package/dist/src/functions/get-top-level-domain.js +0 -17
  40. package/dist/src/functions/get-top-level-domain.js.map +0 -1
package/dist/index.esm.js CHANGED
@@ -118,7 +118,7 @@ function assertAllowedPropertyName(name) {
118
118
  throw new Error("Property name \"".concat(name, "\" is not allowed"));
119
119
  }
120
120
 
121
- var version = "3.0.2-1";
121
+ var version = "3.0.2";
122
122
 
123
123
  var Subscription = /** @class */ (function () {
124
124
  function Subscription(listeners, listener) {
@@ -1200,6 +1200,17 @@ var Builder = /** @class */ (function () {
1200
1200
  this.setTestsFromUrl();
1201
1201
  // TODO: do this on every request send?
1202
1202
  this.getOverridesFromQueryString();
1203
+ // cookies used in personalization container script, so need to set before hydration to match script result
1204
+ var userAttrCookie = this.getCookie(Builder.attributesCookieName);
1205
+ if (userAttrCookie) {
1206
+ try {
1207
+ var attributes = JSON.parse(userAttrCookie);
1208
+ this.setUserAttributes(attributes);
1209
+ }
1210
+ catch (err) {
1211
+ console.debug('Error parsing user attributes cookie', err);
1212
+ }
1213
+ }
1203
1214
  }
1204
1215
  }
1205
1216
  Builder.register = function (type, info) {
@@ -2089,12 +2100,9 @@ var Builder = /** @class */ (function () {
2089
2100
  };
2090
2101
  Builder.prototype.setUserAttributes = function (options) {
2091
2102
  assign(Builder.overrideUserAttributes, options);
2092
- try {
2103
+ if (this.canTrack) {
2093
2104
  this.setCookie(Builder.attributesCookieName, JSON.stringify(this.getUserAttributes()));
2094
2105
  }
2095
- catch (_a) {
2096
- // Ignore
2097
- }
2098
2106
  this.userAttributesChanged.next(options);
2099
2107
  };
2100
2108
  /**