posthog-js 1.78.4 → 1.78.6
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/README.md +1 -1
- package/dist/array.full.js +2 -2
- package/dist/array.full.js.map +1 -1
- package/dist/array.js +2 -2
- package/dist/array.js.map +1 -1
- package/dist/es.js +2 -2
- package/dist/es.js.map +1 -1
- package/dist/module.js +2 -2
- package/dist/module.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/src/decide.js +2 -1
- package/lib/src/decide.js.map +1 -1
- package/lib/src/extensions/toolbar.js +6 -4
- package/lib/src/extensions/toolbar.js.map +1 -1
- package/lib/src/posthog-core.js +3 -0
- package/lib/src/posthog-core.js.map +1 -1
- package/package.json +1 -1
package/lib/package.json
CHANGED
package/lib/src/decide.js
CHANGED
|
@@ -40,8 +40,9 @@ var Decide = /** @class */ (function () {
|
|
|
40
40
|
var e_1, _a, e_2, _b;
|
|
41
41
|
var _this = this;
|
|
42
42
|
var _c, _d, _e;
|
|
43
|
-
this.instance.featureFlags.resetRequestQueue();
|
|
44
43
|
this.instance.featureFlags.setReloadingPaused(false);
|
|
44
|
+
// :TRICKY: Reload - start another request if queued!
|
|
45
|
+
this.instance.featureFlags._startReloadTimer();
|
|
45
46
|
if ((response === null || response === void 0 ? void 0 : response.status) === 0) {
|
|
46
47
|
console.error('Failed to fetch feature flags from PostHog.');
|
|
47
48
|
return;
|
package/lib/src/decide.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decide.js","sourceRoot":"","sources":["../../src/decide.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAGnD,OAAO,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAEvF;IAGI,gBAAY,QAAiB;QACzB,IAAI,CA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,QAAQ,CAAC,UAAU,CAAC,CAAA,gBAAA;wBAAnC,IAAA,aAAW,EAAT,EAAE,QAAA,EAAE,GAAG,SAAA;gCAAP,EAAE,EAAE,GAAG;qBAanB;;;;;;;;;aACJ;iBAAM,IAAI,QAAQ,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;gBACxC,OAAO,CAAC,KAAK,CAAC,kFAAkF,CAAC,CAAA;aACpG;SACJ;IACL,CAAC;IACL,aAAC;AAAD,CAAC,AA5FD,IA4FC","sourcesContent":["import { autocapture } from './autocapture'\nimport { _base64Encode, loadScript } from './utils'\nimport { PostHog } from './posthog-core'\nimport { Compression, DecideResponse } from './types'\nimport { STORED_GROUP_PROPERTIES_KEY, STORED_PERSON_PROPERTIES_KEY } from './constants'\n\nexport class Decide {\n instance: PostHog\n\n constructor(instance: PostHog) {\n this.instance = instance\n // don't need to wait for `decide` to return if flags were provided on initialisation\n this.instance.decideEndpointWasHit = this.instance._hasBootstrappedFeatureFlags()\n }\n\n call(): void {\n /*\n Calls /decide endpoint to fetch options for autocapture, session recording, feature flags & compression.\n */\n const json_data = JSON.stringify({\n token: this.instance.get_config('token'),\n distinct_id: this.instance.get_distinct_id(),\n groups: this.instance.getGroups(),\n person_properties: this.instance.get_property(STORED_PERSON_PROPERTIES_KEY),\n group_properties: this.instance.get_property(STORED_GROUP_PROPERTIES_KEY),\n disable_flags:\n this.instance.get_config('advanced_disable_feature_flags') ||\n this.instance.get_config('advanced_disable_feature_flags_on_first_load') ||\n undefined,\n })\n\n const encoded_data = _base64Encode(json_data)\n this.instance._send_request(\n `${this.instance.get_config('api_host')}/decide/?v=3`,\n { data: encoded_data, verbose: true },\n { method: 'POST' },\n (response) => this.parseDecideResponse(response as DecideResponse)\n )\n }\n\n parseDecideResponse(response: DecideResponse): void {\n this.instance.featureFlags.setReloadingPaused(false)\n // :TRICKY: Reload - start another request if queued!\n this.instance.featureFlags._startReloadTimer()\n\n if (response?.status === 0) {\n console.error('Failed to fetch feature flags from PostHog.')\n return\n }\n if (!(document && document.body)) {\n console.log('document not ready yet, trying again in 500 milliseconds...')\n setTimeout(() => {\n this.parseDecideResponse(response)\n }, 500)\n return\n }\n\n this.instance.toolbar.afterDecideResponse(response)\n this.instance.sessionRecording?.afterDecideResponse(response)\n autocapture.afterDecideResponse(response, this.instance)\n this.instance.webPerformance?.afterDecideResponse(response)\n this.instance.exceptionAutocapture?.afterDecideResponse(response)\n\n if (!this.instance.get_config('advanced_disable_feature_flags_on_first_load')) {\n this.instance.featureFlags.receivedFeatureFlags(response)\n }\n\n this.instance['compression'] = {}\n if (response['supportedCompression'] && !this.instance.get_config('disable_compression')) {\n const compression: Partial<Record<Compression, boolean>> = {}\n for (const method of response['supportedCompression']) {\n compression[method] = true\n }\n this.instance['compression'] = compression\n }\n\n if (response['siteApps']) {\n if (this.instance.get_config('opt_in_site_apps')) {\n const apiHost = this.instance.get_config('api_host')\n for (const { id, url } of response['siteApps']) {\n const scriptUrl = [\n apiHost,\n apiHost[apiHost.length - 1] === '/' && url[0] === '/' ? url.substring(1) : url,\n ].join('')\n\n ;(window as any)[`__$$ph_site_app_${id}`] = this.instance\n\n loadScript(scriptUrl, (err) => {\n if (err) {\n console.error(`Error while initializing PostHog app with config id ${id}`, err)\n }\n })\n }\n } else if (response['siteApps'].length > 0) {\n console.error('PostHog site apps are disabled. Enable the \"opt_in_site_apps\" config to proceed.')\n }\n }\n }\n}\n"]}
|
|
@@ -107,11 +107,13 @@ var Toolbar = /** @class */ (function () {
|
|
|
107
107
|
// only load the toolbar once, even if there are multiple instances of PostHogLib
|
|
108
108
|
;
|
|
109
109
|
window['_postHogToolbarLoaded'] = true;
|
|
110
|
-
// By design array.js, recorder.js, and toolbar.js are served from Django with no or limited caching, not from our CDN
|
|
111
|
-
// Django respects the query params for caching, returning a 304 if appropriate
|
|
112
110
|
var host = this.instance.get_config('api_host');
|
|
113
|
-
|
|
114
|
-
|
|
111
|
+
// toolbar.js is served from the PostHog CDN, this has a TTL of 24 hours.
|
|
112
|
+
// the toolbar asset includes a rotating "token" that is valid for 5 minutes.
|
|
113
|
+
var fiveMinutesInMillis = 5 * 60 * 1000;
|
|
114
|
+
// this ensures that we bust the cache periodically
|
|
115
|
+
var timestampToNearestFiveMinutes = Math.floor(Date.now() / fiveMinutesInMillis) * fiveMinutesInMillis;
|
|
116
|
+
var toolbarUrl = "".concat(host).concat(host.endsWith('/') ? '' : '/', "static/toolbar.js?t=").concat(timestampToNearestFiveMinutes);
|
|
115
117
|
var disableToolbarMetrics = !POSTHOG_MANAGED_HOSTS.includes(this.instance.get_config('api_host')) &&
|
|
116
118
|
this.instance.get_config('advanced_disable_toolbar_metrics');
|
|
117
119
|
var toolbarParams = __assign(__assign(__assign({ token: this.instance.get_config('token') }, params), { apiURL: host }), (disableToolbarMetrics ? { instrument: false } : {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolbar.js","sourceRoot":"","sources":["../../../src/extensions/toolbar.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAG7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAE/C;IAEI,iBAAY,QAAiB;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC5B,CAAC;IAED,qCAAmB,GAAnB,UAAoB,QAAwB;QACxC,IAAM,aAAa,GACf,QAAQ,CAAC,eAAe,CAAC;YACzB,QAAQ,CAAC,cAAc,CAAC;YACxB,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;QACtF,IACI,QAAQ,CAAC,iBAAiB,CAAC;YAC3B,aAAa,CAAC,gBAAgB,CAAC;YAC/B,aAAa,CAAC,gBAAg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AmG;QACnG,oGAAoG;QACpG,eAAe,CAAC,MAAM,EAAE,iBAAiB,EAAE;YACvC,CAAC;YAAC,MAAc,CAAC,uBAAuB,CAAC,GAAG,KAAK,CAAA;YACjD,KAAI,CAAC,WAAW,CAAC,aAAa,CAAC,CAAA;QACnC,CAAC,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACf,CAAC;IAED,6CAA6C;IAC7C,6BAAW,GAAX,UAAY,MAAqB;QAC7B,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA;IACnC,CAAC;IAED,kDAAkD;IAClD,iCAAe,GAAf,UACI,QAA0B,EAC1B,YAA6C,EAC7C,OAAwB;QAFxB,yBAAA,EAAA,WAAW,MAAM,CAAC,QAAQ;QAC1B,6BAAA,EAAA,wBAA6C;QAC7C,wBAAA,EAAA,UAAU,MAAM,CAAC,OAAO;QAExB,OAAO,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,CAAC,CAAA;IACjE,CAAC;IACL,cAAC;AAAD,CAAC,AAhJD,IAgJC","sourcesContent":["import { _getHashParam, _register_event, loadScript, logger } from '../utils'\nimport { PostHog } from '../posthog-core'\nimport { DecideResponse, ToolbarParams } from '../types'\nimport { POSTHOG_MANAGED_HOSTS } from './cloud'\n\nexport class Toolbar {\n instance: PostHog\n constructor(instance: PostHog) {\n this.instance = instance\n }\n\n afterDecideResponse(response: DecideResponse) {\n const toolbarParams: ToolbarParams =\n response['toolbarParams'] ||\n response['editorParams'] ||\n (response['toolbarVersion'] ? { toolbarVersion: response['toolbarVersion'] } : {})\n if (\n response['isAuthenticated'] &&\n toolbarParams['toolbarVersion'] &&\n toolbarParams['toolbarVersion'].indexOf('toolbar') === 0\n ) {\n this.loadToolbar({\n ...toolbarParams,\n })\n }\n }\n\n /**\n * To load the toolbar, we need an access token and other state. That state comes from one of three places:\n * 1. In the URL hash params\n * 2. From session storage under the key `toolbarParams` if the toolbar was initialized on a previous page\n */\n maybeLoadToolbar(\n location = window.location,\n localStorage: Storage | undefined = undefined,\n history = window.history\n ): boolean {\n try {\n // Before running the code we check if we can access localStorage, if not we opt-out\n if (!localStorage) {\n try {\n window.localStorage.setItem('test', 'test')\n window.localStorage.removeItem('test')\n } catch (error) {\n return false\n }\n\n // If localStorage was undefined, and localStorage is supported we set the default value\n localStorage = window.localStorage\n }\n\n const stateHash = _getHashParam(location.hash, '__posthog') || _getHashParam(location.hash, 'state')\n const state = stateHash ? JSON.parse(decodeURIComponent(stateHash)) : null\n const parseFromUrl = state && state['action'] === 'ph_authorize'\n let toolbarParams: ToolbarParams\n\n if (parseFromUrl) {\n // happens if they are initializing the toolbar using an old snippet\n toolbarParams = state\n toolbarParams.source = 'url'\n\n if (toolbarParams && Object.keys(toolbarParams).length > 0) {\n if (state['desiredHash']) {\n // hash that was in the url before the redirect\n location.hash = state['desiredHash']\n } else if (history) {\n history.replaceState('', document.title, location.pathname + location.search) // completely remove hash\n } else {\n location.hash = '' // clear hash (but leaves # unfortunately)\n }\n }\n } else {\n // get credentials from localStorage from a previous initialzation\n toolbarParams = JSON.parse(localStorage.getItem('_postHogToolbarParams') || '{}')\n toolbarParams.source = 'localstorage'\n\n // delete \"add-action\" or other intent from toolbarParams, otherwise we'll have the same intent\n // every time we open the page (e.g. you just visiting your own site an hour later)\n delete toolbarParams.userIntent\n }\n\n if (toolbarParams['token'] && this.instance.get_config('token') === toolbarParams['token']) {\n this.loadToolbar(toolbarParams)\n return true\n } else {\n return false\n }\n } catch (e) {\n return false\n }\n }\n\n loadToolbar(params?: ToolbarParams): boolean {\n if ((window as any)['_postHogToolbarLoaded']) {\n return false\n }\n // only load the toolbar once, even if there are multiple instances of PostHogLib\n ;(window as any)['_postHogToolbarLoaded'] = true\n\n // By design array.js, recorder.js, and toolbar.js are served from Django with no or limited caching, not from our CDN\n // Django respects the query params for caching, returning a 304 if appropriate\n const host = this.instance.get_config('api_host')\n const timestampToNearestThirtySeconds = Math.floor(Date.now() / 30000) * 30000\n const toolbarUrl = `${host}${\n host.endsWith('/') ? '' : '/'\n }static/toolbar.js?_ts=${timestampToNearestThirtySeconds}`\n const disableToolbarMetrics =\n !POSTHOG_MANAGED_HOSTS.includes(this.instance.get_config('api_host')) &&\n this.instance.get_config('advanced_disable_toolbar_metrics')\n\n const toolbarParams = {\n token: this.instance.get_config('token'),\n ...params,\n apiURL: host, // defaults to api_host from the instance config if nothing else set\n ...(disableToolbarMetrics ? { instrument: false } : {}),\n }\n\n const { source: _discard, ...paramsToPersist } = toolbarParams // eslint-disable-line\n window.localStorage.setItem('_postHogToolbarParams', JSON.stringify(paramsToPersist))\n\n loadScript(toolbarUrl, (err) => {\n if (err) {\n logger.error('Failed to load toolbar', err)\n return\n }\n ;((window as any)['ph_load_toolbar'] || (window as any)['ph_load_editor'])(toolbarParams, this.instance)\n })\n // Turbolinks doesn't fire an onload event but does replace the entire body, including the toolbar.\n // Thus, we ensure the toolbar is only loaded inside the body, and then reloaded on turbolinks:load.\n _register_event(window, 'turbolinks:load', () => {\n ;(window as any)['_postHogToolbarLoaded'] = false\n this.loadToolbar(toolbarParams)\n })\n return true\n }\n\n /** @deprecated Use \"loadToolbar\" instead. */\n _loadEditor(params: ToolbarParams): boolean {\n return this.loadToolbar(params)\n }\n\n /** @deprecated Use \"maybeLoadToolbar\" instead. */\n maybeLoadEditor(\n location = window.location,\n localStorage: Storage | undefined = undefined,\n history = window.history\n ): boolean {\n return this.maybeLoadToolbar(location, localStorage, history)\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"toolbar.js","sourceRoot":"","sources":["../../../src/extensions/toolbar.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAG7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAE/C;IAEI,iBAAY,QAAiB;QACzB,IAAI,CAAC,QAAQ,GAAG,QA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AxD,UAAwC,CAAF,CAAkB,CAAC,sBAAsB;QACrF,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,uBAAuB,EAAE,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,CAAA;QAErF,UAAU,CAAC,UAAU,EAAE,UAAC,GAAG;YACvB,IAAI,GAAG,EAAE;gBACL,MAAM,CAAC,KAAK,CAAC,wBAAwB,EAAE,GAAG,CAAC,CAAA;gBAC3C,OAAM;aACT;YACD,CAAC;YAAA,CAAE,MAAc,CAAC,iBAAiB,CAAC,IAAK,MAAc,CAAC,gBAAgB,CAAC,CAAC,CAAC,aAAa,EAAE,KAAI,CAAC,QAAQ,CAAC,CAAA;QAC5G,CAAC,CAAC,CAAA;QACF,mGAAmG;QACnG,oGAAoG;QACpG,eAAe,CAAC,MAAM,EAAE,iBAAiB,EAAE;YACvC,CAAC;YAAC,MAAc,CAAC,uBAAuB,CAAC,GAAG,KAAK,CAAA;YACjD,KAAI,CAAC,WAAW,CAAC,aAAa,CAAC,CAAA;QACnC,CAAC,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACf,CAAC;IAED,6CAA6C;IAC7C,6BAAW,GAAX,UAAY,MAAqB;QAC7B,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA;IACnC,CAAC;IAED,kDAAkD;IAClD,iCAAe,GAAf,UACI,QAA0B,EAC1B,YAA6C,EAC7C,OAAwB;QAFxB,yBAAA,EAAA,WAAW,MAAM,CAAC,QAAQ;QAC1B,6BAAA,EAAA,wBAA6C;QAC7C,wBAAA,EAAA,UAAU,MAAM,CAAC,OAAO;QAExB,OAAO,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,CAAC,CAAA;IACjE,CAAC;IACL,cAAC;AAAD,CAAC,AAhJD,IAgJC","sourcesContent":["import { _getHashParam, _register_event, loadScript, logger } from '../utils'\nimport { PostHog } from '../posthog-core'\nimport { DecideResponse, ToolbarParams } from '../types'\nimport { POSTHOG_MANAGED_HOSTS } from './cloud'\n\nexport class Toolbar {\n instance: PostHog\n constructor(instance: PostHog) {\n this.instance = instance\n }\n\n afterDecideResponse(response: DecideResponse) {\n const toolbarParams: ToolbarParams =\n response['toolbarParams'] ||\n response['editorParams'] ||\n (response['toolbarVersion'] ? { toolbarVersion: response['toolbarVersion'] } : {})\n if (\n response['isAuthenticated'] &&\n toolbarParams['toolbarVersion'] &&\n toolbarParams['toolbarVersion'].indexOf('toolbar') === 0\n ) {\n this.loadToolbar({\n ...toolbarParams,\n })\n }\n }\n\n /**\n * To load the toolbar, we need an access token and other state. That state comes from one of three places:\n * 1. In the URL hash params\n * 2. From session storage under the key `toolbarParams` if the toolbar was initialized on a previous page\n */\n maybeLoadToolbar(\n location = window.location,\n localStorage: Storage | undefined = undefined,\n history = window.history\n ): boolean {\n try {\n // Before running the code we check if we can access localStorage, if not we opt-out\n if (!localStorage) {\n try {\n window.localStorage.setItem('test', 'test')\n window.localStorage.removeItem('test')\n } catch (error) {\n return false\n }\n\n // If localStorage was undefined, and localStorage is supported we set the default value\n localStorage = window.localStorage\n }\n\n const stateHash = _getHashParam(location.hash, '__posthog') || _getHashParam(location.hash, 'state')\n const state = stateHash ? JSON.parse(decodeURIComponent(stateHash)) : null\n const parseFromUrl = state && state['action'] === 'ph_authorize'\n let toolbarParams: ToolbarParams\n\n if (parseFromUrl) {\n // happens if they are initializing the toolbar using an old snippet\n toolbarParams = state\n toolbarParams.source = 'url'\n\n if (toolbarParams && Object.keys(toolbarParams).length > 0) {\n if (state['desiredHash']) {\n // hash that was in the url before the redirect\n location.hash = state['desiredHash']\n } else if (history) {\n history.replaceState('', document.title, location.pathname + location.search) // completely remove hash\n } else {\n location.hash = '' // clear hash (but leaves # unfortunately)\n }\n }\n } else {\n // get credentials from localStorage from a previous initialzation\n toolbarParams = JSON.parse(localStorage.getItem('_postHogToolbarParams') || '{}')\n toolbarParams.source = 'localstorage'\n\n // delete \"add-action\" or other intent from toolbarParams, otherwise we'll have the same intent\n // every time we open the page (e.g. you just visiting your own site an hour later)\n delete toolbarParams.userIntent\n }\n\n if (toolbarParams['token'] && this.instance.get_config('token') === toolbarParams['token']) {\n this.loadToolbar(toolbarParams)\n return true\n } else {\n return false\n }\n } catch (e) {\n return false\n }\n }\n\n loadToolbar(params?: ToolbarParams): boolean {\n if ((window as any)['_postHogToolbarLoaded']) {\n return false\n }\n // only load the toolbar once, even if there are multiple instances of PostHogLib\n ;(window as any)['_postHogToolbarLoaded'] = true\n\n const host = this.instance.get_config('api_host')\n // toolbar.js is served from the PostHog CDN, this has a TTL of 24 hours.\n // the toolbar asset includes a rotating \"token\" that is valid for 5 minutes.\n const fiveMinutesInMillis = 5 * 60 * 1000\n // this ensures that we bust the cache periodically\n const timestampToNearestFiveMinutes = Math.floor(Date.now() / fiveMinutesInMillis) * fiveMinutesInMillis\n const toolbarUrl = `${host}${host.endsWith('/') ? '' : '/'}static/toolbar.js?t=${timestampToNearestFiveMinutes}`\n const disableToolbarMetrics =\n !POSTHOG_MANAGED_HOSTS.includes(this.instance.get_config('api_host')) &&\n this.instance.get_config('advanced_disable_toolbar_metrics')\n\n const toolbarParams = {\n token: this.instance.get_config('token'),\n ...params,\n apiURL: host, // defaults to api_host from the instance config if nothing else set\n ...(disableToolbarMetrics ? { instrument: false } : {}),\n }\n\n const { source: _discard, ...paramsToPersist } = toolbarParams // eslint-disable-line\n window.localStorage.setItem('_postHogToolbarParams', JSON.stringify(paramsToPersist))\n\n loadScript(toolbarUrl, (err) => {\n if (err) {\n logger.error('Failed to load toolbar', err)\n return\n }\n ;((window as any)['ph_load_toolbar'] || (window as any)['ph_load_editor'])(toolbarParams, this.instance)\n })\n // Turbolinks doesn't fire an onload event but does replace the entire body, including the toolbar.\n // Thus, we ensure the toolbar is only loaded inside the body, and then reloaded on turbolinks:load.\n _register_event(window, 'turbolinks:load', () => {\n ;(window as any)['_postHogToolbarLoaded'] = false\n this.loadToolbar(toolbarParams)\n })\n return true\n }\n\n /** @deprecated Use \"loadToolbar\" instead. */\n _loadEditor(params: ToolbarParams): boolean {\n return this.loadToolbar(params)\n }\n\n /** @deprecated Use \"maybeLoadToolbar\" instead. */\n maybeLoadEditor(\n location = window.location,\n localStorage: Storage | undefined = undefined,\n history = window.history\n ): boolean {\n return this.maybeLoadToolbar(location, localStorage, history)\n }\n}\n"]}
|
package/lib/src/posthog-core.js
CHANGED
|
@@ -456,6 +456,9 @@ var PostHog = /** @class */ (function () {
|
|
|
456
456
|
// and compression will not be available.
|
|
457
457
|
if (!disableDecide) {
|
|
458
458
|
new Decide(this).call();
|
|
459
|
+
// TRICKY: Reset any decide reloads queued during config.loaded because they'll be
|
|
460
|
+
// covered by the decide call right above.
|
|
461
|
+
this.featureFlags.resetRequestQueue();
|
|
459
462
|
}
|
|
460
463
|
};
|
|
461
464
|
PostHog.prototype._start_queue_if_opted_in = function () {
|