posthog-react-native 4.76.0 → 4.77.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/dist/storage.d.ts CHANGED
@@ -21,6 +21,14 @@ export declare class PostHogRNStorage {
21
21
  * inside persist() / _drainScheduledPersist().
22
22
  */
23
23
  waitForPersist(): Promise<void>;
24
+ /**
25
+ * Same as {@link waitForPersist}, but resolves to `true` only when every
26
+ * in-flight (and any freshly-drained scheduled) write landed successfully.
27
+ * Returns `false` if any tracked write rejected — the caller is responsible
28
+ * for treating that as "data not durable" and not e.g. removing a recovery
29
+ * entry from a backup store.
30
+ */
31
+ waitForPersistSuccess(): Promise<boolean>;
24
32
  persist(): void;
25
33
  private schedulePersist;
26
34
  private _drainScheduledPersist;
package/dist/storage.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.PostHogRNSyncMemoryStorage=exports.PostHogRNStorage=void 0;exports.createEventsMemoryStorage=createEventsMemoryStorage;exports.createEventsStorage=createEventsStorage;exports.createLogsMemoryStorage=createLogsMemoryStorage;exports.createLogsStorage=createLogsStorage;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _core=require("@posthog/core");function _callSuper(t,o,e){return o=(0,_getPrototypeOf2["default"])(o),(0,_possibleConstructorReturn2["default"])(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],(0,_getPrototypeOf2["default"])(t).constructor):o.apply(t,e));}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}var EVENTS_STORAGE_FILE='.posthog-rn.json';var LOGS_STORAGE_FILE='.posthog-rn-logs.json';var POSTHOG_STORAGE_VERSION='v1';var PERSIST_DEBOUNCE_MS=100;var PostHogRNStorage=exports.PostHogRNStorage=function(){function PostHogRNStorage(storage,storageKey){var _this=this;(0,_classCallCheck2["default"])(this,PostHogRNStorage);var _a;this.memoryCache={};this._pendingPromises=new Set();this.storage=storage;this._storageKey=storageKey;var preloadResult=this.storage.getItem(this._storageKey);if((0,_core.isPromise)(preloadResult)){this.preloadPromise=preloadResult.then(function(res){_this.populateMemoryCache(res);});(_a=this.preloadPromise)===null||_a===void 0?void 0:_a["finally"](function(){_this.preloadPromise=undefined;});}else{this.populateMemoryCache(preloadResult);}}return(0,_createClass2["default"])(PostHogRNStorage,[{key:"waitForPersist",value:(function(){var _waitForPersist=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(){return _regenerator["default"].wrap(function(_context){while(1)switch(_context.prev=_context.next){case 0:this._drainScheduledPersist();if(!(this._pendingPromises.size>0)){_context.next=1;break;}_context.next=1;return Promise.all(this._pendingPromises);case 1:case"end":return _context.stop();}},_callee,this);}));function waitForPersist(){return _waitForPersist.apply(this,arguments);}return waitForPersist;}())},{key:"persist",value:function persist(){var _this2=this;var payload={version:POSTHOG_STORAGE_VERSION,content:this.memoryCache};var result=this.storage.setItem(this._storageKey,JSON.stringify(payload));if((0,_core.isPromise)(result)){var promise=result["catch"](function(err){console.warn('PostHog storage persist failed:',err);})["finally"](function(){_this2._pendingPromises["delete"](promise);});this._pendingPromises.add(promise);}}},{key:"schedulePersist",value:function schedulePersist(){var _this3=this;if(this._persistTimer!==undefined){return;}this._persistTimer=(0,_core.safeSetTimeout)(function(){_this3._persistTimer=undefined;try{_this3.persist();}catch(err){console.warn('PostHog storage scheduled persist threw:',err);}},PERSIST_DEBOUNCE_MS);}},{key:"_drainScheduledPersist",value:function _drainScheduledPersist(){if(this._persistTimer===undefined){return;}clearTimeout(this._persistTimer);this._persistTimer=undefined;try{this.persist();}catch(err){console.warn('PostHog storage drain persist threw:',err);}}},{key:"getItem",value:function getItem(key){return this.memoryCache[key];}},{key:"setItem",value:function setItem(key,value){this.memoryCache[key]=value;this.schedulePersist();}},{key:"removeItem",value:function removeItem(key){delete this.memoryCache[key];this.schedulePersist();}},{key:"clear",value:function clear(){for(var key in this.memoryCache){delete this.memoryCache[key];}this.schedulePersist();}},{key:"getAllKeys",value:function getAllKeys(){return Object.keys(this.memoryCache);}},{key:"populateMemoryCache",value:function populateMemoryCache(res){try{var data=res?JSON.parse(res).content:{};for(var key in data){this.memoryCache[key]=data[key];}}catch(e){console.warn("PostHog failed to load persisted data from storage. This is likely because the storage format is. We'll reset the storage.",e);}}}]);}();var PostHogRNSyncMemoryStorage=exports.PostHogRNSyncMemoryStorage=function(_PostHogRNStorage){function PostHogRNSyncMemoryStorage(storageKey){(0,_classCallCheck2["default"])(this,PostHogRNSyncMemoryStorage);var cache={};var storage={getItem:function getItem(key){return cache[key];},setItem:function setItem(key,value){cache[key]=value;}};return _callSuper(this,PostHogRNSyncMemoryStorage,[storage,storageKey]);}(0,_inherits2["default"])(PostHogRNSyncMemoryStorage,_PostHogRNStorage);return(0,_createClass2["default"])(PostHogRNSyncMemoryStorage);}(PostHogRNStorage);function createEventsStorage(customStorage){return new PostHogRNStorage(customStorage,EVENTS_STORAGE_FILE);}function createLogsStorage(customStorage){return new PostHogRNStorage(customStorage,LOGS_STORAGE_FILE);}function createEventsMemoryStorage(){return new PostHogRNSyncMemoryStorage(EVENTS_STORAGE_FILE);}function createLogsMemoryStorage(){return new PostHogRNSyncMemoryStorage(LOGS_STORAGE_FILE);}
1
+ "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.PostHogRNSyncMemoryStorage=exports.PostHogRNStorage=void 0;exports.createEventsMemoryStorage=createEventsMemoryStorage;exports.createEventsStorage=createEventsStorage;exports.createLogsMemoryStorage=createLogsMemoryStorage;exports.createLogsStorage=createLogsStorage;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _core=require("@posthog/core");function _callSuper(t,o,e){return o=(0,_getPrototypeOf2["default"])(o),(0,_possibleConstructorReturn2["default"])(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],(0,_getPrototypeOf2["default"])(t).constructor):o.apply(t,e));}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}var EVENTS_STORAGE_FILE='.posthog-rn.json';var LOGS_STORAGE_FILE='.posthog-rn-logs.json';var POSTHOG_STORAGE_VERSION='v1';var PERSIST_DEBOUNCE_MS=100;var PostHogRNStorage=exports.PostHogRNStorage=function(){function PostHogRNStorage(storage,storageKey){var _this=this;(0,_classCallCheck2["default"])(this,PostHogRNStorage);this.memoryCache={};this._pendingPromises=new Set();this.storage=storage;this._storageKey=storageKey;var preloadResult=this.storage.getItem(this._storageKey);if((0,_core.isPromise)(preloadResult)){this.preloadPromise=preloadResult.then(function(res){_this.populateMemoryCache(res);});void this.preloadPromise.then(function(){_this.preloadPromise=undefined;},function(){_this.preloadPromise=undefined;});}else{this.populateMemoryCache(preloadResult);}}return(0,_createClass2["default"])(PostHogRNStorage,[{key:"waitForPersist",value:(function(){var _waitForPersist=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(){return _regenerator["default"].wrap(function(_context){while(1)switch(_context.prev=_context.next){case 0:this._drainScheduledPersist();if(!(this._pendingPromises.size>0)){_context.next=1;break;}_context.next=1;return Promise.all(this._pendingPromises);case 1:case"end":return _context.stop();}},_callee,this);}));function waitForPersist(){return _waitForPersist.apply(this,arguments);}return waitForPersist;}())},{key:"waitForPersistSuccess",value:(function(){var _waitForPersistSuccess=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2(){var results;return _regenerator["default"].wrap(function(_context2){while(1)switch(_context2.prev=_context2.next){case 0:this._drainScheduledPersist();if(!(this._pendingPromises.size===0)){_context2.next=1;break;}return _context2.abrupt("return",true);case 1:_context2.next=2;return Promise.all(this._pendingPromises);case 2:results=_context2.sent;return _context2.abrupt("return",results.every(function(r){return r===true;}));case 3:case"end":return _context2.stop();}},_callee2,this);}));function waitForPersistSuccess(){return _waitForPersistSuccess.apply(this,arguments);}return waitForPersistSuccess;}())},{key:"persist",value:function persist(){var _this2=this;var payload={version:POSTHOG_STORAGE_VERSION,content:this.memoryCache};var result;try{result=this.storage.setItem(this._storageKey,JSON.stringify(payload));}catch(err){console.warn('PostHog storage persist failed:',err);var promise=Promise.resolve(false);this._pendingPromises.add(promise);void promise["finally"](function(){_this2._pendingPromises["delete"](promise);});return;}if((0,_core.isPromise)(result)){var _promise=result.then(function(){return true;})["catch"](function(err){console.warn('PostHog storage persist failed:',err);return false;})["finally"](function(){_this2._pendingPromises["delete"](_promise);});this._pendingPromises.add(_promise);}}},{key:"schedulePersist",value:function schedulePersist(){var _this3=this;if(this._persistTimer!==undefined){return;}this._persistTimer=(0,_core.safeSetTimeout)(function(){_this3._persistTimer=undefined;try{_this3.persist();}catch(err){console.warn('PostHog storage scheduled persist threw:',err);}},PERSIST_DEBOUNCE_MS);}},{key:"_drainScheduledPersist",value:function _drainScheduledPersist(){if(this._persistTimer===undefined){return;}clearTimeout(this._persistTimer);this._persistTimer=undefined;try{this.persist();}catch(err){console.warn('PostHog storage drain persist threw:',err);}}},{key:"getItem",value:function getItem(key){return this.memoryCache[key];}},{key:"setItem",value:function setItem(key,value){this.memoryCache[key]=value;this.schedulePersist();}},{key:"removeItem",value:function removeItem(key){delete this.memoryCache[key];this.schedulePersist();}},{key:"clear",value:function clear(){for(var key in this.memoryCache){delete this.memoryCache[key];}this.schedulePersist();}},{key:"getAllKeys",value:function getAllKeys(){return Object.keys(this.memoryCache);}},{key:"populateMemoryCache",value:function populateMemoryCache(res){try{var data=res?JSON.parse(res).content:{};for(var key in data){this.memoryCache[key]=data[key];}}catch(e){console.warn("PostHog failed to load persisted data from storage. This is likely because the storage format is. We'll reset the storage.",e);}}}]);}();var PostHogRNSyncMemoryStorage=exports.PostHogRNSyncMemoryStorage=function(_PostHogRNStorage){function PostHogRNSyncMemoryStorage(storageKey){(0,_classCallCheck2["default"])(this,PostHogRNSyncMemoryStorage);var cache={};var storage={getItem:function getItem(key){return cache[key];},setItem:function setItem(key,value){cache[key]=value;}};return _callSuper(this,PostHogRNSyncMemoryStorage,[storage,storageKey]);}(0,_inherits2["default"])(PostHogRNSyncMemoryStorage,_PostHogRNStorage);return(0,_createClass2["default"])(PostHogRNSyncMemoryStorage);}(PostHogRNStorage);function createEventsStorage(customStorage){return new PostHogRNStorage(customStorage,EVENTS_STORAGE_FILE);}function createLogsStorage(customStorage){return new PostHogRNStorage(customStorage,LOGS_STORAGE_FILE);}function createEventsMemoryStorage(){return new PostHogRNSyncMemoryStorage(EVENTS_STORAGE_FILE);}function createLogsMemoryStorage(){return new PostHogRNSyncMemoryStorage(LOGS_STORAGE_FILE);}
2
2
  //# sourceMappingURL=storage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"storage.js","names":["_core","require","_callSuper","t","o","e","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","apply","Boolean","prototype","valueOf","call","EVENTS_STORAGE_FILE","LOGS_STORAGE_FILE","POSTHOG_STORAGE_VERSION","PERSIST_DEBOUNCE_MS","PostHogRNStorage","exports","storage","storageKey","_this","_classCallCheck2","memoryCache","_pendingPromises","Set","_storageKey","preloadResult","getItem","isPromise","preloadPromise","then","res","populateMemoryCache","_a","undefined","_createClass2","key","value","_waitForPersist","_asyncToGenerator2","_regenerator","mark","_callee","wrap","_context","prev","next","_drainScheduledPersist","size","Promise","all","stop","waitForPersist","arguments","persist","_this2","payload","version","content","result","setItem","JSON","stringify","promise","err","console","warn","add","schedulePersist","_this3","_persistTimer","safeSetTimeout","clearTimeout","removeItem","clear","getAllKeys","Object","keys","data","parse","PostHogRNSyncMemoryStorage","_PostHogRNStorage","cache","_inherits2","createEventsStorage","customStorage","createLogsStorage","createEventsMemoryStorage","createLogsMemoryStorage"],"sources":["../src/storage.ts"],"sourcesContent":["import { isPromise, safeSetTimeout } from '@posthog/core'\nimport { PostHogCustomStorage } from './types'\n\n// Module-local: SDK-internal detail, not part of any public or reachable\n// surface. The factory functions below are the only way to obtain a storage\n// instance bound to one of these files.\nconst EVENTS_STORAGE_FILE = '.posthog-rn.json'\nconst LOGS_STORAGE_FILE = '.posthog-rn-logs.json'\nconst POSTHOG_STORAGE_VERSION = 'v1'\n\n// Window over which storage mutations coalesce into one disk write. The\n// single-blob storage shape re-serializes the full cache on every write, so an\n// unbatched burst of N captures costs O(n²) bytes; coalescing collapses a\n// same-tick burst to a single write. The mutation lands in memoryCache\n// synchronously — only the disk write is deferred — and flush / AppState\n// background / shutdown each force a synchronous write via waitForPersist, so\n// the only data-loss window is a hard crash before the next drain.\n//\n// 100ms is chosen from the write-rate curve: at high burst rates the disk-write\n// count is already floored by the events flushAt (a flush drains every 20\n// events), and 100ms is enough to reach that floor while bounding worst-case\n// loss to ~one flush batch. Larger windows don't reduce writes further (the\n// floor is flushAt, not the window) and only widen the loss window when flushes\n// aren't draining.\nconst PERSIST_DEBOUNCE_MS = 100\n\ntype PostHogStorageContents = { [key: string]: any }\n\nexport class PostHogRNStorage {\n memoryCache: PostHogStorageContents = {}\n storage: PostHogCustomStorage\n preloadPromise: Promise<void> | undefined\n private _storageKey: string\n private _pendingPromises: Set<Promise<void>> = new Set()\n // Single in-flight debounce timer. Its presence doubles as the \"a write is\n // scheduled\" flag — one source of truth. Armed on the first mutation in a\n // window and deliberately not reset by later mutations, so write latency is\n // bounded to PERSIST_DEBOUNCE_MS rather than starving under a continuous\n // stream of captures.\n private _persistTimer?: ReturnType<typeof setTimeout>\n\n // Prefer the `create*Storage` factories below over calling this directly —\n // they're the only callers that know which file to bind to.\n constructor(storage: PostHogCustomStorage, storageKey: string) {\n this.storage = storage\n this._storageKey = storageKey\n\n const preloadResult = this.storage.getItem(this._storageKey)\n\n if (isPromise(preloadResult)) {\n this.preloadPromise = preloadResult.then((res) => {\n this.populateMemoryCache(res)\n })\n\n this.preloadPromise?.finally(() => {\n this.preloadPromise = undefined\n })\n } else {\n this.populateMemoryCache(preloadResult)\n }\n }\n\n /**\n * Force any scheduled write to be initiated now and await in-flight async\n * writes. Used by durability-sensitive paths (events flush, AppState\n * background, shutdown, login/logout/opt-in/opt-out, fatal exceptions) so the\n * latest state is on its way to the backend before they continue.\n *\n * Best-effort under crash: backend writes are async, so an immediate\n * termination can interrupt them. Never throws — backend errors are logged\n * inside persist() / _drainScheduledPersist().\n */\n async waitForPersist(): Promise<void> {\n this._drainScheduledPersist()\n if (this._pendingPromises.size > 0) {\n await Promise.all(this._pendingPromises)\n }\n }\n\n persist(): void {\n const payload = {\n version: POSTHOG_STORAGE_VERSION,\n content: this.memoryCache,\n }\n\n const result = this.storage.setItem(this._storageKey, JSON.stringify(payload))\n\n // Track async persist operations so we can wait for them if needed\n if (isPromise(result)) {\n const promise = result\n .catch((err) => {\n console.warn('PostHog storage persist failed:', err)\n })\n .finally(() => {\n this._pendingPromises.delete(promise)\n })\n this._pendingPromises.add(promise)\n }\n }\n\n // Arm a single debounced persist on the first un-persisted mutation. Repeated\n // calls within the window are no-ops — the mutation is already in memoryCache\n // and the scheduled fire reads the final state.\n private schedulePersist(): void {\n if (this._persistTimer !== undefined) {\n return\n }\n this._persistTimer = safeSetTimeout(() => {\n this._persistTimer = undefined\n try {\n this.persist()\n } catch (err) {\n console.warn('PostHog storage scheduled persist threw:', err)\n }\n }, PERSIST_DEBOUNCE_MS)\n }\n\n // Force any scheduled persist to fire now (cancels the timer, persists immediately).\n private _drainScheduledPersist(): void {\n if (this._persistTimer === undefined) {\n return\n }\n clearTimeout(this._persistTimer)\n this._persistTimer = undefined\n try {\n this.persist()\n } catch (err) {\n console.warn('PostHog storage drain persist threw:', err)\n }\n }\n\n getItem(key: string): any | null | undefined {\n return this.memoryCache[key]\n }\n setItem(key: string, value: any): void {\n this.memoryCache[key] = value\n this.schedulePersist()\n }\n removeItem(key: string): void {\n delete this.memoryCache[key]\n this.schedulePersist()\n }\n clear(): void {\n for (const key in this.memoryCache) {\n delete this.memoryCache[key]\n }\n this.schedulePersist()\n }\n getAllKeys(): readonly string[] {\n return Object.keys(this.memoryCache)\n }\n\n populateMemoryCache(res: string | null): void {\n try {\n const data = res ? JSON.parse(res).content : {}\n\n for (const key in data) {\n this.memoryCache[key] = data[key]\n }\n } catch (e) {\n console.warn(\n \"PostHog failed to load persisted data from storage. This is likely because the storage format is. We'll reset the storage.\",\n e\n )\n }\n }\n}\n\nexport class PostHogRNSyncMemoryStorage extends PostHogRNStorage {\n constructor(storageKey: string) {\n const cache: { [key: string]: any | undefined } = {}\n const storage = {\n getItem: (key: string) => cache[key],\n setItem: (key: string, value: string) => {\n cache[key] = value\n },\n }\n\n super(storage, storageKey)\n }\n}\n\n// Factory functions that bind the storage instance to the correct SDK-internal\n// file. The file names never leave this module — callers (including tests)\n// reach storages only through these helpers.\nexport function createEventsStorage(customStorage: PostHogCustomStorage): PostHogRNStorage {\n return new PostHogRNStorage(customStorage, EVENTS_STORAGE_FILE)\n}\n\nexport function createLogsStorage(customStorage: PostHogCustomStorage): PostHogRNStorage {\n return new PostHogRNStorage(customStorage, LOGS_STORAGE_FILE)\n}\n\nexport function createEventsMemoryStorage(): PostHogRNStorage {\n return new PostHogRNSyncMemoryStorage(EVENTS_STORAGE_FILE)\n}\n\nexport function createLogsMemoryStorage(): PostHogRNStorage {\n return new PostHogRNSyncMemoryStorage(LOGS_STORAGE_FILE)\n}\n"],"mappings":"ujCAAA,IAAAA,KAAA,CAAAC,OAAA,kBAAyD,SAAAC,WAAAC,CAAA,CAAAC,CAAA,CAAAC,CAAA,SAAAD,CAAA,IAAAE,gBAAA,aAAAF,CAAA,KAAAG,2BAAA,aAAAJ,CAAA,CAAAK,yBAAA,GAAAC,OAAA,CAAAC,SAAA,CAAAN,CAAA,CAAAC,CAAA,QAAAC,gBAAA,aAAAH,CAAA,EAAAQ,WAAA,EAAAP,CAAA,CAAAQ,KAAA,CAAAT,CAAA,CAAAE,CAAA,aAAAG,0BAAA,UAAAL,CAAA,EAAAU,OAAA,CAAAC,SAAA,CAAAC,OAAA,CAAAC,IAAA,CAAAP,OAAA,CAAAC,SAAA,CAAAG,OAAA,0BAAAV,CAAA,UAAAK,yBAAA,UAAAA,0BAAA,UAAAL,CAAA,OAMzD,GAAM,CAAAc,mBAAmB,CAAG,kBAAkB,CAC9C,GAAM,CAAAC,iBAAiB,CAAG,uBAAuB,CACjD,GAAM,CAAAC,uBAAuB,CAAG,IAAI,CAgBpC,GAAM,CAAAC,mBAAmB,CAAG,GAAG,IAIlB,CAAAC,gBAAgB,CAAAC,OAAA,CAAAD,gBAAA,YAe3B,SAAAA,iBAAYE,OAA6B,CAAEC,UAAkB,MAAAC,KAAA,SAAAC,gBAAA,kBAAAL,gBAAA,E,OAd7D,KAAAM,WAAW,CAA2B,EAAE,CAIhC,KAAAC,gBAAgB,CAAuB,GAAI,CAAAC,GAAG,EAAE,CAWtD,IAAI,CAACN,OAAO,CAAGA,OAAO,CAC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CAAC,CAAE,CACViE,OAAO,CAACC,IAAI,CACV,4HAA4H,CAC5HlE,CAAC,CACF,CACH,CACF,CAAC,WAGU,CAAAgF,0BAA2B,CAAA/D,OAAA,CAAA+D,0BAAA,UAAAC,iBAAA,EACtC,SAAAD,2BAAY7D,UAAkB,KAAAE,gBAAA,kBAAA2D,0BAAA,EAC5B,GAAM,CAAAE,KAAK,CAAuC,EAAE,CACpD,GAAM,CAAAhE,OAAO,CAAG,CACdS,OAAO,CAAE,QAAT,CAAAA,OAAOA,CAAGS,GAAW,QAAK,CAAA8C,KAAK,CAAC9C,GAAG,CAAC,GACpCwB,OAAO,CAAE,QAAT,CAAAA,OAAOA,CAAGxB,GAAW,CAAEC,KAAa,CAAI,CACtC6C,KAAK,CAAC9C,GAAG,CAAC,CAAGC,KAAK,CACpB,C,CACD,QAAAxC,UAAA,MAAAmF,0BAAA,EAEK9D,OAAO,CAAEC,UAAU,GAC3B,CAAC,GAAAgE,UAAA,aAAAH,0BAAA,CAAAC,iBAAA,WAAA9C,aAAA,aAAA6C,0BAAA,IAX6ChE,gBAAgB,EAiB1D,QAAU,CAAAoE,mBAAmBA,CAACC,aAAmC,EACrE,MAAO,IAAI,CAAArE,gBAAgB,CAACqE,aAAa,CAAEzE,mBAAmB,CAAC,CACjE,CAEM,QAAU,CAAA0E,iBAAiBA,CAACD,aAAmC,EACnE,MAAO,IAAI,CAAArE,gBAAgB,CAACqE,aAAa,CAAExE,iBAAiB,CAAC,CAC/D,CAEM,QAAU,CAAA0E,yBAAyBA,CAAA,EACvC,MAAO,IAAI,CAAAP,0BAA0B,CAACpE,mBAAmB,CAAC,CAC5D,CAEM,QAAU,CAAA4E,uBAAuBA,CAAA,EACrC,MAAO,IAAI,CAAAR,0BAA0B,CAACnE,iBAAiB,CAAC,CAC1D","ignoreList":[]}
1
+ {"version":3,"file":"storage.js","names":["_core","require","_callSuper","t","o","e","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","apply","Boolean","prototype","valueOf","call","EVENTS_STORAGE_FILE","LOGS_STORAGE_FILE","POSTHOG_STORAGE_VERSION","PERSIST_DEBOUNCE_MS","PostHogRNStorage","exports","storage","storageKey","_this","_classCallCheck2","memoryCache","_pendingPromises","Set","_storageKey","preloadResult","getItem","isPromise","preloadPromise","then","res","populateMemoryCache","undefined","_createClass2","key","value","_waitForPersist","_asyncToGenerator2","_regenerator","mark","_callee","wrap","_context","prev","next","_drainScheduledPersist","size","Promise","all","stop","waitForPersist","arguments","_waitForPersistSuccess","_callee2","results","_context2","abrupt","sent","every","r","waitForPersistSuccess","persist","_this2","payload","version","content","result","setItem","JSON","stringify","err","console","warn","promise","resolve","add","schedulePersist","_this3","_persistTimer","safeSetTimeout","clearTimeout","removeItem","clear","getAllKeys","Object","keys","data","parse","PostHogRNSyncMemoryStorage","_PostHogRNStorage","cache","_inherits2","createEventsStorage","customStorage","createLogsStorage","createEventsMemoryStorage","createLogsMemoryStorage"],"sources":["../src/storage.ts"],"sourcesContent":["import { isPromise, safeSetTimeout } from '@posthog/core'\nimport { PostHogCustomStorage } from './types'\n\n// Module-local: SDK-internal detail, not part of any public or reachable\n// surface. The factory functions below are the only way to obtain a storage\n// instance bound to one of these files.\nconst EVENTS_STORAGE_FILE = '.posthog-rn.json'\nconst LOGS_STORAGE_FILE = '.posthog-rn-logs.json'\nconst POSTHOG_STORAGE_VERSION = 'v1'\n\n// Window over which storage mutations coalesce into one disk write. The\n// single-blob storage shape re-serializes the full cache on every write, so an\n// unbatched burst of N captures costs O(n²) bytes; coalescing collapses a\n// same-tick burst to a single write. The mutation lands in memoryCache\n// synchronously — only the disk write is deferred — and flush / AppState\n// background / shutdown each force a synchronous write via waitForPersist, so\n// the only data-loss window is a hard crash before the next drain.\n//\n// 100ms is chosen from the write-rate curve: at high burst rates the disk-write\n// count is already floored by the events flushAt (a flush drains every 20\n// events), and 100ms is enough to reach that floor while bounding worst-case\n// loss to ~one flush batch. Larger windows don't reduce writes further (the\n// floor is flushAt, not the window) and only widen the loss window when flushes\n// aren't draining.\nconst PERSIST_DEBOUNCE_MS = 100\n\ntype PostHogStorageContents = { [key: string]: any }\n\nexport class PostHogRNStorage {\n memoryCache: PostHogStorageContents = {}\n storage: PostHogCustomStorage\n preloadPromise: Promise<void> | undefined\n private _storageKey: string\n // Each pending persist resolves to a boolean: true if the underlying setItem\n // resolved, false if it rejected. waitForPersistSuccess() uses this to surface\n // async failures instead of silently swallowing them.\n private _pendingPromises: Set<Promise<boolean>> = new Set()\n // Single in-flight debounce timer. Its presence doubles as the \"a write is\n // scheduled\" flag — one source of truth. Armed on the first mutation in a\n // window and deliberately not reset by later mutations, so write latency is\n // bounded to PERSIST_DEBOUNCE_MS rather than starving under a continuous\n // stream of captures.\n private _persistTimer?: ReturnType<typeof setTimeout>\n\n // Prefer the `create*Storage` factories below over calling this directly —\n // they're the only callers that know which file to bind to.\n constructor(storage: PostHogCustomStorage, storageKey: string) {\n this.storage = storage\n this._storageKey = storageKey\n\n const preloadResult = this.storage.getItem(this._storageKey)\n\n if (isPromise(preloadResult)) {\n this.preloadPromise = preloadResult.then((res) => {\n this.populateMemoryCache(res)\n })\n\n // Observe both outcomes without creating the unhandled rejected promise that\n // `void preloadPromise.finally(...)` would leave behind.\n void this.preloadPromise.then(\n () => {\n this.preloadPromise = undefined\n },\n () => {\n this.preloadPromise = undefined\n }\n )\n } else {\n this.populateMemoryCache(preloadResult)\n }\n }\n\n /**\n * Force any scheduled write to be initiated now and await in-flight async\n * writes. Used by durability-sensitive paths (events flush, AppState\n * background, shutdown, login/logout/opt-in/opt-out, fatal exceptions) so the\n * latest state is on its way to the backend before they continue.\n *\n * Best-effort under crash: backend writes are async, so an immediate\n * termination can interrupt them. Never throws — backend errors are logged\n * inside persist() / _drainScheduledPersist().\n */\n async waitForPersist(): Promise<void> {\n this._drainScheduledPersist()\n if (this._pendingPromises.size > 0) {\n await Promise.all(this._pendingPromises)\n }\n }\n\n /**\n * Same as {@link waitForPersist}, but resolves to `true` only when every\n * in-flight (and any freshly-drained scheduled) write landed successfully.\n * Returns `false` if any tracked write rejected — the caller is responsible\n * for treating that as \"data not durable\" and not e.g. removing a recovery\n * entry from a backup store.\n */\n async waitForPersistSuccess(): Promise<boolean> {\n this._drainScheduledPersist()\n if (this._pendingPromises.size === 0) {\n return true\n }\n const results = await Promise.all(this._pendingPromises)\n return results.every((r) => r === true)\n }\n\n persist(): void {\n const payload = {\n version: POSTHOG_STORAGE_VERSION,\n content: this.memoryCache,\n }\n\n // Wrap the setItem call in a try/catch so a synchronous throw (customStorage\n // rejecting inline) is still surfaced via waitForPersistSuccess() — without\n // this, a sync-throwing storage pretends to succeed and callers that gate on\n // durability act as though the data landed.\n let result: void | Promise<void>\n try {\n result = this.storage.setItem(this._storageKey, JSON.stringify(payload))\n } catch (err) {\n console.warn('PostHog storage persist failed:', err)\n const promise: Promise<boolean> = Promise.resolve(false)\n this._pendingPromises.add(promise)\n void promise.finally(() => {\n this._pendingPromises.delete(promise)\n })\n return\n }\n\n // Track async persist operations so we can wait for them if needed. The\n // resolved boolean is the source of truth for waitForPersistSuccess().\n if (isPromise(result)) {\n const promise: Promise<boolean> = result\n .then(() => true)\n .catch((err) => {\n console.warn('PostHog storage persist failed:', err)\n return false\n })\n .finally(() => {\n this._pendingPromises.delete(promise)\n })\n this._pendingPromises.add(promise)\n }\n }\n\n // Arm a single debounced persist on the first un-persisted mutation. Repeated\n // calls within the window are no-ops — the mutation is already in memoryCache\n // and the scheduled fire reads the final state.\n private schedulePersist(): void {\n if (this._persistTimer !== undefined) {\n return\n }\n this._persistTimer = safeSetTimeout(() => {\n this._persistTimer = undefined\n try {\n this.persist()\n } catch (err) {\n console.warn('PostHog storage scheduled persist threw:', err)\n }\n }, PERSIST_DEBOUNCE_MS)\n }\n\n // Force any scheduled persist to fire now (cancels the timer, persists immediately).\n private _drainScheduledPersist(): void {\n if (this._persistTimer === undefined) {\n return\n }\n clearTimeout(this._persistTimer)\n this._persistTimer = undefined\n try {\n this.persist()\n } catch (err) {\n console.warn('PostHog storage drain persist threw:', err)\n }\n }\n\n getItem(key: string): any | null | undefined {\n return this.memoryCache[key]\n }\n setItem(key: string, value: any): void {\n this.memoryCache[key] = value\n this.schedulePersist()\n }\n removeItem(key: string): void {\n delete this.memoryCache[key]\n this.schedulePersist()\n }\n clear(): void {\n for (const key in this.memoryCache) {\n delete this.memoryCache[key]\n }\n this.schedulePersist()\n }\n getAllKeys(): readonly string[] {\n return Object.keys(this.memoryCache)\n }\n\n populateMemoryCache(res: string | null): void {\n try {\n const data = res ? JSON.parse(res).content : {}\n\n for (const key in data) {\n this.memoryCache[key] = data[key]\n }\n } catch (e) {\n console.warn(\n \"PostHog failed to load persisted data from storage. This is likely because the storage format is. We'll reset the storage.\",\n e\n )\n }\n }\n}\n\nexport class PostHogRNSyncMemoryStorage extends PostHogRNStorage {\n constructor(storageKey: string) {\n const cache: { [key: string]: any | undefined } = {}\n const storage = {\n getItem: (key: string) => cache[key],\n setItem: (key: string, value: string) => {\n cache[key] = value\n },\n }\n\n super(storage, storageKey)\n }\n}\n\n// Factory functions that bind the storage instance to the correct SDK-internal\n// file. The file names never leave this module — callers (including tests)\n// reach storages only through these helpers.\nexport function createEventsStorage(customStorage: PostHogCustomStorage): PostHogRNStorage {\n return new PostHogRNStorage(customStorage, EVENTS_STORAGE_FILE)\n}\n\nexport function createLogsStorage(customStorage: PostHogCustomStorage): PostHogRNStorage {\n return new PostHogRNStorage(customStorage, LOGS_STORAGE_FILE)\n}\n\nexport function createEventsMemoryStorage(): PostHogRNStorage {\n return new PostHogRNSyncMemoryStorage(EVENTS_STORAGE_FILE)\n}\n\nexport function createLogsMemoryStorage(): PostHogRNStorage {\n return new PostHogRNSyncMemoryStorage(LOGS_STORAGE_FILE)\n}\n"],"mappings":"ujCAAA,IAAAA,KAAA,CAAAC,OAAA,kBAAyD,SAAAC,WAAAC,CAAA,CAAAC,CAAA,CAAAC,CAAA,SAAAD,CAAA,IAAAE,gBAAA,a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AW,CAAEC,KAAa,CAAI,CACtCuD,KAAK,CAACxD,GAAG,CAAC,CAAGC,KAAK,CACpB,C,CACD,QAAAvC,UAAA,MAAA4F,0BAAA,EAEKvE,OAAO,CAAEC,UAAU,GAC3B,CAAC,GAAAyE,UAAA,aAAAH,0BAAA,CAAAC,iBAAA,WAAAxD,aAAA,aAAAuD,0BAAA,IAX6CzE,gBAAgB,EAiB1D,QAAU,CAAA6E,mBAAmBA,CAACC,aAAmC,EACrE,MAAO,IAAI,CAAA9E,gBAAgB,CAAC8E,aAAa,CAAElF,mBAAmB,CAAC,CACjE,CAEM,QAAU,CAAAmF,iBAAiBA,CAACD,aAAmC,EACnE,MAAO,IAAI,CAAA9E,gBAAgB,CAAC8E,aAAa,CAAEjF,iBAAiB,CAAC,CAC/D,CAEM,QAAU,CAAAmF,yBAAyBA,CAAA,EACvC,MAAO,IAAI,CAAAP,0BAA0B,CAAC7E,mBAAmB,CAAC,CAC5D,CAEM,QAAU,CAAAqF,uBAAuBA,CAAA,EACrC,MAAO,IAAI,CAAAR,0BAA0B,CAAC5E,iBAAiB,CAAC,CAC1D","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _typeof=require("@babel/runtime/helpers/typeof");Object.defineProperty(exports,"__esModule",{value:true});exports.LinkQuestion=LinkQuestion;exports.MultipleChoiceQuestion=MultipleChoiceQuestion;exports.OpenTextQuestion=OpenTextQuestion;exports.RatingButton=RatingButton;exports.RatingQuestion=RatingQuestion;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _safeStyleSheet=require("../safeStyleSheet");var _icons=require("../icons");var _surveysUtils=require("../surveys-utils");var _surveyShuffling=require("../survey-shuffling");var _core=require("@posthog/core");var _surveys=require("@posthog/core/surveys");var _BottomSection=require("./BottomSection");var _QuestionHeader=require("./QuestionHeader");var _jsxRuntime=require("react/jsx-runtime");var _jsxFileName="/home/runner/work/posthog-js/posthog-js/packages/react-native/dist/surveys/components/QuestionTypes.js";function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var r=new WeakMap(),n=new WeakMap();return(_interopRequireWildcard=function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var o,i,f={__proto__:null,"default":e};if(null===e||"object"!=_typeof(e)&&"function"!=typeof e)return f;if(o=t?n:r){if(o.has(e))return o.get(e);o.set(e,f);}for(var _t2 in e)"default"!==_t2&&{}.hasOwnProperty.call(e,_t2)&&((i=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,_t2))&&(i.get||i.set)?o(f,_t2,i):f[_t2]=e[_t2]);return f;})(e,t);}function QuestionLayout(_ref){var children=_ref.children,footer=_ref.footer;var _useState=(0,_react.useState)(0),_useState2=(0,_slicedToArray2["default"])(_useState,2),viewportHeight=_useState2[0],setViewportHeight=_useState2[1];var _useState3=(0,_react.useState)(0),_useState4=(0,_slicedToArray2["default"])(_useState3,2),contentHeight=_useState4[0],setContentHeight=_useState4[1];var isOverflowing=contentHeight>viewportHeight+1;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:questionLayoutStyles.container,children:[(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{style:questionLayoutStyles.scroll,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,scrollEnabled:isOverflowing,bounces:isOverflowing,onLayout:function onLayout(e){return setViewportHeight(e.nativeEvent.layout.height);},onContentSizeChange:function onContentSizeChange(_width,height){return setContentHeight(height);},children:children}),footer]});}var questionLayoutStyles=(0,_safeStyleSheet.createSafeStyleSheet)({container:{flexShrink:1},scroll:{flexShrink:1}});function OpenTextQuestion(_ref2){var question=_ref2.question,appearance=_ref2.appearance,onSubmit=_ref2.onSubmit;var _a,_b,_c,_d;var _useState5=(0,_react.useState)(''),_useState6=(0,_slicedToArray2["default"])(_useState5,2),text=_useState6[0],setText=_useState6[1];var validationError=(0,_react.useMemo)(function(){return(0,_surveys.getValidationError)(text,question.validation,question.optional);},[text,question.validation,question.optional]);var minLength=(0,_surveys.getLengthFromRules)(question.validation,_core.SurveyValidationType.MinLength);var maxLength=(0,_surveys.getLengthFromRules)(question.validation,_core.SurveyValidationType.MaxLength);var requirementsHint=(0,_react.useMemo)(function(){return(0,_surveys.getRequirementsHint)(minLength,maxLength);},[minLength,maxLength]);var handleSubmit=function handleSubmit(){if(validationError){return;}onSubmit(text.trim());};return(0,_jsxRuntime.jsxs)(QuestionLayout,{footer:(0,_jsxRuntime.jsx)(_BottomSection.BottomSection,{text:(_a=question.buttonText)!==null&&_a!==void 0?_a:appearance.submitButtonText,submitDisabled:!!validationError,appearance:appearance,onSubmit:handleSubmit}),children:[(0,_jsxRuntime.jsx)(_QuestionHeader.QuestionHeader,{question:question.question,description:question.description,descriptionContentType:question.descriptionContentType,appearance:appearance}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.textInputContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.TextInput,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'input'),style:[styles.textInput,{backgroundColor:appearance.inputBackground,color:(_b=appearance.inputTextColor)!==null&&_b!==void 0?_b:(0,_surveysUtils.getContrastingTextColor)(appearance.inputBackground),borderColor:appearance.borderColor}],multiline:true,numberOfLines:4,placeholder:appearance.placeholder,placeholderTextColor:(0,_surveysUtils.getContrastingTextColor)((_c=appearance.inputTextColor)!==null&&_c!==void 0?_c:(0,_surveysUtils.getContrastingTextColor)(appearance.inputBackground))==='white'?'rgba(0, 0, 0, 0.5)':'rgba(255, 255, 255, 0.5)',onChangeText:setText,value:text}),requirementsHint&&(0,_jsxRuntime.jsx)(_reactNative.Text,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'validationHint'),style:[styles.validationHint,{color:(_d=appearance.textColor)!==null&&_d!==void 0?_d:(0,_surveysUtils.getContrastingTextColor)(appearance.backgroundColor)}],children:requirementsHint})]})]});}function LinkQuestion(_ref3){var question=_ref3.question,appearance=_ref3.appearance,_onSubmit=_ref3.onSubmit;var _a,_b;question=question;return(0,_jsxRuntime.jsx)(QuestionLayout,{footer:(0,_jsxRuntime.jsx)(_BottomSection.BottomSection,{text:(_b=(_a=question.buttonText)!==null&&_a!==void 0?_a:appearance.submitButtonText)!==null&&_b!==void 0?_b:'Submit',submitDisabled:false,link:question.link,appearance:appearance,onSubmit:function onSubmit(){return _onSubmit('link clicked');}}),children:(0,_jsxRuntime.jsx)(_QuestionHeader.QuestionHeader,{question:question.question,description:question.description,descriptionContentType:question.descriptionContentType,appearance:appearance})});}function RatingQuestion(_ref4){var _this=this;var question=_ref4.question,appearance=_ref4.appearance,_onSubmit2=_ref4.onSubmit;var _a;var _b,_c,_d;var _useState7=(0,_react.useState)(null),_useState8=(0,_slicedToArray2["default"])(_useState7,2),rating=_useState8[0],setRating=_useState8[1];question=question;return(0,_jsxRuntime.jsxs)(QuestionLayout,{footer:(0,_jsxRuntime.jsx)(_BottomSection.BottomSection,{text:(_b=question.buttonText)!==null&&_b!==void 0?_b:appearance.submitButtonText,submitDisabled:rating===null&&!question.optional,appearance:appearance,onSubmit:function onSubmit(){return _onSubmit2(rating);},skipSubmitButton:question.skipSubmitButton}),children:[(0,_jsxRuntime.jsx)(_QuestionHeader.QuestionHeader,{question:question.question,description:question.description,descriptionContentType:question.descriptionContentType,appearance:appearance}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.ratingSection,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.ratingOptions,children:[question.display===_core.SurveyRatingDisplay.Emoji&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.ratingOptionsEmoji,children:(_a=emojiScaleLists[question.scale])===null||_a===void 0?void 0:_a.map(function(Emoji,idx){var active=idx+1===rating;return(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.ratingsEmoji,onPress:function onPress(){var response=idx+1;setRating(response);if(question.skipSubmitButton){_onSubmit2(response);}},children:(0,_jsxRuntime.jsx)(Emoji,{fill:active?appearance.ratingButtonActiveColor:appearance.ratingButtonColor})},idx);})}),question.display===_core.SurveyRatingDisplay.Number&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.ratingOptionsNumber,{borderColor:appearance.borderColor}],children:getScaleNumbers(question.scale).map(function(number,idx){var active=rating===number;return(0,_jsxRuntime.jsx)(RatingButton,{index:idx,active:active,appearance:appearance,num:number,setActiveNumber:function setActiveNumber(response){setRating(response);if(question.skipSubmitButton){_onSubmit2(response);}}},idx);})})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.ratingText,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'ratingLabel'),style:{color:(_c=appearance.textColor)!==null&&_c!==void 0?_c:(0,_surveysUtils.getContrastingTextColor)(appearance.backgroundColor),opacity:_surveysUtils.defaultRatingLabelOpacity},children:question.lowerBoundLabel}),(0,_jsxRuntime.jsx)(_reactNative.Text,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'ratingLabel'),style:{color:(_d=appearance.textColor)!==null&&_d!==void 0?_d:(0,_surveysUtils.getContrastingTextColor)(appearance.backgroundColor),opacity:_surveysUtils.defaultRatingLabelOpacity},children:question.upperBoundLabel})]})]})]});}function RatingButton(_ref5){var index=_ref5.index,num=_ref5.num,active=_ref5.active,appearance=_ref5.appearance,setActiveNumber=_ref5.setActiveNumber;var _a;var backgroundColor=active?appearance.ratingButtonActiveColor:appearance.ratingButtonColor;var textColor=active?(0,_surveysUtils.getContrastingTextColor)(backgroundColor):(_a=appearance.inputTextColor)!==null&&_a!==void 0?_a:(0,_surveysUtils.getContrastingTextColor)(backgroundColor);return(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.ratingsNumber,index===0&&{borderLeftWidth:0},{backgroundColor:backgroundColor,borderColor:appearance.borderColor}],onPress:function onPress(){return setActiveNumber(num);},children:(0,_jsxRuntime.jsx)(_reactNative.Text,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'ratingNumber'),style:{color:textColor},children:num})});}function MultipleChoiceQuestion(_ref6){var _this2=this;var question=_ref6.question,appearance=_ref6.appearance,_onSubmit3=_ref6.onSubmit;var _a;question=question;var isSingleChoice=question.type===_core.SurveyQuestionType.SingleChoice;var allowMultiple=question.type===_core.SurveyQuestionType.MultipleChoice;var openChoiceIndex=question.hasOpenChoice?question.choices.length-1:-1;var choices=(0,_react.useMemo)(function(){return(0,_surveyShuffling.getDisplayOrderChoices)(question);},[question]);var _useState9=(0,_react.useState)([]),_useState0=(0,_slicedToArray2["default"])(_useState9,2),selectedChoiceIndices=_useState0[0],setSelectedChoiceIndices=_useState0[1];var _useState1=(0,_react.useState)(''),_useState10=(0,_slicedToArray2["default"])(_useState1,2),openEndedInput=_useState10[0],setOpenEndedInput=_useState10[1];var shouldSkipSubmit=question.skipSubmitButton&&isSingleChoice&&!question.hasOpenChoice;return(0,_jsxRuntime.jsxs)(QuestionLayout,{footer:(0,_jsxRuntime.jsx)(_BottomSection.BottomSection,{text:(_a=question.buttonText)!==null&&_a!==void 0?_a:appearance.submitButtonText,submitDisabled:!question.optional&&(selectedChoiceIndices.length===0||selectedChoiceIndices.includes(openChoiceIndex)&&openEndedInput.length===0),appearance:appearance,onSubmit:function onSubmit(){var result=selectedChoiceIndices.map(function(index){return index===openChoiceIndex?openEndedInput:question.choices[index];});_onSubmit3(allowMultiple?result:result[0]);},skipSubmitButton:shouldSkipSubmit}),children:[(0,_jsxRuntime.jsx)(_QuestionHeader.QuestionHeader,{question:question.question,description:question.description,descriptionContentType:question.descriptionContentType,appearance:appearance}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.multipleChoiceOptions,children:choices.map(function(choice,choiceIndex){var _a;var isOpenChoice=choiceIndex===openChoiceIndex;var isSelected=selectedChoiceIndices.includes(choiceIndex);var choiceTextColor=(_a=appearance.inputTextColor)!==null&&_a!==void 0?_a:(0,_surveysUtils.getContrastingTextColor)(appearance.inputBackground);return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{style:[styles.choiceOption,{backgroundColor:appearance.inputBackground},isSelected?{borderColor:(0,_surveysUtils.getContrastingTextColor)(appearance.backgroundColor)}:{}],onPress:function onPress(){if(allowMultiple){setSelectedChoiceIndices(isSelected?selectedChoiceIndices.filter(function(index){return index!==choiceIndex;}):[].concat((0,_toConsumableArray2["default"])(selectedChoiceIndices),[choiceIndex]));}else{setSelectedChoiceIndices([choiceIndex]);if(shouldSkipSubmit&&!isOpenChoice){_onSubmit3(choice);}}},children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.choiceText,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'choice'),style:{flexGrow:1,color:choiceTextColor},children:[choice,isOpenChoice?':':'']}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.rightCheckArea,children:isSelected&&(0,_jsxRuntime.jsx)(_icons.CheckSVG,{})})]}),isOpenChoice&&(0,_jsxRuntime.jsx)(_reactNative.TextInput,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'input'),style:styles.openEndedInput,onChangeText:function onChangeText(userValue){setOpenEndedInput(userValue);if(!isSelected){setSelectedChoiceIndices(allowMultiple?[].concat((0,_toConsumableArray2["default"])(selectedChoiceIndices),[choiceIndex]):[choiceIndex]);}}})]},choiceIndex);})})]});}var emojiScaleLists={2:[_icons.ThumbsUpEmoji,_icons.ThumbsDownEmoji],3:[_icons.DissatisfiedEmoji,_icons.NeutralEmoji,_icons.SatisfiedEmoji],5:[_icons.VeryDissatisfiedEmoji,_icons.DissatisfiedEmoji,_icons.NeutralEmoji,_icons.SatisfiedEmoji,_icons.VerySatisfiedEmoji]};var fiveScaleNumbers=[1,2,3,4,5];var sevenScaleNumbers=[1,2,3,4,5,6,7];var tenScaleNumbers=[0,1,2,3,4,5,6,7,8,9,10];function getScaleNumbers(scale){switch(scale){case 5:return fiveScaleNumbers;case 7:return sevenScaleNumbers;case 10:return tenScaleNumbers;default:return fiveScaleNumbers;}}var styles=(0,_safeStyleSheet.createSafeStyleSheet)({textInputContainer:{padding:10},textInput:{borderColor:'#ccc',borderWidth:1,padding:10,marginVertical:10,fontSize:16,height:80,textAlignVertical:'top'},ratingSection:{marginVertical:10},ratingOptions:{flexDirection:'row',justifyContent:'space-between'},ratingOptionsEmoji:{flexDirection:'row',justifyContent:'space-around',flexWrap:'nowrap',flex:1},ratingsEmoji:{padding:4},ratingOptionsNumber:{margin:10,flexGrow:1,flexDirection:'row',justifyContent:'space-between',borderRadius:5,borderWidth:1,overflow:'hidden'},ratingsNumber:{flex:1,paddingVertical:10,alignItems:'center',borderLeftWidth:1},ratingText:{flexDirection:'row',justifyContent:'space-between',padding:10},multipleChoiceOptions:{padding:10},choiceOption:{flexDirection:'column',marginVertical:5,borderWidth:1,borderColor:'grey',borderRadius:5,padding:10},choiceText:{flexDirection:'row'},rightCheckArea:{flexGrow:0},openEndedInput:{padding:5},validationHint:{fontSize:12,opacity:0.7,marginTop:4}});
1
+ "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _typeof=require("@babel/runtime/helpers/typeof");Object.defineProperty(exports,"__esModule",{value:true});exports.LinkQuestion=LinkQuestion;exports.MultipleChoiceQuestion=MultipleChoiceQuestion;exports.OpenTextQuestion=OpenTextQuestion;exports.RatingButton=RatingButton;exports.RatingQuestion=RatingQuestion;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _safeStyleSheet=require("../safeStyleSheet");var _icons=require("../icons");var _surveysUtils=require("../surveys-utils");var _surveyShuffling=require("../survey-shuffling");var _core=require("@posthog/core");var _surveys=require("@posthog/core/surveys");var _BottomSection=require("./BottomSection");var _QuestionHeader=require("./QuestionHeader");var _jsxRuntime=require("react/jsx-runtime");var _jsxFileName="/home/runner/work/posthog-js/posthog-js/packages/react-native/dist/surveys/components/QuestionTypes.js";function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var r=new WeakMap(),n=new WeakMap();return(_interopRequireWildcard=function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var o,i,f={__proto__:null,"default":e};if(null===e||"object"!=_typeof(e)&&"function"!=typeof e)return f;if(o=t?n:r){if(o.has(e))return o.get(e);o.set(e,f);}for(var _t2 in e)"default"!==_t2&&{}.hasOwnProperty.call(e,_t2)&&((i=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,_t2))&&(i.get||i.set)?o(f,_t2,i):f[_t2]=e[_t2]);return f;})(e,t);}function QuestionLayout(_ref){var children=_ref.children,footer=_ref.footer;var _useState=(0,_react.useState)(0),_useState2=(0,_slicedToArray2["default"])(_useState,2),viewportHeight=_useState2[0],setViewportHeight=_useState2[1];var _useState3=(0,_react.useState)(0),_useState4=(0,_slicedToArray2["default"])(_useState3,2),contentHeight=_useState4[0],setContentHeight=_useState4[1];var isOverflowing=contentHeight>viewportHeight+1;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:questionLayoutStyles.container,children:[(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{style:questionLayoutStyles.scroll,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,scrollEnabled:isOverflowing,bounces:isOverflowing,onLayout:function onLayout(e){return setViewportHeight(e.nativeEvent.layout.height);},onContentSizeChange:function onContentSizeChange(_width,height){return setContentHeight(height);},children:children}),footer]});}var questionLayoutStyles=(0,_safeStyleSheet.createSafeStyleSheet)({container:{flexShrink:1},scroll:{flexShrink:1}});function OpenTextQuestion(_ref2){var question=_ref2.question,appearance=_ref2.appearance,onSubmit=_ref2.onSubmit;var _a,_b,_c,_d;var _useState5=(0,_react.useState)(''),_useState6=(0,_slicedToArray2["default"])(_useState5,2),text=_useState6[0],setText=_useState6[1];var validationError=(0,_react.useMemo)(function(){return(0,_surveys.getValidationError)(text,question.validation,question.optional);},[text,question.validation,question.optional]);var minLength=(0,_surveys.getLengthFromRules)(question.validation,_core.SurveyValidationType.MinLength);var maxLength=(0,_surveys.getLengthFromRules)(question.validation,_core.SurveyValidationType.MaxLength);var requirementsHint=(0,_react.useMemo)(function(){return(0,_surveys.getRequirementsHint)(minLength,maxLength);},[minLength,maxLength]);var handleSubmit=function handleSubmit(){if(validationError){return;}onSubmit(text.trim());};return(0,_jsxRuntime.jsxs)(QuestionLayout,{footer:(0,_jsxRuntime.jsx)(_BottomSection.BottomSection,{text:(_a=question.buttonText)!==null&&_a!==void 0?_a:appearance.submitButtonText,submitDisabled:!!validationError,appearance:appearance,onSubmit:handleSubmit}),children:[(0,_jsxRuntime.jsx)(_QuestionHeader.QuestionHeader,{question:question.question,description:question.description,descriptionContentType:question.descriptionContentType,appearance:appearance}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.textInputContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.TextInput,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'input'),style:[styles.textInput,{backgroundColor:appearance.inputBackground,color:(_b=appearance.inputTextColor)!==null&&_b!==void 0?_b:(0,_surveysUtils.getContrastingTextColor)(appearance.inputBackground),borderColor:appearance.borderColor}],multiline:true,numberOfLines:4,placeholder:appearance.placeholder,placeholderTextColor:(0,_surveysUtils.getContrastingTextColor)((_c=appearance.inputTextColor)!==null&&_c!==void 0?_c:(0,_surveysUtils.getContrastingTextColor)(appearance.inputBackground))==='white'?'rgba(0, 0, 0, 0.5)':'rgba(255, 255, 255, 0.5)',onChangeText:setText,value:text}),requirementsHint&&(0,_jsxRuntime.jsx)(_reactNative.Text,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'validationHint'),style:[styles.validationHint,{color:(_d=appearance.textColor)!==null&&_d!==void 0?_d:(0,_surveysUtils.getContrastingTextColor)(appearance.backgroundColor)}],children:requirementsHint})]})]});}function LinkQuestion(_ref3){var question=_ref3.question,appearance=_ref3.appearance,_onSubmit=_ref3.onSubmit;var _a,_b;question=question;return(0,_jsxRuntime.jsx)(QuestionLayout,{footer:(0,_jsxRuntime.jsx)(_BottomSection.BottomSection,{text:(_b=(_a=question.buttonText)!==null&&_a!==void 0?_a:appearance.submitButtonText)!==null&&_b!==void 0?_b:'Submit',submitDisabled:false,link:question.link,appearance:appearance,onSubmit:function onSubmit(){return _onSubmit('link clicked');}}),children:(0,_jsxRuntime.jsx)(_QuestionHeader.QuestionHeader,{question:question.question,description:question.description,descriptionContentType:question.descriptionContentType,appearance:appearance})});}function RatingQuestion(_ref4){var _this=this;var question=_ref4.question,appearance=_ref4.appearance,_onSubmit2=_ref4.onSubmit;var _a;var _b,_c,_d;var _useState7=(0,_react.useState)(null),_useState8=(0,_slicedToArray2["default"])(_useState7,2),rating=_useState8[0],setRating=_useState8[1];question=question;return(0,_jsxRuntime.jsxs)(QuestionLayout,{footer:(0,_jsxRuntime.jsx)(_BottomSection.BottomSection,{text:(_b=question.buttonText)!==null&&_b!==void 0?_b:appearance.submitButtonText,submitDisabled:rating===null&&!question.optional,appearance:appearance,onSubmit:function onSubmit(){return _onSubmit2(rating);},skipSubmitButton:question.skipSubmitButton}),children:[(0,_jsxRuntime.jsx)(_QuestionHeader.QuestionHeader,{question:question.question,description:question.description,descriptionContentType:question.descriptionContentType,appearance:appearance}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.ratingSection,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.ratingOptions,children:[question.display===_core.SurveyRatingDisplay.Emoji&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.ratingOptionsEmoji,children:(_a=emojiScaleLists[question.scale])===null||_a===void 0?void 0:_a.map(function(Emoji,idx){var active=idx+1===rating;return(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.ratingsEmoji,onPress:function onPress(){var response=idx+1;setRating(response);if(question.skipSubmitButton){_onSubmit2(response);}},children:(0,_jsxRuntime.jsx)(Emoji,{fill:active?appearance.ratingButtonActiveColor:appearance.ratingButtonColor})},idx);})}),question.display===_core.SurveyRatingDisplay.Number&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.ratingOptionsNumber,{borderColor:appearance.borderColor}],children:getScaleNumbers(question.scale).map(function(number,idx){var active=rating===number;return(0,_jsxRuntime.jsx)(RatingButton,{index:idx,active:active,appearance:appearance,num:number,setActiveNumber:function setActiveNumber(response){setRating(response);if(question.skipSubmitButton){_onSubmit2(response);}}},idx);})})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.ratingText,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'ratingLabel'),style:{color:(_c=appearance.textColor)!==null&&_c!==void 0?_c:(0,_surveysUtils.getContrastingTextColor)(appearance.backgroundColor),opacity:_surveysUtils.defaultRatingLabelOpacity},children:question.lowerBoundLabel}),(0,_jsxRuntime.jsx)(_reactNative.Text,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'ratingLabel'),style:{color:(_d=appearance.textColor)!==null&&_d!==void 0?_d:(0,_surveysUtils.getContrastingTextColor)(appearance.backgroundColor),opacity:_surveysUtils.defaultRatingLabelOpacity},children:question.upperBoundLabel})]})]})]});}function RatingButton(_ref5){var index=_ref5.index,num=_ref5.num,active=_ref5.active,appearance=_ref5.appearance,setActiveNumber=_ref5.setActiveNumber;var _a;var backgroundColor=active?appearance.ratingButtonActiveColor:appearance.ratingButtonColor;var textColor=active?(0,_surveysUtils.getContrastingTextColor)(backgroundColor):(_a=appearance.inputTextColor)!==null&&_a!==void 0?_a:(0,_surveysUtils.getContrastingTextColor)(backgroundColor);return(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.ratingsNumber,index===0&&{borderLeftWidth:0},{backgroundColor:backgroundColor,borderColor:appearance.borderColor}],onPress:function onPress(){return setActiveNumber(num);},children:(0,_jsxRuntime.jsx)(_reactNative.Text,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'ratingNumber'),style:{color:textColor},children:num})});}function MultipleChoiceQuestion(_ref6){var _this2=this;var question=_ref6.question,appearance=_ref6.appearance,_onSubmit3=_ref6.onSubmit;var _a;question=question;var isSingleChoice=question.type===_core.SurveyQuestionType.SingleChoice;var allowMultiple=question.type===_core.SurveyQuestionType.MultipleChoice;var openChoiceIndex=question.hasOpenChoice?question.choices.length-1:-1;var choices=(0,_react.useMemo)(function(){return(0,_surveyShuffling.getDisplayOrderChoices)(question);},[question]);var _useState9=(0,_react.useState)([]),_useState0=(0,_slicedToArray2["default"])(_useState9,2),selectedChoiceIndices=_useState0[0],setSelectedChoiceIndices=_useState0[1];var _useState1=(0,_react.useState)(''),_useState10=(0,_slicedToArray2["default"])(_useState1,2),openEndedInput=_useState10[0],setOpenEndedInput=_useState10[1];var shouldSkipSubmit=question.skipSubmitButton&&isSingleChoice&&!question.hasOpenChoice;return(0,_jsxRuntime.jsxs)(QuestionLayout,{footer:(0,_jsxRuntime.jsx)(_BottomSection.BottomSection,{text:(_a=question.buttonText)!==null&&_a!==void 0?_a:appearance.submitButtonText,submitDisabled:!question.optional&&(selectedChoiceIndices.length===0||selectedChoiceIndices.includes(openChoiceIndex)&&openEndedInput.length===0),appearance:appearance,onSubmit:function onSubmit(){var result=selectedChoiceIndices.map(function(index){return index===openChoiceIndex?openEndedInput:choices[index];});_onSubmit3(allowMultiple?result:result[0]);},skipSubmitButton:shouldSkipSubmit}),children:[(0,_jsxRuntime.jsx)(_QuestionHeader.QuestionHeader,{question:question.question,description:question.description,descriptionContentType:question.descriptionContentType,appearance:appearance}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.multipleChoiceOptions,children:choices.map(function(choice,choiceIndex){var _a;var isOpenChoice=choiceIndex===openChoiceIndex;var isSelected=selectedChoiceIndices.includes(choiceIndex);var choiceTextColor=(_a=appearance.inputTextColor)!==null&&_a!==void 0?_a:(0,_surveysUtils.getContrastingTextColor)(appearance.inputBackground);return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{style:[styles.choiceOption,{backgroundColor:appearance.inputBackground},isSelected?{borderColor:(0,_surveysUtils.getContrastingTextColor)(appearance.backgroundColor)}:{}],onPress:function onPress(){if(allowMultiple){setSelectedChoiceIndices(isSelected?selectedChoiceIndices.filter(function(index){return index!==choiceIndex;}):[].concat((0,_toConsumableArray2["default"])(selectedChoiceIndices),[choiceIndex]));}else{setSelectedChoiceIndices([choiceIndex]);if(shouldSkipSubmit&&!isOpenChoice){_onSubmit3(choice);}}},children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.choiceText,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'choice'),style:{flexGrow:1,color:choiceTextColor},children:[choice,isOpenChoice?':':'']}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.rightCheckArea,children:isSelected&&(0,_jsxRuntime.jsx)(_icons.CheckSVG,{})})]}),isOpenChoice&&(0,_jsxRuntime.jsx)(_reactNative.TextInput,{maxFontSizeMultiplier:(0,_surveysUtils.getMaxFontSizeMultiplier)(appearance,'input'),style:styles.openEndedInput,onChangeText:function onChangeText(userValue){setOpenEndedInput(userValue);if(!isSelected){setSelectedChoiceIndices(allowMultiple?[].concat((0,_toConsumableArray2["default"])(selectedChoiceIndices),[choiceIndex]):[choiceIndex]);}}})]},choiceIndex);})})]});}var emojiScaleLists={2:[_icons.ThumbsUpEmoji,_icons.ThumbsDownEmoji],3:[_icons.DissatisfiedEmoji,_icons.NeutralEmoji,_icons.SatisfiedEmoji],5:[_icons.VeryDissatisfiedEmoji,_icons.DissatisfiedEmoji,_icons.NeutralEmoji,_icons.SatisfiedEmoji,_icons.VerySatisfiedEmoji]};var fiveScaleNumbers=[1,2,3,4,5];var sevenScaleNumbers=[1,2,3,4,5,6,7];var tenScaleNumbers=[0,1,2,3,4,5,6,7,8,9,10];function getScaleNumbers(scale){switch(scale){case 5:return fiveScaleNumbers;case 7:return sevenScaleNumbers;case 10:return tenScaleNumbers;default:return fiveScaleNumbers;}}var styles=(0,_safeStyleSheet.createSafeStyleSheet)({textInputContainer:{padding:10},textInput:{borderColor:'#ccc',borderWidth:1,padding:10,marginVertical:10,fontSize:16,height:80,textAlignVertical:'top'},ratingSection:{marginVertical:10},ratingOptions:{flexDirection:'row',justifyContent:'space-between'},ratingOptionsEmoji:{flexDirection:'row',justifyContent:'space-around',flexWrap:'nowrap',flex:1},ratingsEmoji:{padding:4},ratingOptionsNumber:{margin:10,flexGrow:1,flexDirection:'row',justifyContent:'space-between',borderRadius:5,borderWidth:1,overflow:'hidden'},ratingsNumber:{flex:1,paddingVertical:10,alignItems:'center',borderLeftWidth:1},ratingText:{flexDirection:'row',justifyContent:'space-between',padding:10},multipleChoiceOptions:{padding:10},choiceOption:{flexDirection:'column',marginVertical:5,borderWidth:1,borderColor:'grey',borderRadius:5,padding:10},choiceText:{flexDirection:'row'},rightCheckArea:{flexGrow:0},openEndedInput:{padding:5},validationHint:{fontSize:12,opacity:0.7,marginTop:4}});
2
2
  //# sourceMappingURL=QuestionTypes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"QuestionTypes.js","names":["_react","_interopRequireWildcard","require","_reactNative","_safeStyleSheet","_icons","_surveysUtils","_surveyShuffling","_core","_surveys","_BottomSection","_QuestionHeader","_jsxRuntime","_jsxFileName","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t2","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","QuestionLayout","_ref","children","footer","_useState","useState","_useState2","_slicedToArray2","viewportHeight","setViewportHeight","_useState3","_useState4","contentHeight","setContentHeight","isOverflowing","jsxs","View","style","questionLayoutStyles","container","jsx","ScrollView","scroll","keyboardShouldPersistTaps","showsVerticalScrollIndicator","scrollEnabled","bounces","onLayout","nativeEvent","layout","height","onContentSizeChange","_width","createSafeStyleSheet","flexShrink","OpenTextQuestion","_ref2","question","appearance","onSubmit","_useState5","_useState6","text","setText","validationError","useMemo","getValidationError","validation","optional","minLength","getLengthFromRules","SurveyValidationType","MinLength","maxLength","MaxLength","requirementsHint","getRequirementsHint","handleSubmit","trim","BottomSection","_a","buttonText","submitButtonText","submitDisabled","QuestionHeader","description","descriptionContentType","styles","textInputContainer","TextInput","maxFontSizeMultiplier","getMaxFontSizeMultiplier","textInput","backgroundColor","inputBackground","color","_b","inputTextColor","getContrastingTextColor","borderColor","multiline","numberOfLines","placeholder","placeholderTextColor","_c","onChangeText","value","Text","validationHint","_d","textColor","LinkQuestion","_ref3","link","RatingQuestion","_ref4","_this","_useState7","_useState8","rating","setRating","skipSubmitButton","ratingSection","ratingOptions","display","SurveyRatingDisplay","Emoji","ratingOptionsEmoji","emojiScaleLists","scale","map","idx","active","TouchableOpacity","ratingsEmoji","onPress","response","fill","ratingButtonActiveColor","ratingButtonColor","Number","ratingOptionsNumber","getScaleNumbers","number","RatingButton","index","num","setActiveNumber","ratingText","opacity","defaultRatingLabelOpacity","lowerBoundLabel","upperBoundLabel","_ref5","ratingsNumber","borderLeftWidth","MultipleChoiceQuestion","_ref6","_this2","isSingleChoice","type","SurveyQuestionType","SingleChoice","allowMultiple","MultipleChoice","openChoiceIndex","hasOpenChoice","choices","length","getDisplayOrderChoices","_useState9","_useState0","selectedChoiceIndices","setSelectedChoiceIndices","_useState1","_useState10","openEndedInput","setOpenEndedInput","shouldSkipSubmit","includes","result","multipleChoiceOptions","choice","choiceIndex","isOpenChoice","isSelected","choiceTextColor","Pressable","choiceOption","filter","concat","_toConsumableArray2","choiceText","flexGrow","rightCheckArea","CheckSVG","userValue","ThumbsUpEmoji","ThumbsDownEmoji","DissatisfiedEmoji","NeutralEmoji","SatisfiedEmoji","VeryDissatisfiedEmoji","VerySatisfiedEmoji","fiveScaleNumbers","sevenScaleNumbers","tenScaleNumbers","padding","borderWidth","marginVertical","fontSize","textAlignVertical","flexDirection","justifyContent","flexWrap","flex","margin","borderRadius","overflow","paddingVertical","alignItems","marginTop"],"sources":["../../../src/surveys/components/QuestionTypes.tsx"],"sourcesContent":["import React, { ReactNode, useMemo, useState } from 'react'\nimport { LayoutChangeEvent, Pressable, ScrollView, Text, TextInput, TouchableOpacity, View } from 'react-native'\n\nimport { createSafeStyleSheet } from '../safeStyleSheet'\nimport {\n CheckSVG,\n DissatisfiedEmoji,\n NeutralEmoji,\n SatisfiedEmoji,\n ThumbsDownEmoji,\n ThumbsUpEmoji,\n VeryDissatisfiedEmoji,\n VerySatisfiedEmoji,\n} from '../icons'\nimport {\n defaultRatingLabelOpacity,\n getContrastingTextColor,\n getMaxFontSizeMultiplier,\n SurveyAppearanceTheme,\n} from '../surveys-utils'\nimport { getDisplayOrderChoices } from '../survey-shuffling'\nimport {\n SurveyQuestion,\n SurveyRatingDisplay,\n SurveyQuestionType,\n LinkSurveyQuestion,\n RatingSurveyQuestion,\n MultipleSurveyQuestion,\n SurveyValidationType,\n} from '@posthog/core'\nimport { getValidationError, getLengthFromRules, getRequirementsHint } from '@posthog/core/surveys'\nimport { BottomSection } from './BottomSection'\nimport { QuestionHeader } from './QuestionHeader'\n\ninterface QuestionCommonProps {\n question: SurveyQuestion\n appearance: SurveyAppearanceTheme\n}\n\n// Wraps question content in a scrollable region with a sticky BottomSection\n// (Submit button) at the bottom. The ScrollView has flexShrink: 1 so it\n// shrinks to fit when the parent modal is capped at its keyboard-aware\n// maxHeight, keeping Submit visible regardless of survey length. Scrolling is\n// enabled only while the content overflows the viewport, so short surveys don't\n// scroll or bounce.\nfunction QuestionLayout({ children, footer }: { children: ReactNode; footer: ReactNode }): JSX.Element {\n const [viewportHeight, setViewportHeight] = useState(0)\n const [contentHeight, setContentHeight] = useState(0)\n // 1px threshold absorbs sub-pixel layout rounding.\n const isOverflowing = contentHeight > viewportHeight + 1\n\n return (\n <View style={questionLayoutStyles.container}>\n <ScrollView\n style={questionLayoutStyles.scroll}\n keyboardShouldPersistTaps=\"handled\"\n showsVerticalScrollIndicator={false}\n scrollEnabled={isOverflowing}\n bounces={isOverflowing}\n onLayout={(e: LayoutChangeEvent) => setViewportHeight(e.nativeEvent.layout.height)}\n onContentSizeChange={(_width, height) => setContentHeight(height)}\n >\n {children}\n </ScrollView>\n {footer}\n </View>\n )\n}\n\nconst questionLayoutStyles = createSafeStyleSheet({\n container: {\n flexShrink: 1,\n },\n scroll: {\n flexShrink: 1,\n },\n})\n\nexport function OpenTextQuestion({\n question,\n appearance,\n onSubmit,\n}: QuestionCommonProps & {\n onSubmit: (text: string) => void\n}): JSX.Element {\n const [text, setText] = useState('')\n\n // Memoize validation error to avoid recalculating on every render\n const validationError = useMemo(\n () => getValidationError(text, question.validation, question.optional),\n [text, question.validation, question.optional]\n )\n\n // Build requirements hint message\n const minLength = getLengthFromRules(question.validation, SurveyValidationType.MinLength)\n const maxLength = getLengthFromRules(question.validation, SurveyValidationType.MaxLength)\n const requirementsHint = useMemo(() => getRequirementsHint(minLength, maxLength), [minLength, maxLength])\n\n const handleSubmit = () => {\n if (validationError) {\n return\n }\n onSubmit(text.trim())\n }\n\n return (\n <QuestionLayout\n footer={\n <BottomSection\n text={question.buttonText ?? appearance.submitButtonText}\n submitDisabled={!!validationError}\n appearance={appearance}\n onSubmit={handleSubmit}\n />\n }\n >\n <QuestionHeader\n question={question.question}\n description={question.description}\n descriptionContentType={question.descriptionContentType}\n appearance={appearance}\n />\n <View style={styles.textInputContainer}>\n <TextInput\n maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'input')}\n style={[\n styles.textInput,\n {\n backgroundColor: appearance.inputBackground,\n color: appearance.inputTextColor ?? getContrastingTextColor(appearance.inputBackground),\n borderColor: appearance.borderColor,\n },\n ]}\n multiline\n numberOfLines={4}\n placeholder={appearance.placeholder}\n placeholderTextColor={\n getContrastingTextColor(\n appearance.inputTextColor ?? getContrastingTextColor(appearance.inputBackground)\n ) === 'white'\n ? 'rgba(0, 0, 0, 0.5)'\n : 'rgba(255, 255, 255, 0.5)'\n }\n onChangeText={setText}\n value={text}\n />\n {requirementsHint && (\n <Text\n maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'validationHint')}\n style={[\n styles.validationHint,\n { color: appearance.textColor ?? getContrastingTextColor(appearance.backgroundColor) },\n ]}\n >\n {requirementsHint}\n </Text>\n )}\n </View>\n </QuestionLayout>\n )\n}\n\nexport function LinkQuestion({\n question,\n appearance,\n onSubmit,\n}: QuestionCommonProps & {\n onSubmit: (clicked: string) => void\n}): JSX.Element {\n question = question as LinkSurveyQuestion\n\n return (\n <QuestionLayout\n footer={\n <BottomSection\n text={question.buttonText ?? appearance.submitButtonText ?? 'Submit'}\n submitDisabled={false}\n link={question.link}\n appearance={appearance}\n onSubmit={() => onSubmit('link clicked')}\n />\n }\n >\n <QuestionHeader\n question={question.question}\n description={question.description}\n descriptionContentType={question.descriptionContentType}\n appearance={appearance}\n />\n </QuestionLayout>\n )\n}\n\nexport function RatingQuestion({\n question,\n appearance,\n onSubmit,\n}: QuestionCommonProps & {\n onSubmit: (rating: number | null) => void\n}): JSX.Element {\n //const starting = question.scale === 10 ? 0 : 1;\n const [rating, setRating] = useState<number | null>(null)\n question = question as RatingSurveyQuestion\n\n return (\n <QuestionLayout\n footer={\n <BottomSection\n text={question.buttonText ?? appearance.submitButtonText}\n submitDisabled={rating === null && !question.optional}\n appearance={appearance}\n onSubmit={() => onSubmit(rating)}\n skipSubmitButton={question.skipSubmitButton}\n />\n }\n >\n <QuestionHeader\n question={question.question}\n description={question.description}\n descriptionContentType={question.descriptionContentType}\n appearance={appearance}\n />\n <View style={styles.ratingSection}>\n <View style={styles.ratingOptions}>\n {question.display === SurveyRatingDisplay.Emoji && (\n <View style={styles.ratingOptionsEmoji}>\n {emojiScaleLists[question.scale]?.map((Emoji, idx) => {\n const active = idx + 1 === rating\n return (\n <TouchableOpacity\n key={idx}\n style={styles.ratingsEmoji}\n onPress={() => {\n const response = idx + 1\n setRating(response)\n if (question.skipSubmitButton) {\n onSubmit(response)\n }\n }}\n >\n <Emoji fill={active ? appearance.ratingButtonActiveColor : appearance.ratingButtonColor} />\n </TouchableOpacity>\n )\n })}\n </View>\n )}\n {question.display === SurveyRatingDisplay.Number && (\n <View style={[styles.ratingOptionsNumber, { borderColor: appearance.borderColor }]}>\n {getScaleNumbers(question.scale).map((number, idx) => {\n const active = rating === number\n return (\n <RatingButton\n key={idx}\n index={idx}\n active={active}\n appearance={appearance}\n num={number}\n setActiveNumber={(response) => {\n setRating(response)\n if (question.skipSubmitButton) {\n onSubmit(response)\n }\n }}\n />\n )\n })}\n </View>\n )}\n </View>\n <View style={styles.ratingText}>\n <Text\n maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'ratingLabel')}\n style={{\n color: appearance.textColor ?? getContrastingTextColor(appearance.backgroundColor),\n opacity: defaultRatingLabelOpacity,\n }}\n >\n {question.lowerBoundLabel}\n </Text>\n <Text\n maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'ratingLabel')}\n style={{\n color: appearance.textColor ?? getContrastingTextColor(appearance.backgroundColor),\n opacity: defaultRatingLabelOpacity,\n }}\n >\n {question.upperBoundLabel}\n </Text>\n </View>\n </View>\n </QuestionLayout>\n )\n}\n\nexport function RatingButton({\n index,\n num,\n active,\n appearance,\n setActiveNumber,\n}: {\n index: number\n num: number\n active: boolean\n appearance: SurveyAppearanceTheme\n setActiveNumber: (num: number) => void\n}): JSX.Element {\n const backgroundColor = active ? appearance.ratingButtonActiveColor : appearance.ratingButtonColor\n // Active state always auto-calculates for contrast; inactive uses inputTextColor override if provided\n const textColor = active\n ? getContrastingTextColor(backgroundColor)\n : (appearance.inputTextColor ?? getContrastingTextColor(backgroundColor))\n\n return (\n <TouchableOpacity\n style={[\n styles.ratingsNumber,\n index === 0 && { borderLeftWidth: 0 },\n { backgroundColor, borderColor: appearance.borderColor },\n ]}\n onPress={() => setActiveNumber(num)}\n >\n <Text maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'ratingNumber')} style={{ color: textColor }}>\n {num}\n </Text>\n </TouchableOpacity>\n )\n}\n\nexport function MultipleChoiceQuestion({\n question,\n appearance,\n onSubmit,\n}: QuestionCommonProps & {\n onSubmit: (choices: string | string[] | null) => void\n}): JSX.Element {\n question = question as MultipleSurveyQuestion\n const isSingleChoice = question.type === SurveyQuestionType.SingleChoice\n const allowMultiple = question.type === SurveyQuestionType.MultipleChoice\n const openChoiceIndex = question.hasOpenChoice ? question.choices.length - 1 : -1\n const choices = useMemo(() => getDisplayOrderChoices(question as MultipleSurveyQuestion), [question])\n // Choice labels change with survey translations; keep selection tied to the original order.\n const [selectedChoiceIndices, setSelectedChoiceIndices] = useState<number[]>([])\n const [openEndedInput, setOpenEndedInput] = useState('')\n\n // Only skip submit for single-choice questions without open choice\n const shouldSkipSubmit = question.skipSubmitButton && isSingleChoice && !question.hasOpenChoice\n\n return (\n <QuestionLayout\n footer={\n <BottomSection\n text={question.buttonText ?? appearance.submitButtonText}\n submitDisabled={\n !question.optional &&\n (selectedChoiceIndices.length === 0 ||\n (selectedChoiceIndices.includes(openChoiceIndex) && openEndedInput.length === 0))\n }\n appearance={appearance}\n onSubmit={() => {\n const result = selectedChoiceIndices.map((index) =>\n index === openChoiceIndex ? openEndedInput : question.choices[index]\n )\n onSubmit(allowMultiple ? result : result[0])\n }}\n skipSubmitButton={shouldSkipSubmit}\n />\n }\n >\n <QuestionHeader\n question={question.question}\n description={question.description}\n descriptionContentType={question.descriptionContentType}\n appearance={appearance}\n />\n <View style={styles.multipleChoiceOptions}>\n {choices.map((choice: string, choiceIndex: number) => {\n const isOpenChoice = choiceIndex === openChoiceIndex\n const isSelected = selectedChoiceIndices.includes(choiceIndex)\n\n const choiceTextColor = appearance.inputTextColor ?? getContrastingTextColor(appearance.inputBackground)\n\n return (\n <Pressable\n key={choiceIndex}\n style={[\n styles.choiceOption,\n { backgroundColor: appearance.inputBackground },\n isSelected ? { borderColor: getContrastingTextColor(appearance.backgroundColor) } : {},\n ]}\n onPress={() => {\n if (allowMultiple) {\n setSelectedChoiceIndices(\n isSelected\n ? selectedChoiceIndices.filter((index) => index !== choiceIndex)\n : [...selectedChoiceIndices, choiceIndex]\n )\n } else {\n setSelectedChoiceIndices([choiceIndex])\n if (shouldSkipSubmit && !isOpenChoice) {\n onSubmit(choice)\n }\n }\n }}\n >\n <View style={styles.choiceText}>\n <Text\n maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'choice')}\n style={{ flexGrow: 1, color: choiceTextColor }}\n >\n {choice}\n {isOpenChoice ? ':' : ''}\n </Text>\n <View style={styles.rightCheckArea}>{isSelected && <CheckSVG />}</View>\n </View>\n {isOpenChoice && (\n <TextInput\n maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'input')}\n style={styles.openEndedInput}\n onChangeText={(userValue) => {\n setOpenEndedInput(userValue)\n if (!isSelected) {\n setSelectedChoiceIndices(allowMultiple ? [...selectedChoiceIndices, choiceIndex] : [choiceIndex])\n }\n }}\n />\n )}\n </Pressable>\n )\n })}\n </View>\n </QuestionLayout>\n )\n}\n\nconst emojiScaleLists: Record<number, (typeof ThumbsUpEmoji)[]> = {\n 2: [ThumbsUpEmoji, ThumbsDownEmoji],\n 3: [DissatisfiedEmoji, NeutralEmoji, SatisfiedEmoji],\n 5: [VeryDissatisfiedEmoji, DissatisfiedEmoji, NeutralEmoji, SatisfiedEmoji, VerySatisfiedEmoji],\n}\nconst fiveScaleNumbers = [1, 2, 3, 4, 5]\nconst sevenScaleNumbers = [1, 2, 3, 4, 5, 6, 7]\nconst tenScaleNumbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n\nfunction getScaleNumbers(scale: number): number[] {\n switch (scale) {\n case 5:\n return fiveScaleNumbers\n case 7:\n return sevenScaleNumbers\n case 10:\n return tenScaleNumbers\n default:\n return fiveScaleNumbers\n }\n}\n\nconst styles = createSafeStyleSheet({\n textInputContainer: {\n padding: 10,\n },\n textInput: {\n borderColor: '#ccc',\n borderWidth: 1,\n padding: 10,\n marginVertical: 10,\n fontSize: 16,\n // Fixed height keeps the surrounding layout stable as the user types —\n // the TextInput scrolls its own content internally\n height: 80,\n textAlignVertical: 'top',\n },\n ratingSection: {\n marginVertical: 10,\n },\n ratingOptions: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n ratingOptionsEmoji: {\n flexDirection: 'row',\n justifyContent: 'space-around',\n flexWrap: 'nowrap',\n flex: 1,\n },\n ratingsEmoji: {\n padding: 4,\n },\n ratingOptionsNumber: {\n margin: 10,\n flexGrow: 1,\n flexDirection: 'row',\n justifyContent: 'space-between',\n borderRadius: 5,\n borderWidth: 1,\n overflow: 'hidden',\n },\n ratingsNumber: {\n flex: 1,\n paddingVertical: 10,\n alignItems: 'center',\n borderLeftWidth: 1,\n },\n ratingText: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n padding: 10,\n },\n multipleChoiceOptions: {\n padding: 10,\n },\n choiceOption: {\n flexDirection: 'column',\n marginVertical: 5,\n borderWidth: 1,\n borderColor: 'grey',\n borderRadius: 5,\n padding: 10,\n },\n choiceText: {\n flexDirection: 'row',\n },\n rightCheckArea: {\n flexGrow: 0,\n },\n openEndedInput: {\n padding: 5,\n },\n validationHint: {\n fontSize: 12,\n opacity: 0.7,\n marginTop: 4,\n },\n})\n"],"mappings":"wlBAAA,IAAAA,MAAA,CAAAC,uBAAA,CAAAC,OAAA,WACA,IAAAC,YAAA,CAAAD,OAAA,iBAEA,IAAAE,eAAA,CAAAF,OAAA,sBACA,IAAAG,MAAA,CAAAH,OAAA,aAUA,IAAAI,aAAA,CAAAJ,OAA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oreList":[]}
1
+ {"version":3,"file":"QuestionTypes.js","names":["_react","_interopRequireWildcard","require","_reactNative","_safeStyleSheet","_icons","_surveysUtils","_surveyShuffling","_core","_surveys","_BottomSection","_QuestionHeader","_jsxRuntime","_jsxFileName","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t2","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","QuestionLayout","_ref","children","footer","_useState","useState","_useState2","_slicedToArray2","viewportHeight","setViewportHeight","_useState3","_useState4","contentHeight","setContentHeight","isOverflowing","jsxs","View","style","questionLayoutStyles","container","jsx","ScrollView","scroll","keyboardShouldPersistTaps","showsVerticalScrollIndicator","scrollEnabled","bounces","onLayout","nativeEvent","layout","height","onContentSizeChange","_width","createSafeStyleSheet","flexShrink","OpenTextQuestion","_ref2","question","appearance","onSubmit","_useState5","_useState6","text","setText","validationError","useMemo","getValidationError","validation","optional","minLength","getLengthFromRules","SurveyValidationType","MinLength","maxLength","MaxLength","requirementsHint","getRequirementsHint","handleSubmit","trim","BottomSection","_a","buttonText","submitButtonText","submitDisabled","QuestionHeader","description","descriptionContentType","styles","textInputContainer","TextInput","maxFontSizeMultiplier","getMaxFontSizeMultiplier","textInput","backgroundColor","inputBackground","color","_b","inputTextColor","getContrastingTextColor","borderColor","multiline","numberOfLines","placeholder","placeholderTextColor","_c","onChangeText","value","Text","validationHint","_d","textColor","LinkQuestion","_ref3","link","RatingQuestion","_ref4","_this","_useState7","_useState8","rating","setRating","skipSubmitButton","ratingSection","ratingOptions","display","SurveyRatingDisplay","Emoji","ratingOptionsEmoji","emojiScaleLists","scale","map","idx","active","TouchableOpacity","ratingsEmoji","onPress","response","fill","ratingButtonActiveColor","ratingButtonColor","Number","ratingOptionsNumber","getScaleNumbers","number","RatingButton","index","num","setActiveNumber","ratingText","opacity","defaultRatingLabelOpacity","lowerBoundLabel","upperBoundLabel","_ref5","ratingsNumber","borderLeftWidth","MultipleChoiceQuestion","_ref6","_this2","isSingleChoice","type","SurveyQuestionType","SingleChoice","allowMultiple","MultipleChoice","openChoiceIndex","hasOpenChoice","choices","length","getDisplayOrderChoices","_useState9","_useState0","selectedChoiceIndices","setSelectedChoiceIndices","_useState1","_useState10","openEndedInput","setOpenEndedInput","shouldSkipSubmit","includes","result","multipleChoiceOptions","choice","choiceIndex","isOpenChoice","isSelected","choiceTextColor","Pressable","choiceOption","filter","concat","_toConsumableArray2","choiceText","flexGrow","rightCheckArea","CheckSVG","userValue","ThumbsUpEmoji","ThumbsDownEmoji","DissatisfiedEmoji","NeutralEmoji","SatisfiedEmoji","VeryDissatisfiedEmoji","VerySatisfiedEmoji","fiveScaleNumbers","sevenScaleNumbers","tenScaleNumbers","padding","borderWidth","marginVertical","fontSize","textAlignVertical","flexDirection","justifyContent","flexWrap","flex","margin","borderRadius","overflow","paddingVertical","alignItems","marginTop"],"sources":["../../../src/surveys/components/QuestionTypes.tsx"],"sourcesContent":["import React, { ReactNode, useMemo, useState } from 'react'\nimport { LayoutChangeEvent, Pressable, ScrollView, Text, TextInput, TouchableOpacity, View } from 'react-native'\n\nimport { createSafeStyleSheet } from '../safeStyleSheet'\nimport {\n CheckSVG,\n DissatisfiedEmoji,\n NeutralEmoji,\n SatisfiedEmoji,\n ThumbsDownEmoji,\n ThumbsUpEmoji,\n VeryDissatisfiedEmoji,\n VerySatisfiedEmoji,\n} from '../icons'\nimport {\n defaultRatingLabelOpacity,\n getContrastingTextColor,\n getMaxFontSizeMultiplier,\n SurveyAppearanceTheme,\n} from '../surveys-utils'\nimport { getDisplayOrderChoices } from '../survey-shuffling'\nimport {\n SurveyQuestion,\n SurveyRatingDisplay,\n SurveyQuestionType,\n LinkSurveyQuestion,\n RatingSurveyQuestion,\n MultipleSurveyQuestion,\n SurveyValidationType,\n} from '@posthog/core'\nimport { getValidationError, getLengthFromRules, getRequirementsHint } from '@posthog/core/surveys'\nimport { BottomSection } from './BottomSection'\nimport { QuestionHeader } from './QuestionHeader'\n\ninterface QuestionCommonProps {\n question: SurveyQuestion\n appearance: SurveyAppearanceTheme\n}\n\n// Wraps question content in a scrollable region with a sticky BottomSection\n// (Submit button) at the bottom. The ScrollView has flexShrink: 1 so it\n// shrinks to fit when the parent modal is capped at its keyboard-aware\n// maxHeight, keeping Submit visible regardless of survey length. Scrolling is\n// enabled only while the content overflows the viewport, so short surveys don't\n// scroll or bounce.\nfunction QuestionLayout({ children, footer }: { children: ReactNode; footer: ReactNode }): JSX.Element {\n const [viewportHeight, setViewportHeight] = useState(0)\n const [contentHeight, setContentHeight] = useState(0)\n // 1px threshold absorbs sub-pixel layout rounding.\n const isOverflowing = contentHeight > viewportHeight + 1\n\n return (\n <View style={questionLayoutStyles.container}>\n <ScrollView\n style={questionLayoutStyles.scroll}\n keyboardShouldPersistTaps=\"handled\"\n showsVerticalScrollIndicator={false}\n scrollEnabled={isOverflowing}\n bounces={isOverflowing}\n onLayout={(e: LayoutChangeEvent) => setViewportHeight(e.nativeEvent.layout.height)}\n onContentSizeChange={(_width, height) => setContentHeight(height)}\n >\n {children}\n </ScrollView>\n {footer}\n </View>\n )\n}\n\nconst questionLayoutStyles = createSafeStyleSheet({\n container: {\n flexShrink: 1,\n },\n scroll: {\n flexShrink: 1,\n },\n})\n\nexport function OpenTextQuestion({\n question,\n appearance,\n onSubmit,\n}: QuestionCommonProps & {\n onSubmit: (text: string) => void\n}): JSX.Element {\n const [text, setText] = useState('')\n\n // Memoize validation error to avoid recalculating on every render\n const validationError = useMemo(\n () => getValidationError(text, question.validation, question.optional),\n [text, question.validation, question.optional]\n )\n\n // Build requirements hint message\n const minLength = getLengthFromRules(question.validation, SurveyValidationType.MinLength)\n const maxLength = getLengthFromRules(question.validation, SurveyValidationType.MaxLength)\n const requirementsHint = useMemo(() => getRequirementsHint(minLength, maxLength), [minLength, maxLength])\n\n const handleSubmit = () => {\n if (validationError) {\n return\n }\n onSubmit(text.trim())\n }\n\n return (\n <QuestionLayout\n footer={\n <BottomSection\n text={question.buttonText ?? appearance.submitButtonText}\n submitDisabled={!!validationError}\n appearance={appearance}\n onSubmit={handleSubmit}\n />\n }\n >\n <QuestionHeader\n question={question.question}\n description={question.description}\n descriptionContentType={question.descriptionContentType}\n appearance={appearance}\n />\n <View style={styles.textInputContainer}>\n <TextInput\n maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'input')}\n style={[\n styles.textInput,\n {\n backgroundColor: appearance.inputBackground,\n color: appearance.inputTextColor ?? getContrastingTextColor(appearance.inputBackground),\n borderColor: appearance.borderColor,\n },\n ]}\n multiline\n numberOfLines={4}\n placeholder={appearance.placeholder}\n placeholderTextColor={\n getContrastingTextColor(\n appearance.inputTextColor ?? getContrastingTextColor(appearance.inputBackground)\n ) === 'white'\n ? 'rgba(0, 0, 0, 0.5)'\n : 'rgba(255, 255, 255, 0.5)'\n }\n onChangeText={setText}\n value={text}\n />\n {requirementsHint && (\n <Text\n maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'validationHint')}\n style={[\n styles.validationHint,\n { color: appearance.textColor ?? getContrastingTextColor(appearance.backgroundColor) },\n ]}\n >\n {requirementsHint}\n </Text>\n )}\n </View>\n </QuestionLayout>\n )\n}\n\nexport function LinkQuestion({\n question,\n appearance,\n onSubmit,\n}: QuestionCommonProps & {\n onSubmit: (clicked: string) => void\n}): JSX.Element {\n question = question as LinkSurveyQuestion\n\n return (\n <QuestionLayout\n footer={\n <BottomSection\n text={question.buttonText ?? appearance.submitButtonText ?? 'Submit'}\n submitDisabled={false}\n link={question.link}\n appearance={appearance}\n onSubmit={() => onSubmit('link clicked')}\n />\n }\n >\n <QuestionHeader\n question={question.question}\n description={question.description}\n descriptionContentType={question.descriptionContentType}\n appearance={appearance}\n />\n </QuestionLayout>\n )\n}\n\nexport function RatingQuestion({\n question,\n appearance,\n onSubmit,\n}: QuestionCommonProps & {\n onSubmit: (rating: number | null) => void\n}): JSX.Element {\n //const starting = question.scale === 10 ? 0 : 1;\n const [rating, setRating] = useState<number | null>(null)\n question = question as RatingSurveyQuestion\n\n return (\n <QuestionLayout\n footer={\n <BottomSection\n text={question.buttonText ?? appearance.submitButtonText}\n submitDisabled={rating === null && !question.optional}\n appearance={appearance}\n onSubmit={() => onSubmit(rating)}\n skipSubmitButton={question.skipSubmitButton}\n />\n }\n >\n <QuestionHeader\n question={question.question}\n description={question.description}\n descriptionContentType={question.descriptionContentType}\n appearance={appearance}\n />\n <View style={styles.ratingSection}>\n <View style={styles.ratingOptions}>\n {question.display === SurveyRatingDisplay.Emoji && (\n <View style={styles.ratingOptionsEmoji}>\n {emojiScaleLists[question.scale]?.map((Emoji, idx) => {\n const active = idx + 1 === rating\n return (\n <TouchableOpacity\n key={idx}\n style={styles.ratingsEmoji}\n onPress={() => {\n const response = idx + 1\n setRating(response)\n if (question.skipSubmitButton) {\n onSubmit(response)\n }\n }}\n >\n <Emoji fill={active ? appearance.ratingButtonActiveColor : appearance.ratingButtonColor} />\n </TouchableOpacity>\n )\n })}\n </View>\n )}\n {question.display === SurveyRatingDisplay.Number && (\n <View style={[styles.ratingOptionsNumber, { borderColor: appearance.borderColor }]}>\n {getScaleNumbers(question.scale).map((number, idx) => {\n const active = rating === number\n return (\n <RatingButton\n key={idx}\n index={idx}\n active={active}\n appearance={appearance}\n num={number}\n setActiveNumber={(response) => {\n setRating(response)\n if (question.skipSubmitButton) {\n onSubmit(response)\n }\n }}\n />\n )\n })}\n </View>\n )}\n </View>\n <View style={styles.ratingText}>\n <Text\n maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'ratingLabel')}\n style={{\n color: appearance.textColor ?? getContrastingTextColor(appearance.backgroundColor),\n opacity: defaultRatingLabelOpacity,\n }}\n >\n {question.lowerBoundLabel}\n </Text>\n <Text\n maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'ratingLabel')}\n style={{\n color: appearance.textColor ?? getContrastingTextColor(appearance.backgroundColor),\n opacity: defaultRatingLabelOpacity,\n }}\n >\n {question.upperBoundLabel}\n </Text>\n </View>\n </View>\n </QuestionLayout>\n )\n}\n\nexport function RatingButton({\n index,\n num,\n active,\n appearance,\n setActiveNumber,\n}: {\n index: number\n num: number\n active: boolean\n appearance: SurveyAppearanceTheme\n setActiveNumber: (num: number) => void\n}): JSX.Element {\n const backgroundColor = active ? appearance.ratingButtonActiveColor : appearance.ratingButtonColor\n // Active state always auto-calculates for contrast; inactive uses inputTextColor override if provided\n const textColor = active\n ? getContrastingTextColor(backgroundColor)\n : (appearance.inputTextColor ?? getContrastingTextColor(backgroundColor))\n\n return (\n <TouchableOpacity\n style={[\n styles.ratingsNumber,\n index === 0 && { borderLeftWidth: 0 },\n { backgroundColor, borderColor: appearance.borderColor },\n ]}\n onPress={() => setActiveNumber(num)}\n >\n <Text maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'ratingNumber')} style={{ color: textColor }}>\n {num}\n </Text>\n </TouchableOpacity>\n )\n}\n\nexport function MultipleChoiceQuestion({\n question,\n appearance,\n onSubmit,\n}: QuestionCommonProps & {\n onSubmit: (choices: string | string[] | null) => void\n}): JSX.Element {\n question = question as MultipleSurveyQuestion\n const isSingleChoice = question.type === SurveyQuestionType.SingleChoice\n const allowMultiple = question.type === SurveyQuestionType.MultipleChoice\n const openChoiceIndex = question.hasOpenChoice ? question.choices.length - 1 : -1\n const choices = useMemo(() => getDisplayOrderChoices(question as MultipleSurveyQuestion), [question])\n // Choice labels change with survey translations; keep selection tied to the original order.\n const [selectedChoiceIndices, setSelectedChoiceIndices] = useState<number[]>([])\n const [openEndedInput, setOpenEndedInput] = useState('')\n\n // Only skip submit for single-choice questions without open choice\n const shouldSkipSubmit = question.skipSubmitButton && isSingleChoice && !question.hasOpenChoice\n\n return (\n <QuestionLayout\n footer={\n <BottomSection\n text={question.buttonText ?? appearance.submitButtonText}\n submitDisabled={\n !question.optional &&\n (selectedChoiceIndices.length === 0 ||\n (selectedChoiceIndices.includes(openChoiceIndex) && openEndedInput.length === 0))\n }\n appearance={appearance}\n onSubmit={() => {\n const result = selectedChoiceIndices.map((index) =>\n index === openChoiceIndex ? openEndedInput : choices[index]\n )\n onSubmit(allowMultiple ? result : result[0])\n }}\n skipSubmitButton={shouldSkipSubmit}\n />\n }\n >\n <QuestionHeader\n question={question.question}\n description={question.description}\n descriptionContentType={question.descriptionContentType}\n appearance={appearance}\n />\n <View style={styles.multipleChoiceOptions}>\n {choices.map((choice: string, choiceIndex: number) => {\n const isOpenChoice = choiceIndex === openChoiceIndex\n const isSelected = selectedChoiceIndices.includes(choiceIndex)\n\n const choiceTextColor = appearance.inputTextColor ?? getContrastingTextColor(appearance.inputBackground)\n\n return (\n <Pressable\n key={choiceIndex}\n style={[\n styles.choiceOption,\n { backgroundColor: appearance.inputBackground },\n isSelected ? { borderColor: getContrastingTextColor(appearance.backgroundColor) } : {},\n ]}\n onPress={() => {\n if (allowMultiple) {\n setSelectedChoiceIndices(\n isSelected\n ? selectedChoiceIndices.filter((index) => index !== choiceIndex)\n : [...selectedChoiceIndices, choiceIndex]\n )\n } else {\n setSelectedChoiceIndices([choiceIndex])\n if (shouldSkipSubmit && !isOpenChoice) {\n onSubmit(choice)\n }\n }\n }}\n >\n <View style={styles.choiceText}>\n <Text\n maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'choice')}\n style={{ flexGrow: 1, color: choiceTextColor }}\n >\n {choice}\n {isOpenChoice ? ':' : ''}\n </Text>\n <View style={styles.rightCheckArea}>{isSelected && <CheckSVG />}</View>\n </View>\n {isOpenChoice && (\n <TextInput\n maxFontSizeMultiplier={getMaxFontSizeMultiplier(appearance, 'input')}\n style={styles.openEndedInput}\n onChangeText={(userValue) => {\n setOpenEndedInput(userValue)\n if (!isSelected) {\n setSelectedChoiceIndices(allowMultiple ? [...selectedChoiceIndices, choiceIndex] : [choiceIndex])\n }\n }}\n />\n )}\n </Pressable>\n )\n })}\n </View>\n </QuestionLayout>\n )\n}\n\nconst emojiScaleLists: Record<number, (typeof ThumbsUpEmoji)[]> = {\n 2: [ThumbsUpEmoji, ThumbsDownEmoji],\n 3: [DissatisfiedEmoji, NeutralEmoji, SatisfiedEmoji],\n 5: [VeryDissatisfiedEmoji, DissatisfiedEmoji, NeutralEmoji, SatisfiedEmoji, VerySatisfiedEmoji],\n}\nconst fiveScaleNumbers = [1, 2, 3, 4, 5]\nconst sevenScaleNumbers = [1, 2, 3, 4, 5, 6, 7]\nconst tenScaleNumbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n\nfunction getScaleNumbers(scale: number): number[] {\n switch (scale) {\n case 5:\n return fiveScaleNumbers\n case 7:\n return sevenScaleNumbers\n case 10:\n return tenScaleNumbers\n default:\n return fiveScaleNumbers\n }\n}\n\nconst styles = createSafeStyleSheet({\n textInputContainer: {\n padding: 10,\n },\n textInput: {\n borderColor: '#ccc',\n borderWidth: 1,\n padding: 10,\n marginVertical: 10,\n fontSize: 16,\n // Fixed height keeps the surrounding layout stable as the user types —\n // the TextInput scrolls its own content internally\n height: 80,\n textAlignVertical: 'top',\n },\n ratingSection: {\n marginVertical: 10,\n },\n ratingOptions: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n ratingOptionsEmoji: {\n flexDirection: 'row',\n justifyContent: 'space-around',\n flexWrap: 'nowrap',\n flex: 1,\n },\n ratingsEmoji: {\n padding: 4,\n },\n ratingOptionsNumber: {\n margin: 10,\n flexGrow: 1,\n flexDirection: 'row',\n justifyContent: 'space-between',\n borderRadius: 5,\n borderWidth: 1,\n overflow: 'hidden',\n },\n ratingsNumber: {\n flex: 1,\n paddingVertical: 10,\n alignItems: 'center',\n borderLeftWidth: 1,\n },\n ratingText: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n padding: 10,\n },\n multipleChoiceOptions: {\n padding: 10,\n },\n choiceOption: {\n flexDirection: 'column',\n marginVertical: 5,\n borderWidth: 1,\n borderColor: 'grey',\n borderRadius: 5,\n padding: 10,\n },\n choiceText: {\n flexDirection: 'row',\n },\n rightCheckArea: {\n flexGrow: 0,\n },\n openEndedInput: {\n padding: 5,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AAE,CACVoB,aAAa,CAAE,K,CAChB,CACDlB,cAAc,CAAE,CACdD,QAAQ,CAAE,C,CACX,CACDjB,cAAc,CAAE,CACd+B,OAAO,CAAE,C,CACV,CACDnG,cAAc,CAAE,CACdsG,QAAQ,CAAE,EAAE,CACZ7D,OAAO,CAAE,GAAG,CACZwE,SAAS,CAAE,C,EAEd,CAAC","ignoreList":[]}
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "4.76.0";
1
+ export declare const version = "4.77.1";
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.76.0";
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version=void 0;var version=exports.version="4.77.1";
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.76.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.77.1\"\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.76.0",
3
+ "version": "4.77.1",
4
4
  "bugs": {
5
5
  "url": "https://github.com/PostHog/posthog-js/issues"
6
6
  },
@@ -34,7 +34,7 @@
34
34
  "directory": "packages/react-native"
35
35
  },
36
36
  "dependencies": {
37
- "@posthog/core": "^1.55.1",
37
+ "@posthog/core": "^1.55.2",
38
38
  "@posthog/types": "^1.412.4"
39
39
  },
40
40
  "devDependencies": {
@@ -73,9 +73,9 @@
73
73
  "typescript": "7.0.2",
74
74
  "@vitest/coverage-v8": "^1.6.1",
75
75
  "vitest": "^1.6.1",
76
- "@posthog/react-native-plugin": "2.9.4",
77
- "@posthog-tooling/rollup-utils": "1.1.1",
78
- "@posthog-tooling/tsconfig-base": "1.1.1"
76
+ "@posthog-tooling/tsconfig-base": "1.1.1",
77
+ "@posthog/react-native-plugin": "2.11.0",
78
+ "@posthog-tooling/rollup-utils": "1.1.1"
79
79
  },
80
80
  "peerDependencies": {
81
81
  "@react-native-async-storage/async-storage": ">=1.0.0",