@builder.io/sdk 3.0.2-0 → 3.0.2-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.
package/dist/index.cjs.js CHANGED
@@ -126,7 +126,7 @@ function assertAllowedPropertyName(name) {
126
126
  throw new Error("Property name \"".concat(name, "\" is not allowed"));
127
127
  }
128
128
 
129
- var version = "3.0.2-0";
129
+ var version = "3.0.2-1";
130
130
 
131
131
  var Subscription = /** @class */ (function () {
132
132
  function Subscription(listeners, listener) {
@@ -741,19 +741,6 @@ var Animator = /** @class */ (function () {
741
741
  return Animator;
742
742
  }());
743
743
 
744
- /**
745
- * Only gets one level up from hostname
746
- * wwww.example.com -> example.com
747
- * www.example.co.uk -> example.co.uk
748
- */
749
- function getTopLevelDomain(host) {
750
- var parts = host.split('.');
751
- if (parts.length > 2) {
752
- return parts.slice(1).join('.');
753
- }
754
- return host;
755
- }
756
-
757
744
  /**
758
745
  * RegExp to match field-content in RFC 7230 sec 3.2
759
746
  *
@@ -798,7 +785,6 @@ var Cookies = /** @class */ (function () {
798
785
  if (opts && 'secure' in opts) {
799
786
  cookie.secure = !!opts.secure;
800
787
  }
801
- cookie.domain = req.headers.host && getTopLevelDomain(req.headers.host);
802
788
  pushCookie(headers, cookie);
803
789
  var setHeader = res.setHeader;
804
790
  setHeader.call(res, 'Set-Cookie', headers);
@@ -1055,7 +1041,6 @@ function setCookie(name, value, expires) {
1055
1041
  (value || '') +
1056
1042
  expiresString +
1057
1043
  '; path=/' +
1058
- "; domain=".concat(getTopLevelDomain(location.hostname)) +
1059
1044
  (secure ? '; secure; SameSite=None' : '');
1060
1045
  }
1061
1046
  catch (err) {
@@ -2112,6 +2097,12 @@ var Builder = /** @class */ (function () {
2112
2097
  };
2113
2098
  Builder.prototype.setUserAttributes = function (options) {
2114
2099
  assign(Builder.overrideUserAttributes, options);
2100
+ try {
2101
+ this.setCookie(Builder.attributesCookieName, JSON.stringify(this.getUserAttributes()));
2102
+ }
2103
+ catch (_a) {
2104
+ // Ignore
2105
+ }
2115
2106
  this.userAttributesChanged.next(options);
2116
2107
  };
2117
2108
  /**
@@ -2618,6 +2609,7 @@ var Builder = /** @class */ (function () {
2618
2609
  Builder.plugins = [];
2619
2610
  Builder.actions = [];
2620
2611
  Builder.registry = {};
2612
+ Builder.attributesCookieName = 'builder.userAttributes';
2621
2613
  Builder.registryChange = new BehaviorSubject({});
2622
2614
  Builder._editingPage = false;
2623
2615
  Builder.isIframe = isIframe;