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