posthog-react-native 4.81.7 → 4.81.8
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/posthog-rn.d.ts +3 -0
- package/dist/posthog-rn.js +1 -1
- package/dist/posthog-rn.js.map +1 -1
- package/dist/surveys/components/ConfirmationMessage.js +1 -1
- package/dist/surveys/components/ConfirmationMessage.js.map +1 -1
- package/dist/surveys/components/SurveyModal.js +1 -1
- package/dist/surveys/components/SurveyModal.js.map +1 -1
- package/dist/surveys/surveys-utils.d.ts +1 -0
- package/dist/surveys/surveys-utils.js +1 -1
- package/dist/surveys/surveys-utils.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.ConfirmationMessage=ConfirmationMessage;var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _safeStyleSheet=require("../safeStyleSheet");var _surveysUtils=require("../surveys-utils");var _BottomSection=require("./BottomSection");var _jsxRuntime=require("react/jsx-runtime");var _jsxFileName="/home/runner/work/posthog-js/posthog-js/packages/react-native/dist/surveys/components/ConfirmationMessage.js";function ConfirmationMessage(_ref){var appearance=_ref.appearance,header=_ref.header,description=_ref.description,contentType=_ref.contentType,onClose=_ref.onClose,styleOverrides=_ref.styleOverrides,isModal=_ref.isModal;var textColor=(0,_surveysUtils.getContrastingTextColor)(appearance.backgroundColor);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styleOverrides,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.thankYouMessageContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'header'),style:[styles.thankYouMessageHeader,{color:textColor}],children:header}),(0,_surveysUtils.shouldRenderDescription)(description,contentType)&&(0,_jsxRuntime.jsx)(_reactNative.Text,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'description'),style:{color:textColor,opacity:_surveysUtils.defaultDescriptionOpacity},children:description})]}),isModal&&(0,_jsxRuntime.jsx)(_BottomSection.BottomSection,{text:appearance.thankYouMessageCloseButtonText,submitDisabled:false,appearance:appearance,onSubmit:onClose})]});}var styles=(0,_safeStyleSheet.createSafeStyleSheet)({thankYouMessageContainer:{padding:10,paddingRight:_surveysUtils.closeButtonSize},thankYouMessageHeader:{fontSize:18,fontWeight:'bold'}});
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.ConfirmationMessage=ConfirmationMessage;var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _safeStyleSheet=require("../safeStyleSheet");var _surveysUtils=require("../surveys-utils");var _BottomSection=require("./BottomSection");var _jsxRuntime=require("react/jsx-runtime");var _jsxFileName="/home/runner/work/posthog-js/posthog-js/packages/react-native/dist/surveys/components/ConfirmationMessage.js";function ConfirmationMessage(_ref){var appearance=_ref.appearance,header=_ref.header,description=_ref.description,contentType=_ref.contentType,onClose=_ref.onClose,styleOverrides=_ref.styleOverrides,isModal=_ref.isModal;var textColor=(0,_surveysUtils.getContrastingTextColor)(appearance.backgroundColor);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styleOverrides,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.thankYouMessageContainer,children:[header?(0,_jsxRuntime.jsx)(_reactNative.Text,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'header'),style:[styles.thankYouMessageHeader,{color:textColor}],children:header}):null,(0,_surveysUtils.shouldRenderDescription)(description,contentType)&&(0,_jsxRuntime.jsx)(_reactNative.Text,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'description'),style:{color:textColor,opacity:_surveysUtils.defaultDescriptionOpacity},children:description})]}),isModal&&(0,_jsxRuntime.jsx)(_BottomSection.BottomSection,{text:appearance.thankYouMessageCloseButtonText,submitDisabled:false,appearance:appearance,onSubmit:onClose})]});}var styles=(0,_safeStyleSheet.createSafeStyleSheet)({thankYouMessageContainer:{padding:10,paddingRight:_surveysUtils.closeButtonSize},thankYouMessageHeader:{fontSize:18,fontWeight:'bold'}});
|
|
2
2
|
//# sourceMappingURL=ConfirmationMessage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmationMessage.js","names":["_react","_interopRequireDefault","require","_reactNative","_safeStyleSheet","_surveysUtils","_BottomSection","_jsxRuntime","_jsxFileName","ConfirmationMessage","_ref","appearance","header","description","contentType","onClose","styleOverrides","isModal","textColor","getContrastingTextColor","backgroundColor","jsxs","View","style","children","styles","thankYouMessageContainer","jsx","Text","maxFontSizeMultiplier","getMaxFontSizeMultiplier","thankYouMessageHeader","color","shouldRenderDescription","opacity","defaultDescriptionOpacity","BottomSection","text","thankYouMessageCloseButtonText","submitDisabled","onSubmit","createSafeStyleSheet","padding","paddingRight","closeButtonSize","fontSize","fontWeight"],"sources":["../../../src/surveys/components/ConfirmationMessage.tsx"],"sourcesContent":["import React from 'react'\nimport { Text, View, ViewStyle } from 'react-native'\n\nimport { createSafeStyleSheet } from '../safeStyleSheet'\nimport {\n closeButtonSize,\n defaultDescriptionOpacity,\n getContrastingTextColor,\n getMaxFontSizeMultiplier,\n shouldRenderDescription,\n SurveyAppearanceTheme,\n} from '../surveys-utils'\nimport { SurveyQuestionDescriptionContentType } from '@posthog/core'\nimport { BottomSection } from './BottomSection'\n\nexport function ConfirmationMessage({\n appearance,\n header,\n description,\n contentType,\n onClose,\n styleOverrides,\n isModal,\n}: {\n appearance: SurveyAppearanceTheme\n header: string\n description: string\n contentType?: SurveyQuestionDescriptionContentType\n onClose: () => void\n styleOverrides?: ViewStyle\n isModal: boolean\n}): JSX.Element {\n const textColor = getContrastingTextColor(appearance.backgroundColor)\n\n return (\n <View style={styleOverrides}>\n <View style={styles.thankYouMessageContainer}>\n <Text\n
|
|
1
|
+
{"version":3,"file":"ConfirmationMessage.js","names":["_react","_interopRequireDefault","require","_reactNative","_safeStyleSheet","_surveysUtils","_BottomSection","_jsxRuntime","_jsxFileName","ConfirmationMessage","_ref","appearance","header","description","contentType","onClose","styleOverrides","isModal","textColor","getContrastingTextColor","backgroundColor","jsxs","View","style","children","styles","thankYouMessageContainer","jsx","Text","maxFontSizeMultiplier","getMaxFontSizeMultiplier","thankYouMessageHeader","color","shouldRenderDescription","opacity","defaultDescriptionOpacity","BottomSection","text","thankYouMessageCloseButtonText","submitDisabled","onSubmit","createSafeStyleSheet","padding","paddingRight","closeButtonSize","fontSize","fontWeight"],"sources":["../../../src/surveys/components/ConfirmationMessage.tsx"],"sourcesContent":["import React from 'react'\nimport { Text, View, ViewStyle } from 'react-native'\n\nimport { createSafeStyleSheet } from '../safeStyleSheet'\nimport {\n closeButtonSize,\n defaultDescriptionOpacity,\n getContrastingTextColor,\n getMaxFontSizeMultiplier,\n shouldRenderDescription,\n SurveyAppearanceTheme,\n} from '../surveys-utils'\nimport { SurveyQuestionDescriptionContentType } from '@posthog/core'\nimport { BottomSection } from './BottomSection'\n\nexport function ConfirmationMessage({\n appearance,\n header,\n description,\n contentType,\n onClose,\n styleOverrides,\n isModal,\n}: {\n appearance: SurveyAppearanceTheme\n header: string\n description: string\n contentType?: SurveyQuestionDescriptionContentType\n onClose: () => void\n styleOverrides?: ViewStyle\n isModal: boolean\n}): JSX.Element {\n const textColor = getContrastingTextColor(appearance.backgroundColor)\n\n return (\n <View style={styleOverrides}>\n <View style={styles.thankYouMessageContainer}>\n {header ? (\n <Text\n maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'header')}\n style={[styles.thankYouMessageHeader, { color: textColor }]}\n >\n {header}\n </Text>\n ) : null}\n {shouldRenderDescription(description, contentType) && (\n <Text\n maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'description')}\n style={{ color: textColor, opacity: defaultDescriptionOpacity }}\n >\n {description}\n </Text>\n )}\n </View>\n {isModal && (\n <BottomSection\n text={appearance.thankYouMessageCloseButtonText}\n submitDisabled={false}\n appearance={appearance}\n onSubmit={onClose}\n />\n )}\n </View>\n )\n}\n\nconst styles = createSafeStyleSheet({\n thankYouMessageContainer: {\n padding: 10,\n paddingRight: closeButtonSize,\n },\n thankYouMessageHeader: {\n fontSize: 18,\n fontWeight: 'bold',\n },\n})\n"],"mappings":"yMAAA,IAAAA,MAAA,CAAAC,sBAAA,CAAAC,OAAA,WACA,IAAAC,YAAA,CAAAD,OAAA,iBAEA,IAAAE,eAAA,CAAAF,OAAA,sBACA,IAAAG,aAAA,CAAAH,OAAA,qBASA,IAAAI,cAAA,CAAAJ,OAAA,oBAA+C,IAAAK,WAAA,CAAAL,OAAA,0BAAAM,YAAA,gHAEzC,QAAU,CAAAC,mBAAmBA,CAAAC,IAAA,CAgBlC,IAfC,CAAAC,UAAU,CAAAD,IAAA,CAAVC,UAAU,CACVC,MAAM,CAAAF,IAAA,CAANE,MAAM,CACNC,WAAW,CAAAH,IAAA,CAAXG,WAAW,CACXC,WAAW,CAAAJ,IAAA,CAAXI,WAAW,CACXC,OAAO,CAAAL,IAAA,CAAPK,OAAO,CACPC,cAAc,CAAAN,IAAA,CAAdM,cAAc,CACdC,OAAO,CAAAP,IAAA,CAAPO,OAAO,CAUP,GAAM,CAAAC,SAAS,CAAG,GAAAC,qCAAuB,EAACR,UAAU,CAACS,eAAe,CAAC,CAErE,MACE,GAAAb,WAAA,CAAAc,IAAA,EAAClB,YAAA,CAAAmB,IAAI,EAACC,KAAK,CAAEP,cAAe,CAAAQ,QAAA,EAC1B,GAAAjB,WAAA,CAAAc,IAAA,EAAClB,YAAA,CAAAmB,IAAI,EAACC,KAAK,CAAEE,MAAM,CAACC,wBAAyB,CAAAF,QAAA,EAC1CZ,MAAM,CACL,GAAAL,WAAA,CAAAoB,GAAA,EAACxB,YAAA,CAAAyB,IAAI,EACHC,qBAAqB,CAAE,GAAAC,sCAAwB,EAACnB,UAAU,CAAE,QAAQ,CAAE,CACtEY,KAAK,CAAE,CAACE,MAAM,CAACM,qBAAqB,CAAE,CAAEC,KAAK,CAAEd,SAAS,CAAE,CAAE,CAAAM,QAAA,CAE3DZ,MAAM,CACH,CAAC,CACL,IAAI,CACP,GAAAqB,qCAAuB,EAACpB,WAAW,CAAEC,WAAW,CAAC,EAChD,GAAAP,WAAA,CAAAoB,GAAA,EAACxB,YAAA,CAAAyB,IAAI,EACHC,qBAAqB,CAAE,GAAAC,sCAAwB,EAACnB,UAAU,CAAE,aAAa,CAAE,CAC3EY,KAAK,CAAE,CAAES,KAAK,CAAEd,SAAS,CAAEgB,OAAO,CAAEC,uCAAyB,CAAG,CAAAX,QAAA,CAE/DX,WAAW,CACR,CACP,EACG,CACN,CAACI,OAAO,EACN,GAAAV,WAAA,CAAAoB,GAAA,EAACrB,cAAA,CAAA8B,aAAa,EACZC,IAAI,CAAE1B,UAAU,CAAC2B,8BAA+B,CAChDC,cAAc,CAAE,KAAM,CACtB5B,UAAU,CAAEA,UAAW,CACvB6B,QAAQ,CAAEzB,OAAQ,EAErB,EACG,CAAC,CAEX,CAEA,GAAM,CAAAU,MAAM,CAAG,GAAAgB,oCAAoB,EAAC,CAClCf,wBAAwB,CAAE,CACxBgB,OAAO,CAAE,EAAE,CACXC,YAAY,CAAEC,6B,CACf,CACDb,qBAAqB,CAAE,CACrBc,QAAQ,CAAE,EAAE,CACZC,UAAU,CAAE,M,EAEf,CAAC","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _typeof=require("@babel/runtime/helpers/typeof");Object.defineProperty(exports,"__esModule",{value:true});exports.SurveyModal=SurveyModal;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _Cancel=require("./Cancel");var _ConfirmationMessage=require("./ConfirmationMessage");var _IntroMessage=require("./IntroMessage");var _safeStyleSheet=require("../safeStyleSheet");var _surveysUtils=require("../surveys-utils");var _OptionalReactNativeSafeArea=require("../../optional/OptionalReactNativeSafeArea");var _Surveys=require("./Surveys");var _jsxRuntime=require("react/jsx-runtime");var _jsxFileName="/home/runner/work/posthog-js/posthog-js/packages/react-native/dist/surveys/components/SurveyModal.js";function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var r=new WeakMap(),n=new WeakMap();return(_interopRequireWildcard=function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var o,i,f={__proto__:null,"default":e};if(null===e||"object"!=_typeof(e)&&"function"!=typeof e)return f;if(o=t?n:r){if(o.has(e))return o.get(e);o.set(e,f);}for(var _t2 in e)"default"!==_t2&&{}.hasOwnProperty.call(e,_t2)&&((i=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,_t2))&&(i.get||i.set)?o(f,_t2,i):f[_t2]=e[_t2]);return f;})(e,t);}var VIEWPORT_BUFFER=0;var MODAL_FADE_DURATION_MS=250;var IOS_DISMISS_FALLBACK_MS=1000;function shouldShowIntro(appearance,progress){var _a;if(Object.keys((_a=progress===null||progress===void 0?void 0:progress.responses)!==null&&_a!==void 0?_a:{}).length>0)return false;return Boolean(appearance.displayIntroScreen)&&Boolean(appearance.introScreenHeader||appearance.introScreenDescription);}function SurveyModal(props){var _a;var _b;var survey=props.survey,surveyLanguage=props.surveyLanguage,appearance=props.appearance,onShow=props.onShow,onCloseProp=props.onClose,_props$androidKeyboar=props.androidKeyboardBehavior,androidKeyboardBehavior=_props$androidKeyboar===void 0?'height':_props$androidKeyboar;var _useState=(0,_react.useState)(false),_useState2=(0,_slicedToArray2["default"])(_useState,2),isSurveySent=_useState2[0],setIsSurveySent=_useState2[1];var _useState3=(0,_react.useState)(function(){return shouldShowIntro(appearance,props.initialProgress);}),_useState4=(0,_slicedToArray2["default"])(_useState3,2),showIntro=_useState4[0],setShowIntro=_useState4[1];var _useState5=(0,_react.useState)((_b=(_a=props.initialProgress)===null||_a===void 0?void 0:_a.responses)!==null&&_b!==void 0?_b:{}),_useState6=(0,_slicedToArray2["default"])(_useState5,2),responses=_useState6[0],setResponses=_useState6[1];var _useState7=(0,_react.useState)(true),_useState8=(0,_slicedToArray2["default"])(_useState7,2),isVisible=_useState8[0],setIsVisible=_useState8[1];var _useState9=(0,_react.useState)(true),_useState0=(0,_slicedToArray2["default"])(_useState9,2),contentMounted=_useState0[0],setContentMounted=_useState0[1];var isClosingRef=(0,_react.useRef)(false);var closeNotifiedRef=(0,_react.useRef)(false);var closeTimerRef=(0,_react.useRef)(null);var notifyParentClosed=(0,_react.useCallback)(function(){if(closeNotifiedRef.current)return;closeNotifiedRef.current=true;onCloseProp(isSurveySent,responses);},[isSurveySent,onCloseProp,responses]);var onClose=(0,_react.useCallback)(function(){if(isClosingRef.current)return;isClosingRef.current=true;setContentMounted(false);requestAnimationFrame(function(){setIsVisible(false);var fallbackDelay=_reactNative.Platform.OS==='ios'?IOS_DISMISS_FALLBACK_MS:MODAL_FADE_DURATION_MS;closeTimerRef.current=setTimeout(notifyParentClosed,fallbackDelay);});},[notifyParentClosed]);(0,_react.useEffect)(function(){return function(){if(closeTimerRef.current){clearTimeout(closeTimerRef.current);}};},[]);var insets=(0,_OptionalReactNativeSafeArea.useOptionalSafeAreaInsets)();var _useWindowDimensions=(0,_reactNative.useWindowDimensions)(),windowHeight=_useWindowDimensions.height;var _useState1=(0,_react.useState)(0),_useState10=(0,_slicedToArray2["default"])(_useState1,2),keyboardHeight=_useState10[0],setKeyboardHeight=_useState10[1];var _resolveSurveyAlignme=(0,_surveysUtils.resolveSurveyAlignment)(appearance.position),vertical=_resolveSurveyAlignme.vertical,horizontal=_resolveSurveyAlignme.horizontal;var isBottom=vertical==='flex-end';var shouldShowConfirmation=
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _typeof=require("@babel/runtime/helpers/typeof");Object.defineProperty(exports,"__esModule",{value:true});exports.SurveyModal=SurveyModal;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _Cancel=require("./Cancel");var _ConfirmationMessage=require("./ConfirmationMessage");var _IntroMessage=require("./IntroMessage");var _safeStyleSheet=require("../safeStyleSheet");var _surveysUtils=require("../surveys-utils");var _OptionalReactNativeSafeArea=require("../../optional/OptionalReactNativeSafeArea");var _Surveys=require("./Surveys");var _jsxRuntime=require("react/jsx-runtime");var _jsxFileName="/home/runner/work/posthog-js/posthog-js/packages/react-native/dist/surveys/components/SurveyModal.js";function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var r=new WeakMap(),n=new WeakMap();return(_interopRequireWildcard=function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var o,i,f={__proto__:null,"default":e};if(null===e||"object"!=_typeof(e)&&"function"!=typeof e)return f;if(o=t?n:r){if(o.has(e))return o.get(e);o.set(e,f);}for(var _t2 in e)"default"!==_t2&&{}.hasOwnProperty.call(e,_t2)&&((i=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,_t2))&&(i.get||i.set)?o(f,_t2,i):f[_t2]=e[_t2]);return f;})(e,t);}var VIEWPORT_BUFFER=0;var MODAL_FADE_DURATION_MS=250;var IOS_DISMISS_FALLBACK_MS=1000;function shouldShowIntro(appearance,progress){var _a;if(Object.keys((_a=progress===null||progress===void 0?void 0:progress.responses)!==null&&_a!==void 0?_a:{}).length>0)return false;return Boolean(appearance.displayIntroScreen)&&Boolean(appearance.introScreenHeader||appearance.introScreenDescription);}function SurveyModal(props){var _a;var _b;var survey=props.survey,surveyLanguage=props.surveyLanguage,appearance=props.appearance,onShow=props.onShow,onCloseProp=props.onClose,_props$androidKeyboar=props.androidKeyboardBehavior,androidKeyboardBehavior=_props$androidKeyboar===void 0?'height':_props$androidKeyboar;var _useState=(0,_react.useState)(false),_useState2=(0,_slicedToArray2["default"])(_useState,2),isSurveySent=_useState2[0],setIsSurveySent=_useState2[1];var _useState3=(0,_react.useState)(function(){return shouldShowIntro(appearance,props.initialProgress);}),_useState4=(0,_slicedToArray2["default"])(_useState3,2),showIntro=_useState4[0],setShowIntro=_useState4[1];var _useState5=(0,_react.useState)((_b=(_a=props.initialProgress)===null||_a===void 0?void 0:_a.responses)!==null&&_b!==void 0?_b:{}),_useState6=(0,_slicedToArray2["default"])(_useState5,2),responses=_useState6[0],setResponses=_useState6[1];var _useState7=(0,_react.useState)(true),_useState8=(0,_slicedToArray2["default"])(_useState7,2),isVisible=_useState8[0],setIsVisible=_useState8[1];var _useState9=(0,_react.useState)(true),_useState0=(0,_slicedToArray2["default"])(_useState9,2),contentMounted=_useState0[0],setContentMounted=_useState0[1];var isClosingRef=(0,_react.useRef)(false);var closeNotifiedRef=(0,_react.useRef)(false);var closeTimerRef=(0,_react.useRef)(null);var notifyParentClosed=(0,_react.useCallback)(function(){if(closeNotifiedRef.current)return;closeNotifiedRef.current=true;onCloseProp(isSurveySent,responses);},[isSurveySent,onCloseProp,responses]);var onClose=(0,_react.useCallback)(function(){if(isClosingRef.current)return;isClosingRef.current=true;setContentMounted(false);requestAnimationFrame(function(){setIsVisible(false);var fallbackDelay=_reactNative.Platform.OS==='ios'?IOS_DISMISS_FALLBACK_MS:MODAL_FADE_DURATION_MS;closeTimerRef.current=setTimeout(notifyParentClosed,fallbackDelay);});},[notifyParentClosed]);(0,_react.useEffect)(function(){return function(){if(closeTimerRef.current){clearTimeout(closeTimerRef.current);}};},[]);var insets=(0,_OptionalReactNativeSafeArea.useOptionalSafeAreaInsets)();var _useWindowDimensions=(0,_reactNative.useWindowDimensions)(),windowHeight=_useWindowDimensions.height;var _useState1=(0,_react.useState)(0),_useState10=(0,_slicedToArray2["default"])(_useState1,2),keyboardHeight=_useState10[0],setKeyboardHeight=_useState10[1];var _resolveSurveyAlignme=(0,_surveysUtils.resolveSurveyAlignment)(appearance.position),vertical=_resolveSurveyAlignme.vertical,horizontal=_resolveSurveyAlignme.horizontal;var isBottom=vertical==='flex-end';var shouldShowConfirmation=(0,_surveysUtils.shouldShowConfirmationMessage)(appearance);(0,_react.useEffect)(function(){if(isVisible){onShow();}},[isVisible,onShow]);(0,_react.useEffect)(function(){if(isSurveySent&&!shouldShowConfirmation){onClose();}},[isSurveySent,shouldShowConfirmation,onClose]);(0,_react.useEffect)(function(){var showEvent=_reactNative.Platform.OS==='ios'?'keyboardWillShow':'keyboardDidShow';var hideEvent=_reactNative.Platform.OS==='ios'?'keyboardWillHide':'keyboardDidHide';var showSub=_reactNative.Keyboard.addListener(showEvent,function(e){return setKeyboardHeight(e.endCoordinates.height);});var hideSub=_reactNative.Keyboard.addListener(hideEvent,function(){return setKeyboardHeight(0);});return function(){showSub.remove();hideSub.remove();};},[]);var maxModalHeight=Math.max(windowHeight-keyboardHeight-insets.top-insets.bottom-VIEWPORT_BUFFER,200);var keyboardBehavior=_reactNative.Platform.OS==='ios'?'padding':androidKeyboardBehavior;return(0,_jsxRuntime.jsx)(_reactNative.Modal,{visible:isVisible,animationType:"fade",transparent:true,onRequestClose:onClose,onDismiss:_reactNative.Platform.OS==='ios'?notifyParentClosed:undefined,statusBarTranslucent:true,children:contentMounted&&(0,_jsxRuntime.jsx)(_reactNative.KeyboardAvoidingView,{behavior:keyboardBehavior,style:styles.fill,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.fill,styles.backdrop,{justifyContent:vertical}],onTouchStart:_reactNative.Keyboard.dismiss,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.modalRow,{justifyContent:horizontal}],children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.modalContent,pointerEvents:"box-none",children:(0,_jsxRuntime.jsxs)(_reactNative.View,{onTouchStart:function onTouchStart(event){return event.stopPropagation();},style:[styles.modalContentInner,{borderColor:appearance.borderColor,backgroundColor:appearance.backgroundColor,marginTop:vertical==='flex-start'?insets.top+10:0,marginBottom:isBottom?keyboardHeight>0?0:insets.bottom+10:0,marginHorizontal:10,maxHeight:maxModalHeight}],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.topIconContainer,children:(0,_jsxRuntime.jsx)(_Cancel.Cancel,{onPress:onClose,appearance:appearance})}),isSurveySent?shouldShowConfirmation?(0,_jsxRuntime.jsx)(_ConfirmationMessage.ConfirmationMessage,{appearance:appearance,header:appearance.thankYouMessageHeader,description:appearance.thankYouMessageDescription,contentType:appearance.thankYouMessageDescriptionContentType,onClose:onClose,isModal:true}):null:showIntro?(0,_jsxRuntime.jsx)(_IntroMessage.IntroMessage,{appearance:appearance,header:appearance.introScreenHeader,description:appearance.introScreenDescription,contentType:appearance.introScreenDescriptionContentType,onStart:function onStart(){return setShowIntro(false);}}):(0,_jsxRuntime.jsx)(_Surveys.Questions,{client:props.client,initialProgress:props.initialProgress,onProgressChange:props.onProgressChange,survey:survey,surveyLanguage:surveyLanguage,appearance:appearance,onResponsesChange:setResponses,onSubmit:function onSubmit(){return setIsSurveySent(true);}})]})})})})})});}var styles=(0,_safeStyleSheet.createSafeStyleSheet)({fill:{flex:1},backdrop:{backgroundColor:'rgba(0, 0, 0, 0.32)'},modalRow:{flexDirection:'row'},modalContent:{width:'90%',maxWidth:400},modalContentInner:{borderRadius:10,borderWidth:1,padding:20},topIconContainer:{position:'absolute',right:8,top:8,zIndex:1}});
|
|
2
2
|
//# sourceMappingURL=SurveyModal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SurveyModal.js","names":["_react","_interopRequireWildcard","require","_reactNative","_Cancel","_ConfirmationMessage","_IntroMessage","_safeStyleSheet","_surveysUtils","_OptionalReactNativeSafeArea","_Surveys","_jsxRuntime","_jsxFileName","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t2","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","VIEWPORT_BUFFER","MODAL_FADE_DURATION_MS","IOS_DISMISS_FALLBACK_MS","shouldShowIntro","appearance","progress","keys","_a","responses","length","Boolean","displayIntroScreen","introScreenHeader","introScreenDescription","SurveyModal","props","survey","surveyLanguage","onShow","onCloseProp","onClose","_props$androidKeyboar","androidKeyboardBehavior","_useState","useState","_useState2","_slicedToArray2","isSurveySent","setIsSurveySent","_useState3","initialProgress","_useState4","showIntro","setShowIntro","_useState5","_b","_useState6","setResponses","_useState7","_useState8","isVisible","setIsVisible","_useState9","_useState0","contentMounted","setContentMounted","isClosingRef","useRef","closeNotifiedRef","closeTimerRef","notifyParentClosed","useCallback","current","requestAnimationFrame","fallbackDelay","Platform","OS","setTimeout","useEffect","clearTimeout","insets","useOptionalSafeAreaInsets","_useWindowDimensions","useWindowDimensions","windowHeight","height","_useState1","_useState10","keyboardHeight","setKeyboardHeight","_resolveSurveyAlignme","resolveSurveyAlignment","position","vertical","horizontal","isBottom","shouldShowConfirmation","thankYouMessageHeader","showEvent","hideEvent","showSub","Keyboard","addListener","endCoordinates","hideSub","remove","maxModalHeight","Math","max","top","bottom","keyboardBehavior","jsx","Modal","visible","animationType","transparent","onRequestClose","onDismiss","undefined","statusBarTranslucent","children","KeyboardAvoidingView","behavior","style","styles","fill","View","backdrop","justifyContent","onTouchStart","dismiss","modalRow","modalContent","pointerEvents","jsxs","event","stopPropagation","modalContentInner","borderColor","backgroundColor","marginTop","marginBottom","marginHorizontal","maxHeight","topIconContainer","Cancel","onPress","ConfirmationMessage","header","description","thankYouMessageDescription","contentType","thankYouMessageDescriptionContentType","isModal","IntroMessage","introScreenDescriptionContentType","onStart","Questions","client","onProgressChange","onResponsesChange","onSubmit","createSafeStyleSheet","flex","flexDirection","width","maxWidth","borderRadius","borderWidth","padding","right","zIndex"],"sources":["../../../src/surveys/components/SurveyModal.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from 'react'\nimport { Keyboard, KeyboardAvoidingView, Modal, Platform, View, useWindowDimensions } from 'react-native'\n\nimport { Cancel } from './Cancel'\nimport { ConfirmationMessage } from './ConfirmationMessage'\nimport { IntroMessage } from './IntroMessage'\nimport { createSafeStyleSheet } from '../safeStyleSheet'\nimport { SurveyAppearanceTheme, resolveSurveyAlignment } from '../surveys-utils'\nimport { Survey, type SurveyResponses } from '@posthog/core'\nimport { useOptionalSafeAreaInsets } from '../../optional/OptionalReactNativeSafeArea'\nimport { Questions } from './Surveys'\nimport type { SurveyProgress } from '../survey-progress'\nimport type { PostHog } from '../../posthog-rn'\n\nexport type SurveyModalProps = {\n survey: Survey\n client?: PostHog\n initialProgress?: SurveyProgress\n onProgressChange?: (progress: SurveyProgress, completed: boolean) => boolean\n surveyLanguage: string | null\n appearance: SurveyAppearanceTheme\n onShow: () => void\n onClose: (submitted: boolean, responses: SurveyResponses) => void\n androidKeyboardBehavior?: 'padding' | 'height'\n}\n\n// No extra buffer — let the modal extend right up to the safe-area / keyboard\n// edges. Insets already keep it clear of the status bar and home indicator.\nconst VIEWPORT_BUFFER = 0\n\n// Matches RN Modal's fade animation duration (Android only).\nconst MODAL_FADE_DURATION_MS = 250\n\n// iOS normally notifies the parent via Modal.onDismiss, but Fabric can fail to fire it\n// (https://github.com/facebook/react-native/issues/48245). When that happens the parent never\n// clears the active survey, so this transparent full-screen Modal stays mounted and swallows\n// every touch — the app appears frozen. This is the safety-net delay after which we notify the\n// parent ourselves if onDismiss still hasn't fired. Longer than the dismiss animation so the\n// real onDismiss stays the primary path on the happy path.\nconst IOS_DISMISS_FALLBACK_MS = 1000\n\nfunction shouldShowIntro(appearance: SurveyAppearanceTheme, progress?: SurveyProgress): boolean {\n if (Object.keys(progress?.responses ?? {}).length > 0) return false\n return (\n Boolean(appearance.displayIntroScreen) && Boolean(appearance.introScreenHeader || appearance.introScreenDescription)\n )\n}\n\nexport function SurveyModal(props: SurveyModalProps): JSX.Element | null {\n const { survey, surveyLanguage, appearance, onShow, onClose: onCloseProp, androidKeyboardBehavior = 'height' } = props\n const [isSurveySent, setIsSurveySent] = useState(false)\n // The intro screen is a leading page mirroring the trailing confirmation message. Dismissing it\n // only flips local state — no response is recorded and no survey event is sent. It has no\n // default header, so an intro with no copy at all is skipped instead of drawing an empty box.\n const [showIntro, setShowIntro] = useState(() => shouldShowIntro(appearance, props.initialProgress))\n const [responses, setResponses] = useState<SurveyResponses>(props.initialProgress?.responses ?? {})\n const [isVisible, setIsVisible] = useState(true)\n // Two-step hide for RN Fabric snapshot recycling — see\n // https://github.com/facebook/react-native/issues/48245\n const [contentMounted, setContentMounted] = useState(true)\n const isClosingRef = useRef(false)\n const closeNotifiedRef = useRef(false)\n const closeTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n const notifyParentClosed = useCallback(() => {\n if (closeNotifiedRef.current) return\n closeNotifiedRef.current = true\n onCloseProp(isSurveySent, responses)\n }, [isSurveySent, onCloseProp, responses])\n const onClose = useCallback(() => {\n if (isClosingRef.current) return\n isClosingRef.current = true\n setContentMounted(false)\n requestAnimationFrame(() => {\n setIsVisible(false)\n // Always schedule a fallback to notify the parent. On Android the Modal has no onDismiss,\n // so this is the only notification path (after the fade). On iOS onDismiss is the primary\n // path, but it can silently fail to fire — this timer guarantees the parent still unmounts\n // the Modal so it can never stay up intercepting touches. notifyParentClosed is idempotent,\n // so whichever fires first wins and the other becomes a no-op.\n const fallbackDelay = Platform.OS === 'ios' ? IOS_DISMISS_FALLBACK_MS : MODAL_FADE_DURATION_MS\n closeTimerRef.current = setTimeout(notifyParentClosed, fallbackDelay)\n })\n }, [notifyParentClosed])\n\n // Clear the pending fallback timer on unmount so it can't fire after the survey is gone.\n useEffect(() => {\n return () => {\n if (closeTimerRef.current) {\n clearTimeout(closeTimerRef.current)\n }\n }\n }, [])\n const insets = useOptionalSafeAreaInsets()\n const { height: windowHeight } = useWindowDimensions()\n const [keyboardHeight, setKeyboardHeight] = useState(0)\n const { vertical, horizontal } = resolveSurveyAlignment(appearance.position)\n const isBottom = vertical === 'flex-end'\n\n const shouldShowConfirmation = isSurveySent && appearance.thankYouMessageHeader\n\n useEffect(() => {\n if (isVisible) {\n onShow()\n }\n }, [isVisible, onShow])\n\n // Track keyboard height so we can cap the modal to the visible viewport.\n // KAV alone lifts the modal but doesn't shrink it — a tall modal would\n // still bleed past the screen top.\n useEffect(() => {\n const showEvent = Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow'\n const hideEvent = Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide'\n const showSub = Keyboard.addListener(showEvent, (e) => setKeyboardHeight(e.endCoordinates.height))\n const hideSub = Keyboard.addListener(hideEvent, () => setKeyboardHeight(0))\n return () => {\n showSub.remove()\n hideSub.remove()\n }\n }, [])\n\n const maxModalHeight = Math.max(windowHeight - keyboardHeight - insets.top - insets.bottom - VIEWPORT_BUFFER, 200)\n\n const keyboardBehavior = Platform.OS === 'ios' ? 'padding' : androidKeyboardBehavior\n\n return (\n <Modal\n visible={isVisible}\n animationType=\"fade\"\n transparent\n onRequestClose={onClose}\n onDismiss={Platform.OS === 'ios' ? notifyParentClosed : undefined}\n statusBarTranslucent={true}\n >\n {contentMounted && (\n <KeyboardAvoidingView behavior={keyboardBehavior} style={styles.fill}>\n <View style={[styles.fill, styles.backdrop, { justifyContent: vertical }]} onTouchStart={Keyboard.dismiss}>\n <View style={[styles.modalRow, { justifyContent: horizontal }]}>\n <View style={styles.modalContent} pointerEvents=\"box-none\">\n <View\n onTouchStart={(event) => event.stopPropagation()}\n style={[\n styles.modalContentInner,\n {\n borderColor: appearance.borderColor,\n backgroundColor: appearance.backgroundColor,\n marginTop: vertical === 'flex-start' ? insets.top + 10 : 0,\n // When keyboard is up, sit flush against it (no extra gap).\n // When keyboard is down, leave room for the home indicator.\n marginBottom: isBottom ? (keyboardHeight > 0 ? 0 : insets.bottom + 10) : 0,\n marginHorizontal: 10,\n maxHeight: maxModalHeight,\n },\n ]}\n >\n <View style={styles.topIconContainer}>\n <Cancel onPress={onClose} appearance={appearance} />\n </View>\n {isSurveySent ? (\n shouldShowConfirmation ? (\n <ConfirmationMessage\n appearance={appearance}\n header={appearance.thankYouMessageHeader}\n description={appearance.thankYouMessageDescription}\n contentType={appearance.thankYouMessageDescriptionContentType}\n onClose={onClose}\n isModal={true}\n />\n ) : null\n ) : showIntro ? (\n <IntroMessage\n appearance={appearance}\n header={appearance.introScreenHeader}\n description={appearance.introScreenDescription}\n contentType={appearance.introScreenDescriptionContentType}\n onStart={() => setShowIntro(false)}\n />\n ) : (\n <Questions\n client={props.client}\n initialProgress={props.initialProgress}\n onProgressChange={props.onProgressChange}\n survey={survey}\n surveyLanguage={surveyLanguage}\n appearance={appearance}\n onResponsesChange={setResponses}\n onSubmit={() => setIsSurveySent(true)}\n />\n )}\n </View>\n </View>\n </View>\n </View>\n </KeyboardAvoidingView>\n )}\n </Modal>\n )\n}\n\nconst styles = createSafeStyleSheet({\n fill: {\n flex: 1,\n },\n backdrop: {\n backgroundColor: 'rgba(0, 0, 0, 0.32)',\n },\n modalRow: {\n flexDirection: 'row',\n },\n modalContent: {\n width: '90%',\n maxWidth: 400,\n },\n modalContentInner: {\n borderRadius: 10,\n borderWidth: 1,\n padding: 20,\n },\n topIconContainer: {\n // Keep the close button inside the modal so it can never bleed off-screen\n // when the modal lifts above the keyboard.\n position: 'absolute',\n right: 8,\n top: 8,\n zIndex: 1,\n },\n})\n"],"mappings":"0UAAA,IAAAA,MAAA,CAAAC,uBAAA,CAAAC,OAAA,WACA,IAAAC,YAAA,CAAAD,OAAA,iBAEA,IAAAE,OAAA,CAAAF,OAAA,aACA,IAAAG,oBAAA,CAAAH,OAAA,0BACA,IAAAI,aAAA,CAAAJ,OAAA,mBACA,IAAAK,eAAA,CAAAL,OAAA,sBACA,IAAAM,aAAA,CAAAN,OAAA,qBAEA,IAAAO,4BAAA,CAAAP,OAAA,+CACA,IAAAQ,QAAA,CAAAR,OAAA,cAAqC,IAAAS,WAAA,CAAAT,OAAA,0BAAAU,YAAA,iHAAAX,wBA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DR,QAAQ,CAAE,CACRiC,aAAa,CAAE,K,CAChB,CACDhC,YAAY,CAAE,CACZiC,KAAK,CAAE,KAAK,CACZC,QAAQ,CAAE,G,CACX,CACD7B,iBAAiB,CAAE,CACjB8B,YAAY,CAAE,EAAE,CAChBC,WAAW,CAAE,CAAC,CACdC,OAAO,CAAE,E,CACV,CACDzB,gBAAgB,CAAE,CAGhBrD,QAAQ,CAAE,UAAU,CACpB+E,KAAK,CAAE,CAAC,CACR9D,GAAG,CAAE,CAAC,CACN+D,MAAM,CAAE,C,EAEX,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"SurveyModal.js","names":["_react","_interopRequireWildcard","require","_reactNative","_Cancel","_ConfirmationMessage","_IntroMessage","_safeStyleSheet","_surveysUtils","_OptionalReactNativeSafeArea","_Surveys","_jsxRuntime","_jsxFileName","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t2","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","VIEWPORT_BUFFER","MODAL_FADE_DURATION_MS","IOS_DISMISS_FALLBACK_MS","shouldShowIntro","appearance","progress","keys","_a","responses","length","Boolean","displayIntroScreen","introScreenHeader","introScreenDescription","SurveyModal","props","survey","surveyLanguage","onShow","onCloseProp","onClose","_props$androidKeyboar","androidKeyboardBehavior","_useState","useState","_useState2","_slicedToArray2","isSurveySent","setIsSurveySent","_useState3","initialProgress","_useState4","showIntro","setShowIntro","_useState5","_b","_useState6","setResponses","_useState7","_useState8","isVisible","setIsVisible","_useState9","_useState0","contentMounted","setContentMounted","isClosingRef","useRef","closeNotifiedRef","closeTimerRef","notifyParentClosed","useCallback","current","requestAnimationFrame","fallbackDelay","Platform","OS","setTimeout","useEffect","clearTimeout","insets","useOptionalSafeAreaInsets","_useWindowDimensions","useWindowDimensions","windowHeight","height","_useState1","_useState10","keyboardHeight","setKeyboardHeight","_resolveSurveyAlignme","resolveSurveyAlignment","position","vertical","horizontal","isBottom","shouldShowConfirmation","shouldShowConfirmationMessage","showEvent","hideEvent","showSub","Keyboard","addListener","endCoordinates","hideSub","remove","maxModalHeight","Math","max","top","bottom","keyboardBehavior","jsx","Modal","visible","animationType","transparent","onRequestClose","onDismiss","undefined","statusBarTranslucent","children","KeyboardAvoidingView","behavior","style","styles","fill","View","backdrop","justifyContent","onTouchStart","dismiss","modalRow","modalContent","pointerEvents","jsxs","event","stopPropagation","modalContentInner","borderColor","backgroundColor","marginTop","marginBottom","marginHorizontal","maxHeight","topIconContainer","Cancel","onPress","ConfirmationMessage","header","thankYouMessageHeader","description","thankYouMessageDescription","contentType","thankYouMessageDescriptionContentType","isModal","IntroMessage","introScreenDescriptionContentType","onStart","Questions","client","onProgressChange","onResponsesChange","onSubmit","createSafeStyleSheet","flex","flexDirection","width","maxWidth","borderRadius","borderWidth","padding","right","zIndex"],"sources":["../../../src/surveys/components/SurveyModal.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from 'react'\nimport { Keyboard, KeyboardAvoidingView, Modal, Platform, View, useWindowDimensions } from 'react-native'\n\nimport { Cancel } from './Cancel'\nimport { ConfirmationMessage } from './ConfirmationMessage'\nimport { IntroMessage } from './IntroMessage'\nimport { createSafeStyleSheet } from '../safeStyleSheet'\nimport { SurveyAppearanceTheme, resolveSurveyAlignment, shouldShowConfirmationMessage } from '../surveys-utils'\nimport { Survey, type SurveyResponses } from '@posthog/core'\nimport { useOptionalSafeAreaInsets } from '../../optional/OptionalReactNativeSafeArea'\nimport { Questions } from './Surveys'\nimport type { SurveyProgress } from '../survey-progress'\nimport type { PostHog } from '../../posthog-rn'\n\nexport type SurveyModalProps = {\n survey: Survey\n client?: PostHog\n initialProgress?: SurveyProgress\n onProgressChange?: (progress: SurveyProgress, completed: boolean) => boolean\n surveyLanguage: string | null\n appearance: SurveyAppearanceTheme\n onShow: () => void\n onClose: (submitted: boolean, responses: SurveyResponses) => void\n androidKeyboardBehavior?: 'padding' | 'height'\n}\n\n// No extra buffer — let the modal extend right up to the safe-area / keyboard\n// edges. Insets already keep it clear of the status bar and home indicator.\nconst VIEWPORT_BUFFER = 0\n\n// Matches RN Modal's fade animation duration (Android only).\nconst MODAL_FADE_DURATION_MS = 250\n\n// iOS normally notifies the parent via Modal.onDismiss, but Fabric can fail to fire it\n// (https://github.com/facebook/react-native/issues/48245). When that happens the parent never\n// clears the active survey, so this transparent full-screen Modal stays mounted and swallows\n// every touch — the app appears frozen. This is the safety-net delay after which we notify the\n// parent ourselves if onDismiss still hasn't fired. Longer than the dismiss animation so the\n// real onDismiss stays the primary path on the happy path.\nconst IOS_DISMISS_FALLBACK_MS = 1000\n\nfunction shouldShowIntro(appearance: SurveyAppearanceTheme, progress?: SurveyProgress): boolean {\n if (Object.keys(progress?.responses ?? {}).length > 0) return false\n return (\n Boolean(appearance.displayIntroScreen) && Boolean(appearance.introScreenHeader || appearance.introScreenDescription)\n )\n}\n\nexport function SurveyModal(props: SurveyModalProps): JSX.Element | null {\n const { survey, surveyLanguage, appearance, onShow, onClose: onCloseProp, androidKeyboardBehavior = 'height' } = props\n const [isSurveySent, setIsSurveySent] = useState(false)\n // The intro screen is a leading page mirroring the trailing confirmation message. Dismissing it\n // only flips local state — no response is recorded and no survey event is sent. It has no\n // default header, so an intro with no copy at all is skipped instead of drawing an empty box.\n const [showIntro, setShowIntro] = useState(() => shouldShowIntro(appearance, props.initialProgress))\n const [responses, setResponses] = useState<SurveyResponses>(props.initialProgress?.responses ?? {})\n const [isVisible, setIsVisible] = useState(true)\n // Two-step hide for RN Fabric snapshot recycling — see\n // https://github.com/facebook/react-native/issues/48245\n const [contentMounted, setContentMounted] = useState(true)\n const isClosingRef = useRef(false)\n const closeNotifiedRef = useRef(false)\n const closeTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n const notifyParentClosed = useCallback(() => {\n if (closeNotifiedRef.current) return\n closeNotifiedRef.current = true\n onCloseProp(isSurveySent, responses)\n }, [isSurveySent, onCloseProp, responses])\n const onClose = useCallback(() => {\n if (isClosingRef.current) return\n isClosingRef.current = true\n setContentMounted(false)\n requestAnimationFrame(() => {\n setIsVisible(false)\n // Always schedule a fallback to notify the parent. On Android the Modal has no onDismiss,\n // so this is the only notification path (after the fade). On iOS onDismiss is the primary\n // path, but it can silently fail to fire — this timer guarantees the parent still unmounts\n // the Modal so it can never stay up intercepting touches. notifyParentClosed is idempotent,\n // so whichever fires first wins and the other becomes a no-op.\n const fallbackDelay = Platform.OS === 'ios' ? IOS_DISMISS_FALLBACK_MS : MODAL_FADE_DURATION_MS\n closeTimerRef.current = setTimeout(notifyParentClosed, fallbackDelay)\n })\n }, [notifyParentClosed])\n\n // Clear the pending fallback timer on unmount so it can't fire after the survey is gone.\n useEffect(() => {\n return () => {\n if (closeTimerRef.current) {\n clearTimeout(closeTimerRef.current)\n }\n }\n }, [])\n const insets = useOptionalSafeAreaInsets()\n const { height: windowHeight } = useWindowDimensions()\n const [keyboardHeight, setKeyboardHeight] = useState(0)\n const { vertical, horizontal } = resolveSurveyAlignment(appearance.position)\n const isBottom = vertical === 'flex-end'\n\n const shouldShowConfirmation = shouldShowConfirmationMessage(appearance)\n\n useEffect(() => {\n if (isVisible) {\n onShow()\n }\n }, [isVisible, onShow])\n\n // The survey is over and it has no confirmation message, so close the modal. Without this the\n // modal stays up as an empty box with only the close button in it.\n useEffect(() => {\n if (isSurveySent && !shouldShowConfirmation) {\n onClose()\n }\n }, [isSurveySent, shouldShowConfirmation, onClose])\n\n // Track keyboard height so we can cap the modal to the visible viewport.\n // KAV alone lifts the modal but doesn't shrink it — a tall modal would\n // still bleed past the screen top.\n useEffect(() => {\n const showEvent = Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow'\n const hideEvent = Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide'\n const showSub = Keyboard.addListener(showEvent, (e) => setKeyboardHeight(e.endCoordinates.height))\n const hideSub = Keyboard.addListener(hideEvent, () => setKeyboardHeight(0))\n return () => {\n showSub.remove()\n hideSub.remove()\n }\n }, [])\n\n const maxModalHeight = Math.max(windowHeight - keyboardHeight - insets.top - insets.bottom - VIEWPORT_BUFFER, 200)\n\n const keyboardBehavior = Platform.OS === 'ios' ? 'padding' : androidKeyboardBehavior\n\n return (\n <Modal\n visible={isVisible}\n animationType=\"fade\"\n transparent\n onRequestClose={onClose}\n onDismiss={Platform.OS === 'ios' ? notifyParentClosed : undefined}\n statusBarTranslucent={true}\n >\n {contentMounted && (\n <KeyboardAvoidingView behavior={keyboardBehavior} style={styles.fill}>\n <View style={[styles.fill, styles.backdrop, { justifyContent: vertical }]} onTouchStart={Keyboard.dismiss}>\n <View style={[styles.modalRow, { justifyContent: horizontal }]}>\n <View style={styles.modalContent} pointerEvents=\"box-none\">\n <View\n onTouchStart={(event) => event.stopPropagation()}\n style={[\n styles.modalContentInner,\n {\n borderColor: appearance.borderColor,\n backgroundColor: appearance.backgroundColor,\n marginTop: vertical === 'flex-start' ? insets.top + 10 : 0,\n // When keyboard is up, sit flush against it (no extra gap).\n // When keyboard is down, leave room for the home indicator.\n marginBottom: isBottom ? (keyboardHeight > 0 ? 0 : insets.bottom + 10) : 0,\n marginHorizontal: 10,\n maxHeight: maxModalHeight,\n },\n ]}\n >\n <View style={styles.topIconContainer}>\n <Cancel onPress={onClose} appearance={appearance} />\n </View>\n {isSurveySent ? (\n shouldShowConfirmation ? (\n <ConfirmationMessage\n appearance={appearance}\n header={appearance.thankYouMessageHeader}\n description={appearance.thankYouMessageDescription}\n contentType={appearance.thankYouMessageDescriptionContentType}\n onClose={onClose}\n isModal={true}\n />\n ) : null\n ) : showIntro ? (\n <IntroMessage\n appearance={appearance}\n header={appearance.introScreenHeader}\n description={appearance.introScreenDescription}\n contentType={appearance.introScreenDescriptionContentType}\n onStart={() => setShowIntro(false)}\n />\n ) : (\n <Questions\n client={props.client}\n initialProgress={props.initialProgress}\n onProgressChange={props.onProgressChange}\n survey={survey}\n surveyLanguage={surveyLanguage}\n appearance={appearance}\n onResponsesChange={setResponses}\n onSubmit={() => setIsSurveySent(true)}\n />\n )}\n </View>\n </View>\n </View>\n </View>\n </KeyboardAvoidingView>\n )}\n </Modal>\n )\n}\n\nconst styles = createSafeStyleSheet({\n fill: {\n flex: 1,\n },\n backdrop: {\n backgroundColor: 'rgba(0, 0, 0, 0.32)',\n },\n modalRow: {\n flexDirection: 'row',\n },\n modalContent: {\n width: '90%',\n maxWidth: 400,\n },\n modalContentInner: {\n borderRadius: 10,\n borderWidth: 1,\n padding: 20,\n },\n topIconContainer: {\n // Keep the close button inside the modal so it can never bleed off-screen\n // when the modal lifts above the keyboard.\n position: 'absolute',\n right: 8,\n top: 8,\n zIndex: 1,\n },\n})\n"],"mappings":"0UAAA,IAAAA,MAAA,CAAAC,uBAAA,CAAAC,OAAA,WACA,IAAAC,YAAA,CAAAD,OAAA,iBAEA,IAAAE,OAAA,CAAAF,OAAA,aACA,IAAAG,oBAAA,CAAAH,OAAA,0BACA,IAAAI,aAAA,CAAAJ,OAAA,mBACA,IAAAK,eAAA,CAAAL,OAAA,sBACA,IAAAM,aAAA,CAAAN,OAAA,qBAEA,IAAAO,4BAAA,CAAAP,OAAA,+CACA,IAAAQ,QAAA,CAAAR,OAAA,cAAqC,IAAAS,WAAA,CAAAT,OAAA,0BAAAU,YAAA,iHAAAX,wBAAAY,CAAA,CAAAC,CAAA,wBAAAC,OAAA,KAAAC,CAAA,KAAAD,OAAA,GAAAE,CAAA,KAAAF,OAAA,UAAAd,uBAAA,UAAAA,wBAAAY,CAAA,CAAAC,CAAA,MAAAA,CAAA,EAAAD,CAAA,EAAAA,CAAA,CAAAK,UAAA,QAAAL,CAAA,KAAAM,CAAA,CAAAC,CAAA,CAAAC,CAAA,EAAAC,SAAA,gBAAAT,CAAA,YAAAA,CAAA,YAAAU,OAAA,CAAAV,CAAA,sBAAAA,CAAA,QAAAQ,CAAA,IAAAF,CAAA,CAAAL,CAAA,CAAAG,CAAA,CAAAD,CAAA,KAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,SAAA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CACpBgF,KAAK,CAAE,CAAC,CACR/D,GAAG,CAAE,CAAC,CACNgE,MAAM,CAAE,C,EAEX,CAAC","ignoreList":[]}
|
|
@@ -95,6 +95,7 @@ export type SurveyAppearanceTheme = Omit<Required<SurveyAppearance>, 'widgetSele
|
|
|
95
95
|
*/
|
|
96
96
|
export declare function getMaxFontSizeMultiplier(appearance: Pick<SurveyAppearance, 'maxFontSizeMultiplier'>, role: SurveyTextRole): number | undefined;
|
|
97
97
|
export declare const defaultSurveyAppearance: SurveyAppearanceTheme;
|
|
98
|
+
export declare function shouldShowConfirmationMessage(appearance: Pick<SurveyAppearance, 'displayThankYouMessage' | 'thankYouMessageHeader' | 'thankYouMessageDescription' | 'thankYouMessageDescriptionContentType'>): boolean;
|
|
98
99
|
export type SurveyFlexAlign = 'flex-start' | 'center' | 'flex-end';
|
|
99
100
|
export declare function resolveSurveyAlignment(position: string | undefined): {
|
|
100
101
|
vertical: SurveyFlexAlign;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.defaultSurveyAppearance=exports.defaultRatingLabelOpacity=exports.defaultDescriptionOpacity=exports.defaultBackgroundColor=exports.closeButtonSize=void 0;exports.getContrastingTextColor=getContrastingTextColor;exports.getDisplayOrderQuestions=void 0;exports.getMaxFontSizeMultiplier=getMaxFontSizeMultiplier;exports.getNextSurveyStep=getNextSurveyStep;Object.defineProperty(exports,"isMatchingRegex",{enumerable:true,get:function get(){return _surveys.isMatchingRegex;}});Object.defineProperty(exports,"matchPropertyFilters",{enumerable:true,get:function get(){return _surveys.matchPropertyFilters;}});exports.resolveSurveyAlignment=resolveSurveyAlignment;exports.shouldRenderDescription=shouldRenderDescription;Object.defineProperty(exports,"surveyValidationMap",{enumerable:true,get:function get(){return _surveys.propertyComparisons;}});var _core=require("@posthog/core");var _surveys=require("@posthog/core/surveys");function isInteger(value){return typeof value==='number'&&Number.isInteger(value);}function shouldRenderDescription(description,contentType){var effectiveContentType=contentType!==null&&contentType!==void 0?contentType:_core.SurveyQuestionDescriptionContentType.Text;return Boolean(description&&effectiveContentType===_core.SurveyQuestionDescriptionContentType.Text);}var defaultBackgroundColor=exports.defaultBackgroundColor='#eeeded';var defaultDescriptionOpacity=exports.defaultDescriptionOpacity=0.8;var defaultRatingLabelOpacity=exports.defaultRatingLabelOpacity=0.7;var closeButtonSize=exports.closeButtonSize=40;function getMaxFontSizeMultiplier(appearance,role){var configured=appearance.maxFontSizeMultiplier;if(typeof configured==='number'){return configured;}return configured===null||configured===void 0?void 0:configured[role];}var defaultSurveyAppearance=exports.defaultSurveyAppearance={backgroundColor:defaultBackgroundColor,submitButtonColor:'black',submitButtonTextColor:'white',ratingButtonColor:'white',ratingButtonActiveColor:'black',inputBackground:'white',borderColor:'#c9c6c6',displayThankYouMessage:true,thankYouMessageHeader:'Thank you for your feedback!',position:_core.SurveyPosition.Center,submitButtonText:'Submit',autoDisappear:false,thankYouMessageDescription:'',thankYouMessageDescriptionContentType:_core.SurveyQuestionDescriptionContentType.Text,thankYouMessageCloseButtonText:'Close',displayIntroScreen:false,introScreenHeader:'',introScreenDescription:'',introScreenDescriptionContentType:_core.SurveyQuestionDescriptionContentType.Text,introScreenButtonText:'Get started',surveyPopupDelaySeconds:0,allowGoBack:false,backButtonText:'Back'};var KNOWN_SURVEY_POSITIONS=new Set(Object.values(_core.SurveyPosition));var warnedUnknownPositions=new Set();function normalizeSurveyPosition(position){return position.replace(/-/g,'_').replace(/^bottom_/,'');}function resolveSurveyAlignment(position){var resolvedPosition=defaultSurveyAppearance.position;if(position){var normalizedPosition=typeof position==='string'?normalizeSurveyPosition(position):'';if(KNOWN_SURVEY_POSITIONS.has(normalizedPosition)){resolvedPosition=normalizedPosition;}else if(!warnedUnknownPositions.has(normalizedPosition)){warnedUnknownPositions.add(normalizedPosition);console.warn("[PostHog.surveys] Unknown survey position ".concat(JSON.stringify(position)," \u2014 falling back to ").concat(defaultSurveyAppearance.position,". Expected one of: ").concat(Object.values(_core.SurveyPosition).join(', '),"."));}}var isTop=resolvedPosition===_core.SurveyPosition.TopLeft||resolvedPosition===_core.SurveyPosition.TopCenter||resolvedPosition===_core.SurveyPosition.TopRight;var isMiddle=resolvedPosition===_core.SurveyPosition.MiddleLeft||resolvedPosition===_core.SurveyPosition.MiddleCenter||resolvedPosition===_core.SurveyPosition.MiddleRight;var isLeft=resolvedPosition===_core.SurveyPosition.TopLeft||resolvedPosition===_core.SurveyPosition.MiddleLeft||resolvedPosition===_core.SurveyPosition.Left;var isRight=resolvedPosition===_core.SurveyPosition.TopRight||resolvedPosition===_core.SurveyPosition.MiddleRight||resolvedPosition===_core.SurveyPosition.Right;return{vertical:isTop?'flex-start':isMiddle?'center':'flex-end',horizontal:isLeft?'flex-start':isRight?'flex-end':'center'};}var getDisplayOrderQuestions=exports.getDisplayOrderQuestions=function getDisplayOrderQuestions(survey){survey.questions.forEach(function(question,idx){question.originalQuestionIndex=idx;});return survey.questions;};function getRatingBucketForResponseValue(responseValue,scale){if(scale===3){if(responseValue<1||responseValue>3){console.warn('PostHog Debug: Rating response out of range for scale 3:',responseValue);return'neutral';}return responseValue===1?'negative':responseValue===2?'neutral':'positive';}else if(scale===5){if(responseValue<1||responseValue>5){console.warn('PostHog Debug: Rating response out of range for scale 5:',responseValue);return'neutral';}return responseValue<=2?'negative':responseValue===3?'neutral':'positive';}else if(scale===7){if(responseValue<1||responseValue>7){console.warn('PostHog Debug: Rating response out of range for scale 7:',responseValue);return'neutral';}return responseValue<=3?'negative':responseValue===4?'neutral':'positive';}else if(scale===10){if(responseValue<0||responseValue>10){console.warn('PostHog Debug: Rating response out of range for scale 10:',responseValue);return'passives';}return responseValue<=6?'detractors':responseValue<=8?'passives':'promoters';}console.warn('PostHog Debug: Unsupported rating scale:',scale);return'neutral';}function getNextSurveyStep(survey,currentQuestionIndex,response){var _a,_b,_c,_d,_e;var question=survey.questions[currentQuestionIndex];var nextQuestionIndex=currentQuestionIndex+1;if(!((_a=question.branching)===null||_a===void 0?void 0:_a.type)){if(currentQuestionIndex===survey.questions.length-1){return _core.SurveyQuestionBranchingType.End;}return nextQuestionIndex;}if(question.branching.type===_core.SurveyQuestionBranchingType.End){return _core.SurveyQuestionBranchingType.End;}else if(question.branching.type===_core.SurveyQuestionBranchingType.SpecificQuestion){if(isInteger(question.branching.index)){return question.branching.index;}}else if(question.branching.type===_core.SurveyQuestionBranchingType.ResponseBased){if(question.type===_core.SurveyQuestionType.SingleChoice){var selectedChoiceIndex=question.choices.indexOf("".concat(response));if(selectedChoiceIndex===-1&&question.hasOpenChoice){selectedChoiceIndex=question.choices.length-1;}if((_c=(_b=question.branching)===null||_b===void 0?void 0:_b.responseValues)===null||_c===void 0?void 0:_c.hasOwnProperty(selectedChoiceIndex)){var nextStep=question.branching.responseValues[selectedChoiceIndex];if(isInteger(nextStep)){return nextStep;}if(nextStep===_core.SurveyQuestionBranchingType.End){return _core.SurveyQuestionBranchingType.End;}return nextQuestionIndex;}}else if(question.type===_core.SurveyQuestionType.Rating){if(!isInteger(response)){console.warn('PostHog Debug: Expected integer response for rating question but received:',response);return nextQuestionIndex;}var ratingQuestion=question;var ratingBucket=getRatingBucketForResponseValue(response,ratingQuestion.scale);if((_e=(_d=question.branching)===null||_d===void 0?void 0:_d.responseValues)===null||_e===void 0?void 0:_e.hasOwnProperty(ratingBucket)){var _nextStep=question.branching.responseValues[ratingBucket];if(isInteger(_nextStep)){return _nextStep;}if(_nextStep===_core.SurveyQuestionBranchingType.End){return _core.SurveyQuestionBranchingType.End;}return nextQuestionIndex;}}return nextQuestionIndex;}console.warn('Falling back to next question index due to unexpected branching type');return nextQuestionIndex;}function getContrastingTextColor(color){var rgb;if(color.startsWith('#')){rgb=hex2rgb(color);}if(color.startsWith('rgb')){rgb=color;}var nameColorToHex=nameToHex(color);if(nameColorToHex){rgb=hex2rgb(nameColorToHex);}if(!rgb){return'black';}var colorMatch=rgb.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(colorMatch){var r=parseInt(colorMatch[1],10);var g=parseInt(colorMatch[2],10);var b=parseInt(colorMatch[3],10);var hsp=Math.sqrt(0.299*(r*r)+0.587*(g*g)+0.114*(b*b));return hsp>127.5?'black':'white';}return'black';}function hex2rgb(c){if(c.startsWith('#')){var hexColor=c.replace(/^#/,'');if(/^[0-9A-Fa-f]{3}$/.test(hexColor)){hexColor=hexColor[0]+hexColor[0]+hexColor[1]+hexColor[1]+hexColor[2]+hexColor[2];}if(!/^[0-9A-Fa-f]{6}$/.test(hexColor)){return'rgb(255, 255, 255)';}var r=parseInt(hexColor.slice(0,2),16);var g=parseInt(hexColor.slice(2,4),16);var b=parseInt(hexColor.slice(4,6),16);return"rgb(".concat(r,",").concat(g,",").concat(b,")");}return'rgb(255, 255, 255)';}function nameToHex(name){return{aliceblue:'#f0f8ff',antiquewhite:'#faebd7',aqua:'#00ffff',aquamarine:'#7fffd4',azure:'#f0ffff',beige:'#f5f5dc',bisque:'#ffe4c4',black:'#000000',blanchedalmond:'#ffebcd',blue:'#0000ff',blueviolet:'#8a2be2',brown:'#a52a2a',burlywood:'#deb887',cadetblue:'#5f9ea0',chartreuse:'#7fff00',chocolate:'#d2691e',coral:'#ff7f50',cornflowerblue:'#6495ed',cornsilk:'#fff8dc',crimson:'#dc143c',cyan:'#00ffff',darkblue:'#00008b',darkcyan:'#008b8b',darkgoldenrod:'#b8860b',darkgray:'#a9a9a9',darkgreen:'#006400',darkkhaki:'#bdb76b',darkmagenta:'#8b008b',darkolivegreen:'#556b2f',darkorange:'#ff8c00',darkorchid:'#9932cc',darkred:'#8b0000',darksalmon:'#e9967a',darkseagreen:'#8fbc8f',darkslateblue:'#483d8b',darkslategray:'#2f4f4f',darkturquoise:'#00ced1',darkviolet:'#9400d3',deeppink:'#ff1493',deepskyblue:'#00bfff',dimgray:'#696969',dodgerblue:'#1e90ff',firebrick:'#b22222',floralwhite:'#fffaf0',forestgreen:'#228b22',fuchsia:'#ff00ff',gainsboro:'#dcdcdc',ghostwhite:'#f8f8ff',gold:'#ffd700',goldenrod:'#daa520',gray:'#808080',green:'#008000',greenyellow:'#adff2f',honeydew:'#f0fff0',hotpink:'#ff69b4','indianred ':'#cd5c5c',indigo:'#4b0082',ivory:'#fffff0',khaki:'#f0e68c',lavender:'#e6e6fa',lavenderblush:'#fff0f5',lawngreen:'#7cfc00',lemonchiffon:'#fffacd',lightblue:'#add8e6',lightcoral:'#f08080',lightcyan:'#e0ffff',lightgoldenrodyellow:'#fafad2',lightgrey:'#d3d3d3',lightgreen:'#90ee90',lightpink:'#ffb6c1',lightsalmon:'#ffa07a',lightseagreen:'#20b2aa',lightskyblue:'#87cefa',lightslategray:'#778899',lightsteelblue:'#b0c4de',lightyellow:'#ffffe0',lime:'#00ff00',limegreen:'#32cd32',linen:'#faf0e6',magenta:'#ff00ff',maroon:'#800000',mediumaquamarine:'#66cdaa',mediumblue:'#0000cd',mediumorchid:'#ba55d3',mediumpurple:'#9370d8',mediumseagreen:'#3cb371',mediumslateblue:'#7b68ee',mediumspringgreen:'#00fa9a',mediumturquoise:'#48d1cc',mediumvioletred:'#c71585',midnightblue:'#191970',mintcream:'#f5fffa',mistyrose:'#ffe4e1',moccasin:'#ffe4b5',navajowhite:'#ffdead',navy:'#000080',oldlace:'#fdf5e6',olive:'#808000',olivedrab:'#6b8e23',orange:'#ffa500',orangered:'#ff4500',orchid:'#da70d6',palegoldenrod:'#eee8aa',palegreen:'#98fb98',paleturquoise:'#afeeee',palevioletred:'#d87093',papayawhip:'#ffefd5',peachpuff:'#ffdab9',peru:'#cd853f',pink:'#ffc0cb',plum:'#dda0dd',powderblue:'#b0e0e6',purple:'#800080',red:'#ff0000',rosybrown:'#bc8f8f',royalblue:'#4169e1',saddlebrown:'#8b4513',salmon:'#fa8072',sandybrown:'#f4a460',seagreen:'#2e8b57',seashell:'#fff5ee',sienna:'#a0522d',silver:'#c0c0c0',skyblue:'#87ceeb',slateblue:'#6a5acd',slategray:'#708090',snow:'#fffafa',springgreen:'#00ff7f',steelblue:'#4682b4',tan:'#d2b48c',teal:'#008080',thistle:'#d8bfd8',tomato:'#ff6347',turquoise:'#40e0d0',violet:'#ee82ee',wheat:'#f5deb3',white:'#ffffff',whitesmoke:'#f5f5f5',yellow:'#ffff00',yellowgreen:'#9acd32'}[name.toLowerCase()];}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.defaultSurveyAppearance=exports.defaultRatingLabelOpacity=exports.defaultDescriptionOpacity=exports.defaultBackgroundColor=exports.closeButtonSize=void 0;exports.getContrastingTextColor=getContrastingTextColor;exports.getDisplayOrderQuestions=void 0;exports.getMaxFontSizeMultiplier=getMaxFontSizeMultiplier;exports.getNextSurveyStep=getNextSurveyStep;Object.defineProperty(exports,"isMatchingRegex",{enumerable:true,get:function get(){return _surveys.isMatchingRegex;}});Object.defineProperty(exports,"matchPropertyFilters",{enumerable:true,get:function get(){return _surveys.matchPropertyFilters;}});exports.resolveSurveyAlignment=resolveSurveyAlignment;exports.shouldRenderDescription=shouldRenderDescription;exports.shouldShowConfirmationMessage=shouldShowConfirmationMessage;Object.defineProperty(exports,"surveyValidationMap",{enumerable:true,get:function get(){return _surveys.propertyComparisons;}});var _core=require("@posthog/core");var _surveys=require("@posthog/core/surveys");function isInteger(value){return typeof value==='number'&&Number.isInteger(value);}function shouldRenderDescription(description,contentType){var effectiveContentType=contentType!==null&&contentType!==void 0?contentType:_core.SurveyQuestionDescriptionContentType.Text;return Boolean(description&&effectiveContentType===_core.SurveyQuestionDescriptionContentType.Text);}var defaultBackgroundColor=exports.defaultBackgroundColor='#eeeded';var defaultDescriptionOpacity=exports.defaultDescriptionOpacity=0.8;var defaultRatingLabelOpacity=exports.defaultRatingLabelOpacity=0.7;var closeButtonSize=exports.closeButtonSize=40;function getMaxFontSizeMultiplier(appearance,role){var configured=appearance.maxFontSizeMultiplier;if(typeof configured==='number'){return configured;}return configured===null||configured===void 0?void 0:configured[role];}var defaultSurveyAppearance=exports.defaultSurveyAppearance={backgroundColor:defaultBackgroundColor,submitButtonColor:'black',submitButtonTextColor:'white',ratingButtonColor:'white',ratingButtonActiveColor:'black',inputBackground:'white',borderColor:'#c9c6c6',displayThankYouMessage:true,thankYouMessageHeader:'Thank you for your feedback!',position:_core.SurveyPosition.Center,submitButtonText:'Submit',autoDisappear:false,thankYouMessageDescription:'',thankYouMessageDescriptionContentType:_core.SurveyQuestionDescriptionContentType.Text,thankYouMessageCloseButtonText:'Close',displayIntroScreen:false,introScreenHeader:'',introScreenDescription:'',introScreenDescriptionContentType:_core.SurveyQuestionDescriptionContentType.Text,introScreenButtonText:'Get started',surveyPopupDelaySeconds:0,allowGoBack:false,backButtonText:'Back'};function shouldShowConfirmationMessage(appearance){var _a;return((_a=appearance.displayThankYouMessage)!==null&&_a!==void 0?_a:true)&&(Boolean(appearance.thankYouMessageHeader)||shouldRenderDescription(appearance.thankYouMessageDescription,appearance.thankYouMessageDescriptionContentType));}var KNOWN_SURVEY_POSITIONS=new Set(Object.values(_core.SurveyPosition));var warnedUnknownPositions=new Set();function normalizeSurveyPosition(position){return position.replace(/-/g,'_').replace(/^bottom_/,'');}function resolveSurveyAlignment(position){var resolvedPosition=defaultSurveyAppearance.position;if(position){var normalizedPosition=typeof position==='string'?normalizeSurveyPosition(position):'';if(KNOWN_SURVEY_POSITIONS.has(normalizedPosition)){resolvedPosition=normalizedPosition;}else if(!warnedUnknownPositions.has(normalizedPosition)){warnedUnknownPositions.add(normalizedPosition);console.warn("[PostHog.surveys] Unknown survey position ".concat(JSON.stringify(position)," \u2014 falling back to ").concat(defaultSurveyAppearance.position,". Expected one of: ").concat(Object.values(_core.SurveyPosition).join(', '),"."));}}var isTop=resolvedPosition===_core.SurveyPosition.TopLeft||resolvedPosition===_core.SurveyPosition.TopCenter||resolvedPosition===_core.SurveyPosition.TopRight;var isMiddle=resolvedPosition===_core.SurveyPosition.MiddleLeft||resolvedPosition===_core.SurveyPosition.MiddleCenter||resolvedPosition===_core.SurveyPosition.MiddleRight;var isLeft=resolvedPosition===_core.SurveyPosition.TopLeft||resolvedPosition===_core.SurveyPosition.MiddleLeft||resolvedPosition===_core.SurveyPosition.Left;var isRight=resolvedPosition===_core.SurveyPosition.TopRight||resolvedPosition===_core.SurveyPosition.MiddleRight||resolvedPosition===_core.SurveyPosition.Right;return{vertical:isTop?'flex-start':isMiddle?'center':'flex-end',horizontal:isLeft?'flex-start':isRight?'flex-end':'center'};}var getDisplayOrderQuestions=exports.getDisplayOrderQuestions=function getDisplayOrderQuestions(survey){survey.questions.forEach(function(question,idx){question.originalQuestionIndex=idx;});return survey.questions;};function getRatingBucketForResponseValue(responseValue,scale){if(scale===3){if(responseValue<1||responseValue>3){console.warn('PostHog Debug: Rating response out of range for scale 3:',responseValue);return'neutral';}return responseValue===1?'negative':responseValue===2?'neutral':'positive';}else if(scale===5){if(responseValue<1||responseValue>5){console.warn('PostHog Debug: Rating response out of range for scale 5:',responseValue);return'neutral';}return responseValue<=2?'negative':responseValue===3?'neutral':'positive';}else if(scale===7){if(responseValue<1||responseValue>7){console.warn('PostHog Debug: Rating response out of range for scale 7:',responseValue);return'neutral';}return responseValue<=3?'negative':responseValue===4?'neutral':'positive';}else if(scale===10){if(responseValue<0||responseValue>10){console.warn('PostHog Debug: Rating response out of range for scale 10:',responseValue);return'passives';}return responseValue<=6?'detractors':responseValue<=8?'passives':'promoters';}console.warn('PostHog Debug: Unsupported rating scale:',scale);return'neutral';}function getNextSurveyStep(survey,currentQuestionIndex,response){var _a,_b,_c,_d,_e;var question=survey.questions[currentQuestionIndex];var nextQuestionIndex=currentQuestionIndex+1;if(!((_a=question.branching)===null||_a===void 0?void 0:_a.type)){if(currentQuestionIndex===survey.questions.length-1){return _core.SurveyQuestionBranchingType.End;}return nextQuestionIndex;}if(question.branching.type===_core.SurveyQuestionBranchingType.End){return _core.SurveyQuestionBranchingType.End;}else if(question.branching.type===_core.SurveyQuestionBranchingType.SpecificQuestion){if(isInteger(question.branching.index)){return question.branching.index;}}else if(question.branching.type===_core.SurveyQuestionBranchingType.ResponseBased){if(question.type===_core.SurveyQuestionType.SingleChoice){var selectedChoiceIndex=question.choices.indexOf("".concat(response));if(selectedChoiceIndex===-1&&question.hasOpenChoice){selectedChoiceIndex=question.choices.length-1;}if((_c=(_b=question.branching)===null||_b===void 0?void 0:_b.responseValues)===null||_c===void 0?void 0:_c.hasOwnProperty(selectedChoiceIndex)){var nextStep=question.branching.responseValues[selectedChoiceIndex];if(isInteger(nextStep)){return nextStep;}if(nextStep===_core.SurveyQuestionBranchingType.End){return _core.SurveyQuestionBranchingType.End;}return nextQuestionIndex;}}else if(question.type===_core.SurveyQuestionType.Rating){if(!isInteger(response)){console.warn('PostHog Debug: Expected integer response for rating question but received:',response);return nextQuestionIndex;}var ratingQuestion=question;var ratingBucket=getRatingBucketForResponseValue(response,ratingQuestion.scale);if((_e=(_d=question.branching)===null||_d===void 0?void 0:_d.responseValues)===null||_e===void 0?void 0:_e.hasOwnProperty(ratingBucket)){var _nextStep=question.branching.responseValues[ratingBucket];if(isInteger(_nextStep)){return _nextStep;}if(_nextStep===_core.SurveyQuestionBranchingType.End){return _core.SurveyQuestionBranchingType.End;}return nextQuestionIndex;}}return nextQuestionIndex;}console.warn('Falling back to next question index due to unexpected branching type');return nextQuestionIndex;}function getContrastingTextColor(color){var rgb;if(color.startsWith('#')){rgb=hex2rgb(color);}if(color.startsWith('rgb')){rgb=color;}var nameColorToHex=nameToHex(color);if(nameColorToHex){rgb=hex2rgb(nameColorToHex);}if(!rgb){return'black';}var colorMatch=rgb.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(colorMatch){var r=parseInt(colorMatch[1],10);var g=parseInt(colorMatch[2],10);var b=parseInt(colorMatch[3],10);var hsp=Math.sqrt(0.299*(r*r)+0.587*(g*g)+0.114*(b*b));return hsp>127.5?'black':'white';}return'black';}function hex2rgb(c){if(c.startsWith('#')){var hexColor=c.replace(/^#/,'');if(/^[0-9A-Fa-f]{3}$/.test(hexColor)){hexColor=hexColor[0]+hexColor[0]+hexColor[1]+hexColor[1]+hexColor[2]+hexColor[2];}if(!/^[0-9A-Fa-f]{6}$/.test(hexColor)){return'rgb(255, 255, 255)';}var r=parseInt(hexColor.slice(0,2),16);var g=parseInt(hexColor.slice(2,4),16);var b=parseInt(hexColor.slice(4,6),16);return"rgb(".concat(r,",").concat(g,",").concat(b,")");}return'rgb(255, 255, 255)';}function nameToHex(name){return{aliceblue:'#f0f8ff',antiquewhite:'#faebd7',aqua:'#00ffff',aquamarine:'#7fffd4',azure:'#f0ffff',beige:'#f5f5dc',bisque:'#ffe4c4',black:'#000000',blanchedalmond:'#ffebcd',blue:'#0000ff',blueviolet:'#8a2be2',brown:'#a52a2a',burlywood:'#deb887',cadetblue:'#5f9ea0',chartreuse:'#7fff00',chocolate:'#d2691e',coral:'#ff7f50',cornflowerblue:'#6495ed',cornsilk:'#fff8dc',crimson:'#dc143c',cyan:'#00ffff',darkblue:'#00008b',darkcyan:'#008b8b',darkgoldenrod:'#b8860b',darkgray:'#a9a9a9',darkgreen:'#006400',darkkhaki:'#bdb76b',darkmagenta:'#8b008b',darkolivegreen:'#556b2f',darkorange:'#ff8c00',darkorchid:'#9932cc',darkred:'#8b0000',darksalmon:'#e9967a',darkseagreen:'#8fbc8f',darkslateblue:'#483d8b',darkslategray:'#2f4f4f',darkturquoise:'#00ced1',darkviolet:'#9400d3',deeppink:'#ff1493',deepskyblue:'#00bfff',dimgray:'#696969',dodgerblue:'#1e90ff',firebrick:'#b22222',floralwhite:'#fffaf0',forestgreen:'#228b22',fuchsia:'#ff00ff',gainsboro:'#dcdcdc',ghostwhite:'#f8f8ff',gold:'#ffd700',goldenrod:'#daa520',gray:'#808080',green:'#008000',greenyellow:'#adff2f',honeydew:'#f0fff0',hotpink:'#ff69b4','indianred ':'#cd5c5c',indigo:'#4b0082',ivory:'#fffff0',khaki:'#f0e68c',lavender:'#e6e6fa',lavenderblush:'#fff0f5',lawngreen:'#7cfc00',lemonchiffon:'#fffacd',lightblue:'#add8e6',lightcoral:'#f08080',lightcyan:'#e0ffff',lightgoldenrodyellow:'#fafad2',lightgrey:'#d3d3d3',lightgreen:'#90ee90',lightpink:'#ffb6c1',lightsalmon:'#ffa07a',lightseagreen:'#20b2aa',lightskyblue:'#87cefa',lightslategray:'#778899',lightsteelblue:'#b0c4de',lightyellow:'#ffffe0',lime:'#00ff00',limegreen:'#32cd32',linen:'#faf0e6',magenta:'#ff00ff',maroon:'#800000',mediumaquamarine:'#66cdaa',mediumblue:'#0000cd',mediumorchid:'#ba55d3',mediumpurple:'#9370d8',mediumseagreen:'#3cb371',mediumslateblue:'#7b68ee',mediumspringgreen:'#00fa9a',mediumturquoise:'#48d1cc',mediumvioletred:'#c71585',midnightblue:'#191970',mintcream:'#f5fffa',mistyrose:'#ffe4e1',moccasin:'#ffe4b5',navajowhite:'#ffdead',navy:'#000080',oldlace:'#fdf5e6',olive:'#808000',olivedrab:'#6b8e23',orange:'#ffa500',orangered:'#ff4500',orchid:'#da70d6',palegoldenrod:'#eee8aa',palegreen:'#98fb98',paleturquoise:'#afeeee',palevioletred:'#d87093',papayawhip:'#ffefd5',peachpuff:'#ffdab9',peru:'#cd853f',pink:'#ffc0cb',plum:'#dda0dd',powderblue:'#b0e0e6',purple:'#800080',red:'#ff0000',rosybrown:'#bc8f8f',royalblue:'#4169e1',saddlebrown:'#8b4513',salmon:'#fa8072',sandybrown:'#f4a460',seagreen:'#2e8b57',seashell:'#fff5ee',sienna:'#a0522d',silver:'#c0c0c0',skyblue:'#87ceeb',slateblue:'#6a5acd',slategray:'#708090',snow:'#fffafa',springgreen:'#00ff7f',steelblue:'#4682b4',tan:'#d2b48c',teal:'#008080',thistle:'#d8bfd8',tomato:'#ff6347',turquoise:'#40e0d0',violet:'#ee82ee',wheat:'#f5deb3',white:'#ffffff',whitesmoke:'#f5f5f5',yellow:'#ffff00',yellowgreen:'#9acd32'}[name.toLowerCase()];}
|
|
2
2
|
//# sourceMappingURL=surveys-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surveys-utils.js","names":["_core","require","_surveys","isInteger","value","Number","shouldRenderDescription","description","contentType","effectiveContentType","SurveyQuestionDescriptionContentType","Text","Boolean","defaultBackgroundColor","exports","defaultDescriptionOpacity","defaultRatingLabelOpacity","closeButtonSize","getMaxFontSizeMultiplier","appearance","role","configured","maxFontSizeMultiplier","defaultSurveyAppearance","backgroundColor","submitButtonColor","submitButtonTextColor","ratingButtonColor","ratingButtonActiveColor","inputBackground","borderColor","displayThankYouMessage","thankYouMessageHeader","position","SurveyPosition","Center","submitButtonText","autoDisappear","thankYouMessageDescription","thankYouMessageDescriptionContentType","thankYouMessageCloseButtonText","displayIntroScreen","introScreenHeader","introScreenDescription","introScreenDescriptionContentType","introScreenButtonText","surveyPopupDelaySeconds","allowGoBack","backButtonText","KNOWN_SURVEY_POSITIONS","Set","Object","values","warnedUnknownPositions","normalizeSurveyPosition","replace","resolveSurveyAlignment","resolvedPosition","normalizedPosition","has","add","console","warn","concat","JSON","stringify","join","isTop","TopLeft","TopCenter","TopRight","isMiddle","MiddleLeft","MiddleCenter","MiddleRight","isLeft","Left","isRight","Right","vertical","horizontal","getDisplayOrderQuestions","survey","questions","forEach","question","idx","originalQuestionIndex","getRatingBucketForResponseValue","responseValue","scale","getNextSurveyStep","currentQuestionIndex","response","nextQuestionIndex","_a","branching","type","length","SurveyQuestionBranchingType","End","SpecificQuestion","index","ResponseBased","SurveyQuestionType","SingleChoice","selectedChoiceIndex","choices","indexOf","hasOpenChoice","_c","_b","responseValues","hasOwnProperty","nextStep","Rating","ratingQuestion","ratingBucket","_e","_d","getContrastingTextColor","color","rgb","startsWith","hex2rgb","nameColorToHex","nameToHex","colorMatch","match","r","parseInt","g","b","hsp","Math","sqrt","c","hexColor","test","slice","name","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","honeydew","hotpink","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgrey","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","toLowerCase"],"sources":["../../src/surveys/surveys-utils.ts"],"sourcesContent":["import {\n Survey,\n SurveyQuestion,\n SurveyQuestionBranchingType,\n SurveyQuestionType,\n SurveyRatingDisplay,\n RatingSurveyQuestion,\n SurveyAppearance as CoreSurveyAppearance,\n SurveyPosition,\n SurveyQuestionDescriptionContentType,\n} from '@posthog/core'\n\nexport type { PropertyFilters, PropertyOperator, SurveyEventWithFilters } from '@posthog/core'\nexport {\n isMatchingRegex,\n matchPropertyFilters,\n propertyComparisons as surveyValidationMap,\n} from '@posthog/core/surveys'\n\nfunction isInteger(value: unknown): boolean {\n return typeof value === 'number' && Number.isInteger(value)\n}\n\n/**\n * Utility function to determine if a description should be rendered based on content type\n * Only renders text content, skips HTML content for React Native compatibility\n * Defaults to Text content type when not specified\n * @param description The description text\n * @param contentType The content type (text or html), defaults to Text if not provided\n * @returns True if the description should be rendered, false otherwise\n */\nexport function shouldRenderDescription(\n description?: string | null,\n contentType?: SurveyQuestionDescriptionContentType\n): boolean {\n const effectiveContentType = contentType ?? SurveyQuestionDescriptionContentType.Text\n return Boolean(description && effectiveContentType === SurveyQuestionDescriptionContentType.Text)\n}\n\nexport const defaultBackgroundColor = '#eeeded' as const\nexport const defaultDescriptionOpacity = 0.8\nexport const defaultRatingLabelOpacity = 0.7\n\n/**\n * Side of the circular close button. The button is absolutely positioned in the modal's\n * top-right corner, so the content containers underneath it reserve this much padding on\n * their right edge to keep long text from wrapping into it.\n */\nexport const closeButtonSize = 40\n\n/**\n * The distinct kinds of text a survey renders, each at its own base size. They\n * are separate because one ceiling cannot serve all of them: `question` is an\n * 18pt headline that can wrap freely, while `ratingNumber` sits inside a\n * fixed-width button and has nowhere to grow.\n */\nexport type SurveyTextRole =\n /** The question headline. */\n | 'question'\n /** Body copy under a question, an intro screen, or the thank-you screen. */\n | 'description'\n /** The intro-screen and thank-you-screen headers. */\n | 'header'\n /** A choice label in a single- or multiple-choice question. */\n | 'choice'\n /** Text the user types - the open-text answer and the open-choice field. */\n | 'input'\n /** The submit / next button label. */\n | 'button'\n /** The lower- and upper-bound labels under a rating scale. */\n | 'ratingLabel'\n /** The numeral inside a rating button, which cannot grow past the button. */\n | 'ratingNumber'\n /** The validation hint under an open-text answer. */\n | 'validationHint'\n\n/** React Native survey appearance, including native-only text scaling options. */\nexport interface SurveyAppearance extends CoreSurveyAppearance {\n /**\n * Caps how far survey text may grow under the OS text-size setting, as a\n * multiple of its base size - React Native's `maxFontSizeMultiplier`, applied\n * to every semantic `Text` and `TextInput` the survey renders. Icon-only text\n * fallbacks do not scale because they occupy fixed-size icon boxes.\n *\n * Pass a number to cap every role at once, or an object to cap them\n * separately: a survey headline can usually take more scaling than a numeral\n * inside a rating button, and a host app that already caps its own text by\n * role will want to match those ceilings here.\n *\n * ```ts\n * maxFontSizeMultiplier: 1.6\n * // or\n * maxFontSizeMultiplier: { question: 1.5, description: 1.8, ratingNumber: 1.2 }\n * ```\n *\n * Roles left out of the object are uncapped, as they are today. Use `0` for\n * no maximum, or a value of `1` or greater to set a cap. Other values below\n * `1` (such as `0.8`) do not shrink text and are unsupported by React Native;\n * depending on the platform and version, they may be ignored or rejected.\n *\n * Leave it unset (the default) and survey text scales without a ceiling. That\n * is what the OS asks for, but not always what a fixed-size survey card can\n * hold - at the largest accessibility sizes an unbounded 18pt headline renders\n * roughly one word per line.\n *\n * React Native only inherits this prop through nested `Text`, so a host app\n * cannot apply it from the outside - it has to come in here.\n *\n * @default undefined (no ceiling)\n */\n maxFontSizeMultiplier?: number | Partial<Record<SurveyTextRole, number>>\n}\n\n// textColor and inputTextColor are optional overrides (auto-calculated if not provided)\n// placeholder is optional too: open text questions only show placeholder text when the survey's\n// appearance sets one, so clearing the field in the survey editor clears it here too.\nexport type SurveyAppearanceTheme = Omit<\n Required<SurveyAppearance>,\n | 'widgetSelector'\n | 'widgetType'\n | 'widgetColor'\n | 'widgetLabel'\n | 'shuffleQuestions'\n | 'textColor'\n | 'inputTextColor'\n | 'placeholder'\n | 'maxFontSizeMultiplier'\n> & {\n textColor?: string\n inputTextColor?: string\n placeholder?: string\n maxFontSizeMultiplier?: SurveyAppearance['maxFontSizeMultiplier']\n}\n\n/**\n * The ceiling for one role, from either form of `maxFontSizeMultiplier`.\n *\n * Returns `undefined` when nothing is configured for that role, which is also\n * React Native's \"no ceiling\" - so an unset appearance renders exactly as it\n * did before this option existed.\n */\nexport function getMaxFontSizeMultiplier(\n appearance: Pick<SurveyAppearance, 'maxFontSizeMultiplier'>,\n role: SurveyTextRole\n): number | undefined {\n const configured = appearance.maxFontSizeMultiplier\n if (typeof configured === 'number') {\n return configured\n }\n return configured?.[role]\n}\nexport const defaultSurveyAppearance: SurveyAppearanceTheme = {\n backgroundColor: defaultBackgroundColor,\n submitButtonColor: 'black',\n submitButtonTextColor: 'white',\n ratingButtonColor: 'white',\n ratingButtonActiveColor: 'black',\n inputBackground: 'white',\n borderColor: '#c9c6c6',\n displayThankYouMessage: true,\n thankYouMessageHeader: 'Thank you for your feedback!',\n position: SurveyPosition.Center,\n submitButtonText: 'Submit',\n autoDisappear: false,\n thankYouMessageDescription: '',\n thankYouMessageDescriptionContentType: SurveyQuestionDescriptionContentType.Text,\n thankYouMessageCloseButtonText: 'Close',\n displayIntroScreen: false,\n introScreenHeader: '',\n introScreenDescription: '',\n introScreenDescriptionContentType: SurveyQuestionDescriptionContentType.Text,\n introScreenButtonText: 'Get started',\n surveyPopupDelaySeconds: 0,\n allowGoBack: false,\n backButtonText: 'Back',\n}\n\nexport type SurveyFlexAlign = 'flex-start' | 'center' | 'flex-end'\n\nconst KNOWN_SURVEY_POSITIONS: ReadonlySet<string> = new Set(Object.values(SurveyPosition))\nconst warnedUnknownPositions = new Set<string>()\n\n// Some survey API clients use CSS-style names such as `bottom-right`, while\n// SurveyPosition represents the bottom row as `left`, `center`, and `right`.\nfunction normalizeSurveyPosition(position: string): string {\n return position.replace(/-/g, '_').replace(/^bottom_/, '')\n}\n\n// Mirrors web SDK semantics: `.ph-survey` is bottom-anchored by default and\n// getPopoverPosition only overrides `top` for top_* / middle_* variants. So\n// `left` / `right` / `center` (no prefix) anchor to the bottom edge — they\n// are NOT shorthand for middle.\nexport function resolveSurveyAlignment(position: string | undefined): {\n vertical: SurveyFlexAlign\n horizontal: SurveyFlexAlign\n} {\n let resolvedPosition: SurveyPosition = defaultSurveyAppearance.position\n if (position) {\n const normalizedPosition = typeof position === 'string' ? normalizeSurveyPosition(position) : ''\n if (KNOWN_SURVEY_POSITIONS.has(normalizedPosition)) {\n resolvedPosition = normalizedPosition as SurveyPosition\n } else if (!warnedUnknownPositions.has(normalizedPosition)) {\n warnedUnknownPositions.add(normalizedPosition)\n console.warn(\n `[PostHog.surveys] Unknown survey position ${JSON.stringify(position)} — falling back to ${defaultSurveyAppearance.position}. Expected one of: ${Object.values(SurveyPosition).join(', ')}.`\n )\n }\n }\n const isTop =\n resolvedPosition === SurveyPosition.TopLeft ||\n resolvedPosition === SurveyPosition.TopCenter ||\n resolvedPosition === SurveyPosition.TopRight\n const isMiddle =\n resolvedPosition === SurveyPosition.MiddleLeft ||\n resolvedPosition === SurveyPosition.MiddleCenter ||\n resolvedPosition === SurveyPosition.MiddleRight\n const isLeft =\n resolvedPosition === SurveyPosition.TopLeft ||\n resolvedPosition === SurveyPosition.MiddleLeft ||\n resolvedPosition === SurveyPosition.Left\n const isRight =\n resolvedPosition === SurveyPosition.TopRight ||\n resolvedPosition === SurveyPosition.MiddleRight ||\n resolvedPosition === SurveyPosition.Right\n return {\n vertical: isTop ? 'flex-start' : isMiddle ? 'center' : 'flex-end',\n horizontal: isLeft ? 'flex-start' : isRight ? 'flex-end' : 'center',\n }\n}\n\nexport const getDisplayOrderQuestions = (survey: Survey): SurveyQuestion[] => {\n // retain the original questionIndex so we can correlate values in the webapp\n survey.questions.forEach((question: SurveyQuestion, idx: number) => {\n question.originalQuestionIndex = idx\n })\n\n // TODO: shuffle questions\n return survey.questions\n\n // if (!survey.appearance?.shuffleQuestions) {\n // return survey.questions\n // }\n\n // return reverseIfUnshuffled(survey.questions, shuffle(survey.questions))\n}\n\n/**\n * Use the Fisher-yates algorithm to shuffle this array\n * https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle\n */\n// export const shuffle = <T>(array: T[]): T[] => {\n// return array\n// .map((a) => ({ sort: Math.floor(Math.random() * 10), value: a }))\n// .sort((a, b) => a.sort - b.sort)\n// .map((a) => a.value)\n// }\n\n// const reverseIfUnshuffled = <T>(unshuffled: T[], shuffled: T[]): T[] => {\n// if (unshuffled.length === shuffled.length && unshuffled.every((val, index) => val === shuffled[index])) {\n// return shuffled.reverse()\n// }\n\n// return shuffled\n// }\n\n/**\n * Get the rating bucket for a response value based on the scale\n * @param responseValue The numeric rating value\n * @param scale The scale of the rating (3, 5, 7, or 10)\n * @returns The bucket name for the rating\n */\nfunction getRatingBucketForResponseValue(responseValue: number, scale: number): string {\n if (scale === 3) {\n if (responseValue < 1 || responseValue > 3) {\n console.warn('PostHog Debug: Rating response out of range for scale 3:', responseValue)\n return 'neutral' // Default to neutral for out-of-range values\n }\n\n return responseValue === 1 ? 'negative' : responseValue === 2 ? 'neutral' : 'positive'\n } else if (scale === 5) {\n if (responseValue < 1 || responseValue > 5) {\n console.warn('PostHog Debug: Rating response out of range for scale 5:', responseValue)\n return 'neutral' // Default to neutral for out-of-range values\n }\n\n return responseValue <= 2 ? 'negative' : responseValue === 3 ? 'neutral' : 'positive'\n } else if (scale === 7) {\n if (responseValue < 1 || responseValue > 7) {\n console.warn('PostHog Debug: Rating response out of range for scale 7:', responseValue)\n return 'neutral' // Default to neutral for out-of-range values\n }\n\n return responseValue <= 3 ? 'negative' : responseValue === 4 ? 'neutral' : 'positive'\n } else if (scale === 10) {\n if (responseValue < 0 || responseValue > 10) {\n console.warn('PostHog Debug: Rating response out of range for scale 10:', responseValue)\n return 'passives' // Default to passives for out-of-range values\n }\n\n return responseValue <= 6 ? 'detractors' : responseValue <= 8 ? 'passives' : 'promoters'\n }\n\n console.warn('PostHog Debug: Unsupported rating scale:', scale)\n return 'neutral' // Default fallback for unsupported scales\n}\n\n/**\n * Determines the next question to show based on the survey's branching logic\n * @param survey The survey object\n * @param currentQuestionIndex The current question index\n * @param response The user's response to the current question\n * @returns The index of the next question or SurveyQuestionBranchingType.End if the survey should end\n */\nexport function getNextSurveyStep(\n survey: Survey,\n currentQuestionIndex: number,\n response: string | string[] | number | null\n): number | typeof SurveyQuestionBranchingType.End {\n const question = survey.questions[currentQuestionIndex]\n const nextQuestionIndex = currentQuestionIndex + 1\n\n if (!question.branching?.type) {\n if (currentQuestionIndex === survey.questions.length - 1) {\n return SurveyQuestionBranchingType.End\n }\n\n return nextQuestionIndex\n }\n\n if (question.branching.type === SurveyQuestionBranchingType.End) {\n return SurveyQuestionBranchingType.End\n } else if (question.branching.type === SurveyQuestionBranchingType.SpecificQuestion) {\n if (isInteger(question.branching.index)) {\n return question.branching.index\n }\n } else if (question.branching.type === SurveyQuestionBranchingType.ResponseBased) {\n // Single choice\n if (question.type === SurveyQuestionType.SingleChoice) {\n // Look up the choiceIndex based on the response\n let selectedChoiceIndex = question.choices.indexOf(`${response}`)\n\n if (selectedChoiceIndex === -1 && question.hasOpenChoice) {\n // if the response is not found in the choices, it must be the open choice,\n // which is always the last choice\n selectedChoiceIndex = question.choices.length - 1\n }\n\n if (question.branching?.responseValues?.hasOwnProperty(selectedChoiceIndex)) {\n const nextStep = question.branching.responseValues[selectedChoiceIndex]\n\n // Specific question\n if (isInteger(nextStep)) {\n return nextStep\n }\n\n if (nextStep === SurveyQuestionBranchingType.End) {\n return SurveyQuestionBranchingType.End\n }\n\n return nextQuestionIndex\n }\n } else if (question.type === SurveyQuestionType.Rating) {\n if (!isInteger(response)) {\n console.warn('PostHog Debug: Expected integer response for rating question but received:', response)\n return nextQuestionIndex // Fail gracefully by continuing to next question\n }\n\n const ratingQuestion = question as RatingSurveyQuestion\n const ratingBucket = getRatingBucketForResponseValue(response as number, ratingQuestion.scale)\n\n if (question.branching?.responseValues?.hasOwnProperty(ratingBucket)) {\n const nextStep = question.branching.responseValues[ratingBucket]\n\n // Specific question\n if (isInteger(nextStep)) {\n return nextStep\n }\n\n if (nextStep === SurveyQuestionBranchingType.End) {\n return SurveyQuestionBranchingType.End\n }\n\n return nextQuestionIndex\n }\n }\n\n return nextQuestionIndex\n }\n\n console.warn('Falling back to next question index due to unexpected branching type')\n return nextQuestionIndex\n}\n\nexport function getContrastingTextColor(color: string): 'black' | 'white' {\n let rgb: string | undefined\n if (color.startsWith('#')) {\n rgb = hex2rgb(color)\n }\n if (color.startsWith('rgb')) {\n rgb = color\n }\n // otherwise it's a color name\n const nameColorToHex = nameToHex(color)\n if (nameColorToHex) {\n rgb = hex2rgb(nameColorToHex)\n }\n if (!rgb) {\n return 'black'\n }\n const colorMatch = rgb.match(/^rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)(?:,\\s*(\\d+(?:\\.\\d+)?))?\\)$/)\n if (colorMatch) {\n const r = parseInt(colorMatch[1], 10)\n const g = parseInt(colorMatch[2], 10)\n const b = parseInt(colorMatch[3], 10)\n const hsp = Math.sqrt(0.299 * (r * r) + 0.587 * (g * g) + 0.114 * (b * b))\n return hsp > 127.5 ? 'black' : 'white'\n }\n return 'black'\n}\n\nfunction hex2rgb(c: string): string {\n if (c.startsWith('#')) {\n let hexColor = c.replace(/^#/, '')\n // Handle 3-character shorthand (e.g., #111 -> #111111, #abc -> #aabbcc)\n if (/^[0-9A-Fa-f]{3}$/.test(hexColor)) {\n hexColor = hexColor[0] + hexColor[0] + hexColor[1] + hexColor[1] + hexColor[2] + hexColor[2]\n }\n if (!/^[0-9A-Fa-f]{6}$/.test(hexColor)) {\n return 'rgb(255, 255, 255)'\n }\n const r = parseInt(hexColor.slice(0, 2), 16)\n const g = parseInt(hexColor.slice(2, 4), 16)\n const b = parseInt(hexColor.slice(4, 6), 16)\n return `rgb(${r},${g},${b})`\n }\n return 'rgb(255, 255, 255)'\n}\n\nfunction nameToHex(name: string): string | undefined {\n return {\n aliceblue: '#f0f8ff',\n antiquewhite: '#faebd7',\n aqua: '#00ffff',\n aquamarine: '#7fffd4',\n azure: '#f0ffff',\n beige: '#f5f5dc',\n bisque: '#ffe4c4',\n black: '#000000',\n blanchedalmond: '#ffebcd',\n blue: '#0000ff',\n blueviolet: '#8a2be2',\n brown: '#a52a2a',\n burlywood: '#deb887',\n cadetblue: '#5f9ea0',\n chartreuse: '#7fff00',\n chocolate: '#d2691e',\n coral: '#ff7f50',\n cornflowerblue: '#6495ed',\n cornsilk: '#fff8dc',\n crimson: '#dc143c',\n cyan: '#00ffff',\n darkblue: '#00008b',\n darkcyan: '#008b8b',\n darkgoldenrod: '#b8860b',\n darkgray: '#a9a9a9',\n darkgreen: '#006400',\n darkkhaki: '#bdb76b',\n darkmagenta: '#8b008b',\n darkolivegreen: '#556b2f',\n darkorange: '#ff8c00',\n darkorchid: '#9932cc',\n darkred: '#8b0000',\n darksalmon: '#e9967a',\n darkseagreen: '#8fbc8f',\n darkslateblue: '#483d8b',\n darkslategray: '#2f4f4f',\n darkturquoise: '#00ced1',\n darkviolet: '#9400d3',\n deeppink: '#ff1493',\n deepskyblue: '#00bfff',\n dimgray: '#696969',\n dodgerblue: '#1e90ff',\n firebrick: '#b22222',\n floralwhite: '#fffaf0',\n forestgreen: '#228b22',\n fuchsia: '#ff00ff',\n gainsboro: '#dcdcdc',\n ghostwhite: '#f8f8ff',\n gold: '#ffd700',\n goldenrod: '#daa520',\n gray: '#808080',\n green: '#008000',\n greenyellow: '#adff2f',\n honeydew: '#f0fff0',\n hotpink: '#ff69b4',\n 'indianred ': '#cd5c5c',\n indigo: '#4b0082',\n ivory: '#fffff0',\n khaki: '#f0e68c',\n lavender: '#e6e6fa',\n lavenderblush: '#fff0f5',\n lawngreen: '#7cfc00',\n lemonchiffon: '#fffacd',\n lightblue: '#add8e6',\n lightcoral: '#f08080',\n lightcyan: '#e0ffff',\n lightgoldenrodyellow: '#fafad2',\n lightgrey: '#d3d3d3',\n lightgreen: '#90ee90',\n lightpink: '#ffb6c1',\n lightsalmon: '#ffa07a',\n lightseagreen: '#20b2aa',\n lightskyblue: '#87cefa',\n lightslategray: '#778899',\n lightsteelblue: '#b0c4de',\n lightyellow: '#ffffe0',\n lime: '#00ff00',\n limegreen: '#32cd32',\n linen: '#faf0e6',\n magenta: '#ff00ff',\n maroon: '#800000',\n mediumaquamarine: '#66cdaa',\n mediumblue: '#0000cd',\n mediumorchid: '#ba55d3',\n mediumpurple: '#9370d8',\n mediumseagreen: '#3cb371',\n mediumslateblue: '#7b68ee',\n mediumspringgreen: '#00fa9a',\n mediumturquoise: '#48d1cc',\n mediumvioletred: '#c71585',\n midnightblue: '#191970',\n mintcream: '#f5fffa',\n mistyrose: '#ffe4e1',\n moccasin: '#ffe4b5',\n navajowhite: '#ffdead',\n navy: '#000080',\n oldlace: '#fdf5e6',\n olive: '#808000',\n olivedrab: '#6b8e23',\n orange: '#ffa500',\n orangered: '#ff4500',\n orchid: '#da70d6',\n palegoldenrod: '#eee8aa',\n palegreen: '#98fb98',\n paleturquoise: '#afeeee',\n palevioletred: '#d87093',\n papayawhip: '#ffefd5',\n peachpuff: '#ffdab9',\n peru: '#cd853f',\n pink: '#ffc0cb',\n plum: '#dda0dd',\n powderblue: '#b0e0e6',\n purple: '#800080',\n red: '#ff0000',\n rosybrown: '#bc8f8f',\n royalblue: '#4169e1',\n saddlebrown: '#8b4513',\n salmon: '#fa8072',\n sandybrown: '#f4a460',\n seagreen: '#2e8b57',\n seashell: '#fff5ee',\n sienna: '#a0522d',\n silver: '#c0c0c0',\n skyblue: '#87ceeb',\n slateblue: '#6a5acd',\n slategray: '#708090',\n snow: '#fffafa',\n springgreen: '#00ff7f',\n steelblue: '#4682b4',\n tan: '#d2b48c',\n teal: '#008080',\n thistle: '#d8bfd8',\n tomato: '#ff6347',\n turquoise: '#40e0d0',\n violet: '#ee82ee',\n wheat: '#f5deb3',\n white: '#ffffff',\n whitesmoke: '#f5f5f5',\n yellow: '#ffff00',\n yellowgreen: '#9acd32',\n }[name.toLowerCase()]\n}\n"],"mappings":"s5BAAA,IAAAA,KAAA,CAAAC,OAAA,kBAaA,IAAAC,QAAA,CAAAD,OAAA,0BAMA,QAAS,CAAAE,SAASA,CAACC,KAAc,EAC/B,MAAO,OAAO,CAAAA,KAAK,GAAK,QAAQ,EAAIC,MAAM,CAACF,SAAS,CAACC,KAAK,CAAC,CAC7D,CAUM,QAAU,CAAAE,uBAAuBA,CACrCC,WAA2B,CAC3BC,WAAkD,EAElD,GAAM,CAAAC,oBAAoB,CAAGD,WAAW,SAAXA,WAAW,UAAXA,WAAW,CAAIE,0CAAoC,CAACC,IAAI,CACr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ACxBC,SAAS,CAAE,SAAS,CACpBC,aAAa,CAAE,SAAS,CACxBC,aAAa,CAAE,SAAS,CACxBC,UAAU,CAAE,SAAS,CACrBC,SAAS,CAAE,SAAS,CACpBC,IAAI,CAAE,SAAS,CACfC,IAAI,CAAE,SAAS,CACfC,IAAI,CAAE,SAAS,CACfC,UAAU,CAAE,SAAS,CACrBC,MAAM,CAAE,SAAS,CACjBC,GAAG,CAAE,SAAS,CACdC,SAAS,CAAE,SAAS,CACpBC,SAAS,CAAE,SAAS,CACpBC,WAAW,CAAE,SAAS,CACtBC,MAAM,CAAE,SAAS,CACjBC,UAAU,CAAE,SAAS,CACrBC,QAAQ,CAAE,SAAS,CACnBC,QAAQ,CAAE,SAAS,CACnBC,MAAM,CAAE,SAAS,CACjBC,MAAM,CAAE,SAAS,CACjBC,OAAO,CAAE,SAAS,CAClBC,SAAS,CAAE,SAAS,CACpBC,SAAS,CAAE,SAAS,CACpBC,IAAI,CAAE,SAAS,CACfC,WAAW,CAAE,SAAS,CACtBC,SAAS,CAAE,SAAS,CACpBC,GAAG,CAAE,SAAS,CACdC,IAAI,CAAE,SAAS,CACfC,OAAO,CAAE,SAAS,CAClBC,MAAM,CAAE,SAAS,CACjBC,SAAS,CAAE,SAAS,CACpBC,MAAM,CAAE,SAAS,CACjBC,KAAK,CAAE,SAAS,CAChBC,KAAK,CAAE,SAAS,CAChBC,UAAU,CAAE,SAAS,CACrBC,MAAM,CAAE,SAAS,CACjBC,WAAW,CAAE,S,CACd,CAAC3I,IAAI,CAAC4I,WAAW,EAAE,CAAC,CACvB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"surveys-utils.js","names":["_core","require","_surveys","isInteger","value","Number","shouldRenderDescription","description","contentType","effectiveContentType","SurveyQuestionDescriptionContentType","Text","Boolean","defaultBackgroundColor","exports","defaultDescriptionOpacity","defaultRatingLabelOpacity","closeButtonSize","getMaxFontSizeMultiplier","appearance","role","configured","maxFontSizeMultiplier","defaultSurveyAppearance","backgroundColor","submitButtonColor","submitButtonTextColor","ratingButtonColor","ratingButtonActiveColor","inputBackground","borderColor","displayThankYouMessage","thankYouMessageHeader","position","SurveyPosition","Center","submitButtonText","autoDisappear","thankYouMessageDescription","thankYouMessageDescriptionContentType","thankYouMessageCloseButtonText","displayIntroScreen","introScreenHeader","introScreenDescription","introScreenDescriptionContentType","introScreenButtonText","surveyPopupDelaySeconds","allowGoBack","backButtonText","shouldShowConfirmationMessage","_a","KNOWN_SURVEY_POSITIONS","Set","Object","values","warnedUnknownPositions","normalizeSurveyPosition","replace","resolveSurveyAlignment","resolvedPosition","normalizedPosition","has","add","console","warn","concat","JSON","stringify","join","isTop","TopLeft","TopCenter","TopRight","isMiddle","MiddleLeft","MiddleCenter","MiddleRight","isLeft","Left","isRight","Right","vertical","horizontal","getDisplayOrderQuestions","survey","questions","forEach","question","idx","originalQuestionIndex","getRatingBucketForResponseValue","responseValue","scale","getNextSurveyStep","currentQuestionIndex","response","nextQuestionIndex","branching","type","length","SurveyQuestionBranchingType","End","SpecificQuestion","index","ResponseBased","SurveyQuestionType","SingleChoice","selectedChoiceIndex","choices","indexOf","hasOpenChoice","_c","_b","responseValues","hasOwnProperty","nextStep","Rating","ratingQuestion","ratingBucket","_e","_d","getContrastingTextColor","color","rgb","startsWith","hex2rgb","nameColorToHex","nameToHex","colorMatch","match","r","parseInt","g","b","hsp","Math","sqrt","c","hexColor","test","slice","name","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","honeydew","hotpink","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgrey","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","toLowerCase"],"sources":["../../src/surveys/surveys-utils.ts"],"sourcesContent":["import {\n Survey,\n SurveyQuestion,\n SurveyQuestionBranchingType,\n SurveyQuestionType,\n SurveyRatingDisplay,\n RatingSurveyQuestion,\n SurveyAppearance as CoreSurveyAppearance,\n SurveyPosition,\n SurveyQuestionDescriptionContentType,\n} from '@posthog/core'\n\nexport type { PropertyFilters, PropertyOperator, SurveyEventWithFilters } from '@posthog/core'\nexport {\n isMatchingRegex,\n matchPropertyFilters,\n propertyComparisons as surveyValidationMap,\n} from '@posthog/core/surveys'\n\nfunction isInteger(value: unknown): boolean {\n return typeof value === 'number' && Number.isInteger(value)\n}\n\n/**\n * Utility function to determine if a description should be rendered based on content type\n * Only renders text content, skips HTML content for React Native compatibility\n * Defaults to Text content type when not specified\n * @param description The description text\n * @param contentType The content type (text or html), defaults to Text if not provided\n * @returns True if the description should be rendered, false otherwise\n */\nexport function shouldRenderDescription(\n description?: string | null,\n contentType?: SurveyQuestionDescriptionContentType\n): boolean {\n const effectiveContentType = contentType ?? SurveyQuestionDescriptionContentType.Text\n return Boolean(description && effectiveContentType === SurveyQuestionDescriptionContentType.Text)\n}\n\nexport const defaultBackgroundColor = '#eeeded' as const\nexport const defaultDescriptionOpacity = 0.8\nexport const defaultRatingLabelOpacity = 0.7\n\n/**\n * Side of the circular close button. The button is absolutely positioned in the modal's\n * top-right corner, so the content containers underneath it reserve this much padding on\n * their right edge to keep long text from wrapping into it.\n */\nexport const closeButtonSize = 40\n\n/**\n * The distinct kinds of text a survey renders, each at its own base size. They\n * are separate because one ceiling cannot serve all of them: `question` is an\n * 18pt headline that can wrap freely, while `ratingNumber` sits inside a\n * fixed-width button and has nowhere to grow.\n */\nexport type SurveyTextRole =\n /** The question headline. */\n | 'question'\n /** Body copy under a question, an intro screen, or the thank-you screen. */\n | 'description'\n /** The intro-screen and thank-you-screen headers. */\n | 'header'\n /** A choice label in a single- or multiple-choice question. */\n | 'choice'\n /** Text the user types - the open-text answer and the open-choice field. */\n | 'input'\n /** The submit / next button label. */\n | 'button'\n /** The lower- and upper-bound labels under a rating scale. */\n | 'ratingLabel'\n /** The numeral inside a rating button, which cannot grow past the button. */\n | 'ratingNumber'\n /** The validation hint under an open-text answer. */\n | 'validationHint'\n\n/** React Native survey appearance, including native-only text scaling options. */\nexport interface SurveyAppearance extends CoreSurveyAppearance {\n /**\n * Caps how far survey text may grow under the OS text-size setting, as a\n * multiple of its base size - React Native's `maxFontSizeMultiplier`, applied\n * to every semantic `Text` and `TextInput` the survey renders. Icon-only text\n * fallbacks do not scale because they occupy fixed-size icon boxes.\n *\n * Pass a number to cap every role at once, or an object to cap them\n * separately: a survey headline can usually take more scaling than a numeral\n * inside a rating button, and a host app that already caps its own text by\n * role will want to match those ceilings here.\n *\n * ```ts\n * maxFontSizeMultiplier: 1.6\n * // or\n * maxFontSizeMultiplier: { question: 1.5, description: 1.8, ratingNumber: 1.2 }\n * ```\n *\n * Roles left out of the object are uncapped, as they are today. Use `0` for\n * no maximum, or a value of `1` or greater to set a cap. Other values below\n * `1` (such as `0.8`) do not shrink text and are unsupported by React Native;\n * depending on the platform and version, they may be ignored or rejected.\n *\n * Leave it unset (the default) and survey text scales without a ceiling. That\n * is what the OS asks for, but not always what a fixed-size survey card can\n * hold - at the largest accessibility sizes an unbounded 18pt headline renders\n * roughly one word per line.\n *\n * React Native only inherits this prop through nested `Text`, so a host app\n * cannot apply it from the outside - it has to come in here.\n *\n * @default undefined (no ceiling)\n */\n maxFontSizeMultiplier?: number | Partial<Record<SurveyTextRole, number>>\n}\n\n// textColor and inputTextColor are optional overrides (auto-calculated if not provided)\n// placeholder is optional too: open text questions only show placeholder text when the survey's\n// appearance sets one, so clearing the field in the survey editor clears it here too.\nexport type SurveyAppearanceTheme = Omit<\n Required<SurveyAppearance>,\n | 'widgetSelector'\n | 'widgetType'\n | 'widgetColor'\n | 'widgetLabel'\n | 'shuffleQuestions'\n | 'textColor'\n | 'inputTextColor'\n | 'placeholder'\n | 'maxFontSizeMultiplier'\n> & {\n textColor?: string\n inputTextColor?: string\n placeholder?: string\n maxFontSizeMultiplier?: SurveyAppearance['maxFontSizeMultiplier']\n}\n\n/**\n * The ceiling for one role, from either form of `maxFontSizeMultiplier`.\n *\n * Returns `undefined` when nothing is configured for that role, which is also\n * React Native's \"no ceiling\" - so an unset appearance renders exactly as it\n * did before this option existed.\n */\nexport function getMaxFontSizeMultiplier(\n appearance: Pick<SurveyAppearance, 'maxFontSizeMultiplier'>,\n role: SurveyTextRole\n): number | undefined {\n const configured = appearance.maxFontSizeMultiplier\n if (typeof configured === 'number') {\n return configured\n }\n return configured?.[role]\n}\nexport const defaultSurveyAppearance: SurveyAppearanceTheme = {\n backgroundColor: defaultBackgroundColor,\n submitButtonColor: 'black',\n submitButtonTextColor: 'white',\n ratingButtonColor: 'white',\n ratingButtonActiveColor: 'black',\n inputBackground: 'white',\n borderColor: '#c9c6c6',\n displayThankYouMessage: true,\n thankYouMessageHeader: 'Thank you for your feedback!',\n position: SurveyPosition.Center,\n submitButtonText: 'Submit',\n autoDisappear: false,\n thankYouMessageDescription: '',\n thankYouMessageDescriptionContentType: SurveyQuestionDescriptionContentType.Text,\n thankYouMessageCloseButtonText: 'Close',\n displayIntroScreen: false,\n introScreenHeader: '',\n introScreenDescription: '',\n introScreenDescriptionContentType: SurveyQuestionDescriptionContentType.Text,\n introScreenButtonText: 'Get started',\n surveyPopupDelaySeconds: 0,\n allowGoBack: false,\n backButtonText: 'Back',\n}\n\n// The confirmation message needs both the setting in PostHog and some copy to put on the screen,\n// the same pair `shouldShowIntro` asks for. A survey with the confirmation message turned off\n// keeps its copy, so the copy alone does not show the screen.\n// Only an explicit `false` hides the screen: the theme is survey JSON spread over the defaults\n// above, so a survey saved without the setting can still carry `null` here, and that is not the\n// author turning it off.\nexport function shouldShowConfirmationMessage(\n appearance: Pick<\n SurveyAppearance,\n | 'displayThankYouMessage'\n | 'thankYouMessageHeader'\n | 'thankYouMessageDescription'\n | 'thankYouMessageDescriptionContentType'\n >\n): boolean {\n return (\n (appearance.displayThankYouMessage ?? true) &&\n (Boolean(appearance.thankYouMessageHeader) ||\n shouldRenderDescription(appearance.thankYouMessageDescription, appearance.thankYouMessageDescriptionContentType))\n )\n}\n\nexport type SurveyFlexAlign = 'flex-start' | 'center' | 'flex-end'\n\nconst KNOWN_SURVEY_POSITIONS: ReadonlySet<string> = new Set(Object.values(SurveyPosition))\nconst warnedUnknownPositions = new Set<string>()\n\n// Some survey API clients use CSS-style names such as `bottom-right`, while\n// SurveyPosition represents the bottom row as `left`, `center`, and `right`.\nfunction normalizeSurveyPosition(position: string): string {\n return position.replace(/-/g, '_').replace(/^bottom_/, '')\n}\n\n// Mirrors web SDK semantics: `.ph-survey` is bottom-anchored by default and\n// getPopoverPosition only overrides `top` for top_* / middle_* variants. So\n// `left` / `right` / `center` (no prefix) anchor to the bottom edge — they\n// are NOT shorthand for middle.\nexport function resolveSurveyAlignment(position: string | undefined): {\n vertical: SurveyFlexAlign\n horizontal: SurveyFlexAlign\n} {\n let resolvedPosition: SurveyPosition = defaultSurveyAppearance.position\n if (position) {\n const normalizedPosition = typeof position === 'string' ? normalizeSurveyPosition(position) : ''\n if (KNOWN_SURVEY_POSITIONS.has(normalizedPosition)) {\n resolvedPosition = normalizedPosition as SurveyPosition\n } else if (!warnedUnknownPositions.has(normalizedPosition)) {\n warnedUnknownPositions.add(normalizedPosition)\n console.warn(\n `[PostHog.surveys] Unknown survey position ${JSON.stringify(position)} — falling back to ${defaultSurveyAppearance.position}. Expected one of: ${Object.values(SurveyPosition).join(', ')}.`\n )\n }\n }\n const isTop =\n resolvedPosition === SurveyPosition.TopLeft ||\n resolvedPosition === SurveyPosition.TopCenter ||\n resolvedPosition === SurveyPosition.TopRight\n const isMiddle =\n resolvedPosition === SurveyPosition.MiddleLeft ||\n resolvedPosition === SurveyPosition.MiddleCenter ||\n resolvedPosition === SurveyPosition.MiddleRight\n const isLeft =\n resolvedPosition === SurveyPosition.TopLeft ||\n resolvedPosition === SurveyPosition.MiddleLeft ||\n resolvedPosition === SurveyPosition.Left\n const isRight =\n resolvedPosition === SurveyPosition.TopRight ||\n resolvedPosition === SurveyPosition.MiddleRight ||\n resolvedPosition === SurveyPosition.Right\n return {\n vertical: isTop ? 'flex-start' : isMiddle ? 'center' : 'flex-end',\n horizontal: isLeft ? 'flex-start' : isRight ? 'flex-end' : 'center',\n }\n}\n\nexport const getDisplayOrderQuestions = (survey: Survey): SurveyQuestion[] => {\n // retain the original questionIndex so we can correlate values in the webapp\n survey.questions.forEach((question: SurveyQuestion, idx: number) => {\n question.originalQuestionIndex = idx\n })\n\n // TODO: shuffle questions\n return survey.questions\n\n // if (!survey.appearance?.shuffleQuestions) {\n // return survey.questions\n // }\n\n // return reverseIfUnshuffled(survey.questions, shuffle(survey.questions))\n}\n\n/**\n * Use the Fisher-yates algorithm to shuffle this array\n * https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle\n */\n// export const shuffle = <T>(array: T[]): T[] => {\n// return array\n// .map((a) => ({ sort: Math.floor(Math.random() * 10), value: a }))\n// .sort((a, b) => a.sort - b.sort)\n// .map((a) => a.value)\n// }\n\n// const reverseIfUnshuffled = <T>(unshuffled: T[], shuffled: T[]): T[] => {\n// if (unshuffled.length === shuffled.length && unshuffled.every((val, index) => val === shuffled[index])) {\n// return shuffled.reverse()\n// }\n\n// return shuffled\n// }\n\n/**\n * Get the rating bucket for a response value based on the scale\n * @param responseValue The numeric rating value\n * @param scale The scale of the rating (3, 5, 7, or 10)\n * @returns The bucket name for the rating\n */\nfunction getRatingBucketForResponseValue(responseValue: number, scale: number): string {\n if (scale === 3) {\n if (responseValue < 1 || responseValue > 3) {\n console.warn('PostHog Debug: Rating response out of range for scale 3:', responseValue)\n return 'neutral' // Default to neutral for out-of-range values\n }\n\n return responseValue === 1 ? 'negative' : responseValue === 2 ? 'neutral' : 'positive'\n } else if (scale === 5) {\n if (responseValue < 1 || responseValue > 5) {\n console.warn('PostHog Debug: Rating response out of range for scale 5:', responseValue)\n return 'neutral' // Default to neutral for out-of-range values\n }\n\n return responseValue <= 2 ? 'negative' : responseValue === 3 ? 'neutral' : 'positive'\n } else if (scale === 7) {\n if (responseValue < 1 || responseValue > 7) {\n console.warn('PostHog Debug: Rating response out of range for scale 7:', responseValue)\n return 'neutral' // Default to neutral for out-of-range values\n }\n\n return responseValue <= 3 ? 'negative' : responseValue === 4 ? 'neutral' : 'positive'\n } else if (scale === 10) {\n if (responseValue < 0 || responseValue > 10) {\n console.warn('PostHog Debug: Rating response out of range for scale 10:', responseValue)\n return 'passives' // Default to passives for out-of-range values\n }\n\n return responseValue <= 6 ? 'detractors' : responseValue <= 8 ? 'passives' : 'promoters'\n }\n\n console.warn('PostHog Debug: Unsupported rating scale:', scale)\n return 'neutral' // Default fallback for unsupported scales\n}\n\n/**\n * Determines the next question to show based on the survey's branching logic\n * @param survey The survey object\n * @param currentQuestionIndex The current question index\n * @param response The user's response to the current question\n * @returns The index of the next question or SurveyQuestionBranchingType.End if the survey should end\n */\nexport function getNextSurveyStep(\n survey: Survey,\n currentQuestionIndex: number,\n response: string | string[] | number | null\n): number | typeof SurveyQuestionBranchingType.End {\n const question = survey.questions[currentQuestionIndex]\n const nextQuestionIndex = currentQuestionIndex + 1\n\n if (!question.branching?.type) {\n if (currentQuestionIndex === survey.questions.length - 1) {\n return SurveyQuestionBranchingType.End\n }\n\n return nextQuestionIndex\n }\n\n if (question.branching.type === SurveyQuestionBranchingType.End) {\n return SurveyQuestionBranchingType.End\n } else if (question.branching.type === SurveyQuestionBranchingType.SpecificQuestion) {\n if (isInteger(question.branching.index)) {\n return question.branching.index\n }\n } else if (question.branching.type === SurveyQuestionBranchingType.ResponseBased) {\n // Single choice\n if (question.type === SurveyQuestionType.SingleChoice) {\n // Look up the choiceIndex based on the response\n let selectedChoiceIndex = question.choices.indexOf(`${response}`)\n\n if (selectedChoiceIndex === -1 && question.hasOpenChoice) {\n // if the response is not found in the choices, it must be the open choice,\n // which is always the last choice\n selectedChoiceIndex = question.choices.length - 1\n }\n\n if (question.branching?.responseValues?.hasOwnProperty(selectedChoiceIndex)) {\n const nextStep = question.branching.responseValues[selectedChoiceIndex]\n\n // Specific question\n if (isInteger(nextStep)) {\n return nextStep\n }\n\n if (nextStep === SurveyQuestionBranchingType.End) {\n return SurveyQuestionBranchingType.End\n }\n\n return nextQuestionIndex\n }\n } else if (question.type === SurveyQuestionType.Rating) {\n if (!isInteger(response)) {\n console.warn('PostHog Debug: Expected integer response for rating question but received:', response)\n return nextQuestionIndex // Fail gracefully by continuing to next question\n }\n\n const ratingQuestion = question as RatingSurveyQuestion\n const ratingBucket = getRatingBucketForResponseValue(response as number, ratingQuestion.scale)\n\n if (question.branching?.responseValues?.hasOwnProperty(ratingBucket)) {\n const nextStep = question.branching.responseValues[ratingBucket]\n\n // Specific question\n if (isInteger(nextStep)) {\n return nextStep\n }\n\n if (nextStep === SurveyQuestionBranchingType.End) {\n return SurveyQuestionBranchingType.End\n }\n\n return nextQuestionIndex\n }\n }\n\n return nextQuestionIndex\n }\n\n console.warn('Falling back to next question index due to unexpected branching type')\n return nextQuestionIndex\n}\n\nexport function getContrastingTextColor(color: string): 'black' | 'white' {\n let rgb: string | undefined\n if (color.startsWith('#')) {\n rgb = hex2rgb(color)\n }\n if (color.startsWith('rgb')) {\n rgb = color\n }\n // otherwise it's a color name\n const nameColorToHex = nameToHex(color)\n if (nameColorToHex) {\n rgb = hex2rgb(nameColorToHex)\n }\n if (!rgb) {\n return 'black'\n }\n const colorMatch = rgb.match(/^rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)(?:,\\s*(\\d+(?:\\.\\d+)?))?\\)$/)\n if (colorMatch) {\n const r = parseInt(colorMatch[1], 10)\n const g = parseInt(colorMatch[2], 10)\n const b = parseInt(colorMatch[3], 10)\n const hsp = Math.sqrt(0.299 * (r * r) + 0.587 * (g * g) + 0.114 * (b * b))\n return hsp > 127.5 ? 'black' : 'white'\n }\n return 'black'\n}\n\nfunction hex2rgb(c: string): string {\n if (c.startsWith('#')) {\n let hexColor = c.replace(/^#/, '')\n // Handle 3-character shorthand (e.g., #111 -> #111111, #abc -> #aabbcc)\n if (/^[0-9A-Fa-f]{3}$/.test(hexColor)) {\n hexColor = hexColor[0] + hexColor[0] + hexColor[1] + hexColor[1] + hexColor[2] + hexColor[2]\n }\n if (!/^[0-9A-Fa-f]{6}$/.test(hexColor)) {\n return 'rgb(255, 255, 255)'\n }\n const r = parseInt(hexColor.slice(0, 2), 16)\n const g = parseInt(hexColor.slice(2, 4), 16)\n const b = parseInt(hexColor.slice(4, 6), 16)\n return `rgb(${r},${g},${b})`\n }\n return 'rgb(255, 255, 255)'\n}\n\nfunction nameToHex(name: string): string | undefined {\n return {\n aliceblue: '#f0f8ff',\n antiquewhite: '#faebd7',\n aqua: '#00ffff',\n aquamarine: '#7fffd4',\n azure: '#f0ffff',\n beige: '#f5f5dc',\n bisque: '#ffe4c4',\n black: '#000000',\n blanchedalmond: '#ffebcd',\n blue: '#0000ff',\n blueviolet: '#8a2be2',\n brown: '#a52a2a',\n burlywood: '#deb887',\n cadetblue: '#5f9ea0',\n chartreuse: '#7fff00',\n chocolate: '#d2691e',\n coral: '#ff7f50',\n cornflowerblue: '#6495ed',\n cornsilk: '#fff8dc',\n crimson: '#dc143c',\n cyan: '#00ffff',\n darkblue: '#00008b',\n darkcyan: '#008b8b',\n darkgoldenrod: '#b8860b',\n darkgray: '#a9a9a9',\n darkgreen: '#006400',\n darkkhaki: '#bdb76b',\n darkmagenta: '#8b008b',\n darkolivegreen: '#556b2f',\n darkorange: '#ff8c00',\n darkorchid: '#9932cc',\n darkred: '#8b0000',\n darksalmon: '#e9967a',\n darkseagreen: '#8fbc8f',\n darkslateblue: '#483d8b',\n darkslategray: '#2f4f4f',\n darkturquoise: '#00ced1',\n darkviolet: '#9400d3',\n deeppink: '#ff1493',\n deepskyblue: '#00bfff',\n dimgray: '#696969',\n dodgerblue: '#1e90ff',\n firebrick: '#b22222',\n floralwhite: '#fffaf0',\n forestgreen: '#228b22',\n fuchsia: '#ff00ff',\n gainsboro: '#dcdcdc',\n ghostwhite: '#f8f8ff',\n gold: '#ffd700',\n goldenrod: '#daa520',\n gray: '#808080',\n green: '#008000',\n greenyellow: '#adff2f',\n honeydew: '#f0fff0',\n hotpink: '#ff69b4',\n 'indianred ': '#cd5c5c',\n indigo: '#4b0082',\n ivory: '#fffff0',\n khaki: '#f0e68c',\n lavender: '#e6e6fa',\n lavenderblush: '#fff0f5',\n lawngreen: '#7cfc00',\n lemonchiffon: '#fffacd',\n lightblue: '#add8e6',\n lightcoral: '#f08080',\n lightcyan: '#e0ffff',\n lightgoldenrodyellow: '#fafad2',\n lightgrey: '#d3d3d3',\n lightgreen: '#90ee90',\n lightpink: '#ffb6c1',\n lightsalmon: '#ffa07a',\n lightseagreen: '#20b2aa',\n lightskyblue: '#87cefa',\n lightslategray: '#778899',\n lightsteelblue: '#b0c4de',\n lightyellow: '#ffffe0',\n lime: '#00ff00',\n limegreen: '#32cd32',\n linen: '#faf0e6',\n magenta: '#ff00ff',\n maroon: '#800000',\n mediumaquamarine: '#66cdaa',\n mediumblue: '#0000cd',\n mediumorchid: '#ba55d3',\n mediumpurple: '#9370d8',\n mediumseagreen: '#3cb371',\n mediumslateblue: '#7b68ee',\n mediumspringgreen: '#00fa9a',\n mediumturquoise: '#48d1cc',\n mediumvioletred: '#c71585',\n midnightblue: '#191970',\n mintcream: '#f5fffa',\n mistyrose: '#ffe4e1',\n moccasin: '#ffe4b5',\n navajowhite: '#ffdead',\n navy: '#000080',\n oldlace: '#fdf5e6',\n olive: '#808000',\n olivedrab: '#6b8e23',\n orange: '#ffa500',\n orangered: '#ff4500',\n orchid: '#da70d6',\n palegoldenrod: '#eee8aa',\n palegreen: '#98fb98',\n paleturquoise: '#afeeee',\n palevioletred: '#d87093',\n papayawhip: '#ffefd5',\n peachpuff: '#ffdab9',\n peru: '#cd853f',\n pink: '#ffc0cb',\n plum: '#dda0dd',\n powderblue: '#b0e0e6',\n purple: '#800080',\n red: '#ff0000',\n rosybrown: '#bc8f8f',\n royalblue: '#4169e1',\n saddlebrown: '#8b4513',\n salmon: '#fa8072',\n sandybrown: '#f4a460',\n seagreen: '#2e8b57',\n seashell: '#fff5ee',\n sienna: '#a0522d',\n silver: '#c0c0c0',\n skyblue: '#87ceeb',\n slateblue: '#6a5acd',\n slategray: '#708090',\n snow: '#fffafa',\n springgreen: '#00ff7f',\n steelblue: '#4682b4',\n tan: '#d2b48c',\n teal: '#008080',\n thistle: '#d8bfd8',\n tomato: '#ff6347',\n turquoise: '#40e0d0',\n violet: '#ee82ee',\n wheat: '#f5deb3',\n white: '#ffffff',\n whitesmoke: '#f5f5f5',\n yellow: '#ffff00',\n yellowgreen: '#9acd32',\n }[name.toLowerCase()]\n}\n"],"mappings":"09BAAA,IAAAA,KAAA,CAAAC,OAAA,kBAaA,IAAAC,QAAA,CAAAD,OAAA,0BAMA,QAAS,CAAAE,SAASA,CAACC,KAAc,EAC/B,MAAO,OAAO,CAAAA,KAAK,GAAK,QAAQ,EAAIC,MAAM,CAACF,SAAS,CAACC,KAAK,CAAC,C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M,CAAE,SAAS,CACjBC,KAAK,CAAE,SAAS,CAChBC,KAAK,CAAE,SAAS,CAChBC,UAAU,CAAE,SAAS,CACrBC,MAAM,CAAE,SAAS,CACjBC,WAAW,CAAE,S,CACd,CAAC3I,IAAI,CAAC4I,WAAW,EAAE,CAAC,CACvB","ignoreList":[]}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "4.81.
|
|
1
|
+
export declare const version = "4.81.8";
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version=void 0;var version=exports.version="4.81.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version=void 0;var version=exports.version="4.81.8";
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","names":["version","exports"],"sources":["../src/version.ts"],"sourcesContent":["export const version = \"4.81.
|
|
1
|
+
{"version":3,"file":"version.js","names":["version","exports"],"sources":["../src/version.ts"],"sourcesContent":["export const version = \"4.81.8\"\n"],"mappings":"6FAAO,GAAM,CAAAA,OAAO,CAAAC,OAAA,CAAAD,OAAA,CAAG,QAAQ","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "posthog-react-native",
|
|
3
|
-
"version": "4.81.
|
|
3
|
+
"version": "4.81.8",
|
|
4
4
|
"bugs": {
|
|
5
5
|
"url": "https://github.com/PostHog/posthog-js/issues"
|
|
6
6
|
},
|
|
@@ -73,9 +73,9 @@
|
|
|
73
73
|
"typescript": "7.0.2",
|
|
74
74
|
"@vitest/coverage-v8": "^1.6.1",
|
|
75
75
|
"vitest": "^1.6.1",
|
|
76
|
+
"@posthog-tooling/tsconfig-base": "1.1.1",
|
|
76
77
|
"@posthog/react-native-plugin": "2.12.6",
|
|
77
|
-
"@posthog-tooling/rollup-utils": "1.1.1"
|
|
78
|
-
"@posthog-tooling/tsconfig-base": "1.1.1"
|
|
78
|
+
"@posthog-tooling/rollup-utils": "1.1.1"
|
|
79
79
|
},
|
|
80
80
|
"peerDependencies": {
|
|
81
81
|
"@react-native-async-storage/async-storage": ">=1.0.0",
|