@posthog/browser-common 0.2.0 → 0.2.2
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 +53 -27
- package/dist/client.d.ts +15 -91
- package/dist/config.js +1 -1
- package/dist/config.mjs +1 -1
- package/dist/core-extension.d.ts +80 -0
- package/dist/core-extension.js +36 -0
- package/dist/core-extension.mjs +2 -0
- package/dist/disposable.d.ts +2 -0
- package/dist/disposable.js +31 -1
- package/dist/disposable.mjs +14 -0
- package/dist/extension-runtime.d.ts +34 -0
- package/dist/extension-runtime.js +109 -0
- package/dist/extension-runtime.mjs +75 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +60 -7
- package/dist/index.mjs +4 -1
- package/dist/persistence.d.ts +15 -12
- package/dist/pubsub.d.ts +1 -1
- package/dist/pubsub.js +6 -8
- package/dist/pubsub.mjs +6 -8
- package/dist/token.d.ts +13 -12
- package/dist/types/compression.d.ts +5 -0
- package/dist/types/compression.js +39 -0
- package/dist/types/compression.mjs +5 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.js +87 -0
- package/dist/types/index.mjs +4 -0
- package/dist/types/network-recording.d.ts +42 -0
- package/dist/types/network-recording.js +18 -0
- package/dist/types/network-recording.mjs +0 -0
- package/dist/types/remote-config.d.ts +180 -0
- package/dist/types/remote-config.js +18 -0
- package/dist/types/remote-config.mjs +0 -0
- package/dist/types/surveys.d.ts +243 -0
- package/dist/types/surveys.js +140 -0
- package/dist/types/surveys.mjs +76 -0
- package/package.json +11 -3
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import type { PerformanceCaptureConfig, SessionRecordingCanvasOptions, SessionRecordingOptions, ToolbarParams } from '@posthog/types';
|
|
2
|
+
import type { Compression } from './compression';
|
|
3
|
+
import type { NetworkRecordOptions } from './network-recording';
|
|
4
|
+
import type { PropertyMatchType, Survey } from './surveys';
|
|
5
|
+
export type FlagVariant = {
|
|
6
|
+
flag: string;
|
|
7
|
+
variant: string;
|
|
8
|
+
};
|
|
9
|
+
export interface SessionRecordingUrlTrigger {
|
|
10
|
+
url: string;
|
|
11
|
+
matching: 'regex';
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* V2 event trigger - always an object with name, optionally with property filters.
|
|
15
|
+
* The server normalizes bare event name strings to this shape before sending.
|
|
16
|
+
*/
|
|
17
|
+
export interface SessionRecordingEventTrigger {
|
|
18
|
+
name: string;
|
|
19
|
+
properties?: SessionRecordingTriggerPropertyFilter[];
|
|
20
|
+
}
|
|
21
|
+
export interface SessionRecordingTriggerPropertyFilter {
|
|
22
|
+
key: string;
|
|
23
|
+
type: 'event' | 'person';
|
|
24
|
+
operator?: 'exact' | 'is_not' | 'icontains' | 'not_icontains' | 'regex' | 'not_regex' | 'gt' | 'lt';
|
|
25
|
+
value?: string | number | boolean | string[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* V2 Trigger Group - represents a single trigger group with its own conditions and sample rate
|
|
29
|
+
*/
|
|
30
|
+
export interface SessionRecordingTriggerGroup {
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
sampleRate: number;
|
|
34
|
+
minDurationMs?: number;
|
|
35
|
+
conditions: {
|
|
36
|
+
matchType: 'any' | 'all';
|
|
37
|
+
events?: SessionRecordingEventTrigger[];
|
|
38
|
+
urls?: SessionRecordingUrlTrigger[];
|
|
39
|
+
flag?: string | FlagVariant;
|
|
40
|
+
properties?: SessionRecordingTriggerPropertyFilter[];
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export type SessionRecordingRemoteConfig = SessionRecordingCanvasOptions & {
|
|
44
|
+
endpoint?: string;
|
|
45
|
+
consoleLogRecordingEnabled?: boolean;
|
|
46
|
+
sampleRate?: string | null;
|
|
47
|
+
minimumDurationMilliseconds?: number;
|
|
48
|
+
linkedFlag?: string | FlagVariant | null;
|
|
49
|
+
networkPayloadCapture?: Pick<NetworkRecordOptions, 'recordBody' | 'recordHeaders'>;
|
|
50
|
+
masking?: Pick<SessionRecordingOptions, 'maskAllInputs' | 'maskTextSelector' | 'blockSelector'>;
|
|
51
|
+
urlTriggers?: SessionRecordingUrlTrigger[];
|
|
52
|
+
scriptConfig?: {
|
|
53
|
+
script?: string | undefined;
|
|
54
|
+
};
|
|
55
|
+
urlBlocklist?: SessionRecordingUrlTrigger[];
|
|
56
|
+
eventTriggers?: string[];
|
|
57
|
+
/**
|
|
58
|
+
* Controls how event, URL, sampling, and linked flag triggers are combined.
|
|
59
|
+
*
|
|
60
|
+
* `any` means that if any of the triggers match, the session will be recorded.
|
|
61
|
+
* `all` means that all the triggers must match for the session to be recorded.
|
|
62
|
+
*/
|
|
63
|
+
triggerMatchType?: 'any' | 'all';
|
|
64
|
+
/**
|
|
65
|
+
* Config version - defaults to 1 (legacy).
|
|
66
|
+
* When version is 2, triggerGroups is used instead of individual trigger fields.
|
|
67
|
+
*/
|
|
68
|
+
version?: 1 | 2;
|
|
69
|
+
/**
|
|
70
|
+
* V2 Trigger Groups - multiple named trigger groups with their own conditions and sample rates.
|
|
71
|
+
* Only used when version === 2.
|
|
72
|
+
*/
|
|
73
|
+
triggerGroups?: SessionRecordingTriggerGroup[];
|
|
74
|
+
};
|
|
75
|
+
export interface ErrorTrackingSuppressionRule {
|
|
76
|
+
type: 'AND' | 'OR';
|
|
77
|
+
values: ErrorTrackingSuppressionRuleValue[];
|
|
78
|
+
}
|
|
79
|
+
export interface ErrorTrackingSuppressionRuleValue {
|
|
80
|
+
key: '$exception_types' | '$exception_values';
|
|
81
|
+
operator: PropertyMatchType;
|
|
82
|
+
value: string | string[];
|
|
83
|
+
type: string;
|
|
84
|
+
}
|
|
85
|
+
/** Position of the conversations widget on the screen. */
|
|
86
|
+
export type WidgetPosition = 'bottom_left' | 'bottom_right' | 'top_left' | 'top_right';
|
|
87
|
+
/** Remote configuration for conversations from the PostHog server. */
|
|
88
|
+
export interface ConversationsRemoteConfig {
|
|
89
|
+
/** Whether conversations are enabled for this team. */
|
|
90
|
+
enabled: boolean;
|
|
91
|
+
/** Whether the widget UI should be shown. */
|
|
92
|
+
widgetEnabled?: boolean;
|
|
93
|
+
/** Public token for authenticating conversations API requests. */
|
|
94
|
+
token: string;
|
|
95
|
+
/** Greeting text to show when the widget is first opened. */
|
|
96
|
+
greetingText?: string;
|
|
97
|
+
/** Primary color for the widget UI. */
|
|
98
|
+
color?: string;
|
|
99
|
+
/** Placeholder text for the message input. */
|
|
100
|
+
placeholderText?: string;
|
|
101
|
+
/** Whether to require an email address before starting a conversation. */
|
|
102
|
+
requireEmail?: boolean;
|
|
103
|
+
/** Whether to show the name field in the identification form. */
|
|
104
|
+
collectName?: boolean;
|
|
105
|
+
/** Title for the identification form. */
|
|
106
|
+
identificationFormTitle?: string;
|
|
107
|
+
/** Description for the identification form. */
|
|
108
|
+
identificationFormDescription?: string;
|
|
109
|
+
/** Domains where the widget may be shown. */
|
|
110
|
+
domains?: string[];
|
|
111
|
+
/** Position of the widget on the screen. */
|
|
112
|
+
widgetPosition?: WidgetPosition;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Remote configuration for a PostHog browser client.
|
|
116
|
+
*
|
|
117
|
+
* These settings can be configured in PostHog. Configuration set directly on
|
|
118
|
+
* the client takes precedence over values from the server.
|
|
119
|
+
*/
|
|
120
|
+
export interface RemoteConfig {
|
|
121
|
+
/** Supported compression algorithms. */
|
|
122
|
+
supportedCompression: Compression[];
|
|
123
|
+
/**
|
|
124
|
+
* If true, disables autocapture. When absent or not a boolean, the SDK
|
|
125
|
+
* keeps the last known server value; a visitor with no stored value keeps
|
|
126
|
+
* autocapture off until a response containing the field arrives.
|
|
127
|
+
*/
|
|
128
|
+
autocapture_opt_out?: boolean;
|
|
129
|
+
/** Performance capture configuration shared by replay and web vitals. */
|
|
130
|
+
capturePerformance?: boolean | PerformanceCaptureConfig;
|
|
131
|
+
/** Custom endpoint configuration for analytics events. */
|
|
132
|
+
analytics?: {
|
|
133
|
+
endpoint?: string;
|
|
134
|
+
};
|
|
135
|
+
/** Whether `$elements_chain` is sent as a string rather than an array. */
|
|
136
|
+
elementsChainAsString?: boolean;
|
|
137
|
+
/** Error tracking configuration. */
|
|
138
|
+
errorTracking?: {
|
|
139
|
+
autocaptureExceptions?: boolean;
|
|
140
|
+
captureExtensionExceptions?: boolean;
|
|
141
|
+
suppressionRules?: ErrorTrackingSuppressionRule[];
|
|
142
|
+
};
|
|
143
|
+
/** Log capture configuration. */
|
|
144
|
+
logs?: {
|
|
145
|
+
captureConsoleLogs?: boolean;
|
|
146
|
+
};
|
|
147
|
+
/** Exception autocapture configuration. */
|
|
148
|
+
autocaptureExceptions?: boolean | {
|
|
149
|
+
endpoint?: string;
|
|
150
|
+
};
|
|
151
|
+
/** Session recording configuration. */
|
|
152
|
+
sessionRecording?: SessionRecordingRemoteConfig | false;
|
|
153
|
+
/** Whether surveys are enabled, optionally including their definitions. */
|
|
154
|
+
surveys?: boolean | Survey[];
|
|
155
|
+
/** Whether product tours are enabled. */
|
|
156
|
+
productTours?: boolean;
|
|
157
|
+
/** Parameters for the toolbar. */
|
|
158
|
+
toolbarParams: ToolbarParams;
|
|
159
|
+
/** @deprecated Renamed to `toolbarParams`; still present on older API responses. */
|
|
160
|
+
editorParams?: ToolbarParams;
|
|
161
|
+
/** @deprecated Moved to `toolbarParams`. */
|
|
162
|
+
toolbarVersion: 'toolbar';
|
|
163
|
+
/** Whether the current user is authenticated. */
|
|
164
|
+
isAuthenticated: boolean;
|
|
165
|
+
/** Site apps available to the client. */
|
|
166
|
+
siteApps: {
|
|
167
|
+
id: string;
|
|
168
|
+
url: string;
|
|
169
|
+
}[];
|
|
170
|
+
/** Whether heatmaps are enabled. */
|
|
171
|
+
heatmaps?: boolean;
|
|
172
|
+
/** Whether to capture only identified users by default. */
|
|
173
|
+
defaultIdentifiedOnly?: boolean;
|
|
174
|
+
/** Whether to capture dead clicks. */
|
|
175
|
+
captureDeadClicks?: boolean;
|
|
176
|
+
/** Whether the team has any feature flags enabled. */
|
|
177
|
+
hasFeatureFlags?: boolean;
|
|
178
|
+
/** Conversations widget configuration. */
|
|
179
|
+
conversations?: boolean | ConversationsRemoteConfig;
|
|
180
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.r = (exports1)=>{
|
|
5
|
+
if ('undefined' != 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 __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
16
|
+
Object.defineProperty(exports, '__esModule', {
|
|
17
|
+
value: true
|
|
18
|
+
});
|
|
File without changes
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import type { SurveyAppearance as CoreSurveyAppearance, SurveyQuestionTranslation, SurveyTranslation, SurveyValidationRule } from '@posthog/core';
|
|
2
|
+
export declare const SurveyEventType: {
|
|
3
|
+
readonly Activation: "events";
|
|
4
|
+
readonly Cancellation: "cancelEvents";
|
|
5
|
+
};
|
|
6
|
+
export type SurveyEventType = (typeof SurveyEventType)[keyof typeof SurveyEventType];
|
|
7
|
+
export declare const SurveyWidgetType: {
|
|
8
|
+
readonly Button: "button";
|
|
9
|
+
readonly Tab: "tab";
|
|
10
|
+
readonly Selector: "selector";
|
|
11
|
+
};
|
|
12
|
+
export type SurveyWidgetType = (typeof SurveyWidgetType)[keyof typeof SurveyWidgetType];
|
|
13
|
+
export declare const SurveyPosition: {
|
|
14
|
+
readonly TopLeft: "top_left";
|
|
15
|
+
readonly TopRight: "top_right";
|
|
16
|
+
readonly TopCenter: "top_center";
|
|
17
|
+
readonly MiddleLeft: "middle_left";
|
|
18
|
+
readonly MiddleRight: "middle_right";
|
|
19
|
+
readonly MiddleCenter: "middle_center";
|
|
20
|
+
readonly Left: "left";
|
|
21
|
+
readonly Center: "center";
|
|
22
|
+
readonly Right: "right";
|
|
23
|
+
readonly NextToTrigger: "next_to_trigger";
|
|
24
|
+
};
|
|
25
|
+
export type SurveyPosition = (typeof SurveyPosition)[keyof typeof SurveyPosition];
|
|
26
|
+
export declare const SurveyTabPosition: {
|
|
27
|
+
readonly Top: "top";
|
|
28
|
+
readonly Left: "left";
|
|
29
|
+
readonly Right: "right";
|
|
30
|
+
readonly Bottom: "bottom";
|
|
31
|
+
};
|
|
32
|
+
export type SurveyTabPosition = (typeof SurveyTabPosition)[keyof typeof SurveyTabPosition];
|
|
33
|
+
export declare const SurveyType: {
|
|
34
|
+
readonly Popover: "popover";
|
|
35
|
+
readonly API: "api";
|
|
36
|
+
readonly Widget: "widget";
|
|
37
|
+
readonly ExternalSurvey: "external_survey";
|
|
38
|
+
};
|
|
39
|
+
export type SurveyType = (typeof SurveyType)[keyof typeof SurveyType];
|
|
40
|
+
export declare const SurveyQuestionType: {
|
|
41
|
+
readonly Open: "open";
|
|
42
|
+
readonly MultipleChoice: "multiple_choice";
|
|
43
|
+
readonly SingleChoice: "single_choice";
|
|
44
|
+
readonly Rating: "rating";
|
|
45
|
+
readonly Link: "link";
|
|
46
|
+
};
|
|
47
|
+
export type SurveyQuestionType = (typeof SurveyQuestionType)[keyof typeof SurveyQuestionType];
|
|
48
|
+
export declare const SurveyQuestionBranchingType: {
|
|
49
|
+
readonly NextQuestion: "next_question";
|
|
50
|
+
readonly End: "end";
|
|
51
|
+
readonly ResponseBased: "response_based";
|
|
52
|
+
readonly SpecificQuestion: "specific_question";
|
|
53
|
+
};
|
|
54
|
+
export type SurveyQuestionBranchingType = (typeof SurveyQuestionBranchingType)[keyof typeof SurveyQuestionBranchingType];
|
|
55
|
+
export declare const SurveySchedule: {
|
|
56
|
+
readonly Once: "once";
|
|
57
|
+
readonly Recurring: "recurring";
|
|
58
|
+
readonly Always: "always";
|
|
59
|
+
};
|
|
60
|
+
export type SurveySchedule = (typeof SurveySchedule)[keyof typeof SurveySchedule];
|
|
61
|
+
export declare const SurveyEventName: {
|
|
62
|
+
readonly SHOWN: "survey shown";
|
|
63
|
+
readonly DISMISSED: "survey dismissed";
|
|
64
|
+
readonly SENT: "survey sent";
|
|
65
|
+
readonly ABANDONED: "survey abandoned";
|
|
66
|
+
};
|
|
67
|
+
export type SurveyEventName = (typeof SurveyEventName)[keyof typeof SurveyEventName];
|
|
68
|
+
export declare const SurveyEventProperties: {
|
|
69
|
+
readonly SURVEY_ID: "$survey_id";
|
|
70
|
+
readonly SURVEY_NAME: "$survey_name";
|
|
71
|
+
readonly SURVEY_RESPONSE: "$survey_response";
|
|
72
|
+
readonly SURVEY_ITERATION: "$survey_iteration";
|
|
73
|
+
readonly SURVEY_ITERATION_START_DATE: "$survey_iteration_start_date";
|
|
74
|
+
readonly SURVEY_PARTIALLY_COMPLETED: "$survey_partially_completed";
|
|
75
|
+
readonly SURVEY_SUBMISSION_ID: "$survey_submission_id";
|
|
76
|
+
readonly SURVEY_QUESTIONS: "$survey_questions";
|
|
77
|
+
readonly SURVEY_COMPLETED: "$survey_completed";
|
|
78
|
+
readonly PRODUCT_TOUR_ID: "$product_tour_id";
|
|
79
|
+
readonly SURVEY_LAST_SEEN_DATE: "$survey_last_seen_date";
|
|
80
|
+
readonly SURVEY_LANGUAGE: "$survey_language";
|
|
81
|
+
};
|
|
82
|
+
export type SurveyEventProperties = (typeof SurveyEventProperties)[keyof typeof SurveyEventProperties];
|
|
83
|
+
export declare const DisplaySurveyType: {
|
|
84
|
+
readonly Popover: "popover";
|
|
85
|
+
readonly Inline: "inline";
|
|
86
|
+
};
|
|
87
|
+
export type DisplaySurveyType = (typeof DisplaySurveyType)[keyof typeof DisplaySurveyType];
|
|
88
|
+
export type PropertyMatchType = 'regex' | 'not_regex' | 'exact' | 'is_not' | 'icontains' | 'not_icontains';
|
|
89
|
+
/** Extended survey operator type with numeric comparisons. */
|
|
90
|
+
export type PropertyOperator = PropertyMatchType | 'gt' | 'lt';
|
|
91
|
+
export type PropertyFilters = {
|
|
92
|
+
[propertyName: string]: {
|
|
93
|
+
values: string[];
|
|
94
|
+
operator: PropertyOperator;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
export interface SurveyEventWithFilters {
|
|
98
|
+
name: string;
|
|
99
|
+
propertyFilters?: PropertyFilters;
|
|
100
|
+
}
|
|
101
|
+
export type SurveyQuestionDescriptionContentType = 'html' | 'text';
|
|
102
|
+
/** Browser survey appearance, including browser-only placement and rendering options. */
|
|
103
|
+
export interface SurveyAppearance extends Omit<CoreSurveyAppearance, 'position' | 'widgetType'> {
|
|
104
|
+
/** @deprecated Not currently used. */
|
|
105
|
+
descriptionTextColor?: string;
|
|
106
|
+
ratingButtonHoverColor?: string;
|
|
107
|
+
whiteLabel?: boolean;
|
|
108
|
+
tabPosition?: SurveyTabPosition;
|
|
109
|
+
fontFamily?: string;
|
|
110
|
+
maxWidth?: string;
|
|
111
|
+
zIndex?: string;
|
|
112
|
+
disabledButtonOpacity?: string;
|
|
113
|
+
boxPadding?: string;
|
|
114
|
+
/** @deprecated Use `inputBackground` instead. */
|
|
115
|
+
inputBackgroundColor?: string;
|
|
116
|
+
hideCancelButton?: boolean;
|
|
117
|
+
disableAutofocus?: boolean;
|
|
118
|
+
position?: SurveyPosition;
|
|
119
|
+
widgetType?: SurveyWidgetType;
|
|
120
|
+
}
|
|
121
|
+
export type SurveyQuestion = BasicSurveyQuestion | LinkSurveyQuestion | RatingSurveyQuestion | MultipleSurveyQuestion;
|
|
122
|
+
interface SurveyQuestionBase {
|
|
123
|
+
question: string;
|
|
124
|
+
id?: string;
|
|
125
|
+
description?: string | null;
|
|
126
|
+
descriptionContentType?: SurveyQuestionDescriptionContentType;
|
|
127
|
+
optional?: boolean;
|
|
128
|
+
buttonText?: string;
|
|
129
|
+
branching?: NextQuestionBranching | EndBranching | ResponseBasedBranching | SpecificQuestionBranching;
|
|
130
|
+
validation?: SurveyValidationRule[];
|
|
131
|
+
translations?: Record<string, SurveyQuestionTranslation>;
|
|
132
|
+
}
|
|
133
|
+
export interface BasicSurveyQuestion extends SurveyQuestionBase {
|
|
134
|
+
type: typeof SurveyQuestionType.Open;
|
|
135
|
+
}
|
|
136
|
+
export interface LinkSurveyQuestion extends SurveyQuestionBase {
|
|
137
|
+
type: typeof SurveyQuestionType.Link;
|
|
138
|
+
link?: string | null;
|
|
139
|
+
}
|
|
140
|
+
export interface RatingSurveyQuestion extends SurveyQuestionBase {
|
|
141
|
+
type: typeof SurveyQuestionType.Rating;
|
|
142
|
+
display: 'number' | 'emoji';
|
|
143
|
+
scale: 2 | 3 | 5 | 7 | 10;
|
|
144
|
+
lowerBoundLabel: string;
|
|
145
|
+
upperBoundLabel: string;
|
|
146
|
+
skipSubmitButton?: boolean;
|
|
147
|
+
}
|
|
148
|
+
export interface MultipleSurveyQuestion extends SurveyQuestionBase {
|
|
149
|
+
type: typeof SurveyQuestionType.SingleChoice | typeof SurveyQuestionType.MultipleChoice;
|
|
150
|
+
choices: string[];
|
|
151
|
+
hasOpenChoice?: boolean;
|
|
152
|
+
shuffleOptions?: boolean;
|
|
153
|
+
skipSubmitButton?: boolean;
|
|
154
|
+
}
|
|
155
|
+
interface NextQuestionBranching {
|
|
156
|
+
type: typeof SurveyQuestionBranchingType.NextQuestion;
|
|
157
|
+
}
|
|
158
|
+
interface EndBranching {
|
|
159
|
+
type: typeof SurveyQuestionBranchingType.End;
|
|
160
|
+
}
|
|
161
|
+
interface ResponseBasedBranching {
|
|
162
|
+
type: typeof SurveyQuestionBranchingType.ResponseBased;
|
|
163
|
+
responseValues: Record<string, any>;
|
|
164
|
+
}
|
|
165
|
+
interface SpecificQuestionBranching {
|
|
166
|
+
type: typeof SurveyQuestionBranchingType.SpecificQuestion;
|
|
167
|
+
index: number;
|
|
168
|
+
}
|
|
169
|
+
/** A survey definition returned as part of browser remote config. */
|
|
170
|
+
export interface Survey {
|
|
171
|
+
id: string;
|
|
172
|
+
name: string;
|
|
173
|
+
description?: string;
|
|
174
|
+
type: SurveyType;
|
|
175
|
+
translations?: Record<string, SurveyTranslation>;
|
|
176
|
+
feature_flag_keys: {
|
|
177
|
+
key: string;
|
|
178
|
+
value?: string;
|
|
179
|
+
}[] | null;
|
|
180
|
+
linked_flag_key: string | null;
|
|
181
|
+
targeting_flag_key: string | null;
|
|
182
|
+
internal_targeting_flag_key: string | null;
|
|
183
|
+
questions: SurveyQuestion[];
|
|
184
|
+
appearance: SurveyAppearance | null;
|
|
185
|
+
conditions: {
|
|
186
|
+
url?: string;
|
|
187
|
+
selector?: string;
|
|
188
|
+
seenSurveyWaitPeriodInDays?: number;
|
|
189
|
+
urlMatchType?: PropertyMatchType;
|
|
190
|
+
events: {
|
|
191
|
+
repeatedActivation?: boolean;
|
|
192
|
+
values: SurveyEventWithFilters[];
|
|
193
|
+
} | null;
|
|
194
|
+
cancelEvents: {
|
|
195
|
+
values: SurveyEventWithFilters[];
|
|
196
|
+
} | null;
|
|
197
|
+
actions: {
|
|
198
|
+
values: SurveyActionType[];
|
|
199
|
+
} | null;
|
|
200
|
+
deviceTypes?: string[];
|
|
201
|
+
deviceTypesMatchType?: PropertyMatchType;
|
|
202
|
+
linkedFlagVariant?: string;
|
|
203
|
+
} | null;
|
|
204
|
+
start_date: string | null;
|
|
205
|
+
end_date: string | null;
|
|
206
|
+
current_iteration: number | null;
|
|
207
|
+
current_iteration_start_date: string | null;
|
|
208
|
+
schedule?: SurveySchedule | null;
|
|
209
|
+
enable_partial_responses?: boolean | null;
|
|
210
|
+
}
|
|
211
|
+
export type SurveyWithTypeAndAppearance = Pick<Survey, 'id' | 'type' | 'appearance'>;
|
|
212
|
+
export interface SurveyActionType {
|
|
213
|
+
id: number;
|
|
214
|
+
name: string | null;
|
|
215
|
+
steps?: ActionStepType[];
|
|
216
|
+
}
|
|
217
|
+
/** Sync with plugin-server/src/types.ts. */
|
|
218
|
+
export type ActionStepStringMatching = 'contains' | 'exact' | 'regex';
|
|
219
|
+
export interface ActionStepType {
|
|
220
|
+
event?: string | null;
|
|
221
|
+
selector?: string | null;
|
|
222
|
+
/** Pre-compiled regex pattern for matching selector against `$elements_chain`. */
|
|
223
|
+
selector_regex?: string | null;
|
|
224
|
+
/** @deprecated Only `selector` should be used now. */
|
|
225
|
+
tag_name?: string;
|
|
226
|
+
text?: string | null;
|
|
227
|
+
/** @default StringMatching.Exact */
|
|
228
|
+
text_matching?: ActionStepStringMatching | null;
|
|
229
|
+
href?: string | null;
|
|
230
|
+
/** @default StringMatching.Exact */
|
|
231
|
+
href_matching?: ActionStepStringMatching | null;
|
|
232
|
+
url?: string | null;
|
|
233
|
+
/** @default StringMatching.Contains */
|
|
234
|
+
url_matching?: ActionStepStringMatching | null;
|
|
235
|
+
/** Property filters for action step matching. */
|
|
236
|
+
properties?: {
|
|
237
|
+
key: string;
|
|
238
|
+
value?: string | number | boolean | (string | number | boolean)[] | null;
|
|
239
|
+
operator?: PropertyMatchType;
|
|
240
|
+
type?: string;
|
|
241
|
+
}[];
|
|
242
|
+
}
|
|
243
|
+
export {};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
DisplaySurveyType: ()=>DisplaySurveyType,
|
|
28
|
+
SurveyEventName: ()=>SurveyEventName,
|
|
29
|
+
SurveyEventProperties: ()=>SurveyEventProperties,
|
|
30
|
+
SurveyEventType: ()=>SurveyEventType,
|
|
31
|
+
SurveyPosition: ()=>SurveyPosition,
|
|
32
|
+
SurveyQuestionBranchingType: ()=>SurveyQuestionBranchingType,
|
|
33
|
+
SurveyQuestionType: ()=>SurveyQuestionType,
|
|
34
|
+
SurveySchedule: ()=>SurveySchedule,
|
|
35
|
+
SurveyTabPosition: ()=>SurveyTabPosition,
|
|
36
|
+
SurveyType: ()=>SurveyType,
|
|
37
|
+
SurveyWidgetType: ()=>SurveyWidgetType
|
|
38
|
+
});
|
|
39
|
+
const SurveyEventType = {
|
|
40
|
+
Activation: 'events',
|
|
41
|
+
Cancellation: 'cancelEvents'
|
|
42
|
+
};
|
|
43
|
+
const SurveyWidgetType = {
|
|
44
|
+
Button: 'button',
|
|
45
|
+
Tab: 'tab',
|
|
46
|
+
Selector: 'selector'
|
|
47
|
+
};
|
|
48
|
+
const SurveyPosition = {
|
|
49
|
+
TopLeft: 'top_left',
|
|
50
|
+
TopRight: 'top_right',
|
|
51
|
+
TopCenter: 'top_center',
|
|
52
|
+
MiddleLeft: 'middle_left',
|
|
53
|
+
MiddleRight: 'middle_right',
|
|
54
|
+
MiddleCenter: 'middle_center',
|
|
55
|
+
Left: 'left',
|
|
56
|
+
Center: 'center',
|
|
57
|
+
Right: 'right',
|
|
58
|
+
NextToTrigger: 'next_to_trigger'
|
|
59
|
+
};
|
|
60
|
+
const SurveyTabPosition = {
|
|
61
|
+
Top: 'top',
|
|
62
|
+
Left: 'left',
|
|
63
|
+
Right: 'right',
|
|
64
|
+
Bottom: 'bottom'
|
|
65
|
+
};
|
|
66
|
+
const SurveyType = {
|
|
67
|
+
Popover: 'popover',
|
|
68
|
+
API: 'api',
|
|
69
|
+
Widget: 'widget',
|
|
70
|
+
ExternalSurvey: 'external_survey'
|
|
71
|
+
};
|
|
72
|
+
const SurveyQuestionType = {
|
|
73
|
+
Open: 'open',
|
|
74
|
+
MultipleChoice: 'multiple_choice',
|
|
75
|
+
SingleChoice: 'single_choice',
|
|
76
|
+
Rating: 'rating',
|
|
77
|
+
Link: 'link'
|
|
78
|
+
};
|
|
79
|
+
const SurveyQuestionBranchingType = {
|
|
80
|
+
NextQuestion: 'next_question',
|
|
81
|
+
End: 'end',
|
|
82
|
+
ResponseBased: 'response_based',
|
|
83
|
+
SpecificQuestion: 'specific_question'
|
|
84
|
+
};
|
|
85
|
+
const SurveySchedule = {
|
|
86
|
+
Once: 'once',
|
|
87
|
+
Recurring: 'recurring',
|
|
88
|
+
Always: 'always'
|
|
89
|
+
};
|
|
90
|
+
const SurveyEventName = {
|
|
91
|
+
SHOWN: 'survey shown',
|
|
92
|
+
DISMISSED: 'survey dismissed',
|
|
93
|
+
SENT: 'survey sent',
|
|
94
|
+
ABANDONED: 'survey abandoned'
|
|
95
|
+
};
|
|
96
|
+
const SurveyEventProperties = {
|
|
97
|
+
SURVEY_ID: '$survey_id',
|
|
98
|
+
SURVEY_NAME: '$survey_name',
|
|
99
|
+
SURVEY_RESPONSE: '$survey_response',
|
|
100
|
+
SURVEY_ITERATION: '$survey_iteration',
|
|
101
|
+
SURVEY_ITERATION_START_DATE: '$survey_iteration_start_date',
|
|
102
|
+
SURVEY_PARTIALLY_COMPLETED: '$survey_partially_completed',
|
|
103
|
+
SURVEY_SUBMISSION_ID: '$survey_submission_id',
|
|
104
|
+
SURVEY_QUESTIONS: '$survey_questions',
|
|
105
|
+
SURVEY_COMPLETED: '$survey_completed',
|
|
106
|
+
PRODUCT_TOUR_ID: '$product_tour_id',
|
|
107
|
+
SURVEY_LAST_SEEN_DATE: '$survey_last_seen_date',
|
|
108
|
+
SURVEY_LANGUAGE: '$survey_language'
|
|
109
|
+
};
|
|
110
|
+
const DisplaySurveyType = {
|
|
111
|
+
Popover: 'popover',
|
|
112
|
+
Inline: 'inline'
|
|
113
|
+
};
|
|
114
|
+
exports.DisplaySurveyType = __webpack_exports__.DisplaySurveyType;
|
|
115
|
+
exports.SurveyEventName = __webpack_exports__.SurveyEventName;
|
|
116
|
+
exports.SurveyEventProperties = __webpack_exports__.SurveyEventProperties;
|
|
117
|
+
exports.SurveyEventType = __webpack_exports__.SurveyEventType;
|
|
118
|
+
exports.SurveyPosition = __webpack_exports__.SurveyPosition;
|
|
119
|
+
exports.SurveyQuestionBranchingType = __webpack_exports__.SurveyQuestionBranchingType;
|
|
120
|
+
exports.SurveyQuestionType = __webpack_exports__.SurveyQuestionType;
|
|
121
|
+
exports.SurveySchedule = __webpack_exports__.SurveySchedule;
|
|
122
|
+
exports.SurveyTabPosition = __webpack_exports__.SurveyTabPosition;
|
|
123
|
+
exports.SurveyType = __webpack_exports__.SurveyType;
|
|
124
|
+
exports.SurveyWidgetType = __webpack_exports__.SurveyWidgetType;
|
|
125
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
126
|
+
"DisplaySurveyType",
|
|
127
|
+
"SurveyEventName",
|
|
128
|
+
"SurveyEventProperties",
|
|
129
|
+
"SurveyEventType",
|
|
130
|
+
"SurveyPosition",
|
|
131
|
+
"SurveyQuestionBranchingType",
|
|
132
|
+
"SurveyQuestionType",
|
|
133
|
+
"SurveySchedule",
|
|
134
|
+
"SurveyTabPosition",
|
|
135
|
+
"SurveyType",
|
|
136
|
+
"SurveyWidgetType"
|
|
137
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
138
|
+
Object.defineProperty(exports, '__esModule', {
|
|
139
|
+
value: true
|
|
140
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
const SurveyEventType = {
|
|
2
|
+
Activation: 'events',
|
|
3
|
+
Cancellation: 'cancelEvents'
|
|
4
|
+
};
|
|
5
|
+
const SurveyWidgetType = {
|
|
6
|
+
Button: 'button',
|
|
7
|
+
Tab: 'tab',
|
|
8
|
+
Selector: 'selector'
|
|
9
|
+
};
|
|
10
|
+
const SurveyPosition = {
|
|
11
|
+
TopLeft: 'top_left',
|
|
12
|
+
TopRight: 'top_right',
|
|
13
|
+
TopCenter: 'top_center',
|
|
14
|
+
MiddleLeft: 'middle_left',
|
|
15
|
+
MiddleRight: 'middle_right',
|
|
16
|
+
MiddleCenter: 'middle_center',
|
|
17
|
+
Left: 'left',
|
|
18
|
+
Center: 'center',
|
|
19
|
+
Right: 'right',
|
|
20
|
+
NextToTrigger: 'next_to_trigger'
|
|
21
|
+
};
|
|
22
|
+
const SurveyTabPosition = {
|
|
23
|
+
Top: 'top',
|
|
24
|
+
Left: 'left',
|
|
25
|
+
Right: 'right',
|
|
26
|
+
Bottom: 'bottom'
|
|
27
|
+
};
|
|
28
|
+
const SurveyType = {
|
|
29
|
+
Popover: 'popover',
|
|
30
|
+
API: 'api',
|
|
31
|
+
Widget: 'widget',
|
|
32
|
+
ExternalSurvey: 'external_survey'
|
|
33
|
+
};
|
|
34
|
+
const SurveyQuestionType = {
|
|
35
|
+
Open: 'open',
|
|
36
|
+
MultipleChoice: 'multiple_choice',
|
|
37
|
+
SingleChoice: 'single_choice',
|
|
38
|
+
Rating: 'rating',
|
|
39
|
+
Link: 'link'
|
|
40
|
+
};
|
|
41
|
+
const SurveyQuestionBranchingType = {
|
|
42
|
+
NextQuestion: 'next_question',
|
|
43
|
+
End: 'end',
|
|
44
|
+
ResponseBased: 'response_based',
|
|
45
|
+
SpecificQuestion: 'specific_question'
|
|
46
|
+
};
|
|
47
|
+
const SurveySchedule = {
|
|
48
|
+
Once: 'once',
|
|
49
|
+
Recurring: 'recurring',
|
|
50
|
+
Always: 'always'
|
|
51
|
+
};
|
|
52
|
+
const SurveyEventName = {
|
|
53
|
+
SHOWN: 'survey shown',
|
|
54
|
+
DISMISSED: 'survey dismissed',
|
|
55
|
+
SENT: 'survey sent',
|
|
56
|
+
ABANDONED: 'survey abandoned'
|
|
57
|
+
};
|
|
58
|
+
const SurveyEventProperties = {
|
|
59
|
+
SURVEY_ID: '$survey_id',
|
|
60
|
+
SURVEY_NAME: '$survey_name',
|
|
61
|
+
SURVEY_RESPONSE: '$survey_response',
|
|
62
|
+
SURVEY_ITERATION: '$survey_iteration',
|
|
63
|
+
SURVEY_ITERATION_START_DATE: '$survey_iteration_start_date',
|
|
64
|
+
SURVEY_PARTIALLY_COMPLETED: '$survey_partially_completed',
|
|
65
|
+
SURVEY_SUBMISSION_ID: '$survey_submission_id',
|
|
66
|
+
SURVEY_QUESTIONS: '$survey_questions',
|
|
67
|
+
SURVEY_COMPLETED: '$survey_completed',
|
|
68
|
+
PRODUCT_TOUR_ID: '$product_tour_id',
|
|
69
|
+
SURVEY_LAST_SEEN_DATE: '$survey_last_seen_date',
|
|
70
|
+
SURVEY_LANGUAGE: '$survey_language'
|
|
71
|
+
};
|
|
72
|
+
const DisplaySurveyType = {
|
|
73
|
+
Popover: 'popover',
|
|
74
|
+
Inline: 'inline'
|
|
75
|
+
};
|
|
76
|
+
export { DisplaySurveyType, SurveyEventName, SurveyEventProperties, SurveyEventType, SurveyPosition, SurveyQuestionBranchingType, SurveyQuestionType, SurveySchedule, SurveyTabPosition, SurveyType, SurveyWidgetType };
|