posthog-react-native 4.83.0 → 4.84.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.SurveyProgressStore=void 0;exports.canCaptureSurvey=canCaptureSurvey;exports.createSurveyProgress=createSurveyProgress;exports.getOtherProjectSurveyProgress=getOtherProjectSurveyProgress;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _core=require("@posthog/core");var _surveys=require("@posthog/core/surveys");var _surveyShuffling=require("./survey-shuffling");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;}function createSurveyProgress(survey){return{submissionId:(0,_core.uuidv7)(),questionIndex:0,questionOrder:(0,_surveyShuffling.getDisplayOrderQuestions)(survey).map(function(question){return question.originalQuestionIndex;}),responses:{},questionSnapshots:{}};}function questionShape(question){var base={id:question.id,type:question.type,optional:question.optional,branching:question.branching};switch(question.type){case _core.SurveyQuestionType.SingleChoice:case _core.SurveyQuestionType.MultipleChoice:return _objectSpread(_objectSpread({},base),{},{choices:question.choices,hasOpenChoice:question.hasOpenChoice});case _core.SurveyQuestionType.Rating:return _objectSpread(_objectSpread({},base),{},{scale:question.scale,display:question.display});case _core.SurveyQuestionType.Link:return _objectSpread(_objectSpread({},base),{},{link:question.link});default:return base;}}function surveyShape(survey){var _a;return JSON.stringify([survey.current_iteration_start_date,survey.enable_partial_responses,(_a=survey.appearance)===null||_a===void 0?void 0:_a.shuffleQuestions,survey.questions.map(questionShape)]);}var MAX_PROGRESS=20;var MAX_AGE=30*24*60*60*1000;function isRecord(value){return(0,_typeof2["default"])(value)==='object'&&value!==null&&!Array.isArray(value);}function isNonEmptyString(value){return typeof value==='string'&&value.length>0;}function isQuestionIndex(value,count){return typeof value==='number'&&Number.isInteger(value)&&value>=0&&value<count;}function isQuestionOrder(value,count){if(!Array.isArray(value)||value.length!==count||new Set(value).size!==count)return false;return value.every(function(index){return isQuestionIndex(index,count);});}function isResponse(value){if(value===null||typeof value==='string')return true;if(typeof value==='number')return Number.isFinite(value);return Array.isArray(value)&&value.every(function(item){return typeof item==='string';});}function validResponses(value,survey){if(!isRecord(value))return false;var keys=new Set(survey.questions.map(function(question){return(0,_surveys.getSurveyResponseKey)(question.id);}));return Object.entries(value).every(function(_ref){var _ref2=(0,_slicedToArray2["default"])(_ref,2),key=_ref2[0],response=_ref2[1];return keys.has(key)&&isResponse(response);});}function validSnapshots(value,survey){if(!isRecord(value))return false;var ids=new Set(survey.questions.map(function(question){return question.id;}));return Object.entries(value).every(function(_ref3){var _ref4=(0,_slicedToArray2["default"])(_ref3,2),id=_ref4[0],text=_ref4[1];return ids.has(id)&&typeof text==='string';});}function validProgress(value,survey){if(!isRecord(value))return false;var submissionId=value.submissionId,questionIndex=value.questionIndex,questionOrder=value.questionOrder,responses=value.responses,questionSnapshots=value.questionSnapshots,surveyLanguage=value.surveyLanguage;var languageIsValid=surveyLanguage==null||typeof surveyLanguage==='string';return isNonEmptyString(submissionId)&&languageIsValid&&isQuestionIndex(questionIndex,survey.questions.length)&&isQuestionOrder(questionOrder,survey.questions.length)&&validResponses(responses,survey)&&validSnapshots(questionSnapshots,survey);}function isRecent(value){return typeof value==='number'&&value>Date.now()-MAX_AGE&&value<=Date.now();}function isSavedProgress(value,project){if(!isRecord(value))return false;return value.project===project&&typeof value.surveyKey==='string'&&isNonEmptyString(value.shape)&&isRecent(value.updatedAt)&&isRecord(value.progress);}function canCaptureSurvey(posthog){return!posthog.optedOut&&!posthog.isDisabled;}function getOtherProjectSurveyProgress(posthog){var raw=posthog.getPersistedProperty(_core.PostHogPersistedProperty.SurveysInProgress);if(!Array.isArray(raw))return[];var counts=new Map();return raw.filter(function(entry){var _a;if(!isRecord(entry)||!isNonEmptyString(entry.project)||entry.project===posthog.apiKey)return false;if(!isSavedProgress(entry,entry.project))return false;var count=(_a=counts.get(entry.project))!==null&&_a!==void 0?_a:0;if(count>=MAX_PROGRESS)return false;counts.set(entry.project,count+1);return true;});}var SurveyProgressStore=exports.SurveyProgressStore=function(){function SurveyProgressStore(posthog){(0,_classCallCheck2["default"])(this,SurveyProgressStore);this.posthog=posthog;}return(0,_createClass2["default"])(SurveyProgressStore,[{key:"read",value:function read(){var _this=this;var raw=this.posthog.getPersistedProperty(_core.PostHogPersistedProperty.SurveysInProgress);if(!Array.isArray(raw))return[];return raw.filter(function(entry){return isSavedProgress(entry,_this.posthog.apiKey);}).slice(0,MAX_PROGRESS);}},{key:"write",value:function write(entries){this.posthog.setPersistedProperty(_core.PostHogPersistedProperty.SurveysInProgress,[].concat((0,_toConsumableArray2["default"])(entries.slice(0,MAX_PROGRESS)),(0,_toConsumableArray2["default"])(getOtherProjectSurveyProgress(this.posthog))));}},{key:"load",value:function load(survey){var entry=this.read().find(function(entry){return entry.surveyKey===(0,_surveys.getSurveyIterationKey)(survey);});return(entry===null||entry===void 0?void 0:entry.shape)===surveyShape(survey)&&validProgress(entry.progress,survey)?entry.progress:undefined;}},{key:"save",value:function save(survey,progress){var surveyKey=(0,_surveys.getSurveyIterationKey)(survey);this.write([{project:this.posthog.apiKey,surveyKey:surveyKey,shape:surveyShape(survey),updatedAt:Date.now(),progress:progress}].concat((0,_toConsumableArray2["default"])(this.read().filter(function(entry){return entry.surveyKey!==surveyKey;}))));}},{key:"remove",value:function remove(survey){this.write(this.read().filter(function(entry){return entry.surveyKey!==(0,_surveys.getSurveyIterationKey)(survey);}));}},{key:"reconcile",value:function reconcile(surveys){var _this2=this;var validKeys=new Set(surveys.filter(function(survey){return survey.start_date&&!survey.end_date&&_this2.load(survey);}).map(_surveys.getSurveyIterationKey));this.write(this.read().filter(function(entry){return validKeys.has(entry.surveyKey);}));}}]);}();
1
+ "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.SurveyProgressStore=void 0;exports.canCaptureSurvey=canCaptureSurvey;exports.createSurveyProgress=createSurveyProgress;exports.getOtherProjectSurveyProgress=getOtherProjectSurveyProgress;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _core=require("@posthog/core");var _surveys=require("@posthog/core/surveys");var _surveyShuffling=require("./survey-shuffling");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;}function createSurveyProgress(survey){return{submissionId:(0,_core.uuidv7)(),questionIndex:0,questionOrder:(0,_surveyShuffling.getDisplayOrderQuestions)(survey).map(function(question){return question.originalQuestionIndex;}),responses:{},questionSnapshots:{}};}function questionShape(question){var base={id:question.id,type:question.type,optional:question.optional,branching:question.branching};switch(question.type){case _core.SurveyQuestionType.SingleChoice:case _core.SurveyQuestionType.MultipleChoice:return _objectSpread(_objectSpread({},base),{},{choices:question.choices,hasOpenChoice:question.hasOpenChoice});case _core.SurveyQuestionType.Rating:return _objectSpread(_objectSpread({},base),{},{scale:question.scale,display:question.display});case _core.SurveyQuestionType.Link:return _objectSpread(_objectSpread({},base),{},{link:question.link});default:return base;}}function surveyShape(survey){var _a;return JSON.stringify([survey.current_iteration_start_date,survey.enable_partial_responses,(_a=survey.appearance)===null||_a===void 0?void 0:_a.shuffleQuestions,survey.questions.map(questionShape)]);}var MAX_PROGRESS=20;var MAX_AGE=30*24*60*60*1000;function isRecord(value){return(0,_typeof2["default"])(value)==='object'&&value!==null&&!Array.isArray(value);}function isNonEmptyString(value){return typeof value==='string'&&value.length>0;}function isQuestionIndex(value,count){return typeof value==='number'&&Number.isInteger(value)&&value>=0&&value<count;}function isQuestionOrder(value,count){if(!Array.isArray(value)||value.length!==count||new Set(value).size!==count)return false;return value.every(function(index){return isQuestionIndex(index,count);});}function isResponse(value){if(value===null||typeof value==='string')return true;if(typeof value==='number')return Number.isFinite(value);return Array.isArray(value)&&value.every(function(item){return typeof item==='string';});}function validResponses(value,survey){if(!isRecord(value))return false;var keys=new Set(survey.questions.map(function(question){return(0,_surveys.getSurveyResponseKey)(question.id);}));return Object.entries(value).every(function(_ref){var _ref2=(0,_slicedToArray2["default"])(_ref,2),key=_ref2[0],response=_ref2[1];return keys.has(key)&&isResponse(response);});}function validSnapshots(value,survey){if(!isRecord(value))return false;var ids=new Set(survey.questions.map(function(question){return question.id;}));return Object.entries(value).every(function(_ref3){var _ref4=(0,_slicedToArray2["default"])(_ref3,2),id=_ref4[0],text=_ref4[1];return ids.has(id)&&typeof text==='string';});}function validProgress(value,survey){if(!isRecord(value))return false;var submissionId=value.submissionId,questionIndex=value.questionIndex,questionOrder=value.questionOrder,responses=value.responses,questionSnapshots=value.questionSnapshots,surveyLanguage=value.surveyLanguage;var languageIsValid=surveyLanguage==null||typeof surveyLanguage==='string';return isNonEmptyString(submissionId)&&languageIsValid&&isQuestionIndex(questionIndex,survey.questions.length)&&isQuestionOrder(questionOrder,survey.questions.length)&&validResponses(responses,survey)&&validSnapshots(questionSnapshots,survey);}function isRecent(value){return typeof value==='number'&&value>Date.now()-MAX_AGE&&value<=Date.now();}function isSavedProgress(value,project){if(!isRecord(value))return false;return value.project===project&&typeof value.surveyKey==='string'&&isNonEmptyString(value.shape)&&isRecent(value.updatedAt)&&isRecord(value.progress);}function canCaptureSurvey(posthog){return!posthog.optedOut&&!posthog.isDisabled;}function getOtherProjectSurveyProgress(posthog){var raw=posthog.getPersistedProperty(_core.PostHogPersistedProperty.SurveysInProgress);if(!Array.isArray(raw))return[];var counts=new Map();return raw.filter(function(entry){var _a;if(!isRecord(entry)||!isNonEmptyString(entry.project)||entry.project===posthog.projectToken)return false;if(!isSavedProgress(entry,entry.project))return false;var count=(_a=counts.get(entry.project))!==null&&_a!==void 0?_a:0;if(count>=MAX_PROGRESS)return false;counts.set(entry.project,count+1);return true;});}var SurveyProgressStore=exports.SurveyProgressStore=function(){function SurveyProgressStore(posthog){(0,_classCallCheck2["default"])(this,SurveyProgressStore);this.posthog=posthog;}return(0,_createClass2["default"])(SurveyProgressStore,[{key:"read",value:function read(){var _this=this;var raw=this.posthog.getPersistedProperty(_core.PostHogPersistedProperty.SurveysInProgress);if(!Array.isArray(raw))return[];return raw.filter(function(entry){return isSavedProgress(entry,_this.posthog.projectToken);}).slice(0,MAX_PROGRESS);}},{key:"write",value:function write(entries){this.posthog.setPersistedProperty(_core.PostHogPersistedProperty.SurveysInProgress,[].concat((0,_toConsumableArray2["default"])(entries.slice(0,MAX_PROGRESS)),(0,_toConsumableArray2["default"])(getOtherProjectSurveyProgress(this.posthog))));}},{key:"load",value:function load(survey){var entry=this.read().find(function(entry){return entry.surveyKey===(0,_surveys.getSurveyIterationKey)(survey);});return(entry===null||entry===void 0?void 0:entry.shape)===surveyShape(survey)&&validProgress(entry.progress,survey)?entry.progress:undefined;}},{key:"save",value:function save(survey,progress){var surveyKey=(0,_surveys.getSurveyIterationKey)(survey);this.write([{project:this.posthog.projectToken,surveyKey:surveyKey,shape:surveyShape(survey),updatedAt:Date.now(),progress:progress}].concat((0,_toConsumableArray2["default"])(this.read().filter(function(entry){return entry.surveyKey!==surveyKey;}))));}},{key:"remove",value:function remove(survey){this.write(this.read().filter(function(entry){return entry.surveyKey!==(0,_surveys.getSurveyIterationKey)(survey);}));}},{key:"reconcile",value:function reconcile(surveys){var _this2=this;var validKeys=new Set(surveys.filter(function(survey){return survey.start_date&&!survey.end_date&&_this2.load(survey);}).map(_surveys.getSurveyIterationKey));this.write(this.read().filter(function(entry){return validKeys.has(entry.surveyKey);}));}}]);}();
2
2
  //# sourceMappingURL=survey-progress.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"survey-progress.js","names":["_core","require","_surveys","_surveyShuffling","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","createSurveyProgress","survey","submissionId","uuidv7","questionIndex","questionOrder","getDisplayOrderQuestions","map","question","originalQuestionIndex","responses","questionSnapshots","questionShape","base","id","type","optional","branching","SurveyQuestionType","SingleChoice","MultipleChoice","choices","hasOpenChoice","Rating","scale","display","Link","link","surveyShape","JSON","stringify","current_iteration_start_date","enable_partial_responses","_a","appearance","shuffleQuestions","questions","MAX_PROGRESS","MAX_AGE","isRecord","value","_typeof2","Array","isArray","isNonEmptyString","isQuestionIndex","count","Number","isInteger","isQuestionOrder","Set","size","every","index","isResponse","isFinite","item","validResponses","getSurveyResponseKey","entries","_ref","_ref2","_slicedToArray2","key","response","has","validSnapshots","ids","_ref3","_ref4","text","validProgress","surveyLanguage","languageIsValid","isRecent","Date","now","isSavedProgress","project","surveyKey","shape","updatedAt","progress","canCaptureSurvey","posthog","optedOut","isDisabled","getOtherProjectSurveyProgress","raw","getPersistedProperty","PostHogPersistedProperty","SurveysInProgress","counts","Map","entry","apiKey","get","set","SurveyProgressStore","exports","_classCallCheck2","_createClass2","read","_this","slice","write","setPersistedProperty","concat","_toConsumableArray2","load","find","getSurveyIterationKey","undefined","save","remove","reconcile","surveys","_this2","validKeys","start_date","end_date"],"sources":["../../src/surveys/survey-progress.ts"],"sourcesContent":["import {\n PostHogPersistedProperty,\n Survey,\n SurveyQuestion,\n SurveyQuestionType,\n SurveyResponses,\n uuidv7,\n} from '@posthog/core'\nimport { getSurveyIterationKey, getSurveyResponseKey } from '@posthog/core/surveys'\nimport type { PostHog } from '../posthog-rn'\nimport { getDisplayOrderQuestions } from './survey-shuffling'\n\nexport type SurveyProgress = {\n submissionId: string\n questionIndex: number\n questionOrder: number[]\n responses: SurveyResponses\n questionSnapshots: Record<string, string>\n surveyLanguage?: string | null\n}\n\nexport function createSurveyProgress(survey: Survey): SurveyProgress {\n return {\n submissionId: uuidv7(),\n questionIndex: 0,\n questionOrder: getDisplayOrderQuestions(survey).map((question) => question.originalQuestionIndex),\n responses: {},\n questionSnapshots: {},\n }\n}\n\n// Copy changes (including translations) do not invalidate answers. Changes to\n// question identity, response shape or branching must start a new submission.\nfunction questionShape(question: SurveyQuestion): object {\n const base = { id: question.id, type: question.type, optional: question.optional, branching: question.branching }\n switch (question.type) {\n case SurveyQuestionType.SingleChoice:\n case SurveyQuestionType.MultipleChoice:\n return { ...base, choices: question.choices, hasOpenChoice: question.hasOpenChoice }\n case SurveyQuestionType.Rating:\n return { ...base, scale: question.scale, display: question.display }\n case SurveyQuestionType.Link:\n return { ...base, link: question.link }\n default:\n return base\n }\n}\n\nfunction surveyShape(survey: Survey): string {\n return JSON.stringify([\n survey.current_iteration_start_date,\n survey.enable_partial_responses,\n survey.appearance?.shuffleQuestions,\n survey.questions.map(questionShape),\n ])\n}\n\ntype SavedProgress = {\n project: string\n surveyKey: string\n shape: string\n updatedAt: number\n progress: SurveyProgress\n}\n\nconst MAX_PROGRESS = 20\nconst MAX_AGE = 30 * 24 * 60 * 60 * 1000\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nfunction isNonEmptyString(value: unknown): value is string {\n return typeof value === 'string' && value.length > 0\n}\n\nfunction isQuestionIndex(value: unknown, count: number): value is number {\n return typeof value === 'number' && Number.isInteger(value) && value >= 0 && value < count\n}\n\nfunction isQuestionOrder(value: unknown, count: number): value is number[] {\n if (!Array.isArray(value) || value.length !== count || new Set(value).size !== count) return false\n return value.every((index) => isQuestionIndex(index, count))\n}\n\nfunction isResponse(value: unknown): boolean {\n if (value === null || typeof value === 'string') return true\n if (typeof value === 'number') return Number.isFinite(value)\n return Array.isArray(value) && value.every((item) => typeof item === 'string')\n}\n\nfunction validResponses(value: unknown, survey: Survey): boolean {\n if (!isRecord(value)) return false\n const keys = new Set(survey.questions.map((question) => getSurveyResponseKey(question.id)))\n return Object.entries(value).every(([key, response]) => keys.has(key) && isResponse(response))\n}\n\nfunction validSnapshots(value: unknown, survey: Survey): boolean {\n if (!isRecord(value)) return false\n const ids = new Set(survey.questions.map((question) => question.id))\n return Object.entries(value).every(([id, text]) => ids.has(id) && typeof text === 'string')\n}\n\nfunction validProgress(value: unknown, survey: Survey): value is SurveyProgress {\n if (!isRecord(value)) return false\n const { submissionId, questionIndex, questionOrder, responses, questionSnapshots, surveyLanguage } = value\n const languageIsValid = surveyLanguage == null || typeof surveyLanguage === 'string'\n return (\n isNonEmptyString(submissionId) &&\n languageIsValid &&\n isQuestionIndex(questionIndex, survey.questions.length) &&\n isQuestionOrder(questionOrder, survey.questions.length) &&\n validResponses(responses, survey) &&\n validSnapshots(questionSnapshots, survey)\n )\n}\n\nfunction isRecent(value: unknown): boolean {\n return typeof value === 'number' && value > Date.now() - MAX_AGE && value <= Date.now()\n}\n\nfunction isSavedProgress(value: unknown, project: string): value is SavedProgress {\n if (!isRecord(value)) return false\n return (\n value.project === project &&\n typeof value.surveyKey === 'string' &&\n isNonEmptyString(value.shape) &&\n isRecent(value.updatedAt) &&\n isRecord(value.progress)\n )\n}\n\nexport function canCaptureSurvey(posthog: PostHog): boolean {\n return !posthog.optedOut && !posthog.isDisabled\n}\n\nexport function getOtherProjectSurveyProgress(posthog: PostHog): unknown[] {\n const raw = posthog.getPersistedProperty<unknown>(PostHogPersistedProperty.SurveysInProgress)\n if (!Array.isArray(raw)) return []\n const counts = new Map<string, number>()\n return raw.filter((entry) => {\n if (!isRecord(entry) || !isNonEmptyString(entry.project) || entry.project === posthog.apiKey) return false\n if (!isSavedProgress(entry, entry.project)) return false\n const count = counts.get(entry.project) ?? 0\n if (count >= MAX_PROGRESS) return false\n counts.set(entry.project, count + 1)\n return true\n })\n}\n\nexport class SurveyProgressStore {\n constructor(private readonly posthog: PostHog) {}\n\n private read(): SavedProgress[] {\n const raw = this.posthog.getPersistedProperty<unknown>(PostHogPersistedProperty.SurveysInProgress)\n if (!Array.isArray(raw)) return []\n return raw\n .filter((entry): entry is SavedProgress => isSavedProgress(entry, this.posthog.apiKey))\n .slice(0, MAX_PROGRESS)\n }\n\n private write(entries: SavedProgress[]): void {\n this.posthog.setPersistedProperty(PostHogPersistedProperty.SurveysInProgress, [\n ...entries.slice(0, MAX_PROGRESS),\n ...getOtherProjectSurveyProgress(this.posthog),\n ])\n }\n\n load(survey: Survey): SurveyProgress | undefined {\n const entry = this.read().find((entry) => entry.surveyKey === getSurveyIterationKey(survey))\n return entry?.shape === surveyShape(survey) && validProgress(entry.progress, survey) ? entry.progress : undefined\n }\n\n save(survey: Survey, progress: SurveyProgress): void {\n const surveyKey = getSurveyIterationKey(survey)\n this.write([\n {\n project: this.posthog.apiKey,\n surveyKey,\n shape: surveyShape(survey),\n updatedAt: Date.now(),\n progress,\n },\n ...this.read().filter((entry) => entry.surveyKey !== surveyKey),\n ])\n }\n\n remove(survey: Survey): void {\n this.write(this.read().filter((entry) => entry.surveyKey !== getSurveyIterationKey(survey)))\n }\n\n reconcile(surveys: Survey[]): void {\n const validKeys = new Set(\n surveys.filter((survey) => survey.start_date && !survey.end_date && this.load(survey)).map(getSurveyIterationKey)\n )\n this.write(this.read().filter((entry) => validKeys.has(entry.surveyKey)))\n }\n}\n"],"mappings":"83BAAA,IAAAA,KAAA,CAAAC,OAAA,kBAQA,IAAAC,QAAA,CAAAD,OAAA,0BAEA,IAAAE,gBAAA,CAAAF,OAAA,uBAA6D,SAAAG,QAAAC,CAAA,CAAAC,CAAA,MAAAC,CAAA,CAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,KAAAG,MAAA,CAAAE,qBAAA,MAAAC,CAAA,CAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,CAAAC,CAAA,IAAAK,CAAA,CAAAA,CAAA,CAAAC,MAAA,UAAAN,CAAA,SAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,CAAAC,CAAA,EAAAQ,UAAA,KAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,CAAAI,CAAA,UAAAJ,CAAA,WAAAU,cAAAZ,CAAA,UAAAC,CAAA,GAAAA,CAAA,CAAAY,SAAA,CAAAC,MAAA,CAAAb,CAAA,QAAAC,CAAA,OAAAW,SAAA,CAAAZ,CAAA,EAAAY,SAAA,CAAAZ,CAAA,IAAAA,CAAA,IAAAF,OAAA,CAAAI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MAAM,CAAC,SAAC2G,KAAK,QAAK,CAAAA,KAAK,CAACf,SAAS,GAAKA,SAAS,GAAC,EAChE,CAAC,CACJ,CAAC,GAAAhB,GAAA,UAAAvB,KAAA,CAED,SAAA0E,MAAMA,CAACjH,MAAc,EACnB,IAAI,CAACwG,KAAK,CAAC,IAAI,CAACH,IAAI,EAAE,CAACnH,MAAM,CAAC,SAAC2G,KAAK,QAAK,CAAAA,KAAK,CAACf,SAAS,GAAK,GAAAgC,8BAAqB,EAAC9G,MAAM,CAAC,GAAC,CAAC,CAC9F,CAAC,GAAA8D,GAAA,aAAAvB,KAAA,CAED,SAAA2E,SAASA,CAACC,OAAiB,MAAAC,MAAA,MACzB,GAAM,CAAAC,SAAS,CAAG,GAAI,CAAApE,GAAG,CACvBkE,OAAO,CAACjI,MAAM,CAAC,SAACc,MAAM,QAAK,CAAAA,MAAM,CAACsH,UAAU,EAAI,CAACtH,MAAM,CAACuH,QAAQ,EAAIH,MAAI,CAACR,IAAI,CAAC5G,MAAM,CAAC,GAAC,CAACM,GAAG,CAACwG,8BAAqB,CAAC,CAClH,CACD,IAAI,CAACN,KAAK,CAAC,IAAI,CAACH,IAAI,EAAE,CAACnH,MAAM,CAAC,SAAC2G,KAAK,QAAK,CAAAwB,SAAS,CAACrD,GAAG,CAAC6B,KAAK,CAACf,SAAS,CAAC,GAAC,CAAC,CAC3E,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"survey-progress.js","names":["_core","require","_surveys","_surveyShuffling","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","createSurveyProgress","survey","submissionId","uuidv7","questionIndex","questionOrder","getDisplayOrderQuestions","map","question","originalQuestionIndex","responses","questionSnapshots","questionShape","base","id","type","optional","branching","SurveyQuestionType","SingleChoice","MultipleChoice","choices","hasOpenChoice","Rating","scale","display","Link","link","surveyShape","JSON","stringify","current_iteration_start_date","enable_partial_responses","_a","appearance","shuffleQuestions","questions","MAX_PROGRESS","MAX_AGE","isRecord","value","_typeof2","Array","isArray","isNonEmptyString","isQuestionIndex","count","Number","isInteger","isQuestionOrder","Set","size","every","index","isResponse","isFinite","item","validResponses","getSurveyResponseKey","entries","_ref","_ref2","_slicedToArray2","key","response","has","validSnapshots","ids","_ref3","_ref4","text","validProgress","surveyLanguage","languageIsValid","isRecent","Date","now","isSavedProgress","project","surveyKey","shape","updatedAt","progress","canCaptureSurvey","posthog","optedOut","isDisabled","getOtherProjectSurveyProgress","raw","getPersistedProperty","PostHogPersistedProperty","SurveysInProgress","counts","Map","entry","projectToken","get","set","SurveyProgressStore","exports","_classCallCheck2","_createClass2","read","_this","slice","write","setPersistedProperty","concat","_toConsumableArray2","load","find","getSurveyIterationKey","undefined","save","remove","reconcile","surveys","_this2","validKeys","start_date","end_date"],"sources":["../../src/surveys/survey-progress.ts"],"sourcesContent":["import {\n PostHogPersistedProperty,\n Survey,\n SurveyQuestion,\n SurveyQuestionType,\n SurveyResponses,\n uuidv7,\n} from '@posthog/core'\nimport { getSurveyIterationKey, getSurveyResponseKey } from '@posthog/core/surveys'\nimport type { PostHog } from '../posthog-rn'\nimport { getDisplayOrderQuestions } from './survey-shuffling'\n\nexport type SurveyProgress = {\n submissionId: string\n questionIndex: number\n questionOrder: number[]\n responses: SurveyResponses\n questionSnapshots: Record<string, string>\n surveyLanguage?: string | null\n}\n\nexport function createSurveyProgress(survey: Survey): SurveyProgress {\n return {\n submissionId: uuidv7(),\n questionIndex: 0,\n questionOrder: getDisplayOrderQuestions(survey).map((question) => question.originalQuestionIndex),\n responses: {},\n questionSnapshots: {},\n }\n}\n\n// Copy changes (including translations) do not invalidate answers. Changes to\n// question identity, response shape or branching must start a new submission.\nfunction questionShape(question: SurveyQuestion): object {\n const base = { id: question.id, type: question.type, optional: question.optional, branching: question.branching }\n switch (question.type) {\n case SurveyQuestionType.SingleChoice:\n case SurveyQuestionType.MultipleChoice:\n return { ...base, choices: question.choices, hasOpenChoice: question.hasOpenChoice }\n case SurveyQuestionType.Rating:\n return { ...base, scale: question.scale, display: question.display }\n case SurveyQuestionType.Link:\n return { ...base, link: question.link }\n default:\n return base\n }\n}\n\nfunction surveyShape(survey: Survey): string {\n return JSON.stringify([\n survey.current_iteration_start_date,\n survey.enable_partial_responses,\n survey.appearance?.shuffleQuestions,\n survey.questions.map(questionShape),\n ])\n}\n\ntype SavedProgress = {\n project: string\n surveyKey: string\n shape: string\n updatedAt: number\n progress: SurveyProgress\n}\n\nconst MAX_PROGRESS = 20\nconst MAX_AGE = 30 * 24 * 60 * 60 * 1000\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nfunction isNonEmptyString(value: unknown): value is string {\n return typeof value === 'string' && value.length > 0\n}\n\nfunction isQuestionIndex(value: unknown, count: number): value is number {\n return typeof value === 'number' && Number.isInteger(value) && value >= 0 && value < count\n}\n\nfunction isQuestionOrder(value: unknown, count: number): value is number[] {\n if (!Array.isArray(value) || value.length !== count || new Set(value).size !== count) return false\n return value.every((index) => isQuestionIndex(index, count))\n}\n\nfunction isResponse(value: unknown): boolean {\n if (value === null || typeof value === 'string') return true\n if (typeof value === 'number') return Number.isFinite(value)\n return Array.isArray(value) && value.every((item) => typeof item === 'string')\n}\n\nfunction validResponses(value: unknown, survey: Survey): boolean {\n if (!isRecord(value)) return false\n const keys = new Set(survey.questions.map((question) => getSurveyResponseKey(question.id)))\n return Object.entries(value).every(([key, response]) => keys.has(key) && isResponse(response))\n}\n\nfunction validSnapshots(value: unknown, survey: Survey): boolean {\n if (!isRecord(value)) return false\n const ids = new Set(survey.questions.map((question) => question.id))\n return Object.entries(value).every(([id, text]) => ids.has(id) && typeof text === 'string')\n}\n\nfunction validProgress(value: unknown, survey: Survey): value is SurveyProgress {\n if (!isRecord(value)) return false\n const { submissionId, questionIndex, questionOrder, responses, questionSnapshots, surveyLanguage } = value\n const languageIsValid = surveyLanguage == null || typeof surveyLanguage === 'string'\n return (\n isNonEmptyString(submissionId) &&\n languageIsValid &&\n isQuestionIndex(questionIndex, survey.questions.length) &&\n isQuestionOrder(questionOrder, survey.questions.length) &&\n validResponses(responses, survey) &&\n validSnapshots(questionSnapshots, survey)\n )\n}\n\nfunction isRecent(value: unknown): boolean {\n return typeof value === 'number' && value > Date.now() - MAX_AGE && value <= Date.now()\n}\n\nfunction isSavedProgress(value: unknown, project: string): value is SavedProgress {\n if (!isRecord(value)) return false\n return (\n value.project === project &&\n typeof value.surveyKey === 'string' &&\n isNonEmptyString(value.shape) &&\n isRecent(value.updatedAt) &&\n isRecord(value.progress)\n )\n}\n\nexport function canCaptureSurvey(posthog: PostHog): boolean {\n return !posthog.optedOut && !posthog.isDisabled\n}\n\nexport function getOtherProjectSurveyProgress(posthog: PostHog): unknown[] {\n const raw = posthog.getPersistedProperty<unknown>(PostHogPersistedProperty.SurveysInProgress)\n if (!Array.isArray(raw)) return []\n const counts = new Map<string, number>()\n return raw.filter((entry) => {\n if (!isRecord(entry) || !isNonEmptyString(entry.project) || entry.project === posthog.projectToken) return false\n if (!isSavedProgress(entry, entry.project)) return false\n const count = counts.get(entry.project) ?? 0\n if (count >= MAX_PROGRESS) return false\n counts.set(entry.project, count + 1)\n return true\n })\n}\n\nexport class SurveyProgressStore {\n constructor(private readonly posthog: PostHog) {}\n\n private read(): SavedProgress[] {\n const raw = this.posthog.getPersistedProperty<unknown>(PostHogPersistedProperty.SurveysInProgress)\n if (!Array.isArray(raw)) return []\n return raw\n .filter((entry): entry is SavedProgress => isSavedProgress(entry, this.posthog.projectToken))\n .slice(0, MAX_PROGRESS)\n }\n\n private write(entries: SavedProgress[]): void {\n this.posthog.setPersistedProperty(PostHogPersistedProperty.SurveysInProgress, [\n ...entries.slice(0, MAX_PROGRESS),\n ...getOtherProjectSurveyProgress(this.posthog),\n ])\n }\n\n load(survey: Survey): SurveyProgress | undefined {\n const entry = this.read().find((entry) => entry.surveyKey === getSurveyIterationKey(survey))\n return entry?.shape === surveyShape(survey) && validProgress(entry.progress, survey) ? entry.progress : undefined\n }\n\n save(survey: Survey, progress: SurveyProgress): void {\n const surveyKey = getSurveyIterationKey(survey)\n this.write([\n {\n project: this.posthog.projectToken,\n surveyKey,\n shape: surveyShape(survey),\n updatedAt: Date.now(),\n progress,\n },\n ...this.read().filter((entry) => entry.surveyKey !== surveyKey),\n ])\n }\n\n remove(survey: Survey): void {\n this.write(this.read().filter((entry) => entry.surveyKey !== getSurveyIterationKey(survey)))\n }\n\n reconcile(surveys: Survey[]): void {\n const validKeys = new Set(\n surveys.filter((survey) => survey.start_date && !survey.end_date && this.load(survey)).map(getSurveyIterationKey)\n )\n this.write(this.read().filter((entry) => validKeys.has(entry.surveyKey)))\n }\n}\n"],"mappings":"83BAAA,IAAAA,KAAA,CAAAC,OAAA,kBAQA,IAAAC,QAAA,CAAAD,OAAA,0BAEA,IAAAE,gBAAA,CAAAF,OAAA,uBAA6D,SAAAG,QAAAC,CAAA,CAAAC,CAAA,MAAAC,CAAA,CAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,KAAAG,MAAA,CAAAE,qBAAA,MAAAC,CAAA,CAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,CAAAC,CAAA,IAAAK,CAAA,CAAAA,CAAA,CAAAC,MAAA,UAAAN,CAAA,SAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,CAAAC,CAAA,EAAAQ,UAAA,KAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,CAAAI,CAAA,UAAAJ,CAAA,WAAAU,cAAAZ,CAAA,UAAAC,CAAA,GAAAA,CAAA,CAAAY,SAAA,CAAAC,MAAA,CAAAb,CAAA,QAAAC,CAAA,OAAAW,SAAA,CAAAZ,CAAA,EAAAY,SAAA,CAAAZ,CAAA,IAAAA,CAAA,IAAAF,OAAA,CAAAI,MAAA,CAAAD,CAAA,MAAAa,OA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CAAAA,KAAK,CAACf,SAAS,GAAKA,SAAS,GAAC,EAChE,CAAC,CACJ,CAAC,GAAAhB,GAAA,UAAAvB,KAAA,CAED,SAAA0E,MAAMA,CAACjH,MAAc,EACnB,IAAI,CAACwG,KAAK,CAAC,IAAI,CAACH,IAAI,EAAE,CAACnH,MAAM,CAAC,SAAC2G,KAAK,QAAK,CAAAA,KAAK,CAACf,SAAS,GAAK,GAAAgC,8BAAqB,EAAC9G,MAAM,CAAC,GAAC,CAAC,CAC9F,CAAC,GAAA8D,GAAA,aAAAvB,KAAA,CAED,SAAA2E,SAASA,CAACC,OAAiB,MAAAC,MAAA,MACzB,GAAM,CAAAC,SAAS,CAAG,GAAI,CAAApE,GAAG,CACvBkE,OAAO,CAACjI,MAAM,CAAC,SAACc,MAAM,QAAK,CAAAA,MAAM,CAACsH,UAAU,EAAI,CAACtH,MAAM,CAACuH,QAAQ,EAAIH,MAAI,CAACR,IAAI,CAAC5G,MAAM,CAAC,GAAC,CAACM,GAAG,CAACwG,8BAAqB,CAAC,CAClH,CACD,IAAI,CAACN,KAAK,CAAC,IAAI,CAACH,IAAI,EAAE,CAACnH,MAAM,CAAC,SAAC2G,KAAK,QAAK,CAAAwB,SAAS,CAACrD,GAAG,CAAC6B,KAAK,CAACf,SAAS,CAAC,GAAC,CAAC,CAC3E,CAAC","ignoreList":[]}
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "4.83.0";
1
+ export declare const version = "4.84.0";
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version=void 0;var version=exports.version="4.83.0";
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version=void 0;var version=exports.version="4.84.0";
2
2
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","names":["version","exports"],"sources":["../src/version.ts"],"sourcesContent":["export const version = \"4.83.0\"\n"],"mappings":"6FAAO,GAAM,CAAAA,OAAO,CAAAC,OAAA,CAAAD,OAAA,CAAG,QAAQ","ignoreList":[]}
1
+ {"version":3,"file":"version.js","names":["version","exports"],"sources":["../src/version.ts"],"sourcesContent":["export const version = \"4.84.0\"\n"],"mappings":"6FAAO,GAAM,CAAAA,OAAO,CAAAC,OAAA,CAAAD,OAAA,CAAG,QAAQ","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "posthog-react-native",
3
- "version": "4.83.0",
3
+ "version": "4.84.0",
4
4
  "bugs": {
5
5
  "url": "https://github.com/PostHog/posthog-js/issues"
6
6
  },
@@ -34,8 +34,8 @@
34
34
  "directory": "packages/react-native"
35
35
  },
36
36
  "dependencies": {
37
- "@posthog/core": "^1.60.1",
38
- "@posthog/types": "^1.416.0"
37
+ "@posthog/core": "^1.61.0",
38
+ "@posthog/types": "^1.416.1"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@babel/cli": "^7.19.3",
@@ -74,8 +74,8 @@
74
74
  "@vitest/coverage-v8": "^1.6.1",
75
75
  "vitest": "^1.6.1",
76
76
  "@posthog-tooling/tsconfig-base": "1.1.1",
77
- "@posthog-tooling/rollup-utils": "1.1.1",
78
- "@posthog/react-native-plugin": "2.12.6"
77
+ "@posthog/react-native-plugin": "2.12.6",
78
+ "@posthog-tooling/rollup-utils": "1.1.1"
79
79
  },
80
80
  "peerDependencies": {
81
81
  "@react-native-async-storage/async-storage": ">=1.0.0",