@sprig-technologies/sprig-browser 2.24.5 → 2.24.6
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.cjs +17 -36
- package/dist/index.d.ts +126 -33
- package/dist/index.js +4086 -7315
- package/package.json +1 -1
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;
|
|
@@ -856,6 +884,8 @@ interface Config {
|
|
|
856
884
|
/** @example "SJcVfq-7QQ" */
|
|
857
885
|
envId: string;
|
|
858
886
|
environmentId?: string;
|
|
887
|
+
exitOnOverlayClick?: boolean;
|
|
888
|
+
exitOnOverlayClickMobile?: boolean;
|
|
859
889
|
eventEmitFn: SprigEventEmitter["emit"];
|
|
860
890
|
fontFamily?: string;
|
|
861
891
|
fontFamilyURL: undefined;
|
|
@@ -891,6 +921,7 @@ interface Config {
|
|
|
891
921
|
maxAttrValueLength: number;
|
|
892
922
|
maxEmailLength: number;
|
|
893
923
|
maxEventLength: number;
|
|
924
|
+
maxReplayDurationSeconds?: number;
|
|
894
925
|
maxUserIdLength: number;
|
|
895
926
|
mobileSDKVersion: undefined;
|
|
896
927
|
mode?: string;
|
|
@@ -914,6 +945,7 @@ interface Config {
|
|
|
914
945
|
surveyId: number;
|
|
915
946
|
tabTitle: string;
|
|
916
947
|
ulEvents: typeof SprigEvent;
|
|
948
|
+
UpChunk: Window["UpChunk"];
|
|
917
949
|
useDesktopPrototype?: boolean;
|
|
918
950
|
useMobileStyling: boolean;
|
|
919
951
|
userId: UUID | null;
|
|
@@ -926,33 +958,34 @@ interface Config {
|
|
|
926
958
|
};
|
|
927
959
|
}
|
|
928
960
|
|
|
929
|
-
declare enum
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
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;
|
|
961
|
+
declare enum ReplayEventType {
|
|
962
|
+
Click = "Sprig_Click",
|
|
963
|
+
Event = "Sprig_TrackEvent",
|
|
964
|
+
PageView = "Sprig_PageView",
|
|
965
|
+
SurveyShown = "Sprig_ShowSurvey",
|
|
966
|
+
SurveySubmitted = "Sprig_SubmitSurvey",
|
|
967
|
+
Noop = "Sprig_Noop"
|
|
955
968
|
}
|
|
969
|
+
type EventDigest = {
|
|
970
|
+
timestamp: number;
|
|
971
|
+
type: ReplayEventType.Click;
|
|
972
|
+
} | {
|
|
973
|
+
timestamp: number;
|
|
974
|
+
name: string;
|
|
975
|
+
type: ReplayEventType.Event;
|
|
976
|
+
} | {
|
|
977
|
+
timestamp: number;
|
|
978
|
+
type: ReplayEventType.PageView;
|
|
979
|
+
url: string;
|
|
980
|
+
} | {
|
|
981
|
+
timestamp: number;
|
|
982
|
+
surveyId: string;
|
|
983
|
+
type: ReplayEventType.SurveyShown;
|
|
984
|
+
} | {
|
|
985
|
+
timestamp: number;
|
|
986
|
+
surveyId: string;
|
|
987
|
+
type: ReplayEventType.SurveySubmitted;
|
|
988
|
+
};
|
|
956
989
|
|
|
957
990
|
declare namespace optimizely {
|
|
958
991
|
interface Optimizely {
|
|
@@ -993,9 +1026,54 @@ declare namespace optimizely {
|
|
|
993
1026
|
}
|
|
994
1027
|
}
|
|
995
1028
|
|
|
1029
|
+
declare namespace upchunk {
|
|
1030
|
+
type AllowedMethods = "PUT" | "POST" | "PATCH";
|
|
1031
|
+
|
|
1032
|
+
//Adapted from here: https://github.com/muxinc/upchunk/blob/master/src/upchunk.ts
|
|
1033
|
+
interface UpChunkOptions {
|
|
1034
|
+
endpoint: string | ((file?: File) => Promise<string>);
|
|
1035
|
+
file: File;
|
|
1036
|
+
method?: AllowedMethods;
|
|
1037
|
+
headers?: Headers;
|
|
1038
|
+
maxFileSize?: number;
|
|
1039
|
+
chunkSize?: number;
|
|
1040
|
+
attempts?: number;
|
|
1041
|
+
delayBeforeAttempt?: number;
|
|
1042
|
+
retryCodes?: number[];
|
|
1043
|
+
dynamicChunkSize?: boolean;
|
|
1044
|
+
maxChunkSize?: number;
|
|
1045
|
+
minChunkSize?: number;
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
type UpChunkEventName =
|
|
1049
|
+
| "attempt"
|
|
1050
|
+
| "attemptFailure"
|
|
1051
|
+
| "chunkSuccess"
|
|
1052
|
+
| "error"
|
|
1053
|
+
| "offline"
|
|
1054
|
+
| "online"
|
|
1055
|
+
| "progress"
|
|
1056
|
+
| "success";
|
|
1057
|
+
|
|
1058
|
+
interface UpChunk {
|
|
1059
|
+
startTime: number;
|
|
1060
|
+
on: (eventName: UpChunkEventName, fn: (event: CustomEvent) => void) => void;
|
|
1061
|
+
}
|
|
1062
|
+
interface UpChunkModule {
|
|
1063
|
+
createUpload: (options: UpChunkOptions) => UpChunk;
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
|
|
996
1067
|
declare namespace sprigConfig {
|
|
997
1068
|
type IdentifyResult = Promise<
|
|
998
|
-
|
|
1069
|
+
| {
|
|
1070
|
+
success: boolean;
|
|
1071
|
+
message?: string;
|
|
1072
|
+
surveyState?: SurveyState;
|
|
1073
|
+
surveyId?: number;
|
|
1074
|
+
responseGroupUid?: string;
|
|
1075
|
+
}
|
|
1076
|
+
| undefined
|
|
999
1077
|
>;
|
|
1000
1078
|
|
|
1001
1079
|
interface TrackPayload {
|
|
@@ -1008,17 +1086,30 @@ declare namespace sprigConfig {
|
|
|
1008
1086
|
}
|
|
1009
1087
|
|
|
1010
1088
|
interface SprigAPIActions {
|
|
1089
|
+
// internal apis
|
|
1090
|
+
_completeSessionReplay: (payload: {
|
|
1091
|
+
surveyId: number;
|
|
1092
|
+
responseGroupUuid: string;
|
|
1093
|
+
eventDigest?: EventDigest[];
|
|
1094
|
+
}) => Promise<void>;
|
|
1095
|
+
_generateVideoUploadUrl: (body: {
|
|
1096
|
+
mediaRecordingUid?: string;
|
|
1097
|
+
mediaType?: MediaType;
|
|
1098
|
+
questionId?: number;
|
|
1099
|
+
responseGroupUid?: string;
|
|
1100
|
+
surveyId?: number;
|
|
1101
|
+
updatedAt?: string;
|
|
1102
|
+
visitorId?: string | null;
|
|
1103
|
+
}) => Promise<string | null>;
|
|
1011
1104
|
_previewSurvey: (surveyTemplateId: UUID) => void;
|
|
1012
1105
|
_reviewSurvey: (surveyId: number) => void;
|
|
1106
|
+
|
|
1107
|
+
// external apis
|
|
1013
1108
|
addListener: (event: SprigEvent, listener: SprigListener) => Promise<void>;
|
|
1014
1109
|
addSurveyListener: (listener: SprigListener) => Promise<void>;
|
|
1015
1110
|
applyStyles: (styleString: string) => void;
|
|
1016
1111
|
dismissActiveSurvey: (reason?: DismissReason) => void;
|
|
1017
|
-
displaySurvey: (surveyId: number) =>
|
|
1018
|
-
success: boolean;
|
|
1019
|
-
message?: string;
|
|
1020
|
-
surveyState: SurveyState;
|
|
1021
|
-
}>;
|
|
1112
|
+
displaySurvey: (surveyId: number) => IdentifyResult;
|
|
1022
1113
|
identifyAndSetAttributes: (payload: {
|
|
1023
1114
|
anonymousId?: string;
|
|
1024
1115
|
attributes?: SprigAttributes;
|
|
@@ -1130,6 +1221,7 @@ declare global {
|
|
|
1130
1221
|
optimizely?: optimizely.Optimizely;
|
|
1131
1222
|
optimizelyDatafile?: object;
|
|
1132
1223
|
previewMode?: unknown;
|
|
1224
|
+
UpChunk: upchunk.UpChunkModule;
|
|
1133
1225
|
_Sprig?: sprigConfig.WindowSprig;
|
|
1134
1226
|
Sprig: sprigConfig.WindowSprig;
|
|
1135
1227
|
UserLeap: sprigConfig.WindowSprig;
|
|
@@ -1165,7 +1257,8 @@ declare class SprigAPI {
|
|
|
1165
1257
|
SURVEY_WILL_CLOSE: SprigEvent;
|
|
1166
1258
|
SURVEY_WILL_PRESENT: SprigEvent;
|
|
1167
1259
|
QUESTION_ANSWERED: SprigEvent;
|
|
1168
|
-
CLOSE_SURVEY_ON_OVERLAY_CLICK: SprigEvent;
|
|
1260
|
+
CLOSE_SURVEY_ON_OVERLAY_CLICK: SprigEvent;
|
|
1261
|
+
/**
|
|
1169
1262
|
* Attach an email address to visitor
|
|
1170
1263
|
*/
|
|
1171
1264
|
VISITOR_ID_UPDATED: SprigEvent;
|