@posthog/browser-common 0.8.2 → 0.9.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/README.md +2 -1
- package/dist/client.d.ts +2 -2
- package/dist/config.js +1 -1
- package/dist/config.mjs +1 -1
- package/dist/utils/general-utils.d.ts +1 -1
- package/dist/utils/general-utils.js +1 -8
- package/dist/utils/general-utils.mjs +1 -8
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -64,7 +64,8 @@ What an extension is given in `setup` — the adapter shared by extensions on th
|
|
|
64
64
|
- **storage and logging**: `kv`, `logger`
|
|
65
65
|
|
|
66
66
|
Identity, session, SDK metadata, capture permission, and the public project token are always-ready synchronous reads.
|
|
67
|
-
`capture`
|
|
67
|
+
`capture` synchronously admits an event to the host pipeline; use host lifecycle APIs when delivery completion matters.
|
|
68
|
+
`sendRequest` is awaitable. Its `sentAt` option controls `sent_at` placement on POST requests; GET query mode
|
|
68
69
|
uses the cache-busting `_` parameter instead, and GET body mode has no effect. `onRemoteConfig` replays the latest
|
|
69
70
|
available success or failure and then reports subsequent outcomes. Configuration timing is host-owned, and the
|
|
70
71
|
subscription remains active until disposed. Extensions that want a named log prefix can create a child with
|
package/dist/client.d.ts
CHANGED
|
@@ -102,8 +102,8 @@ export interface Client {
|
|
|
102
102
|
readonly session: SessionContext;
|
|
103
103
|
/** Whether the host currently permits data capture. */
|
|
104
104
|
readonly canCapture: boolean;
|
|
105
|
-
/**
|
|
106
|
-
capture(event: string, properties?: Properties | null, options?: CaptureOptions):
|
|
105
|
+
/** Synchronously admits an analytics event to the client's normal pipeline. */
|
|
106
|
+
capture(event: string, properties?: Properties | null, options?: CaptureOptions): void;
|
|
107
107
|
/** Registers a synchronous producer of properties merged into every captured event. */
|
|
108
108
|
registerDynamicEventProperties(producer: () => Record<string, unknown>): Disposable;
|
|
109
109
|
/** Returns the extension registered under a typed stable name, or `undefined` when it is not installed. */
|
package/dist/config.js
CHANGED
package/dist/config.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PostHogConfig, Properties } from '@posthog/types';
|
|
2
|
+
export { trySafe } from '@posthog/core';
|
|
2
3
|
export declare function find<T>(value: T[], predicate: (value: T) => boolean): T | undefined;
|
|
3
4
|
export declare function eachArray<E = any>(obj: E[] | null | undefined, iterator: (value: E, key: number) => void): void;
|
|
4
5
|
export declare function each(obj: any, iterator: (value: any, key: any) => void): void;
|
|
@@ -8,7 +9,6 @@ export declare const extend: (obj: Record<string, any>, ...args: Record<string,
|
|
|
8
9
|
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries
|
|
9
10
|
*/
|
|
10
11
|
export declare function entries<T = any>(obj: Record<string, T>): [string, T][];
|
|
11
|
-
export declare const trySafe: <T>(fn: () => T) => T | undefined;
|
|
12
12
|
export declare const safewrap: <F extends (...args: any[]) => any = (...args: any[]) => any>(f: F) => F;
|
|
13
13
|
export declare const safewrapClass: (klass: Function, functions: string[]) => void;
|
|
14
14
|
export declare const stripEmptyProperties: (p: Properties) => Properties;
|
|
@@ -42,7 +42,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
42
42
|
safewrap: ()=>safewrap,
|
|
43
43
|
safewrapClass: ()=>safewrapClass,
|
|
44
44
|
stripEmptyProperties: ()=>stripEmptyProperties,
|
|
45
|
-
trySafe: ()=>trySafe
|
|
45
|
+
trySafe: ()=>core_namespaceObject.trySafe
|
|
46
46
|
});
|
|
47
47
|
const core_namespaceObject = require("@posthog/core");
|
|
48
48
|
const external_logger_js_namespaceObject = require("./logger.js");
|
|
@@ -72,13 +72,6 @@ function entries(obj) {
|
|
|
72
72
|
];
|
|
73
73
|
return resArray;
|
|
74
74
|
}
|
|
75
|
-
const trySafe = function(fn) {
|
|
76
|
-
try {
|
|
77
|
-
return fn();
|
|
78
|
-
} catch {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
75
|
const safewrap = function(f) {
|
|
83
76
|
return function(...args) {
|
|
84
77
|
try {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { hasOwnProperty as core_hasOwnProperty, isArray, isError, isFormData, isNullish, isNumber, isString } from "@posthog/core";
|
|
1
|
+
import { hasOwnProperty as core_hasOwnProperty, isArray, isError, isFormData, isNullish, isNumber, isString, trySafe } from "@posthog/core";
|
|
2
2
|
import { logger } from "./logger.mjs";
|
|
3
3
|
function find(value, predicate) {
|
|
4
4
|
for(let i = 0; i < value.length; i++)if (predicate(value[i])) return value[i];
|
|
@@ -26,13 +26,6 @@ function entries(obj) {
|
|
|
26
26
|
];
|
|
27
27
|
return resArray;
|
|
28
28
|
}
|
|
29
|
-
const trySafe = function(fn) {
|
|
30
|
-
try {
|
|
31
|
-
return fn();
|
|
32
|
-
} catch {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
29
|
const safewrap = function(f) {
|
|
37
30
|
return function(...args) {
|
|
38
31
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@posthog/browser-common",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Internal shared browser utilities and extension primitives for PostHog Browser SDKs",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@posthog/core": "^1.
|
|
77
|
-
"@posthog/types": "^1.
|
|
76
|
+
"@posthog/core": "^1.54.2",
|
|
77
|
+
"@posthog/types": "^1.412.1"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@rslib/core": "0.23.2",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"build": "rslib build",
|
|
91
91
|
"dev": "rslib build -w",
|
|
92
92
|
"test:unit": "vitest run",
|
|
93
|
-
"check-types": "
|
|
93
|
+
"check-types": "tsc --noEmit --project tsconfig.build.json",
|
|
94
94
|
"package": "pnpm pack --out $PACKAGE_DEST/%s.tgz"
|
|
95
95
|
}
|
|
96
96
|
}
|