posthog-react-native 4.74.2 → 4.76.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/PostHogErrorBoundary.js.map +1 -1
  2. package/dist/PostHogProvider.js.map +1 -1
  3. package/dist/autocapture.d.ts +1 -1
  4. package/dist/autocapture.js.map +1 -1
  5. package/dist/error-tracking/index.js.map +1 -1
  6. package/dist/error-tracking/utils.js.map +1 -1
  7. package/dist/frameworks/wix-navigation.js +1 -1
  8. package/dist/frameworks/wix-navigation.js.map +1 -1
  9. package/dist/hooks/useNavigationTracker.js.map +1 -1
  10. package/dist/logs-defaults.js +1 -1
  11. package/dist/logs-defaults.js.map +1 -1
  12. package/dist/optional/OptionalExpoUpdates.js.map +1 -1
  13. package/dist/optional/OptionalPlugin.js.map +1 -1
  14. package/dist/optional/OptionalReactNativeSafeArea.js.map +1 -1
  15. package/dist/optional/OptionalReactNativeSvg.js.map +1 -1
  16. package/dist/posthog-rn.js +1 -1
  17. package/dist/posthog-rn.js.map +1 -1
  18. package/dist/surveys/PostHogSurveyProvider.js +1 -1
  19. package/dist/surveys/PostHogSurveyProvider.js.map +1 -1
  20. package/dist/surveys/components/QuestionHeader.js.map +1 -1
  21. package/dist/surveys/components/QuestionTypes.js +1 -1
  22. package/dist/surveys/components/QuestionTypes.js.map +1 -1
  23. package/dist/surveys/components/SurveyModal.d.ts +5 -0
  24. package/dist/surveys/components/SurveyModal.js +1 -1
  25. package/dist/surveys/components/SurveyModal.js.map +1 -1
  26. package/dist/surveys/components/Surveys.d.ts +7 -4
  27. package/dist/surveys/components/Surveys.js +1 -1
  28. package/dist/surveys/components/Surveys.js.map +1 -1
  29. package/dist/surveys/getActiveMatchingSurveys.d.ts +1 -1
  30. package/dist/surveys/getActiveMatchingSurveys.js +1 -1
  31. package/dist/surveys/getActiveMatchingSurveys.js.map +1 -1
  32. package/dist/surveys/icons.js.map +1 -1
  33. package/dist/surveys/safeStyleSheet.js.map +1 -1
  34. package/dist/surveys/survey-progress.d.ts +23 -0
  35. package/dist/surveys/survey-progress.js +2 -0
  36. package/dist/surveys/survey-progress.js.map +1 -0
  37. package/dist/surveys/survey-shuffling.js.map +1 -1
  38. package/dist/surveys/surveys-utils.d.ts +1 -1
  39. package/dist/surveys/useActivatedSurveys.js +1 -1
  40. package/dist/surveys/useActivatedSurveys.js.map +1 -1
  41. package/dist/surveys/useSurveyStorage.d.ts +3 -1
  42. package/dist/surveys/useSurveyStorage.js +1 -1
  43. package/dist/surveys/useSurveyStorage.js.map +1 -1
  44. package/dist/tooling/expoconfig.d.ts +24 -4
  45. package/dist/tooling/expoconfig.js +1 -1
  46. package/dist/tooling/expoconfig.js.map +1 -1
  47. package/dist/tooling/metroconfig.js.map +1 -1
  48. package/dist/tooling/posthogMetroSerializer.js.map +1 -1
  49. package/dist/tooling/utils.js.map +1 -1
  50. package/dist/tooling/vendor/metro/countLines.d.ts +1 -1
  51. package/dist/tooling/vendor/metro/utils.js.map +1 -1
  52. package/dist/utils.js.map +1 -1
  53. package/dist/version.d.ts +1 -1
  54. package/dist/version.js +1 -1
  55. package/dist/version.js.map +1 -1
  56. package/package.json +6 -6
  57. package/tooling/posthog-xcode.sh +22 -1
  58. package/tooling/posthog.gradle +13 -1
@@ -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.PostHogSurveyProvider=PostHogSurveyProvider;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=_interopRequireWildcard(require("react"));var _Surveys=require("./components/Surveys");var _getActiveMatchingSurveys=require("./getActiveMatchingSurveys");var _useSurveyStorage2=require("./useSurveyStorage");var _useActivatedSurveys=require("./useActivatedSurveys");var _SurveyModal=require("./components/SurveyModal");var _surveysUtils=require("./surveys-utils");var _core=require("@posthog/core");var _usePostHog=require("../hooks/usePostHog");var _useFeatureFlags=require("../hooks/useFeatureFlags");var _surveyTranslations=require("./survey-translations");var _jsxRuntime=require("react/jsx-runtime");var _jsxFileName="/home/runner/work/posthog-js/posthog-js/packages/react-native/dist/surveys/PostHogSurveyProvider.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);}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable;})),t.push.apply(t,o);}return t;}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){(0,_defineProperty2["default"])(e,r,t[r]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));});}return e;}var ActiveSurveyContext=_react["default"].createContext(undefined);var FeedbackSurveyContext=_react["default"].createContext(undefined);function PostHogSurveyProvider(props){var _a;var posthogFromHook=(0,_usePostHog.usePostHog)();var posthog=(_a=props.client)!==null&&_a!==void 0?_a:posthogFromHook;var _useSurveyStorage=(0,_useSurveyStorage2.useSurveyStorage)(),seenSurveys=_useSurveyStorage.seenSurveys,setSeenSurvey=_useSurveyStorage.setSeenSurvey,setLastSeenSurveyDate=_useSurveyStorage.setLastSeenSurveyDate;var _useState=(0,_react.useState)([]),_useState2=(0,_slicedToArray2["default"])(_useState,2),surveys=_useState2[0],setSurveys=_useState2[1];var _useState3=(0,_react.useState)(undefined),_useState4=(0,_slicedToArray2["default"])(_useState3,2),activeSurvey=_useState4[0],setActiveSurvey=_useState4[1];var shownSurveyIdRef=(0,_react.useRef)(undefined);var activatedSurveys=(0,_useActivatedSurveys.useActivatedSurveys)(posthog,surveys);var flags=(0,_useFeatureFlags.useFeatureFlags)(posthog);var _useState5=(0,_react.useState)(function(){return(0,_surveyTranslations.detectUserLanguage)(posthog);}),_useState6=(0,_slicedToArray2["default"])(_useState5,2),userLanguage=_useState6[0],setUserLanguage=_useState6[1];(0,_react.useEffect)(function(){var updateLanguage=function updateLanguage(){return setUserLanguage((0,_surveyTranslations.detectUserLanguage)(posthog));};var unsubscribe=posthog.on('personProperties',updateLanguage);updateLanguage();return unsubscribe;},[posthog]);(0,_react.useEffect)(function(){posthog.ready().then(function(){return posthog._onSurveysReady();}).then(function(){setUserLanguage((0,_surveyTranslations.detectUserLanguage)(posthog));return posthog.getSurveys();}).then(setSurveys)["catch"](function(){});},[posthog]);(0,_react.useEffect)(function(){var isShown=!!activeSurvey&&shownSurveyIdRef.current===activeSurvey.id;if(isShown){return;}var activeSurveys=(0,_getActiveMatchingSurveys.getActiveMatchingSurveys)(surveys,flags!==null&&flags!==void 0?flags:{},seenSurveys,activatedSurveys);var popoverSurveys=activeSurveys.filter(function(survey){return survey.type===_core.SurveyType.Popover;});if(activeSurvey&&popoverSurveys.some(function(survey){return survey.id===activeSurvey.id;})){return;}setActiveSurvey(popoverSurveys.length>0?popoverSurveys[0]:undefined);},[activeSurvey,flags,surveys,seenSurveys,activatedSurveys]);var translatedActiveSurvey=(0,_react.useMemo)(function(){return activeSurvey?(0,_surveyTranslations.applySurveyTranslationForUser)(activeSurvey,posthog,userLanguage):undefined;},[activeSurvey,posthog,userLanguage]);var surveyAppearance=(0,_react.useMemo)(function(){var _a,_b,_c,_d,_e;if(props.overrideAppearanceWithDefault||!translatedActiveSurvey){return _objectSpread(_objectSpread({},_surveysUtils.defaultSurveyAppearance),(_a=props.defaultSurveyAppearance)!==null&&_a!==void 0?_a:{});}return _objectSpread(_objectSpread(_objectSpread(_objectSpread({},_surveysUtils.defaultSurveyAppearance),(_b=props.defaultSurveyAppearance)!==null&&_b!==void 0?_b:{}),(_c=translatedActiveSurvey.survey.appearance)!==null&&_c!==void 0?_c:{}),((_d=translatedActiveSurvey.survey.appearance)===null||_d===void 0?void 0:_d.submitButtonColor)?{submitButtonTextColor:(_e=translatedActiveSurvey.survey.appearance.submitButtonTextColor)!==null&&_e!==void 0?_e:(0,_surveysUtils.getContrastingTextColor)(translatedActiveSurvey.survey.appearance.submitButtonColor)}:{});},[translatedActiveSurvey,props.defaultSurveyAppearance,props.overrideAppearanceWithDefault]);var activeContext=(0,_react.useMemo)(function(){if(!activeSurvey||!translatedActiveSurvey){return undefined;}return{survey:translatedActiveSurvey.survey,surveyLanguage:translatedActiveSurvey.language,onShow:function onShow(){if(shownSurveyIdRef.current===activeSurvey.id){return;}shownSurveyIdRef.current=activeSurvey.id;(0,_Surveys.sendSurveyShownEvent)(translatedActiveSurvey.survey,posthog,translatedActiveSurvey.language);setLastSeenSurveyDate(new Date());},onClose:function onClose(submitted,responses){shownSurveyIdRef.current=undefined;setSeenSurvey(activeSurvey);setActiveSurvey(undefined);if(!submitted){(0,_Surveys.dismissedSurveyEvent)(translatedActiveSurvey.survey,responses,posthog,translatedActiveSurvey.language);}}};},[activeSurvey,posthog,setLastSeenSurveyDate,setSeenSurvey,translatedActiveSurvey]);var autoPresent=props.autoPresentSurveys!==false;var isAlreadyShown=!!activeSurvey&&shownSurveyIdRef.current===activeSurvey.id;var shouldShowModal=activeContext&&activeContext.survey.type===_core.SurveyType.Popover&&(autoPresent||isAlreadyShown);return(0,_jsxRuntime.jsx)(ActiveSurveyContext.Provider,{value:activeContext,children:(0,_jsxRuntime.jsxs)(FeedbackSurveyContext.Provider,{value:{surveys:surveys,activeSurvey:activeSurvey,setActiveSurvey:setActiveSurvey},children:[props.children,shouldShowModal&&(0,_jsxRuntime.jsx)(_SurveyModal.SurveyModal,_objectSpread({appearance:surveyAppearance,androidKeyboardBehavior:props.androidKeyboardBehavior},activeContext))]})});}
1
+ "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _typeof=require("@babel/runtime/helpers/typeof");Object.defineProperty(exports,"__esModule",{value:true});exports.PostHogSurveyProvider=PostHogSurveyProvider;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=_interopRequireWildcard(require("react"));var _Surveys=require("./components/Surveys");var _getActiveMatchingSurveys=require("./getActiveMatchingSurveys");var _useSurveyStorage2=require("./useSurveyStorage");var _surveyProgress=require("./survey-progress");var _surveys=require("@posthog/core/surveys");var _useActivatedSurveys=require("./useActivatedSurveys");var _SurveyModal=require("./components/SurveyModal");var _surveysUtils=require("./surveys-utils");var _core=require("@posthog/core");var _usePostHog=require("../hooks/usePostHog");var _useFeatureFlags=require("../hooks/useFeatureFlags");var _surveyTranslations=require("./survey-translations");var _jsxRuntime=require("react/jsx-runtime");var _jsxFileName="/home/runner/work/posthog-js/posthog-js/packages/react-native/dist/surveys/PostHogSurveyProvider.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);}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable;})),t.push.apply(t,o);}return t;}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){(0,_defineProperty2["default"])(e,r,t[r]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));});}return e;}var ActiveSurveyContext=_react["default"].createContext(undefined);var FeedbackSurveyContext=_react["default"].createContext(undefined);function PostHogSurveyProvider(props){var _a;var posthogFromHook=(0,_usePostHog.usePostHog)();var posthog=(_a=props.client)!==null&&_a!==void 0?_a:posthogFromHook;var _useSurveyStorage=(0,_useSurveyStorage2.useSurveyStorage)(posthog),seenSurveys=_useSurveyStorage.seenSurveys,setSeenSurvey=_useSurveyStorage.setSeenSurvey,setLastSeenSurveyDate=_useSurveyStorage.setLastSeenSurveyDate,isReady=_useSurveyStorage.isReady;var progressStore=(0,_react.useMemo)(function(){return new _surveyProgress.SurveyProgressStore(posthog);},[posthog]);var _useState=(0,_react.useState)([]),_useState2=(0,_slicedToArray2["default"])(_useState,2),surveys=_useState2[0],setSurveys=_useState2[1];var _useState3=(0,_react.useState)(undefined),_useState4=(0,_slicedToArray2["default"])(_useState3,2),activeSurvey=_useState4[0],setActiveSurvey=_useState4[1];var shownSurveyIdRef=(0,_react.useRef)(undefined);var sessionEpochRef=(0,_react.useRef)(0);var activeSessionRef=(0,_react.useRef)(undefined);var activatedSurveys=(0,_useActivatedSurveys.useActivatedSurveys)(posthog,surveys);var invalidateSession=(0,_react.useCallback)(function(){sessionEpochRef.current++;activeSessionRef.current=undefined;shownSurveyIdRef.current=undefined;},[]);var flags=(0,_useFeatureFlags.useFeatureFlags)(posthog);var _useState5=(0,_react.useState)(function(){return(0,_surveyTranslations.detectUserLanguage)(posthog);}),_useState6=(0,_slicedToArray2["default"])(_useState5,2),userLanguage=_useState6[0],setUserLanguage=_useState6[1];(0,_react.useEffect)(function(){var updateLanguage=function updateLanguage(){return setUserLanguage((0,_surveyTranslations.detectUserLanguage)(posthog));};var unsubscribe=posthog.on('personProperties',updateLanguage);updateLanguage();return unsubscribe;},[posthog]);(0,_react.useEffect)(function(){return posthog.on('surveysReset',function(){invalidateSession();setActiveSurvey(undefined);});},[posthog,invalidateSession]);(0,_react.useEffect)(function(){var mounted=true;setActiveSurvey(undefined);setSurveys([]);activeSessionRef.current=undefined;shownSurveyIdRef.current=undefined;posthog.ready().then(function(){return posthog._onSurveysReady();}).then(function(){setUserLanguage((0,_surveyTranslations.detectUserLanguage)(posthog));return posthog.getSurveys();}).then(function(loadedSurveys){if(!mounted)return;if(Array.isArray(posthog.getPersistedProperty(_core.PostHogPersistedProperty.Surveys))){progressStore.reconcile(loadedSurveys);}setSurveys(loadedSurveys);})["catch"](function(){});return function(){mounted=false;invalidateSession();};},[posthog,progressStore,invalidateSession]);(0,_react.useEffect)(function(){if(!isReady||!(0,_surveyProgress.canCaptureSurvey)(posthog))return;var isShown=!!activeSurvey&&shownSurveyIdRef.current===activeSurvey.id;if(isShown){return;}var activeSurveys=(0,_getActiveMatchingSurveys.getActiveMatchingSurveys)(surveys,flags!==null&&flags!==void 0?flags:{},seenSurveys,activatedSurveys,new Set(surveys.filter(function(survey){return progressStore.load(survey);}).map(_surveys.getSurveyIterationKey)));var popoverSurveys=activeSurveys.filter(function(survey){return survey.type===_core.SurveyType.Popover;}).sort(function(a,b){return Number(!!progressStore.load(b))-Number(!!progressStore.load(a));});if(activeSurvey&&popoverSurveys.some(function(survey){return survey.id===activeSurvey.id;})){return;}setActiveSurvey(popoverSurveys.length>0?popoverSurveys[0]:undefined);},[activeSurvey,flags,surveys,seenSurveys,activatedSurveys,isReady,posthog,progressStore]);var translatedActiveSurvey=(0,_react.useMemo)(function(){return activeSurvey?(0,_surveyTranslations.applySurveyTranslationForUser)(activeSurvey,posthog,userLanguage):undefined;},[activeSurvey,posthog,userLanguage]);var surveyAppearance=(0,_react.useMemo)(function(){var _a;var _b,_c,_d,_e;if(props.overrideAppearanceWithDefault||!translatedActiveSurvey){return _objectSpread(_objectSpread({},_surveysUtils.defaultSurveyAppearance),(_b=props.defaultSurveyAppearance)!==null&&_b!==void 0?_b:{});}return _objectSpread(_objectSpread(_objectSpread(_objectSpread({},_surveysUtils.defaultSurveyAppearance),(_c=props.defaultSurveyAppearance)!==null&&_c!==void 0?_c:{}),(_d=translatedActiveSurvey.survey.appearance)!==null&&_d!==void 0?_d:{}),((_a=translatedActiveSurvey.survey.appearance)===null||_a===void 0?void 0:_a.submitButtonColor)?{submitButtonTextColor:(_e=translatedActiveSurvey.survey.appearance.submitButtonTextColor)!==null&&_e!==void 0?_e:(0,_surveysUtils.getContrastingTextColor)(translatedActiveSurvey.survey.appearance.submitButtonColor)}:{});},[translatedActiveSurvey,props.defaultSurveyAppearance,props.overrideAppearanceWithDefault]);var activeSession=(0,_react.useMemo)(function(){var _a;return activeSurvey?{progress:(_a=progressStore.load(activeSurvey))!==null&&_a!==void 0?_a:(0,_surveyProgress.createSurveyProgress)(activeSurvey),completed:false,epoch:sessionEpochRef.current}:undefined;},[activeSurvey,progressStore]);var activeContext=(0,_react.useMemo)(function(){if(!activeSurvey||!translatedActiveSurvey||!activeSession){return undefined;}return{client:posthog,initialProgress:activeSession.progress,onProgressChange:function onProgressChange(progress,completed){var _a;if(activeSessionRef.current!==activeSession||!(0,_surveyProgress.canCaptureSurvey)(posthog)||((_a=progressStore.load(activeSurvey))===null||_a===void 0?void 0:_a.submissionId)!==activeSession.progress.submissionId)return false;activeSession.progress=progress;activeSession.completed=completed;if(completed){progressStore.remove(activeSurvey);setSeenSurvey(activeSurvey);}else{progressStore.save(activeSurvey,progress);}return true;},survey:translatedActiveSurvey.survey,surveyLanguage:translatedActiveSurvey.language,onShow:function onShow(){if(activeSession.epoch!==sessionEpochRef.current||!(0,_surveyProgress.canCaptureSurvey)(posthog))return;if(shownSurveyIdRef.current===activeSurvey.id){return;}activeSessionRef.current=activeSession;progressStore.save(activeSurvey,activeSession.progress);shownSurveyIdRef.current=activeSurvey.id;(0,_Surveys.sendSurveyShownEvent)(translatedActiveSurvey.survey,posthog,translatedActiveSurvey.language);setLastSeenSurveyDate(new Date());},onClose:function onClose(submitted,responses){if(activeSessionRef.current!==activeSession)return;activeSessionRef.current=undefined;progressStore.remove(activeSurvey);shownSurveyIdRef.current=undefined;setSeenSurvey(activeSurvey);setActiveSurvey(undefined);if(submitted||activeSession.completed)return;if((0,_surveyProgress.canCaptureSurvey)(posthog)){(0,_Surveys.dismissedSurveyEvent)(translatedActiveSurvey.survey,responses,posthog,Object.keys(activeSession.progress.responses).length>0?activeSession.progress.surveyLanguage:translatedActiveSurvey.language,activeSession.progress);}}};},[activeSurvey,activeSession,posthog,progressStore,setLastSeenSurveyDate,setSeenSurvey,translatedActiveSurvey]);var autoPresent=props.autoPresentSurveys!==false;var isAlreadyShown=!!activeSurvey&&shownSurveyIdRef.current===activeSurvey.id;var shouldShowModal=activeContext&&activeContext.survey.type===_core.SurveyType.Popover&&(autoPresent||isAlreadyShown);return(0,_jsxRuntime.jsx)(ActiveSurveyContext.Provider,{value:activeContext,children:(0,_jsxRuntime.jsxs)(FeedbackSurveyContext.Provider,{value:{surveys:surveys,activeSurvey:activeSurvey,setActiveSurvey:setActiveSurvey},children:[props.children,shouldShowModal&&(0,_jsxRuntime.jsx)(_SurveyModal.SurveyModal,_objectSpread({appearance:surveyAppearance,androidKeyboardBehavior:props.androidKeyboardBehavior},activeContext),activeSession===null||activeSession===void 0?void 0:activeSession.progress.submissionId)]})});}
2
2
  //# sourceMappingURL=PostHogSurveyProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PostHogSurveyProvider.js","names":["_react","_interopRequireWildcard","require","_Surveys","_getActiveMatchingSurveys","_useSurveyStorage2","_useActivatedSurveys","_SurveyModal","_surveysUtils","_core","_usePostHog","_useFeatureFlags","_surveyTranslations","_jsxRuntime","_jsxFileName","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t2","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ownKeys","keys","getOwnPropertySymbols","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","ActiveSurveyContext","React","createContext","undefined","FeedbackSurveyContext","PostHogSurveyProvider","props","posthogFromHook","usePostHog","posthog","_a","client","_useSurveyStorage","useSurveyStorage","seenSurveys","setSeenSurvey","setLastSeenSurveyDate","_useState","useState","_useState2","_slicedToArray2","surveys","setSurveys","_useState3","_useState4","activeSurvey","setActiveSurvey","shownSurveyIdRef","useRef","activatedSurveys","useActivatedSurveys","flags","useFeatureFlags","_useState5","detectUserLanguage","_useState6","userLanguage","setUserLanguage","useEffect","updateLanguage","unsubscribe","on","ready","then","_onSurveysReady","getSurveys","isShown","current","id","activeSurveys","getActiveMatchingSurveys","popoverSurveys","survey","type","SurveyType","Popover","some","translatedActiveSurvey","useMemo","applySurveyTranslationForUser","surveyAppearance","overrideAppearanceWithDefault","defaultSurveyAppearance","_b","_c","appearance","_d","submitButtonColor","submitButtonTextColor","_e","getContrastingTextColor","activeContext","surveyLanguage","language","onShow","sendSurveyShownEvent","Date","onClose","submitted","responses","dismissedSurveyEvent","autoPresent","autoPresentSurveys","isAlreadyShown","shouldShowModal","jsx","Provider","value","children","jsxs","SurveyModal","androidKeyboardBehavior"],"sources":["../../src/surveys/PostHogSurveyProvider.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useRef, useState } from 'react'\n\nimport { dismissedSurveyEvent, sendSurveyShownEvent } from './components/Surveys'\n\nimport { getActiveMatchingSurveys } from './getActiveMatchingSurveys'\nimport { useSurveyStorage } from './useSurveyStorage'\nimport { useActivatedSurveys } from './useActivatedSurveys'\nimport { SurveyModal } from './components/SurveyModal'\nimport {\n defaultSurveyAppearance,\n getContrastingTextColor,\n SurveyAppearance,\n SurveyAppearanceTheme,\n} from './surveys-utils'\nimport { Survey, SurveyType, type SurveyResponses } from '@posthog/core'\nimport { usePostHog } from '../hooks/usePostHog'\nimport { useFeatureFlags } from '../hooks/useFeatureFlags'\nimport { PostHog } from '../posthog-rn'\nimport { applySurveyTranslationForUser, detectUserLanguage } from './survey-translations'\n\ntype ActiveSurveyContextType =\n | {\n survey: Survey\n surveyLanguage: string | null\n onShow: () => void\n onClose: (submitted: boolean, responses: SurveyResponses) => void\n }\n | undefined\nconst ActiveSurveyContext = React.createContext<ActiveSurveyContextType>(undefined)\n// export const useActiveSurvey = (): ActiveSurveyContextType => React.useContext(ActiveSurveyContext)\n\n// type FeedbackSurveyHook = {\n// survey: Survey\n// showSurveyModal: () => void\n// hideSurveyModal: () => void\n// }\nconst FeedbackSurveyContext = React.createContext<\n | {\n surveys: Survey[]\n activeSurvey: Survey | undefined\n setActiveSurvey: React.Dispatch<React.SetStateAction<Survey | undefined>>\n }\n | undefined\n>(undefined)\n// export const useFeedbackSurvey = (selector: string): FeedbackSurveyHook | undefined => {\n// const context = React.useContext(FeedbackSurveyContext)\n// const survey = context?.surveys.find(\n// (survey: Survey) => survey.type === SurveyType.Widget && survey.appearance?.widgetSelector === selector\n// )\n// if (!context || !survey) {\n// return undefined\n// }\n\n// return {\n// survey,\n// showSurveyModal: () => context.setActiveSurvey(survey),\n// hideSurveyModal: () => {\n// if (context.activeSurvey === survey) {\n// context.setActiveSurvey(undefined)\n// }\n// },\n// }\n// }\n\nexport type PostHogSurveyProviderProps = {\n /**\n * Whether eligible popover surveys are automatically presented. (Default: true)\n * Set to false to defer presentation — e.g. while a native-stack formSheet/modal is on top.\n * Deferral is display-only: the survey stays armed and presents once this is true again.\n * A survey already on screen is not interrupted when this becomes false.\n *\n * You own flipping this back to true (e.g. wire it to route/screen focus). While it stays\n * false the survey remains deferred and never shows — if the un-defer never happens\n * (sheet dismissed without re-focusing the provider, an unmount, an error boundary), the\n * survey stays armed indefinitely and no \"survey shown\" event fires.\n */\n autoPresentSurveys?: boolean\n\n /**\n * The default appearance for surveys when not specified in PostHog.\n *\n * Accepts the React Native-only appearance fields as well (e.g.\n * `maxFontSizeMultiplier`) — they are merged into the same theme object the\n * survey components read, and PostHog never sends them down.\n */\n defaultSurveyAppearance?: SurveyAppearance\n\n /**\n * If true, PosHog appearance will be ignored and defaultSurveyAppearance is always used.\n */\n overrideAppearanceWithDefault?: boolean\n\n /**\n * The keyboard avoiding behavior for the survey modal (KeyboardAvoidingView), applied only to Android devices.\n * - 'padding': Adds padding to avoid keyboard (recommended)\n * - 'height': Resizes the view height (default, for legacy - may cause flickering on some Android devices)\n * @default 'height'\n */\n androidKeyboardBehavior?: 'padding' | 'height'\n\n client?: PostHog\n\n children: React.ReactNode\n}\n\nexport function PostHogSurveyProvider(props: PostHogSurveyProviderProps): JSX.Element {\n const posthogFromHook = usePostHog()\n const posthog = props.client ?? posthogFromHook\n const { seenSurveys, setSeenSurvey, setLastSeenSurveyDate } = useSurveyStorage()\n const [surveys, setSurveys] = useState<Survey[]>([])\n const [activeSurvey, setActiveSurvey] = useState<Survey | undefined>(undefined)\n // Latches the id of the survey once its modal has actually painted, so deferring presentation\n // (autoPresentSurveys=false) never tears down a survey the user is already interacting with.\n const shownSurveyIdRef = useRef<string | undefined>(undefined)\n const activatedSurveys = useActivatedSurveys(posthog, surveys)\n\n const flags = useFeatureFlags(posthog)\n const [userLanguage, setUserLanguage] = useState(() => detectUserLanguage(posthog))\n\n useEffect(() => {\n const updateLanguage = () => setUserLanguage(detectUserLanguage(posthog))\n const unsubscribe = posthog.on('personProperties', updateLanguage)\n updateLanguage()\n return unsubscribe\n }, [posthog])\n\n // Load surveys once\n useEffect(() => {\n posthog\n .ready()\n .then(() => posthog._onSurveysReady())\n .then(() => {\n setUserLanguage(detectUserLanguage(posthog))\n return posthog.getSurveys()\n })\n .then(setSurveys)\n .catch(() => {})\n }, [posthog])\n\n // Whenever state changes, re-select the popover survey to show. A survey that has already\n // painted is left alone; an armed-but-deferred one is re-validated so it can't be presented\n // after it stops matching (e.g. its targeting flag flips off during a long deferral).\n useEffect(() => {\n const isShown = !!activeSurvey && shownSurveyIdRef.current === activeSurvey.id\n if (isShown) {\n return\n }\n\n const activeSurveys = getActiveMatchingSurveys(\n surveys,\n flags ?? {},\n seenSurveys,\n activatedSurveys\n // lastSeenSurveyDate\n )\n\n const popoverSurveys = activeSurveys.filter((survey: Survey) => survey.type === SurveyType.Popover)\n // TODO: sort by appearance delay, implement delay\n // const popoverSurveyQueue = sortSurveysByAppearanceDelay(popoverSurveys)\n\n if (activeSurvey && popoverSurveys.some((survey) => survey.id === activeSurvey.id)) {\n return\n }\n\n setActiveSurvey(popoverSurveys.length > 0 ? popoverSurveys[0] : undefined)\n }, [activeSurvey, flags, surveys, seenSurveys, activatedSurveys])\n\n const translatedActiveSurvey = useMemo(() => {\n return activeSurvey ? applySurveyTranslationForUser(activeSurvey, posthog, userLanguage) : undefined\n }, [activeSurvey, posthog, userLanguage])\n\n // Merge survey appearance so that components and hooks can use a consistent model\n const surveyAppearance = useMemo<SurveyAppearanceTheme>(() => {\n if (props.overrideAppearanceWithDefault || !translatedActiveSurvey) {\n return {\n ...defaultSurveyAppearance,\n ...(props.defaultSurveyAppearance ?? {}),\n }\n }\n return {\n ...defaultSurveyAppearance,\n ...(props.defaultSurveyAppearance ?? {}),\n ...(translatedActiveSurvey.survey.appearance ?? {}),\n // If submitButtonColor is set by PostHog, ensure submitButtonTextColor is also set to contrast\n ...(translatedActiveSurvey.survey.appearance?.submitButtonColor\n ? {\n submitButtonTextColor:\n translatedActiveSurvey.survey.appearance.submitButtonTextColor ??\n getContrastingTextColor(translatedActiveSurvey.survey.appearance.submitButtonColor),\n }\n : {}),\n }\n }, [translatedActiveSurvey, props.defaultSurveyAppearance, props.overrideAppearanceWithDefault])\n\n const activeContext = useMemo(() => {\n if (!activeSurvey || !translatedActiveSurvey) {\n return undefined\n }\n return {\n survey: translatedActiveSurvey.survey,\n surveyLanguage: translatedActiveSurvey.language,\n onShow: () => {\n // Updating translated copy changes this callback, but does not show a new survey.\n if (shownSurveyIdRef.current === activeSurvey.id) {\n return\n }\n shownSurveyIdRef.current = activeSurvey.id\n sendSurveyShownEvent(translatedActiveSurvey.survey, posthog, translatedActiveSurvey.language)\n setLastSeenSurveyDate(new Date())\n },\n onClose: (submitted: boolean, responses: SurveyResponses) => {\n shownSurveyIdRef.current = undefined\n setSeenSurvey(activeSurvey)\n setActiveSurvey(undefined)\n if (!submitted) {\n dismissedSurveyEvent(translatedActiveSurvey.survey, responses, posthog, translatedActiveSurvey.language)\n }\n },\n }\n }, [activeSurvey, posthog, setLastSeenSurveyDate, setSeenSurvey, translatedActiveSurvey])\n\n // Present a popover survey when autoPresentSurveys is on. Once it has painted (shownSurveyIdRef),\n // keep it mounted regardless of the gate so a mid-interaction survey is never yanked — the gate\n // defers not-yet-shown surveys, it does not interrupt a live one.\n const autoPresent = props.autoPresentSurveys !== false\n const isAlreadyShown = !!activeSurvey && shownSurveyIdRef.current === activeSurvey.id\n const shouldShowModal =\n activeContext && activeContext.survey.type === SurveyType.Popover && (autoPresent || isAlreadyShown)\n\n return (\n <ActiveSurveyContext.Provider value={activeContext}>\n <FeedbackSurveyContext.Provider value={{ surveys, activeSurvey, setActiveSurvey }}>\n {props.children}\n {shouldShowModal && (\n <SurveyModal\n appearance={surveyAppearance}\n androidKeyboardBehavior={props.androidKeyboardBehavior}\n {...activeContext}\n />\n )}\n </FeedbackSurveyContext.Provider>\n </ActiveSurveyContext.Provider>\n )\n}\n\n// function sortSurveysByAppearanceDelay(surveys: Survey[]): Survey[] {\n// return surveys.sort(\n// (a, b) => (a.appearance?.surveyPopupDelaySeconds ?? 0) - (b.appearance?.surveyPopupDelaySeconds ?? 0)\n// )\n// }\n"],"mappings":"4bAAA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CAAEO,qBAAqB,CAAED,aAAa,CAAE0C,sBAAsB,CAAC,CAAC,CAKzF,GAAM,CAAAwB,WAAW,CAAG3E,KAAK,CAAC4E,kBAAkB,GAAK,KAAK,CACtD,GAAM,CAAAC,cAAc,CAAG,CAAC,CAAC1D,YAAY,EAAIE,gBAAgB,CAACoB,OAAO,GAAKtB,YAAY,CAACuB,EAAE,CACrF,GAAM,CAAAoC,eAAe,CACnBb,aAAa,EAAIA,aAAa,CAACnB,MAAM,CAACC,IAAI,GAAKC,gBAAU,CAACC,OAAO,GAAK0B,WAAW,EAAIE,cAAc,CAAC,CAEtG,MACE,GAAAvH,WAAA,CAAAyH,GAAA,EAACrF,mBAAmB,CAACsF,QAAQ,EAACC,KAAK,CAAEhB,aAAc,CAAAiB,QAAA,CACjD,GAAA5H,WAAA,CAAA6H,IAAA,EAACrF,qBAAqB,CAACkF,QAAQ,EAACC,KAAK,CAAE,CAAElE,OAAO,CAAPA,OAAO,CAAEI,YAAY,CAAZA,YAAY,CAAEC,eAAe,CAAfA,eAAe,CAAG,CAAA8D,QAAA,EAC/ElF,KAAK,CAACkF,QAAQ,CACdJ,eAAe,EACd,GAAAxH,WAAA,CAAAyH,GAAA,EAAC/H,YAAA,CAAAoI,WAAW,CAAAjG,aAAA,EACVwE,UAAU,CAAEL,gBAAiB,CAC7B+B,uBAAuB,CAAErF,KAAK,CAACqF,uBAAwB,EACnDpB,aAAa,CAAC,CAErB,EAC6B,CAClC,CAA8B,CAAC,CAEnC","ignoreList":[]}
1
+ {"version":3,"file":"PostHogSurveyProvider.js","names":["_react","_interopRequireWildcard","require","_Surveys","_getActiveMatchingSurveys","_useSurveyStorage2","_surveyProgress","_surveys","_useActivatedSurveys","_SurveyModal","_surveysUtils","_core","_usePostHog","_useFeatureFlags","_surveyTranslations","_jsxRuntime","_jsxFileName","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t2","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ownKeys","keys","getOwnPropertySymbols","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","ActiveSurveyContext","React","createContext","undefined","FeedbackSurveyContext","PostHogSurveyProvider","props","posthogFromHook","usePostHog","posthog","_a","client","_useSurveyStorage","useSurveyStorage","seenSurveys","setSeenSurvey","setLastSeenSurveyDate","isReady","progressStore","useMemo","SurveyProgressStore","_useState","useState","_useState2","_slicedToArray2","surveys","setSurveys","_useState3","_useState4","activeSurvey","setActiveSurvey","shownSurveyIdRef","useRef","sessionEpochRef","activeSessionRef","activatedSurveys","useActivatedSurveys","invalidateSession","useCallback","current","flags","useFeatureFlags","_useState5","detectUserLanguage","_useState6","userLanguage","setUserLanguage","useEffect","updateLanguage","unsubscribe","on","mounted","ready","then","_onSurveysReady","getSurveys","loadedSurveys","Array","isArray","getPersistedProperty","PostHogPersistedProperty","Surveys","reconcile","canCaptureSurvey","isShown","id","activeSurveys","getActiveMatchingSurveys","Set","survey","load","map","getSurveyIterationKey","popoverSurveys","type","SurveyType","Popover","sort","a","b","Number","some","translatedActiveSurvey","applySurveyTranslationForUser","surveyAppearance","overrideAppearanceWithDefault","defaultSurveyAppearance","_b","_c","_d","appearance","submitButtonColor","submitButtonTextColor","_e","getContrastingTextColor","activeSession","progress","createSurveyProgress","completed","epoch","activeContext","initialProgress","onProgressChange","submissionId","remove","save","surveyLanguage","language","onShow","sendSurveyShownEvent","Date","onClose","submitted","responses","dismissedSurveyEvent","autoPresent","autoPresentSurveys","isAlreadyShown","shouldShowModal","jsx","Provider","value","children","jsxs","SurveyModal","androidKeyboardBehavior"],"sources":["../../src/surveys/PostHogSurveyProvider.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'\n\nimport { dismissedSurveyEvent, sendSurveyShownEvent } from './components/Surveys'\n\nimport { getActiveMatchingSurveys } from './getActiveMatchingSurveys'\nimport { useSurveyStorage } from './useSurveyStorage'\nimport { canCaptureSurvey, createSurveyProgress, SurveyProgress, SurveyProgressStore } from './survey-progress'\nimport { getSurveyIterationKey } from '@posthog/core/surveys'\nimport { useActivatedSurveys } from './useActivatedSurveys'\nimport { SurveyModal } from './components/SurveyModal'\nimport {\n defaultSurveyAppearance,\n getContrastingTextColor,\n SurveyAppearance,\n SurveyAppearanceTheme,\n} from './surveys-utils'\nimport { PostHogPersistedProperty, Survey, SurveyType, type SurveyResponses } from '@posthog/core'\nimport { usePostHog } from '../hooks/usePostHog'\nimport { useFeatureFlags } from '../hooks/useFeatureFlags'\nimport { PostHog } from '../posthog-rn'\nimport { applySurveyTranslationForUser, detectUserLanguage } from './survey-translations'\n\ntype ActiveSurveyContextType =\n | {\n survey: Survey\n surveyLanguage: string | null\n onShow: () => void\n onClose: (submitted: boolean, responses: SurveyResponses) => void\n }\n | undefined\nconst ActiveSurveyContext = React.createContext<ActiveSurveyContextType>(undefined)\n// export const useActiveSurvey = (): ActiveSurveyContextType => React.useContext(ActiveSurveyContext)\n\n// type FeedbackSurveyHook = {\n// survey: Survey\n// showSurveyModal: () => void\n// hideSurveyModal: () => void\n// }\nconst FeedbackSurveyContext = React.createContext<\n | {\n surveys: Survey[]\n activeSurvey: Survey | undefined\n setActiveSurvey: React.Dispatch<React.SetStateAction<Survey | undefined>>\n }\n | undefined\n>(undefined)\n// export const useFeedbackSurvey = (selector: string): FeedbackSurveyHook | undefined => {\n// const context = React.useContext(FeedbackSurveyContext)\n// const survey = context?.surveys.find(\n// (survey: Survey) => survey.type === SurveyType.Widget && survey.appearance?.widgetSelector === selector\n// )\n// if (!context || !survey) {\n// return undefined\n// }\n\n// return {\n// survey,\n// showSurveyModal: () => context.setActiveSurvey(survey),\n// hideSurveyModal: () => {\n// if (context.activeSurvey === survey) {\n// context.setActiveSurvey(undefined)\n// }\n// },\n// }\n// }\n\nexport type PostHogSurveyProviderProps = {\n /**\n * Whether eligible popover surveys are automatically presented. (Default: true)\n * Set to false to defer presentation — e.g. while a native-stack formSheet/modal is on top.\n * Deferral is display-only: the survey stays armed and presents once this is true again.\n * A survey already on screen is not interrupted when this becomes false.\n *\n * You own flipping this back to true (e.g. wire it to route/screen focus). While it stays\n * false the survey remains deferred and never shows — if the un-defer never happens\n * (sheet dismissed without re-focusing the provider, an unmount, an error boundary), the\n * survey stays armed indefinitely and no \"survey shown\" event fires.\n */\n autoPresentSurveys?: boolean\n\n /**\n * The default appearance for surveys when not specified in PostHog.\n *\n * Accepts the React Native-only appearance fields as well (e.g.\n * `maxFontSizeMultiplier`) — they are merged into the same theme object the\n * survey components read, and PostHog never sends them down.\n */\n defaultSurveyAppearance?: SurveyAppearance\n\n /**\n * If true, PosHog appearance will be ignored and defaultSurveyAppearance is always used.\n */\n overrideAppearanceWithDefault?: boolean\n\n /**\n * The keyboard avoiding behavior for the survey modal (KeyboardAvoidingView), applied only to Android devices.\n * - 'padding': Adds padding to avoid keyboard (recommended)\n * - 'height': Resizes the view height (default, for legacy - may cause flickering on some Android devices)\n * @default 'height'\n */\n androidKeyboardBehavior?: 'padding' | 'height'\n\n client?: PostHog\n\n children: React.ReactNode\n}\n\nexport function PostHogSurveyProvider(props: PostHogSurveyProviderProps): JSX.Element {\n const posthogFromHook = usePostHog()\n const posthog = props.client ?? posthogFromHook\n const { seenSurveys, setSeenSurvey, setLastSeenSurveyDate, isReady } = useSurveyStorage(posthog)\n const progressStore = useMemo(() => new SurveyProgressStore(posthog), [posthog])\n const [surveys, setSurveys] = useState<Survey[]>([])\n const [activeSurvey, setActiveSurvey] = useState<Survey | undefined>(undefined)\n // Latches the id of the survey once its modal has actually painted, so deferring presentation\n // (autoPresentSurveys=false) never tears down a survey the user is already interacting with.\n const shownSurveyIdRef = useRef<string | undefined>(undefined)\n const sessionEpochRef = useRef(0)\n const activeSessionRef = useRef<object | undefined>(undefined)\n const activatedSurveys = useActivatedSurveys(posthog, surveys)\n const invalidateSession = useCallback(() => {\n sessionEpochRef.current++\n activeSessionRef.current = undefined\n shownSurveyIdRef.current = undefined\n }, [])\n\n const flags = useFeatureFlags(posthog)\n const [userLanguage, setUserLanguage] = useState(() => detectUserLanguage(posthog))\n\n useEffect(() => {\n const updateLanguage = () => setUserLanguage(detectUserLanguage(posthog))\n const unsubscribe = posthog.on('personProperties', updateLanguage)\n updateLanguage()\n return unsubscribe\n }, [posthog])\n\n useEffect(\n () =>\n posthog.on('surveysReset', () => {\n invalidateSession()\n setActiveSurvey(undefined)\n }),\n [posthog, invalidateSession]\n )\n\n // Load surveys once\n useEffect(() => {\n let mounted = true\n setActiveSurvey(undefined)\n setSurveys([])\n activeSessionRef.current = undefined\n shownSurveyIdRef.current = undefined\n posthog\n .ready()\n .then(() => posthog._onSurveysReady())\n .then(() => {\n setUserLanguage(detectUserLanguage(posthog))\n return posthog.getSurveys()\n })\n .then((loadedSurveys) => {\n if (!mounted) return\n // An unavailable cache (failed load or disableSurveys) is not an empty project.\n if (Array.isArray(posthog.getPersistedProperty(PostHogPersistedProperty.Surveys))) {\n progressStore.reconcile(loadedSurveys)\n }\n setSurveys(loadedSurveys)\n })\n .catch(() => {})\n return () => {\n mounted = false\n invalidateSession()\n }\n }, [posthog, progressStore, invalidateSession])\n\n // Whenever state changes, re-select the popover survey to show. A survey that has already\n // painted is left alone; an armed-but-deferred one is re-validated so it can't be presented\n // after it stops matching (e.g. its targeting flag flips off during a long deferral).\n useEffect(() => {\n if (!isReady || !canCaptureSurvey(posthog)) return\n const isShown = !!activeSurvey && shownSurveyIdRef.current === activeSurvey.id\n if (isShown) {\n return\n }\n\n const activeSurveys = getActiveMatchingSurveys(\n surveys,\n flags ?? {},\n seenSurveys,\n activatedSurveys,\n new Set(surveys.filter((survey) => progressStore.load(survey)).map(getSurveyIterationKey))\n // lastSeenSurveyDate\n )\n\n const popoverSurveys = activeSurveys\n .filter((survey: Survey) => survey.type === SurveyType.Popover)\n .sort((a, b) => Number(!!progressStore.load(b)) - Number(!!progressStore.load(a)))\n // TODO: sort by appearance delay, implement delay\n // const popoverSurveyQueue = sortSurveysByAppearanceDelay(popoverSurveys)\n\n if (activeSurvey && popoverSurveys.some((survey) => survey.id === activeSurvey.id)) {\n return\n }\n\n setActiveSurvey(popoverSurveys.length > 0 ? popoverSurveys[0] : undefined)\n }, [activeSurvey, flags, surveys, seenSurveys, activatedSurveys, isReady, posthog, progressStore])\n\n const translatedActiveSurvey = useMemo(() => {\n return activeSurvey ? applySurveyTranslationForUser(activeSurvey, posthog, userLanguage) : undefined\n }, [activeSurvey, posthog, userLanguage])\n\n // Merge survey appearance so that components and hooks can use a consistent model\n const surveyAppearance = useMemo<SurveyAppearanceTheme>(() => {\n if (props.overrideAppearanceWithDefault || !translatedActiveSurvey) {\n return {\n ...defaultSurveyAppearance,\n ...(props.defaultSurveyAppearance ?? {}),\n }\n }\n return {\n ...defaultSurveyAppearance,\n ...(props.defaultSurveyAppearance ?? {}),\n ...(translatedActiveSurvey.survey.appearance ?? {}),\n // If submitButtonColor is set by PostHog, ensure submitButtonTextColor is also set to contrast\n ...(translatedActiveSurvey.survey.appearance?.submitButtonColor\n ? {\n submitButtonTextColor:\n translatedActiveSurvey.survey.appearance.submitButtonTextColor ??\n getContrastingTextColor(translatedActiveSurvey.survey.appearance.submitButtonColor),\n }\n : {}),\n }\n }, [translatedActiveSurvey, props.defaultSurveyAppearance, props.overrideAppearanceWithDefault])\n\n const activeSession = useMemo(\n () =>\n activeSurvey\n ? {\n progress: progressStore.load(activeSurvey) ?? createSurveyProgress(activeSurvey),\n completed: false,\n epoch: sessionEpochRef.current,\n }\n : undefined,\n [activeSurvey, progressStore]\n )\n\n const activeContext = useMemo(() => {\n if (!activeSurvey || !translatedActiveSurvey || !activeSession) {\n return undefined\n }\n return {\n client: posthog,\n initialProgress: activeSession.progress,\n onProgressChange: (progress: SurveyProgress, completed: boolean) => {\n if (\n activeSessionRef.current !== activeSession ||\n !canCaptureSurvey(posthog) ||\n progressStore.load(activeSurvey)?.submissionId !== activeSession.progress.submissionId\n )\n return false\n activeSession.progress = progress\n activeSession.completed = completed\n if (completed) {\n progressStore.remove(activeSurvey)\n setSeenSurvey(activeSurvey)\n } else {\n progressStore.save(activeSurvey, progress)\n }\n return true\n },\n survey: translatedActiveSurvey.survey,\n surveyLanguage: translatedActiveSurvey.language,\n onShow: () => {\n // Updating translated copy changes this callback, but does not show a new survey.\n if (activeSession.epoch !== sessionEpochRef.current || !canCaptureSurvey(posthog)) return\n if (shownSurveyIdRef.current === activeSurvey.id) {\n return\n }\n activeSessionRef.current = activeSession\n progressStore.save(activeSurvey, activeSession.progress)\n shownSurveyIdRef.current = activeSurvey.id\n sendSurveyShownEvent(translatedActiveSurvey.survey, posthog, translatedActiveSurvey.language)\n setLastSeenSurveyDate(new Date())\n },\n onClose: (submitted: boolean, responses: SurveyResponses) => {\n if (activeSessionRef.current !== activeSession) return\n activeSessionRef.current = undefined\n progressStore.remove(activeSurvey)\n shownSurveyIdRef.current = undefined\n setSeenSurvey(activeSurvey)\n setActiveSurvey(undefined)\n if (submitted || activeSession.completed) return\n if (canCaptureSurvey(posthog)) {\n dismissedSurveyEvent(\n translatedActiveSurvey.survey,\n responses,\n posthog,\n Object.keys(activeSession.progress.responses).length > 0\n ? activeSession.progress.surveyLanguage\n : translatedActiveSurvey.language,\n activeSession.progress\n )\n }\n },\n }\n }, [\n activeSurvey,\n activeSession,\n posthog,\n progressStore,\n setLastSeenSurveyDate,\n setSeenSurvey,\n translatedActiveSurvey,\n ])\n\n // Present a popover survey when autoPresentSurveys is on. Once it has painted (shownSurveyIdRef),\n // keep it mounted regardless of the gate so a mid-interaction survey is never yanked — the gate\n // defers not-yet-shown surveys, it does not interrupt a live one.\n const autoPresent = props.autoPresentSurveys !== false\n const isAlreadyShown = !!activeSurvey && shownSurveyIdRef.current === activeSurvey.id\n const shouldShowModal =\n activeContext && activeContext.survey.type === SurveyType.Popover && (autoPresent || isAlreadyShown)\n\n return (\n <ActiveSurveyContext.Provider value={activeContext}>\n <FeedbackSurveyContext.Provider value={{ surveys, activeSurvey, setActiveSurvey }}>\n {props.children}\n {shouldShowModal && (\n <SurveyModal\n key={activeSession?.progress.submissionId}\n appearance={surveyAppearance}\n androidKeyboardBehavior={props.androidKeyboardBehavior}\n {...activeContext}\n />\n )}\n </FeedbackSurveyContext.Provider>\n </ActiveSurveyContext.Provider>\n )\n}\n\n// function sortSurveysByAppearanceDelay(surveys: Survey[]): Survey[] {\n// return surveys.sort(\n// (a, b) => (a.appearance?.surveyPopupDelaySeconds ?? 0) - (b.appearance?.surveyPopupDelaySeconds ?? 0)\n// )\n// }\n"],"mappings":"4bAAA,IAAAA,MAAA,CAAAC,uBAAA,CAAAC,OAAA,WAEA,IAAAC,QAAA,CAAAD,OAAA,yBAEA,IAAAE,yBAAA,CAAAF,OAAA,+BACA,IAAAG,kBAAA,CAAAH,OAAA,uBACA,IAAAI,eAAA,CAAAJ,OAAA,sBACA,IAAAK,QAAA,CAAAL,OAAA,0BACA,IAAAM,oBAAA,CAAAN,OAAA,0BACA,IAAAO,YAAA,CAAAP,OAAA,6BACA,IAAAQ,aAAA,CAAAR,OAAA,oBAMA,IAAAS,KAAA,CAAAT,OAAA,kBACA,IAAAU,WAAA,CAAAV,OAAA,wBACA,IAAAW,gBAAA,CAAAX,OAAA,6BAEA,IAAAY,mBAAA,CAAAZ,OAAA,0BAAyF,IAAAa,WAAA,CAAAb,OAAA,0BAAAc,YAAA,gHAAAf,wBAAAgB,CAAA,CAAAC,CAAA,wBAAAC,OAAA,KAAAC,CAAA,KAAAD,OAAA,GAAAE,CAAA,KAAAF,OAAA,UAAAlB,uBAAA,UAAAA,wBAAAgB,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,CAAA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
@@ -1 +1 @@
1
- {"version":3,"file":"QuestionHeader.js","names":["_react","_interopRequireDefault","require","_reactNative","_safeStyleSheet","_surveysUtils","_jsxRuntime","_jsxFileName","QuestionHeader","_ref","question","description","descriptionContentType","appearance","textColor","_a","getContrastingTextColor","backgroundColor","jsxs","View","style","styles","container","children","jsx","Text","maxFontSizeMultiplier","getMaxFontSizeMultiplier","color","shouldRenderDescription","opacity","defaultDescriptionOpacity","createSafeStyleSheet","padding","paddingRight","closeButtonSize","fontSize","fontWeight","marginTop"],"sources":["../../../src/surveys/components/QuestionHeader.tsx"],"sourcesContent":["import React from 'react'\nimport { Text, View } from 'react-native'\n\nimport { SurveyQuestionDescriptionContentType } from '@posthog/core'\nimport { createSafeStyleSheet } from '../safeStyleSheet'\nimport {\n closeButtonSize,\n defaultDescriptionOpacity,\n getContrastingTextColor,\n getMaxFontSizeMultiplier,\n shouldRenderDescription,\n SurveyAppearanceTheme,\n} from '../surveys-utils'\n\nexport function QuestionHeader({\n question,\n description,\n descriptionContentType,\n appearance,\n}: {\n question: string\n description?: string | null\n descriptionContentType?: SurveyQuestionDescriptionContentType\n appearance: SurveyAppearanceTheme\n}): JSX.Element {\n // Use textColor override if provided, otherwise auto-calculate from background\n const textColor = appearance.textColor ?? getContrastingTextColor(appearance.backgroundColor)\n\n return (\n <View style={styles.container}>\n <Text\n maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'question')}\n style={[styles.question, { color: textColor }]}\n >\n {question}\n </Text>\n {shouldRenderDescription(description, descriptionContentType) && (\n <Text\n maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'description')}\n style={[styles.description, { color: textColor, opacity: defaultDescriptionOpacity }]}\n >\n {description}\n </Text>\n )}\n </View>\n )\n}\n\nconst styles = createSafeStyleSheet({\n container: {\n padding: 10,\n paddingRight: closeButtonSize,\n },\n question: {\n fontSize: 18,\n fontWeight: 'bold',\n },\n description: {\n fontSize: 14,\n marginTop: 5,\n },\n})\n"],"mappings":"+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B,CAAE,CAAE,CAAAR,QAAA,CAErFZ,WAAW,CACR,CACP,EACG,CAAC,CAEX,CAEA,GAAM,CAAAU,MAAM,CAAG,GAAAW,oCAAoB,EAAC,CAClCV,SAAS,CAAE,CACTW,OAAO,CAAE,EAAE,CACXC,YAAY,CAAEC,6B,CACf,CACDzB,QAAQ,CAAE,CACR0B,QAAQ,CAAE,EAAE,CACZC,UAAU,CAAE,M,CACb,CACD1B,WAAW,CAAE,CACXyB,QAAQ,CAAE,EAAE,CACZE,SAAS,CAAE,C,EAEd,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"QuestionHeader.js","names":["_react","_interopRequireDefault","require","_reactNative","_safeStyleSheet","_surveysUtils","_jsxRuntime","_jsxFileName","QuestionHeader","_ref","question","description","descriptionContentType","appearance","textColor","_a","getContrastingTextColor","backgroundColor","jsxs","View","style","styles","container","children","jsx","Text","maxFontSizeMultiplier","getMaxFontSizeMultiplier","color","shouldRenderDescription","opacity","defaultDescriptionOpacity","createSafeStyleSheet","padding","paddingRight","closeButtonSize","fontSize","fontWeight","marginTop"],"sources":["../../../src/surveys/components/QuestionHeader.tsx"],"sourcesContent":["import React from 'react'\nimport { Text, View } from 'react-native'\n\nimport { SurveyQuestionDescriptionContentType } from '@posthog/core'\nimport { createSafeStyleSheet } from '../safeStyleSheet'\nimport {\n closeButtonSize,\n defaultDescriptionOpacity,\n getContrastingTextColor,\n getMaxFontSizeMultiplier,\n shouldRenderDescription,\n SurveyAppearanceTheme,\n} from '../surveys-utils'\n\nexport function QuestionHeader({\n question,\n description,\n descriptionContentType,\n appearance,\n}: {\n question: string\n description?: string | null\n descriptionContentType?: SurveyQuestionDescriptionContentType\n appearance: SurveyAppearanceTheme\n}): JSX.Element {\n // Use textColor override if provided, otherwise auto-calculate from background\n const textColor = appearance.textColor ?? getContrastingTextColor(appearance.backgroundColor)\n\n return (\n <View style={styles.container}>\n <Text\n maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'question')}\n style={[styles.question, { color: textColor }]}\n >\n {question}\n </Text>\n {shouldRenderDescription(description, descriptionContentType) && (\n <Text\n maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'description')}\n style={[styles.description, { color: textColor, opacity: defaultDescriptionOpacity }]}\n >\n {description}\n </Text>\n )}\n </View>\n )\n}\n\nconst styles = createSafeStyleSheet({\n container: {\n padding: 10,\n paddingRight: closeButtonSize,\n },\n question: {\n fontSize: 18,\n fontWeight: 'bold',\n },\n description: {\n fontSize: 14,\n marginTop: 5,\n },\n})\n"],"mappings":"+LAAA,IAAAA,MAAA,CAAAC,sBAAA,CAAAC,OAAA,WACA,IAAAC,YAAA,CAAAD,OAAA,iBAGA,IAAAE,eAAA,CAAAF,OAAA,sBACA,IAAAG,aAAA,CAAAH,OAAA,qBAOyB,IAAAI,WAAA,CAAAJ,OAAA,0BAAAK,YAAA,2GAEnB,QAAU,CAAAC,cAAcA,CAAAC,IAAA,CAU7B,IATC,CAAAC,QAAQ,CAAAD,IAAA,CAARC,QAAQ,CACRC,WAAW,CAAAF,IAAA,CAAXE,WAAW,CACXC,sBAAsB,CAAAH,IAAA,CAAtBG,sBAAsB,CACtBC,UAAU,CAAAJ,IAAA,CAAVI,UAAU,C,OAQV,GAAM,CAAAC,SAAS,EAAAC,EAAA,CAAGF,UAAU,CAACC,SAAS,UAAAC,EAAA,UAAAA,EAAA,CAAI,GAAAC,qCAAuB,EAACH,UAAU,CAACI,eAAe,CAAC,CAE7F,MACE,GAAAX,WAAA,CAAAY,IAAA,EAACf,YAAA,CAAAgB,IAAI,EAACC,KAAK,CAAEC,MAAM,CAACC,SAAU,CAAAC,QAAA,EAC5B,GAAAjB,WAAA,CAAAkB,GAAA,EAACrB,YAAA,CAAAsB,IAAI,EACHC,qBAAqB,CAAE,GAAAC,sCAAwB,EAACd,UAAU,CAAE,UAAU,CAAE,CACxEO,KAAK,CAAE,CAACC,MAAM,CAACX,QAAQ,CAAE,CAAEkB,KAAK,CAAEd,SAAS,CAAE,CAAE,CAAAS,QAAA,CAE9Cb,QAAQ,CACL,CACN,CAAC,GAAAmB,qCAAuB,EAAClB,WAAW,CAAEC,sBAAsB,CAAC,EAC3D,GAAAN,WAAA,CAAAkB,GAAA,EAACrB,YAAA,CAAAsB,IAAI,EACHC,qBAAqB,CAAE,GAAAC,sCAAwB,EAACd,UAAU,CAAE,aAAa,CAAE,CAC3EO,KAAK,CAAE,CAACC,MAAM,CAACV,WAAW,CAAE,CAAEiB,KAAK,CAAEd,SAAS,CAAEgB,OAAO,CAAEC,uCAAyB,CAAE,CAAE,CAAAR,QAAA,CAErFZ,WAAW,CACR,CACP,EACG,CAAC,CAEX,CAEA,GAAM,CAAAU,MAAM,CAAG,GAAAW,oCAAoB,EAAC,CAClCV,SAAS,CAAE,CACTW,OAAO,CAAE,EAAE,CACXC,YAAY,CAAEC,6B,CACf,CACDzB,QAAQ,CAAE,CACR0B,QAAQ,CAAE,EAAE,CACZC,UAAU,CAAE,M,CACb,CACD1B,WAAW,CAAE,CACXyB,QAAQ,CAAE,EAAE,CACZE,SAAS,CAAE,C,EAEd,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.LinkQuestion=LinkQuestion;exports.MultipleChoiceQuestion=MultipleChoiceQuestion;exports.OpenTextQuestion=OpenTextQuestion;exports.RatingButton=RatingButton;exports.RatingQuestion=RatingQuestion;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _safeStyleSheet=require("../safeStyleSheet");var _icons=require("../icons");var _surveysUtils=require("../surveys-utils");var _surveyShuffling=require("../survey-shuffling");var _core=require("@posthog/core");var _surveys=require("@posthog/core/surveys");var _BottomSection=require("./BottomSection");var _QuestionHeader=require("./QuestionHeader");var _jsxRuntime=require("react/jsx-runtime");var _jsxFileName="/home/runner/work/posthog-js/posthog-js/packages/react-native/dist/surveys/components/QuestionTypes.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);}function QuestionLayout(_ref){var children=_ref.children,footer=_ref.footer;var _useState=(0,_react.useState)(0),_useState2=(0,_slicedToArray2["default"])(_useState,2),viewportHeight=_useState2[0],setViewportHeight=_useState2[1];var _useState3=(0,_react.useState)(0),_useState4=(0,_slicedToArray2["default"])(_useState3,2),contentHeight=_useState4[0],setContentHeight=_useState4[1];var isOverflowing=contentHeight>viewportHeight+1;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:questionLayoutStyles.container,children:[(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{style:questionLayoutStyles.scroll,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,scrollEnabled:isOverflowing,bounces:isOverflowing,onLayout:function onLayout(e){return setViewportHeight(e.nativeEvent.layout.height);},onContentSizeChange:function onContentSizeChange(_width,height){return setContentHeight(height);},children:children}),footer]});}var questionLayoutStyles=(0,_safeStyleSheet.createSafeStyleSheet)({container:{flexShrink:1},scroll:{flexShrink:1}});function OpenTextQuestion(_ref2){var question=_ref2.question,appearance=_ref2.appearance,onSubmit=_ref2.onSubmit;var _a,_b,_c,_d;var _useState5=(0,_react.useState)(''),_useState6=(0,_slicedToArray2["default"])(_useState5,2),text=_useState6[0],setText=_useState6[1];var validationError=(0,_react.useMemo)(function(){return(0,_surveys.getValidationError)(text,question.validation,question.optional);},[text,question.validation,question.optional]);var minLength=(0,_surveys.getLengthFromRules)(question.validation,_core.SurveyValidationType.MinLength);var maxLength=(0,_surveys.getLengthFromRules)(question.validation,_core.SurveyValidationType.MaxLength);var requirementsHint=(0,_react.useMemo)(function(){return(0,_surveys.getRequirementsHint)(minLength,maxLength);},[minLength,maxLength]);var handleSubmit=function handleSubmit(){if(validationError){return;}onSubmit(text.trim());};return(0,_jsxRuntime.jsxs)(QuestionLayout,{footer:(0,_jsxRuntime.jsx)(_BottomSection.BottomSection,{text:(_a=question.buttonText)!==null&&_a!==void 0?_a:appearance.submitButtonText,submitDisabled:!!validationError,appearance:appearance,onSubmit:handleSubmit}),children:[(0,_jsxRuntime.jsx)(_QuestionHeader.QuestionHeader,{question:question.question,description:question.description,descriptionContentType:question.descriptionContentType,appearance:appearance}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.textInputContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.TextInput,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'input'),style:[styles.textInput,{backgroundColor:appearance.inputBackground,color:(_b=appearance.inputTextColor)!==null&&_b!==void 0?_b:(0,_surveysUtils.getContrastingTextColor)(appearance.inputBackground),borderColor:appearance.borderColor}],multiline:true,numberOfLines:4,placeholder:appearance.placeholder,placeholderTextColor:(0,_surveysUtils.getContrastingTextColor)((_c=appearance.inputTextColor)!==null&&_c!==void 0?_c:(0,_surveysUtils.getContrastingTextColor)(appearance.inputBackground))==='white'?'rgba(0, 0, 0, 0.5)':'rgba(255, 255, 255, 0.5)',onChangeText:setText,value:text}),requirementsHint&&(0,_jsxRuntime.jsx)(_reactNative.Text,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'validationHint'),style:[styles.validationHint,{color:(_d=appearance.textColor)!==null&&_d!==void 0?_d:(0,_surveysUtils.getContrastingTextColor)(appearance.backgroundColor)}],children:requirementsHint})]})]});}function LinkQuestion(_ref3){var question=_ref3.question,appearance=_ref3.appearance,_onSubmit=_ref3.onSubmit;var _a,_b;question=question;return(0,_jsxRuntime.jsx)(QuestionLayout,{footer:(0,_jsxRuntime.jsx)(_BottomSection.BottomSection,{text:(_b=(_a=question.buttonText)!==null&&_a!==void 0?_a:appearance.submitButtonText)!==null&&_b!==void 0?_b:'Submit',submitDisabled:false,link:question.link,appearance:appearance,onSubmit:function onSubmit(){return _onSubmit('link clicked');}}),children:(0,_jsxRuntime.jsx)(_QuestionHeader.QuestionHeader,{question:question.question,description:question.description,descriptionContentType:question.descriptionContentType,appearance:appearance})});}function RatingQuestion(_ref4){var _this=this;var question=_ref4.question,appearance=_ref4.appearance,_onSubmit2=_ref4.onSubmit;var _a,_b,_c,_d;var _useState7=(0,_react.useState)(null),_useState8=(0,_slicedToArray2["default"])(_useState7,2),rating=_useState8[0],setRating=_useState8[1];question=question;return(0,_jsxRuntime.jsxs)(QuestionLayout,{footer:(0,_jsxRuntime.jsx)(_BottomSection.BottomSection,{text:(_a=question.buttonText)!==null&&_a!==void 0?_a:appearance.submitButtonText,submitDisabled:rating===null&&!question.optional,appearance:appearance,onSubmit:function onSubmit(){return _onSubmit2(rating);},skipSubmitButton:question.skipSubmitButton}),children:[(0,_jsxRuntime.jsx)(_QuestionHeader.QuestionHeader,{question:question.question,description:question.description,descriptionContentType:question.descriptionContentType,appearance:appearance}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.ratingSection,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.ratingOptions,children:[question.display===_core.SurveyRatingDisplay.Emoji&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.ratingOptionsEmoji,children:(_b=emojiScaleLists[question.scale])===null||_b===void 0?void 0:_b.map(function(Emoji,idx){var active=idx+1===rating;return(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.ratingsEmoji,onPress:function onPress(){var response=idx+1;setRating(response);if(question.skipSubmitButton){_onSubmit2(response);}},children:(0,_jsxRuntime.jsx)(Emoji,{fill:active?appearance.ratingButtonActiveColor:appearance.ratingButtonColor})},idx);})}),question.display===_core.SurveyRatingDisplay.Number&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.ratingOptionsNumber,{borderColor:appearance.borderColor}],children:getScaleNumbers(question.scale).map(function(number,idx){var active=rating===number;return(0,_jsxRuntime.jsx)(RatingButton,{index:idx,active:active,appearance:appearance,num:number,setActiveNumber:function setActiveNumber(response){setRating(response);if(question.skipSubmitButton){_onSubmit2(response);}}},idx);})})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.ratingText,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'ratingLabel'),style:{color:(_c=appearance.textColor)!==null&&_c!==void 0?_c:(0,_surveysUtils.getContrastingTextColor)(appearance.backgroundColor),opacity:_surveysUtils.defaultRatingLabelOpacity},children:question.lowerBoundLabel}),(0,_jsxRuntime.jsx)(_reactNative.Text,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'ratingLabel'),style:{color:(_d=appearance.textColor)!==null&&_d!==void 0?_d:(0,_surveysUtils.getContrastingTextColor)(appearance.backgroundColor),opacity:_surveysUtils.defaultRatingLabelOpacity},children:question.upperBoundLabel})]})]})]});}function RatingButton(_ref5){var index=_ref5.index,num=_ref5.num,active=_ref5.active,appearance=_ref5.appearance,setActiveNumber=_ref5.setActiveNumber;var _a;var backgroundColor=active?appearance.ratingButtonActiveColor:appearance.ratingButtonColor;var textColor=active?(0,_surveysUtils.getContrastingTextColor)(backgroundColor):(_a=appearance.inputTextColor)!==null&&_a!==void 0?_a:(0,_surveysUtils.getContrastingTextColor)(backgroundColor);return(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.ratingsNumber,index===0&&{borderLeftWidth:0},{backgroundColor:backgroundColor,borderColor:appearance.borderColor}],onPress:function onPress(){return setActiveNumber(num);},children:(0,_jsxRuntime.jsx)(_reactNative.Text,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'ratingNumber'),style:{color:textColor},children:num})});}function MultipleChoiceQuestion(_ref6){var _this2=this;var question=_ref6.question,appearance=_ref6.appearance,_onSubmit3=_ref6.onSubmit;var _a;question=question;var isSingleChoice=question.type===_core.SurveyQuestionType.SingleChoice;var allowMultiple=question.type===_core.SurveyQuestionType.MultipleChoice;var openChoiceIndex=question.hasOpenChoice?question.choices.length-1:-1;var choices=(0,_react.useMemo)(function(){return(0,_surveyShuffling.getDisplayOrderChoices)(question);},[question]);var _useState9=(0,_react.useState)([]),_useState0=(0,_slicedToArray2["default"])(_useState9,2),selectedChoiceIndices=_useState0[0],setSelectedChoiceIndices=_useState0[1];var _useState1=(0,_react.useState)(''),_useState10=(0,_slicedToArray2["default"])(_useState1,2),openEndedInput=_useState10[0],setOpenEndedInput=_useState10[1];var shouldSkipSubmit=question.skipSubmitButton&&isSingleChoice&&!question.hasOpenChoice;return(0,_jsxRuntime.jsxs)(QuestionLayout,{footer:(0,_jsxRuntime.jsx)(_BottomSection.BottomSection,{text:(_a=question.buttonText)!==null&&_a!==void 0?_a:appearance.submitButtonText,submitDisabled:!question.optional&&(selectedChoiceIndices.length===0||selectedChoiceIndices.includes(openChoiceIndex)&&openEndedInput.length===0),appearance:appearance,onSubmit:function onSubmit(){var result=selectedChoiceIndices.map(function(index){return index===openChoiceIndex?openEndedInput:question.choices[index];});_onSubmit3(allowMultiple?result:result[0]);},skipSubmitButton:shouldSkipSubmit}),children:[(0,_jsxRuntime.jsx)(_QuestionHeader.QuestionHeader,{question:question.question,description:question.description,descriptionContentType:question.descriptionContentType,appearance:appearance}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.multipleChoiceOptions,children:choices.map(function(choice,choiceIndex){var _a;var isOpenChoice=choiceIndex===openChoiceIndex;var isSelected=selectedChoiceIndices.includes(choiceIndex);var choiceTextColor=(_a=appearance.inputTextColor)!==null&&_a!==void 0?_a:(0,_surveysUtils.getContrastingTextColor)(appearance.inputBackground);return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{style:[styles.choiceOption,{backgroundColor:appearance.inputBackground},isSelected?{borderColor:(0,_surveysUtils.getContrastingTextColor)(appearance.backgroundColor)}:{}],onPress:function onPress(){if(allowMultiple){setSelectedChoiceIndices(isSelected?selectedChoiceIndices.filter(function(index){return index!==choiceIndex;}):[].concat((0,_toConsumableArray2["default"])(selectedChoiceIndices),[choiceIndex]));}else{setSelectedChoiceIndices([choiceIndex]);if(shouldSkipSubmit&&!isOpenChoice){_onSubmit3(choice);}}},children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.choiceText,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'choice'),style:{flexGrow:1,color:choiceTextColor},children:[choice,isOpenChoice?':':'']}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.rightCheckArea,children:isSelected&&(0,_jsxRuntime.jsx)(_icons.CheckSVG,{})})]}),isOpenChoice&&(0,_jsxRuntime.jsx)(_reactNative.TextInput,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'input'),style:styles.openEndedInput,onChangeText:function onChangeText(userValue){setOpenEndedInput(userValue);if(!isSelected){setSelectedChoiceIndices(allowMultiple?[].concat((0,_toConsumableArray2["default"])(selectedChoiceIndices),[choiceIndex]):[choiceIndex]);}}})]},choiceIndex);})})]});}var emojiScaleLists={2:[_icons.ThumbsUpEmoji,_icons.ThumbsDownEmoji],3:[_icons.DissatisfiedEmoji,_icons.NeutralEmoji,_icons.SatisfiedEmoji],5:[_icons.VeryDissatisfiedEmoji,_icons.DissatisfiedEmoji,_icons.NeutralEmoji,_icons.SatisfiedEmoji,_icons.VerySatisfiedEmoji]};var fiveScaleNumbers=[1,2,3,4,5];var sevenScaleNumbers=[1,2,3,4,5,6,7];var tenScaleNumbers=[0,1,2,3,4,5,6,7,8,9,10];function getScaleNumbers(scale){switch(scale){case 5:return fiveScaleNumbers;case 7:return sevenScaleNumbers;case 10:return tenScaleNumbers;default:return fiveScaleNumbers;}}var styles=(0,_safeStyleSheet.createSafeStyleSheet)({textInputContainer:{padding:10},textInput:{borderColor:'#ccc',borderWidth:1,padding:10,marginVertical:10,fontSize:16,height:80,textAlignVertical:'top'},ratingSection:{marginVertical:10},ratingOptions:{flexDirection:'row',justifyContent:'space-between'},ratingOptionsEmoji:{flexDirection:'row',justifyContent:'space-around',flexWrap:'nowrap',flex:1},ratingsEmoji:{padding:4},ratingOptionsNumber:{margin:10,flexGrow:1,flexDirection:'row',justifyContent:'space-between',borderRadius:5,borderWidth:1,overflow:'hidden'},ratingsNumber:{flex:1,paddingVertical:10,alignItems:'center',borderLeftWidth:1},ratingText:{flexDirection:'row',justifyContent:'space-between',padding:10},multipleChoiceOptions:{padding:10},choiceOption:{flexDirection:'column',marginVertical:5,borderWidth:1,borderColor:'grey',borderRadius:5,padding:10},choiceText:{flexDirection:'row'},rightCheckArea:{flexGrow:0},openEndedInput:{padding:5},validationHint:{fontSize:12,opacity:0.7,marginTop:4}});
1
+ "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _typeof=require("@babel/runtime/helpers/typeof");Object.defineProperty(exports,"__esModule",{value:true});exports.LinkQuestion=LinkQuestion;exports.MultipleChoiceQuestion=MultipleChoiceQuestion;exports.OpenTextQuestion=OpenTextQuestion;exports.RatingButton=RatingButton;exports.RatingQuestion=RatingQuestion;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _safeStyleSheet=require("../safeStyleSheet");var _icons=require("../icons");var _surveysUtils=require("../surveys-utils");var _surveyShuffling=require("../survey-shuffling");var _core=require("@posthog/core");var _surveys=require("@posthog/core/surveys");var _BottomSection=require("./BottomSection");var _QuestionHeader=require("./QuestionHeader");var _jsxRuntime=require("react/jsx-runtime");var _jsxFileName="/home/runner/work/posthog-js/posthog-js/packages/react-native/dist/surveys/components/QuestionTypes.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);}function QuestionLayout(_ref){var children=_ref.children,footer=_ref.footer;var _useState=(0,_react.useState)(0),_useState2=(0,_slicedToArray2["default"])(_useState,2),viewportHeight=_useState2[0],setViewportHeight=_useState2[1];var _useState3=(0,_react.useState)(0),_useState4=(0,_slicedToArray2["default"])(_useState3,2),contentHeight=_useState4[0],setContentHeight=_useState4[1];var isOverflowing=contentHeight>viewportHeight+1;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:questionLayoutStyles.container,children:[(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{style:questionLayoutStyles.scroll,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,scrollEnabled:isOverflowing,bounces:isOverflowing,onLayout:function onLayout(e){return setViewportHeight(e.nativeEvent.layout.height);},onContentSizeChange:function onContentSizeChange(_width,height){return setContentHeight(height);},children:children}),footer]});}var questionLayoutStyles=(0,_safeStyleSheet.createSafeStyleSheet)({container:{flexShrink:1},scroll:{flexShrink:1}});function OpenTextQuestion(_ref2){var question=_ref2.question,appearance=_ref2.appearance,onSubmit=_ref2.onSubmit;var _a,_b,_c,_d;var _useState5=(0,_react.useState)(''),_useState6=(0,_slicedToArray2["default"])(_useState5,2),text=_useState6[0],setText=_useState6[1];var validationError=(0,_react.useMemo)(function(){return(0,_surveys.getValidationError)(text,question.validation,question.optional);},[text,question.validation,question.optional]);var minLength=(0,_surveys.getLengthFromRules)(question.validation,_core.SurveyValidationType.MinLength);var maxLength=(0,_surveys.getLengthFromRules)(question.validation,_core.SurveyValidationType.MaxLength);var requirementsHint=(0,_react.useMemo)(function(){return(0,_surveys.getRequirementsHint)(minLength,maxLength);},[minLength,maxLength]);var handleSubmit=function handleSubmit(){if(validationError){return;}onSubmit(text.trim());};return(0,_jsxRuntime.jsxs)(QuestionLayout,{footer:(0,_jsxRuntime.jsx)(_BottomSection.BottomSection,{text:(_a=question.buttonText)!==null&&_a!==void 0?_a:appearance.submitButtonText,submitDisabled:!!validationError,appearance:appearance,onSubmit:handleSubmit}),children:[(0,_jsxRuntime.jsx)(_QuestionHeader.QuestionHeader,{question:question.question,description:question.description,descriptionContentType:question.descriptionContentType,appearance:appearance}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.textInputContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.TextInput,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'input'),style:[styles.textInput,{backgroundColor:appearance.inputBackground,color:(_b=appearance.inputTextColor)!==null&&_b!==void 0?_b:(0,_surveysUtils.getContrastingTextColor)(appearance.inputBackground),borderColor:appearance.borderColor}],multiline:true,numberOfLines:4,placeholder:appearance.placeholder,placeholderTextColor:(0,_surveysUtils.getContrastingTextColor)((_c=appearance.inputTextColor)!==null&&_c!==void 0?_c:(0,_surveysUtils.getContrastingTextColor)(appearance.inputBackground))==='white'?'rgba(0, 0, 0, 0.5)':'rgba(255, 255, 255, 0.5)',onChangeText:setText,value:text}),requirementsHint&&(0,_jsxRuntime.jsx)(_reactNative.Text,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'validationHint'),style:[styles.validationHint,{color:(_d=appearance.textColor)!==null&&_d!==void 0?_d:(0,_surveysUtils.getContrastingTextColor)(appearance.backgroundColor)}],children:requirementsHint})]})]});}function LinkQuestion(_ref3){var question=_ref3.question,appearance=_ref3.appearance,_onSubmit=_ref3.onSubmit;var _a,_b;question=question;return(0,_jsxRuntime.jsx)(QuestionLayout,{footer:(0,_jsxRuntime.jsx)(_BottomSection.BottomSection,{text:(_b=(_a=question.buttonText)!==null&&_a!==void 0?_a:appearance.submitButtonText)!==null&&_b!==void 0?_b:'Submit',submitDisabled:false,link:question.link,appearance:appearance,onSubmit:function onSubmit(){return _onSubmit('link clicked');}}),children:(0,_jsxRuntime.jsx)(_QuestionHeader.QuestionHeader,{question:question.question,description:question.description,descriptionContentType:question.descriptionContentType,appearance:appearance})});}function RatingQuestion(_ref4){var _this=this;var question=_ref4.question,appearance=_ref4.appearance,_onSubmit2=_ref4.onSubmit;var _a;var _b,_c,_d;var _useState7=(0,_react.useState)(null),_useState8=(0,_slicedToArray2["default"])(_useState7,2),rating=_useState8[0],setRating=_useState8[1];question=question;return(0,_jsxRuntime.jsxs)(QuestionLayout,{footer:(0,_jsxRuntime.jsx)(_BottomSection.BottomSection,{text:(_b=question.buttonText)!==null&&_b!==void 0?_b:appearance.submitButtonText,submitDisabled:rating===null&&!question.optional,appearance:appearance,onSubmit:function onSubmit(){return _onSubmit2(rating);},skipSubmitButton:question.skipSubmitButton}),children:[(0,_jsxRuntime.jsx)(_QuestionHeader.QuestionHeader,{question:question.question,description:question.description,descriptionContentType:question.descriptionContentType,appearance:appearance}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.ratingSection,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.ratingOptions,children:[question.display===_core.SurveyRatingDisplay.Emoji&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.ratingOptionsEmoji,children:(_a=emojiScaleLists[question.scale])===null||_a===void 0?void 0:_a.map(function(Emoji,idx){var active=idx+1===rating;return(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.ratingsEmoji,onPress:function onPress(){var response=idx+1;setRating(response);if(question.skipSubmitButton){_onSubmit2(response);}},children:(0,_jsxRuntime.jsx)(Emoji,{fill:active?appearance.ratingButtonActiveColor:appearance.ratingButtonColor})},idx);})}),question.display===_core.SurveyRatingDisplay.Number&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.ratingOptionsNumber,{borderColor:appearance.borderColor}],children:getScaleNumbers(question.scale).map(function(number,idx){var active=rating===number;return(0,_jsxRuntime.jsx)(RatingButton,{index:idx,active:active,appearance:appearance,num:number,setActiveNumber:function setActiveNumber(response){setRating(response);if(question.skipSubmitButton){_onSubmit2(response);}}},idx);})})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.ratingText,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'ratingLabel'),style:{color:(_c=appearance.textColor)!==null&&_c!==void 0?_c:(0,_surveysUtils.getContrastingTextColor)(appearance.backgroundColor),opacity:_surveysUtils.defaultRatingLabelOpacity},children:question.lowerBoundLabel}),(0,_jsxRuntime.jsx)(_reactNative.Text,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'ratingLabel'),style:{color:(_d=appearance.textColor)!==null&&_d!==void 0?_d:(0,_surveysUtils.getContrastingTextColor)(appearance.backgroundColor),opacity:_surveysUtils.defaultRatingLabelOpacity},children:question.upperBoundLabel})]})]})]});}function RatingButton(_ref5){var index=_ref5.index,num=_ref5.num,active=_ref5.active,appearance=_ref5.appearance,setActiveNumber=_ref5.setActiveNumber;var _a;var backgroundColor=active?appearance.ratingButtonActiveColor:appearance.ratingButtonColor;var textColor=active?(0,_surveysUtils.getContrastingTextColor)(backgroundColor):(_a=appearance.inputTextColor)!==null&&_a!==void 0?_a:(0,_surveysUtils.getContrastingTextColor)(backgroundColor);return(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.ratingsNumber,index===0&&{borderLeftWidth:0},{backgroundColor:backgroundColor,borderColor:appearance.borderColor}],onPress:function onPress(){return setActiveNumber(num);},children:(0,_jsxRuntime.jsx)(_reactNative.Text,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'ratingNumber'),style:{color:textColor},children:num})});}function MultipleChoiceQuestion(_ref6){var _this2=this;var question=_ref6.question,appearance=_ref6.appearance,_onSubmit3=_ref6.onSubmit;var _a;question=question;var isSingleChoice=question.type===_core.SurveyQuestionType.SingleChoice;var allowMultiple=question.type===_core.SurveyQuestionType.MultipleChoice;var openChoiceIndex=question.hasOpenChoice?question.choices.length-1:-1;var choices=(0,_react.useMemo)(function(){return(0,_surveyShuffling.getDisplayOrderChoices)(question);},[question]);var _useState9=(0,_react.useState)([]),_useState0=(0,_slicedToArray2["default"])(_useState9,2),selectedChoiceIndices=_useState0[0],setSelectedChoiceIndices=_useState0[1];var _useState1=(0,_react.useState)(''),_useState10=(0,_slicedToArray2["default"])(_useState1,2),openEndedInput=_useState10[0],setOpenEndedInput=_useState10[1];var shouldSkipSubmit=question.skipSubmitButton&&isSingleChoice&&!question.hasOpenChoice;return(0,_jsxRuntime.jsxs)(QuestionLayout,{footer:(0,_jsxRuntime.jsx)(_BottomSection.BottomSection,{text:(_a=question.buttonText)!==null&&_a!==void 0?_a:appearance.submitButtonText,submitDisabled:!question.optional&&(selectedChoiceIndices.length===0||selectedChoiceIndices.includes(openChoiceIndex)&&openEndedInput.length===0),appearance:appearance,onSubmit:function onSubmit(){var result=selectedChoiceIndices.map(function(index){return index===openChoiceIndex?openEndedInput:question.choices[index];});_onSubmit3(allowMultiple?result:result[0]);},skipSubmitButton:shouldSkipSubmit}),children:[(0,_jsxRuntime.jsx)(_QuestionHeader.QuestionHeader,{question:question.question,description:question.description,descriptionContentType:question.descriptionContentType,appearance:appearance}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.multipleChoiceOptions,children:choices.map(function(choice,choiceIndex){var _a;var isOpenChoice=choiceIndex===openChoiceIndex;var isSelected=selectedChoiceIndices.includes(choiceIndex);var choiceTextColor=(_a=appearance.inputTextColor)!==null&&_a!==void 0?_a:(0,_surveysUtils.getContrastingTextColor)(appearance.inputBackground);return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{style:[styles.choiceOption,{backgroundColor:appearance.inputBackground},isSelected?{borderColor:(0,_surveysUtils.getContrastingTextColor)(appearance.backgroundColor)}:{}],onPress:function onPress(){if(allowMultiple){setSelectedChoiceIndices(isSelected?selectedChoiceIndices.filter(function(index){return index!==choiceIndex;}):[].concat((0,_toConsumableArray2["default"])(selectedChoiceIndices),[choiceIndex]));}else{setSelectedChoiceIndices([choiceIndex]);if(shouldSkipSubmit&&!isOpenChoice){_onSubmit3(choice);}}},children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.choiceText,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'choice'),style:{flexGrow:1,color:choiceTextColor},children:[choice,isOpenChoice?':':'']}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.rightCheckArea,children:isSelected&&(0,_jsxRuntime.jsx)(_icons.CheckSVG,{})})]}),isOpenChoice&&(0,_jsxRuntime.jsx)(_reactNative.TextInput,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'input'),style:styles.openEndedInput,onChangeText:function onChangeText(userValue){setOpenEndedInput(userValue);if(!isSelected){setSelectedChoiceIndices(allowMultiple?[].concat((0,_toConsumableArray2["default"])(selectedChoiceIndices),[choiceIndex]):[choiceIndex]);}}})]},choiceIndex);})})]});}var emojiScaleLists={2:[_icons.ThumbsUpEmoji,_icons.ThumbsDownEmoji],3:[_icons.DissatisfiedEmoji,_icons.NeutralEmoji,_icons.SatisfiedEmoji],5:[_icons.VeryDissatisfiedEmoji,_icons.DissatisfiedEmoji,_icons.NeutralEmoji,_icons.SatisfiedEmoji,_icons.VerySatisfiedEmoji]};var fiveScaleNumbers=[1,2,3,4,5];var sevenScaleNumbers=[1,2,3,4,5,6,7];var tenScaleNumbers=[0,1,2,3,4,5,6,7,8,9,10];function getScaleNumbers(scale){switch(scale){case 5:return fiveScaleNumbers;case 7:return sevenScaleNumbers;case 10:return tenScaleNumbers;default:return fiveScaleNumbers;}}var styles=(0,_safeStyleSheet.createSafeStyleSheet)({textInputContainer:{padding:10},textInput:{borderColor:'#ccc',borderWidth:1,padding:10,marginVertical:10,fontSize:16,height:80,textAlignVertical:'top'},ratingSection:{marginVertical:10},ratingOptions:{flexDirection:'row',justifyContent:'space-between'},ratingOptionsEmoji:{flexDirection:'row',justifyContent:'space-around',flexWrap:'nowrap',flex:1},ratingsEmoji:{padding:4},ratingOptionsNumber:{margin:10,flexGrow:1,flexDirection:'row',justifyContent:'space-between',borderRadius:5,borderWidth:1,overflow:'hidden'},ratingsNumber:{flex:1,paddingVertical:10,alignItems:'center',borderLeftWidth:1},ratingText:{flexDirection:'row',justifyContent:'space-between',padding:10},multipleChoiceOptions:{padding:10},choiceOption:{flexDirection:'column',marginVertical:5,borderWidth:1,borderColor:'grey',borderRadius:5,padding:10},choiceText:{flexDirection:'row'},rightCheckArea:{flexGrow:0},openEndedInput:{padding:5},validationHint:{fontSize:12,opacity:0.7,marginTop:4}});
2
2
  //# sourceMappingURL=QuestionTypes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"QuestionTypes.js","names":["_react","_interopRequireWildcard","require","_reactNative","_safeStyleSheet","_icons","_surveysUtils","_surveyShuffling","_core","_surveys","_BottomSection","_QuestionHeader","_jsxRuntime","_jsxFileName","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t2","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","QuestionLayout","_ref","children","footer","_useState","useState","_useState2","_slicedToArray2","viewportHeight","setViewportHeight","_useState3","_useState4","contentHeight","setContentHeight","isOverflowing","jsxs","View","style","questionLayoutStyles","container","jsx","ScrollView","scroll","keyboardShouldPersistTaps","showsVerticalScrollIndicator","scrollEnabled","bounces","onLayout","nativeEvent","layout","height","onContentSizeChange","_width","createSafeStyleSheet","flexShrink","OpenTextQuestion","_ref2","question","appearance","onSubmit","_useState5","_useState6","text","setText","validationError","useMemo","getValidationError","validation","optional","minLength","getLengthFromRules","SurveyValidationType","MinLength","maxLength","MaxLength","requirementsHint","getRequirementsHint","handleSubmit","trim","BottomSection","_a","buttonText","submitButtonText","submitDisabled","QuestionHeader","description","descriptionContentType","styles","textInputContainer","TextInput","maxFontSizeMultiplier","getMaxFontSizeMultiplier","textInput","backgroundColor","inputBackground","color","_b","inputTextColor","getContrastingTextColor","borderColor","multiline","numberOfLines","placeholder","placeholderTextColor","_c","onChangeText","value","Text","validationHint","_d","textColor","LinkQuestion","_ref3","link","RatingQuestion","_ref4","_this","_useState7","_useState8","rating","setRating","skipSubmitButton","ratingSection","ratingOptions","display","SurveyRatingDisplay","Emoji","ratingOptionsEmoji","emojiScaleLists","scale","map","idx","active","TouchableOpacity","ratingsEmoji","onPress","response","fill","ratingButtonActiveColor","ratingButtonColor","Number","ratingOptionsNumber","getScaleNumbers","number","RatingButton","index","num","setActiveNumber","ratingText","opacity","defaultRatingLabelOpacity","lowerBoundLabel","upperBoundLabel","_ref5","ratingsNumber","borderLeftWidth","MultipleChoiceQuestion","_ref6","_this2","isSingleChoice","type","SurveyQuestionType","SingleChoice","allowMultiple","MultipleChoice","openChoiceIndex","hasOpenChoice","choices","length","getDisplayOrderChoices","_useState9","_useState0","selectedChoiceIndices","setSelectedChoiceIndices","_useState1","_useState10","openEndedInput","setOpenEndedInput","shouldSkipSubmit","includes","result","multipleChoiceOptions","choice","choiceIndex","isOpenChoice","isSelected","choiceTextColor","Pressable","choiceOption","filter","concat","_toConsumableArray2","choiceText","flexGrow","rightCheckArea","CheckSVG","userValue","ThumbsUpEmoji","ThumbsDownEmoji","DissatisfiedEmoji","NeutralEmoji","SatisfiedEmoji","VeryDissatisfiedEmoji","VerySatisfiedEmoji","fiveScaleNumbers","sevenScaleNumbers","tenScaleNumbers","padding","borderWidth","marginVertical","fontSize","textAlignVertical","flexDirection","justifyContent","flexWrap","flex","margin","borderRadius","overflow","paddingVertical","alignItems","marginTop"],"sources":["../../../src/surveys/components/QuestionTypes.tsx"],"sourcesContent":["import React, { ReactNode, useMemo, useState } from 'react'\nimport { LayoutChangeEvent, Pressable, ScrollView, Text, TextInput, TouchableOpacity, View } from 'react-native'\n\nimport { createSafeStyleSheet } from '../safeStyleSheet'\nimport {\n CheckSVG,\n DissatisfiedEmoji,\n NeutralEmoji,\n SatisfiedEmoji,\n ThumbsDownEmoji,\n ThumbsUpEmoji,\n VeryDissatisfiedEmoji,\n VerySatisfiedEmoji,\n} from '../icons'\nimport {\n defaultRatingLabelOpacity,\n getContrastingTextColor,\n getMaxFontSizeMultiplier,\n SurveyAppearanceTheme,\n} from '../surveys-utils'\nimport { getDisplayOrderChoices } from '../survey-shuffling'\nimport {\n SurveyQuestion,\n SurveyRatingDisplay,\n SurveyQuestionType,\n LinkSurveyQuestion,\n RatingSurveyQuestion,\n MultipleSurveyQuestion,\n SurveyValidationType,\n} from '@posthog/core'\nimport { getValidationError, getLengthFromRules, getRequirementsHint } from '@posthog/core/surveys'\nimport { BottomSection } from './BottomSection'\nimport { QuestionHeader } from './QuestionHeader'\n\ninterface QuestionCommonProps {\n question: SurveyQuestion\n appearance: SurveyAppearanceTheme\n}\n\n// Wraps question content in a scrollable region with a sticky BottomSection\n// (Submit button) at the bottom. The ScrollView has flexShrink: 1 so it\n// shrinks to fit when the parent modal is capped at its keyboard-aware\n// maxHeight, keeping Submit visible regardless of survey length. Scrolling is\n// enabled only while the content overflows the viewport, so short surveys don't\n// scroll or bounce.\nfunction QuestionLayout({ children, footer }: { children: ReactNode; footer: ReactNode }): JSX.Element {\n const [viewportHeight, setViewportHeight] = useState(0)\n const [contentHeight, setContentHeight] = useState(0)\n // 1px threshold absorbs sub-pixel layout rounding.\n const isOverflowing = contentHeight > viewportHeight + 1\n\n return (\n <View style={questionLayoutStyles.container}>\n <ScrollView\n style={questionLayoutStyles.scroll}\n keyboardShouldPersistTaps=\"handled\"\n showsVerticalScrollIndicator={false}\n scrollEnabled={isOverflowing}\n bounces={isOverflowing}\n onLayout={(e: LayoutChangeEvent) => setViewportHeight(e.nativeEvent.layout.height)}\n onContentSizeChange={(_width, height) => setContentHeight(height)}\n >\n {children}\n </ScrollView>\n {footer}\n </View>\n )\n}\n\nconst questionLayoutStyles = createSafeStyleSheet({\n container: {\n flexShrink: 1,\n },\n scroll: {\n flexShrink: 1,\n },\n})\n\nexport function OpenTextQuestion({\n question,\n appearance,\n onSubmit,\n}: QuestionCommonProps & {\n onSubmit: (text: string) => void\n}): JSX.Element {\n const [text, setText] = useState('')\n\n // Memoize validation error to avoid recalculating on every render\n const validationError = useMemo(\n () => getValidationError(text, question.validation, question.optional),\n [text, question.validation, question.optional]\n )\n\n // Build requirements hint message\n const minLength = getLengthFromRules(question.validation, SurveyValidationType.MinLength)\n const maxLength = getLengthFromRules(question.validation, SurveyValidationType.MaxLength)\n const requirementsHint = useMemo(() => getRequirementsHint(minLength, maxLength), [minLength, maxLength])\n\n const handleSubmit = () => {\n if (validationError) {\n return\n }\n onSubmit(text.trim())\n }\n\n return (\n <QuestionLayout\n footer={\n <BottomSection\n text={question.buttonText ?? appearance.submitButtonText}\n submitDisabled={!!validationError}\n appearance={appearance}\n onSubmit={handleSubmit}\n />\n }\n >\n <QuestionHeader\n question={question.question}\n description={question.description}\n descriptionContentType={question.descriptionContentType}\n appearance={appearance}\n />\n <View style={styles.textInputContainer}>\n <TextInput\n maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'input')}\n style={[\n styles.textInput,\n {\n backgroundColor: appearance.inputBackground,\n color: appearance.inputTextColor ?? getContrastingTextColor(appearance.inputBackground),\n borderColor: appearance.borderColor,\n },\n ]}\n multiline\n numberOfLines={4}\n placeholder={appearance.placeholder}\n placeholderTextColor={\n getContrastingTextColor(\n appearance.inputTextColor ?? getContrastingTextColor(appearance.inputBackground)\n ) === 'white'\n ? 'rgba(0, 0, 0, 0.5)'\n : 'rgba(255, 255, 255, 0.5)'\n }\n onChangeText={setText}\n value={text}\n />\n {requirementsHint && (\n <Text\n maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'validationHint')}\n style={[\n styles.validationHint,\n { color: appearance.textColor ?? getContrastingTextColor(appearance.backgroundColor) },\n ]}\n >\n {requirementsHint}\n </Text>\n )}\n </View>\n </QuestionLayout>\n )\n}\n\nexport function LinkQuestion({\n question,\n appearance,\n onSubmit,\n}: QuestionCommonProps & {\n onSubmit: (clicked: string) => void\n}): JSX.Element {\n question = question as LinkSurveyQuestion\n\n return (\n <QuestionLayout\n footer={\n <BottomSection\n text={question.buttonText ?? appearance.submitButtonText ?? 'Submit'}\n submitDisabled={false}\n link={question.link}\n appearance={appearance}\n onSubmit={() => onSubmit('link clicked')}\n />\n }\n >\n <QuestionHeader\n question={question.question}\n description={question.description}\n descriptionContentType={question.descriptionContentType}\n appearance={appearance}\n />\n </QuestionLayout>\n )\n}\n\nexport function RatingQuestion({\n question,\n appearance,\n onSubmit,\n}: QuestionCommonProps & {\n onSubmit: (rating: number | null) => void\n}): JSX.Element {\n //const starting = question.scale === 10 ? 0 : 1;\n const [rating, setRating] = useState<number | null>(null)\n question = question as RatingSurveyQuestion\n\n return (\n <QuestionLayout\n footer={\n <BottomSection\n text={question.buttonText ?? appearance.submitButtonText}\n submitDisabled={rating === null && !question.optional}\n appearance={appearance}\n onSubmit={() => onSubmit(rating)}\n skipSubmitButton={question.skipSubmitButton}\n />\n }\n >\n <QuestionHeader\n question={question.question}\n description={question.description}\n descriptionContentType={question.descriptionContentType}\n appearance={appearance}\n />\n <View style={styles.ratingSection}>\n <View style={styles.ratingOptions}>\n {question.display === SurveyRatingDisplay.Emoji && (\n <View style={styles.ratingOptionsEmoji}>\n {emojiScaleLists[question.scale]?.map((Emoji, idx) => {\n const active = idx + 1 === rating\n return (\n <TouchableOpacity\n key={idx}\n style={styles.ratingsEmoji}\n onPress={() => {\n const response = idx + 1\n setRating(response)\n if (question.skipSubmitButton) {\n onSubmit(response)\n }\n }}\n >\n <Emoji fill={active ? appearance.ratingButtonActiveColor : appearance.ratingButtonColor} />\n </TouchableOpacity>\n )\n })}\n </View>\n )}\n {question.display === SurveyRatingDisplay.Number && (\n <View style={[styles.ratingOptionsNumber, { borderColor: appearance.borderColor }]}>\n {getScaleNumbers(question.scale).map((number, idx) => {\n const active = rating === number\n return (\n <RatingButton\n key={idx}\n index={idx}\n active={active}\n appearance={appearance}\n num={number}\n setActiveNumber={(response) => {\n setRating(response)\n if (question.skipSubmitButton) {\n onSubmit(response)\n }\n }}\n />\n )\n })}\n </View>\n )}\n </View>\n <View style={styles.ratingText}>\n <Text\n maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'ratingLabel')}\n style={{\n color: appearance.textColor ?? getContrastingTextColor(appearance.backgroundColor),\n opacity: defaultRatingLabelOpacity,\n }}\n >\n {question.lowerBoundLabel}\n </Text>\n <Text\n maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'ratingLabel')}\n style={{\n color: appearance.textColor ?? getContrastingTextColor(appearance.backgroundColor),\n opacity: defaultRatingLabelOpacity,\n }}\n >\n {question.upperBoundLabel}\n </Text>\n </View>\n </View>\n </QuestionLayout>\n )\n}\n\nexport function RatingButton({\n index,\n num,\n active,\n appearance,\n setActiveNumber,\n}: {\n index: number\n num: number\n active: boolean\n appearance: SurveyAppearanceTheme\n setActiveNumber: (num: number) => void\n}): JSX.Element {\n const backgroundColor = active ? appearance.ratingButtonActiveColor : appearance.ratingButtonColor\n // Active state always auto-calculates for contrast; inactive uses inputTextColor override if provided\n const textColor = active\n ? getContrastingTextColor(backgroundColor)\n : (appearance.inputTextColor ?? getContrastingTextColor(backgroundColor))\n\n return (\n <TouchableOpacity\n style={[\n styles.ratingsNumber,\n index === 0 && { borderLeftWidth: 0 },\n { backgroundColor, borderColor: appearance.borderColor },\n ]}\n onPress={() => setActiveNumber(num)}\n >\n <Text maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'ratingNumber')} style={{ color: textColor }}>\n {num}\n </Text>\n </TouchableOpacity>\n )\n}\n\nexport function MultipleChoiceQuestion({\n question,\n appearance,\n onSubmit,\n}: QuestionCommonProps & {\n onSubmit: (choices: string | string[] | null) => void\n}): JSX.Element {\n question = question as MultipleSurveyQuestion\n const isSingleChoice = question.type === SurveyQuestionType.SingleChoice\n const allowMultiple = question.type === SurveyQuestionType.MultipleChoice\n const openChoiceIndex = question.hasOpenChoice ? question.choices.length - 1 : -1\n const choices = useMemo(() => getDisplayOrderChoices(question as MultipleSurveyQuestion), [question])\n // Choice labels change with survey translations; keep selection tied to the original order.\n const [selectedChoiceIndices, setSelectedChoiceIndices] = useState<number[]>([])\n const [openEndedInput, setOpenEndedInput] = useState('')\n\n // Only skip submit for single-choice questions without open choice\n const shouldSkipSubmit = question.skipSubmitButton && isSingleChoice && !question.hasOpenChoice\n\n return (\n <QuestionLayout\n footer={\n <BottomSection\n text={question.buttonText ?? appearance.submitButtonText}\n submitDisabled={\n !question.optional &&\n (selectedChoiceIndices.length === 0 ||\n (selectedChoiceIndices.includes(openChoiceIndex) && openEndedInput.length === 0))\n }\n appearance={appearance}\n onSubmit={() => {\n const result = selectedChoiceIndices.map((index) =>\n index === openChoiceIndex ? openEndedInput : question.choices[index]\n )\n onSubmit(allowMultiple ? result : result[0])\n }}\n skipSubmitButton={shouldSkipSubmit}\n />\n }\n >\n <QuestionHeader\n question={question.question}\n description={question.description}\n descriptionContentType={question.descriptionContentType}\n appearance={appearance}\n />\n <View style={styles.multipleChoiceOptions}>\n {choices.map((choice: string, choiceIndex: number) => {\n const isOpenChoice = choiceIndex === openChoiceIndex\n const isSelected = selectedChoiceIndices.includes(choiceIndex)\n\n const choiceTextColor = appearance.inputTextColor ?? getContrastingTextColor(appearance.inputBackground)\n\n return (\n <Pressable\n key={choiceIndex}\n style={[\n styles.choiceOption,\n { backgroundColor: appearance.inputBackground },\n isSelected ? { borderColor: getContrastingTextColor(appearance.backgroundColor) } : {},\n ]}\n onPress={() => {\n if (allowMultiple) {\n setSelectedChoiceIndices(\n isSelected\n ? selectedChoiceIndices.filter((index) => index !== choiceIndex)\n : [...selectedChoiceIndices, choiceIndex]\n )\n } else {\n setSelectedChoiceIndices([choiceIndex])\n if (shouldSkipSubmit && !isOpenChoice) {\n onSubmit(choice)\n }\n }\n }}\n >\n <View style={styles.choiceText}>\n <Text\n maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'choice')}\n style={{ flexGrow: 1, color: choiceTextColor }}\n >\n {choice}\n {isOpenChoice ? ':' : ''}\n </Text>\n <View style={styles.rightCheckArea}>{isSelected && <CheckSVG />}</View>\n </View>\n {isOpenChoice && (\n <TextInput\n maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'input')}\n style={styles.openEndedInput}\n onChangeText={(userValue) => {\n setOpenEndedInput(userValue)\n if (!isSelected) {\n setSelectedChoiceIndices(allowMultiple ? [...selectedChoiceIndices, choiceIndex] : [choiceIndex])\n }\n }}\n />\n )}\n </Pressable>\n )\n })}\n </View>\n </QuestionLayout>\n )\n}\n\nconst emojiScaleLists: Record<number, (typeof ThumbsUpEmoji)[]> = {\n 2: [ThumbsUpEmoji, ThumbsDownEmoji],\n 3: [DissatisfiedEmoji, NeutralEmoji, SatisfiedEmoji],\n 5: [VeryDissatisfiedEmoji, DissatisfiedEmoji, NeutralEmoji, SatisfiedEmoji, VerySatisfiedEmoji],\n}\nconst fiveScaleNumbers = [1, 2, 3, 4, 5]\nconst sevenScaleNumbers = [1, 2, 3, 4, 5, 6, 7]\nconst tenScaleNumbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n\nfunction getScaleNumbers(scale: number): number[] {\n switch (scale) {\n case 5:\n return fiveScaleNumbers\n case 7:\n return sevenScaleNumbers\n case 10:\n return tenScaleNumbers\n default:\n return fiveScaleNumbers\n }\n}\n\nconst styles = createSafeStyleSheet({\n textInputContainer: {\n padding: 10,\n },\n textInput: {\n borderColor: '#ccc',\n borderWidth: 1,\n padding: 10,\n marginVertical: 10,\n fontSize: 16,\n // Fixed height keeps the surrounding layout stable as the user types —\n // the TextInput scrolls its own content internally\n height: 80,\n textAlignVertical: 'top',\n },\n ratingSection: {\n marginVertical: 10,\n },\n ratingOptions: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n ratingOptionsEmoji: {\n flexDirection: 'row',\n justifyContent: 'space-around',\n flexWrap: 'nowrap',\n flex: 1,\n },\n ratingsEmoji: {\n padding: 4,\n },\n ratingOptionsNumber: {\n margin: 10,\n flexGrow: 1,\n flexDirection: 'row',\n justifyContent: 'space-between',\n borderRadius: 5,\n borderWidth: 1,\n overflow: 'hidden',\n },\n ratingsNumber: {\n flex: 1,\n paddingVertical: 10,\n alignItems: 'center',\n borderLeftWidth: 1,\n },\n ratingText: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n padding: 10,\n },\n multipleChoiceOptions: {\n padding: 10,\n },\n choiceOption: {\n flexDirection: 'column',\n marginVertical: 5,\n borderWidth: 1,\n borderColor: 'grey',\n borderRadius: 5,\n padding: 10,\n },\n choiceText: {\n flexDirection: 'row',\n },\n rightCheckArea: {\n flexGrow: 0,\n },\n openEndedInput: {\n padding: 5,\n },\n validationHint: {\n fontSize: 12,\n opacity: 0.7,\n marginTop: 4,\n },\n})\n"],"mappings":"wlBAAA,IAAAA,MAAA,CAAAC,uBAAA,CAAAC,OAAA,WACA,IAAAC,YAAA,CAAAD,OAAA,iBAEA,IAAAE,eAAA,CAAAF,OAAA,sBACA,IAAAG,MAAA,CAAAH,OAAA,aAUA,IAAAI,aAAA,CAAAJ,OAAA,qBAMA,IA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S,CAAE,C,EAEd,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"QuestionTypes.js","names":["_react","_interopRequireWildcard","require","_reactNative","_safeStyleSheet","_icons","_surveysUtils","_surveyShuffling","_core","_surveys","_BottomSection","_QuestionHeader","_jsxRuntime","_jsxFileName","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t2","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","QuestionLayout","_ref","children","footer","_useState","useState","_useState2","_slicedToArray2","viewportHeight","setViewportHeight","_useState3","_useState4","contentHeight","setContentHeight","isOverflowing","jsxs","View","style","questionLayoutStyles","container","jsx","ScrollView","scroll","keyboardShouldPersistTaps","showsVerticalScrollIndicator","scrollEnabled","bounces","onLayout","nativeEvent","layout","height","onContentSizeChange","_width","createSafeStyleSheet","flexShrink","OpenTextQuestion","_ref2","question","appearance","onSubmit","_useState5","_useState6","text","setText","validationError","useMemo","getValidationError","validation","optional","minLength","getLengthFromRules","SurveyValidationType","MinLength","maxLength","MaxLength","requirementsHint","getRequirementsHint","handleSubmit","trim","BottomSection","_a","buttonText","submitButtonText","submitDisabled","QuestionHeader","description","descriptionContentType","styles","textInputContainer","TextInput","maxFontSizeMultiplier","getMaxFontSizeMultiplier","textInput","backgroundColor","inputBackground","color","_b","inputTextColor","getContrastingTextColor","borderColor","multiline","numberOfLines","placeholder","placeholderTextColor","_c","onChangeText","value","Text","validationHint","_d","textColor","LinkQuestion","_ref3","link","RatingQuestion","_ref4","_this","_useState7","_useState8","rating","setRating","skipSubmitButton","ratingSection","ratingOptions","display","SurveyRatingDisplay","Emoji","ratingOptionsEmoji","emojiScaleLists","scale","map","idx","active","TouchableOpacity","ratingsEmoji","onPress","response","fill","ratingButtonActiveColor","ratingButtonColor","Number","ratingOptionsNumber","getScaleNumbers","number","RatingButton","index","num","setActiveNumber","ratingText","opacity","defaultRatingLabelOpacity","lowerBoundLabel","upperBoundLabel","_ref5","ratingsNumber","borderLeftWidth","MultipleChoiceQuestion","_ref6","_this2","isSingleChoice","type","SurveyQuestionType","SingleChoice","allowMultiple","MultipleChoice","openChoiceIndex","hasOpenChoice","choices","length","getDisplayOrderChoices","_useState9","_useState0","selectedChoiceIndices","setSelectedChoiceIndices","_useState1","_useState10","openEndedInput","setOpenEndedInput","shouldSkipSubmit","includes","result","multipleChoiceOptions","choice","choiceIndex","isOpenChoice","isSelected","choiceTextColor","Pressable","choiceOption","filter","concat","_toConsumableArray2","choiceText","flexGrow","rightCheckArea","CheckSVG","userValue","ThumbsUpEmoji","ThumbsDownEmoji","DissatisfiedEmoji","NeutralEmoji","SatisfiedEmoji","VeryDissatisfiedEmoji","VerySatisfiedEmoji","fiveScaleNumbers","sevenScaleNumbers","tenScaleNumbers","padding","borderWidth","marginVertical","fontSize","textAlignVertical","flexDirection","justifyContent","flexWrap","flex","margin","borderRadius","overflow","paddingVertical","alignItems","marginTop"],"sources":["../../../src/surveys/components/QuestionTypes.tsx"],"sourcesContent":["import React, { ReactNode, useMemo, useState } from 'react'\nimport { LayoutChangeEvent, Pressable, ScrollView, Text, TextInput, TouchableOpacity, View } from 'react-native'\n\nimport { createSafeStyleSheet } from '../safeStyleSheet'\nimport {\n CheckSVG,\n DissatisfiedEmoji,\n NeutralEmoji,\n SatisfiedEmoji,\n ThumbsDownEmoji,\n ThumbsUpEmoji,\n VeryDissatisfiedEmoji,\n VerySatisfiedEmoji,\n} from '../icons'\nimport {\n defaultRatingLabelOpacity,\n getContrastingTextColor,\n getMaxFontSizeMultiplier,\n SurveyAppearanceTheme,\n} from '../surveys-utils'\nimport { getDisplayOrderChoices } from '../survey-shuffling'\nimport {\n SurveyQuestion,\n SurveyRatingDisplay,\n SurveyQuestionType,\n LinkSurveyQuestion,\n RatingSurveyQuestion,\n MultipleSurveyQuestion,\n SurveyValidationType,\n} from '@posthog/core'\nimport { getValidationError, getLengthFromRules, getRequirementsHint } from '@posthog/core/surveys'\nimport { BottomSection } from './BottomSection'\nimport { QuestionHeader } from './QuestionHeader'\n\ninterface QuestionCommonProps {\n question: SurveyQuestion\n appearance: SurveyAppearanceTheme\n}\n\n// Wraps question content in a scrollable region with a sticky BottomSection\n// (Submit button) at the bottom. The ScrollView has flexShrink: 1 so it\n// shrinks to fit when the parent modal is capped at its keyboard-aware\n// maxHeight, keeping Submit visible regardless of survey length. Scrolling is\n// enabled only while the content overflows the viewport, so short surveys don't\n// scroll or bounce.\nfunction QuestionLayout({ children, footer }: { children: ReactNode; footer: ReactNode }): JSX.Element {\n const [viewportHeight, setViewportHeight] = useState(0)\n const [contentHeight, setContentHeight] = useState(0)\n // 1px threshold absorbs sub-pixel layout rounding.\n const isOverflowing = contentHeight > viewportHeight + 1\n\n return (\n <View style={questionLayoutStyles.container}>\n <ScrollView\n style={questionLayoutStyles.scroll}\n keyboardShouldPersistTaps=\"handled\"\n showsVerticalScrollIndicator={false}\n scrollEnabled={isOverflowing}\n bounces={isOverflowing}\n onLayout={(e: LayoutChangeEvent) => setViewportHeight(e.nativeEvent.layout.height)}\n onContentSizeChange={(_width, height) => setContentHeight(height)}\n >\n {children}\n </ScrollView>\n {footer}\n </View>\n )\n}\n\nconst questionLayoutStyles = createSafeStyleSheet({\n container: {\n flexShrink: 1,\n },\n scroll: {\n flexShrink: 1,\n },\n})\n\nexport function OpenTextQuestion({\n question,\n appearance,\n onSubmit,\n}: QuestionCommonProps & {\n onSubmit: (text: string) => void\n}): JSX.Element {\n const [text, setText] = useState('')\n\n // Memoize validation error to avoid recalculating on every render\n const validationError = useMemo(\n () => getValidationError(text, question.validation, question.optional),\n [text, question.validation, question.optional]\n )\n\n // Build requirements hint message\n const minLength = getLengthFromRules(question.validation, SurveyValidationType.MinLength)\n const maxLength = getLengthFromRules(question.validation, SurveyValidationType.MaxLength)\n const requirementsHint = useMemo(() => getRequirementsHint(minLength, maxLength), [minLength, maxLength])\n\n const handleSubmit = () => {\n if (validationError) {\n return\n }\n onSubmit(text.trim())\n }\n\n return (\n <QuestionLayout\n footer={\n <BottomSection\n text={question.buttonText ?? appearance.submitButtonText}\n submitDisabled={!!validationError}\n appearance={appearance}\n onSubmit={handleSubmit}\n />\n }\n >\n <QuestionHeader\n question={question.question}\n description={question.description}\n descriptionContentType={question.descriptionContentType}\n appearance={appearance}\n />\n <View style={styles.textInputContainer}>\n <TextInput\n maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'input')}\n style={[\n styles.textInput,\n {\n backgroundColor: appearance.inputBackground,\n color: appearance.inputTextColor ?? getContrastingTextColor(appearance.inputBackground),\n borderColor: appearance.borderColor,\n },\n ]}\n multiline\n numberOfLines={4}\n placeholder={appearance.placeholder}\n placeholderTextColor={\n getContrastingTextColor(\n appearance.inputTextColor ?? getContrastingTextColor(appearance.inputBackground)\n ) === 'white'\n ? 'rgba(0, 0, 0, 0.5)'\n : 'rgba(255, 255, 255, 0.5)'\n }\n onChangeText={setText}\n value={text}\n />\n {requirementsHint && (\n <Text\n maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'validationHint')}\n style={[\n styles.validationHint,\n { color: appearance.textColor ?? getContrastingTextColor(appearance.backgroundColor) },\n ]}\n >\n {requirementsHint}\n </Text>\n )}\n </View>\n </QuestionLayout>\n )\n}\n\nexport function LinkQuestion({\n question,\n appearance,\n onSubmit,\n}: QuestionCommonProps & {\n onSubmit: (clicked: string) => void\n}): JSX.Element {\n question = question as LinkSurveyQuestion\n\n return (\n <QuestionLayout\n footer={\n <BottomSection\n text={question.buttonText ?? appearance.submitButtonText ?? 'Submit'}\n submitDisabled={false}\n link={question.link}\n appearance={appearance}\n onSubmit={() => onSubmit('link clicked')}\n />\n }\n >\n <QuestionHeader\n question={question.question}\n description={question.description}\n descriptionContentType={question.descriptionContentType}\n appearance={appearance}\n />\n </QuestionLayout>\n )\n}\n\nexport function RatingQuestion({\n question,\n appearance,\n onSubmit,\n}: QuestionCommonProps & {\n onSubmit: (rating: number | null) => void\n}): JSX.Element {\n //const starting = question.scale === 10 ? 0 : 1;\n const [rating, setRating] = useState<number | null>(null)\n question = question as RatingSurveyQuestion\n\n return (\n <QuestionLayout\n footer={\n <BottomSection\n text={question.buttonText ?? appearance.submitButtonText}\n submitDisabled={rating === null && !question.optional}\n appearance={appearance}\n onSubmit={() => onSubmit(rating)}\n skipSubmitButton={question.skipSubmitButton}\n />\n }\n >\n <QuestionHeader\n question={question.question}\n description={question.description}\n descriptionContentType={question.descriptionContentType}\n appearance={appearance}\n />\n <View style={styles.ratingSection}>\n <View style={styles.ratingOptions}>\n {question.display === SurveyRatingDisplay.Emoji && (\n <View style={styles.ratingOptionsEmoji}>\n {emojiScaleLists[question.scale]?.map((Emoji, idx) => {\n const active = idx + 1 === rating\n return (\n <TouchableOpacity\n key={idx}\n style={styles.ratingsEmoji}\n onPress={() => {\n const response = idx + 1\n setRating(response)\n if (question.skipSubmitButton) {\n onSubmit(response)\n }\n }}\n >\n <Emoji fill={active ? appearance.ratingButtonActiveColor : appearance.ratingButtonColor} />\n </TouchableOpacity>\n )\n })}\n </View>\n )}\n {question.display === SurveyRatingDisplay.Number && (\n <View style={[styles.ratingOptionsNumber, { borderColor: appearance.borderColor }]}>\n {getScaleNumbers(question.scale).map((number, idx) => {\n const active = rating === number\n return (\n <RatingButton\n key={idx}\n index={idx}\n active={active}\n appearance={appearance}\n num={number}\n setActiveNumber={(response) => {\n setRating(response)\n if (question.skipSubmitButton) {\n onSubmit(response)\n }\n }}\n />\n )\n })}\n </View>\n )}\n </View>\n <View style={styles.ratingText}>\n <Text\n maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'ratingLabel')}\n style={{\n color: appearance.textColor ?? getContrastingTextColor(appearance.backgroundColor),\n opacity: defaultRatingLabelOpacity,\n }}\n >\n {question.lowerBoundLabel}\n </Text>\n <Text\n maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'ratingLabel')}\n style={{\n color: appearance.textColor ?? getContrastingTextColor(appearance.backgroundColor),\n opacity: defaultRatingLabelOpacity,\n }}\n >\n {question.upperBoundLabel}\n </Text>\n </View>\n </View>\n </QuestionLayout>\n )\n}\n\nexport function RatingButton({\n index,\n num,\n active,\n appearance,\n setActiveNumber,\n}: {\n index: number\n num: number\n active: boolean\n appearance: SurveyAppearanceTheme\n setActiveNumber: (num: number) => void\n}): JSX.Element {\n const backgroundColor = active ? appearance.ratingButtonActiveColor : appearance.ratingButtonColor\n // Active state always auto-calculates for contrast; inactive uses inputTextColor override if provided\n const textColor = active\n ? getContrastingTextColor(backgroundColor)\n : (appearance.inputTextColor ?? getContrastingTextColor(backgroundColor))\n\n return (\n <TouchableOpacity\n style={[\n styles.ratingsNumber,\n index === 0 && { borderLeftWidth: 0 },\n { backgroundColor, borderColor: appearance.borderColor },\n ]}\n onPress={() => setActiveNumber(num)}\n >\n <Text maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'ratingNumber')} style={{ color: textColor }}>\n {num}\n </Text>\n </TouchableOpacity>\n )\n}\n\nexport function MultipleChoiceQuestion({\n question,\n appearance,\n onSubmit,\n}: QuestionCommonProps & {\n onSubmit: (choices: string | string[] | null) => void\n}): JSX.Element {\n question = question as MultipleSurveyQuestion\n const isSingleChoice = question.type === SurveyQuestionType.SingleChoice\n const allowMultiple = question.type === SurveyQuestionType.MultipleChoice\n const openChoiceIndex = question.hasOpenChoice ? question.choices.length - 1 : -1\n const choices = useMemo(() => getDisplayOrderChoices(question as MultipleSurveyQuestion), [question])\n // Choice labels change with survey translations; keep selection tied to the original order.\n const [selectedChoiceIndices, setSelectedChoiceIndices] = useState<number[]>([])\n const [openEndedInput, setOpenEndedInput] = useState('')\n\n // Only skip submit for single-choice questions without open choice\n const shouldSkipSubmit = question.skipSubmitButton && isSingleChoice && !question.hasOpenChoice\n\n return (\n <QuestionLayout\n footer={\n <BottomSection\n text={question.buttonText ?? appearance.submitButtonText}\n submitDisabled={\n !question.optional &&\n (selectedChoiceIndices.length === 0 ||\n (selectedChoiceIndices.includes(openChoiceIndex) && openEndedInput.length === 0))\n }\n appearance={appearance}\n onSubmit={() => {\n const result = selectedChoiceIndices.map((index) =>\n index === openChoiceIndex ? openEndedInput : question.choices[index]\n )\n onSubmit(allowMultiple ? result : result[0])\n }}\n skipSubmitButton={shouldSkipSubmit}\n />\n }\n >\n <QuestionHeader\n question={question.question}\n description={question.description}\n descriptionContentType={question.descriptionContentType}\n appearance={appearance}\n />\n <View style={styles.multipleChoiceOptions}>\n {choices.map((choice: string, choiceIndex: number) => {\n const isOpenChoice = choiceIndex === openChoiceIndex\n const isSelected = selectedChoiceIndices.includes(choiceIndex)\n\n const choiceTextColor = appearance.inputTextColor ?? getContrastingTextColor(appearance.inputBackground)\n\n return (\n <Pressable\n key={choiceIndex}\n style={[\n styles.choiceOption,\n { backgroundColor: appearance.inputBackground },\n isSelected ? { borderColor: getContrastingTextColor(appearance.backgroundColor) } : {},\n ]}\n onPress={() => {\n if (allowMultiple) {\n setSelectedChoiceIndices(\n isSelected\n ? selectedChoiceIndices.filter((index) => index !== choiceIndex)\n : [...selectedChoiceIndices, choiceIndex]\n )\n } else {\n setSelectedChoiceIndices([choiceIndex])\n if (shouldSkipSubmit && !isOpenChoice) {\n onSubmit(choice)\n }\n }\n }}\n >\n <View style={styles.choiceText}>\n <Text\n maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'choice')}\n style={{ flexGrow: 1, color: choiceTextColor }}\n >\n {choice}\n {isOpenChoice ? ':' : ''}\n </Text>\n <View style={styles.rightCheckArea}>{isSelected && <CheckSVG />}</View>\n </View>\n {isOpenChoice && (\n <TextInput\n maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'input')}\n style={styles.openEndedInput}\n onChangeText={(userValue) => {\n setOpenEndedInput(userValue)\n if (!isSelected) {\n setSelectedChoiceIndices(allowMultiple ? [...selectedChoiceIndices, choiceIndex] : [choiceIndex])\n }\n }}\n />\n )}\n </Pressable>\n )\n })}\n </View>\n </QuestionLayout>\n )\n}\n\nconst emojiScaleLists: Record<number, (typeof ThumbsUpEmoji)[]> = {\n 2: [ThumbsUpEmoji, ThumbsDownEmoji],\n 3: [DissatisfiedEmoji, NeutralEmoji, SatisfiedEmoji],\n 5: [VeryDissatisfiedEmoji, DissatisfiedEmoji, NeutralEmoji, SatisfiedEmoji, VerySatisfiedEmoji],\n}\nconst fiveScaleNumbers = [1, 2, 3, 4, 5]\nconst sevenScaleNumbers = [1, 2, 3, 4, 5, 6, 7]\nconst tenScaleNumbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n\nfunction getScaleNumbers(scale: number): number[] {\n switch (scale) {\n case 5:\n return fiveScaleNumbers\n case 7:\n return sevenScaleNumbers\n case 10:\n return tenScaleNumbers\n default:\n return fiveScaleNumbers\n }\n}\n\nconst styles = createSafeStyleSheet({\n textInputContainer: {\n padding: 10,\n },\n textInput: {\n borderColor: '#ccc',\n borderWidth: 1,\n padding: 10,\n marginVertical: 10,\n fontSize: 16,\n // Fixed height keeps the surrounding layout stable as the user types —\n // the TextInput scrolls its own content internally\n height: 80,\n textAlignVertical: 'top',\n },\n ratingSection: {\n marginVertical: 10,\n },\n ratingOptions: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n ratingOptionsEmoji: {\n flexDirection: 'row',\n justifyContent: 'space-around',\n flexWrap: 'nowrap',\n flex: 1,\n },\n ratingsEmoji: {\n padding: 4,\n },\n ratingOptionsNumber: {\n margin: 10,\n flexGrow: 1,\n flexDirection: 'row',\n justifyContent: 'space-between',\n borderRadius: 5,\n borderWidth: 1,\n overflow: 'hidden',\n },\n ratingsNumber: {\n flex: 1,\n paddingVertical: 10,\n alignItems: 'center',\n borderLeftWidth: 1,\n },\n ratingText: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n padding: 10,\n },\n multipleChoiceOptions: {\n padding: 10,\n },\n choiceOption: {\n flexDirection: 'column',\n marginVertical: 5,\n borderWidth: 1,\n borderColor: 'grey',\n borderRadius: 5,\n padding: 10,\n },\n choiceText: {\n flexDirection: 'row',\n },\n rightCheckArea: {\n flexGrow: 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AAC,CACfV,OAAO,CAAE,E,CACV,CACDf,UAAU,CAAE,CACVoB,aAAa,CAAE,K,CAChB,CACDlB,cAAc,CAAE,CACdD,QAAQ,CAAE,C,CACX,CACDjB,cAAc,CAAE,CACd+B,OAAO,CAAE,C,CACV,CACDnG,cAAc,CAAE,CACdsG,QAAQ,CAAE,EAAE,CACZ7D,OAAO,CAAE,GAAG,CACZwE,SAAS,CAAE,C,EAEd,CAAC","ignoreList":[]}
@@ -1,7 +1,12 @@
1
1
  import { SurveyAppearanceTheme } from '../surveys-utils';
2
2
  import { Survey, type SurveyResponses } from '@posthog/core';
3
+ import type { SurveyProgress } from '../survey-progress';
4
+ import type { PostHog } from '../../posthog-rn';
3
5
  export type SurveyModalProps = {
4
6
  survey: Survey;
7
+ client?: PostHog;
8
+ initialProgress?: SurveyProgress;
9
+ onProgressChange?: (progress: SurveyProgress, completed: boolean) => boolean;
5
10
  surveyLanguage: string | null;
6
11
  appearance: SurveyAppearanceTheme;
7
12
  onShow: () => void;
@@ -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 SurveyModal(props){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)(Boolean(appearance.displayIntroScreen)&&Boolean(appearance.introScreenHeader||appearance.introScreenDescription)),_useState4=(0,_slicedToArray2["default"])(_useState3,2),showIntro=_useState4[0],setShowIntro=_useState4[1];var _useState5=(0,_react.useState)({}),_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=isSurveySent&&appearance.thankYouMessageHeader;(0,_react.useEffect)(function(){if(isVisible){onShow();}},[isVisible,onShow]);(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,{survey:survey,surveyLanguage:surveyLanguage,appearance:appearance,responses:responses,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}});
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=isSurveySent&&appearance.thankYouMessageHeader;(0,_react.useEffect)(function(){if(isVisible){onShow();}},[isVisible,onShow]);(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