posthog-react-native 3.15.0 → 3.15.1
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/lib/posthog-core/src/eventemitter.d.ts +8 -8
- package/lib/posthog-core/src/eventemitter.js +1 -0
- package/lib/posthog-core/src/eventemitter.js.map +1 -0
- package/lib/posthog-core/src/featureFlagUtils.d.ts +34 -34
- package/lib/posthog-core/src/featureFlagUtils.js +1 -0
- package/lib/posthog-core/src/featureFlagUtils.js.map +1 -0
- package/lib/posthog-core/src/index.d.ts +242 -239
- package/lib/posthog-core/src/index.js +1 -0
- package/lib/posthog-core/src/index.js.map +1 -0
- package/lib/posthog-core/src/lz-string.d.ts +8 -8
- package/lib/posthog-core/src/lz-string.js +1 -0
- package/lib/posthog-core/src/lz-string.js.map +1 -0
- package/lib/posthog-core/src/types.d.ts +422 -423
- package/lib/posthog-core/src/types.js +1 -0
- package/lib/posthog-core/src/types.js.map +1 -0
- package/lib/posthog-core/src/utils.d.ts +19 -19
- package/lib/posthog-core/src/utils.js +1 -0
- package/lib/posthog-core/src/utils.js.map +1 -0
- package/lib/posthog-core/src/vendor/uuidv7.d.ts +179 -179
- package/lib/posthog-core/src/vendor/uuidv7.js +7 -0
- package/lib/posthog-core/src/vendor/uuidv7.js.map +1 -0
- package/lib/posthog-react-native/index.d.ts +10 -10
- package/lib/posthog-react-native/index.js +1 -0
- package/lib/posthog-react-native/index.js.map +1 -0
- package/lib/posthog-react-native/src/PostHogContext.d.ts +5 -5
- package/lib/posthog-react-native/src/PostHogContext.js +1 -0
- package/lib/posthog-react-native/src/PostHogContext.js.map +1 -0
- package/lib/posthog-react-native/src/PostHogProvider.d.ts +14 -14
- package/lib/posthog-react-native/src/PostHogProvider.js +1 -0
- package/lib/posthog-react-native/src/PostHogProvider.js.map +1 -0
- package/lib/posthog-react-native/src/autocapture.d.ts +4 -4
- package/lib/posthog-react-native/src/autocapture.js +1 -0
- package/lib/posthog-react-native/src/autocapture.js.map +1 -0
- package/lib/posthog-react-native/src/frameworks/wix-navigation.d.ts +3 -3
- package/lib/posthog-react-native/src/frameworks/wix-navigation.js +1 -0
- package/lib/posthog-react-native/src/frameworks/wix-navigation.js.map +1 -0
- package/lib/posthog-react-native/src/hooks/useFeatureFlag.d.ts +5 -5
- package/lib/posthog-react-native/src/hooks/useFeatureFlag.js +1 -0
- package/lib/posthog-react-native/src/hooks/useFeatureFlag.js.map +1 -0
- package/lib/posthog-react-native/src/hooks/useFeatureFlags.d.ts +3 -3
- package/lib/posthog-react-native/src/hooks/useFeatureFlags.js +1 -0
- package/lib/posthog-react-native/src/hooks/useFeatureFlags.js.map +1 -0
- package/lib/posthog-react-native/src/hooks/useNavigationTracker.d.ts +6 -6
- package/lib/posthog-react-native/src/hooks/useNavigationTracker.js +1 -0
- package/lib/posthog-react-native/src/hooks/useNavigationTracker.js.map +1 -0
- package/lib/posthog-react-native/src/hooks/usePostHog.d.ts +2 -2
- package/lib/posthog-react-native/src/hooks/usePostHog.js +1 -0
- package/lib/posthog-react-native/src/hooks/usePostHog.js.map +1 -0
- package/lib/posthog-react-native/src/legacy.d.ts +4 -4
- package/lib/posthog-react-native/src/legacy.js +1 -0
- package/lib/posthog-react-native/src/legacy.js.map +1 -0
- package/lib/posthog-react-native/src/native-deps.d.ts +4 -4
- package/lib/posthog-react-native/src/native-deps.js +1 -0
- package/lib/posthog-react-native/src/native-deps.js.map +1 -0
- package/lib/posthog-react-native/src/optional/OptionalAsyncStorage.d.ts +2 -2
- package/lib/posthog-react-native/src/optional/OptionalAsyncStorage.js +1 -0
- package/lib/posthog-react-native/src/optional/OptionalAsyncStorage.js.map +1 -0
- package/lib/posthog-react-native/src/optional/OptionalExpoApplication.d.ts +2 -2
- package/lib/posthog-react-native/src/optional/OptionalExpoApplication.js +1 -0
- package/lib/posthog-react-native/src/optional/OptionalExpoApplication.js.map +1 -0
- package/lib/posthog-react-native/src/optional/OptionalExpoDevice.d.ts +2 -2
- package/lib/posthog-react-native/src/optional/OptionalExpoDevice.js +1 -0
- package/lib/posthog-react-native/src/optional/OptionalExpoDevice.js.map +1 -0
- package/lib/posthog-react-native/src/optional/OptionalExpoFileSystem.d.ts +2 -2
- package/lib/posthog-react-native/src/optional/OptionalExpoFileSystem.js +1 -0
- package/lib/posthog-react-native/src/optional/OptionalExpoFileSystem.js.map +1 -0
- package/lib/posthog-react-native/src/optional/OptionalExpoLocalization.d.ts +2 -2
- package/lib/posthog-react-native/src/optional/OptionalExpoLocalization.js +1 -0
- package/lib/posthog-react-native/src/optional/OptionalExpoLocalization.js.map +1 -0
- package/lib/posthog-react-native/src/optional/OptionalReactNativeDeviceInfo.d.ts +2 -2
- package/lib/posthog-react-native/src/optional/OptionalReactNativeDeviceInfo.js +1 -0
- package/lib/posthog-react-native/src/optional/OptionalReactNativeDeviceInfo.js.map +1 -0
- package/lib/posthog-react-native/src/optional/OptionalReactNativeLocalize.d.ts +13 -13
- package/lib/posthog-react-native/src/optional/OptionalReactNativeLocalize.js +1 -0
- package/lib/posthog-react-native/src/optional/OptionalReactNativeLocalize.js.map +1 -0
- package/lib/posthog-react-native/src/optional/OptionalReactNativeNavigation.d.ts +2 -2
- package/lib/posthog-react-native/src/optional/OptionalReactNativeNavigation.js +1 -0
- package/lib/posthog-react-native/src/optional/OptionalReactNativeNavigation.js.map +1 -0
- package/lib/posthog-react-native/src/optional/OptionalReactNativeNavigationWix.d.ts +2 -2
- package/lib/posthog-react-native/src/optional/OptionalReactNativeNavigationWix.js +1 -0
- package/lib/posthog-react-native/src/optional/OptionalReactNativeNavigationWix.js.map +1 -0
- package/lib/posthog-react-native/src/optional/OptionalReactNativeSafeArea.d.ts +2 -2
- package/lib/posthog-react-native/src/optional/OptionalReactNativeSafeArea.js +1 -0
- package/lib/posthog-react-native/src/optional/OptionalReactNativeSafeArea.js.map +1 -0
- package/lib/posthog-react-native/src/optional/OptionalSessionReplay.d.ts +2 -2
- package/lib/posthog-react-native/src/optional/OptionalSessionReplay.js +1 -0
- package/lib/posthog-react-native/src/optional/OptionalSessionReplay.js.map +1 -0
- package/lib/posthog-react-native/src/posthog-rn.d.ts +71 -71
- package/lib/posthog-react-native/src/posthog-rn.js +1 -0
- package/lib/posthog-react-native/src/posthog-rn.js.map +1 -0
- package/lib/posthog-react-native/src/storage.d.ts +21 -21
- package/lib/posthog-react-native/src/storage.js +1 -0
- package/lib/posthog-react-native/src/storage.js.map +1 -0
- package/lib/posthog-react-native/src/surveys/PostHogSurveyProvider.d.ts +16 -16
- package/lib/posthog-react-native/src/surveys/PostHogSurveyProvider.js +1 -0
- package/lib/posthog-react-native/src/surveys/PostHogSurveyProvider.js.map +1 -0
- package/lib/posthog-react-native/src/surveys/components/BottomSection.d.ts +9 -9
- package/lib/posthog-react-native/src/surveys/components/BottomSection.js +1 -0
- package/lib/posthog-react-native/src/surveys/components/BottomSection.js.map +1 -0
- package/lib/posthog-react-native/src/surveys/components/Cancel.d.ts +6 -6
- package/lib/posthog-react-native/src/surveys/components/Cancel.js +1 -0
- package/lib/posthog-react-native/src/surveys/components/Cancel.js.map +1 -0
- package/lib/posthog-react-native/src/surveys/components/ConfirmationMessage.d.ts +13 -13
- package/lib/posthog-react-native/src/surveys/components/ConfirmationMessage.js +1 -0
- package/lib/posthog-react-native/src/surveys/components/ConfirmationMessage.js.map +1 -0
- package/lib/posthog-react-native/src/surveys/components/QuestionHeader.d.ts +7 -7
- package/lib/posthog-react-native/src/surveys/components/QuestionHeader.js +1 -0
- package/lib/posthog-react-native/src/surveys/components/QuestionHeader.js.map +1 -0
- package/lib/posthog-react-native/src/surveys/components/QuestionTypes.d.ts +27 -27
- package/lib/posthog-react-native/src/surveys/components/QuestionTypes.js +1 -0
- package/lib/posthog-react-native/src/surveys/components/QuestionTypes.js.map +1 -0
- package/lib/posthog-react-native/src/surveys/components/SurveyModal.d.ts +10 -10
- package/lib/posthog-react-native/src/surveys/components/SurveyModal.js +1 -0
- package/lib/posthog-react-native/src/surveys/components/SurveyModal.js.map +1 -0
- package/lib/posthog-react-native/src/surveys/components/Surveys.d.ts +14 -14
- package/lib/posthog-react-native/src/surveys/components/Surveys.js +1 -0
- package/lib/posthog-react-native/src/surveys/components/Surveys.js.map +1 -0
- package/lib/posthog-react-native/src/surveys/getActiveMatchingSurveys.d.ts +2 -2
- package/lib/posthog-react-native/src/surveys/getActiveMatchingSurveys.js +1 -0
- package/lib/posthog-react-native/src/surveys/getActiveMatchingSurveys.js.map +1 -0
- package/lib/posthog-react-native/src/surveys/icons.d.ts +8 -10
- package/lib/posthog-react-native/src/surveys/icons.js +1 -0
- package/lib/posthog-react-native/src/surveys/icons.js.map +1 -0
- package/lib/posthog-react-native/src/surveys/index.d.ts +6 -6
- package/lib/posthog-react-native/src/surveys/index.js +1 -0
- package/lib/posthog-react-native/src/surveys/index.js.map +1 -0
- package/lib/posthog-react-native/src/surveys/surveys-utils.d.ts +13 -13
- package/lib/posthog-react-native/src/surveys/surveys-utils.js +1 -0
- package/lib/posthog-react-native/src/surveys/surveys-utils.js.map +1 -0
- package/lib/posthog-react-native/src/surveys/useActivatedSurveys.d.ts +3 -3
- package/lib/posthog-react-native/src/surveys/useActivatedSurveys.js +1 -0
- package/lib/posthog-react-native/src/surveys/useActivatedSurveys.js.map +1 -0
- package/lib/posthog-react-native/src/surveys/useSurveyStorage.d.ts +8 -8
- package/lib/posthog-react-native/src/surveys/useSurveyStorage.js +1 -0
- package/lib/posthog-react-native/src/surveys/useSurveyStorage.js.map +1 -0
- package/lib/posthog-react-native/src/types.d.ts +112 -112
- package/lib/posthog-react-native/src/types.js +1 -0
- package/lib/posthog-react-native/src/types.js.map +1 -0
- package/lib/posthog-react-native/src/version.d.ts +1 -1
- package/lib/posthog-react-native/src/version.js +1 -0
- package/lib/posthog-react-native/src/version.js.map +1 -0
- package/lib/posthog-react-native/tsconfig.tsbuildinfo +1 -0
- package/package.json +8 -9
- package/lib/index.cjs.js +0 -4677
- package/lib/index.cjs.js.map +0 -1
- package/lib/index.d.ts +0 -875
- package/lib/index.esm.js +0 -4659
- package/lib/index.esm.js.map +0 -1
- package/lib/posthog-react-native/test/test-utils.d.ts +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { PostHogSurveyProvider } from './PostHogSurveyProvider';
|
|
2
|
-
export type { PostHogSurveyProviderProps } from './PostHogSurveyProvider';
|
|
3
|
-
export { SurveyModal } from './components/SurveyModal';
|
|
4
|
-
export type { SurveyModalProps } from './components/SurveyModal';
|
|
5
|
-
export type { Survey, SurveyAppearance } from '../../../posthog-core/src';
|
|
6
|
-
export { Questions } from './components/Surveys';
|
|
1
|
+
export { PostHogSurveyProvider } from './PostHogSurveyProvider';
|
|
2
|
+
export type { PostHogSurveyProviderProps } from './PostHogSurveyProvider';
|
|
3
|
+
export { SurveyModal } from './components/SurveyModal';
|
|
4
|
+
export type { SurveyModalProps } from './components/SurveyModal';
|
|
5
|
+
export type { Survey, SurveyAppearance } from '../../../posthog-core/src';
|
|
6
|
+
export { Questions } from './components/Surveys';
|
|
@@ -0,0 +1 @@
|
|
|
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");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/surveys/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAGtD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { MultipleSurveyQuestion, Survey, SurveyAppearance, SurveyQuestion } from '../../../posthog-core/src';
|
|
2
|
-
export declare const defaultBackgroundColor: "#eeeded";
|
|
3
|
-
export type SurveyAppearanceTheme = Omit<Required<SurveyAppearance>, 'widgetSelector' | 'widgetType' | 'widgetColor' | 'widgetLabel' | 'shuffleQuestions'>;
|
|
4
|
-
export declare const defaultSurveyAppearance: SurveyAppearanceTheme;
|
|
5
|
-
export declare const getDisplayOrderQuestions: (survey: Survey) => SurveyQuestion[];
|
|
6
|
-
export declare const hasEvents: (survey: Survey) => boolean;
|
|
7
|
-
export declare const canActivateRepeatedly: (survey: Survey) => boolean;
|
|
8
|
-
/**
|
|
9
|
-
* Use the Fisher-yates algorithm to shuffle this array
|
|
10
|
-
* https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle
|
|
11
|
-
*/
|
|
12
|
-
export declare const getDisplayOrderChoices: (question: MultipleSurveyQuestion) => string[];
|
|
13
|
-
export declare function getContrastingTextColor(color: string): 'black' | 'white';
|
|
1
|
+
import { MultipleSurveyQuestion, Survey, SurveyAppearance, SurveyQuestion } from '../../../posthog-core/src';
|
|
2
|
+
export declare const defaultBackgroundColor: "#eeeded";
|
|
3
|
+
export type SurveyAppearanceTheme = Omit<Required<SurveyAppearance>, 'widgetSelector' | 'widgetType' | 'widgetColor' | 'widgetLabel' | 'shuffleQuestions'>;
|
|
4
|
+
export declare const defaultSurveyAppearance: SurveyAppearanceTheme;
|
|
5
|
+
export declare const getDisplayOrderQuestions: (survey: Survey) => SurveyQuestion[];
|
|
6
|
+
export declare const hasEvents: (survey: Survey) => boolean;
|
|
7
|
+
export declare const canActivateRepeatedly: (survey: Survey) => boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Use the Fisher-yates algorithm to shuffle this array
|
|
10
|
+
* https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle
|
|
11
|
+
*/
|
|
12
|
+
export declare const getDisplayOrderChoices: (question: MultipleSurveyQuestion) => string[];
|
|
13
|
+
export declare function getContrastingTextColor(color: string): 'black' | 'white';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.defaultSurveyAppearance=exports.defaultBackgroundColor=exports.canActivateRepeatedly=void 0;exports.getContrastingTextColor=getContrastingTextColor;exports.hasEvents=exports.getDisplayOrderQuestions=exports.getDisplayOrderChoices=void 0;var _src=require("../../../posthog-core/src");var defaultBackgroundColor=exports.defaultBackgroundColor='#eeeded';var defaultSurveyAppearance=exports.defaultSurveyAppearance={backgroundColor:defaultBackgroundColor,submitButtonColor:'black',submitButtonTextColor:'white',ratingButtonColor:'white',ratingButtonActiveColor:'black',borderColor:'#c9c6c6',placeholder:'Start typing...',displayThankYouMessage:true,thankYouMessageHeader:'Thank you for your feedback!',position:_src.SurveyPosition.Right,submitButtonText:'Submit',autoDisappear:false,thankYouMessageDescription:'',thankYouMessageDescriptionContentType:_src.SurveyQuestionDescriptionContentType.Text,thankYouMessageCloseButtonText:'Close',surveyPopupDelaySeconds:0};var getDisplayOrderQuestions=exports.getDisplayOrderQuestions=function getDisplayOrderQuestions(survey){survey.questions.forEach(function(question,idx){question.originalQuestionIndex=idx;});return survey.questions;};var hasEvents=exports.hasEvents=function hasEvents(survey){var _a,_b;return((_b=(_a=survey.conditions)===null||_a===void 0?void 0:_a.events)===null||_b===void 0?void 0:_b.values)!==undefined&&survey.conditions.events.values.length>0;};var canActivateRepeatedly=exports.canActivateRepeatedly=function canActivateRepeatedly(survey){var _a,_b;return!!(((_b=(_a=survey.conditions)===null||_a===void 0?void 0:_a.events)===null||_b===void 0?void 0:_b.repeatedActivation)&&hasEvents(survey));};var getDisplayOrderChoices=exports.getDisplayOrderChoices=function getDisplayOrderChoices(question){return question.choices;};function getContrastingTextColor(color){var rgb;if(color.startsWith('#')){rgb=hex2rgb(color);}if(color.startsWith('rgb')){rgb=color;}var nameColorToHex=nameToHex(color);if(nameColorToHex){rgb=hex2rgb(nameColorToHex);}if(!rgb){return'black';}var colorMatch=rgb.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(colorMatch){var r=parseInt(colorMatch[1],10);var g=parseInt(colorMatch[2],10);var b=parseInt(colorMatch[3],10);var hsp=Math.sqrt(0.299*(r*r)+0.587*(g*g)+0.114*(b*b));return hsp>127.5?'black':'white';}return'black';}function hex2rgb(c){if(c.startsWith('#')){var hexColor=c.replace(/^#/,'');if(!/^[0-9A-Fa-f]{6}$/.test(hexColor)){return'rgb(255, 255, 255)';}var r=parseInt(hexColor.slice(0,2),16);var g=parseInt(hexColor.slice(2,4),16);var b=parseInt(hexColor.slice(4,6),16);return"rgb(".concat(r,",").concat(g,",").concat(b,")");}return'rgb(255, 255, 255)';}function nameToHex(name){return{aliceblue:'#f0f8ff',antiquewhite:'#faebd7',aqua:'#00ffff',aquamarine:'#7fffd4',azure:'#f0ffff',beige:'#f5f5dc',bisque:'#ffe4c4',black:'#000000',blanchedalmond:'#ffebcd',blue:'#0000ff',blueviolet:'#8a2be2',brown:'#a52a2a',burlywood:'#deb887',cadetblue:'#5f9ea0',chartreuse:'#7fff00',chocolate:'#d2691e',coral:'#ff7f50',cornflowerblue:'#6495ed',cornsilk:'#fff8dc',crimson:'#dc143c',cyan:'#00ffff',darkblue:'#00008b',darkcyan:'#008b8b',darkgoldenrod:'#b8860b',darkgray:'#a9a9a9',darkgreen:'#006400',darkkhaki:'#bdb76b',darkmagenta:'#8b008b',darkolivegreen:'#556b2f',darkorange:'#ff8c00',darkorchid:'#9932cc',darkred:'#8b0000',darksalmon:'#e9967a',darkseagreen:'#8fbc8f',darkslateblue:'#483d8b',darkslategray:'#2f4f4f',darkturquoise:'#00ced1',darkviolet:'#9400d3',deeppink:'#ff1493',deepskyblue:'#00bfff',dimgray:'#696969',dodgerblue:'#1e90ff',firebrick:'#b22222',floralwhite:'#fffaf0',forestgreen:'#228b22',fuchsia:'#ff00ff',gainsboro:'#dcdcdc',ghostwhite:'#f8f8ff',gold:'#ffd700',goldenrod:'#daa520',gray:'#808080',green:'#008000',greenyellow:'#adff2f',honeydew:'#f0fff0',hotpink:'#ff69b4','indianred ':'#cd5c5c',indigo:'#4b0082',ivory:'#fffff0',khaki:'#f0e68c',lavender:'#e6e6fa',lavenderblush:'#fff0f5',lawngreen:'#7cfc00',lemonchiffon:'#fffacd',lightblue:'#add8e6',lightcoral:'#f08080',lightcyan:'#e0ffff',lightgoldenrodyellow:'#fafad2',lightgrey:'#d3d3d3',lightgreen:'#90ee90',lightpink:'#ffb6c1',lightsalmon:'#ffa07a',lightseagreen:'#20b2aa',lightskyblue:'#87cefa',lightslategray:'#778899',lightsteelblue:'#b0c4de',lightyellow:'#ffffe0',lime:'#00ff00',limegreen:'#32cd32',linen:'#faf0e6',magenta:'#ff00ff',maroon:'#800000',mediumaquamarine:'#66cdaa',mediumblue:'#0000cd',mediumorchid:'#ba55d3',mediumpurple:'#9370d8',mediumseagreen:'#3cb371',mediumslateblue:'#7b68ee',mediumspringgreen:'#00fa9a',mediumturquoise:'#48d1cc',mediumvioletred:'#c71585',midnightblue:'#191970',mintcream:'#f5fffa',mistyrose:'#ffe4e1',moccasin:'#ffe4b5',navajowhite:'#ffdead',navy:'#000080',oldlace:'#fdf5e6',olive:'#808000',olivedrab:'#6b8e23',orange:'#ffa500',orangered:'#ff4500',orchid:'#da70d6',palegoldenrod:'#eee8aa',palegreen:'#98fb98',paleturquoise:'#afeeee',palevioletred:'#d87093',papayawhip:'#ffefd5',peachpuff:'#ffdab9',peru:'#cd853f',pink:'#ffc0cb',plum:'#dda0dd',powderblue:'#b0e0e6',purple:'#800080',red:'#ff0000',rosybrown:'#bc8f8f',royalblue:'#4169e1',saddlebrown:'#8b4513',salmon:'#fa8072',sandybrown:'#f4a460',seagreen:'#2e8b57',seashell:'#fff5ee',sienna:'#a0522d',silver:'#c0c0c0',skyblue:'#87ceeb',slateblue:'#6a5acd',slategray:'#708090',snow:'#fffafa',springgreen:'#00ff7f',steelblue:'#4682b4',tan:'#d2b48c',teal:'#008080',thistle:'#d8bfd8',tomato:'#ff6347',turquoise:'#40e0d0',violet:'#ee82ee',wheat:'#f5deb3',white:'#ffffff',whitesmoke:'#f5f5f5',yellow:'#ffff00',yellowgreen:'#9acd32'}[name.toLowerCase()];}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surveys-utils.js","sourceRoot":"","sources":["../../../../src/surveys/surveys-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,cAAc,EACd,oCAAoC,GACrC,MAAM,2BAA2B,CAAA;AAElC,MAAM,CAAC,MAAM,sBAAsB,GAAG,SAAkB,CAAA;AAMxD,MAAM,CAAC,MAAM,uBAAuB,GAA0B;IAC5D,eAAe,EAAE,sBAAsB;IACvC,iBAAiB,EAAE,OAAO;IAC1B,qBAAqB,EAAE,OAAO;IAC9B,iBAAiB,EAAE,OAAO;IAC1B,uBAAuB,EAAE,OAAO;IAChC,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,iBAAiB;IAC9B,sBAAsB,EAAE,IAAI;IAC5B,qBAAqB,EAAE,8BAA8B;IACrD,QAAQ,EAAE,cAAc,CAAC,KAAK;IAC9B,gBAAgB,EAAE,QAAQ;IAC1B,aAAa,EAAE,KAAK;IACpB,0BAA0B,EAAE,EAAE;IAC9B,qCAAqC,EAAE,oCAAoC,CAAC,IAAI;IAChF,8BAA8B,EAAE,OAAO;IACvC,uBAAuB,EAAE,CAAC;CAC3B,CAAA;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,MAAc,EAAoB,EAAE;IAC3E,6EAA6E;IAC7E,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAwB,EAAE,GAAW,EAAE,EAAE;QACjE,QAAQ,CAAC,qBAAqB,GAAG,GAAG,CAAA;IACtC,CAAC,CAAC,CAAA;IAEF,0BAA0B;IAC1B,OAAO,MAAM,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,SAAS;QACd,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,SAAS;QAClB,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,SAAS;QACpB,MAAM,EAAE,SAAS;QACjB,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,SAAS;QAChB,UAAU,EAAE,SAAS;QACrB,MAAM,EAAE,SAAS;QACjB,WAAW,EAAE,SAAS;KACvB,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAA;AACvB,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Survey } from '../../../posthog-core/src';
|
|
2
|
-
import { PostHog } from '../posthog-rn';
|
|
3
|
-
export declare function useActivatedSurveys(posthog: PostHog, surveys: Survey[]): ReadonlySet<string>;
|
|
1
|
+
import { Survey } from '../../../posthog-core/src';
|
|
2
|
+
import { PostHog } from '../posthog-rn';
|
|
3
|
+
export declare function useActivatedSurveys(posthog: PostHog, surveys: Survey[]): ReadonlySet<string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useActivatedSurveys=useActivatedSurveys;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=require("react");var _surveysUtils=require("./surveys-utils");function _createForOfIteratorHelper(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var _n=0,F=function F(){};return{s:F,n:function n(){return _n>=r.length?{done:!0}:{done:!1,value:r[_n++]};},e:function e(r){throw r;},f:F};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var o,a=!0,u=!1;return{s:function s(){t=t.call(r);},n:function n(){var r=t.next();return a=r.done,r;},e:function e(r){u=!0,o=r;},f:function f(){try{a||null==t["return"]||t["return"]();}finally{if(u)throw o;}}};}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}var SURVEY_SHOWN_EVENT_NAME='survey shown';function useActivatedSurveys(posthog,surveys){var _useState=(0,_react.useState)(new Set()),_useState2=(0,_slicedToArray2["default"])(_useState,2),activatedSurveys=_useState2[0],setActivatedSurveys=_useState2[1];var eventMap=(0,_react.useMemo)(function(){var _a,_b,_c,_d;var newEventMap=new Map();var _iterator=_createForOfIteratorHelper(surveys.filter(_surveysUtils.hasEvents)),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var survey=_step.value;var _iterator2=_createForOfIteratorHelper((_c=(_b=(_a=survey.conditions)===null||_a===void 0?void 0:_a.events)===null||_b===void 0?void 0:_b.values)!==null&&_c!==void 0?_c:[]),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var event=_step2.value;var knownSurveys=(_d=newEventMap.get(event.name))!==null&&_d!==void 0?_d:[];knownSurveys.push(survey.id);newEventMap.set(event.name,knownSurveys);}}catch(err){_iterator2.e(err);}finally{_iterator2.f();}}}catch(err){_iterator.e(err);}finally{_iterator.f();}return newEventMap;},[surveys]);(0,_react.useEffect)(function(){if(eventMap.size>0){return posthog.on('capture',function(payload){var _a;if(eventMap.has(payload.event)){setActivatedSurveys(function(current){var _a;return new Set([].concat((0,_toConsumableArray2["default"])(current),(0,_toConsumableArray2["default"])((_a=eventMap.get(payload.event))!==null&&_a!==void 0?_a:[])));});}else if(payload.event===SURVEY_SHOWN_EVENT_NAME){var surveyId=(_a=payload.properties)===null||_a===void 0?void 0:_a.$survey_id;if(surveyId){setActivatedSurveys(function(current){if(!current.has(surveyId)){return current;}var next=new Set(current);next["delete"](surveyId);return next;});}}});}},[eventMap,posthog]);return activatedSurveys;}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useActivatedSurveys.js","sourceRoot":"","sources":["../../../../src/surveys/useActivatedSurveys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAI3C,MAAM,uBAAuB,GAAG,cAAc,CAAA;AAE9C,MAAM,UAAU,mBAAmB,CAAC,OAAgB,EAAE,OAAiB;IACrE,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAsB,IAAI,GAAG,EAAE,CAAC,CAAA;IAExF,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE;;QAC5B,MAAM,WAAW,GAAG,IAAI,GAAG,EAAoB,CAAA;QAC/C,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE;YAC9C,KAAK,MAAM,KAAK,IAAI,MAAA,MAAA,MAAA,MAAM,CAAC,UAAU,0CAAE,MAAM,0CAAE,MAAM,mCAAI,EAAE,EAAE;gBAC3D,MAAM,YAAY,GAAG,MAAA,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,mCAAI,EAAE,CAAA;gBACtD,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;gBAC5B,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,YAAY,CAAC,CAAA;aAC1C;SACF;QACD,OAAO,WAAW,CAAA;IACpB,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAA;IAE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yDate: (date: Date) => void;
|
|
6
|
-
};
|
|
7
|
-
export declare function useSurveyStorage(): SurveyStorage;
|
|
8
|
-
export {};
|
|
1
|
+
type SurveyStorage = {
|
|
2
|
+
seenSurveys: string[];
|
|
3
|
+
setSeenSurvey: (surveyId: string) => void;
|
|
4
|
+
lastSeenSurveyDate: Date | undefined;
|
|
5
|
+
setLastSeenSurveyDate: (date: Date) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare function useSurveyStorage(): SurveyStorage;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useSurveyStorage=useSurveyStorage;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _src=require("../../../posthog-core/src");var _react=require("react");var _usePostHog=require("../hooks/usePostHog");function useSurveyStorage(){var posthogStorage=(0,_usePostHog.usePostHog)();var _useState=(0,_react.useState)(undefined),_useState2=(0,_slicedToArray2["default"])(_useState,2),lastSeenSurveyDate=_useState2[0],setLastSeenSurveyDate=_useState2[1];var _useState3=(0,_react.useState)([]),_useState4=(0,_slicedToArray2["default"])(_useState3,2),seenSurveys=_useState4[0],setSeenSurveys=_useState4[1];(0,_react.useEffect)(function(){posthogStorage.ready().then(function(){var lastSeenSurveyDate=posthogStorage.getPersistedProperty(_src.PostHogPersistedProperty.SurveyLastSeenDate);if(typeof lastSeenSurveyDate==='string'){setLastSeenSurveyDate(new Date(lastSeenSurveyDate));}var serialisedSeenSurveys=posthogStorage.getPersistedProperty(_src.PostHogPersistedProperty.SurveysSeen);if(typeof serialisedSeenSurveys==='string'){var parsedSeenSurveys=JSON.parse(serialisedSeenSurveys);if(Array.isArray(parsedSeenSurveys)&&typeof parsedSeenSurveys[0]==='string'){setSeenSurveys(parsedSeenSurveys);}}});},[posthogStorage]);return{seenSurveys:seenSurveys,setSeenSurvey:(0,_react.useCallback)(function(surveyId){setSeenSurveys(function(current){var newValue=[surveyId].concat((0,_toConsumableArray2["default"])(current.filter(function(id){return id!==surveyId;})));posthogStorage.setPersistedProperty(_src.PostHogPersistedProperty.SurveysSeen,JSON.stringify(newValue.slice(0,20)));return newValue;});},[posthogStorage]),lastSeenSurveyDate:lastSeenSurveyDate,setLastSeenSurveyDate:(0,_react.useCallback)(function(date){setLastSeenSurveyDate(date);posthogStorage.setPersistedProperty(_src.PostHogPersistedProperty.SurveyLastSeenDate,date.toISOString());},[posthogStorage])};}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSurveyStorage.js","sourceRoot":"","sources":["../../../../src/surveys/useSurveyStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA;AACpE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAShD,MAAM,UAAU,gBAAgB;IAC9B,MAAM,cAAc,GAAG,UAAU,EAAE,CAAA;IACnC,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,QAAQ,CAAmB,SAAS,CAAC,CAAA;IACzF,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAW,EAAE,CAAC,CAAA;IAE5D,SAAS,CAAC,GAAG,EAAE;QACb,cAAc,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;YAC/B,MAAM,kBAAkB,GAAG,cAAc,CAAC,oBAAoB,CAAC,wBAAwB,CAAC,kBAAkB,CAAC,CAAA;YAC3G,IAAI,OAAO,kBAAkB,KAAK,QAAQ,EAAE;gBAC1C,qBAAqB,CAAC,IAAI,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAA;aACpD;YAED,MAAM,qBAAqB,GAAG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
|
1
|
-
export type PostHogAutocaptureNavigationTrackerOptions = {
|
|
2
|
-
routeToName?: (name: string, params: any) => string;
|
|
3
|
-
routeToProperties?: (name: string, params: any) => Record<string, any>;
|
|
4
|
-
};
|
|
5
|
-
export type PostHogNavigationRef = {
|
|
6
|
-
getCurrentRoute(): any | undefined;
|
|
7
|
-
isReady: () => boolean;
|
|
8
|
-
};
|
|
9
|
-
export type PostHogAutocaptureOptions = {
|
|
10
|
-
captureTouches?: boolean;
|
|
11
|
-
customLabelProp?: string;
|
|
12
|
-
noCaptureProp?: string;
|
|
13
|
-
maxElementsCaptured?: number;
|
|
14
|
-
ignoreLabels?: string[];
|
|
15
|
-
propsToCapture?: string[];
|
|
16
|
-
captureScreens?: boolean;
|
|
17
|
-
navigation?: PostHogAutocaptureNavigationTrackerOptions;
|
|
18
|
-
navigationRef?: PostHogNavigationRef;
|
|
19
|
-
/** Captures app lifecycle events such as Application Installed, Application Updated, Application Opened, Application Became Active and Application Backgrounded.
|
|
20
|
-
* By default is true.
|
|
21
|
-
* If you're already using the 'captureNativeAppLifecycleEvents' client option, you don't need to set this.
|
|
22
|
-
* If 'captureNativeAppLifecycleEvents' is set, the 'captureNativeAppLifecycleEvents' value has priority over this option.
|
|
23
|
-
* Application Installed and Application Updated events are not supported with persistence set to 'memory'.
|
|
24
|
-
*/
|
|
25
|
-
captureLifecycleEvents?: boolean;
|
|
26
|
-
};
|
|
27
|
-
export interface PostHogCustomAppProperties {
|
|
28
|
-
/** Build number like "1.2.2" or "122" */
|
|
29
|
-
$app_build?: string | null;
|
|
30
|
-
/** Name of the app as displayed below the icon like "PostHog" */
|
|
31
|
-
$app_name?: string | null;
|
|
32
|
-
/** Namespace of the app usually like "com.posthog.app" */
|
|
33
|
-
$app_namespace?: string | null;
|
|
34
|
-
/** Human friendly app version like what a user would see in the app store like "1.2.2" */
|
|
35
|
-
$app_version?: string | null;
|
|
36
|
-
/** Manufacturer like "Apple", "Samsung" or "Android" */
|
|
37
|
-
$device_manufacturer?: string | null;
|
|
38
|
-
/** Readable model name like "iPhone 12" or "Samsung Galaxy S24" */
|
|
39
|
-
$device_name?: string | null;
|
|
40
|
-
/** Model identifier like "iPhone13,2" or "SM-S921B" */
|
|
41
|
-
$device_model?: string | null;
|
|
42
|
-
/** Device type ("Mobile" | "Desktop" | "Web") */
|
|
43
|
-
$device_type?: string | null;
|
|
44
|
-
/** Operating system name like iOS or Android */
|
|
45
|
-
$os_name?: string | null;
|
|
46
|
-
/** Operating system version "14.0" */
|
|
47
|
-
$os_version?: string | null;
|
|
48
|
-
/** Locale (language) of the device like "en-US" */
|
|
49
|
-
$locale?: string | null;
|
|
50
|
-
/** Timezone of the device like "Europe/Berlin" */
|
|
51
|
-
$timezone?: string | null;
|
|
52
|
-
}
|
|
53
|
-
export type PostHogSessionReplayConfig = {
|
|
54
|
-
/**
|
|
55
|
-
* Enable masking of all text and text input fields
|
|
56
|
-
* Default: true
|
|
57
|
-
*/
|
|
58
|
-
maskAllTextInputs?: boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Enable masking of all images to a placeholder
|
|
61
|
-
* Default: true
|
|
62
|
-
*/
|
|
63
|
-
maskAllImages?: boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Enable masking of all sandboxed system views
|
|
66
|
-
* These may include UIImagePickerController, PHPickerViewController and CNContactPickerViewController
|
|
67
|
-
* iOS only
|
|
68
|
-
* Experimental support
|
|
69
|
-
* Default: true
|
|
70
|
-
*/
|
|
71
|
-
maskAllSandboxedViews?: boolean;
|
|
72
|
-
/**
|
|
73
|
-
* Enable masking of images that likely originated from user's photo library
|
|
74
|
-
* Experimental support (UIKit only)
|
|
75
|
-
* iOS only
|
|
76
|
-
* Default: false
|
|
77
|
-
*
|
|
78
|
-
* @deprecated This property has no effect and will be removed in the next major release. To learn how to manually mask user photos please see our Privacy controls documentation: https://posthog.com/docs/session-replay/privacy?tab=React+Native
|
|
79
|
-
*/
|
|
80
|
-
maskPhotoLibraryImages?: boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Enable capturing of logcat as console events
|
|
83
|
-
* Android only
|
|
84
|
-
* Default: true
|
|
85
|
-
*/
|
|
86
|
-
captureLog?: boolean;
|
|
87
|
-
/**
|
|
88
|
-
* Deboucer delay used to reduce the number of snapshots captured and reduce performance impact
|
|
89
|
-
* This is used for capturing the view as a screenshot
|
|
90
|
-
* The lower the number more snapshots will be captured but higher the performance impact
|
|
91
|
-
* Defaults to 1s on iOS
|
|
92
|
-
*/
|
|
93
|
-
iOSdebouncerDelayMs?: number;
|
|
94
|
-
/**
|
|
95
|
-
* Deboucer delay used to reduce the number of snapshots captured and reduce performance impact
|
|
96
|
-
* This is used for capturing the view as a screenshot
|
|
97
|
-
* The lower the number more snapshots will be captured but higher the performance impact
|
|
98
|
-
* Defaults to 1000ms (1s)
|
|
99
|
-
* Ps: it was 500ms (0.5s) by default until version 3.3.7
|
|
100
|
-
*/
|
|
101
|
-
androidDebouncerDelayMs?: number;
|
|
102
|
-
/**
|
|
103
|
-
* Enable capturing network telemetry
|
|
104
|
-
* iOS only
|
|
105
|
-
* Default: true
|
|
106
|
-
*/
|
|
107
|
-
captureNetworkTelemetry?: boolean;
|
|
108
|
-
};
|
|
109
|
-
export interface PostHogCustomStorage {
|
|
110
|
-
getItem: (key: string) => string | null | Promise<string | null>;
|
|
111
|
-
setItem: (key: string, value: string) => void | Promise<void>;
|
|
112
|
-
}
|
|
1
|
+
export type PostHogAutocaptureNavigationTrackerOptions = {
|
|
2
|
+
routeToName?: (name: string, params: any) => string;
|
|
3
|
+
routeToProperties?: (name: string, params: any) => Record<string, any>;
|
|
4
|
+
};
|
|
5
|
+
export type PostHogNavigationRef = {
|
|
6
|
+
getCurrentRoute(): any | undefined;
|
|
7
|
+
isReady: () => boolean;
|
|
8
|
+
};
|
|
9
|
+
export type PostHogAutocaptureOptions = {
|
|
10
|
+
captureTouches?: boolean;
|
|
11
|
+
customLabelProp?: string;
|
|
12
|
+
noCaptureProp?: string;
|
|
13
|
+
maxElementsCaptured?: number;
|
|
14
|
+
ignoreLabels?: string[];
|
|
15
|
+
propsToCapture?: string[];
|
|
16
|
+
captureScreens?: boolean;
|
|
17
|
+
navigation?: PostHogAutocaptureNavigationTrackerOptions;
|
|
18
|
+
navigationRef?: PostHogNavigationRef;
|
|
19
|
+
/** Captures app lifecycle events such as Application Installed, Application Updated, Application Opened, Application Became Active and Application Backgrounded.
|
|
20
|
+
* By default is true.
|
|
21
|
+
* If you're already using the 'captureNativeAppLifecycleEvents' client option, you don't need to set this.
|
|
22
|
+
* If 'captureNativeAppLifecycleEvents' is set, the 'captureNativeAppLifecycleEvents' value has priority over this option.
|
|
23
|
+
* Application Installed and Application Updated events are not supported with persistence set to 'memory'.
|
|
24
|
+
*/
|
|
25
|
+
captureLifecycleEvents?: boolean;
|
|
26
|
+
};
|
|
27
|
+
export interface PostHogCustomAppProperties {
|
|
28
|
+
/** Build number like "1.2.2" or "122" */
|
|
29
|
+
$app_build?: string | null;
|
|
30
|
+
/** Name of the app as displayed below the icon like "PostHog" */
|
|
31
|
+
$app_name?: string | null;
|
|
32
|
+
/** Namespace of the app usually like "com.posthog.app" */
|
|
33
|
+
$app_namespace?: string | null;
|
|
34
|
+
/** Human friendly app version like what a user would see in the app store like "1.2.2" */
|
|
35
|
+
$app_version?: string | null;
|
|
36
|
+
/** Manufacturer like "Apple", "Samsung" or "Android" */
|
|
37
|
+
$device_manufacturer?: string | null;
|
|
38
|
+
/** Readable model name like "iPhone 12" or "Samsung Galaxy S24" */
|
|
39
|
+
$device_name?: string | null;
|
|
40
|
+
/** Model identifier like "iPhone13,2" or "SM-S921B" */
|
|
41
|
+
$device_model?: string | null;
|
|
42
|
+
/** Device type ("Mobile" | "Desktop" | "Web") */
|
|
43
|
+
$device_type?: string | null;
|
|
44
|
+
/** Operating system name like iOS or Android */
|
|
45
|
+
$os_name?: string | null;
|
|
46
|
+
/** Operating system version "14.0" */
|
|
47
|
+
$os_version?: string | null;
|
|
48
|
+
/** Locale (language) of the device like "en-US" */
|
|
49
|
+
$locale?: string | null;
|
|
50
|
+
/** Timezone of the device like "Europe/Berlin" */
|
|
51
|
+
$timezone?: string | null;
|
|
52
|
+
}
|
|
53
|
+
export type PostHogSessionReplayConfig = {
|
|
54
|
+
/**
|
|
55
|
+
* Enable masking of all text and text input fields
|
|
56
|
+
* Default: true
|
|
57
|
+
*/
|
|
58
|
+
maskAllTextInputs?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Enable masking of all images to a placeholder
|
|
61
|
+
* Default: true
|
|
62
|
+
*/
|
|
63
|
+
maskAllImages?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Enable masking of all sandboxed system views
|
|
66
|
+
* These may include UIImagePickerController, PHPickerViewController and CNContactPickerViewController
|
|
67
|
+
* iOS only
|
|
68
|
+
* Experimental support
|
|
69
|
+
* Default: true
|
|
70
|
+
*/
|
|
71
|
+
maskAllSandboxedViews?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Enable masking of images that likely originated from user's photo library
|
|
74
|
+
* Experimental support (UIKit only)
|
|
75
|
+
* iOS only
|
|
76
|
+
* Default: false
|
|
77
|
+
*
|
|
78
|
+
* @deprecated This property has no effect and will be removed in the next major release. To learn how to manually mask user photos please see our Privacy controls documentation: https://posthog.com/docs/session-replay/privacy?tab=React+Native
|
|
79
|
+
*/
|
|
80
|
+
maskPhotoLibraryImages?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Enable capturing of logcat as console events
|
|
83
|
+
* Android only
|
|
84
|
+
* Default: true
|
|
85
|
+
*/
|
|
86
|
+
captureLog?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Deboucer delay used to reduce the number of snapshots captured and reduce performance impact
|
|
89
|
+
* This is used for capturing the view as a screenshot
|
|
90
|
+
* The lower the number more snapshots will be captured but higher the performance impact
|
|
91
|
+
* Defaults to 1s on iOS
|
|
92
|
+
*/
|
|
93
|
+
iOSdebouncerDelayMs?: number;
|
|
94
|
+
/**
|
|
95
|
+
* Deboucer delay used to reduce the number of snapshots captured and reduce performance impact
|
|
96
|
+
* This is used for capturing the view as a screenshot
|
|
97
|
+
* The lower the number more snapshots will be captured but higher the performance impact
|
|
98
|
+
* Defaults to 1000ms (1s)
|
|
99
|
+
* Ps: it was 500ms (0.5s) by default until version 3.3.7
|
|
100
|
+
*/
|
|
101
|
+
androidDebouncerDelayMs?: number;
|
|
102
|
+
/**
|
|
103
|
+
* Enable capturing network telemetry
|
|
104
|
+
* iOS only
|
|
105
|
+
* Default: true
|
|
106
|
+
*/
|
|
107
|
+
captureNetworkTelemetry?: boolean;
|
|
108
|
+
};
|
|
109
|
+
export interface PostHogCustomStorage {
|
|
110
|
+
getItem: (key: string) => string | null | Promise<string | null>;
|
|
111
|
+
setItem: (key: string, value: string) => void | Promise<void>;
|
|
112
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "3.15.
|
|
1
|
+
export declare const version = "3.15.1";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version=void 0;var version=exports.version="3.15.1";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAA"}
|