@posthog/browser-common 0.10.3 → 0.10.4
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/surveys/surveys-extension-utils.d.ts +8 -0
- package/dist/surveys/surveys-extension-utils.js +10 -0
- package/dist/surveys/surveys-extension-utils.mjs +8 -1
- package/dist/surveys-renderer.js +2 -4
- package/dist/surveys-renderer.mjs +3 -5
- package/package.json +3 -3
package/dist/config.js
CHANGED
package/dist/config.mjs
CHANGED
|
@@ -131,3 +131,11 @@ export declare function getSurveyContainerClass(survey: Pick<Survey, 'id'>, asSe
|
|
|
131
131
|
* Used by both surveys and product tours for consistent positioning
|
|
132
132
|
*/
|
|
133
133
|
export declare function getPopoverPosition(type?: SurveyType, position?: SurveyPosition, surveyWidgetType?: SurveyWidgetType): Record<string, string>;
|
|
134
|
+
/**
|
|
135
|
+
* Style overrides for a tab widget's popup. The popup is centred next to the
|
|
136
|
+
* tab only while the survey uses the default right position or explicitly
|
|
137
|
+
* asks to sit next to its trigger. Any other selected position is a
|
|
138
|
+
* deliberate placement, so no override applies and getPopoverPosition alone
|
|
139
|
+
* decides where the popup goes.
|
|
140
|
+
*/
|
|
141
|
+
export declare function getTabWidgetPopupOverrides(position?: SurveyPosition): Record<string, string>;
|
|
@@ -49,6 +49,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
49
49
|
getSurveyResponseKey: ()=>surveys_namespaceObject.getSurveyResponseKey,
|
|
50
50
|
getSurveySeen: ()=>getSurveySeen,
|
|
51
51
|
getSurveyStylesheet: ()=>getSurveyStylesheet,
|
|
52
|
+
getTabWidgetPopupOverrides: ()=>getTabWidgetPopupOverrides,
|
|
52
53
|
hasWaitPeriodPassed: ()=>hasWaitPeriodPassed,
|
|
53
54
|
hex2rgb: ()=>hex2rgb,
|
|
54
55
|
hexToRgba: ()=>hexToRgba,
|
|
@@ -669,6 +670,13 @@ function getPopoverPosition(type, position = external_survey_constants_js_namesp
|
|
|
669
670
|
};
|
|
670
671
|
}
|
|
671
672
|
}
|
|
673
|
+
function getTabWidgetPopupOverrides(position) {
|
|
674
|
+
if (!position || position === external_survey_constants_js_namespaceObject.SurveyPosition.Right || position === external_survey_constants_js_namespaceObject.SurveyPosition.NextToTrigger) return {
|
|
675
|
+
top: '50%',
|
|
676
|
+
bottom: 'auto'
|
|
677
|
+
};
|
|
678
|
+
return {};
|
|
679
|
+
}
|
|
672
680
|
exports.SurveyContext = __webpack_exports__.SurveyContext;
|
|
673
681
|
exports.addSurveyCSSVariablesToElement = __webpack_exports__.addSurveyCSSVariablesToElement;
|
|
674
682
|
exports.canActivateRepeatedly = __webpack_exports__.canActivateRepeatedly;
|
|
@@ -690,6 +698,7 @@ exports.getSurveyContainerClass = __webpack_exports__.getSurveyContainerClass;
|
|
|
690
698
|
exports.getSurveyResponseKey = __webpack_exports__.getSurveyResponseKey;
|
|
691
699
|
exports.getSurveySeen = __webpack_exports__.getSurveySeen;
|
|
692
700
|
exports.getSurveyStylesheet = __webpack_exports__.getSurveyStylesheet;
|
|
701
|
+
exports.getTabWidgetPopupOverrides = __webpack_exports__.getTabWidgetPopupOverrides;
|
|
693
702
|
exports.hasWaitPeriodPassed = __webpack_exports__.hasWaitPeriodPassed;
|
|
694
703
|
exports.hex2rgb = __webpack_exports__.hex2rgb;
|
|
695
704
|
exports.hexToRgba = __webpack_exports__.hexToRgba;
|
|
@@ -723,6 +732,7 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
|
723
732
|
"getSurveyResponseKey",
|
|
724
733
|
"getSurveySeen",
|
|
725
734
|
"getSurveyStylesheet",
|
|
735
|
+
"getTabWidgetPopupOverrides",
|
|
726
736
|
"hasWaitPeriodPassed",
|
|
727
737
|
"hex2rgb",
|
|
728
738
|
"hexToRgba",
|
|
@@ -606,4 +606,11 @@ function getPopoverPosition(type, position = SurveyPosition.Right, surveyWidgetT
|
|
|
606
606
|
};
|
|
607
607
|
}
|
|
608
608
|
}
|
|
609
|
-
|
|
609
|
+
function getTabWidgetPopupOverrides(position) {
|
|
610
|
+
if (!position || position === SurveyPosition.Right || position === SurveyPosition.NextToTrigger) return {
|
|
611
|
+
top: '50%',
|
|
612
|
+
bottom: 'auto'
|
|
613
|
+
};
|
|
614
|
+
return {};
|
|
615
|
+
}
|
|
616
|
+
export { SurveyContext, addSurveyCSSVariablesToElement, canActivateRepeatedly, clearAllInMemoryInProgressSurveyState, clearInProgressSurveyState, defaultSurveyAppearance, dismissedSurveyEvent, doesSurveyDeviceTypesMatch, doesSurveyMatchSelector, doesSurveyUrlMatch, getContrastingTextColor, getDisplayOrderChoices, getDisplayOrderQuestions, getFontFamily, getInProgressSurveyState, getPopoverPosition, getQuestionOrder, getSurveyContainerClass, getSurveyResponseKey, getSurveySeen, getSurveyStylesheet, getTabWidgetPopupOverrides, hasWaitPeriodPassed, hex2rgb, hexToRgba, isSurveyInProgress, renderChildrenAsTextOrHtml, retrieveSurveyShadow, sendSurveyAbandonedEvent, sendSurveyEvent, setInProgressSurveyState, shuffle, useSurveyContext };
|
package/dist/surveys-renderer.js
CHANGED
|
@@ -1164,10 +1164,7 @@ function FeedbackWidget({ survey, forceDisableHtml, posthog, readOnly, surveyLan
|
|
|
1164
1164
|
(0, hooks_namespaceObject.useEffect)(()=>{
|
|
1165
1165
|
if (!posthog) return void survey_utils_js_namespaceObject.SURVEY_LOGGER.error('FeedbackWidget called without a PostHog instance.');
|
|
1166
1166
|
if (readOnly) return;
|
|
1167
|
-
if (survey.appearance?.widgetType === 'tab') setStyleOverrides(
|
|
1168
|
-
top: '50%',
|
|
1169
|
-
bottom: 'auto'
|
|
1170
|
-
});
|
|
1167
|
+
if (survey.appearance?.widgetType === 'tab') setStyleOverrides((0, surveys_extension_utils_js_namespaceObject.getTabWidgetPopupOverrides)(survey.appearance?.position));
|
|
1171
1168
|
const handleShowSurvey = (event)=>{
|
|
1172
1169
|
const customEvent = event;
|
|
1173
1170
|
if (customEvent.detail?.surveyId === survey.id) {
|
|
@@ -1189,6 +1186,7 @@ function FeedbackWidget({ survey, forceDisableHtml, posthog, readOnly, surveyLan
|
|
|
1189
1186
|
readOnly,
|
|
1190
1187
|
survey.id,
|
|
1191
1188
|
survey.appearance?.widgetType,
|
|
1189
|
+
survey.appearance?.position,
|
|
1192
1190
|
survey.appearance?.widgetSelector,
|
|
1193
1191
|
survey.appearance?.borderColor
|
|
1194
1192
|
]);
|
|
@@ -14,7 +14,7 @@ import { ConfirmationMessage } from "./surveys/components/ConfirmationMessage.mj
|
|
|
14
14
|
import { IntroScreen } from "./surveys/components/IntroScreen.mjs";
|
|
15
15
|
import { Cancel } from "./surveys/components/QuestionHeader.mjs";
|
|
16
16
|
import { LinkQuestion, MultipleChoiceQuestion, OpenTextQuestion, RatingQuestion } from "./surveys/components/QuestionTypes.mjs";
|
|
17
|
-
import { SurveyContext, addSurveyCSSVariablesToElement, canActivateRepeatedly, clearAllInMemoryInProgressSurveyState, clearInProgressSurveyState, defaultSurveyAppearance, dismissedSurveyEvent, doesSurveyDeviceTypesMatch, doesSurveyMatchSelector, doesSurveyUrlMatch, getDisplayOrderQuestions, getInProgressSurveyState, getPopoverPosition, getQuestionOrder, getSurveyContainerClass, getSurveyResponseKey, getSurveySeen, getSurveyStylesheet, hasWaitPeriodPassed, isSurveyInProgress, retrieveSurveyShadow, sendSurveyAbandonedEvent, sendSurveyEvent, setInProgressSurveyState } from "./surveys/surveys-extension-utils.mjs";
|
|
17
|
+
import { SurveyContext, addSurveyCSSVariablesToElement, canActivateRepeatedly, clearAllInMemoryInProgressSurveyState, clearInProgressSurveyState, defaultSurveyAppearance, dismissedSurveyEvent, doesSurveyDeviceTypesMatch, doesSurveyMatchSelector, doesSurveyUrlMatch, getDisplayOrderQuestions, getInProgressSurveyState, getPopoverPosition, getQuestionOrder, getSurveyContainerClass, getSurveyResponseKey, getSurveySeen, getSurveyStylesheet, getTabWidgetPopupOverrides, hasWaitPeriodPassed, isSurveyInProgress, retrieveSurveyShadow, sendSurveyAbandonedEvent, sendSurveyEvent, setInProgressSurveyState } from "./surveys/surveys-extension-utils.mjs";
|
|
18
18
|
import { calculatePrefillStartIndex, convertPrefillToResponses, extractPrefillParamsFromUrl } from "./surveys/survey-url-prefill.mjs";
|
|
19
19
|
import { getNextSurveyStep } from "./surveys/survey-branching.mjs";
|
|
20
20
|
import { applySurveyTranslationForUser } from "./surveys/survey-translations.mjs";
|
|
@@ -1121,10 +1121,7 @@ function FeedbackWidget({ survey, forceDisableHtml, posthog, readOnly, surveyLan
|
|
|
1121
1121
|
useEffect(()=>{
|
|
1122
1122
|
if (!posthog) return void SURVEY_LOGGER.error('FeedbackWidget called without a PostHog instance.');
|
|
1123
1123
|
if (readOnly) return;
|
|
1124
|
-
if (survey.appearance?.widgetType === 'tab') setStyleOverrides(
|
|
1125
|
-
top: '50%',
|
|
1126
|
-
bottom: 'auto'
|
|
1127
|
-
});
|
|
1124
|
+
if (survey.appearance?.widgetType === 'tab') setStyleOverrides(getTabWidgetPopupOverrides(survey.appearance?.position));
|
|
1128
1125
|
const handleShowSurvey = (event)=>{
|
|
1129
1126
|
const customEvent = event;
|
|
1130
1127
|
if (customEvent.detail?.surveyId === survey.id) {
|
|
@@ -1146,6 +1143,7 @@ function FeedbackWidget({ survey, forceDisableHtml, posthog, readOnly, surveyLan
|
|
|
1146
1143
|
readOnly,
|
|
1147
1144
|
survey.id,
|
|
1148
1145
|
survey.appearance?.widgetType,
|
|
1146
|
+
survey.appearance?.position,
|
|
1149
1147
|
survey.appearance?.widgetSelector,
|
|
1150
1148
|
survey.appearance?.borderColor
|
|
1151
1149
|
]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@posthog/browser-common",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.4",
|
|
4
4
|
"description": "Internal shared browser utilities and extension primitives for PostHog Browser SDKs",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -241,8 +241,8 @@
|
|
|
241
241
|
"dependencies": {
|
|
242
242
|
"dompurify": "^3.4.13",
|
|
243
243
|
"preact": "^10.29.3",
|
|
244
|
-
"@posthog/
|
|
245
|
-
"@posthog/
|
|
244
|
+
"@posthog/types": "^1.419.0",
|
|
245
|
+
"@posthog/core": "^1.62.1"
|
|
246
246
|
},
|
|
247
247
|
"devDependencies": {
|
|
248
248
|
"@rsbuild/plugin-react": "^2.1.0",
|