@posthog/browser-common 0.9.2 → 0.9.3
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/config.js +1 -1
- package/dist/config.mjs +1 -1
- package/dist/constants.d.ts +16 -0
- package/dist/constants.js +64 -0
- package/dist/constants.mjs +17 -1
- package/dist/feature-flags-config.d.ts +23 -0
- package/dist/feature-flags-config.js +18 -0
- package/dist/feature-flags-config.mjs +1 -0
- package/dist/feature-flags.d.ts +329 -0
- package/dist/feature-flags.js +1222 -0
- package/dist/feature-flags.mjs +1172 -0
- package/dist/types/feature-flags.d.ts +18 -0
- package/dist/types/feature-flags.js +18 -0
- package/dist/types/feature-flags.mjs +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +7 -0
- package/dist/types/index.mjs +1 -0
- package/dist/utils/event-utils.d.ts +1 -1
- package/dist/utils/event-utils.js +3 -9
- package/dist/utils/event-utils.mjs +1 -7
- package/dist/utils/logger.js +8 -3
- package/dist/utils/logger.mjs +8 -3
- package/dist/utils/request-reachability.d.ts +2 -0
- package/dist/utils/request-reachability.js +61 -0
- package/dist/utils/request-reachability.mjs +20 -0
- package/dist/utils/request-utils.d.ts +1 -2
- package/dist/utils/request-utils.js +3 -14
- package/dist/utils/request-utils.mjs +3 -14
- package/dist/utils/timezone.d.ts +1 -0
- package/dist/utils/timezone.js +46 -0
- package/dist/utils/timezone.mjs +8 -0
- package/package.json +19 -3
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { FeatureFlagDetail, JsonType } from '@posthog/types';
|
|
2
|
+
import type { RemoteConfig } from './remote-config';
|
|
3
|
+
/**
|
|
4
|
+
* Flags returns feature flags and their payloads
|
|
5
|
+
*/
|
|
6
|
+
export interface FlagsResponse extends RemoteConfig {
|
|
7
|
+
featureFlags: Record<string, string | boolean>;
|
|
8
|
+
featureFlagPayloads: Record<string, JsonType>;
|
|
9
|
+
errorsWhileComputingFlags: boolean;
|
|
10
|
+
requestId?: string;
|
|
11
|
+
flags: Record<string, FeatureFlagDetail>;
|
|
12
|
+
evaluatedAt?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Server-controlled gate for minimal `$feature_flag_called` events. `true` only when the
|
|
15
|
+
* project opted in; omitted otherwise. Absence always means full events.
|
|
16
|
+
*/
|
|
17
|
+
minimalFlagCalledEvents?: boolean;
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.r = (exports1)=>{
|
|
5
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
6
|
+
value: 'Module'
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
})();
|
|
13
|
+
var __webpack_exports__ = {};
|
|
14
|
+
__webpack_require__.r(__webpack_exports__);
|
|
15
|
+
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
16
|
+
Object.defineProperty(exports, '__esModule', {
|
|
17
|
+
value: true
|
|
18
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
|
@@ -3,6 +3,9 @@ var __webpack_modules__ = {
|
|
|
3
3
|
"./compression" (module) {
|
|
4
4
|
module.exports = require("./compression.js");
|
|
5
5
|
},
|
|
6
|
+
"./feature-flags" (module) {
|
|
7
|
+
module.exports = require("./feature-flags.js");
|
|
8
|
+
},
|
|
6
9
|
"./network-recording" (module) {
|
|
7
10
|
module.exports = require("./network-recording.js");
|
|
8
11
|
},
|
|
@@ -76,6 +79,10 @@ var __webpack_exports__ = {};
|
|
|
76
79
|
var __rspack_reexport = {};
|
|
77
80
|
for(const __rspack_import_key in _surveys__rspack_import_3)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_surveys__rspack_import_3[__rspack_import_key];
|
|
78
81
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
82
|
+
var _feature_flags__rspack_import_4 = __webpack_require__("./feature-flags");
|
|
83
|
+
var __rspack_reexport = {};
|
|
84
|
+
for(const __rspack_import_key in _feature_flags__rspack_import_4)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_feature_flags__rspack_import_4[__rspack_import_key];
|
|
85
|
+
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
79
86
|
})();
|
|
80
87
|
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
81
88
|
Object.defineProperty(exports, '__esModule', {
|
package/dist/types/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { getTimezone } from './timezone';
|
|
1
2
|
import type { Properties } from '@posthog/types';
|
|
2
3
|
import type { BrowserDetectionHints } from '@posthog/core';
|
|
3
4
|
export declare const PERSONAL_DATA_CAMPAIGN_PARAMS: string[];
|
|
@@ -18,7 +19,6 @@ export declare function getPersonInfo(maskPersonalDataProperties?: boolean, cust
|
|
|
18
19
|
};
|
|
19
20
|
export declare function getPersonPropsFromInfo(info: Record<string, any>, disableCaptureUrlHashes?: boolean): Record<string, any>;
|
|
20
21
|
export declare function getInitialPersonPropsFromInfo(info: Record<string, any>, disableCaptureUrlHashes?: boolean): Record<string, any>;
|
|
21
|
-
export declare function getTimezone(): string | undefined;
|
|
22
22
|
export declare function getTimezoneOffset(): number | undefined;
|
|
23
23
|
export declare function getBrowserDetectionHints(): BrowserDetectionHints;
|
|
24
24
|
export declare function getEventProperties(maskPersonalDataProperties?: boolean, customPersonalDataProperties?: string[], detectGoogleSearchApp?: boolean, disableCaptureUrlHashes?: boolean): Properties;
|
|
@@ -54,9 +54,10 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
54
54
|
getReferrerInfo: ()=>getReferrerInfo,
|
|
55
55
|
getReferringDomain: ()=>getReferringDomain,
|
|
56
56
|
getSearchInfo: ()=>getSearchInfo,
|
|
57
|
-
getTimezone: ()=>getTimezone,
|
|
57
|
+
getTimezone: ()=>external_timezone_js_namespaceObject.getTimezone,
|
|
58
58
|
getTimezoneOffset: ()=>getTimezoneOffset
|
|
59
59
|
});
|
|
60
|
+
const external_timezone_js_namespaceObject = require("./timezone.js");
|
|
60
61
|
const external_request_utils_js_namespaceObject = require("./request-utils.js");
|
|
61
62
|
const core_namespaceObject = require("@posthog/core");
|
|
62
63
|
const external_config_js_namespaceObject = require("../config.js");
|
|
@@ -235,13 +236,6 @@ function getInitialPersonPropsFromInfo(info, disableCaptureUrlHashes = false) {
|
|
|
235
236
|
});
|
|
236
237
|
return props;
|
|
237
238
|
}
|
|
238
|
-
function getTimezone() {
|
|
239
|
-
try {
|
|
240
|
-
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
241
|
-
} catch {
|
|
242
|
-
return;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
239
|
function getTimezoneOffset() {
|
|
246
240
|
try {
|
|
247
241
|
return new Date().getTimezoneOffset();
|
|
@@ -285,7 +279,7 @@ function getEventProperties(maskPersonalDataProperties, customPersonalDataProper
|
|
|
285
279
|
$webview_app_version: webviewAppVersion,
|
|
286
280
|
$device: (0, core_namespaceObject.detectDevice)(external_globals_js_namespaceObject.userAgent),
|
|
287
281
|
$device_type: (0, core_namespaceObject.detectDeviceType)(external_globals_js_namespaceObject.userAgent, deviceOptions),
|
|
288
|
-
$timezone: getTimezone(),
|
|
282
|
+
$timezone: (0, external_timezone_js_namespaceObject.getTimezone)(),
|
|
289
283
|
$timezone_offset: getTimezoneOffset()
|
|
290
284
|
}), {
|
|
291
285
|
$current_url: (0, external_request_utils_js_namespaceObject.maskQueryParams)(disableCaptureUrlHashes ? (0, core_namespaceObject.stripUrlHash)(external_globals_js_namespaceObject.location?.href) : external_globals_js_namespaceObject.location?.href, paramsToMask, MASKED),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getTimezone } from "./timezone.mjs";
|
|
1
2
|
import { convertToURL, getQueryParam, maskQueryParams } from "./request-utils.mjs";
|
|
2
3
|
import { detectBrowser, detectBrowserVersion, detectDevice, detectDeviceType, detectOS, detectWebviewApp, isNull, isUndefined, stripLeadingDollar, stripUrlHash } from "@posthog/core";
|
|
3
4
|
import config from "../config.mjs";
|
|
@@ -175,13 +176,6 @@ function getInitialPersonPropsFromInfo(info, disableCaptureUrlHashes = false) {
|
|
|
175
176
|
});
|
|
176
177
|
return props;
|
|
177
178
|
}
|
|
178
|
-
function getTimezone() {
|
|
179
|
-
try {
|
|
180
|
-
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
181
|
-
} catch {
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
179
|
function getTimezoneOffset() {
|
|
186
180
|
try {
|
|
187
181
|
return new Date().getTimezoneOffset();
|
package/dist/utils/logger.js
CHANGED
|
@@ -43,12 +43,17 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
43
43
|
const external_config_js_namespaceObject = require("../config.js");
|
|
44
44
|
var external_config_js_default = /*#__PURE__*/ __webpack_require__.n(external_config_js_namespaceObject);
|
|
45
45
|
const core_namespaceObject = require("@posthog/core");
|
|
46
|
-
const external_globals_js_namespaceObject = require("./globals.js");
|
|
47
46
|
const _createLogger = (prefix, { debugEnabled } = {})=>{
|
|
48
47
|
const logger = {
|
|
49
48
|
_log: (level, ...args)=>{
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
let browserWindow;
|
|
50
|
+
try {
|
|
51
|
+
browserWindow = "u" < typeof window ? void 0 : window;
|
|
52
|
+
} catch {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (browserWindow && (external_config_js_default().DEBUG || browserWindow.POSTHOG_DEBUG || debugEnabled) && !(0, core_namespaceObject.isUndefined)(browserWindow.console) && browserWindow.console) {
|
|
56
|
+
const consoleLog = '__rrweb_original__' in browserWindow.console[level] ? browserWindow.console[level]['__rrweb_original__'] : browserWindow.console[level];
|
|
52
57
|
consoleLog(prefix, ...args);
|
|
53
58
|
}
|
|
54
59
|
},
|
package/dist/utils/logger.mjs
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import config from "../config.mjs";
|
|
2
2
|
import { isUndefined } from "@posthog/core";
|
|
3
|
-
import { window as external_globals_mjs_window } from "./globals.mjs";
|
|
4
3
|
const _createLogger = (prefix, { debugEnabled } = {})=>{
|
|
5
4
|
const logger = {
|
|
6
5
|
_log: (level, ...args)=>{
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
let browserWindow;
|
|
7
|
+
try {
|
|
8
|
+
browserWindow = "u" < typeof window ? void 0 : window;
|
|
9
|
+
} catch {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if (browserWindow && (config.DEBUG || browserWindow.POSTHOG_DEBUG || debugEnabled) && !isUndefined(browserWindow.console) && browserWindow.console) {
|
|
13
|
+
const consoleLog = '__rrweb_original__' in browserWindow.console[level] ? browserWindow.console[level]['__rrweb_original__'] : browserWindow.console[level];
|
|
9
14
|
consoleLog(prefix, ...args);
|
|
10
15
|
}
|
|
11
16
|
},
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const isStatusZeroFailureCircuitBreakerTripped: (consecutiveStatusZeroFailures: number, maxConsecutiveStatusZeroFailures: number) => boolean;
|
|
2
|
+
export declare const updateStatusZeroFailureCount: (statusCode: number, consecutiveStatusZeroFailures: number, maxConsecutiveStatusZeroFailures: number, onCircuitBreakerTripped: () => void) => number;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
const isBrowserOnline = ()=>{
|
|
31
|
+
try {
|
|
32
|
+
return "u" > typeof window && false !== window.navigator.onLine;
|
|
33
|
+
} catch {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const isStatusZeroFailureCircuitBreakerTripped = (consecutiveStatusZeroFailures, maxConsecutiveStatusZeroFailures)=>consecutiveStatusZeroFailures >= maxConsecutiveStatusZeroFailures && isBrowserOnline();
|
|
38
|
+
const updateStatusZeroFailureCount = (statusCode, consecutiveStatusZeroFailures, maxConsecutiveStatusZeroFailures, onCircuitBreakerTripped)=>{
|
|
39
|
+
if (0 === statusCode) {
|
|
40
|
+
if (isBrowserOnline()) {
|
|
41
|
+
const updatedConsecutiveStatusZeroFailures = consecutiveStatusZeroFailures + 1;
|
|
42
|
+
if (updatedConsecutiveStatusZeroFailures === maxConsecutiveStatusZeroFailures) onCircuitBreakerTripped();
|
|
43
|
+
return updatedConsecutiveStatusZeroFailures;
|
|
44
|
+
}
|
|
45
|
+
return consecutiveStatusZeroFailures;
|
|
46
|
+
}
|
|
47
|
+
return 0;
|
|
48
|
+
};
|
|
49
|
+
__webpack_require__.d(__webpack_exports__, {}, {
|
|
50
|
+
isStatusZeroFailureCircuitBreakerTripped: isStatusZeroFailureCircuitBreakerTripped,
|
|
51
|
+
updateStatusZeroFailureCount: updateStatusZeroFailureCount
|
|
52
|
+
});
|
|
53
|
+
exports.isStatusZeroFailureCircuitBreakerTripped = __webpack_exports__.isStatusZeroFailureCircuitBreakerTripped;
|
|
54
|
+
exports.updateStatusZeroFailureCount = __webpack_exports__.updateStatusZeroFailureCount;
|
|
55
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
56
|
+
"isStatusZeroFailureCircuitBreakerTripped",
|
|
57
|
+
"updateStatusZeroFailureCount"
|
|
58
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
59
|
+
Object.defineProperty(exports, '__esModule', {
|
|
60
|
+
value: true
|
|
61
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const isBrowserOnline = ()=>{
|
|
2
|
+
try {
|
|
3
|
+
return "u" > typeof window && false !== window.navigator.onLine;
|
|
4
|
+
} catch {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
const isStatusZeroFailureCircuitBreakerTripped = (consecutiveStatusZeroFailures, maxConsecutiveStatusZeroFailures)=>consecutiveStatusZeroFailures >= maxConsecutiveStatusZeroFailures && isBrowserOnline();
|
|
9
|
+
const updateStatusZeroFailureCount = (statusCode, consecutiveStatusZeroFailures, maxConsecutiveStatusZeroFailures, onCircuitBreakerTripped)=>{
|
|
10
|
+
if (0 === statusCode) {
|
|
11
|
+
if (isBrowserOnline()) {
|
|
12
|
+
const updatedConsecutiveStatusZeroFailures = consecutiveStatusZeroFailures + 1;
|
|
13
|
+
if (updatedConsecutiveStatusZeroFailures === maxConsecutiveStatusZeroFailures) onCircuitBreakerTripped();
|
|
14
|
+
return updatedConsecutiveStatusZeroFailures;
|
|
15
|
+
}
|
|
16
|
+
return consecutiveStatusZeroFailures;
|
|
17
|
+
}
|
|
18
|
+
return 0;
|
|
19
|
+
};
|
|
20
|
+
export { isStatusZeroFailureCircuitBreakerTripped, updateStatusZeroFailureCount };
|
|
@@ -11,5 +11,4 @@ export declare const getQueryParam: (url: string, param: string) => string;
|
|
|
11
11
|
export declare const maskQueryParams: <T extends string | undefined>(url: T, maskedParams: string[] | undefined, mask: string) => T extends string ? string : undefined;
|
|
12
12
|
export declare const _getHashParam: (hash: string, param: string) => string | null;
|
|
13
13
|
export declare const isLocalhost: () => boolean;
|
|
14
|
-
export
|
|
15
|
-
export declare const updateStatusZeroFailureCount: (statusCode: number, consecutiveStatusZeroFailures: number, maxConsecutiveStatusZeroFailures: number, onCircuitBreakerTripped: () => void) => number;
|
|
14
|
+
export { isStatusZeroFailureCircuitBreakerTripped, updateStatusZeroFailureCount } from './request-reachability';
|
|
@@ -33,15 +33,16 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
33
33
|
formDataToQuery: ()=>formDataToQuery,
|
|
34
34
|
getQueryParam: ()=>getQueryParam,
|
|
35
35
|
isLocalhost: ()=>isLocalhost,
|
|
36
|
-
isStatusZeroFailureCircuitBreakerTripped: ()=>isStatusZeroFailureCircuitBreakerTripped,
|
|
36
|
+
isStatusZeroFailureCircuitBreakerTripped: ()=>external_request_reachability_js_namespaceObject.isStatusZeroFailureCircuitBreakerTripped,
|
|
37
37
|
jsonStringify: ()=>jsonStringify,
|
|
38
38
|
maskQueryParams: ()=>maskQueryParams,
|
|
39
|
-
updateStatusZeroFailureCount: ()=>updateStatusZeroFailureCount
|
|
39
|
+
updateStatusZeroFailureCount: ()=>external_request_reachability_js_namespaceObject.updateStatusZeroFailureCount
|
|
40
40
|
});
|
|
41
41
|
const core_namespaceObject = require("@posthog/core");
|
|
42
42
|
const external_general_utils_js_namespaceObject = require("./general-utils.js");
|
|
43
43
|
const external_globals_js_namespaceObject = require("./globals.js");
|
|
44
44
|
const external_logger_js_namespaceObject = require("./logger.js");
|
|
45
|
+
const external_request_reachability_js_namespaceObject = require("./request-reachability.js");
|
|
45
46
|
const localDomains = [
|
|
46
47
|
'localhost',
|
|
47
48
|
'127.0.0.1'
|
|
@@ -128,18 +129,6 @@ const _getHashParam = function(hash, param) {
|
|
|
128
129
|
return matches ? matches[1] : null;
|
|
129
130
|
};
|
|
130
131
|
const isLocalhost = ()=>localDomains.includes(external_globals_js_namespaceObject.location.hostname);
|
|
131
|
-
const isStatusZeroFailureCircuitBreakerTripped = (consecutiveStatusZeroFailures, maxConsecutiveStatusZeroFailures)=>consecutiveStatusZeroFailures >= maxConsecutiveStatusZeroFailures && (0, external_globals_js_namespaceObject.isBrowserOnline)();
|
|
132
|
-
const updateStatusZeroFailureCount = (statusCode, consecutiveStatusZeroFailures, maxConsecutiveStatusZeroFailures, onCircuitBreakerTripped)=>{
|
|
133
|
-
if (0 === statusCode) {
|
|
134
|
-
if ((0, external_globals_js_namespaceObject.isBrowserOnline)()) {
|
|
135
|
-
const updatedConsecutiveStatusZeroFailures = consecutiveStatusZeroFailures + 1;
|
|
136
|
-
if (updatedConsecutiveStatusZeroFailures === maxConsecutiveStatusZeroFailures) onCircuitBreakerTripped();
|
|
137
|
-
return updatedConsecutiveStatusZeroFailures;
|
|
138
|
-
}
|
|
139
|
-
return consecutiveStatusZeroFailures;
|
|
140
|
-
}
|
|
141
|
-
return 0;
|
|
142
|
-
};
|
|
143
132
|
exports._getHashParam = __webpack_exports__._getHashParam;
|
|
144
133
|
exports.convertToURL = __webpack_exports__.convertToURL;
|
|
145
134
|
exports.formDataToQuery = __webpack_exports__.formDataToQuery;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isArray, isError, isFile, isUndefined, safeJsonStringify } from "@posthog/core";
|
|
2
2
|
import { each, errorToProperties } from "./general-utils.mjs";
|
|
3
|
-
import { document as external_globals_mjs_document,
|
|
3
|
+
import { document as external_globals_mjs_document, location as external_globals_mjs_location } from "./globals.mjs";
|
|
4
4
|
import { logger } from "./logger.mjs";
|
|
5
5
|
const localDomains = [
|
|
6
6
|
'localhost',
|
|
@@ -88,16 +88,5 @@ const _getHashParam = function(hash, param) {
|
|
|
88
88
|
return matches ? matches[1] : null;
|
|
89
89
|
};
|
|
90
90
|
const isLocalhost = ()=>localDomains.includes(external_globals_mjs_location.hostname);
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
if (0 === statusCode) {
|
|
94
|
-
if (isBrowserOnline()) {
|
|
95
|
-
const updatedConsecutiveStatusZeroFailures = consecutiveStatusZeroFailures + 1;
|
|
96
|
-
if (updatedConsecutiveStatusZeroFailures === maxConsecutiveStatusZeroFailures) onCircuitBreakerTripped();
|
|
97
|
-
return updatedConsecutiveStatusZeroFailures;
|
|
98
|
-
}
|
|
99
|
-
return consecutiveStatusZeroFailures;
|
|
100
|
-
}
|
|
101
|
-
return 0;
|
|
102
|
-
};
|
|
103
|
-
export { _getHashParam, convertToURL, formDataToQuery, getQueryParam, isLocalhost, isStatusZeroFailureCircuitBreakerTripped, jsonStringify, maskQueryParams, updateStatusZeroFailureCount };
|
|
91
|
+
export { isStatusZeroFailureCircuitBreakerTripped, updateStatusZeroFailureCount } from "./request-reachability.mjs";
|
|
92
|
+
export { _getHashParam, convertToURL, formDataToQuery, getQueryParam, isLocalhost, jsonStringify, maskQueryParams };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getTimezone(): string | undefined;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
function getTimezone() {
|
|
31
|
+
try {
|
|
32
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
33
|
+
} catch {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
38
|
+
getTimezone: ()=>getTimezone
|
|
39
|
+
});
|
|
40
|
+
exports.getTimezone = __webpack_exports__.getTimezone;
|
|
41
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
42
|
+
"getTimezone"
|
|
43
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
44
|
+
Object.defineProperty(exports, '__esModule', {
|
|
45
|
+
value: true
|
|
46
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@posthog/browser-common",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
4
4
|
"description": "Internal shared browser utilities and extension primitives for PostHog Browser SDKs",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -37,6 +37,12 @@
|
|
|
37
37
|
],
|
|
38
38
|
"utils/*": [
|
|
39
39
|
"dist/utils/*.d.ts"
|
|
40
|
+
],
|
|
41
|
+
"feature-flags": [
|
|
42
|
+
"dist/feature-flags.d.ts"
|
|
43
|
+
],
|
|
44
|
+
"feature-flags-config": [
|
|
45
|
+
"dist/feature-flags-config.d.ts"
|
|
40
46
|
]
|
|
41
47
|
}
|
|
42
48
|
},
|
|
@@ -70,11 +76,21 @@
|
|
|
70
76
|
"types": "./dist/utils/*.d.ts",
|
|
71
77
|
"require": "./dist/utils/*.js",
|
|
72
78
|
"import": "./dist/utils/*.mjs"
|
|
79
|
+
},
|
|
80
|
+
"./feature-flags": {
|
|
81
|
+
"types": "./dist/feature-flags.d.ts",
|
|
82
|
+
"require": "./dist/feature-flags.js",
|
|
83
|
+
"import": "./dist/feature-flags.mjs"
|
|
84
|
+
},
|
|
85
|
+
"./feature-flags-config": {
|
|
86
|
+
"types": "./dist/feature-flags-config.d.ts",
|
|
87
|
+
"require": "./dist/feature-flags-config.js",
|
|
88
|
+
"import": "./dist/feature-flags-config.mjs"
|
|
73
89
|
}
|
|
74
90
|
},
|
|
75
91
|
"dependencies": {
|
|
76
|
-
"@posthog/core": "^1.57.
|
|
77
|
-
"@posthog/types": "^1.415.
|
|
92
|
+
"@posthog/core": "^1.57.3",
|
|
93
|
+
"@posthog/types": "^1.415.2"
|
|
78
94
|
},
|
|
79
95
|
"devDependencies": {
|
|
80
96
|
"@rslib/core": "0.23.2",
|