@sprig-technologies/sprig-bundled 1.1.4 → 1.1.5

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,14 +1456,6 @@ interface XhrHeaders {
1442
1456
  [key: string]: string;
1443
1457
  }
1444
1458
 
1445
- declare const isValidChunkSize: (chunkSize: any, { minChunkSize, maxChunkSize, }?: {
1446
- minChunkSize?: number | undefined;
1447
- maxChunkSize?: number | undefined;
1448
- }) => chunkSize is number | null | undefined;
1449
- declare const getChunkSizeError: (chunkSize: any, { minChunkSize, maxChunkSize, }?: {
1450
- minChunkSize?: number | undefined;
1451
- maxChunkSize?: number | undefined;
1452
- }) => TypeError;
1453
1459
  declare type ChunkedStreamIterableOptions = {
1454
1460
  defaultChunkSize?: number;
1455
1461
  minChunkSize?: number;
@@ -1467,11 +1473,6 @@ declare class ChunkedStreamIterable implements AsyncIterable<Blob> {
1467
1473
  get chunkByteSize(): number;
1468
1474
  [Symbol.asyncIterator](): AsyncIterator<Blob>;
1469
1475
  }
1470
- /**
1471
- * Checks if an upload chunk was partially received (HTTP 308) and needs a retry.
1472
- * Validates against the 'Range' header to ensure the full chunk was processed.
1473
- */
1474
- declare const isIncompleteChunkUploadNeedingRetry: (res: XhrResponse | undefined, _options?: any) => res is XhrResponse;
1475
1476
  declare type EventName = 'attempt' | 'attemptFailure' | 'chunkSuccess' | 'error' | 'offline' | 'online' | 'progress' | 'success';
1476
1477
  declare type AllowedMethods = 'PUT' | 'POST' | 'PATCH';
1477
1478
  interface UpChunkOptions {
@@ -1560,20 +1561,7 @@ declare class UpChunk {
1560
1561
  */
1561
1562
  private sendChunks;
1562
1563
  }
1563
- declare function createUpload$1(options: UpChunkOptions): UpChunk;
1564
-
1565
- type _mux_upchunk_ChunkedStreamIterable = ChunkedStreamIterable;
1566
- declare const _mux_upchunk_ChunkedStreamIterable: typeof ChunkedStreamIterable;
1567
- type _mux_upchunk_ChunkedStreamIterableOptions = ChunkedStreamIterableOptions;
1568
- type _mux_upchunk_UpChunk = UpChunk;
1569
- declare const _mux_upchunk_UpChunk: typeof UpChunk;
1570
- type _mux_upchunk_UpChunkOptions = UpChunkOptions;
1571
- declare const _mux_upchunk_getChunkSizeError: typeof getChunkSizeError;
1572
- declare const _mux_upchunk_isIncompleteChunkUploadNeedingRetry: typeof isIncompleteChunkUploadNeedingRetry;
1573
- declare const _mux_upchunk_isValidChunkSize: typeof isValidChunkSize;
1574
- 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 };
1576
- }
1564
+ declare const createUpload: typeof UpChunk.createUpload;
1577
1565
 
1578
1566
  declare enum NOTIFICATION_TYPES {
1579
1567
  ACTIVATE = "ACTIVATE:experiment, user_id,attributes, variation, event",
@@ -2151,11 +2139,11 @@ interface PageUrlEvent {
2151
2139
  }
2152
2140
 
2153
2141
  declare enum DismissReason {
2154
- Closed = "close.click",
2155
- Complete = "survey.completed",
2156
- FeedbackClosed = "feedback.closed",
2157
- PageChange = "page.change",
2158
- API = "api",
2142
+ Closed = "close.click",// user clicked the close button
2143
+ Complete = "survey.completed",// user answered all questions
2144
+ FeedbackClosed = "feedback.closed",// user either clicked on feedback button or close button
2145
+ PageChange = "page.change",// productConfig.dismissOnPageChange == true and we detected a page change (excludes hash/query param changes)
2146
+ API = "api",// JS called Sprig('dismissActiveSurvey')
2159
2147
  Override = "override"
2160
2148
  }
2161
2149
  type StudyType = "feedbackButton" | "inProductSurvey";
@@ -2206,7 +2194,7 @@ declare const EVENTS: {
2206
2194
  };
2207
2195
  };
2208
2196
 
2209
- type Metric = "sdk_event_queue_latency_seconds" | "sdk_replay_add_event_batch_seconds" | "sdk_replay_cleanup_seconds" | "sdk_replay_compression_seconds" | "sdk_replay_get_events_between_seconds" | "sdk_replay_snapshot_seconds";
2197
+ type Metric = "sdk_event_queue_latency_seconds" | "sdk_replay_add_event_batch_seconds" | "sdk_replay_cleanup_seconds" | "sdk_replay_compression_seconds" | "sdk_replay_get_events_between_seconds" | "sdk_replay_snapshot_seconds" | "sdk_mutations_nodes_added" | "sdk_mutations_nodes_removed" | "sdk_mutations_attributes_changed" | "sdk_mutations_character_data" | "sdk_dom_nodes_count" | "sdk_page_html_characters";
2210
2198
  type ThresholdType = "max" | "min";
2211
2199
  interface MetricThreshold {
2212
2200
  metric: Metric;
@@ -2214,34 +2202,15 @@ interface MetricThreshold {
2214
2202
  value: number;
2215
2203
  }
2216
2204
 
2217
- type ReplayDurationType = "after" | "before" | "beforeAndAfter";
2218
- type EventDigest = {
2219
- timestamp: number;
2220
- type: "Sprig_Click";
2221
- } | {
2222
- timestamp: number;
2223
- name: string;
2224
- type: "Sprig_TrackEvent";
2225
- } | {
2226
- timestamp: number;
2227
- type: "Sprig_PageView";
2228
- url: string;
2229
- } | {
2230
- timestamp: number;
2231
- surveyId: string;
2232
- type: "Sprig_ShowSurvey";
2233
- } | {
2234
- timestamp: number;
2235
- surveyId: string;
2236
- type: "Sprig_SubmitSurvey";
2237
- };
2238
-
2239
2205
  interface RecordedTaskResponseType {
2240
2206
  questionId: number;
2241
2207
  type: CardType;
2242
2208
  value: RecordedTaskResponseValueType;
2243
2209
  }
2244
2210
 
2211
+ type SurveyState = "ready" | "no survey";
2212
+ type ReplayDurationType = "after" | "before" | "beforeAndAfter";
2213
+
2245
2214
  interface MobileReplayConfig {
2246
2215
  mobileMetricsReportingEnabled?: boolean;
2247
2216
  metricsReportingInterval?: number;
@@ -2442,7 +2411,7 @@ interface Config extends MobileReplayConfig {
2442
2411
  };
2443
2412
  };
2444
2413
  customMetadata?: Record<string, unknown>;
2445
- customStyles: string;
2414
+ customStyles?: string;
2446
2415
  dismissOnPageChange: boolean;
2447
2416
  forceBrandedLogo?: boolean;
2448
2417
  endCard?: {
@@ -2469,6 +2438,7 @@ interface Config extends MobileReplayConfig {
2469
2438
  Authorization?: string;
2470
2439
  "Content-Type"?: string;
2471
2440
  "userleap-platform": Platform | "ios" | "android" | "video_recorder";
2441
+ "sprig-modules"?: string;
2472
2442
  /** @example "SJcVfq-7QQ" */
2473
2443
  "x-ul-environment-id"?: string;
2474
2444
  "x-ul-installation-method": InstallationMethod;
@@ -2508,7 +2478,7 @@ interface Config extends MobileReplayConfig {
2508
2478
  path?: string;
2509
2479
  platform?: Platform;
2510
2480
  previewKey?: string | null;
2511
- previewLanguage?: string;
2481
+ previewMode?: boolean;
2512
2482
  productConfig?: AppProductConfig;
2513
2483
  replayNonce?: string;
2514
2484
  replaySettings?: object;
@@ -2522,8 +2492,10 @@ interface Config extends MobileReplayConfig {
2522
2492
  studyType?: StudyType;
2523
2493
  surveyId: number;
2524
2494
  tabTitle: string;
2495
+ trackPageViewUrl?: string;
2525
2496
  ulEvents: typeof SprigEvent;
2526
2497
  UpChunk: Window["UpChunk"];
2498
+ upchunkLibraryURL?: string;
2527
2499
  useDesktopPrototype?: boolean;
2528
2500
  useMobileStyling: boolean;
2529
2501
  userId: UUID | null;
@@ -2559,7 +2531,26 @@ declare class SprigQueue {
2559
2531
  empty(): void;
2560
2532
  }
2561
2533
 
2562
- type SurveyState = "ready" | "no survey";
2534
+ type EventDigest = {
2535
+ timestamp: number;
2536
+ type: "Sprig_Click";
2537
+ } | {
2538
+ timestamp: number;
2539
+ name: string;
2540
+ type: "Sprig_TrackEvent";
2541
+ } | {
2542
+ timestamp: number;
2543
+ type: "Sprig_PageView";
2544
+ url: string;
2545
+ } | {
2546
+ timestamp: number;
2547
+ surveyId: string;
2548
+ type: "Sprig_ShowSurvey";
2549
+ } | {
2550
+ timestamp: number;
2551
+ surveyId: string;
2552
+ type: "Sprig_SubmitSurvey";
2553
+ };
2563
2554
 
2564
2555
  declare namespace optimizely {
2565
2556
  interface Optimizely {
@@ -2646,6 +2637,7 @@ declare namespace sprigConfig {
2646
2637
  // external apis
2647
2638
  addListener: (event: SprigEvent, listener: SprigListener) => Promise<void>;
2648
2639
  addSurveyListener: (listener: SprigListener) => Promise<void>;
2640
+ applyFeedbackStyles: (styles: { button?: string; view?: string }) => void;
2649
2641
  applyStyles: (styleString: string) => void;
2650
2642
  dismissActiveSurvey: (reason?: DismissReason) => void;
2651
2643
  displaySurvey: (surveyId: number) => IdentifyResult;
@@ -2704,6 +2696,7 @@ declare namespace sprigConfig {
2704
2696
  url: string,
2705
2697
  properties?: SprigProperties,
2706
2698
  showSurveyCallback?: (surveyId?: number) => Promise<boolean>,
2699
+ calledFromApi?: boolean,
2707
2700
  ) => void;
2708
2701
  unmute: () => void;
2709
2702
  }
@@ -2718,7 +2711,10 @@ declare namespace sprigConfig {
2718
2711
  SprigAPIActions &
2719
2712
  SprigCommands & {
2720
2713
  _API_URL: string;
2721
- _config: Config;
2714
+ _config: Config & {
2715
+ desktopDisplay?: string;
2716
+ previewLanguage?: string;
2717
+ };
2722
2718
  _gtm: unknown; // TODO: determine if boolean?
2723
2719
  _queue: SprigQueue;
2724
2720
  _segment: unknown; // TODO: determine if boolean?
@@ -2730,7 +2726,9 @@ declare namespace sprigConfig {
2730
2726
  email?: string | null;
2731
2727
  envId: string;
2732
2728
  error?: Error;
2729
+ feedbackCustomStyles?: string;
2733
2730
  frameId: string;
2731
+ isMobileSDK?: boolean;
2734
2732
  loaded: boolean;
2735
2733
  locale?: string;
2736
2734
  maxHeight?: number | string;
@@ -2738,10 +2736,12 @@ declare namespace sprigConfig {
2738
2736
  mobileHeadersJSON?: string;
2739
2737
  nonce?: string;
2740
2738
  partnerAnonymousId: string | null;
2739
+ replayLibraryURL?: string;
2741
2740
  replayNonce?: string;
2742
- reportError: (name: string, err: Error, extraInfo?: object) => void;
2741
+ reportError: (name: string, err: Error, extraInfo?: object, bodyInfo?: object) => void;
2743
2742
  sampleRate?: number;
2744
2743
  token: string | null;
2744
+ upchunkLibraryURL?: string;
2745
2745
  UPDATES: typeof EVENTS;
2746
2746
  viewSDKURL?: string;
2747
2747
  windowDimensions?: {
@@ -2755,9 +2755,9 @@ type ArgumentType<T> = T extends (arg1: infer U, ...args: unknown[]) => unknown
2755
2755
  ? U
2756
2756
  : unknown;
2757
2757
  type PublicOf<T> = { [K in keyof T]: T[K] };
2758
- type createUpload = (typeof _mux_upchunk)["createUpload"];
2759
2758
  type rrwebRecord = (typeof rrweb)["record"];
2760
2759
  type rrwebCustomEvent = (typeof rrweb)["record"]["addCustomEvent"];
2760
+ type rrwebFullSnapshot = (typeof rrweb)["record"]["takeFullSnapshot"];
2761
2761
  declare global {
2762
2762
  interface Window {
2763
2763
  __cfg: Config;
@@ -2773,9 +2773,7 @@ declare global {
2773
2773
  optimizelyDatafile?: object;
2774
2774
  previewMode?: unknown;
2775
2775
  UpChunk: {
2776
- createUpload: (
2777
- ...args: ArgumentTypes<createUpload>
2778
- ) => PublicOf<ReturnType<createUpload>>;
2776
+ createUpload: typeof createUpload;
2779
2777
  };
2780
2778
  _Sprig?: sprigConfig.WindowSprig;
2781
2779
  Sprig: sprigConfig.WindowSprig;
@@ -2784,6 +2782,9 @@ declare global {
2784
2782
  addCustomEvent: (
2785
2783
  ...args: ArgumentTypes<rrwebCustomEvent>
2786
2784
  ) => PublicOf<ReturnType<rrwebCustomEvent>>;
2785
+ takeFullSnapshot: (
2786
+ ...args: ArgumentTypes<rrwebFullSnapshot>
2787
+ ) => PublicOf<ReturnType<rrwebFullSnapshot>>;
2787
2788
  } & ((
2788
2789
  arg: Omit<ArgumentType<rrwebRecord>, "hooks">,
2789
2790
  ) => PublicOf<ReturnType<rrwebRecord>>);
@@ -2793,7 +2794,13 @@ declare global {
2793
2794
  type WindowSprig = sprigConfig.WindowSprig;
2794
2795
  type SprigAttributes = Record<string, boolean | number | string>;
2795
2796
  type SprigListener = Listener<unknown[]>;
2796
- type SprigMetadata = Record<string, unknown>;
2797
+ type SprigMetadata = {
2798
+ url?: string;
2799
+ trackPageView?: boolean;
2800
+ optimizelyExperiments?: object;
2801
+ launchDarklyFlags?: object;
2802
+ eventProperties?: SprigProperties;
2803
+ };
2797
2804
  type SprigProperties = Record<string, unknown>;
2798
2805
  type SprigAPIActions = sprigConfig.SprigAPIActions;
2799
2806
  type TrackPayload = sprigConfig.TrackPayload;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{D as s,g as a,S as i,h as r}from"./index-Ce9gtwb7.js";export{s as DismissReason,a as SprigAPI,i as SprigEvent,r as sprig};
1
+ import{D as s,h as a,S as i,j as r}from"./index-Cr-P2Ow4.js";export{s as DismissReason,a as SprigAPI,i as SprigEvent,r as sprig};