posthog-js 1.232.6 → 1.232.7
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/all-external-dependencies.js.map +1 -1
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.es5.js.map +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.full.no-external.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.js.map +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/array.no-external.js.map +1 -1
- package/dist/customizations.full.js +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.d.ts +29 -1
- package/dist/module.full.d.ts +29 -1
- package/dist/module.full.js +1 -1
- package/dist/module.full.js.map +1 -1
- package/dist/module.full.no-external.d.ts +29 -1
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.full.no-external.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/module.no-external.d.ts +29 -1
- package/dist/module.no-external.js +1 -1
- package/dist/module.no-external.js.map +1 -1
- package/dist/src/posthog-core.d.ts +1 -0
- package/dist/src/posthog-surveys-types.d.ts +4 -1
- package/dist/src/posthog-surveys.d.ts +24 -0
- package/dist/surveys-preview.d.ts +29 -1
- package/dist/surveys-preview.js.map +1 -1
- package/dist/surveys.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/src/posthog-core.d.ts +1 -0
- package/lib/src/posthog-core.js +17 -0
- package/lib/src/posthog-core.js.map +1 -1
- package/lib/src/posthog-surveys-types.d.ts +4 -1
- package/lib/src/posthog-surveys-types.js.map +1 -1
- package/lib/src/posthog-surveys.d.ts +24 -0
- package/lib/src/posthog-surveys.js +104 -6
- package/lib/src/posthog-surveys.js.map +1 -1
- package/package.json +1 -1
package/lib/package.json
CHANGED
|
@@ -267,6 +267,7 @@ export declare class PostHog {
|
|
|
267
267
|
*/
|
|
268
268
|
on(event: 'eventCaptured', cb: (...args: any[]) => void): () => void;
|
|
269
269
|
onFeatureFlags(callback: FeatureFlagsCallback): () => void;
|
|
270
|
+
onSurveysLoaded(callback: SurveyCallback): () => void;
|
|
270
271
|
onSessionId(callback: SessionIdChangedCallback): () => void;
|
|
271
272
|
/** Get list of all surveys. */
|
|
272
273
|
getSurveys(callback: SurveyCallback, forceReload?: boolean): void;
|
package/lib/src/posthog-core.js
CHANGED
|
@@ -1117,6 +1117,23 @@ var PostHog = /** @class */ (function () {
|
|
|
1117
1117
|
PostHog.prototype.onFeatureFlags = function (callback) {
|
|
1118
1118
|
return this.featureFlags.onFeatureFlags(callback);
|
|
1119
1119
|
};
|
|
1120
|
+
/*
|
|
1121
|
+
* Register an event listener that runs when surveys are loaded.
|
|
1122
|
+
*
|
|
1123
|
+
* ### Usage:
|
|
1124
|
+
*
|
|
1125
|
+
* posthog.onSurveysLoaded((surveys, context) => { // do something })
|
|
1126
|
+
*
|
|
1127
|
+
* Callback parameters:
|
|
1128
|
+
* - surveys: Survey[]: An array containing all survey objects fetched from PostHog using the getSurveys method
|
|
1129
|
+
* - context: { isLoaded: boolean, error?: string }: An object indicating if the surveys were loaded successfully
|
|
1130
|
+
*
|
|
1131
|
+
* @param {Function} callback The callback function will be called when surveys are loaded or updated.
|
|
1132
|
+
* @returns {Function} A function that can be called to unsubscribe the listener.
|
|
1133
|
+
*/
|
|
1134
|
+
PostHog.prototype.onSurveysLoaded = function (callback) {
|
|
1135
|
+
return this.surveys.onSurveysLoaded(callback);
|
|
1136
|
+
};
|
|
1120
1137
|
/*
|
|
1121
1138
|
* Register an event listener that runs whenever the session id or window id change.
|
|
1122
1139
|
* If there is already a session id, the listener is called immediately in addition to being called on future changes.
|