posthog-js 1.151.2 → 1.152.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/array.full.js +2 -2
- package/dist/array.full.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.js.map +1 -1
- package/dist/lib/src/extensions/surveys/components/PostHogLogo.d.ts +1 -3
- package/dist/lib/src/extensions/surveys/surveys-utils.d.ts +2 -1
- package/dist/lib/src/extensions/surveys.d.ts +11 -3
- package/dist/lib/src/posthog-core.d.ts +4 -0
- package/dist/lib/src/posthog-surveys-types.d.ts +4 -0
- package/dist/lib/src/posthog-surveys.d.ts +3 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.d.ts +12 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -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/lib/package.json +1 -1
- package/lib/src/extensions/surveys/components/BottomSection.jsx +4 -4
- package/lib/src/extensions/surveys/components/BottomSection.jsx.map +1 -1
- package/lib/src/extensions/surveys/components/ConfirmationMessage.jsx +5 -2
- package/lib/src/extensions/surveys/components/ConfirmationMessage.jsx.map +1 -1
- package/lib/src/extensions/surveys/components/PostHogLogo.d.ts +1 -3
- package/lib/src/extensions/surveys/components/PostHogLogo.jsx +2 -5
- package/lib/src/extensions/surveys/components/PostHogLogo.jsx.map +1 -1
- package/lib/src/extensions/surveys/components/QuestionHeader.jsx +2 -1
- package/lib/src/extensions/surveys/components/QuestionHeader.jsx.map +1 -1
- package/lib/src/extensions/surveys/components/QuestionTypes.jsx +9 -17
- package/lib/src/extensions/surveys/components/QuestionTypes.jsx.map +1 -1
- package/lib/src/extensions/surveys/surveys-utils.d.ts +2 -1
- package/lib/src/extensions/surveys/surveys-utils.jsx +4 -2
- package/lib/src/extensions/surveys/surveys-utils.jsx.map +1 -1
- package/lib/src/extensions/surveys.d.ts +11 -3
- package/lib/src/extensions/surveys.jsx +62 -7
- package/lib/src/extensions/surveys.jsx.map +1 -1
- package/lib/src/posthog-core.d.ts +4 -0
- package/lib/src/posthog-core.js +8 -0
- package/lib/src/posthog-core.js.map +1 -1
- package/lib/src/posthog-surveys-types.d.ts +4 -0
- package/lib/src/posthog-surveys-types.js.map +1 -1
- package/lib/src/posthog-surveys.d.ts +3 -0
- package/lib/src/posthog-surveys.js +23 -1
- package/lib/src/posthog-surveys.js.map +1 -1
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ export declare function getContrastingTextColor(color?: string): "black" | "whit
|
|
|
6
6
|
export declare function getTextColor(el: HTMLElement): "black" | "white";
|
|
7
7
|
export declare const defaultSurveyAppearance: SurveyAppearance;
|
|
8
8
|
export declare const defaultBackgroundColor = "#eeeded";
|
|
9
|
-
export declare const createShadow: (styleSheet: string, surveyId: string) => ShadowRoot;
|
|
9
|
+
export declare const createShadow: (styleSheet: string, surveyId: string, element?: Element) => ShadowRoot;
|
|
10
10
|
export declare const sendSurveyEvent: (responses: Record<string, string | number | string[] | null> | undefined, survey: Survey, posthog?: PostHog) => void;
|
|
11
11
|
export declare const dismissedSurveyEvent: (survey: Survey, posthog?: PostHog, readOnly?: boolean) => void;
|
|
12
12
|
export declare const shuffle: (array: any[]) => any[];
|
|
@@ -25,6 +25,7 @@ export declare const SurveyContext: import("preact").Context<{
|
|
|
25
25
|
isPreviewMode: boolean;
|
|
26
26
|
previewPageIndex: number | undefined;
|
|
27
27
|
handleCloseSurveyPopup: () => void;
|
|
28
|
+
isPopup: boolean;
|
|
28
29
|
}>;
|
|
29
30
|
interface RenderProps {
|
|
30
31
|
component: VNode<{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PostHog } from '../posthog-core';
|
|
2
|
-
import { Survey } from '../posthog-surveys-types';
|
|
2
|
+
import { Survey, SurveyRenderReason } from '../posthog-surveys-types';
|
|
3
3
|
export declare class SurveyManager {
|
|
4
4
|
private posthog;
|
|
5
5
|
private surveyInFocus;
|
|
@@ -15,6 +15,13 @@ export declare class SurveyManager {
|
|
|
15
15
|
* @returns The surveys sorted by their appearance delay
|
|
16
16
|
*/
|
|
17
17
|
private sortSurveysByAppearanceDelay;
|
|
18
|
+
/**
|
|
19
|
+
* Checks the feature flags associated with this Survey to see if the survey can be rendered.
|
|
20
|
+
* @param survey
|
|
21
|
+
* @param instance
|
|
22
|
+
*/
|
|
23
|
+
canRenderSurvey: (survey: Survey) => SurveyRenderReason;
|
|
24
|
+
renderSurvey: (survey: Survey, selector: Element) => void;
|
|
18
25
|
callSurveysAndEvaluateDisplayLogic: (forceReload?: boolean) => void;
|
|
19
26
|
private addSurveyToFocus;
|
|
20
27
|
private removeSurveyFromFocus;
|
|
@@ -40,19 +47,20 @@ export declare const renderFeedbackWidgetPreview: ({ survey, root, forceDisableH
|
|
|
40
47
|
root: HTMLElement;
|
|
41
48
|
forceDisableHtml?: boolean | undefined;
|
|
42
49
|
}) => void;
|
|
43
|
-
export declare function generateSurveys(posthog: PostHog):
|
|
50
|
+
export declare function generateSurveys(posthog: PostHog): SurveyManager | undefined;
|
|
44
51
|
export declare function usePopupVisibility(survey: Survey, posthog: PostHog | undefined, millisecondDelay: number, isPreviewMode: boolean, removeSurveyFromFocus: (id: string) => void): {
|
|
45
52
|
isPopupVisible: boolean;
|
|
46
53
|
isSurveySent: boolean;
|
|
47
54
|
setIsPopupVisible: import("preact/hooks").StateUpdater<boolean>;
|
|
48
55
|
};
|
|
49
|
-
export declare function SurveyPopup({ survey, forceDisableHtml, posthog, style, previewPageIndex, removeSurveyFromFocus, }: {
|
|
56
|
+
export declare function SurveyPopup({ survey, forceDisableHtml, posthog, style, previewPageIndex, removeSurveyFromFocus, isPopup, }: {
|
|
50
57
|
survey: Survey;
|
|
51
58
|
forceDisableHtml?: boolean;
|
|
52
59
|
posthog?: PostHog;
|
|
53
60
|
style?: React.CSSProperties;
|
|
54
61
|
previewPageIndex?: number | undefined;
|
|
55
62
|
removeSurveyFromFocus: (id: string) => void;
|
|
63
|
+
isPopup?: boolean;
|
|
56
64
|
}): JSX.Element;
|
|
57
65
|
export declare function Questions({ survey, forceDisableHtml, posthog, styleOverrides, }: {
|
|
58
66
|
survey: Survey;
|
|
@@ -251,6 +251,10 @@ export declare class PostHog {
|
|
|
251
251
|
getSurveys(callback: SurveyCallback, forceReload?: boolean): void;
|
|
252
252
|
/** Get surveys that should be enabled for the current user. */
|
|
253
253
|
getActiveMatchingSurveys(callback: SurveyCallback, forceReload?: boolean): void;
|
|
254
|
+
/** Render a survey on a specific element. */
|
|
255
|
+
renderSurvey(surveyId: string, selector: string): void;
|
|
256
|
+
/** Checks the feature flags associated with this Survey to see if the survey can be rendered. */
|
|
257
|
+
canRenderSurvey(surveyId: string): void;
|
|
254
258
|
/** Get the next step of the survey: a question index or `end` */
|
|
255
259
|
getNextSurveyStep(survey: Survey, currentQuestionIndex: number, response: string | string[] | number | null): number | SurveyQuestionBranchingType.End;
|
|
256
260
|
/**
|
|
@@ -7,6 +7,7 @@ export declare class PostHogSurveys {
|
|
|
7
7
|
private readonly instance;
|
|
8
8
|
private _decideServerResponse?;
|
|
9
9
|
_surveyEventReceiver: SurveyEventReceiver | null;
|
|
10
|
+
private _surveyManager;
|
|
10
11
|
constructor(instance: PostHog);
|
|
11
12
|
afterDecideResponse(response: DecideResponse): void;
|
|
12
13
|
loadIfEnabled(): void;
|
|
@@ -14,4 +15,6 @@ export declare class PostHogSurveys {
|
|
|
14
15
|
getActiveMatchingSurveys(callback: SurveyCallback, forceReload?: boolean): void;
|
|
15
16
|
getNextSurveyStep(survey: Survey, currentQuestionIndex: number, response: string | string[] | number | null): any;
|
|
16
17
|
private _canActivateRepeatedly;
|
|
18
|
+
canRenderSurvey(surveyId: string): void;
|
|
19
|
+
renderSurvey(surveyId: string, selector: string): void;
|
|
17
20
|
}
|