posthog-react-native 4.74.0 → 4.74.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PostHogContext.js +2 -1
- package/dist/PostHogContext.js.map +1 -1
- package/dist/PostHogErrorBoundary.js +2 -1
- package/dist/PostHogErrorBoundary.js.map +1 -1
- package/dist/PostHogMaskView.js +2 -1
- package/dist/PostHogMaskView.js.map +1 -1
- package/dist/PostHogProvider.js +2 -1
- package/dist/PostHogProvider.js.map +1 -1
- package/dist/autocapture.js +2 -1
- package/dist/autocapture.js.map +1 -1
- package/dist/error-tracking/exception-context.js +2 -1
- package/dist/error-tracking/exception-context.js.map +1 -1
- package/dist/error-tracking/index.js +2 -1
- package/dist/error-tracking/index.js.map +1 -1
- package/dist/error-tracking/utils.js +2 -1
- package/dist/error-tracking/utils.js.map +1 -1
- package/dist/frameworks/wix-navigation.js +2 -1
- package/dist/frameworks/wix-navigation.js.map +1 -1
- package/dist/hooks/useFeatureFlag.js +2 -1
- package/dist/hooks/useFeatureFlag.js.map +1 -1
- package/dist/hooks/useFeatureFlagResult.js +2 -1
- package/dist/hooks/useFeatureFlagResult.js.map +1 -1
- package/dist/hooks/useFeatureFlags.js +2 -1
- package/dist/hooks/useFeatureFlags.js.map +1 -1
- package/dist/hooks/useNavigationTracker.js +2 -1
- package/dist/hooks/useNavigationTracker.js.map +1 -1
- package/dist/hooks/usePostHog.js +2 -1
- package/dist/hooks/usePostHog.js.map +1 -1
- package/dist/hooks/utils.js +2 -1
- package/dist/hooks/utils.js.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/logs-defaults.js +2 -1
- package/dist/logs-defaults.js.map +1 -1
- package/dist/native-deps.js +2 -1
- package/dist/native-deps.js.map +1 -1
- package/dist/optional/OptionalAsyncStorage.js +2 -1
- package/dist/optional/OptionalAsyncStorage.js.map +1 -1
- package/dist/optional/OptionalExpoApplication.js +2 -1
- package/dist/optional/OptionalExpoApplication.js.map +1 -1
- package/dist/optional/OptionalExpoDevice.js +2 -1
- package/dist/optional/OptionalExpoDevice.js.map +1 -1
- package/dist/optional/OptionalExpoFileSystem.js +2 -1
- package/dist/optional/OptionalExpoFileSystem.js.map +1 -1
- package/dist/optional/OptionalExpoFileSystemLegacy.js +2 -1
- package/dist/optional/OptionalExpoFileSystemLegacy.js.map +1 -1
- package/dist/optional/OptionalExpoLocalization.js +2 -1
- package/dist/optional/OptionalExpoLocalization.js.map +1 -1
- package/dist/optional/OptionalExpoUpdates.js +2 -1
- package/dist/optional/OptionalExpoUpdates.js.map +1 -1
- package/dist/optional/OptionalPlugin.js +2 -1
- package/dist/optional/OptionalPlugin.js.map +1 -1
- package/dist/optional/OptionalReactNativeDeviceInfo.js +2 -1
- package/dist/optional/OptionalReactNativeDeviceInfo.js.map +1 -1
- package/dist/optional/OptionalReactNativeLocalize.js +2 -1
- package/dist/optional/OptionalReactNativeLocalize.js.map +1 -1
- package/dist/optional/OptionalReactNativeNavigation.js +2 -1
- package/dist/optional/OptionalReactNativeNavigation.js.map +1 -1
- package/dist/optional/OptionalReactNativeNavigationWix.js +2 -1
- package/dist/optional/OptionalReactNativeNavigationWix.js.map +1 -1
- package/dist/optional/OptionalReactNativeSafeArea.js +2 -1
- package/dist/optional/OptionalReactNativeSafeArea.js.map +1 -1
- package/dist/optional/OptionalReactNativeSvg.js +2 -1
- package/dist/optional/OptionalReactNativeSvg.js.map +1 -1
- package/dist/posthog-rn.js +2 -1
- package/dist/posthog-rn.js.map +1 -1
- package/dist/storage.js +2 -1
- package/dist/storage.js.map +1 -1
- package/dist/surveys/PostHogSurveyProvider.js +2 -1
- package/dist/surveys/PostHogSurveyProvider.js.map +1 -1
- package/dist/surveys/components/BottomSection.js +2 -1
- package/dist/surveys/components/BottomSection.js.map +1 -1
- package/dist/surveys/components/Cancel.js +2 -1
- package/dist/surveys/components/Cancel.js.map +1 -1
- package/dist/surveys/components/ConfirmationMessage.js +2 -1
- package/dist/surveys/components/ConfirmationMessage.js.map +1 -1
- package/dist/surveys/components/IntroMessage.js +2 -1
- package/dist/surveys/components/IntroMessage.js.map +1 -1
- package/dist/surveys/components/QuestionHeader.js +2 -1
- package/dist/surveys/components/QuestionHeader.js.map +1 -1
- package/dist/surveys/components/QuestionTypes.js +2 -1
- package/dist/surveys/components/QuestionTypes.js.map +1 -1
- package/dist/surveys/components/SurveyModal.js +2 -1
- package/dist/surveys/components/SurveyModal.js.map +1 -1
- package/dist/surveys/components/Surveys.js +2 -1
- package/dist/surveys/components/Surveys.js.map +1 -1
- package/dist/surveys/getActiveMatchingSurveys.js +2 -1
- package/dist/surveys/getActiveMatchingSurveys.js.map +1 -1
- package/dist/surveys/icons.js +2 -1
- package/dist/surveys/icons.js.map +1 -1
- package/dist/surveys/index.js +2 -1
- package/dist/surveys/index.js.map +1 -1
- package/dist/surveys/safeStyleSheet.js +2 -1
- package/dist/surveys/safeStyleSheet.js.map +1 -1
- package/dist/surveys/survey-shuffling.d.ts +2 -6
- package/dist/surveys/survey-shuffling.js +2 -1
- package/dist/surveys/survey-shuffling.js.map +1 -1
- package/dist/surveys/survey-translations.js +2 -1
- package/dist/surveys/survey-translations.js.map +1 -1
- package/dist/surveys/surveys-utils.d.ts +1 -6
- package/dist/surveys/surveys-utils.js +2 -1
- package/dist/surveys/surveys-utils.js.map +1 -1
- package/dist/surveys/useActivatedSurveys.js +2 -1
- package/dist/surveys/useActivatedSurveys.js.map +1 -1
- package/dist/surveys/useSurveyStorage.js +2 -1
- package/dist/surveys/useSurveyStorage.js.map +1 -1
- package/dist/tooling/expoconfig.js +2 -1
- package/dist/tooling/expoconfig.js.map +1 -1
- package/dist/tooling/metroconfig.js +2 -1
- package/dist/tooling/metroconfig.js.map +1 -1
- package/dist/tooling/posthogMetroSerializer.js +2 -1
- package/dist/tooling/posthogMetroSerializer.js.map +1 -1
- package/dist/tooling/utils.js +2 -1
- package/dist/tooling/utils.js.map +1 -1
- package/dist/tooling/vendor/expo/expoconfig.js +2 -1
- package/dist/tooling/vendor/expo/expoconfig.js.map +1 -1
- package/dist/tooling/vendor/metro/countLines.js +2 -1
- package/dist/tooling/vendor/metro/countLines.js.map +1 -1
- package/dist/tooling/vendor/metro/utils.js +2 -1
- package/dist/tooling/vendor/metro/utils.js.map +1 -1
- package/dist/types.js +2 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.js +2 -1
- package/dist/utils.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +2 -1
- package/dist/version.js.map +1 -1
- package/package.json +8 -6
|
@@ -1 +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 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}});
|
|
2
|
+
//# sourceMappingURL=SurveyModal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SurveyModal.js","sourceRoot":"","sources":["../../../src/surveys/components/SurveyModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACvE,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAEzG,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,EAAyB,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AAEhF,OAAO,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAA;AACtF,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAWrC,8EAA8E;AAC9E,4EAA4E;AAC5E,MAAM,eAAe,GAAG,CAAC,CAAA;AAEzB,6DAA6D;AAC7D,MAAM,sBAAsB,GAAG,GAAG,CAAA;AAElC,uFAAuF;AACvF,8FAA8F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,CAAC,UAAU,CAAC,CACvB,SAAS,CAAC,CAAC,SAAS,CAAC,CACrB,iBAAiB,CAAC,CAAC,YAAY,CAAC,CAChC,QAAQ,CAAC,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,EACtC,CACH,CACH;gBAAA,EAAE,IAAI,CACR;cAAA,EAAE,IAAI,CACR;YAAA,EAAE,IAAI,CACR;UAAA,EAAE,IAAI,CACR;QAAA,EAAE,oBAAoB,CAAC,CACxB,CACH;IAAA,EAAE,KAAK,CAAC,CACT,CAAA;AACH,CAAC;AAED,MAAM,MAAM,GAAG,oBAAoB,CAAC;IAClC,IAAI,EAAE;QACJ,IAAI,EAAE,CAAC;KACR;IACD,QAAQ,EAAE;QACR,eAAe,EAAE,qBAAqB;KACvC;IACD,QAAQ,EAAE;QACR,aAAa,EAAE,KAAK;KACrB;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,GAAG;KACd;IACD,iBAAiB,EAAE;QACjB,YAAY,EAAE,EAAE;QAChB,WAAW,EAAE,CAAC;QACd,OAAO,EAAE,EAAE;KACZ;IACD,gBAAgB,EAAE;QAChB,0EAA0E;QAC1E,2CAA2C;QAC3C,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,CAAC;QACR,GAAG,EAAE,CAAC;QACN,MAAM,EAAE,CAAC;KACV;CACF,CAAC,CAAA"}
|
|
1
|
+
{"version":3,"file":"SurveyModal.js","names":["_react","_interopRequireWildcard","require","_reactNative","_Cancel","_ConfirmationMessage","_IntroMessage","_safeStyleSheet","_surveysUtils","_OptionalReactNativeSafeArea","_Surveys","_jsxRuntime","_jsxFileName","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t2","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","VIEWPORT_BUFFER","MODAL_FADE_DURATION_MS","IOS_DISMISS_FALLBACK_MS","SurveyModal","props","survey","surveyLanguage","appearance","onShow","onCloseProp","onClose","_props$androidKeyboar","androidKeyboardBehavior","_useState","useState","_useState2","_slicedToArray2","isSurveySent","setIsSurveySent","_useState3","Boolean","displayIntroScreen","introScreenHeader","introScreenDescription","_useState4","showIntro","setShowIntro","_useState5","_useState6","responses","setResponses","_useState7","_useState8","isVisible","setIsVisible","_useState9","_useState0","contentMounted","setContentMounted","isClosingRef","useRef","closeNotifiedRef","closeTimerRef","notifyParentClosed","useCallback","current","requestAnimationFrame","fallbackDelay","Platform","OS","setTimeout","useEffect","clearTimeout","insets","useOptionalSafeAreaInsets","_useWindowDimensions","useWindowDimensions","windowHeight","height","_useState1","_useState10","keyboardHeight","setKeyboardHeight","_resolveSurveyAlignme","resolveSurveyAlignment","position","vertical","horizontal","isBottom","shouldShowConfirmation","thankYouMessageHeader","showEvent","hideEvent","showSub","Keyboard","addListener","endCoordinates","hideSub","remove","maxModalHeight","Math","max","top","bottom","keyboardBehavior","jsx","Modal","visible","animationType","transparent","onRequestClose","onDismiss","undefined","statusBarTranslucent","children","KeyboardAvoidingView","behavior","style","styles","fill","View","backdrop","justifyContent","onTouchStart","dismiss","modalRow","modalContent","pointerEvents","jsxs","event","stopPropagation","modalContentInner","borderColor","backgroundColor","marginTop","marginBottom","marginHorizontal","maxHeight","topIconContainer","Cancel","onPress","ConfirmationMessage","header","description","thankYouMessageDescription","contentType","thankYouMessageDescriptionContentType","isModal","IntroMessage","introScreenDescriptionContentType","onStart","Questions","onResponsesChange","onSubmit","createSafeStyleSheet","flex","flexDirection","width","maxWidth","borderRadius","borderWidth","padding","right","zIndex"],"sources":["../../../src/surveys/components/SurveyModal.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from 'react'\nimport { Keyboard, KeyboardAvoidingView, Modal, Platform, View, useWindowDimensions } from 'react-native'\n\nimport { Cancel } from './Cancel'\nimport { ConfirmationMessage } from './ConfirmationMessage'\nimport { IntroMessage } from './IntroMessage'\nimport { createSafeStyleSheet } from '../safeStyleSheet'\nimport { SurveyAppearanceTheme, resolveSurveyAlignment } from '../surveys-utils'\nimport { Survey, type SurveyResponses } from '@posthog/core'\nimport { useOptionalSafeAreaInsets } from '../../optional/OptionalReactNativeSafeArea'\nimport { Questions } from './Surveys'\n\nexport type SurveyModalProps = {\n survey: Survey\n surveyLanguage: string | null\n appearance: SurveyAppearanceTheme\n onShow: () => void\n onClose: (submitted: boolean, responses: SurveyResponses) => void\n androidKeyboardBehavior?: 'padding' | 'height'\n}\n\n// No extra buffer — let the modal extend right up to the safe-area / keyboard\n// edges. Insets already keep it clear of the status bar and home indicator.\nconst VIEWPORT_BUFFER = 0\n\n// Matches RN Modal's fade animation duration (Android only).\nconst MODAL_FADE_DURATION_MS = 250\n\n// iOS normally notifies the parent via Modal.onDismiss, but Fabric can fail to fire it\n// (https://github.com/facebook/react-native/issues/48245). When that happens the parent never\n// clears the active survey, so this transparent full-screen Modal stays mounted and swallows\n// every touch — the app appears frozen. This is the safety-net delay after which we notify the\n// parent ourselves if onDismiss still hasn't fired. Longer than the dismiss animation so the\n// real onDismiss stays the primary path on the happy path.\nconst IOS_DISMISS_FALLBACK_MS = 1000\n\nexport function SurveyModal(props: SurveyModalProps): JSX.Element | null {\n const { survey, surveyLanguage, appearance, onShow, onClose: onCloseProp, androidKeyboardBehavior = 'height' } = props\n const [isSurveySent, setIsSurveySent] = useState(false)\n // The intro screen is a leading page mirroring the trailing confirmation message. Dismissing it\n // only flips local state — no response is recorded and no survey event is sent. It has no\n // default header, so an intro with no copy at all is skipped instead of drawing an empty box.\n const [showIntro, setShowIntro] = useState(\n Boolean(appearance.displayIntroScreen) && Boolean(appearance.introScreenHeader || appearance.introScreenDescription)\n )\n const [responses, setResponses] = useState<SurveyResponses>({})\n const [isVisible, setIsVisible] = useState(true)\n // Two-step hide for RN Fabric snapshot recycling — see\n // https://github.com/facebook/react-native/issues/48245\n const [contentMounted, setContentMounted] = useState(true)\n const isClosingRef = useRef(false)\n const closeNotifiedRef = useRef(false)\n const closeTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n const notifyParentClosed = useCallback(() => {\n if (closeNotifiedRef.current) return\n closeNotifiedRef.current = true\n onCloseProp(isSurveySent, responses)\n }, [isSurveySent, onCloseProp, responses])\n const onClose = useCallback(() => {\n if (isClosingRef.current) return\n isClosingRef.current = true\n setContentMounted(false)\n requestAnimationFrame(() => {\n setIsVisible(false)\n // Always schedule a fallback to notify the parent. On Android the Modal has no onDismiss,\n // so this is the only notification path (after the fade). On iOS onDismiss is the primary\n // path, but it can silently fail to fire — this timer guarantees the parent still unmounts\n // the Modal so it can never stay up intercepting touches. notifyParentClosed is idempotent,\n // so whichever fires first wins and the other becomes a no-op.\n const fallbackDelay = Platform.OS === 'ios' ? IOS_DISMISS_FALLBACK_MS : MODAL_FADE_DURATION_MS\n closeTimerRef.current = setTimeout(notifyParentClosed, fallbackDelay)\n })\n }, [notifyParentClosed])\n\n // Clear the pending fallback timer on unmount so it can't fire after the survey is gone.\n useEffect(() => {\n return () => {\n if (closeTimerRef.current) {\n clearTimeout(closeTimerRef.current)\n }\n }\n }, [])\n const insets = useOptionalSafeAreaInsets()\n const { height: windowHeight } = useWindowDimensions()\n const [keyboardHeight, setKeyboardHeight] = useState(0)\n const { vertical, horizontal } = resolveSurveyAlignment(appearance.position)\n const isBottom = vertical === 'flex-end'\n\n const shouldShowConfirmation = isSurveySent && appearance.thankYouMessageHeader\n\n useEffect(() => {\n if (isVisible) {\n onShow()\n }\n }, [isVisible, onShow])\n\n // Track keyboard height so we can cap the modal to the visible viewport.\n // KAV alone lifts the modal but doesn't shrink it — a tall modal would\n // still bleed past the screen top.\n useEffect(() => {\n const showEvent = Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow'\n const hideEvent = Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide'\n const showSub = Keyboard.addListener(showEvent, (e) => setKeyboardHeight(e.endCoordinates.height))\n const hideSub = Keyboard.addListener(hideEvent, () => setKeyboardHeight(0))\n return () => {\n showSub.remove()\n hideSub.remove()\n }\n }, [])\n\n const maxModalHeight = Math.max(windowHeight - keyboardHeight - insets.top - insets.bottom - VIEWPORT_BUFFER, 200)\n\n const keyboardBehavior = Platform.OS === 'ios' ? 'padding' : androidKeyboardBehavior\n\n return (\n <Modal\n visible={isVisible}\n animationType=\"fade\"\n transparent\n onRequestClose={onClose}\n onDismiss={Platform.OS === 'ios' ? notifyParentClosed : undefined}\n statusBarTranslucent={true}\n >\n {contentMounted && (\n <KeyboardAvoidingView behavior={keyboardBehavior} style={styles.fill}>\n <View style={[styles.fill, styles.backdrop, { justifyContent: vertical }]} onTouchStart={Keyboard.dismiss}>\n <View style={[styles.modalRow, { justifyContent: horizontal }]}>\n <View style={styles.modalContent} pointerEvents=\"box-none\">\n <View\n onTouchStart={(event) => event.stopPropagation()}\n style={[\n styles.modalContentInner,\n {\n borderColor: appearance.borderColor,\n backgroundColor: appearance.backgroundColor,\n marginTop: vertical === 'flex-start' ? insets.top + 10 : 0,\n // When keyboard is up, sit flush against it (no extra gap).\n // When keyboard is down, leave room for the home indicator.\n marginBottom: isBottom ? (keyboardHeight > 0 ? 0 : insets.bottom + 10) : 0,\n marginHorizontal: 10,\n maxHeight: maxModalHeight,\n },\n ]}\n >\n <View style={styles.topIconContainer}>\n <Cancel onPress={onClose} appearance={appearance} />\n </View>\n {isSurveySent ? (\n shouldShowConfirmation ? (\n <ConfirmationMessage\n appearance={appearance}\n header={appearance.thankYouMessageHeader}\n description={appearance.thankYouMessageDescription}\n contentType={appearance.thankYouMessageDescriptionContentType}\n onClose={onClose}\n isModal={true}\n />\n ) : null\n ) : showIntro ? (\n <IntroMessage\n appearance={appearance}\n header={appearance.introScreenHeader}\n description={appearance.introScreenDescription}\n contentType={appearance.introScreenDescriptionContentType}\n onStart={() => setShowIntro(false)}\n />\n ) : (\n <Questions\n survey={survey}\n surveyLanguage={surveyLanguage}\n appearance={appearance}\n responses={responses}\n onResponsesChange={setResponses}\n onSubmit={() => setIsSurveySent(true)}\n />\n )}\n </View>\n </View>\n </View>\n </View>\n </KeyboardAvoidingView>\n )}\n </Modal>\n )\n}\n\nconst styles = createSafeStyleSheet({\n fill: {\n flex: 1,\n },\n backdrop: {\n backgroundColor: 'rgba(0, 0, 0, 0.32)',\n },\n modalRow: {\n flexDirection: 'row',\n },\n modalContent: {\n width: '90%',\n maxWidth: 400,\n },\n modalContentInner: {\n borderRadius: 10,\n borderWidth: 1,\n padding: 20,\n },\n topIconContainer: {\n // Keep the close button inside the modal so it can never bleed off-screen\n // when the modal lifts above the keyboard.\n position: 'absolute',\n right: 8,\n top: 8,\n zIndex: 1,\n },\n})\n"],"mappings":"0UAAA,IAAAA,MAAA,CAAAC,uBAAA,CAAAC,OAAA,WACA,IAAAC,YAAA,CAAAD,OAAA,iBAEA,IAAAE,OAAA,CAAAF,OAAA,aACA,IAAAG,oBAAA,CAAAH,OAAA,0BACA,IAAAI,aAAA,CAAAJ,OAAA,mBACA,IAAAK,eAAA,CAAAL,OAAA,sBACA,IAAAM,aAAA,CAAAN,OAAA,qBAEA,IAAAO,4BAAA,CAAAP,OAAA,+CACA,IAAAQ,QAAA,CAAAR,OAAA,cAAqC,IAAAS,WAAA,CAAAT,OAAA,0BAAAU,YAAA,iHAAAX,wBAAAY,CAAA,CAAAC,CAAA,wBAAAC,OAAA,KAAAC,CAAA,KAAAD,OAAA,GAAAE,CAAA,KAAAF,OAAA,UAAAd,uBAAA,UAAAA,wBAAAY,CAAA,CAAAC,CAAA,MAAAA,CAAA,EAAAD,CAAA,EAAAA,CAAA,CAAAK,UAAA,QAAAL,CAAA,KAAAM,CAAA,CAAAC,CAAA,CAAAC,CAAA,EAAAC,SAAA,gBAAAT,CAAA,YAAAA,CAAA,YAAAU,OAAA,CAAAV,CAAA,sBAAAA,CAAA,QAAAQ,CAAA,IAAAF,CAAA,CAAAL,CAAA,CAAAG,CAAA,CAAAD,CAAA,KAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,SAAAM,CAAA,CAAAM,GAAA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R,CAAM,CACR,CAAsB,CACvB,CACI,CAAC,CAEZ,CAEA,GAAM,CAAAgF,MAAM,CAAG,GAAAoC,oCAAoB,EAAC,CAClCnC,IAAI,CAAE,CACJoC,IAAI,CAAE,C,CACP,CACDlC,QAAQ,CAAE,CACRY,eAAe,CAAE,qB,CAClB,CACDR,QAAQ,CAAE,CACR+B,aAAa,CAAE,K,CAChB,CACD9B,YAAY,CAAE,CACZ+B,KAAK,CAAE,KAAK,CACZC,QAAQ,CAAE,G,CACX,CACD3B,iBAAiB,CAAE,CACjB4B,YAAY,CAAE,EAAE,CAChBC,WAAW,CAAE,CAAC,CACdC,OAAO,CAAE,E,CACV,CACDvB,gBAAgB,CAAE,CAGhBrD,QAAQ,CAAE,UAAU,CACpB6E,KAAK,CAAE,CAAC,CACR5D,GAAG,CAAE,CAAC,CACN6D,MAAM,CAAE,C,EAEX,CAAC","ignoreList":[]}
|
|
@@ -1 +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.Questions=Questions;exports.sendSurveyShownEvent=exports.sendSurveyEvent=exports.dismissedSurveyEvent=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _react=_interopRequireWildcard(require("react"));var _surveysUtils=require("../surveys-utils");var _surveyShuffling=require("../survey-shuffling");var _core=require("@posthog/core");var _surveys=require("@posthog/core/surveys");var _QuestionTypes=require("./QuestionTypes");var _usePostHog=require("../../hooks/usePostHog");var _jsxRuntime=require("react/jsx-runtime");var _this=void 0,_jsxFileName="/home/runner/work/posthog-js/posthog-js/packages/react-native/dist/surveys/components/Surveys.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 buildConfiguredSurveyResponseProperties=function buildConfiguredSurveyResponseProperties(responses,survey){return(0,_surveys.buildSurveyResponseProperties)(responses,{questions:survey.questions.map(function(question,originalQuestionIndex){return _objectSpread(_objectSpread({},question),{},{originalQuestionIndex:originalQuestionIndex});})});};var sendSurveyShownEvent=exports.sendSurveyShownEvent=function sendSurveyShownEvent(survey,posthog,surveyLanguage){posthog.capture('survey shown',_objectSpread(_objectSpread(_objectSpread({$survey_name:survey.name,$survey_id:survey.id},(0,_core.maybeAdd)('$survey_iteration',survey.current_iteration)),(0,_core.maybeAdd)('$survey_iteration_start_date',survey.current_iteration_start_date)),surveyLanguage?(0,_defineProperty2["default"])({},_surveys.SURVEY_LANGUAGE_PROPERTY,surveyLanguage):{}));};var sendSurveyEvent=exports.sendSurveyEvent=function sendSurveyEvent(){var responses=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var survey=arguments.length>1?arguments[1]:undefined;var posthog=arguments.length>2?arguments[2]:undefined;var surveyLanguage=arguments.length>3?arguments[3]:undefined;posthog.capture('survey sent',_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({$survey_name:survey.name,$survey_id:survey.id},(0,_core.maybeAdd)('$survey_iteration',survey.current_iteration)),(0,_core.maybeAdd)('$survey_iteration_start_date',survey.current_iteration_start_date)),surveyLanguage?(0,_defineProperty2["default"])({},_surveys.SURVEY_LANGUAGE_PROPERTY,surveyLanguage):{}),buildConfiguredSurveyResponseProperties(responses,survey)),{},{$set:(0,_defineProperty2["default"])({},(0,_surveys.getSurveyInteractionProperty)(survey,'responded'),true)}));};var dismissedSurveyEvent=exports.dismissedSurveyEvent=function dismissedSurveyEvent(survey){var responses=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var posthog=arguments.length>2?arguments[2]:undefined;var surveyLanguage=arguments.length>3?arguments[3]:undefined;posthog.capture('survey dismissed',_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({$survey_name:survey.name,$survey_id:survey.id},(0,_core.maybeAdd)('$survey_iteration',survey.current_iteration)),(0,_core.maybeAdd)('$survey_iteration_start_date',survey.current_iteration_start_date)),surveyLanguage?(0,_defineProperty2["default"])({},_surveys.SURVEY_LANGUAGE_PROPERTY,surveyLanguage):{}),{},{$survey_partially_completed:(0,_surveys.surveyHasResponses)(responses)},buildConfiguredSurveyResponseProperties(responses,survey)),{},{$set:(0,_defineProperty2["default"])({},(0,_surveys.getSurveyInteractionProperty)(survey,'dismissed'),true)}));};function Questions(_ref4){var survey=_ref4.survey,surveyLanguage=_ref4.surveyLanguage,appearance=_ref4.appearance,styleOverrides=_ref4.styleOverrides,_ref4$responses=_ref4.responses,responses=_ref4$responses===void 0?{}:_ref4$responses,_ref4$onResponsesChan=_ref4.onResponsesChange,onResponsesChange=_ref4$onResponsesChan===void 0?function(){}:_ref4$onResponsesChan,onSubmit=_ref4.onSubmit;var _useState=(0,_react.useState)(0),_useState2=(0,_slicedToArray2["default"])(_useState,2),currentQuestionIndex=_useState2[0],setCurrentQuestionIndex=_useState2[1];var surveyQuestions=(0,_react.useMemo)(function(){return(0,_surveyShuffling.getDisplayOrderQuestions)(survey);},[survey]);var questionsAreShuffled=(0,_surveyShuffling.shouldShuffleQuestions)(survey);var posthog=(0,_usePostHog.usePostHog)();var onNextButtonClick=function onNextButtonClick(_ref5){var res=_ref5.res,originalQuestionIndex=_ref5.originalQuestionIndex,questionId=_ref5.questionId;var responseKey=(0,_surveys.getSurveyResponseKey)(questionId);var allResponses=_objectSpread(_objectSpread({},responses),{},(0,_defineProperty2["default"])({},responseKey,res));onResponsesChange(allResponses);if(questionsAreShuffled){if(currentQuestionIndex===surveyQuestions.length-1){sendSurveyEvent(allResponses,survey,posthog,surveyLanguage);onSubmit();}else{setCurrentQuestionIndex(function(index){return index+1;});}return;}var nextStep=(0,_surveysUtils.getNextSurveyStep)(survey,originalQuestionIndex,res);if(nextStep===_core.SurveyQuestionBranchingType.End){sendSurveyEvent(allResponses,survey,posthog,surveyLanguage);onSubmit();}else{setCurrentQuestionIndex(nextStep);}};var question=surveyQuestions[currentQuestionIndex];return getQuestionComponent({question:question,appearance:appearance,styleOverrides:styleOverrides,onSubmit:function onSubmit(res){return onNextButtonClick({res:res,originalQuestionIndex:question.originalQuestionIndex,questionId:question.id});}});}var getQuestionComponent=function getQuestionComponent(props){var questionComponents={open:_QuestionTypes.OpenTextQuestion,link:_QuestionTypes.LinkQuestion,rating:_QuestionTypes.RatingQuestion,multiple_choice:_QuestionTypes.MultipleChoiceQuestion,single_choice:_QuestionTypes.MultipleChoiceQuestion};var Component=questionComponents[props.question.type];return(0,_jsxRuntime.jsx)(Component,_objectSpread({},props),props.question.originalQuestionIndex);};
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _typeof=require("@babel/runtime/helpers/typeof");Object.defineProperty(exports,"__esModule",{value:true});exports.Questions=Questions;exports.sendSurveyShownEvent=exports.sendSurveyEvent=exports.dismissedSurveyEvent=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _react=_interopRequireWildcard(require("react"));var _surveysUtils=require("../surveys-utils");var _surveyShuffling=require("../survey-shuffling");var _core=require("@posthog/core");var _surveys=require("@posthog/core/surveys");var _QuestionTypes=require("./QuestionTypes");var _usePostHog=require("../../hooks/usePostHog");var _jsxRuntime=require("react/jsx-runtime");var _this=void 0,_jsxFileName="/home/runner/work/posthog-js/posthog-js/packages/react-native/dist/surveys/components/Surveys.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 buildConfiguredSurveyResponseProperties=function buildConfiguredSurveyResponseProperties(responses,survey){return(0,_surveys.buildSurveyResponseProperties)(responses,{questions:survey.questions.map(function(question,originalQuestionIndex){return _objectSpread(_objectSpread({},question),{},{originalQuestionIndex:originalQuestionIndex});})});};var sendSurveyShownEvent=exports.sendSurveyShownEvent=function sendSurveyShownEvent(survey,posthog,surveyLanguage){posthog.capture('survey shown',_objectSpread(_objectSpread(_objectSpread({$survey_name:survey.name,$survey_id:survey.id},(0,_core.maybeAdd)('$survey_iteration',survey.current_iteration)),(0,_core.maybeAdd)('$survey_iteration_start_date',survey.current_iteration_start_date)),surveyLanguage?(0,_defineProperty2["default"])({},_surveys.SURVEY_LANGUAGE_PROPERTY,surveyLanguage):{}));};var sendSurveyEvent=exports.sendSurveyEvent=function sendSurveyEvent(){var responses=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var survey=arguments.length>1?arguments[1]:undefined;var posthog=arguments.length>2?arguments[2]:undefined;var surveyLanguage=arguments.length>3?arguments[3]:undefined;posthog.capture('survey sent',_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({$survey_name:survey.name,$survey_id:survey.id},(0,_core.maybeAdd)('$survey_iteration',survey.current_iteration)),(0,_core.maybeAdd)('$survey_iteration_start_date',survey.current_iteration_start_date)),surveyLanguage?(0,_defineProperty2["default"])({},_surveys.SURVEY_LANGUAGE_PROPERTY,surveyLanguage):{}),buildConfiguredSurveyResponseProperties(responses,survey)),{},{$set:(0,_defineProperty2["default"])({},(0,_surveys.getSurveyInteractionProperty)(survey,'responded'),true)}));};var dismissedSurveyEvent=exports.dismissedSurveyEvent=function dismissedSurveyEvent(survey){var responses=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var posthog=arguments.length>2?arguments[2]:undefined;var surveyLanguage=arguments.length>3?arguments[3]:undefined;posthog.capture('survey dismissed',_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({$survey_name:survey.name,$survey_id:survey.id},(0,_core.maybeAdd)('$survey_iteration',survey.current_iteration)),(0,_core.maybeAdd)('$survey_iteration_start_date',survey.current_iteration_start_date)),surveyLanguage?(0,_defineProperty2["default"])({},_surveys.SURVEY_LANGUAGE_PROPERTY,surveyLanguage):{}),{},{$survey_partially_completed:(0,_surveys.surveyHasResponses)(responses)},buildConfiguredSurveyResponseProperties(responses,survey)),{},{$set:(0,_defineProperty2["default"])({},(0,_surveys.getSurveyInteractionProperty)(survey,'dismissed'),true)}));};function Questions(_ref4){var survey=_ref4.survey,surveyLanguage=_ref4.surveyLanguage,appearance=_ref4.appearance,styleOverrides=_ref4.styleOverrides,_ref4$responses=_ref4.responses,responses=_ref4$responses===void 0?{}:_ref4$responses,_ref4$onResponsesChan=_ref4.onResponsesChange,onResponsesChange=_ref4$onResponsesChan===void 0?function(){}:_ref4$onResponsesChan,onSubmit=_ref4.onSubmit;var _useState=(0,_react.useState)(0),_useState2=(0,_slicedToArray2["default"])(_useState,2),currentQuestionIndex=_useState2[0],setCurrentQuestionIndex=_useState2[1];var surveyQuestions=(0,_react.useMemo)(function(){return(0,_surveyShuffling.getDisplayOrderQuestions)(survey);},[survey]);var questionsAreShuffled=(0,_surveyShuffling.shouldShuffleQuestions)(survey);var posthog=(0,_usePostHog.usePostHog)();var onNextButtonClick=function onNextButtonClick(_ref5){var res=_ref5.res,originalQuestionIndex=_ref5.originalQuestionIndex,questionId=_ref5.questionId;var responseKey=(0,_surveys.getSurveyResponseKey)(questionId);var allResponses=_objectSpread(_objectSpread({},responses),{},(0,_defineProperty2["default"])({},responseKey,res));onResponsesChange(allResponses);if(questionsAreShuffled){if(currentQuestionIndex===surveyQuestions.length-1){sendSurveyEvent(allResponses,survey,posthog,surveyLanguage);onSubmit();}else{setCurrentQuestionIndex(function(index){return index+1;});}return;}var nextStep=(0,_surveysUtils.getNextSurveyStep)(survey,originalQuestionIndex,res);if(nextStep===_core.SurveyQuestionBranchingType.End){sendSurveyEvent(allResponses,survey,posthog,surveyLanguage);onSubmit();}else{setCurrentQuestionIndex(nextStep);}};var question=surveyQuestions[currentQuestionIndex];return getQuestionComponent({question:question,appearance:appearance,styleOverrides:styleOverrides,onSubmit:function onSubmit(res){return onNextButtonClick({res:res,originalQuestionIndex:question.originalQuestionIndex,questionId:question.id});}});}var getQuestionComponent=function getQuestionComponent(props){var questionComponents={open:_QuestionTypes.OpenTextQuestion,link:_QuestionTypes.LinkQuestion,rating:_QuestionTypes.RatingQuestion,multiple_choice:_QuestionTypes.MultipleChoiceQuestion,single_choice:_QuestionTypes.MultipleChoiceQuestion};var Component=questionComponents[props.question.type];return(0,_jsxRuntime.jsx)(Component,_objectSpread({},props),props.question.originalQuestionIndex);};
|
|
2
|
+
//# sourceMappingURL=Surveys.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Surveys.js","sourceRoot":"","sources":["../../../src/surveys/components/Surveys.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAGhD,OAAO,EAAE,iBAAiB,EAAyB,MAAM,kBAAkB,CAAA;AAC3E,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AACtF,OAAO,EAAgD,QAAQ,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAA;AACnH,OAAO,EACL,6BAA6B,EAC7B,4BAA4B,EAC5B,oBAAoB,EACpB,wBAAwB,EACxB,kBAAkB,GACnB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAExG,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAEnD,gFAAgF;AAChF,oFAAoF;AACpF,MAAM,uCAAuC,GAAG,CAAC,SAA0B,EAAE,MAAc,EAAE,EAAE,CAC7F,6BAA6B,CAAC,SAAS,EAAE;IACvC,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,qBAAqB,EAAE,EAA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,oBAAoB,GAAG,CAAC,KAAgC,EAAe,EAAE;IAC7E,MAAM,kBAAkB,GAAG;QACzB,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE,YAAY;QAClB,MAAM,EAAE,cAAc;QACtB,eAAe,EAAE,sBAAsB;QACvC,aAAa,EAAE,sBAAsB;KACtC,CAAA;IAED,MAAM,SAAS,GAAG,kBAAkB,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IAEzD,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC,IAAK,KAAa,CAAC,EAAG,CAAA;AACrF,CAAC,CAAA"}
|
|
1
|
+
{"version":3,"file":"Surveys.js","names":["_react","_interopRequireWildcard","require","_surveysUtils","_surveyShuffling","_core","_surveys","_QuestionTypes","_usePostHog","_jsxRuntime","_this","_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","buildConfiguredSurveyResponseProperties","responses","survey","buildSurveyResponseProperties","questions","map","question","originalQuestionIndex","sendSurveyShownEvent","exports","posthog","surveyLanguage","capture","$survey_name","name","$survey_id","id","maybeAdd","current_iteration","current_iteration_start_date","SURVEY_LANGUAGE_PROPERTY","sendSurveyEvent","undefined","$set","getSurveyInteractionProperty","dismissedSurveyEvent","$survey_partially_completed","surveyHasResponses","Questions","_ref4","appearance","styleOverrides","_ref4$responses","_ref4$onResponsesChan","onResponsesChange","onSubmit","_useState","useState","_useState2","_slicedToArray2","currentQuestionIndex","setCurrentQuestionIndex","surveyQuestions","useMemo","getDisplayOrderQuestions","questionsAreShuffled","shouldShuffleQuestions","usePostHog","onNextButtonClick","_ref5","res","questionId","responseKey","getSurveyResponseKey","allResponses","index","nextStep","getNextSurveyStep","SurveyQuestionBranchingType","End","getQuestionComponent","props","questionComponents","open","OpenTextQuestion","link","LinkQuestion","rating","RatingQuestion","multiple_choice","MultipleChoiceQuestion","single_choice","Component","type","jsx"],"sources":["../../../src/surveys/components/Surveys.tsx"],"sourcesContent":["import React, { useMemo, useState } from 'react'\nimport { StyleProp, ViewStyle } from 'react-native'\n\nimport { getNextSurveyStep, SurveyAppearanceTheme } from '../surveys-utils'\nimport { getDisplayOrderQuestions, shouldShuffleQuestions } from '../survey-shuffling'\nimport { Survey, SurveyQuestion, type SurveyResponses, maybeAdd, SurveyQuestionBranchingType } from '@posthog/core'\nimport {\n buildSurveyResponseProperties,\n getSurveyInteractionProperty,\n getSurveyResponseKey,\n SURVEY_LANGUAGE_PROPERTY,\n surveyHasResponses,\n} from '@posthog/core/surveys'\nimport { LinkQuestion, MultipleChoiceQuestion, OpenTextQuestion, RatingQuestion } from './QuestionTypes'\nimport { PostHog } from '../../posthog-rn'\nimport { usePostHog } from '../../hooks/usePostHog'\n\n// Events receive the configured survey, not its shuffled display copies. Supply\n// positional indices here so legacy response properties do not depend on rendering.\nconst buildConfiguredSurveyResponseProperties = (responses: SurveyResponses, survey: Survey) =>\n buildSurveyResponseProperties(responses, {\n questions: survey.questions.map((question, originalQuestionIndex) => ({\n ...question,\n originalQuestionIndex,\n })),\n })\n\nexport const sendSurveyShownEvent = (survey: Survey, posthog: PostHog, surveyLanguage?: string | null): void => {\n posthog.capture('survey shown', {\n $survey_name: survey.name,\n $survey_id: survey.id,\n ...maybeAdd('$survey_iteration', survey.current_iteration),\n ...maybeAdd('$survey_iteration_start_date', survey.current_iteration_start_date),\n ...(surveyLanguage ? { [SURVEY_LANGUAGE_PROPERTY]: surveyLanguage } : {}),\n })\n}\n\nexport const sendSurveyEvent = (\n responses: SurveyResponses = {},\n survey: Survey,\n posthog: PostHog,\n surveyLanguage?: string | null\n): void => {\n posthog.capture('survey sent', {\n $survey_name: survey.name,\n $survey_id: survey.id,\n ...maybeAdd('$survey_iteration', survey.current_iteration),\n ...maybeAdd('$survey_iteration_start_date', survey.current_iteration_start_date),\n ...(surveyLanguage ? { [SURVEY_LANGUAGE_PROPERTY]: surveyLanguage } : {}),\n ...buildConfiguredSurveyResponseProperties(responses, survey),\n $set: {\n [getSurveyInteractionProperty(survey, 'responded')]: true,\n },\n })\n}\n\nexport const dismissedSurveyEvent = (\n survey: Survey,\n responses: SurveyResponses = {},\n posthog: PostHog,\n surveyLanguage?: string | null\n): void => {\n posthog.capture('survey dismissed', {\n $survey_name: survey.name,\n $survey_id: survey.id,\n ...maybeAdd('$survey_iteration', survey.current_iteration),\n ...maybeAdd('$survey_iteration_start_date', survey.current_iteration_start_date),\n ...(surveyLanguage ? { [SURVEY_LANGUAGE_PROPERTY]: surveyLanguage } : {}),\n $survey_partially_completed: surveyHasResponses(responses),\n ...buildConfiguredSurveyResponseProperties(responses, survey),\n $set: {\n [getSurveyInteractionProperty(survey, 'dismissed')]: true,\n },\n })\n}\n\nexport function Questions({\n survey,\n surveyLanguage,\n appearance,\n styleOverrides,\n responses = {},\n onResponsesChange = () => {},\n onSubmit,\n}: {\n survey: Survey\n surveyLanguage?: string | null\n appearance: SurveyAppearanceTheme\n styleOverrides?: StyleProp<ViewStyle>\n responses?: SurveyResponses\n onResponsesChange?: (responses: SurveyResponses) => void\n onSubmit: () => void\n}): JSX.Element {\n const [currentQuestionIndex, setCurrentQuestionIndex] = useState(0)\n const surveyQuestions = useMemo(() => getDisplayOrderQuestions(survey), [survey])\n const questionsAreShuffled = shouldShuffleQuestions(survey)\n const posthog = usePostHog()\n\n const onNextButtonClick = ({\n res,\n originalQuestionIndex,\n questionId,\n }: {\n res: string | string[] | number | null\n originalQuestionIndex: number\n questionId: string\n }): void => {\n const responseKey = getSurveyResponseKey(questionId)\n\n const allResponses = {\n ...responses,\n [responseKey]: res,\n }\n onResponsesChange(allResponses)\n\n // Shuffled surveys cannot use branching and must advance through display order.\n // Non-shuffled surveys retain the configured/original-index branching semantics.\n if (questionsAreShuffled) {\n if (currentQuestionIndex === surveyQuestions.length - 1) {\n sendSurveyEvent(allResponses, survey, posthog, surveyLanguage)\n onSubmit()\n } else {\n setCurrentQuestionIndex((index) => index + 1)\n }\n return\n }\n\n const nextStep = getNextSurveyStep(survey, originalQuestionIndex, res)\n\n if (nextStep === SurveyQuestionBranchingType.End) {\n sendSurveyEvent(allResponses, survey, posthog, surveyLanguage)\n onSubmit()\n } else {\n setCurrentQuestionIndex(nextStep)\n }\n }\n\n const question = surveyQuestions[currentQuestionIndex]\n\n return getQuestionComponent({\n question,\n appearance,\n styleOverrides,\n onSubmit: (res) =>\n onNextButtonClick({\n res,\n originalQuestionIndex: question.originalQuestionIndex,\n questionId: question.id,\n }),\n })\n}\n\ntype GetQuestionComponentProps = {\n question: SurveyQuestion\n // The question components each declare `SurveyAppearanceTheme`; typing this\n // intermediate as the shared `SurveyAppearance` dropped every React\n // Native-only field, which the `as any` below then hid.\n appearance: SurveyAppearanceTheme\n styleOverrides?: StyleProp<ViewStyle>\n onSubmit: (res: string | string[] | number | null) => void\n}\n\nconst getQuestionComponent = (props: GetQuestionComponentProps): JSX.Element => {\n const questionComponents = {\n open: OpenTextQuestion,\n link: LinkQuestion,\n rating: RatingQuestion,\n multiple_choice: MultipleChoiceQuestion,\n single_choice: MultipleChoiceQuestion,\n }\n\n const Component = questionComponents[props.question.type]\n\n return <Component key={props.question.originalQuestionIndex} {...(props as any)} />\n}\n"],"mappings":"6fAAA,IAAAA,MAAA,CAAAC,uBAAA,CAAAC,OAAA,WAGA,IAAAC,aAAA,CAAAD,OAAA,qBACA,IAAAE,gBAAA,CAAAF,OAAA,wBACA,IAAAG,KAAA,CAAAH,OAAA,kBACA,IAAAI,QAAA,CAAAJ,OAAA,0BAOA,IAAAK,cAAA,CAAAL,OAAA,oBAEA,IAAAM,WAAA,CAAAN,OAAA,2BAAmD,IAAAO,WAAA,CAAAP,OAAA,0BAAAQ,KAAA,QAAAC,YAAA,6G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kBAAkB,CAACD,KAAK,CAACvD,QAAQ,CAACmE,IAAI,CAAC,CAEzD,MAAO,GAAA9G,WAAA,CAAA+G,GAAA,EAACF,SAAS,CAAA/E,aAAA,IAAiDoE,KAAa,EAAxDA,KAAK,CAACvD,QAAQ,CAACC,qBAA0C,CAAG,CACrF,CAAC","ignoreList":[]}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getActiveMatchingSurveys=getActiveMatchingSurveys;var _surveys=require("@posthog/core/surveys");var _nativeDeps=require("../native-deps");var _core=require("@posthog/core");var ANY_FLAG_VARIANT='any';function defaultMatchType(matchType){return matchType!==null&&matchType!==void 0?matchType:_core.SurveyMatchType.Icontains;}function doesSurveyDeviceTypesMatch(survey){var _a;if(!((_a=survey.conditions)===null||_a===void 0?void 0:_a.deviceTypes)||survey.conditions.deviceTypes.length===0){return true;}return _surveys.propertyComparisons[defaultMatchType(survey.conditions.deviceTypesMatchType)](survey.conditions.deviceTypes,[_nativeDeps.currentDeviceType]);}function isSurveyFlagEnabled(flagKey,flags){return flagKey?!!flags[flagKey]===true:true;}function getActiveMatchingSurveys(surveys,flags,seenSurveys,activatedSurveys){return surveys.filter(function(survey){var _a,_b,_c,_d,_e;if(!survey.start_date||survey.end_date){return false;}if(!doesSurveyDeviceTypesMatch(survey)){return false;}if(seenSurveys.includes((0,_surveys.getSurveyIterationKey)(survey))&&!(0,_surveys.canSurveyActivateRepeatedly)(survey)){return false;}if(((_a=survey.conditions)===null||_a===void 0?void 0:_a.url)&&survey.conditions.url!==''||((_b=survey.conditions)===null||_b===void 0?void 0:_b.selector)&&survey.conditions.selector!==''){return false;}if(!survey.linked_flag_key&&!survey.targeting_flag_key&&!survey.internal_targeting_flag_key&&!((_c=survey.feature_flag_keys)===null||_c===void 0?void 0:_c.length)){return true;}var linkedFlagCheck=isSurveyFlagEnabled(survey.linked_flag_key,flags);var linkedFlagVariant=(_d=survey.conditions)===null||_d===void 0?void 0:_d.linkedFlagVariant;var linkedFlagVariantCheck=true;if(linkedFlagVariant){linkedFlagVariantCheck=survey.linked_flag_key?flags[survey.linked_flag_key]===linkedFlagVariant||linkedFlagVariant===ANY_FLAG_VARIANT:true;}var targetingFlagCheck=isSurveyFlagEnabled(survey.targeting_flag_key,flags);var eventBasedTargetingFlagCheck=(0,_surveys.doesSurveyActivateByEvent)(survey)?activatedSurveys.has(survey.id):true;var internalTargetingFlagCheck=survey.internal_targeting_flag_key&&!(0,_surveys.canSurveyActivateRepeatedly)(survey)?isSurveyFlagEnabled(survey.internal_targeting_flag_key,flags):true;var flagsCheck=((_e=survey.feature_flag_keys)===null||_e===void 0?void 0:_e.length)?survey.feature_flag_keys.every(function(_ref){var key=_ref.key,value=_ref.value;return!key||!value||isSurveyFlagEnabled(value,flags);}):true;return linkedFlagCheck&&linkedFlagVariantCheck&&targetingFlagCheck&&internalTargetingFlagCheck&&eventBasedTargetingFlagCheck&&flagsCheck;});}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getActiveMatchingSurveys=getActiveMatchingSurveys;var _surveys=require("@posthog/core/surveys");var _nativeDeps=require("../native-deps");var _core=require("@posthog/core");var ANY_FLAG_VARIANT='any';function defaultMatchType(matchType){return matchType!==null&&matchType!==void 0?matchType:_core.SurveyMatchType.Icontains;}function doesSurveyDeviceTypesMatch(survey){var _a;if(!((_a=survey.conditions)===null||_a===void 0?void 0:_a.deviceTypes)||survey.conditions.deviceTypes.length===0){return true;}return _surveys.propertyComparisons[defaultMatchType(survey.conditions.deviceTypesMatchType)](survey.conditions.deviceTypes,[_nativeDeps.currentDeviceType]);}function isSurveyFlagEnabled(flagKey,flags){return flagKey?!!flags[flagKey]===true:true;}function getActiveMatchingSurveys(surveys,flags,seenSurveys,activatedSurveys){return surveys.filter(function(survey){var _a,_b,_c,_d,_e;if(!survey.start_date||survey.end_date){return false;}if(!doesSurveyDeviceTypesMatch(survey)){return false;}if(seenSurveys.includes((0,_surveys.getSurveyIterationKey)(survey))&&!(0,_surveys.canSurveyActivateRepeatedly)(survey)){return false;}if(((_a=survey.conditions)===null||_a===void 0?void 0:_a.url)&&survey.conditions.url!==''||((_b=survey.conditions)===null||_b===void 0?void 0:_b.selector)&&survey.conditions.selector!==''){return false;}if(!survey.linked_flag_key&&!survey.targeting_flag_key&&!survey.internal_targeting_flag_key&&!((_c=survey.feature_flag_keys)===null||_c===void 0?void 0:_c.length)){return true;}var linkedFlagCheck=isSurveyFlagEnabled(survey.linked_flag_key,flags);var linkedFlagVariant=(_d=survey.conditions)===null||_d===void 0?void 0:_d.linkedFlagVariant;var linkedFlagVariantCheck=true;if(linkedFlagVariant){linkedFlagVariantCheck=survey.linked_flag_key?flags[survey.linked_flag_key]===linkedFlagVariant||linkedFlagVariant===ANY_FLAG_VARIANT:true;}var targetingFlagCheck=isSurveyFlagEnabled(survey.targeting_flag_key,flags);var eventBasedTargetingFlagCheck=(0,_surveys.doesSurveyActivateByEvent)(survey)?activatedSurveys.has(survey.id):true;var internalTargetingFlagCheck=survey.internal_targeting_flag_key&&!(0,_surveys.canSurveyActivateRepeatedly)(survey)?isSurveyFlagEnabled(survey.internal_targeting_flag_key,flags):true;var flagsCheck=((_e=survey.feature_flag_keys)===null||_e===void 0?void 0:_e.length)?survey.feature_flag_keys.every(function(_ref){var key=_ref.key,value=_ref.value;return!key||!value||isSurveyFlagEnabled(value,flags);}):true;return linkedFlagCheck&&linkedFlagVariantCheck&&targetingFlagCheck&&internalTargetingFlagCheck&&eventBasedTargetingFlagCheck&&flagsCheck;});}
|
|
2
|
+
//# sourceMappingURL=getActiveMatchingSurveys.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getActiveMatchingSurveys.js","
|
|
1
|
+
{"version":3,"file":"getActiveMatchingSurveys.js","names":["_surveys","require","_nativeDeps","_core","ANY_FLAG_VARIANT","defaultMatchType","matchType","SurveyMatchType","Icontains","doesSurveyDeviceTypesMatch","survey","_a","conditions","deviceTypes","length","propertyComparisons","deviceTypesMatchType","currentDeviceType","isSurveyFlagEnabled","flagKey","flags","getActiveMatchingSurveys","surveys","seenSurveys","activatedSurveys","filter","start_date","end_date","includes","getSurveyIterationKey","canSurveyActivateRepeatedly","url","_b","selector","linked_flag_key","targeting_flag_key","internal_targeting_flag_key","_c","feature_flag_keys","linkedFlagCheck","linkedFlagVariant","_d","linkedFlagVariantCheck","targetingFlagCheck","eventBasedTargetingFlagCheck","doesSurveyActivateByEvent","has","id","internalTargetingFlagCheck","flagsCheck","_e","every","_ref","key","value"],"sources":["../../src/surveys/getActiveMatchingSurveys.ts"],"sourcesContent":["import {\n canSurveyActivateRepeatedly,\n doesSurveyActivateByEvent,\n getSurveyIterationKey,\n propertyComparisons,\n} from '@posthog/core/surveys'\nimport { currentDeviceType } from '../native-deps'\nimport { FeatureFlagValue, Survey, SurveyMatchType } from '@posthog/core'\n\nconst ANY_FLAG_VARIANT = 'any'\n\nfunction defaultMatchType(matchType?: SurveyMatchType): SurveyMatchType {\n return matchType ?? SurveyMatchType.Icontains\n}\n\nfunction doesSurveyDeviceTypesMatch(survey: Survey): boolean {\n if (!survey.conditions?.deviceTypes || survey.conditions.deviceTypes.length === 0) {\n return true\n }\n\n return propertyComparisons[defaultMatchType(survey.conditions.deviceTypesMatchType)](survey.conditions.deviceTypes, [\n currentDeviceType,\n ])\n}\n\nfunction isSurveyFlagEnabled(flagKey: string | undefined, flags: Record<string, FeatureFlagValue>): boolean {\n return flagKey ? !!flags[flagKey] === true : true\n}\n\nexport function getActiveMatchingSurveys(\n surveys: Survey[],\n flags: Record<string, FeatureFlagValue>,\n seenSurveys: string[],\n activatedSurveys: ReadonlySet<string>\n // lastSeenSurveyDate: Date | undefined\n): Survey[] {\n return surveys.filter((survey: Survey) => {\n // Is Active\n if (!survey.start_date || survey.end_date) {\n return false\n }\n\n // device type check\n if (!doesSurveyDeviceTypesMatch(survey)) {\n return false\n }\n\n if (seenSurveys.includes(getSurveyIterationKey(survey)) && !canSurveyActivateRepeatedly(survey)) {\n return false\n }\n\n // const surveyWaitPeriodInDays = survey.conditions?.seenSurveyWaitPeriodInDays\n // if (surveyWaitPeriodInDays && lastSeenSurveyDate) {\n // const today = new Date()\n // const diff = Math.abs(today.getTime() - lastSeenSurveyDate.getTime())\n // const diffDaysFromToday = Math.ceil(diff / (1000 * 3600 * 24))\n // if (diffDaysFromToday < surveyWaitPeriodInDays) {\n // return false\n // }\n // }\n\n // Skip surveys with URL or CSS selector conditions (not supported in React Native)\n if (\n (survey.conditions?.url && survey.conditions.url !== '') ||\n (survey.conditions?.selector && survey.conditions.selector !== '')\n ) {\n return false\n }\n\n if (\n !survey.linked_flag_key &&\n !survey.targeting_flag_key &&\n !survey.internal_targeting_flag_key &&\n !survey.feature_flag_keys?.length\n ) {\n // Survey is targeting All Users with no conditions\n return true\n }\n\n const linkedFlagCheck = isSurveyFlagEnabled(survey.linked_flag_key, flags)\n\n const linkedFlagVariant = survey.conditions?.linkedFlagVariant\n let linkedFlagVariantCheck = true\n if (linkedFlagVariant) {\n linkedFlagVariantCheck = survey.linked_flag_key\n ? flags[survey.linked_flag_key] === linkedFlagVariant || linkedFlagVariant === ANY_FLAG_VARIANT\n : true\n }\n\n const targetingFlagCheck = isSurveyFlagEnabled(survey.targeting_flag_key, flags)\n\n const eventBasedTargetingFlagCheck = doesSurveyActivateByEvent(survey) ? activatedSurveys.has(survey.id) : true\n\n const internalTargetingFlagCheck =\n survey.internal_targeting_flag_key && !canSurveyActivateRepeatedly(survey)\n ? isSurveyFlagEnabled(survey.internal_targeting_flag_key, flags)\n : true\n const flagsCheck = survey.feature_flag_keys?.length\n ? survey.feature_flag_keys.every(({ key, value }: { key: string; value?: string }) => {\n return !key || !value || isSurveyFlagEnabled(value, flags)\n })\n : true\n\n return (\n linkedFlagCheck &&\n linkedFlagVariantCheck &&\n targetingFlagCheck &&\n internalTargetingFlagCheck &&\n eventBasedTargetingFlagCheck &&\n flagsCheck\n )\n })\n}\n"],"mappings":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AgB,CAACsB,GAAG,CAACpC,MAAM,CAACqC,EAAE,CAAC,CAAG,IAAI,CAE/G,GAAM,CAAAC,0BAA0B,CAC9BtC,MAAM,CAAC0B,2BAA2B,EAAI,CAAC,GAAAN,oCAA2B,EAACpB,MAAM,CAAC,CACtEQ,mBAAmB,CAACR,MAAM,CAAC0B,2BAA2B,CAAEhB,KAAK,CAAC,CAC9D,IAAI,CACV,GAAM,CAAA6B,UAAU,CAAG,EAAAC,EAAA,CAAAxC,MAAM,CAAC4B,iBAAiB,UAAAY,EAAA,iBAAAA,EAAA,CAAEpC,MAAM,EAC/CJ,MAAM,CAAC4B,iBAAiB,CAACa,KAAK,CAAC,SAAAC,IAAA,CAAoD,IAAjD,CAAAC,GAAG,CAAAD,IAAA,CAAHC,GAAG,CAAEC,KAAK,CAAAF,IAAA,CAALE,KAAK,CAC1C,MAAO,CAACD,GAAG,EAAI,CAACC,KAAK,EAAIpC,mBAAmB,CAACoC,KAAK,CAAElC,KAAK,CAAC,CAC5D,CAAC,CAAC,CACF,IAAI,CAER,MACE,CAAAmB,eAAe,EACfG,sBAAsB,EACtBC,kBAAkB,EAClBK,0BAA0B,EAC1BJ,4BAA4B,EAC5BK,UAAU,CAEd,CAAC,CAAC,CACJ","ignoreList":[]}
|
package/dist/surveys/icons.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.VerySatisfiedEmoji=exports.VeryDissatisfiedEmoji=exports.ThumbsUpEmoji=exports.ThumbsDownEmoji=exports.SatisfiedEmoji=exports.NeutralEmoji=exports.DissatisfiedEmoji=exports.CheckSVG=exports.CancelSVG=void 0;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _OptionalReactNativeSvg=require("../optional/OptionalReactNativeSvg");var _safeStyleSheet=require("./safeStyleSheet");var _jsxRuntime=require("react/jsx-runtime");var _this=void 0,_jsxFileName="/home/runner/work/posthog-js/posthog-js/packages/react-native/dist/surveys/icons.js";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 Svg=_OptionalReactNativeSvg.OptionalReactNativeSvg===null||_OptionalReactNativeSvg.OptionalReactNativeSvg===void 0?void 0:_OptionalReactNativeSvg.OptionalReactNativeSvg.Svg;var Path=_OptionalReactNativeSvg.OptionalReactNativeSvg===null||_OptionalReactNativeSvg.OptionalReactNativeSvg===void 0?void 0:_OptionalReactNativeSvg.OptionalReactNativeSvg.Path;var getFallbackSize=function getFallbackSize(value,fallback){if(typeof value==='number'){return value;}if(typeof value==='string'){var parsed=Number.parseInt(value,10);return Number.isNaN(parsed)?fallback:parsed;}return fallback;};var getFallbackColor=function getFallbackColor(fill){return typeof fill==='string'&&fill!=='none'?fill:'black';};var getFallbackFontSize=function getFallbackFontSize(label,height){return label.length>1?Math.round(height*0.55):height;};var renderFallbackIcon=function renderFallbackIcon(_ref){var label=_ref.label,fill=_ref.fill,height=_ref.height;return(0,_jsxRuntime.jsx)(_reactNative.Text,{allowFontScaling:false,style:[styles.fallbackIcon,{color:getFallbackColor(fill),fontSize:getFallbackFontSize(label,height),height:height,lineHeight:height,width:height}],children:label});};var renderSvgIcon=function renderSvgIcon(_ref2){var props=_ref2.props,height=_ref2.height,width=_ref2.width,viewBox=_ref2.viewBox,pathProps=_ref2.pathProps,fallback=_ref2.fallback;var _a;if(!Svg||!Path){return renderFallbackIcon({label:fallback,fill:props.fill,height:getFallbackSize((_a=props.height)!==null&&_a!==void 0?_a:height,48)});}return(0,_jsxRuntime.jsx)(Svg,_objectSpread(_objectSpread({height:height,viewBox:viewBox,width:width},props),{},{children:(0,_jsxRuntime.jsx)(Path,_objectSpread({},pathProps))}));};var SatisfiedEmoji=exports.SatisfiedEmoji=function SatisfiedEmoji(props){return renderSvgIcon({props:props,height:'48',viewBox:'0 -960 960 960',width:'48',fallback:':)',pathProps:{d:'M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146 272q66 0 121.5-35.5T682-393h-52q-23 40-63 61.5T480.5-310q-46.5 0-87-21T331-393h-53q26 61 81 96.5T480-261Zm0 181q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z'}});};var NeutralEmoji=exports.NeutralEmoji=function NeutralEmoji(props){return renderSvgIcon({props:props,height:'48',viewBox:'0 -960 960 960',width:'48',fallback:':|',pathProps:{d:'M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm20 194h253v-49H354v49ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z'}});};var DissatisfiedEmoji=exports.DissatisfiedEmoji=function DissatisfiedEmoji(props){return renderSvgIcon({props:props,height:'48',viewBox:'0 -960 960 960',width:'48',fallback:':(',pathProps:{d:'M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146.174 116Q413-417 358.5-379.5T278-280h53q22-42 62.173-65t87.5-23Q528-368 567.5-344.5T630-280h52q-25-63-79.826-100-54.826-37-122-37ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z'}});};var VeryDissatisfiedEmoji=exports.VeryDissatisfiedEmoji=function VeryDissatisfiedEmoji(props){return renderSvgIcon({props:props,height:'48',viewBox:'0 -960 960 960',width:'48',fallback:'X(',pathProps:{d:'M480-417q-67 0-121.5 37.5T278-280h404q-25-63-80-100t-122-37Zm-183-72 50-45 45 45 31-36-45-45 45-45-31-36-45 45-50-45-31 36 45 45-45 45 31 36Zm272 0 44-45 51 45 31-36-45-45 45-45-31-36-51 45-44-45-31 36 44 45-44 45 31 36ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142 0 241-99t99-241q0-142-99-241t-241-99q-142 0-241 99t-99 241q0 142 99 241t241 99Z'}});};var VerySatisfiedEmoji=exports.VerySatisfiedEmoji=function VerySatisfiedEmoji(props){return renderSvgIcon({props:props,height:'48',viewBox:'0 -960 960 960',width:'48',fallback:':D',pathProps:{d:'M479.504-261Q537-261 585.5-287q48.5-26 78.5-72.4 6-11.6-.75-22.6-6.75-11-20.25-11H316.918Q303-393 296.5-382t-.5 22.6q30 46.4 78.5 72.4 48.5 26 105.004 26ZM347-578l27 27q7.636 8 17.818 8Q402-543 410-551q8-8 8-18t-8-18l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.636-8 17.818Q276-559 284-551q8 8 18 8t18-8l27-27Zm267 0 27 27q7.714 8 18 8t18-8q8-7.636 8-17.818Q685-579 677-587l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.714-8 18t8 18q7.636 8 17.818 8Q579-543 587-551l27-27ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z'}});};var ThumbsUpEmoji=exports.ThumbsUpEmoji=function ThumbsUpEmoji(props){return renderSvgIcon({props:props,height:'48',viewBox:'0 0 24 24',width:'48',fallback:'+',pathProps:{d:'M2 20h2c.55 0 1-.45 1-1v-9c0-.55-.45-1-1-1H2v11zm19.83-7.12c.11-.25.17-.52.17-.8V11c0-1.1-.9-2-2-2h-5.5l.92-4.65c.05-.22.02-.46-.08-.66-.23-.45-.52-.86-.88-1.22L14 2 7.59 8.41C7.21 8.79 7 9.3 7 9.83v7.84C7 18.95 8.05 20 9.34 20h8.11c.7 0 1.36-.37 1.72-.97l2.66-6.15z'}});};var ThumbsDownEmoji=exports.ThumbsDownEmoji=function ThumbsDownEmoji(props){return renderSvgIcon({props:props,height:'48',viewBox:'0 0 24 24',width:'48',fallback:'-',pathProps:{d:'M22 4h-2c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1h2V4zM2.17 11.12c-.11.25-.17.52-.17.8V13c0 1.1.9 2 2 2h5.5l-.92 4.65c-.05.22-.02.46.08.66.23.45.52.86.88 1.22L10 22l6.41-6.41c.38-.38.59-.89.59-1.42V6.34C17 5.05 15.95 4 14.66 4H6.55c-.7 0-1.36.37-1.72.97l-2.66 6.15z'}});};var CheckSVG=exports.CheckSVG=function CheckSVG(props){return renderSvgIcon({props:props,height:'16',viewBox:'0 0 16 12',width:'16',fallback:'v',pathProps:{d:'M5.30769 10.6923L4.77736 11.2226C4.91801 11.3633 5.10878 11.4423 5.30769 11.4423C5.5066 11.4423 5.69737 11.3633 5.83802 11.2226L5.30769 10.6923ZM15.5303 1.53033C15.8232 1.23744 15.8232 0.762563 15.5303 0.46967C15.2374 0.176777 14.7626 0.176777 14.4697 0.46967L15.5303 1.53033ZM1.53033 5.85429C1.23744 5.56139 0.762563 5.56139 0.46967 5.85429C0.176777 6.14718 0.176777 6.62205 0.46967 6.91495L1.53033 5.85429ZM5.83802 11.2226L15.5303 1.53033L14.4697 0.46967L4.77736 10.162L5.83802 11.2226ZM0.46967 6.91495L4.77736 11.2226L5.83802 10.162L1.53033 5.85429L0.46967 6.91495Z'}});};var CancelSVG=exports.CancelSVG=function CancelSVG(props){var _a;return renderSvgIcon({props:props,height:'12',viewBox:'0 0 12 12',width:'12',fallback:'x',pathProps:{fillRule:'evenodd',clipRule:'evenodd',d:'M0.164752 0.164752C0.384422 -0.0549175 0.740578 -0.0549175 0.960248 0.164752L6 5.20451L11.0398 0.164752C11.2594 -0.0549175 11.6156 -0.0549175 11.8352 0.164752C12.0549 0.384422 12.0549 0.740578 11.8352 0.960248L6.79549 6L11.8352 11.0398C12.0549 11.2594 12.0549 11.6156 11.8352 11.8352C11.6156 12.0549 11.2594 12.0549 11.0398 11.8352L6 6.79549L0.960248 11.8352C0.740578 12.0549 0.384422 12.0549 0.164752 11.8352C-0.0549175 11.6156 -0.0549175 11.2594 0.164752 11.0398L5.20451 6L0.164752 0.960248C-0.0549175 0.740578 -0.0549175 0.384422 0.164752 0.164752Z',fill:(_a=props.fill)!==null&&_a!==void 0?_a:'black'}});};var styles=(0,_safeStyleSheet.createSafeStyleSheet)({fallbackIcon:{textAlign:'center'}});
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.VerySatisfiedEmoji=exports.VeryDissatisfiedEmoji=exports.ThumbsUpEmoji=exports.ThumbsDownEmoji=exports.SatisfiedEmoji=exports.NeutralEmoji=exports.DissatisfiedEmoji=exports.CheckSVG=exports.CancelSVG=void 0;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _OptionalReactNativeSvg=require("../optional/OptionalReactNativeSvg");var _safeStyleSheet=require("./safeStyleSheet");var _jsxRuntime=require("react/jsx-runtime");var _this=void 0,_jsxFileName="/home/runner/work/posthog-js/posthog-js/packages/react-native/dist/surveys/icons.js";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 Svg=_OptionalReactNativeSvg.OptionalReactNativeSvg===null||_OptionalReactNativeSvg.OptionalReactNativeSvg===void 0?void 0:_OptionalReactNativeSvg.OptionalReactNativeSvg.Svg;var Path=_OptionalReactNativeSvg.OptionalReactNativeSvg===null||_OptionalReactNativeSvg.OptionalReactNativeSvg===void 0?void 0:_OptionalReactNativeSvg.OptionalReactNativeSvg.Path;var getFallbackSize=function getFallbackSize(value,fallback){if(typeof value==='number'){return value;}if(typeof value==='string'){var parsed=Number.parseInt(value,10);return Number.isNaN(parsed)?fallback:parsed;}return fallback;};var getFallbackColor=function getFallbackColor(fill){return typeof fill==='string'&&fill!=='none'?fill:'black';};var getFallbackFontSize=function getFallbackFontSize(label,height){return label.length>1?Math.round(height*0.55):height;};var renderFallbackIcon=function renderFallbackIcon(_ref){var label=_ref.label,fill=_ref.fill,height=_ref.height;return(0,_jsxRuntime.jsx)(_reactNative.Text,{allowFontScaling:false,style:[styles.fallbackIcon,{color:getFallbackColor(fill),fontSize:getFallbackFontSize(label,height),height:height,lineHeight:height,width:height}],children:label});};var renderSvgIcon=function renderSvgIcon(_ref2){var props=_ref2.props,height=_ref2.height,width=_ref2.width,viewBox=_ref2.viewBox,pathProps=_ref2.pathProps,fallback=_ref2.fallback;var _a;if(!Svg||!Path){return renderFallbackIcon({label:fallback,fill:props.fill,height:getFallbackSize((_a=props.height)!==null&&_a!==void 0?_a:height,48)});}return(0,_jsxRuntime.jsx)(Svg,_objectSpread(_objectSpread({height:height,viewBox:viewBox,width:width},props),{},{children:(0,_jsxRuntime.jsx)(Path,_objectSpread({},pathProps))}));};var SatisfiedEmoji=exports.SatisfiedEmoji=function SatisfiedEmoji(props){return renderSvgIcon({props:props,height:'48',viewBox:'0 -960 960 960',width:'48',fallback:':)',pathProps:{d:'M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146 272q66 0 121.5-35.5T682-393h-52q-23 40-63 61.5T480.5-310q-46.5 0-87-21T331-393h-53q26 61 81 96.5T480-261Zm0 181q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z'}});};var NeutralEmoji=exports.NeutralEmoji=function NeutralEmoji(props){return renderSvgIcon({props:props,height:'48',viewBox:'0 -960 960 960',width:'48',fallback:':|',pathProps:{d:'M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm20 194h253v-49H354v49ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z'}});};var DissatisfiedEmoji=exports.DissatisfiedEmoji=function DissatisfiedEmoji(props){return renderSvgIcon({props:props,height:'48',viewBox:'0 -960 960 960',width:'48',fallback:':(',pathProps:{d:'M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146.174 116Q413-417 358.5-379.5T278-280h53q22-42 62.173-65t87.5-23Q528-368 567.5-344.5T630-280h52q-25-63-79.826-100-54.826-37-122-37ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z'}});};var VeryDissatisfiedEmoji=exports.VeryDissatisfiedEmoji=function VeryDissatisfiedEmoji(props){return renderSvgIcon({props:props,height:'48',viewBox:'0 -960 960 960',width:'48',fallback:'X(',pathProps:{d:'M480-417q-67 0-121.5 37.5T278-280h404q-25-63-80-100t-122-37Zm-183-72 50-45 45 45 31-36-45-45 45-45-31-36-45 45-50-45-31 36 45 45-45 45 31 36Zm272 0 44-45 51 45 31-36-45-45 45-45-31-36-51 45-44-45-31 36 44 45-44 45 31 36ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142 0 241-99t99-241q0-142-99-241t-241-99q-142 0-241 99t-99 241q0 142 99 241t241 99Z'}});};var VerySatisfiedEmoji=exports.VerySatisfiedEmoji=function VerySatisfiedEmoji(props){return renderSvgIcon({props:props,height:'48',viewBox:'0 -960 960 960',width:'48',fallback:':D',pathProps:{d:'M479.504-261Q537-261 585.5-287q48.5-26 78.5-72.4 6-11.6-.75-22.6-6.75-11-20.25-11H316.918Q303-393 296.5-382t-.5 22.6q30 46.4 78.5 72.4 48.5 26 105.004 26ZM347-578l27 27q7.636 8 17.818 8Q402-543 410-551q8-8 8-18t-8-18l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.636-8 17.818Q276-559 284-551q8 8 18 8t18-8l27-27Zm267 0 27 27q7.714 8 18 8t18-8q8-7.636 8-17.818Q685-579 677-587l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.714-8 18t8 18q7.636 8 17.818 8Q579-543 587-551l27-27ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z'}});};var ThumbsUpEmoji=exports.ThumbsUpEmoji=function ThumbsUpEmoji(props){return renderSvgIcon({props:props,height:'48',viewBox:'0 0 24 24',width:'48',fallback:'+',pathProps:{d:'M2 20h2c.55 0 1-.45 1-1v-9c0-.55-.45-1-1-1H2v11zm19.83-7.12c.11-.25.17-.52.17-.8V11c0-1.1-.9-2-2-2h-5.5l.92-4.65c.05-.22.02-.46-.08-.66-.23-.45-.52-.86-.88-1.22L14 2 7.59 8.41C7.21 8.79 7 9.3 7 9.83v7.84C7 18.95 8.05 20 9.34 20h8.11c.7 0 1.36-.37 1.72-.97l2.66-6.15z'}});};var ThumbsDownEmoji=exports.ThumbsDownEmoji=function ThumbsDownEmoji(props){return renderSvgIcon({props:props,height:'48',viewBox:'0 0 24 24',width:'48',fallback:'-',pathProps:{d:'M22 4h-2c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1h2V4zM2.17 11.12c-.11.25-.17.52-.17.8V13c0 1.1.9 2 2 2h5.5l-.92 4.65c-.05.22-.02.46.08.66.23.45.52.86.88 1.22L10 22l6.41-6.41c.38-.38.59-.89.59-1.42V6.34C17 5.05 15.95 4 14.66 4H6.55c-.7 0-1.36.37-1.72.97l-2.66 6.15z'}});};var CheckSVG=exports.CheckSVG=function CheckSVG(props){return renderSvgIcon({props:props,height:'16',viewBox:'0 0 16 12',width:'16',fallback:'v',pathProps:{d:'M5.30769 10.6923L4.77736 11.2226C4.91801 11.3633 5.10878 11.4423 5.30769 11.4423C5.5066 11.4423 5.69737 11.3633 5.83802 11.2226L5.30769 10.6923ZM15.5303 1.53033C15.8232 1.23744 15.8232 0.762563 15.5303 0.46967C15.2374 0.176777 14.7626 0.176777 14.4697 0.46967L15.5303 1.53033ZM1.53033 5.85429C1.23744 5.56139 0.762563 5.56139 0.46967 5.85429C0.176777 6.14718 0.176777 6.62205 0.46967 6.91495L1.53033 5.85429ZM5.83802 11.2226L15.5303 1.53033L14.4697 0.46967L4.77736 10.162L5.83802 11.2226ZM0.46967 6.91495L4.77736 11.2226L5.83802 10.162L1.53033 5.85429L0.46967 6.91495Z'}});};var CancelSVG=exports.CancelSVG=function CancelSVG(props){var _a;return renderSvgIcon({props:props,height:'12',viewBox:'0 0 12 12',width:'12',fallback:'x',pathProps:{fillRule:'evenodd',clipRule:'evenodd',d:'M0.164752 0.164752C0.384422 -0.0549175 0.740578 -0.0549175 0.960248 0.164752L6 5.20451L11.0398 0.164752C11.2594 -0.0549175 11.6156 -0.0549175 11.8352 0.164752C12.0549 0.384422 12.0549 0.740578 11.8352 0.960248L6.79549 6L11.8352 11.0398C12.0549 11.2594 12.0549 11.6156 11.8352 11.8352C11.6156 12.0549 11.2594 12.0549 11.0398 11.8352L6 6.79549L0.960248 11.8352C0.740578 12.0549 0.384422 12.0549 0.164752 11.8352C-0.0549175 11.6156 -0.0549175 11.2594 0.164752 11.0398L5.20451 6L0.164752 0.960248C-0.0549175 0.740578 -0.0549175 0.384422 0.164752 0.164752Z',fill:(_a=props.fill)!==null&&_a!==void 0?_a:'black'}});};var styles=(0,_safeStyleSheet.createSafeStyleSheet)({fallbackIcon:{textAlign:'center'}});
|
|
2
|
+
//# sourceMappingURL=icons.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.js","sourceRoot":"","sources":["../../src/surveys/icons.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAc,MAAM,OAAO,CAAA;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAGnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAA;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAEvD,MAAM,GAAG,GAAG,sBAAsB,aAAtB,sBAAsB,uBAAtB,sBAAsB,CAAE,GAAgD,CAAA;AACpF,MAAM,IAAI,GAAG,sBAAsB,aAAtB,sBAAsB,uBAAtB,sBAAsB,CAAE,IAAgE,CAAA;AAErG,MAAM,eAAe,GAAG,CAAC,KAAc,EAAE,QAAgB,EAAU,EAAE;IACnE,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAA;IACd,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;QACzC,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAA;IACjD,CAAC;IAED,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAA;AAED,MAAM,gBAAgB,GAAG,CAAC,IAAa,EAAU,EAAE;IACjD,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO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,KAAK,CAAC,IAAI,mCAAI,OAAO;SAC5B;KACF,CAAC,CAAA;CAAA,CAAA;AAEJ,MAAM,MAAM,GAAG,oBAAoB,CAAC;IAClC,YAAY,EAAE;QACZ,SAAS,EAAE,QAAQ;KACpB;CACF,CAAC,CAAA"}
|
|
1
|
+
{"version":3,"file":"icons.js","names":["_react","_interopRequireDefault","require","_reactNative","_OptionalReactNativeSvg","_safeStyleSheet","_jsxRuntime","_this","_jsxFileName","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","Svg","OptionalReactNativeSvg","Path","getFallbackSize","value","fallback","parsed","Number","parseInt","isNaN","getFallbackColor","fill","getFallbackFontSize","label","height","Math","round","renderFallbackIcon","_ref","jsx","Text","allowFontScaling","style","styles","fallbackIcon","color","fontSize","lineHeight","width","children","renderSvgIcon","_ref2","props","viewBox","pathProps","_a","SatisfiedEmoji","exports","d","NeutralEmoji","DissatisfiedEmoji","VeryDissatisfiedEmoji","VerySatisfiedEmoji","ThumbsUpEmoji","ThumbsDownEmoji","CheckSVG","CancelSVG","fillRule","clipRule","createSafeStyleSheet","textAlign"],"sources":["../../src/surveys/icons.tsx"],"sourcesContent":["import React, { JSX } from 'react'\nimport { Text } from 'react-native'\nimport type { SvgProps } from 'react-native-svg'\n\nimport { OptionalReactNativeSvg } from '../optional/OptionalReactNativeSvg'\nimport { createSafeStyleSheet } from './safeStyleSheet'\n\nconst Svg = OptionalReactNativeSvg?.Svg as React.ComponentType<SvgProps> | undefined\nconst Path = OptionalReactNativeSvg?.Path as React.ComponentType<Record<string, unknown>> | undefined\n\nconst getFallbackSize = (value: unknown, fallback: number): number => {\n if (typeof value === 'number') {\n return value\n }\n\n if (typeof value === 'string') {\n const parsed = Number.parseInt(value, 10)\n return Number.isNaN(parsed) ? fallback : parsed\n }\n\n return fallback\n}\n\nconst getFallbackColor = (fill: unknown): string => {\n return typeof fill === 'string' && fill !== 'none' ? fill : 'black'\n}\n\nconst getFallbackFontSize = (label: string, height: number): number => {\n return label.length > 1 ? Math.round(height * 0.55) : height\n}\n\nconst renderFallbackIcon = ({\n label,\n fill,\n height,\n}: {\n label: string\n fill?: unknown\n height: number\n}): JSX.Element => (\n <Text\n allowFontScaling={false}\n style={[\n styles.fallbackIcon,\n {\n color: getFallbackColor(fill),\n fontSize: getFallbackFontSize(label, height),\n height,\n lineHeight: height,\n width: height,\n },\n ]}\n >\n {label}\n </Text>\n)\n\nconst renderSvgIcon = ({\n props,\n height,\n width,\n viewBox,\n pathProps,\n fallback,\n}: {\n props: SvgProps\n height: string\n width: string\n viewBox: string\n pathProps: Record<string, unknown>\n fallback: string\n}): JSX.Element => {\n if (!Svg || !Path) {\n return renderFallbackIcon({\n label: fallback,\n fill: (props as { fill?: unknown }).fill,\n height: getFallbackSize(props.height ?? height, 48),\n })\n }\n\n return (\n <Svg height={height} viewBox={viewBox} width={width} {...props}>\n <Path {...pathProps} />\n </Svg>\n )\n}\n\nexport const SatisfiedEmoji = (props: SvgProps): JSX.Element =>\n renderSvgIcon({\n props,\n height: '48',\n viewBox: '0 -960 960 960',\n width: '48',\n fallback: ':)',\n pathProps: {\n d: 'M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146 272q66 0 121.5-35.5T682-393h-52q-23 40-63 61.5T480.5-310q-46.5 0-87-21T331-393h-53q26 61 81 96.5T480-261Zm0 181q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z',\n },\n })\n\nexport const NeutralEmoji = (props: SvgProps): JSX.Element =>\n renderSvgIcon({\n props,\n height: '48',\n viewBox: '0 -960 960 960',\n width: '48',\n fallback: ':|',\n pathProps: {\n d: 'M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm20 194h253v-49H354v49ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z',\n },\n })\n\nexport const DissatisfiedEmoji = (props: SvgProps): JSX.Element =>\n renderSvgIcon({\n props,\n height: '48',\n viewBox: '0 -960 960 960',\n width: '48',\n fallback: ':(',\n pathProps: {\n d: 'M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146.174 116Q413-417 358.5-379.5T278-280h53q22-42 62.173-65t87.5-23Q528-368 567.5-344.5T630-280h52q-25-63-79.826-100-54.826-37-122-37ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z',\n },\n })\n\nexport const VeryDissatisfiedEmoji = (props: SvgProps): JSX.Element =>\n renderSvgIcon({\n props,\n height: '48',\n viewBox: '0 -960 960 960',\n width: '48',\n fallback: 'X(',\n pathProps: {\n d: 'M480-417q-67 0-121.5 37.5T278-280h404q-25-63-80-100t-122-37Zm-183-72 50-45 45 45 31-36-45-45 45-45-31-36-45 45-50-45-31 36 45 45-45 45 31 36Zm272 0 44-45 51 45 31-36-45-45 45-45-31-36-51 45-44-45-31 36 44 45-44 45 31 36ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142 0 241-99t99-241q0-142-99-241t-241-99q-142 0-241 99t-99 241q0 142 99 241t241 99Z',\n },\n })\n\nexport const VerySatisfiedEmoji = (props: SvgProps): JSX.Element =>\n renderSvgIcon({\n props,\n height: '48',\n viewBox: '0 -960 960 960',\n width: '48',\n fallback: ':D',\n pathProps: {\n d: 'M479.504-261Q537-261 585.5-287q48.5-26 78.5-72.4 6-11.6-.75-22.6-6.75-11-20.25-11H316.918Q303-393 296.5-382t-.5 22.6q30 46.4 78.5 72.4 48.5 26 105.004 26ZM347-578l27 27q7.636 8 17.818 8Q402-543 410-551q8-8 8-18t-8-18l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.636-8 17.818Q276-559 284-551q8 8 18 8t18-8l27-27Zm267 0 27 27q7.714 8 18 8t18-8q8-7.636 8-17.818Q685-579 677-587l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.714-8 18t8 18q7.636 8 17.818 8Q579-543 587-551l27-27ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z',\n },\n })\n\nexport const ThumbsUpEmoji = (props: SvgProps): JSX.Element =>\n renderSvgIcon({\n props,\n height: '48',\n viewBox: '0 0 24 24',\n width: '48',\n fallback: '+',\n pathProps: {\n d: 'M2 20h2c.55 0 1-.45 1-1v-9c0-.55-.45-1-1-1H2v11zm19.83-7.12c.11-.25.17-.52.17-.8V11c0-1.1-.9-2-2-2h-5.5l.92-4.65c.05-.22.02-.46-.08-.66-.23-.45-.52-.86-.88-1.22L14 2 7.59 8.41C7.21 8.79 7 9.3 7 9.83v7.84C7 18.95 8.05 20 9.34 20h8.11c.7 0 1.36-.37 1.72-.97l2.66-6.15z',\n },\n })\n\nexport const ThumbsDownEmoji = (props: SvgProps): JSX.Element =>\n renderSvgIcon({\n props,\n height: '48',\n viewBox: '0 0 24 24',\n width: '48',\n fallback: '-',\n pathProps: {\n d: 'M22 4h-2c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1h2V4zM2.17 11.12c-.11.25-.17.52-.17.8V13c0 1.1.9 2 2 2h5.5l-.92 4.65c-.05.22-.02.46.08.66.23.45.52.86.88 1.22L10 22l6.41-6.41c.38-.38.59-.89.59-1.42V6.34C17 5.05 15.95 4 14.66 4H6.55c-.7 0-1.36.37-1.72.97l-2.66 6.15z',\n },\n })\n\nexport const CheckSVG = (props: SvgProps): JSX.Element =>\n renderSvgIcon({\n props,\n height: '16',\n viewBox: '0 0 16 12',\n width: '16',\n fallback: 'v',\n pathProps: {\n d: 'M5.30769 10.6923L4.77736 11.2226C4.91801 11.3633 5.10878 11.4423 5.30769 11.4423C5.5066 11.4423 5.69737 11.3633 5.83802 11.2226L5.30769 10.6923ZM15.5303 1.53033C15.8232 1.23744 15.8232 0.762563 15.5303 0.46967C15.2374 0.176777 14.7626 0.176777 14.4697 0.46967L15.5303 1.53033ZM1.53033 5.85429C1.23744 5.56139 0.762563 5.56139 0.46967 5.85429C0.176777 6.14718 0.176777 6.62205 0.46967 6.91495L1.53033 5.85429ZM5.83802 11.2226L15.5303 1.53033L14.4697 0.46967L4.77736 10.162L5.83802 11.2226ZM0.46967 6.91495L4.77736 11.2226L5.83802 10.162L1.53033 5.85429L0.46967 6.91495Z',\n },\n })\n\nexport const CancelSVG = (props: SvgProps): JSX.Element =>\n renderSvgIcon({\n props,\n height: '12',\n viewBox: '0 0 12 12',\n width: '12',\n fallback: 'x',\n pathProps: {\n fillRule: 'evenodd',\n clipRule: 'evenodd',\n d: 'M0.164752 0.164752C0.384422 -0.0549175 0.740578 -0.0549175 0.960248 0.164752L6 5.20451L11.0398 0.164752C11.2594 -0.0549175 11.6156 -0.0549175 11.8352 0.164752C12.0549 0.384422 12.0549 0.740578 11.8352 0.960248L6.79549 6L11.8352 11.0398C12.0549 11.2594 12.0549 11.6156 11.8352 11.8352C11.6156 12.0549 11.2594 12.0549 11.0398 11.8352L6 6.79549L0.960248 11.8352C0.740578 12.0549 0.384422 12.0549 0.164752 11.8352C-0.0549175 11.6156 -0.0549175 11.2594 0.164752 11.0398L5.20451 6L0.164752 0.960248C-0.0549175 0.740578 -0.0549175 0.384422 0.164752 0.164752Z',\n fill: props.fill ?? 'black',\n },\n })\n\nconst styles = createSafeStyleSheet({\n fallbackIcon: {\n textAlign: 'center',\n },\n})\n"],"mappings":"8cAAA,IAAAA,MAAA,CAAAC,sBAAA,CAAAC,OAAA,WACA,IAAAC,YAAA,CAAAD,OAAA,iBAGA,IAAAE,uBAAA,CAAAF,OAAA,uCACA,IAAAG,eAAA,CAAAH,OAAA,qBAAuD,IAAAI,WAAA,CAAAJ,OAAA,0B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CACXvB,QAAQ,CAAE,GAAG,CACb6B,SAAS,CAAE,CACTa,QAAQ,CAAE,SAAS,CACnBC,QAAQ,CAAE,SAAS,CACnBV,CAAC,CAAE,yiBAAyiB,CAC5iB3B,IAAI,CAAE,CAAAwB,EAAA,CAAAH,KAAK,CAACrB,IAAI,UAAAwB,EAAA,UAAAA,EAAA,CAAI,O,EAEvB,CAAC,C,CAAA,CAEJ,GAAM,CAAAZ,MAAM,CAAG,GAAA0B,oCAAoB,EAAC,CAClCzB,YAAY,CAAE,CACZ0B,SAAS,CAAE,Q,EAEd,CAAC","ignoreList":[]}
|
package/dist/surveys/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"PostHogSurveyProvider",{enumerable:true,get:function get(){return _PostHogSurveyProvider.PostHogSurveyProvider;}});Object.defineProperty(exports,"Questions",{enumerable:true,get:function get(){return _Surveys.Questions;}});Object.defineProperty(exports,"SurveyModal",{enumerable:true,get:function get(){return _SurveyModal.SurveyModal;}});var _PostHogSurveyProvider=require("./PostHogSurveyProvider");var _SurveyModal=require("./components/SurveyModal");var _Surveys=require("./components/Surveys");
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"PostHogSurveyProvider",{enumerable:true,get:function get(){return _PostHogSurveyProvider.PostHogSurveyProvider;}});Object.defineProperty(exports,"Questions",{enumerable:true,get:function get(){return _Surveys.Questions;}});Object.defineProperty(exports,"SurveyModal",{enumerable:true,get:function get(){return _SurveyModal.SurveyModal;}});var _PostHogSurveyProvider=require("./PostHogSurveyProvider");var _SurveyModal=require("./components/SurveyModal");var _Surveys=require("./components/Surveys");
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_PostHogSurveyProvider","require","_SurveyModal","_Surveys"],"sources":["../../src/surveys/index.ts"],"sourcesContent":["export { PostHogSurveyProvider } from './PostHogSurveyProvider'\nexport type { PostHogSurveyProviderProps } from './PostHogSurveyProvider'\nexport { SurveyModal } from './components/SurveyModal'\nexport type { SurveyModalProps } from './components/SurveyModal'\nexport type { Survey } from '@posthog/core'\nexport type { SurveyAppearance, SurveyAppearanceTheme, SurveyTextRole } from './surveys-utils'\nexport { Questions } from './components/Surveys'\n"],"mappings":"wbAAA,IAAAA,sBAAA,CAAAC,OAAA,4BAEA,IAAAC,YAAA,CAAAD,OAAA,6BAIA,IAAAE,QAAA,CAAAF,OAAA","ignoreList":[]}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.createSafeStyleSheet=void 0;var _reactNative=require("react-native");var createSafeStyleSheet=exports.createSafeStyleSheet=function createSafeStyleSheet(styles){try{return typeof(_reactNative.StyleSheet===null||_reactNative.StyleSheet===void 0?void 0:_reactNative.StyleSheet.create)==='function'?_reactNative.StyleSheet.create(styles):styles;}catch(_a){return styles;}};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.createSafeStyleSheet=void 0;var _reactNative=require("react-native");var createSafeStyleSheet=exports.createSafeStyleSheet=function createSafeStyleSheet(styles){try{return typeof(_reactNative.StyleSheet===null||_reactNative.StyleSheet===void 0?void 0:_reactNative.StyleSheet.create)==='function'?_reactNative.StyleSheet.create(styles):styles;}catch(_a){return styles;}};
|
|
2
|
+
//# sourceMappingURL=safeStyleSheet.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safeStyleSheet.js","
|
|
1
|
+
{"version":3,"file":"safeStyleSheet.js","names":["_reactNative","require","createSafeStyleSheet","exports","styles","StyleSheet","create","_a"],"sources":["../../src/surveys/safeStyleSheet.ts"],"sourcesContent":["import { StyleSheet } from 'react-native'\n\n/**\n * `StyleSheet.create` that returns the raw style map when the React Native\n * `StyleSheet` runtime is unavailable (e.g. Jest `testEnvironment: node` without\n * the RN preset), instead of throwing at import.\n * See https://github.com/PostHog/posthog-js/issues/3740.\n */\nexport const createSafeStyleSheet = <T extends StyleSheet.NamedStyles<T>>(styles: T): T => {\n try {\n return typeof StyleSheet?.create === 'function' ? StyleSheet.create(styles) : styles\n } catch {\n return styles\n }\n}\n"],"mappings":"0GAAA,IAAAA,YAAA,CAAAC,OAAA,iBAQO,GAAM,CAAAC,oBAAoB,CAAAC,OAAA,CAAAD,oBAAA,CAAG,QAAvB,CAAAA,oBAAoBA,CAAyCE,MAAS,CAAO,CACxF,GAAI,CACF,MAAO,QAAOC,uBAAU,SAAVA,uBAAU,iBAAVA,uBAAU,CAAEC,MAAM,IAAK,UAAU,CAAGD,uBAAU,CAACC,MAAM,CAACF,MAAM,CAAC,CAAGA,MAAM,CACtF,CAAE,MAAAG,EAAA,CAAM,CACN,MAAO,CAAAH,MAAM,CACf,CACF,CAAC","ignoreList":[]}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
export { getDisplayOrderChoices, shuffle } from '@posthog/core/surveys';
|
|
2
|
+
import { Survey, SurveyQuestion } from '@posthog/core';
|
|
2
3
|
export declare const shouldShuffleQuestions: (survey: Survey) => boolean;
|
|
3
|
-
/**
|
|
4
|
-
* Fisher-Yates shuffle without mutating the input array.
|
|
5
|
-
*/
|
|
6
|
-
export declare const shuffle: <T>(array: readonly T[]) => T[];
|
|
7
4
|
export declare const getDisplayOrderQuestions: (survey: Survey) => SurveyQuestion[];
|
|
8
|
-
export declare const getDisplayOrderChoices: (question: MultipleSurveyQuestion) => string[];
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"getDisplayOrderChoices",{enumerable:true,get:function get(){return _surveys.getDisplayOrderChoices;}});exports.shouldShuffleQuestions=exports.getDisplayOrderQuestions=void 0;Object.defineProperty(exports,"shuffle",{enumerable:true,get:function get(){return _surveys.shuffle;}});var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _surveys=require("@posthog/core/surveys");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 hasBranching=function hasBranching(survey){return survey.questions.some(function(question){var _a;return!!((_a=question.branching)===null||_a===void 0?void 0:_a.type);});};var shouldShuffleQuestions=exports.shouldShuffleQuestions=function shouldShuffleQuestions(survey){var _a;var partialResponsesEnabled=survey.enable_partial_responses;return!!((_a=survey.appearance)===null||_a===void 0?void 0:_a.shuffleQuestions)&&!partialResponsesEnabled&&!hasBranching(survey);};var reverseIfUnshuffled=function reverseIfUnshuffled(unshuffled,shuffled){if(shuffled.length>1&&unshuffled.every(function(value,index){return value===shuffled[index];})){return shuffled.reverse();}return shuffled;};var getDisplayOrderQuestions=exports.getDisplayOrderQuestions=function getDisplayOrderQuestions(survey){var questions=survey.questions.map(function(question,originalQuestionIndex){return _objectSpread(_objectSpread({},question),{},{originalQuestionIndex:originalQuestionIndex});});if(!shouldShuffleQuestions(survey)){return questions;}return reverseIfUnshuffled(questions,(0,_surveys.shuffle)(questions));};
|
|
2
|
+
//# sourceMappingURL=survey-shuffling.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"survey-shuffling.js","
|
|
1
|
+
{"version":3,"file":"survey-shuffling.js","names":["_surveys","require","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","hasBranching","survey","questions","some","question","_a","branching","type","shouldShuffleQuestions","exports","partialResponsesEnabled","enable_partial_responses","appearance","shuffleQuestions","reverseIfUnshuffled","unshuffled","shuffled","every","value","index","reverse","getDisplayOrderQuestions","map","originalQuestionIndex","shuffle"],"sources":["../../src/surveys/survey-shuffling.ts"],"sourcesContent":["import { shuffle } from '@posthog/core/surveys'\nexport { getDisplayOrderChoices, shuffle } from '@posthog/core/surveys'\nimport { Survey, SurveyQuestion } from '@posthog/core'\n\ntype SurveyWithPartialResponses = Survey & {\n enable_partial_responses?: boolean | null\n}\n\nconst hasBranching = (survey: Survey): boolean => survey.questions.some((question) => !!question.branching?.type)\n\nexport const shouldShuffleQuestions = (survey: Survey): boolean => {\n const partialResponsesEnabled = (survey as SurveyWithPartialResponses).enable_partial_responses\n\n return !!survey.appearance?.shuffleQuestions && !partialResponsesEnabled && !hasBranching(survey)\n}\n\nconst reverseIfUnshuffled = <T>(unshuffled: readonly T[], shuffled: T[]): T[] => {\n if (shuffled.length > 1 && unshuffled.every((value, index) => value === shuffled[index])) {\n return shuffled.reverse()\n }\n\n return shuffled\n}\n\nexport const getDisplayOrderQuestions = (survey: Survey): SurveyQuestion[] => {\n const questions = survey.questions.map((question, originalQuestionIndex) => ({\n ...question,\n originalQuestionIndex,\n }))\n\n if (!shouldShuffleQuestions(survey)) {\n return questions\n }\n\n return reverseIfUnshuffled(questions, shuffle(questions))\n}\n"],"mappings":"4iBAAA,IAAAA,QAAA,CAAAC,OAAA,0BAA+C,SAAAC,QAAAC,CAAA,CAAAC,CAAA,MAAAC,CAAA,CAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,KAAAG,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sBA,CAAIP,MAAc,CAAa,C,OAChE,GAAM,CAAAS,uBAAuB,CAAIT,MAAqC,CAACU,wBAAwB,CAE/F,MAAO,CAAC,EAAC,CAAAN,EAAA,CAAAJ,MAAM,CAACW,UAAU,UAAAP,EAAA,iBAAAA,EAAA,CAAEQ,gBAAgB,GAAI,CAACH,uBAAuB,EAAI,CAACV,YAAY,CAACC,MAAM,CAAC,CACnG,CAAC,CAED,GAAM,CAAAa,mBAAmB,CAAG,QAAtB,CAAAA,mBAAmBA,CAAOC,UAAwB,CAAEC,QAAa,CAAS,CAC9E,GAAIA,QAAQ,CAACtB,MAAM,CAAG,CAAC,EAAIqB,UAAU,CAACE,KAAK,CAAC,SAACC,KAAK,CAAEC,KAAK,QAAK,CAAAD,KAAK,GAAKF,QAAQ,CAACG,KAAK,CAAC,GAAC,CAAE,CACxF,MAAO,CAAAH,QAAQ,CAACI,OAAO,EAAE,CAC3B,CAEA,MAAO,CAAAJ,QAAQ,CACjB,CAAC,CAEM,GAAM,CAAAK,wBAAwB,CAAAZ,OAAA,CAAAY,wBAAA,CAAG,QAA3B,CAAAA,wBAAwBA,CAAIpB,MAAc,CAAsB,CAC3E,GAAM,CAAAC,SAAS,CAAGD,MAAM,CAACC,SAAS,CAACoB,GAAG,CAAC,SAAClB,QAAQ,CAAEmB,qBAAqB,SAAA/B,aAAA,CAAAA,aAAA,IAClEY,QAAQ,MACXmB,qBAAqB,CAArBA,qBAAqB,IACrB,CAAC,CAEH,GAAI,CAACf,sBAAsB,CAACP,MAAM,CAAC,CAAE,CACnC,MAAO,CAAAC,SAAS,CAClB,CAEA,MAAO,CAAAY,mBAAmB,CAACZ,SAAS,CAAE,GAAAsB,gBAAO,EAACtB,SAAS,CAAC,CAAC,CAC3D,CAAC","ignoreList":[]}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.applySurveyTranslationForUser=applySurveyTranslationForUser;exports.detectUserLanguage=detectUserLanguage;var _core=require("@posthog/core");var _surveys=require("@posthog/core/surveys");var logger=(0,_core.createLogger)('[SurveyTranslations]');function getLogger(instance){return instance.isDebug?logger:undefined;}function detectUserLanguage(instance){return(0,_surveys.detectSurveyLanguage)({overrideLanguage:instance.getSurveyDisplayLanguageOverride(),storedPersonProperties:instance.getPersistedProperty(_core.PostHogPersistedProperty.PersonProperties),locale:instance.getCommonEventProperties().$locale},getLogger(instance));}function applySurveyTranslationForUser(survey,instance){var userLanguage=arguments.length>2&&arguments[2]!==undefined?arguments[2]:detectUserLanguage(instance);var logger=getLogger(instance);if(!userLanguage){logger===null||logger===void 0?void 0:logger.info('No user language detected');return{survey:survey,language:null};}var result=(0,_surveys.applySurveyTranslation)(survey,userLanguage,logger);return{survey:result.survey,language:result.matchedKey};}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.applySurveyTranslationForUser=applySurveyTranslationForUser;exports.detectUserLanguage=detectUserLanguage;var _core=require("@posthog/core");var _surveys=require("@posthog/core/surveys");var logger=(0,_core.createLogger)('[SurveyTranslations]');function getLogger(instance){return instance.isDebug?logger:undefined;}function detectUserLanguage(instance){return(0,_surveys.detectSurveyLanguage)({overrideLanguage:instance.getSurveyDisplayLanguageOverride(),storedPersonProperties:instance.getPersistedProperty(_core.PostHogPersistedProperty.PersonProperties),locale:instance.getCommonEventProperties().$locale},getLogger(instance));}function applySurveyTranslationForUser(survey,instance){var userLanguage=arguments.length>2&&arguments[2]!==undefined?arguments[2]:detectUserLanguage(instance);var logger=getLogger(instance);if(!userLanguage){logger===null||logger===void 0?void 0:logger.info('No user language detected');return{survey:survey,language:null};}var result=(0,_surveys.applySurveyTranslation)(survey,userLanguage,logger);return{survey:result.survey,language:result.matchedKey};}
|
|
2
|
+
//# sourceMappingURL=survey-translations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"survey-translations.js","
|
|
1
|
+
{"version":3,"file":"survey-translations.js","names":["_core","require","_surveys","logger","createLogger","getLogger","instance","isDebug","undefined","detectUserLanguage","detectSurveyLanguage","overrideLanguage","getSurveyDisplayLanguageOverride","storedPersonProperties","getPersistedProperty","PostHogPersistedProperty","PersonProperties","locale","getCommonEventProperties","$locale","applySurveyTranslationForUser","survey","userLanguage","arguments","length","info","language","result","applySurveyTranslation","matchedKey"],"sources":["../../src/surveys/survey-translations.ts"],"sourcesContent":["import { createLogger, Logger, PostHogPersistedProperty, Survey } from '@posthog/core'\nimport { applySurveyTranslation, detectSurveyLanguage } from '@posthog/core/surveys'\nimport { PostHog } from '../posthog-rn'\n\nconst logger = createLogger('[SurveyTranslations]')\n\nfunction getLogger(instance: PostHog): Logger | undefined {\n return instance.isDebug ? logger : undefined\n}\n\nexport function detectUserLanguage(instance: PostHog): string | null {\n return detectSurveyLanguage(\n {\n overrideLanguage: instance.getSurveyDisplayLanguageOverride(),\n storedPersonProperties: instance.getPersistedProperty(PostHogPersistedProperty.PersonProperties),\n locale: instance.getCommonEventProperties().$locale,\n },\n getLogger(instance)\n )\n}\n\nexport function applySurveyTranslationForUser(\n survey: Survey,\n instance: PostHog,\n userLanguage = detectUserLanguage(instance)\n): { survey: Survey; language: string | null } {\n const logger = getLogger(instance)\n\n if (!userLanguage) {\n logger?.info('No user language detected')\n return { survey, language: null }\n }\n\n const result = applySurveyTranslation(survey, userLanguage, logger)\n\n return {\n survey: result.survey,\n language: result.matchedKey,\n }\n}\n"],"mappings":"wLAAA,IAAAA,KAAA,CAAAC,OAAA,kBACA,IAAAC,QAAA,CAAAD,OAAA,0BAGA,GAAM,CAAAE,MAAM,CAAG,GAAAC,kBAAY,EAAC,sBAAsB,CAAC,CAEnD,QAAS,CAAAC,SAASA,CAACC,QAAiB,EAClC,MAAO,CAAAA,QAAQ,CAACC,OAAO,CAAGJ,MAAM,CAAGK,SAAS,CAC9C,CAEM,QAAU,CAAAC,kBAAkBA,CAACH,QAAiB,EAClD,MAAO,GAAAI,6BAAoB,EACzB,CACEC,gBAAgB,CAAEL,QAAQ,CAACM,gCAAgC,EAAE,CAC7DC,sBAAsB,CAAEP,QAAQ,CAACQ,oBAAoB,CAACC,8BAAwB,CAACC,gBAAgB,CAAC,CAChGC,MAAM,CAAEX,QAAQ,CAACY,wBAAwB,EAAE,CAACC,O,CAC7C,CACDd,SAAS,CAACC,QAAQ,CAAC,CACpB,CACH,CAEM,QAAU,CAAAc,6BAA6BA,CAC3CC,MAAc,CACdf,QAAiB,CAC0B,IAA3C,CAAAgB,YAAY,CAAAC,SAAA,CAAAC,MAAA,IAAAD,SAAA,MAAAf,SAAA,CAAAe,SAAA,IAAGd,kBAAkB,CAACH,QAAQ,CAAC,CAE3C,GAAM,CAAAH,MAAM,CAAGE,SAAS,CAACC,QAAQ,CAAC,CAElC,GAAI,CAACgB,YAAY,CAAE,CACjBnB,MAAM,SAANA,MAAM,iBAANA,MAAM,CAAEsB,IAAI,CAAC,2BAA2B,CAAC,CACzC,MAAO,CAAEJ,MAAM,CAANA,MAAM,CAAEK,QAAQ,CAAE,IAAI,CAAE,CACnC,CAEA,GAAM,CAAAC,MAAM,CAAG,GAAAC,+BAAsB,EAACP,MAAM,CAAEC,YAAY,CAAEnB,MAAM,CAAC,CAEnE,MAAO,CACLkB,MAAM,CAAEM,MAAM,CAACN,MAAM,CACrBK,QAAQ,CAAEC,MAAM,CAACE,U,CAClB,CACH","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Survey, SurveyQuestion, SurveyQuestionBranchingType,
|
|
1
|
+
import { Survey, SurveyQuestion, SurveyQuestionBranchingType, SurveyAppearance as CoreSurveyAppearance, SurveyQuestionDescriptionContentType } from '@posthog/core';
|
|
2
2
|
export type { PropertyFilters, PropertyOperator, SurveyEventWithFilters } from '@posthog/core';
|
|
3
3
|
export { isMatchingRegex, matchPropertyFilters, propertyComparisons as surveyValidationMap, } from '@posthog/core/surveys';
|
|
4
4
|
/**
|
|
@@ -101,11 +101,6 @@ export declare function resolveSurveyAlignment(position: string | undefined): {
|
|
|
101
101
|
horizontal: SurveyFlexAlign;
|
|
102
102
|
};
|
|
103
103
|
export declare const getDisplayOrderQuestions: (survey: Survey) => SurveyQuestion[];
|
|
104
|
-
/**
|
|
105
|
-
* Use the Fisher-yates algorithm to shuffle this array
|
|
106
|
-
* https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle
|
|
107
|
-
*/
|
|
108
|
-
export declare const getDisplayOrderChoices: (question: MultipleSurveyQuestion) => string[];
|
|
109
104
|
/**
|
|
110
105
|
* Determines the next question to show based on the survey's branching logic
|
|
111
106
|
* @param survey The survey object
|