@sprig-technologies/sprig-browser 2.24.5 → 2.24.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/index.d.ts CHANGED
@@ -351,6 +351,34 @@ interface PassthroughData {
351
351
  responseGroupUid: UUID;
352
352
  }
353
353
 
354
+ interface Experiment {
355
+ id: string;
356
+ variation?: string;
357
+ }
358
+
359
+ type QueueItem = [string, ...unknown[]] | (() => void);
360
+ declare class SprigQueue {
361
+ paused: boolean;
362
+ queue: QueueItem[];
363
+ ul: WindowSprig;
364
+ constructor(ul: WindowSprig, queue: QueueItem[]);
365
+ flush(queue: QueueItem[]): void;
366
+ isPaused(): boolean;
367
+ pause(): void;
368
+ unpause(): void;
369
+ push(action: QueueItem): void;
370
+ perform(func: () => void): void | Promise<unknown>;
371
+ /**
372
+ * Removes all queued items
373
+ */
374
+ empty(): void;
375
+ }
376
+
377
+ declare enum SurveyState {
378
+ Ready = "ready",
379
+ NoSurvey = "no survey"
380
+ }
381
+
354
382
  interface RecordedTaskResponseValueType {
355
383
  mediaRecordingUids?: string[] | null;
356
384
  taskDurationMillisecond?: number;
@@ -849,6 +877,7 @@ interface Config {
849
877
  customMetadata?: Record<string, unknown>;
850
878
  customStyles: string;
851
879
  dismissOnPageChange: boolean;
880
+ forceBrandedLogo?: boolean;
852
881
  endCard?: {
853
882
  headline: string;
854
883
  subheader?: string;
@@ -856,6 +885,8 @@ interface Config {
856
885
  /** @example "SJcVfq-7QQ" */
857
886
  envId: string;
858
887
  environmentId?: string;
888
+ exitOnOverlayClick?: boolean;
889
+ exitOnOverlayClickMobile?: boolean;
859
890
  eventEmitFn: SprigEventEmitter["emit"];
860
891
  fontFamily?: string;
861
892
  fontFamilyURL: undefined;
@@ -891,6 +922,7 @@ interface Config {
891
922
  maxAttrValueLength: number;
892
923
  maxEmailLength: number;
893
924
  maxEventLength: number;
925
+ maxReplayDurationSeconds?: number;
894
926
  maxUserIdLength: number;
895
927
  mobileSDKVersion: undefined;
896
928
  mode?: string;
@@ -914,6 +946,7 @@ interface Config {
914
946
  surveyId: number;
915
947
  tabTitle: string;
916
948
  ulEvents: typeof SprigEvent;
949
+ UpChunk: Window["UpChunk"];
917
950
  useDesktopPrototype?: boolean;
918
951
  useMobileStyling: boolean;
919
952
  userId: UUID | null;
@@ -926,33 +959,34 @@ interface Config {
926
959
  };
927
960
  }
928
961
 
929
- declare enum SurveyState {
930
- Ready = "ready",
931
- NoSurvey = "no survey"
932
- }
933
-
934
- interface Experiment {
935
- id: string;
936
- variation?: string;
937
- }
938
-
939
- type QueueItem = [string, ...unknown[]] | (() => void);
940
- declare class SprigQueue {
941
- paused: boolean;
942
- queue: QueueItem[];
943
- ul: WindowSprig;
944
- constructor(ul: WindowSprig, queue: QueueItem[]);
945
- flush(queue: QueueItem[]): void;
946
- isPaused(): boolean;
947
- pause(): void;
948
- unpause(): void;
949
- push(action: QueueItem): void;
950
- perform(func: () => void): void | Promise<unknown>;
951
- /**
952
- * Removes all queued items
953
- */
954
- empty(): void;
962
+ declare enum ReplayEventType {
963
+ Click = "Sprig_Click",
964
+ Event = "Sprig_TrackEvent",
965
+ PageView = "Sprig_PageView",
966
+ SurveyShown = "Sprig_ShowSurvey",
967
+ SurveySubmitted = "Sprig_SubmitSurvey",
968
+ Noop = "Sprig_Noop"
955
969
  }
970
+ type EventDigest = {
971
+ timestamp: number;
972
+ type: ReplayEventType.Click;
973
+ } | {
974
+ timestamp: number;
975
+ name: string;
976
+ type: ReplayEventType.Event;
977
+ } | {
978
+ timestamp: number;
979
+ type: ReplayEventType.PageView;
980
+ url: string;
981
+ } | {
982
+ timestamp: number;
983
+ surveyId: string;
984
+ type: ReplayEventType.SurveyShown;
985
+ } | {
986
+ timestamp: number;
987
+ surveyId: string;
988
+ type: ReplayEventType.SurveySubmitted;
989
+ };
956
990
 
957
991
  declare namespace optimizely {
958
992
  interface Optimizely {
@@ -993,9 +1027,54 @@ declare namespace optimizely {
993
1027
  }
994
1028
  }
995
1029
 
1030
+ declare namespace upchunk {
1031
+ type AllowedMethods = "PUT" | "POST" | "PATCH";
1032
+
1033
+ //Adapted from here: https://github.com/muxinc/upchunk/blob/master/src/upchunk.ts
1034
+ interface UpChunkOptions {
1035
+ endpoint: string | ((file?: File) => Promise<string>);
1036
+ file: File;
1037
+ method?: AllowedMethods;
1038
+ headers?: Headers;
1039
+ maxFileSize?: number;
1040
+ chunkSize?: number;
1041
+ attempts?: number;
1042
+ delayBeforeAttempt?: number;
1043
+ retryCodes?: number[];
1044
+ dynamicChunkSize?: boolean;
1045
+ maxChunkSize?: number;
1046
+ minChunkSize?: number;
1047
+ }
1048
+
1049
+ type UpChunkEventName =
1050
+ | "attempt"
1051
+ | "attemptFailure"
1052
+ | "chunkSuccess"
1053
+ | "error"
1054
+ | "offline"
1055
+ | "online"
1056
+ | "progress"
1057
+ | "success";
1058
+
1059
+ interface UpChunk {
1060
+ startTime: number;
1061
+ on: (eventName: UpChunkEventName, fn: (event: CustomEvent) => void) => void;
1062
+ }
1063
+ interface UpChunkModule {
1064
+ createUpload: (options: UpChunkOptions) => UpChunk;
1065
+ }
1066
+ }
1067
+
996
1068
  declare namespace sprigConfig {
997
1069
  type IdentifyResult = Promise<
998
- { success: boolean; message?: string } | undefined
1070
+ | {
1071
+ success: boolean;
1072
+ message?: string;
1073
+ surveyState?: SurveyState;
1074
+ surveyId?: number;
1075
+ responseGroupUid?: string;
1076
+ }
1077
+ | undefined
999
1078
  >;
1000
1079
 
1001
1080
  interface TrackPayload {
@@ -1008,17 +1087,30 @@ declare namespace sprigConfig {
1008
1087
  }
1009
1088
 
1010
1089
  interface SprigAPIActions {
1090
+ // internal apis
1091
+ _completeSessionReplay: (payload: {
1092
+ surveyId: number;
1093
+ responseGroupUuid: string;
1094
+ eventDigest?: EventDigest[];
1095
+ }) => Promise<void>;
1096
+ _generateVideoUploadUrl: (body: {
1097
+ mediaRecordingUid?: string;
1098
+ mediaType?: MediaType;
1099
+ questionId?: number;
1100
+ responseGroupUid?: string;
1101
+ surveyId?: number;
1102
+ updatedAt?: string;
1103
+ visitorId?: string | null;
1104
+ }) => Promise<string | null>;
1011
1105
  _previewSurvey: (surveyTemplateId: UUID) => void;
1012
1106
  _reviewSurvey: (surveyId: number) => void;
1107
+
1108
+ // external apis
1013
1109
  addListener: (event: SprigEvent, listener: SprigListener) => Promise<void>;
1014
1110
  addSurveyListener: (listener: SprigListener) => Promise<void>;
1015
1111
  applyStyles: (styleString: string) => void;
1016
1112
  dismissActiveSurvey: (reason?: DismissReason) => void;
1017
- displaySurvey: (surveyId: number) => Promise<{
1018
- success: boolean;
1019
- message?: string;
1020
- surveyState: SurveyState;
1021
- }>;
1113
+ displaySurvey: (surveyId: number) => IdentifyResult;
1022
1114
  identifyAndSetAttributes: (payload: {
1023
1115
  anonymousId?: string;
1024
1116
  attributes?: SprigAttributes;
@@ -1130,6 +1222,7 @@ declare global {
1130
1222
  optimizely?: optimizely.Optimizely;
1131
1223
  optimizelyDatafile?: object;
1132
1224
  previewMode?: unknown;
1225
+ UpChunk: upchunk.UpChunkModule;
1133
1226
  _Sprig?: sprigConfig.WindowSprig;
1134
1227
  Sprig: sprigConfig.WindowSprig;
1135
1228
  UserLeap: sprigConfig.WindowSprig;
@@ -1165,7 +1258,8 @@ declare class SprigAPI {
1165
1258
  SURVEY_WILL_CLOSE: SprigEvent;
1166
1259
  SURVEY_WILL_PRESENT: SprigEvent;
1167
1260
  QUESTION_ANSWERED: SprigEvent;
1168
- CLOSE_SURVEY_ON_OVERLAY_CLICK: SprigEvent; /**
1261
+ CLOSE_SURVEY_ON_OVERLAY_CLICK: SprigEvent;
1262
+ /**
1169
1263
  * Attach an email address to visitor
1170
1264
  */
1171
1265
  VISITOR_ID_UPDATED: SprigEvent;