posthog-js 1.27.0-alpha2 → 1.27.0-alpha3

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/module.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { MaskInputOptions, SlimDOMOptions } from 'rrweb-snapshot';
2
2
  import { record } from 'rrweb';
3
3
  import { listenerHandler, eventWithTime } from 'rrweb/typings/types';
4
- import { EventProcessor, Hub } from '@sentry/types';
4
+ import { Integration, EventProcessor, Hub } from '@sentry/types';
5
5
 
6
6
  declare class CaptureMetrics {
7
7
  enabled: boolean;
@@ -47,6 +47,7 @@ interface CaptureResult {
47
47
  $set?: Properties;
48
48
  timestamp?: Date;
49
49
  }
50
+ declare type CaptureCallback = (response: any, data: any) => void;
50
51
  interface PostHogConfig {
51
52
  api_host: string;
52
53
  api_method: string;
@@ -163,6 +164,11 @@ interface QueuedRequestData {
163
164
  callback?: RequestCallback;
164
165
  retriesPerformedSoFar?: number;
165
166
  }
167
+ interface XHRParams extends QueuedRequestData {
168
+ captureMetrics: CaptureMetrics;
169
+ retryQueue: RetryQueue;
170
+ onXHRError: (req: XMLHttpRequest) => void;
171
+ }
166
172
  interface DecideResponse {
167
173
  status: number;
168
174
  supportedCompression: Compression[];
@@ -184,6 +190,10 @@ interface AutoCaptureCustomProperty {
184
190
  css_selector: string;
185
191
  event_selectors: string[];
186
192
  }
193
+ interface CompressionData {
194
+ data: string;
195
+ compression?: Compression;
196
+ }
187
197
  interface GDPROptions {
188
198
  capture?: (event: string, properties: Properties, options: CaptureOptions) => void; /** function used for capturing a PostHog event to record the opt-in action */
189
199
  captureEventName?: string; /** event name to be used for capturing the opt-in action */
@@ -205,11 +215,18 @@ interface PersistentStore {
205
215
  set: (name: string, value: any, expire_days?: number | null, cross_subdomain?: boolean, secure?: boolean) => void;
206
216
  remove: (name: string, cross_subdomain?: boolean) => void;
207
217
  }
218
+ declare type Breaker = {};
219
+ declare type EventHandler = (event: Event) => boolean | void;
208
220
  interface EditorParams {
209
221
  jsURL?: string;
210
222
  apiURL?: string;
211
223
  toolbarVersion?: 'toolbar';
212
224
  }
225
+ interface PostData {
226
+ buffer?: BlobPart;
227
+ compression?: Compression;
228
+ data?: string;
229
+ }
213
230
  interface JSC {
214
231
  (): void;
215
232
  [key: string]: (response: any) => void;
@@ -403,7 +420,7 @@ declare class SessionIdManager {
403
420
  * @param {string} [prefix] Optional: Url of a self-hosted sentry instance (default: https://sentry.io/organizations/)
404
421
  */
405
422
 
406
- declare class SentryIntegration {
423
+ declare class SentryIntegration implements Integration {
407
424
  name: string;
408
425
  setupOnce: (addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub) => void;
409
426
  constructor(_posthog: PostHog, organization?: string, projectId?: number, prefix?: string);
@@ -950,4 +967,4 @@ declare class PostHog {
950
967
 
951
968
  declare const posthog: PostHog;
952
969
 
953
- export { PostHog, posthog as default, posthog };
970
+ export { AutoCaptureCustomProperty, Breaker, CaptureCallback, CaptureOptions, CaptureResult, Compression, CompressionData, DecideResponse, EditorParams, EventHandler, FeatureFlagsCallback, GDPROptions, JSC, OptInOutCapturingOptions, PersistentStore, PostData, PostHog, PostHogConfig, Properties, Property, QueuedRequestData, RequestCallback, RetryQueueElement, SessionRecordingOptions, SnippetArrayItem, XHROptions, XHRParams, posthog as default, isFeatureEnabledOptions, posthog };
package/dist/module.js CHANGED
@@ -885,7 +885,7 @@ var LZString = {
885
885
  }
886
886
  };
887
887
 
888
- var version = "1.27.0-alpha2";
888
+ var version = "1.27.0-alpha3";
889
889
 
890
890
  // e.g. Config.DEBUG = Config.DEBUG || instance.get_config('debug')
891
891
 
@@ -5169,37 +5169,37 @@ function strToU8(str, latin1) {
5169
5169
  return slc(ar, 0, ai);
5170
5170
  }
5171
5171
 
5172
- var Compression;
5172
+ exports.Compression = void 0;
5173
5173
 
5174
5174
  (function (Compression) {
5175
5175
  Compression["GZipJS"] = "gzip-js";
5176
5176
  Compression["LZ64"] = "lz64";
5177
5177
  Compression["Base64"] = "base64";
5178
- })(Compression || (Compression = {}));
5178
+ })(exports.Compression || (exports.Compression = {}));
5179
5179
 
5180
5180
  function decideCompression(compressionSupport) {
5181
- if (compressionSupport[Compression.GZipJS]) {
5182
- return Compression.GZipJS;
5183
- } else if (compressionSupport[Compression.LZ64]) {
5184
- return Compression.LZ64;
5181
+ if (compressionSupport[exports.Compression.GZipJS]) {
5182
+ return exports.Compression.GZipJS;
5183
+ } else if (compressionSupport[exports.Compression.LZ64]) {
5184
+ return exports.Compression.LZ64;
5185
5185
  } else {
5186
- return Compression.Base64;
5186
+ return exports.Compression.Base64;
5187
5187
  }
5188
5188
  }
5189
5189
  function compressData(compression, jsonData, options) {
5190
- if (compression === Compression.LZ64) {
5190
+ if (compression === exports.Compression.LZ64) {
5191
5191
  return [{
5192
5192
  data: LZString.compressToBase64(jsonData),
5193
- compression: Compression.LZ64
5193
+ compression: exports.Compression.LZ64
5194
5194
  }, options];
5195
- } else if (compression === Compression.GZipJS) {
5195
+ } else if (compression === exports.Compression.GZipJS) {
5196
5196
  // :TRICKY: This returns an UInt8Array. We don't encode this to a string - returning a blob will do this for us.
5197
5197
  return [gzipSync(strToU8(jsonData), {
5198
5198
  mtime: 0
5199
5199
  }), _objectSpread2(_objectSpread2({}, options), {}, {
5200
5200
  blob: true,
5201
5201
  urlQueryArgs: {
5202
- compression: Compression.GZipJS
5202
+ compression: exports.Compression.GZipJS
5203
5203
  }
5204
5204
  })];
5205
5205
  } else {