@posthog/browser-common 0.8.3 → 0.9.1
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/types/compression.d.ts +2 -2
- package/dist/types/surveys.d.ts +53 -53
- package/dist/utils/event-utils.js +1 -0
- package/dist/utils/event-utils.mjs +1 -0
- 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
package/dist/types/surveys.d.ts
CHANGED
|
@@ -1,89 +1,89 @@
|
|
|
1
1
|
import type { PropertyMatchType, SurveyAppearance as CoreSurveyAppearance, SurveyEventWithFilters, SurveyQuestionTranslation, SurveyTranslation, SurveyValidationRule } from '@posthog/core';
|
|
2
2
|
export type { PropertyFilters, PropertyMatchType, PropertyOperator, SurveyEventWithFilters } from '@posthog/core';
|
|
3
3
|
export declare const SurveyEventType: {
|
|
4
|
-
readonly Activation:
|
|
5
|
-
readonly Cancellation:
|
|
4
|
+
readonly Activation: 'events';
|
|
5
|
+
readonly Cancellation: 'cancelEvents';
|
|
6
6
|
};
|
|
7
7
|
export type SurveyEventType = (typeof SurveyEventType)[keyof typeof SurveyEventType];
|
|
8
8
|
export declare const SurveyWidgetType: {
|
|
9
|
-
readonly Button:
|
|
10
|
-
readonly Tab:
|
|
11
|
-
readonly Selector:
|
|
9
|
+
readonly Button: 'button';
|
|
10
|
+
readonly Tab: 'tab';
|
|
11
|
+
readonly Selector: 'selector';
|
|
12
12
|
};
|
|
13
13
|
export type SurveyWidgetType = (typeof SurveyWidgetType)[keyof typeof SurveyWidgetType];
|
|
14
14
|
export declare const SurveyPosition: {
|
|
15
|
-
readonly TopLeft:
|
|
16
|
-
readonly TopRight:
|
|
17
|
-
readonly TopCenter:
|
|
18
|
-
readonly MiddleLeft:
|
|
19
|
-
readonly MiddleRight:
|
|
20
|
-
readonly MiddleCenter:
|
|
21
|
-
readonly Left:
|
|
22
|
-
readonly Center:
|
|
23
|
-
readonly Right:
|
|
24
|
-
readonly NextToTrigger:
|
|
15
|
+
readonly TopLeft: 'top_left';
|
|
16
|
+
readonly TopRight: 'top_right';
|
|
17
|
+
readonly TopCenter: 'top_center';
|
|
18
|
+
readonly MiddleLeft: 'middle_left';
|
|
19
|
+
readonly MiddleRight: 'middle_right';
|
|
20
|
+
readonly MiddleCenter: 'middle_center';
|
|
21
|
+
readonly Left: 'left';
|
|
22
|
+
readonly Center: 'center';
|
|
23
|
+
readonly Right: 'right';
|
|
24
|
+
readonly NextToTrigger: 'next_to_trigger';
|
|
25
25
|
};
|
|
26
26
|
export type SurveyPosition = (typeof SurveyPosition)[keyof typeof SurveyPosition];
|
|
27
27
|
export declare const SurveyTabPosition: {
|
|
28
|
-
readonly Top:
|
|
29
|
-
readonly Left:
|
|
30
|
-
readonly Right:
|
|
31
|
-
readonly Bottom:
|
|
28
|
+
readonly Top: 'top';
|
|
29
|
+
readonly Left: 'left';
|
|
30
|
+
readonly Right: 'right';
|
|
31
|
+
readonly Bottom: 'bottom';
|
|
32
32
|
};
|
|
33
33
|
export type SurveyTabPosition = (typeof SurveyTabPosition)[keyof typeof SurveyTabPosition];
|
|
34
34
|
export declare const SurveyType: {
|
|
35
|
-
readonly Popover:
|
|
36
|
-
readonly API:
|
|
37
|
-
readonly Widget:
|
|
38
|
-
readonly ExternalSurvey:
|
|
35
|
+
readonly Popover: 'popover';
|
|
36
|
+
readonly API: 'api';
|
|
37
|
+
readonly Widget: 'widget';
|
|
38
|
+
readonly ExternalSurvey: 'external_survey';
|
|
39
39
|
};
|
|
40
40
|
export type SurveyType = (typeof SurveyType)[keyof typeof SurveyType];
|
|
41
41
|
export declare const SurveyQuestionType: {
|
|
42
|
-
readonly Open:
|
|
43
|
-
readonly MultipleChoice:
|
|
44
|
-
readonly SingleChoice:
|
|
45
|
-
readonly Rating:
|
|
46
|
-
readonly Link:
|
|
42
|
+
readonly Open: 'open';
|
|
43
|
+
readonly MultipleChoice: 'multiple_choice';
|
|
44
|
+
readonly SingleChoice: 'single_choice';
|
|
45
|
+
readonly Rating: 'rating';
|
|
46
|
+
readonly Link: 'link';
|
|
47
47
|
};
|
|
48
48
|
export type SurveyQuestionType = (typeof SurveyQuestionType)[keyof typeof SurveyQuestionType];
|
|
49
49
|
export declare const SurveyQuestionBranchingType: {
|
|
50
|
-
readonly NextQuestion:
|
|
51
|
-
readonly End:
|
|
52
|
-
readonly ResponseBased:
|
|
53
|
-
readonly SpecificQuestion:
|
|
50
|
+
readonly NextQuestion: 'next_question';
|
|
51
|
+
readonly End: 'end';
|
|
52
|
+
readonly ResponseBased: 'response_based';
|
|
53
|
+
readonly SpecificQuestion: 'specific_question';
|
|
54
54
|
};
|
|
55
55
|
export type SurveyQuestionBranchingType = (typeof SurveyQuestionBranchingType)[keyof typeof SurveyQuestionBranchingType];
|
|
56
56
|
export declare const SurveySchedule: {
|
|
57
|
-
readonly Once:
|
|
58
|
-
readonly Recurring:
|
|
59
|
-
readonly Always:
|
|
57
|
+
readonly Once: 'once';
|
|
58
|
+
readonly Recurring: 'recurring';
|
|
59
|
+
readonly Always: 'always';
|
|
60
60
|
};
|
|
61
61
|
export type SurveySchedule = (typeof SurveySchedule)[keyof typeof SurveySchedule];
|
|
62
62
|
export declare const SurveyEventName: {
|
|
63
|
-
readonly SHOWN:
|
|
64
|
-
readonly DISMISSED:
|
|
65
|
-
readonly SENT:
|
|
66
|
-
readonly ABANDONED:
|
|
63
|
+
readonly SHOWN: 'survey shown';
|
|
64
|
+
readonly DISMISSED: 'survey dismissed';
|
|
65
|
+
readonly SENT: 'survey sent';
|
|
66
|
+
readonly ABANDONED: 'survey abandoned';
|
|
67
67
|
};
|
|
68
68
|
export type SurveyEventName = (typeof SurveyEventName)[keyof typeof SurveyEventName];
|
|
69
69
|
export declare const SurveyEventProperties: {
|
|
70
|
-
readonly SURVEY_ID:
|
|
71
|
-
readonly SURVEY_NAME:
|
|
72
|
-
readonly SURVEY_RESPONSE:
|
|
73
|
-
readonly SURVEY_ITERATION:
|
|
74
|
-
readonly SURVEY_ITERATION_START_DATE:
|
|
75
|
-
readonly SURVEY_PARTIALLY_COMPLETED:
|
|
76
|
-
readonly SURVEY_SUBMISSION_ID:
|
|
77
|
-
readonly SURVEY_QUESTIONS:
|
|
78
|
-
readonly SURVEY_COMPLETED:
|
|
79
|
-
readonly PRODUCT_TOUR_ID:
|
|
80
|
-
readonly SURVEY_LAST_SEEN_DATE:
|
|
81
|
-
readonly SURVEY_LANGUAGE:
|
|
70
|
+
readonly SURVEY_ID: '$survey_id';
|
|
71
|
+
readonly SURVEY_NAME: '$survey_name';
|
|
72
|
+
readonly SURVEY_RESPONSE: '$survey_response';
|
|
73
|
+
readonly SURVEY_ITERATION: '$survey_iteration';
|
|
74
|
+
readonly SURVEY_ITERATION_START_DATE: '$survey_iteration_start_date';
|
|
75
|
+
readonly SURVEY_PARTIALLY_COMPLETED: '$survey_partially_completed';
|
|
76
|
+
readonly SURVEY_SUBMISSION_ID: '$survey_submission_id';
|
|
77
|
+
readonly SURVEY_QUESTIONS: '$survey_questions';
|
|
78
|
+
readonly SURVEY_COMPLETED: '$survey_completed';
|
|
79
|
+
readonly PRODUCT_TOUR_ID: '$product_tour_id';
|
|
80
|
+
readonly SURVEY_LAST_SEEN_DATE: '$survey_last_seen_date';
|
|
81
|
+
readonly SURVEY_LANGUAGE: '$survey_language';
|
|
82
82
|
};
|
|
83
83
|
export type SurveyEventProperties = (typeof SurveyEventProperties)[keyof typeof SurveyEventProperties];
|
|
84
84
|
export declare const DisplaySurveyType: {
|
|
85
|
-
readonly Popover:
|
|
86
|
-
readonly Inline:
|
|
85
|
+
readonly Popover: 'popover';
|
|
86
|
+
readonly Inline: 'inline';
|
|
87
87
|
};
|
|
88
88
|
export type DisplaySurveyType = (typeof DisplaySurveyType)[keyof typeof DisplaySurveyType];
|
|
89
89
|
export type SurveyQuestionDescriptionContentType = 'html' | 'text';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@posthog/browser-common",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Internal shared browser utilities and extension primitives for PostHog Browser SDKs",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -73,13 +73,13 @@
|
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@posthog/
|
|
77
|
-
"@posthog/
|
|
76
|
+
"@posthog/core": "^1.55.3",
|
|
77
|
+
"@posthog/types": "^1.413.0"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@rslib/core": "0.23.2",
|
|
81
81
|
"jsdom": "^26.1.0",
|
|
82
|
-
"typescript": "
|
|
82
|
+
"typescript": "7.0.2",
|
|
83
83
|
"vitest": "^1.6.1",
|
|
84
84
|
"@posthog-tooling/tsconfig-base": "1.1.1"
|
|
85
85
|
},
|