@sprig-technologies/sprig-browser 2.28.1 → 2.30.0

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/index.d.ts CHANGED
@@ -27,6 +27,7 @@ type elementNode = {
27
27
  childNodes: serializedNodeWithId[];
28
28
  isSVG?: true;
29
29
  needBlock?: boolean;
30
+ isCustom?: true;
30
31
  };
31
32
  type textNode = {
32
33
  type: NodeType.Text;
@@ -98,7 +99,7 @@ type DataURLOptions = Partial<{
98
99
  type: string;
99
100
  quality: number;
100
101
  }>;
101
- type MaskTextFn = (text: string) => string;
102
+ type MaskTextFn = (text: string, element: HTMLElement | null) => string;
102
103
  type MaskInputFn = (text: string, element: HTMLElement) => string;
103
104
 
104
105
  declare class Mirror$1 implements IMirror<Node> {
@@ -185,7 +186,8 @@ declare enum IncrementalSource {
185
186
  Drag = 12,
186
187
  StyleDeclaration = 13,
187
188
  Selection = 14,
188
- AdoptedStyleSheet = 15
189
+ AdoptedStyleSheet = 15,
190
+ CustomElement = 16
189
191
  }
190
192
  type mutationData = {
191
193
  source: IncrementalSource.Mutation;
@@ -228,7 +230,10 @@ type selectionData = {
228
230
  type adoptedStyleSheetData = {
229
231
  source: IncrementalSource.AdoptedStyleSheet;
230
232
  } & adoptedStyleSheetParam;
231
- type incrementalData = mutationData | mousemoveData | mouseInteractionData | scrollData | viewportResizeData | inputData | mediaInteractionData | styleSheetRuleData | canvasMutationData | fontData | selectionData | styleDeclarationData | adoptedStyleSheetData;
233
+ type customElementData = {
234
+ source: IncrementalSource.CustomElement;
235
+ } & customElementParam;
236
+ type incrementalData = mutationData | mousemoveData | mouseInteractionData | scrollData | viewportResizeData | inputData | mediaInteractionData | styleSheetRuleData | canvasMutationData | fontData | selectionData | styleDeclarationData | adoptedStyleSheetData | customElementData;
232
237
  type event = domContentLoadedEvent | loadedEvent | fullSnapshotEvent | incrementalSnapshotEvent | metaEvent | customEvent | pluginEvent;
233
238
  type eventWithTime = event & {
234
239
  timestamp: number;
@@ -280,6 +285,7 @@ type hooksParam = {
280
285
  canvasMutation?: canvasMutationCallback;
281
286
  font?: fontCallback;
282
287
  selection?: selectionCallback;
288
+ customElement?: customElementCallback;
283
289
  };
284
290
  type textMutation = {
285
291
  id: number;
@@ -347,8 +353,8 @@ declare enum CanvasContext {
347
353
  type mouseInteractionParam = {
348
354
  type: MouseInteractions;
349
355
  id: number;
350
- x: number;
351
- y: number;
356
+ x?: number;
357
+ y?: number;
352
358
  pointerType?: PointerTypes;
353
359
  };
354
360
  type mouseInteractionCallBack = (d: mouseInteractionParam) => void;
@@ -443,6 +449,7 @@ type mediaInteractionParam = {
443
449
  currentTime?: number;
444
450
  volume?: number;
445
451
  muted?: boolean;
452
+ loop?: boolean;
446
453
  playbackRate?: number;
447
454
  };
448
455
  type mediaInteractionCallback = (p: mediaInteractionParam) => void;
@@ -462,6 +469,12 @@ type selectionParam = {
462
469
  ranges: Array<SelectionRange>;
463
470
  };
464
471
  type selectionCallback = (p: selectionParam) => void;
472
+ type customElementParam = {
473
+ define?: {
474
+ name: string;
475
+ };
476
+ };
477
+ type customElementCallback = (c: customElementParam) => void;
465
478
  type DeprecatedMirror = {
466
479
  map: {
467
480
  [key: number]: INode;
@@ -822,6 +835,7 @@ declare const RRMediaElement_base: {
822
835
  paused?: boolean | undefined;
823
836
  muted?: boolean | undefined;
824
837
  playbackRate?: number | undefined;
838
+ loop?: boolean | undefined;
825
839
  attachShadow(_init: ShadowRootInit): IRRElement;
826
840
  play(): void;
827
841
  pause(): void;
@@ -1442,6 +1456,7 @@ interface XhrHeaders {
1442
1456
  [key: string]: string;
1443
1457
  }
1444
1458
 
1459
+ declare type XhrResponseLike = Partial<XhrResponse> & Pick<XhrResponse, 'statusCode'>;
1445
1460
  declare const isValidChunkSize: (chunkSize: any, { minChunkSize, maxChunkSize, }?: {
1446
1461
  minChunkSize?: number | undefined;
1447
1462
  maxChunkSize?: number | undefined;
@@ -1455,23 +1470,46 @@ declare type ChunkedStreamIterableOptions = {
1455
1470
  minChunkSize?: number;
1456
1471
  maxChunkSize?: number;
1457
1472
  };
1458
- declare class ChunkedStreamIterable implements AsyncIterable<Blob> {
1473
+ interface ChunkedIterable extends AsyncIterable<Blob> {
1474
+ chunkSize: number;
1475
+ readonly chunkByteSize: number;
1476
+ readonly minChunkSize: number;
1477
+ readonly maxChunkSize: number;
1478
+ readonly error: Error | undefined;
1479
+ }
1480
+ declare class ChunkedStreamIterable implements ChunkedIterable {
1459
1481
  protected readableStream: ReadableStream<Uint8Array | Blob>;
1460
1482
  protected _chunkSize: number | undefined;
1461
1483
  protected defaultChunkSize: number;
1484
+ protected _error: Error | undefined;
1462
1485
  readonly minChunkSize: number;
1463
1486
  readonly maxChunkSize: number;
1464
1487
  constructor(readableStream: ReadableStream<Uint8Array | Blob>, options?: ChunkedStreamIterableOptions);
1465
1488
  get chunkSize(): number;
1466
1489
  set chunkSize(value: number);
1467
1490
  get chunkByteSize(): number;
1491
+ get error(): Error | undefined;
1492
+ [Symbol.asyncIterator](): AsyncIterator<Blob>;
1493
+ }
1494
+ declare class ChunkedFileIterable implements ChunkedIterable {
1495
+ protected file: File;
1496
+ protected _chunkSize: number | undefined;
1497
+ protected defaultChunkSize: number;
1498
+ protected _error: Error | undefined;
1499
+ readonly minChunkSize: number;
1500
+ readonly maxChunkSize: number;
1501
+ constructor(file: File, options?: ChunkedStreamIterableOptions);
1502
+ get chunkSize(): number;
1503
+ set chunkSize(value: number);
1504
+ get chunkByteSize(): number;
1505
+ get error(): Error | undefined;
1468
1506
  [Symbol.asyncIterator](): AsyncIterator<Blob>;
1469
1507
  }
1470
1508
  /**
1471
1509
  * Checks if an upload chunk was partially received (HTTP 308) and needs a retry.
1472
1510
  * Validates against the 'Range' header to ensure the full chunk was processed.
1473
1511
  */
1474
- declare const isIncompleteChunkUploadNeedingRetry: (res: XhrResponse | undefined, _options?: any) => res is XhrResponse;
1512
+ declare const isIncompleteChunkUploadNeedingRetry: (res: XhrResponseLike | undefined, _options?: any) => res is XhrResponseLike;
1475
1513
  declare type EventName = 'attempt' | 'attemptFailure' | 'chunkSuccess' | 'error' | 'offline' | 'online' | 'progress' | 'success';
1476
1514
  declare type AllowedMethods = 'PUT' | 'POST' | 'PATCH';
1477
1515
  interface UpChunkOptions {
@@ -1487,6 +1525,7 @@ interface UpChunkOptions {
1487
1525
  dynamicChunkSize?: boolean;
1488
1526
  maxChunkSize?: number;
1489
1527
  minChunkSize?: number;
1528
+ useLargeFileWorkaround?: boolean;
1490
1529
  }
1491
1530
  declare class UpChunk {
1492
1531
  static createUpload(options: UpChunkOptions): UpChunk;
@@ -1498,15 +1537,15 @@ declare class UpChunk {
1498
1537
  delayBeforeAttempt: number;
1499
1538
  retryCodes: number[];
1500
1539
  dynamicChunkSize: boolean;
1501
- protected chunkedStreamIterable: ChunkedStreamIterable;
1502
- protected chunkedStreamIterator: AsyncIterator<Blob, any, undefined>;
1540
+ protected chunkedIterable: ChunkedIterable;
1541
+ protected chunkedIterator: AsyncIterator<Blob, any, undefined>;
1503
1542
  protected pendingChunk?: Blob;
1504
1543
  private chunkCount;
1505
1544
  private maxFileBytes;
1506
1545
  private endpointValue;
1507
1546
  private totalChunks;
1508
1547
  private attemptCount;
1509
- private offline;
1548
+ private _offline;
1510
1549
  private _paused;
1511
1550
  private success;
1512
1551
  private currentXhr?;
@@ -1532,10 +1571,12 @@ declare class UpChunk {
1532
1571
  * Unsubscribe to an event
1533
1572
  */
1534
1573
  off(eventName: EventName, fn: (event: CustomEvent) => void): void;
1574
+ get offline(): boolean;
1535
1575
  get paused(): boolean;
1536
1576
  abort(): void;
1537
1577
  pause(): void;
1538
1578
  resume(): void;
1579
+ get successfulPercentage(): number;
1539
1580
  /**
1540
1581
  * Dispatch an event
1541
1582
  */
@@ -1562,6 +1603,9 @@ declare class UpChunk {
1562
1603
  }
1563
1604
  declare function createUpload$1(options: UpChunkOptions): UpChunk;
1564
1605
 
1606
+ type _mux_upchunk_ChunkedFileIterable = ChunkedFileIterable;
1607
+ declare const _mux_upchunk_ChunkedFileIterable: typeof ChunkedFileIterable;
1608
+ type _mux_upchunk_ChunkedIterable = ChunkedIterable;
1565
1609
  type _mux_upchunk_ChunkedStreamIterable = ChunkedStreamIterable;
1566
1610
  declare const _mux_upchunk_ChunkedStreamIterable: typeof ChunkedStreamIterable;
1567
1611
  type _mux_upchunk_ChunkedStreamIterableOptions = ChunkedStreamIterableOptions;
@@ -1572,7 +1616,7 @@ declare const _mux_upchunk_getChunkSizeError: typeof getChunkSizeError;
1572
1616
  declare const _mux_upchunk_isIncompleteChunkUploadNeedingRetry: typeof isIncompleteChunkUploadNeedingRetry;
1573
1617
  declare const _mux_upchunk_isValidChunkSize: typeof isValidChunkSize;
1574
1618
  declare namespace _mux_upchunk {
1575
- export { _mux_upchunk_ChunkedStreamIterable as ChunkedStreamIterable, type _mux_upchunk_ChunkedStreamIterableOptions as ChunkedStreamIterableOptions, _mux_upchunk_UpChunk as UpChunk, type _mux_upchunk_UpChunkOptions as UpChunkOptions, createUpload$1 as createUpload, _mux_upchunk_getChunkSizeError as getChunkSizeError, _mux_upchunk_isIncompleteChunkUploadNeedingRetry as isIncompleteChunkUploadNeedingRetry, _mux_upchunk_isValidChunkSize as isValidChunkSize };
1619
+ export { _mux_upchunk_ChunkedFileIterable as ChunkedFileIterable, type _mux_upchunk_ChunkedIterable as ChunkedIterable, _mux_upchunk_ChunkedStreamIterable as ChunkedStreamIterable, type _mux_upchunk_ChunkedStreamIterableOptions as ChunkedStreamIterableOptions, _mux_upchunk_UpChunk as UpChunk, type _mux_upchunk_UpChunkOptions as UpChunkOptions, createUpload$1 as createUpload, _mux_upchunk_getChunkSizeError as getChunkSizeError, _mux_upchunk_isIncompleteChunkUploadNeedingRetry as isIncompleteChunkUploadNeedingRetry, _mux_upchunk_isValidChunkSize as isValidChunkSize };
1576
1620
  }
1577
1621
 
1578
1622
  declare enum NOTIFICATION_TYPES {
@@ -2442,7 +2486,7 @@ interface Config extends MobileReplayConfig {
2442
2486
  };
2443
2487
  };
2444
2488
  customMetadata?: Record<string, unknown>;
2445
- customStyles: string;
2489
+ customStyles?: string;
2446
2490
  dismissOnPageChange: boolean;
2447
2491
  forceBrandedLogo?: boolean;
2448
2492
  endCard?: {
@@ -2508,7 +2552,6 @@ interface Config extends MobileReplayConfig {
2508
2552
  path?: string;
2509
2553
  platform?: Platform;
2510
2554
  previewKey?: string | null;
2511
- previewLanguage?: string;
2512
2555
  productConfig?: AppProductConfig;
2513
2556
  replayNonce?: string;
2514
2557
  replaySettings?: object;
@@ -2522,6 +2565,7 @@ interface Config extends MobileReplayConfig {
2522
2565
  studyType?: StudyType;
2523
2566
  surveyId: number;
2524
2567
  tabTitle: string;
2568
+ trackPageViewUrl?: string;
2525
2569
  ulEvents: typeof SprigEvent;
2526
2570
  UpChunk: Window["UpChunk"];
2527
2571
  useDesktopPrototype?: boolean;
@@ -2646,6 +2690,7 @@ declare namespace sprigConfig {
2646
2690
  // external apis
2647
2691
  addListener: (event: SprigEvent, listener: SprigListener) => Promise<void>;
2648
2692
  addSurveyListener: (listener: SprigListener) => Promise<void>;
2693
+ applyFeedbackStyles: (styles: { button?: string; view?: string }) => void;
2649
2694
  applyStyles: (styleString: string) => void;
2650
2695
  dismissActiveSurvey: (reason?: DismissReason) => void;
2651
2696
  displaySurvey: (surveyId: number) => IdentifyResult;
@@ -2704,6 +2749,7 @@ declare namespace sprigConfig {
2704
2749
  url: string,
2705
2750
  properties?: SprigProperties,
2706
2751
  showSurveyCallback?: (surveyId?: number) => Promise<boolean>,
2752
+ calledFromApi?: boolean,
2707
2753
  ) => void;
2708
2754
  unmute: () => void;
2709
2755
  }
@@ -2718,7 +2764,10 @@ declare namespace sprigConfig {
2718
2764
  SprigAPIActions &
2719
2765
  SprigCommands & {
2720
2766
  _API_URL: string;
2721
- _config: Config;
2767
+ _config: Config & {
2768
+ desktopDisplay?: string;
2769
+ previewLanguage?: string;
2770
+ };
2722
2771
  _gtm: unknown; // TODO: determine if boolean?
2723
2772
  _queue: SprigQueue;
2724
2773
  _segment: unknown; // TODO: determine if boolean?
@@ -2730,6 +2779,7 @@ declare namespace sprigConfig {
2730
2779
  email?: string | null;
2731
2780
  envId: string;
2732
2781
  error?: Error;
2782
+ feedbackCustomStyles?: string;
2733
2783
  frameId: string;
2734
2784
  loaded: boolean;
2735
2785
  locale?: string;
@@ -2793,7 +2843,13 @@ declare global {
2793
2843
  type WindowSprig = sprigConfig.WindowSprig;
2794
2844
  type SprigAttributes = Record<string, boolean | number | string>;
2795
2845
  type SprigListener = Listener<unknown[]>;
2796
- type SprigMetadata = Record<string, unknown>;
2846
+ type SprigMetadata = {
2847
+ url?: string;
2848
+ trackPageView?: boolean;
2849
+ optimizelyExperiments?: object;
2850
+ launchDarklyFlags?: object;
2851
+ eventProperties?: SprigProperties;
2852
+ }
2797
2853
  type SprigProperties = Record<string, unknown>;
2798
2854
  type SprigAPIActions = sprigConfig.SprigAPIActions;
2799
2855
  type TrackPayload = sprigConfig.TrackPayload;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{D as s,g as a,S as i,j as r,h as p}from"./index-DPcbQptf.js";export{s as DismissReason,a as SprigAPI,i as SprigEvent,r as default,p as sprig};
1
+ import{D as s,g as a,S as i,j as r,h as p}from"./index-Del4rEas.js";export{s as DismissReason,a as SprigAPI,i as SprigEvent,r as default,p as sprig};