posthog-js 1.36.0 → 1.36.1

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/module.d.ts CHANGED
@@ -1098,6 +1098,10 @@ declare class PostHog {
1098
1098
  * @param {Object} groupPropertiesToSet Optional properties to set for group
1099
1099
  */
1100
1100
  group(groupType: string, groupKey: string, groupPropertiesToSet?: Properties): void;
1101
+ /**
1102
+ * Resets only the group properties of the user currently logged in.
1103
+ */
1104
+ resetGroups(): void;
1101
1105
  /**
1102
1106
  * Clears super properties and generates a new random distinct_id for this instance.
1103
1107
  * Useful for clearing data when a user logs out.
package/dist/module.js CHANGED
@@ -921,7 +921,7 @@ var LZString = {
921
921
  }
922
922
  };
923
923
 
924
- var version = "1.36.0";
924
+ var version = "1.36.1";
925
925
 
926
926
  // e.g. Config.DEBUG = Config.DEBUG || instance.get_config('debug')
927
927
 
@@ -1203,7 +1203,6 @@ var _strip_empty_properties = function _strip_empty_properties(p) {
1203
1203
 
1204
1204
  return ret;
1205
1205
  };
1206
- var COPY_IN_PROGRESS_ATTRIBUTE = typeof Symbol !== 'undefined' ? Symbol('__deepCircularCopyInProgress__') : '__deepCircularCopyInProgress__';
1207
1206
  /**
1208
1207
  * Deep copies an object.
1209
1208
  * It handles cycles by replacing all references to them with `undefined`
@@ -1211,35 +1210,39 @@ var COPY_IN_PROGRESS_ATTRIBUTE = typeof Symbol !== 'undefined' ? Symbol('__deepC
1211
1210
  *
1212
1211
  * @param value
1213
1212
  * @param customizer
1214
- * @param [key] if provided this is the object key associated with the value to be copied. It allows the customizer function to have context when it runs
1215
1213
  * @returns {{}|undefined|*}
1216
1214
  */
1217
1215
 
1218
- function deepCircularCopy(value, customizer, key) {
1219
- if (value !== Object(value)) return customizer ? customizer(value, key) : value; // primitive value
1216
+ function deepCircularCopy(value, customizer) {
1217
+ var COPY_IN_PROGRESS_SET = new Set();
1220
1218
 
1221
- if (value[COPY_IN_PROGRESS_ATTRIBUTE]) return undefined;
1222
- value[COPY_IN_PROGRESS_ATTRIBUTE] = true;
1223
- var result;
1219
+ function internalDeepCircularCopy(value, key) {
1220
+ if (value !== Object(value)) return customizer ? customizer(value, key) : value; // primitive value
1224
1221
 
1225
- if (_isArray(value)) {
1226
- result = [];
1222
+ if (COPY_IN_PROGRESS_SET.has(value)) return undefined;
1223
+ COPY_IN_PROGRESS_SET.add(value);
1224
+ var result;
1227
1225
 
1228
- _eachArray(value, function (it) {
1229
- result.push(deepCircularCopy(it, customizer));
1230
- });
1231
- } else {
1232
- result = {};
1226
+ if (_isArray(value)) {
1227
+ result = [];
1233
1228
 
1234
- _each(value, function (val, key) {
1235
- if (key !== COPY_IN_PROGRESS_ATTRIBUTE) {
1236
- result[key] = deepCircularCopy(val, customizer, key);
1237
- }
1238
- });
1229
+ _eachArray(value, function (it) {
1230
+ result.push(internalDeepCircularCopy(it));
1231
+ });
1232
+ } else {
1233
+ result = {};
1234
+
1235
+ _each(value, function (val, key) {
1236
+ if (!COPY_IN_PROGRESS_SET.has(val)) {
1237
+ result[key] = internalDeepCircularCopy(val, key);
1238
+ }
1239
+ });
1240
+ }
1241
+
1242
+ return result;
1239
1243
  }
1240
1244
 
1241
- delete value[COPY_IN_PROGRESS_ATTRIBUTE];
1242
- return result;
1245
+ return internalDeepCircularCopy(value);
1243
1246
  }
1244
1247
 
1245
1248
  var LONG_STRINGS_ALLOW_LIST = ['$performance_raw'];
@@ -7159,6 +7162,19 @@ var PostHog = /*#__PURE__*/function () {
7159
7162
  this.reloadFeatureFlags();
7160
7163
  }
7161
7164
  }
7165
+ /**
7166
+ * Resets only the group properties of the user currently logged in.
7167
+ */
7168
+
7169
+ }, {
7170
+ key: "resetGroups",
7171
+ value: function resetGroups() {
7172
+ this.register({
7173
+ $groups: {}
7174
+ }); // If groups changed, reload feature flags.
7175
+
7176
+ this.reloadFeatureFlags();
7177
+ }
7162
7178
  /**
7163
7179
  * Clears super properties and generates a new random distinct_id for this instance.
7164
7180
  * Useful for clearing data when a user logs out.