posthog-js 1.31.1 → 1.32.0

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
@@ -277,6 +277,11 @@ interface DecideResponse {
277
277
  editorParams: EditorParams;
278
278
  toolbarVersion: 'toolbar'; /** deprecated, moved to editorParams */
279
279
  isAuthenticated: boolean;
280
+ inject: {
281
+ id: number;
282
+ source: string;
283
+ config?: Record<string, any>;
284
+ }[];
280
285
  }
281
286
  declare type FeatureFlagsCallback = (flags: string[], variants: Record<string, string | boolean>) => void;
282
287
  interface AutoCaptureCustomProperty {
package/dist/module.js CHANGED
@@ -885,7 +885,7 @@ var LZString = {
885
885
  }
886
886
  };
887
887
 
888
- var version = "1.31.1";
888
+ var version = "1.32.0";
889
889
 
890
890
  // e.g. Config.DEBUG = Config.DEBUG || instance.get_config('debug')
891
891
 
@@ -4059,6 +4059,36 @@ var Decide = /*#__PURE__*/function () {
4059
4059
  } else {
4060
4060
  this.instance['compression'] = {};
4061
4061
  }
4062
+
4063
+ if (response['inject']) {
4064
+ var _iterator2 = _createForOfIteratorHelper(response['inject']),
4065
+ _step2;
4066
+
4067
+ try {
4068
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
4069
+ var _step2$value = _step2.value,
4070
+ id = _step2$value.id,
4071
+ source = _step2$value.source,
4072
+ config = _step2$value.config;
4073
+
4074
+ try {
4075
+ var _window$eval, _window$eval2, _window$eval2$inject;
4076
+
4077
+ var apiHost = this.instance.get_config('api_host');
4078
+ (_window$eval = window.eval(source)) === null || _window$eval === void 0 ? void 0 : (_window$eval2 = _window$eval(apiHost)) === null || _window$eval2 === void 0 ? void 0 : (_window$eval2$inject = _window$eval2.inject) === null || _window$eval2$inject === void 0 ? void 0 : _window$eval2$inject.call(_window$eval2, {
4079
+ config: config,
4080
+ posthog: this.instance
4081
+ });
4082
+ } catch (e) {
4083
+ console.error("[POSTHOG-JS] Error while initializing PostHog app with config id ".concat(id), e);
4084
+ }
4085
+ }
4086
+ } catch (err) {
4087
+ _iterator2.e(err);
4088
+ } finally {
4089
+ _iterator2.f();
4090
+ }
4091
+ }
4062
4092
  }
4063
4093
  }]);
4064
4094