posthog-js 1.425.0 → 1.426.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.
Files changed (123) hide show
  1. package/dist/all-external-dependencies.js +1 -1
  2. package/dist/all-external-dependencies.js.map +1 -1
  3. package/dist/array.full.es5.js +1 -1
  4. package/dist/array.full.es5.js.map +1 -1
  5. package/dist/array.full.js +1 -1
  6. package/dist/array.full.js.map +1 -1
  7. package/dist/array.full.no-external.js +1 -1
  8. package/dist/array.full.no-external.js.map +1 -1
  9. package/dist/array.js +1 -1
  10. package/dist/array.js.map +1 -1
  11. package/dist/array.no-external.js +1 -1
  12. package/dist/array.no-external.js.map +1 -1
  13. package/dist/conversations.js +1 -1
  14. package/dist/conversations.js.map +1 -1
  15. package/dist/crisp-chat-integration.js +1 -1
  16. package/dist/crisp-chat-integration.js.map +1 -1
  17. package/dist/customizations.full.js +1 -1
  18. package/dist/customizations.full.js.map +1 -1
  19. package/dist/customizations.js +1 -1
  20. package/dist/customizations.js.map +1 -1
  21. package/dist/dead-clicks-autocapture.js +1 -1
  22. package/dist/dead-clicks-autocapture.js.map +1 -1
  23. package/dist/default-extensions.js +1 -1
  24. package/dist/default-extensions.js.map +1 -1
  25. package/dist/element-inference.js +1 -1
  26. package/dist/element-inference.js.map +1 -1
  27. package/dist/exception-autocapture.js +1 -1
  28. package/dist/exception-autocapture.js.map +1 -1
  29. package/dist/extension-bundles.js +1 -1
  30. package/dist/extension-bundles.js.map +1 -1
  31. package/dist/external-scripts-loader.js +1 -1
  32. package/dist/external-scripts-loader.js.map +1 -1
  33. package/dist/intercom-integration.js +1 -1
  34. package/dist/intercom-integration.js.map +1 -1
  35. package/dist/lazy-recorder.js +1 -1
  36. package/dist/lazy-recorder.js.map +1 -1
  37. package/dist/logs.js +1 -1
  38. package/dist/logs.js.map +1 -1
  39. package/dist/main.js +1 -1
  40. package/dist/main.js.map +1 -1
  41. package/dist/module.d.ts +7 -3
  42. package/dist/module.full.d.ts +7 -3
  43. package/dist/module.full.js +1 -1
  44. package/dist/module.full.js.map +1 -1
  45. package/dist/module.full.no-external.d.ts +7 -3
  46. package/dist/module.full.no-external.js +1 -1
  47. package/dist/module.full.no-external.js.map +1 -1
  48. package/dist/module.js +1 -1
  49. package/dist/module.js.map +1 -1
  50. package/dist/module.no-external.d.ts +7 -3
  51. package/dist/module.no-external.js +1 -1
  52. package/dist/module.no-external.js.map +1 -1
  53. package/dist/module.slim.js +1 -1
  54. package/dist/module.slim.js.map +1 -1
  55. package/dist/module.slim.no-external.d.ts +7 -3
  56. package/dist/module.slim.no-external.js +1 -1
  57. package/dist/module.slim.no-external.js.map +1 -1
  58. package/dist/posthog-recorder.js +1 -1
  59. package/dist/posthog-recorder.js.map +1 -1
  60. package/dist/product-tours-preview.js +1 -1
  61. package/dist/product-tours-preview.js.map +1 -1
  62. package/dist/product-tours.js +1 -1
  63. package/dist/product-tours.js.map +1 -1
  64. package/dist/recorder-v2.js +1 -1
  65. package/dist/recorder-v2.js.map +1 -1
  66. package/dist/recorder.js +1 -1
  67. package/dist/recorder.js.map +1 -1
  68. package/dist/rrweb.d.ts +1 -0
  69. package/dist/rrweb.js +1 -1
  70. package/dist/rrweb.js.map +1 -1
  71. package/dist/src/constants.d.ts +2 -0
  72. package/dist/src/extensions/replay/external/lazy-loaded-session-recorder.d.ts +1 -0
  73. package/dist/src/posthog-core.d.ts +5 -2
  74. package/dist/src/posthog-persistence.d.ts +2 -1
  75. package/dist/surveys-preview.js +1 -1
  76. package/dist/surveys-preview.js.map +1 -1
  77. package/dist/surveys.js +1 -1
  78. package/dist/surveys.js.map +1 -1
  79. package/dist/tracing-headers.js +1 -1
  80. package/dist/tracing-headers.js.map +1 -1
  81. package/dist/web-vitals-soft-navs.js +1 -1
  82. package/dist/web-vitals-soft-navs.js.map +1 -1
  83. package/dist/web-vitals-with-attribution-soft-navs.js +1 -1
  84. package/dist/web-vitals-with-attribution-soft-navs.js.map +1 -1
  85. package/dist/web-vitals-with-attribution.js +1 -1
  86. package/dist/web-vitals-with-attribution.js.map +1 -1
  87. package/dist/web-vitals.js +1 -1
  88. package/dist/web-vitals.js.map +1 -1
  89. package/lib/package.json +6 -7
  90. package/lib/src/constants.d.ts +2 -0
  91. package/lib/src/constants.js +5 -3
  92. package/lib/src/constants.js.map +1 -1
  93. package/lib/src/extensions/replay/external/lazy-loaded-session-recorder.d.ts +1 -0
  94. package/lib/src/extensions/replay/external/lazy-loaded-session-recorder.js +24 -16
  95. package/lib/src/extensions/replay/external/lazy-loaded-session-recorder.js.map +1 -1
  96. package/lib/src/persistence-key-policy.js +1 -0
  97. package/lib/src/persistence-key-policy.js.map +1 -1
  98. package/lib/src/posthog-core.d.ts +5 -2
  99. package/lib/src/posthog-core.js +109 -21
  100. package/lib/src/posthog-core.js.map +1 -1
  101. package/lib/src/posthog-persistence.d.ts +2 -1
  102. package/lib/src/posthog-persistence.js +22 -5
  103. package/lib/src/posthog-persistence.js.map +1 -1
  104. package/lib/src/scroll-manager.js +6 -4
  105. package/lib/src/scroll-manager.js.map +1 -1
  106. package/lib/src/storage.js +1 -0
  107. package/lib/src/storage.js.map +1 -1
  108. package/package.json +11 -20
  109. package/react/dist/esm/index.js +232 -256
  110. package/react/dist/esm/index.js.map +1 -1
  111. package/react/dist/esm/slim/index.js +205 -225
  112. package/react/dist/esm/slim/index.js.map +1 -1
  113. package/react/dist/esm/surveys/index.js +48 -74
  114. package/react/dist/esm/surveys/index.js.map +1 -1
  115. package/react/dist/types/index.d.ts +72 -65
  116. package/react/dist/types/slim/index.d.ts +67 -60
  117. package/react/dist/types/surveys/index.d.ts +15 -16
  118. package/react/dist/umd/index.js +287 -289
  119. package/react/dist/umd/index.js.map +1 -1
  120. package/react/dist/umd/slim/index.js +253 -255
  121. package/react/dist/umd/slim/index.js.map +1 -1
  122. package/react/dist/umd/surveys/index.js +91 -91
  123. package/react/dist/umd/surveys/index.js.map +1 -1
@@ -1,14 +1,77 @@
1
+ (function () {var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
16
+ var __assign = (this && this.__assign) || function () {
17
+ __assign = Object.assign || function(t) {
18
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
19
+ s = arguments[i];
20
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
21
+ t[p] = s[p];
22
+ }
23
+ return t;
24
+ };
25
+ return __assign.apply(this, arguments);
26
+ };
27
+ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
28
+ if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
29
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
30
+ };
31
+ var __rest = (this && this.__rest) || function (s, e) {
32
+ var t = {};
33
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
34
+ t[p] = s[p];
35
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
36
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
37
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
38
+ t[p[i]] = s[p[i]];
39
+ }
40
+ return t;
41
+ };
1
42
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('posthog-js'), require('react')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'posthog-js', 'react'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.PosthogReact = {}, global.posthog, global.React));
5
- })(this, (function (exports, posthogJs, React) { 'use strict';
6
-
7
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
8
-
9
- var posthogJs__default = /*#__PURE__*/_interopDefaultCompat(posthogJs);
10
- var React__default = /*#__PURE__*/_interopDefaultCompat(React);
11
-
43
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("posthog-js"), require("react")) : typeof define === "function" && define.amd ? define([
44
+ "exports",
45
+ "posthog-js",
46
+ "react"
47
+ ], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.PosthogReact = {}, global.posthog, global.React));
48
+ })(this, function (exports, posthog_js, react) {
49
+ "use strict";
50
+ var _a;
51
+ var __create = Object.create;
52
+ var __defProp = Object.defineProperty;
53
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
54
+ var __getOwnPropNames = Object.getOwnPropertyNames;
55
+ var __getProtoOf = Object.getPrototypeOf;
56
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
57
+ var __copyProps = function (to, from, except, desc) {
58
+ if (from && typeof from === "object" || typeof from === "function")
59
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
60
+ key = keys[i];
61
+ if (!__hasOwnProp.call(to, key) && key !== except)
62
+ __defProp(to, key, {
63
+ get: (function (k) { return from[k]; }).bind(null, key),
64
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
65
+ });
66
+ }
67
+ return to;
68
+ };
69
+ var __toESM = function (mod, isNodeMode, target) { return (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
70
+ value: mod,
71
+ enumerable: true
72
+ }) : target, mod)); };
73
+ posthog_js = posthog_js && typeof posthog_js === "object" && "default" in posthog_js ? posthog_js : { default: posthog_js };
74
+ react = __toESM(react);
12
75
  var defaultPostHogInstance;
13
76
  function setDefaultPostHogInstance(instance) {
14
77
  defaultPostHogInstance = instance;
@@ -16,98 +79,92 @@
16
79
  function getDefaultPostHogInstance() {
17
80
  return defaultPostHogInstance;
18
81
  }
19
-
20
- var PostHogContext = React.createContext({
82
+ var PostHogContext = (0, react.createContext)({
21
83
  get client() {
22
84
  return getDefaultPostHogInstance();
23
85
  },
24
- bootstrap: undefined,
86
+ bootstrap: void 0
25
87
  });
26
-
27
88
  function isDeepEqual(obj1, obj2, visited) {
28
89
  if (visited === void 0) { visited = new WeakMap(); }
29
- if (obj1 === obj2) {
90
+ if (obj1 === obj2)
30
91
  return true;
31
- }
32
- if (typeof obj1 !== 'object' || obj1 === null || typeof obj2 !== 'object' || obj2 === null) {
92
+ if (typeof obj1 !== "object" || obj1 === null || typeof obj2 !== "object" || obj2 === null)
33
93
  return false;
34
- }
35
- if (visited.has(obj1) && visited.get(obj1) === obj2) {
94
+ if (visited.has(obj1) && visited.get(obj1) === obj2)
36
95
  return true;
37
- }
38
96
  visited.set(obj1, obj2);
39
97
  var keys1 = Object.keys(obj1);
40
98
  var keys2 = Object.keys(obj2);
41
- if (keys1.length !== keys2.length) {
99
+ if (keys1.length !== keys2.length)
42
100
  return false;
43
- }
44
101
  for (var _i = 0, keys1_1 = keys1; _i < keys1_1.length; _i++) {
45
102
  var key = keys1_1[_i];
46
- if (!keys2.includes(key)) {
103
+ if (!keys2.includes(key))
47
104
  return false;
48
- }
49
- if (!isDeepEqual(obj1[key], obj2[key], visited)) {
105
+ if (!isDeepEqual(obj1[key], obj2[key], visited))
50
106
  return false;
51
- }
52
107
  }
53
108
  return true;
54
109
  }
55
-
56
- function PostHogProvider(_a) {
57
- var _b, _c;
58
- var children = _a.children, client = _a.client, apiKey = _a.apiKey, options = _a.options;
59
- var previousInitializationRef = React.useRef(null);
60
- var posthog = React.useMemo(function () {
110
+ function PostHogProvider(_b) {
111
+ var _c, _d;
112
+ var children = _b.children, client = _b.client, apiKey = _b.apiKey, options = _b.options;
113
+ var previousInitializationRef = (0, react.useRef)(null);
114
+ var posthog = (0, react.useMemo)(function () {
61
115
  if (client) {
62
- if (apiKey) {
63
- console.warn('[PostHog.js] You have provided both `client` and `apiKey` to `PostHogProvider`. `apiKey` will be ignored in favour of `client`.');
64
- }
65
- if (options) {
66
- console.warn('[PostHog.js] You have provided both `client` and `options` to `PostHogProvider`. `options` will be ignored in favour of `client`.');
67
- }
116
+ if (apiKey)
117
+ console.warn("[PostHog.js] You have provided both `client` and `apiKey` to `PostHogProvider`. `apiKey` will be ignored in favour of `client`.");
118
+ if (options)
119
+ console.warn("[PostHog.js] You have provided both `client` and `options` to `PostHogProvider`. `options` will be ignored in favour of `client`.");
68
120
  return client;
69
121
  }
70
122
  var defaultInstance = getDefaultPostHogInstance();
71
- if (apiKey) {
123
+ if (apiKey)
72
124
  return defaultInstance;
73
- }
74
- console.warn('[PostHog.js] No `apiKey` or `client` were provided to `PostHogProvider`. Using default global `window.posthog` instance. You must initialize it manually. This is not recommended behavior.');
125
+ console.warn("[PostHog.js] No `apiKey` or `client` were provided to `PostHogProvider`. Using default global `window.posthog` instance. You must initialize it manually. This is not recommended behavior.");
75
126
  return defaultInstance;
76
- }, [client, apiKey, JSON.stringify(options)]);
77
- React.useEffect(function () {
78
- if (client || !apiKey) {
127
+ }, [
128
+ client,
129
+ apiKey,
130
+ JSON.stringify(options)
131
+ ]);
132
+ (0, react.useEffect)(function () {
133
+ if (client || !apiKey)
79
134
  return;
80
- }
81
135
  var defaultInstance = getDefaultPostHogInstance();
82
136
  var previousInitialization = previousInitializationRef.current;
83
137
  if (!previousInitialization) {
84
- if (defaultInstance.__loaded) {
85
- console.warn('[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues.');
86
- }
138
+ if (defaultInstance.__loaded)
139
+ console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues.");
87
140
  defaultInstance.init(apiKey, options);
88
141
  previousInitializationRef.current = {
89
142
  apiKey: apiKey,
90
- options: options !== null && options !== void 0 ? options : {},
143
+ options: options !== null && options !== void 0 ? options : {}
91
144
  };
92
145
  }
93
146
  else {
94
- if (apiKey !== previousInitialization.apiKey) {
147
+ if (apiKey !== previousInitialization.apiKey)
95
148
  console.warn("[PostHog.js] You have provided a different `apiKey` to `PostHogProvider` than the one that was already initialized. This is not supported by our provider and we'll keep using the previous key. If you need to toggle between API Keys you need to control the `client` yourself and pass it in as a prop rather than an `apiKey` prop.");
96
- }
97
- if (options && !isDeepEqual(options, previousInitialization.options)) {
149
+ if (options && !isDeepEqual(options, previousInitialization.options))
98
150
  defaultInstance.set_config(options);
99
- }
100
151
  previousInitializationRef.current = {
101
152
  apiKey: apiKey,
102
- options: options !== null && options !== void 0 ? options : {},
153
+ options: options !== null && options !== void 0 ? options : {}
103
154
  };
104
155
  }
105
- }, [client, apiKey, JSON.stringify(options)]);
106
- return (React__default.default.createElement(PostHogContext.Provider, { value: { client: posthog, bootstrap: (_b = options === null || options === void 0 ? void 0 : options.bootstrap) !== null && _b !== void 0 ? _b : (_c = client === null || client === void 0 ? void 0 : client.config) === null || _c === void 0 ? void 0 : _c.bootstrap } }, children));
156
+ }, [
157
+ client,
158
+ apiKey,
159
+ JSON.stringify(options)
160
+ ]);
161
+ return react.default.createElement(PostHogContext.Provider, { value: {
162
+ client: posthog,
163
+ bootstrap: (_c = options === null || options === void 0 ? void 0 : options.bootstrap) !== null && _c !== void 0 ? _c : (_d = client === null || client === void 0 ? void 0 : client.config) === null || _d === void 0 ? void 0 : _d.bootstrap
164
+ } }, children);
107
165
  }
108
-
109
166
  var isFunction = function (f) {
110
- return typeof f === 'function';
167
+ return typeof f === "function";
111
168
  };
112
169
  var isUndefined = function (x) {
113
170
  return x === void 0;
@@ -115,189 +172,121 @@
115
172
  var isNull = function (x) {
116
173
  return x === null;
117
174
  };
118
-
119
175
  function useFeatureFlagEnabled(flag, defaultValue) {
120
- var _a, _b;
121
- var _c = React.useContext(PostHogContext), client = _c.client, bootstrap = _c.bootstrap;
122
- var _d = React.useState(function () { return client.isFeatureEnabled(flag); }), featureEnabled = _d[0], setFeatureEnabled = _d[1];
123
- React.useEffect(function () {
176
+ var _b, _c;
177
+ var _d = (0, react.useContext)(PostHogContext), client = _d.client, bootstrap = _d.bootstrap;
178
+ var _e = (0, react.useState)(function () { return client.isFeatureEnabled(flag); }), featureEnabled = _e[0], setFeatureEnabled = _e[1];
179
+ (0, react.useEffect)(function () {
124
180
  return client.onFeatureFlags(function () {
125
181
  setFeatureEnabled(client.isFeatureEnabled(flag));
126
182
  });
127
183
  }, [client, flag]);
128
- var bootstrapped = (_a = bootstrap === null || bootstrap === void 0 ? void 0 : bootstrap.featureFlags) === null || _a === void 0 ? void 0 : _a[flag];
129
- if (!((_b = client === null || client === void 0 ? void 0 : client.featureFlags) === null || _b === void 0 ? void 0 : _b.hasLoadedFlags) && (bootstrap === null || bootstrap === void 0 ? void 0 : bootstrap.featureFlags)) {
184
+ var bootstrapped = (_b = bootstrap === null || bootstrap === void 0 ? void 0 : bootstrap.featureFlags) === null || _b === void 0 ? void 0 : _b[flag];
185
+ if (!((_c = client === null || client === void 0 ? void 0 : client.featureFlags) === null || _c === void 0 ? void 0 : _c.hasLoadedFlags) && (bootstrap === null || bootstrap === void 0 ? void 0 : bootstrap.featureFlags))
130
186
  return isUndefined(bootstrapped) ? defaultValue : !!bootstrapped;
131
- }
132
187
  return isUndefined(featureEnabled) ? defaultValue : featureEnabled;
133
188
  }
134
-
135
189
  function useFeatureFlagPayload(flag) {
136
- var _a;
137
- var _b = React.useContext(PostHogContext), client = _b.client, bootstrap = _b.bootstrap;
138
- var _c = React.useState(function () { var _a; return (_a = client.getFeatureFlagResult(flag, { send_event: false })) === null || _a === void 0 ? void 0 : _a.payload; }), featureFlagPayload = _c[0], setFeatureFlagPayload = _c[1];
139
- React.useEffect(function () {
190
+ var _b;
191
+ var _c = (0, react.useContext)(PostHogContext), client = _c.client, bootstrap = _c.bootstrap;
192
+ var _d = (0, react.useState)(function () { var _b; return (_b = client.getFeatureFlagResult(flag, { send_event: false })) === null || _b === void 0 ? void 0 : _b.payload; }), featureFlagPayload = _d[0], setFeatureFlagPayload = _d[1];
193
+ (0, react.useEffect)(function () {
140
194
  return client.onFeatureFlags(function () {
141
- var _a;
142
- setFeatureFlagPayload((_a = client.getFeatureFlagResult(flag, { send_event: false })) === null || _a === void 0 ? void 0 : _a.payload);
195
+ var _b;
196
+ setFeatureFlagPayload((_b = client.getFeatureFlagResult(flag, { send_event: false })) === null || _b === void 0 ? void 0 : _b.payload);
143
197
  });
144
198
  }, [client, flag]);
145
- if (!((_a = client === null || client === void 0 ? void 0 : client.featureFlags) === null || _a === void 0 ? void 0 : _a.hasLoadedFlags) && (bootstrap === null || bootstrap === void 0 ? void 0 : bootstrap.featureFlagPayloads)) {
199
+ if (!((_b = client === null || client === void 0 ? void 0 : client.featureFlags) === null || _b === void 0 ? void 0 : _b.hasLoadedFlags) && (bootstrap === null || bootstrap === void 0 ? void 0 : bootstrap.featureFlagPayloads))
146
200
  return bootstrap.featureFlagPayloads[flag];
147
- }
148
201
  return featureFlagPayload;
149
202
  }
150
-
151
203
  function useFeatureFlagResult(flag) {
152
- var _a, _b;
153
- var _c = React.useContext(PostHogContext), client = _c.client, bootstrap = _c.bootstrap;
154
- var _d = React.useState(function () { return client.getFeatureFlagResult(flag); }), result = _d[0], setResult = _d[1];
155
- React.useEffect(function () {
204
+ var _b, _c;
205
+ var _d = (0, react.useContext)(PostHogContext), client = _d.client, bootstrap = _d.bootstrap;
206
+ var _e = (0, react.useState)(function () { return client.getFeatureFlagResult(flag); }), result = _e[0], setResult = _e[1];
207
+ (0, react.useEffect)(function () {
156
208
  return client.onFeatureFlags(function () {
157
209
  setResult(client.getFeatureFlagResult(flag));
158
210
  });
159
211
  }, [client, flag]);
160
- if (!((_a = client === null || client === void 0 ? void 0 : client.featureFlags) === null || _a === void 0 ? void 0 : _a.hasLoadedFlags) && (bootstrap === null || bootstrap === void 0 ? void 0 : bootstrap.featureFlags)) {
212
+ if (!((_b = client === null || client === void 0 ? void 0 : client.featureFlags) === null || _b === void 0 ? void 0 : _b.hasLoadedFlags) && (bootstrap === null || bootstrap === void 0 ? void 0 : bootstrap.featureFlags)) {
161
213
  var bootstrappedValue = bootstrap.featureFlags[flag];
162
- if (isUndefined(bootstrappedValue)) {
163
- return undefined;
164
- }
214
+ if (isUndefined(bootstrappedValue))
215
+ return;
165
216
  return {
166
217
  key: flag,
167
- enabled: typeof bootstrappedValue === 'string' ? true : !!bootstrappedValue,
168
- variant: typeof bootstrappedValue === 'string' ? bootstrappedValue : undefined,
169
- payload: (_b = bootstrap.featureFlagPayloads) === null || _b === void 0 ? void 0 : _b[flag],
218
+ enabled: typeof bootstrappedValue === "string" ? true : !!bootstrappedValue,
219
+ variant: typeof bootstrappedValue === "string" ? bootstrappedValue : void 0,
220
+ payload: (_c = bootstrap.featureFlagPayloads) === null || _c === void 0 ? void 0 : _c[flag]
170
221
  };
171
222
  }
172
223
  return result;
173
224
  }
174
-
175
225
  function useActiveFeatureFlags() {
176
- var _a;
177
- var _b = React.useContext(PostHogContext), client = _b.client, bootstrap = _b.bootstrap;
178
- var _c = React.useState(function () { return client.featureFlags.getFlags(); }), featureFlags = _c[0], setFeatureFlags = _c[1];
179
- React.useEffect(function () {
226
+ var _b;
227
+ var _c = (0, react.useContext)(PostHogContext), client = _c.client, bootstrap = _c.bootstrap;
228
+ var _d = (0, react.useState)(function () { return client.featureFlags.getFlags(); }), featureFlags = _d[0], setFeatureFlags = _d[1];
229
+ (0, react.useEffect)(function () {
180
230
  return client.onFeatureFlags(function (flags) {
181
231
  setFeatureFlags(flags);
182
232
  });
183
233
  }, [client]);
184
- if (!((_a = client === null || client === void 0 ? void 0 : client.featureFlags) === null || _a === void 0 ? void 0 : _a.hasLoadedFlags) && (bootstrap === null || bootstrap === void 0 ? void 0 : bootstrap.featureFlags)) {
185
- return Object.entries(bootstrap.featureFlags)
186
- .filter(function (_a) {
187
- var value = _a[1];
234
+ if (!((_b = client === null || client === void 0 ? void 0 : client.featureFlags) === null || _b === void 0 ? void 0 : _b.hasLoadedFlags) && (bootstrap === null || bootstrap === void 0 ? void 0 : bootstrap.featureFlags))
235
+ return Object.entries(bootstrap.featureFlags).filter(function (_b) {
236
+ var value = _b[1];
188
237
  return value;
189
- })
190
- .map(function (_a) {
191
- var key = _a[0];
238
+ }).map(function (_b) {
239
+ var key = _b[0];
192
240
  return key;
193
241
  });
194
- }
195
242
  return featureFlags;
196
243
  }
197
-
198
244
  function useFeatureFlagVariantKey(flag) {
199
- var _a;
200
- var _b = React.useContext(PostHogContext), client = _b.client, bootstrap = _b.bootstrap;
201
- var _c = React.useState(function () {
202
- return client.getFeatureFlag(flag);
203
- }), featureFlagVariantKey = _c[0], setFeatureFlagVariantKey = _c[1];
204
- React.useEffect(function () {
245
+ var _b;
246
+ var _c = (0, react.useContext)(PostHogContext), client = _c.client, bootstrap = _c.bootstrap;
247
+ var _d = (0, react.useState)(function () { return client.getFeatureFlag(flag); }), featureFlagVariantKey = _d[0], setFeatureFlagVariantKey = _d[1];
248
+ (0, react.useEffect)(function () {
205
249
  return client.onFeatureFlags(function () {
206
250
  setFeatureFlagVariantKey(client.getFeatureFlag(flag));
207
251
  });
208
252
  }, [client, flag]);
209
- if (!((_a = client === null || client === void 0 ? void 0 : client.featureFlags) === null || _a === void 0 ? void 0 : _a.hasLoadedFlags) && (bootstrap === null || bootstrap === void 0 ? void 0 : bootstrap.featureFlags)) {
253
+ if (!((_b = client === null || client === void 0 ? void 0 : client.featureFlags) === null || _b === void 0 ? void 0 : _b.hasLoadedFlags) && (bootstrap === null || bootstrap === void 0 ? void 0 : bootstrap.featureFlags))
210
254
  return bootstrap.featureFlags[flag];
211
- }
212
255
  return featureFlagVariantKey;
213
256
  }
214
-
215
257
  var usePostHog = function () {
216
- var client = React.useContext(PostHogContext).client;
258
+ var client = (0, react.useContext)(PostHogContext).client;
217
259
  return client;
218
260
  };
219
-
220
- /******************************************************************************
221
- Copyright (c) Microsoft Corporation.
222
-
223
- Permission to use, copy, modify, and/or distribute this software for any
224
- purpose with or without fee is hereby granted.
225
-
226
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
227
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
228
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
229
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
230
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
231
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
232
- PERFORMANCE OF THIS SOFTWARE.
233
- ***************************************************************************** */
234
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
235
-
236
- var extendStatics = function(d, b) {
237
- extendStatics = Object.setPrototypeOf ||
238
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
239
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
240
- return extendStatics(d, b);
241
- };
242
-
243
- function __extends(d, b) {
244
- if (typeof b !== "function" && b !== null)
245
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
246
- extendStatics(d, b);
247
- function __() { this.constructor = d; }
248
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
249
- }
250
-
251
- var __assign = function() {
252
- __assign = Object.assign || function __assign(t) {
253
- for (var s, i = 1, n = arguments.length; i < n; i++) {
254
- s = arguments[i];
255
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
256
- }
257
- return t;
258
- };
259
- return __assign.apply(this, arguments);
260
- };
261
-
262
- function __rest(s, e) {
263
- var t = {};
264
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
265
- t[p] = s[p];
266
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
267
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
268
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
269
- t[p[i]] = s[p[i]];
270
- }
271
- return t;
272
- }
273
-
274
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
275
- var e = new Error(message);
276
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
277
- };
278
-
279
- function VisibilityAndClickTracker(_a) {
280
- var children = _a.children, onIntersect = _a.onIntersect, onClick = _a.onClick, trackView = _a.trackView, options = _a.options, props = __rest(_a, ["children", "onIntersect", "onClick", "trackView", "options"]);
281
- var ref = React.useRef(null);
282
- var observerOptions = React.useMemo(function () { return (__assign({ threshold: 0.1 }, options)); }, [options === null || options === void 0 ? void 0 : options.threshold, options === null || options === void 0 ? void 0 : options.root, options === null || options === void 0 ? void 0 : options.rootMargin]);
283
- React.useEffect(function () {
261
+ function VisibilityAndClickTracker(_b) {
262
+ var children = _b.children, onIntersect = _b.onIntersect, onClick = _b.onClick, trackView = _b.trackView, options = _b.options, props = __rest(_b, ["children", "onIntersect", "onClick", "trackView", "options"]);
263
+ var ref = (0, react.useRef)(null);
264
+ var observerOptions = (0, react.useMemo)(function () { return (__assign({ threshold: .1 }, options)); }, [
265
+ options === null || options === void 0 ? void 0 : options.threshold,
266
+ options === null || options === void 0 ? void 0 : options.root,
267
+ options === null || options === void 0 ? void 0 : options.rootMargin
268
+ ]);
269
+ (0, react.useEffect)(function () {
284
270
  if (isNull(ref.current) || !trackView)
285
271
  return;
286
- var observer = new IntersectionObserver(function (_a) {
287
- var entry = _a[0];
272
+ var observer = new IntersectionObserver(function (_b) {
273
+ var entry = _b[0];
288
274
  return onIntersect(entry);
289
275
  }, observerOptions);
290
276
  observer.observe(ref.current);
291
277
  return function () { return observer.disconnect(); };
292
- }, [observerOptions, trackView, onIntersect]);
293
- return (React__default.default.createElement("div", __assign({ ref: ref }, props, { onClick: onClick }), children));
278
+ }, [
279
+ observerOptions,
280
+ trackView,
281
+ onIntersect
282
+ ]);
283
+ return react.default.createElement("div", __assign(__assign({ ref: ref }, props), { onClick: onClick }), children);
294
284
  }
295
-
296
- function VisibilityAndClickTrackers(_a) {
297
- var children = _a.children, trackInteraction = _a.trackInteraction, trackView = _a.trackView, options = _a.options, onInteract = _a.onInteract, onView = _a.onView, props = __rest(_a, ["children", "trackInteraction", "trackView", "options", "onInteract", "onView"]);
298
- var clickTrackedRef = React.useRef(false);
299
- var visibilityTrackedRef = React.useRef(false);
300
- var cachedOnClick = React.useCallback(function () {
285
+ function VisibilityAndClickTrackers(_b) {
286
+ var children = _b.children, trackInteraction = _b.trackInteraction, trackView = _b.trackView, options = _b.options, onInteract = _b.onInteract, onView = _b.onView, props = __rest(_b, ["children", "trackInteraction", "trackView", "options", "onInteract", "onView"]);
287
+ var clickTrackedRef = (0, react.useRef)(false);
288
+ var visibilityTrackedRef = (0, react.useRef)(false);
289
+ var cachedOnClick = (0, react.useCallback)(function () {
301
290
  if (!clickTrackedRef.current && trackInteraction && onInteract) {
302
291
  onInteract();
303
292
  clickTrackedRef.current = true;
@@ -309,14 +298,13 @@
309
298
  visibilityTrackedRef.current = true;
310
299
  }
311
300
  };
312
- var trackedChildren = React.Children.map(children, function (child) {
313
- return (React__default.default.createElement(VisibilityAndClickTracker, __assign({ onClick: cachedOnClick, onIntersect: onIntersect, trackView: trackView, options: options }, props), child));
301
+ var trackedChildren = react.Children.map(children, function (child) {
302
+ return react.default.createElement(VisibilityAndClickTracker, __assign({ onClick: cachedOnClick, onIntersect: onIntersect, trackView: trackView, options: options }, props), child);
314
303
  });
315
- return React__default.default.createElement(React__default.default.Fragment, null, trackedChildren);
304
+ return react.default.createElement(react.default.Fragment, null, trackedChildren);
316
305
  }
317
-
318
- function PostHogFeature(_a) {
319
- var flag = _a.flag, match = _a.match, children = _a.children, fallback = _a.fallback, visibilityObserverOptions = _a.visibilityObserverOptions, trackInteraction = _a.trackInteraction, trackView = _a.trackView, props = __rest(_a, ["flag", "match", "children", "fallback", "visibilityObserverOptions", "trackInteraction", "trackView"]);
306
+ function PostHogFeature(_b) {
307
+ var flag = _b.flag, match = _b.match, children = _b.children, fallback = _b.fallback, visibilityObserverOptions = _b.visibilityObserverOptions, trackInteraction = _b.trackInteraction, trackView = _b.trackView, props = __rest(_b, ["flag", "match", "children", "fallback", "visibilityObserverOptions", "trackInteraction", "trackView"]);
320
308
  var payload = useFeatureFlagPayload(flag);
321
309
  var variant = useFeatureFlagVariantKey(flag);
322
310
  var posthog = usePostHog();
@@ -325,68 +313,89 @@
325
313
  if (!isUndefined(variant)) {
326
314
  if (isUndefined(match) || variant === match) {
327
315
  var childNode = isFunction(children) ? children(payload) : children;
328
- return (React__default.default.createElement(VisibilityAndClickTrackers, __assign({ flag: flag, options: visibilityObserverOptions, trackInteraction: shouldTrackInteraction, trackView: shouldTrackView, onInteract: function () { return captureFeatureInteraction({ flag: flag, posthog: posthog, flagVariant: variant }); }, onView: function () { return captureFeatureView({ flag: flag, posthog: posthog, flagVariant: variant }); } }, props), childNode));
316
+ return react.default.createElement(VisibilityAndClickTrackers, __assign({ flag: flag, options: visibilityObserverOptions, trackInteraction: shouldTrackInteraction, trackView: shouldTrackView, onInteract: function () { return captureFeatureInteraction({
317
+ flag: flag,
318
+ posthog: posthog,
319
+ flagVariant: variant
320
+ }); }, onView: function () { return captureFeatureView({
321
+ flag: flag,
322
+ posthog: posthog,
323
+ flagVariant: variant
324
+ }); } }, props), childNode);
329
325
  }
330
326
  }
331
- return React__default.default.createElement(React__default.default.Fragment, null, fallback);
327
+ return react.default.createElement(react.default.Fragment, null, fallback);
332
328
  }
333
- function captureFeatureEvent(event, _a) {
334
- var _b;
335
- var flag = _a.flag, posthog = _a.posthog, flagVariant = _a.flagVariant;
329
+ function captureFeatureEvent(event, _b) {
330
+ var _c;
331
+ var flag = _b.flag, posthog = _b.posthog, flagVariant = _b.flagVariant;
336
332
  var properties = {
337
333
  feature_flag: flag,
338
- $set: (_b = {}, _b["".concat(event, "/").concat(flag)] = flagVariant !== null && flagVariant !== void 0 ? flagVariant : true, _b),
334
+ $set: (_c = {}, _c["".concat(event, "/").concat(flag)] = flagVariant !== null && flagVariant !== void 0 ? flagVariant : true, _c)
339
335
  };
340
- if (typeof flagVariant === 'string') {
336
+ if (typeof flagVariant === "string")
341
337
  properties.feature_flag_variant = flagVariant;
342
- }
343
338
  posthog.capture(event, properties);
344
339
  }
345
340
  function captureFeatureInteraction(options) {
346
- captureFeatureEvent('$feature_interaction', options);
341
+ captureFeatureEvent("$feature_interaction", options);
347
342
  }
348
343
  function captureFeatureView(options) {
349
- captureFeatureEvent('$feature_view', options);
344
+ captureFeatureEvent("$feature_view", options);
350
345
  }
351
-
352
- function TrackedChild(_a) {
353
- var child = _a.child, index = _a.index, name = _a.name, properties = _a.properties, observerOptions = _a.observerOptions;
354
- var trackedRef = React.useRef(false);
346
+ function TrackedChild(_b) {
347
+ var child = _b.child, index = _b.index, name = _b.name, properties = _b.properties, observerOptions = _b.observerOptions;
348
+ var trackedRef = (0, react.useRef)(false);
355
349
  var posthog = usePostHog();
356
- var onIntersect = React.useCallback(function (entry) {
350
+ var onIntersect = (0, react.useCallback)(function (entry) {
357
351
  if (entry.isIntersecting && !trackedRef.current) {
358
- posthog.capture('$element_viewed', __assign({ element_name: name, child_index: index }, properties));
352
+ posthog.capture("$element_viewed", __assign({ element_name: name, child_index: index }, properties));
359
353
  trackedRef.current = true;
360
354
  }
361
- }, [posthog, name, index, properties]);
362
- return (React__default.default.createElement(VisibilityAndClickTracker, { onIntersect: onIntersect, trackView: true, options: observerOptions }, child));
355
+ }, [
356
+ posthog,
357
+ name,
358
+ index,
359
+ properties
360
+ ]);
361
+ return react.default.createElement(VisibilityAndClickTracker, {
362
+ onIntersect: onIntersect,
363
+ trackView: true,
364
+ options: observerOptions
365
+ }, child);
363
366
  }
364
- function PostHogCaptureOnViewed(_a) {
365
- var name = _a.name, properties = _a.properties, observerOptions = _a.observerOptions, trackAllChildren = _a.trackAllChildren, children = _a.children, props = __rest(_a, ["name", "properties", "observerOptions", "trackAllChildren", "children"]);
366
- var trackedRef = React.useRef(false);
367
+ function PostHogCaptureOnViewed(_b) {
368
+ var name = _b.name, properties = _b.properties, observerOptions = _b.observerOptions, trackAllChildren = _b.trackAllChildren, children = _b.children, props = __rest(_b, ["name", "properties", "observerOptions", "trackAllChildren", "children"]);
369
+ var trackedRef = (0, react.useRef)(false);
367
370
  var posthog = usePostHog();
368
- var onIntersect = React.useCallback(function (entry) {
371
+ var onIntersect = (0, react.useCallback)(function (entry) {
369
372
  if (entry.isIntersecting && !trackedRef.current) {
370
- posthog.capture('$element_viewed', __assign({ element_name: name }, properties));
373
+ posthog.capture("$element_viewed", __assign({ element_name: name }, properties));
371
374
  trackedRef.current = true;
372
375
  }
373
- }, [posthog, name, properties]);
376
+ }, [
377
+ posthog,
378
+ name,
379
+ properties
380
+ ]);
374
381
  if (trackAllChildren) {
375
- var trackedChildren = React.Children.map(children, function (child, index) {
376
- return (React__default.default.createElement(TrackedChild, { key: index, child: child, index: index, name: name, properties: properties, observerOptions: observerOptions }));
382
+ var trackedChildren = react.Children.map(children, function (child, index) {
383
+ return react.default.createElement(TrackedChild, {
384
+ key: index,
385
+ child: child,
386
+ index: index,
387
+ name: name,
388
+ properties: properties,
389
+ observerOptions: observerOptions
390
+ });
377
391
  });
378
- return React__default.default.createElement("div", __assign({}, props), trackedChildren);
392
+ return react.default.createElement("div", props, trackedChildren);
379
393
  }
380
- return (React__default.default.createElement(VisibilityAndClickTracker, __assign({ onIntersect: onIntersect, trackView: true, options: observerOptions }, props), children));
394
+ return react.default.createElement(VisibilityAndClickTracker, __assign({ onIntersect: onIntersect, trackView: true, options: observerOptions }, props), children);
381
395
  }
382
-
383
396
  var isError = function (value) {
384
397
  var tag = Object.prototype.toString.call(value);
385
- return (value instanceof Error ||
386
- tag === '[object Error]' ||
387
- tag === '[object Exception]' ||
388
- tag === '[object DOMException]' ||
389
- tag === '[object DOMError]');
398
+ return value instanceof Error || tag === "[object Error]" || tag === "[object Exception]" || tag === "[object DOMException]" || tag === "[object DOMError]";
390
399
  };
391
400
  var setCause = function (error, cause) {
392
401
  var seenErrors = new WeakSet();
@@ -394,9 +403,8 @@
394
403
  while (!seenErrors.has(currentError)) {
395
404
  seenErrors.add(currentError);
396
405
  if (!isError(currentError.cause)) {
397
- if (!isUndefined(currentError.cause)) {
406
+ if (!isUndefined(currentError.cause))
398
407
  cause.cause = currentError.cause;
399
- }
400
408
  currentError.cause = cause;
401
409
  return;
402
410
  }
@@ -404,11 +412,10 @@
404
412
  }
405
413
  };
406
414
  var addReactComponentStack = function (error, componentStack) {
407
- if (!componentStack) {
415
+ if (!componentStack)
408
416
  return error;
409
- }
410
417
  var componentStackError = new Error(isError(error) ? error.message : "Primitive value captured as exception: ".concat(String(error)));
411
- componentStackError.name = "React ErrorBoundary ".concat(isError(error) ? error.name : 'Error');
418
+ componentStackError.name = "React ErrorBoundary ".concat(isError(error) ? error.name : "Error");
412
419
  componentStackError.stack = componentStack;
413
420
  if (isError(error)) {
414
421
  setCause(error, componentStackError);
@@ -416,74 +423,65 @@
416
423
  }
417
424
  return componentStackError;
418
425
  };
419
-
420
426
  var INITIAL_STATE = {
421
427
  componentStack: null,
422
428
  exceptionEvent: null,
423
- error: null,
429
+ error: null
424
430
  };
425
- var __POSTHOG_ERROR_MESSAGES = {
426
- INVALID_FALLBACK: '[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element.',
427
- };
428
- var PostHogErrorBoundary = (function (_super) {
429
- __extends(PostHogErrorBoundary, _super);
430
- function PostHogErrorBoundary(props) {
431
- var _this = _super.call(this, props) || this;
432
- _this.state = INITIAL_STATE;
433
- return _this;
434
- }
435
- PostHogErrorBoundary.prototype.componentDidCatch = function (error, errorInfo) {
436
- var additionalProperties = this.props.additionalProperties;
437
- var currentProperties;
438
- if (isFunction(additionalProperties)) {
439
- currentProperties = additionalProperties(error, errorInfo);
440
- }
441
- else if (typeof additionalProperties === 'object') {
442
- currentProperties = additionalProperties;
443
- }
444
- var client = this.context.client;
445
- var componentStack = errorInfo.componentStack;
446
- var exceptionEvent = client.captureException(addReactComponentStack(error, componentStack), currentProperties);
447
- this.setState({
448
- error: error,
449
- componentStack: componentStack !== null && componentStack !== void 0 ? componentStack : null,
450
- exceptionEvent: exceptionEvent,
451
- });
452
- };
453
- PostHogErrorBoundary.prototype.render = function () {
454
- var _a = this.props, children = _a.children, fallback = _a.fallback;
455
- var state = this.state;
456
- if (state.componentStack == null) {
457
- return isFunction(children) ? children() : children;
431
+ var __POSTHOG_ERROR_MESSAGES = { INVALID_FALLBACK: "[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element." };
432
+ var PostHogErrorBoundary = (_a = (function (_super) {
433
+ __extends(class_1, _super);
434
+ function class_1(props) {
435
+ var _this = _super.call(this, props) || this;
436
+ _this.state = INITIAL_STATE;
437
+ return _this;
458
438
  }
459
- var element = isFunction(fallback)
460
- ? React__default.default.createElement(fallback, {
439
+ class_1.prototype.componentDidCatch = function (error, errorInfo) {
440
+ var additionalProperties = this.props.additionalProperties;
441
+ var currentProperties;
442
+ if (isFunction(additionalProperties))
443
+ currentProperties = additionalProperties(error, errorInfo);
444
+ else if (typeof additionalProperties === "object")
445
+ currentProperties = additionalProperties;
446
+ var client = this.context.client;
447
+ var componentStack = errorInfo.componentStack;
448
+ var exceptionEvent = client.captureException(addReactComponentStack(error, componentStack), currentProperties);
449
+ this.setState({
450
+ error: error,
451
+ componentStack: componentStack !== null && componentStack !== void 0 ? componentStack : null,
452
+ exceptionEvent: exceptionEvent
453
+ });
454
+ };
455
+ class_1.prototype.render = function () {
456
+ var _b = this.props, children = _b.children, fallback = _b.fallback;
457
+ var state = this.state;
458
+ if (state.componentStack == null)
459
+ return isFunction(children) ? children() : children;
460
+ var element = isFunction(fallback) ? react.default.createElement(fallback, {
461
461
  error: state.error,
462
462
  componentStack: state.componentStack,
463
- exceptionEvent: state.exceptionEvent,
464
- })
465
- : fallback;
466
- if (React__default.default.isValidElement(element)) {
467
- return element;
468
- }
469
- console.warn(__POSTHOG_ERROR_MESSAGES.INVALID_FALLBACK);
470
- return React__default.default.createElement(React__default.default.Fragment, null);
471
- };
472
- PostHogErrorBoundary.contextType = PostHogContext;
473
- return PostHogErrorBoundary;
474
- }(React__default.default.Component));
475
-
463
+ exceptionEvent: state.exceptionEvent
464
+ }) : fallback;
465
+ if (react.default.isValidElement(element))
466
+ return element;
467
+ console.warn(__POSTHOG_ERROR_MESSAGES.INVALID_FALLBACK);
468
+ return react.default.createElement(react.default.Fragment, null);
469
+ };
470
+ return class_1;
471
+ }(react.default.Component)),
472
+ __setFunctionName(_a, "PostHogErrorBoundary"),
473
+ (function () {
474
+ _a.contextType = PostHogContext;
475
+ })(),
476
+ _a);
476
477
  var setupReactErrorHandler = function (client, callback) {
477
478
  return function (error, errorInfo) {
478
479
  var event = client.captureException(addReactComponentStack(error, errorInfo.componentStack));
479
- if (callback) {
480
+ if (callback)
480
481
  callback(event, error, errorInfo);
481
- }
482
482
  };
483
483
  };
484
-
485
- setDefaultPostHogInstance(posthogJs__default.default);
486
-
484
+ setDefaultPostHogInstance(posthog_js.default);
487
485
  exports.PostHogCaptureOnViewed = PostHogCaptureOnViewed;
488
486
  exports.PostHogContext = PostHogContext;
489
487
  exports.PostHogErrorBoundary = PostHogErrorBoundary;
@@ -498,6 +496,6 @@
498
496
  exports.useFeatureFlagResult = useFeatureFlagResult;
499
497
  exports.useFeatureFlagVariantKey = useFeatureFlagVariantKey;
500
498
  exports.usePostHog = usePostHog;
501
-
502
- }));
503
- //# sourceMappingURL=index.js.map
499
+ });
500
+ }).call(this);
501
+ //# sourceMappingURL=index.js.map