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.
Files changed (42) hide show
  1. package/dist/all-external-dependencies.js.map +1 -1
  2. package/dist/array.full.es5.js +1 -1
  3. package/dist/array.full.es5.js.map +1 -1
  4. package/dist/array.full.js +1 -1
  5. package/dist/array.full.js.map +1 -1
  6. package/dist/array.full.no-external.js +1 -1
  7. package/dist/array.full.no-external.js.map +1 -1
  8. package/dist/array.js +1 -1
  9. package/dist/array.js.map +1 -1
  10. package/dist/array.no-external.js +1 -1
  11. package/dist/array.no-external.js.map +1 -1
  12. package/dist/customizations.full.js +1 -1
  13. package/dist/main.js +1 -1
  14. package/dist/main.js.map +1 -1
  15. package/dist/module.d.ts +29 -1
  16. package/dist/module.full.d.ts +29 -1
  17. package/dist/module.full.js +1 -1
  18. package/dist/module.full.js.map +1 -1
  19. package/dist/module.full.no-external.d.ts +29 -1
  20. package/dist/module.full.no-external.js +1 -1
  21. package/dist/module.full.no-external.js.map +1 -1
  22. package/dist/module.js +1 -1
  23. package/dist/module.js.map +1 -1
  24. package/dist/module.no-external.d.ts +29 -1
  25. package/dist/module.no-external.js +1 -1
  26. package/dist/module.no-external.js.map +1 -1
  27. package/dist/src/posthog-core.d.ts +1 -0
  28. package/dist/src/posthog-surveys-types.d.ts +4 -1
  29. package/dist/src/posthog-surveys.d.ts +24 -0
  30. package/dist/surveys-preview.d.ts +29 -1
  31. package/dist/surveys-preview.js.map +1 -1
  32. package/dist/surveys.js.map +1 -1
  33. package/lib/package.json +1 -1
  34. package/lib/src/posthog-core.d.ts +1 -0
  35. package/lib/src/posthog-core.js +17 -0
  36. package/lib/src/posthog-core.js.map +1 -1
  37. package/lib/src/posthog-surveys-types.d.ts +4 -1
  38. package/lib/src/posthog-surveys-types.js.map +1 -1
  39. package/lib/src/posthog-surveys.d.ts +24 -0
  40. package/lib/src/posthog-surveys.js +104 -6
  41. package/lib/src/posthog-surveys.js.map +1 -1
  42. package/package.json +1 -1
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "posthog-js",
3
- "version": "1.232.6",
3
+ "version": "1.232.7",
4
4
  "description": "Posthog-js allows you to automatically capture usage and send events to PostHog.",
5
5
  "repository": "https://github.com/PostHog/posthog-js",
6
6
  "author": "hey@posthog.com",
@@ -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;
@@ -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.