@sprig-technologies/sprig-browser 2.24.3 → 2.24.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.cjs +36 -17
- package/dist/index.d.ts +26 -57
- package/dist/index.js +7527 -4246
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -374,7 +374,7 @@ declare const enum CardType {
|
|
|
374
374
|
Uploading = "uploading",
|
|
375
375
|
VideoVoice = "videovoice"
|
|
376
376
|
}
|
|
377
|
-
|
|
377
|
+
type ConceptUrl = string | null;
|
|
378
378
|
interface BaseCard {
|
|
379
379
|
name: number;
|
|
380
380
|
surveyId: number;
|
|
@@ -398,28 +398,28 @@ declare const enum Comparator {
|
|
|
398
398
|
Contains = "contains",
|
|
399
399
|
DoesNotContain = "notcontains"
|
|
400
400
|
}
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
401
|
+
type DefaultComparator = Comparator.Answered | Comparator.Skipped;
|
|
402
|
+
type RoutingOption<C extends Comparator = DefaultComparator> = OldRoutingOption<C> | GroupRoutingOption;
|
|
403
|
+
type OldRoutingOption<C extends Comparator = DefaultComparator> = {
|
|
404
404
|
comparator: C;
|
|
405
405
|
target: number;
|
|
406
406
|
/** @example '', 'option_2', ['option_1'] */
|
|
407
407
|
value: number | string | string[];
|
|
408
408
|
};
|
|
409
|
-
|
|
409
|
+
type GroupRoutingOption = {
|
|
410
410
|
group: (RoutingGroupOption | BooleanOperator)[];
|
|
411
411
|
target: number;
|
|
412
412
|
};
|
|
413
|
-
|
|
413
|
+
type RoutingGroupOption = {
|
|
414
414
|
comparator: Comparator;
|
|
415
415
|
questionIndex: number;
|
|
416
416
|
value: number | string | string[] | {
|
|
417
417
|
skipped: true;
|
|
418
418
|
} | null | undefined;
|
|
419
419
|
};
|
|
420
|
-
|
|
420
|
+
type RoutingOptions<C extends Comparator = DefaultComparator> = RoutingOption<C | DefaultComparator>[] | null;
|
|
421
421
|
/** @example <p>Body</p> */
|
|
422
|
-
|
|
422
|
+
type RichTextBody = string;
|
|
423
423
|
declare const enum PromptActionType {
|
|
424
424
|
Continue = "CONTINUE",
|
|
425
425
|
External = "EXTERNAL"
|
|
@@ -514,7 +514,7 @@ interface CompleteTaskPage extends BaseTaskPage {
|
|
|
514
514
|
taskDetail: string;
|
|
515
515
|
type: RecordedTaskPageType.CompleteTask;
|
|
516
516
|
}
|
|
517
|
-
|
|
517
|
+
type RecordedTaskPage = PermissionTaskPage | ScreenTaskPage | StartTaskPage | CompleteTaskPage;
|
|
518
518
|
interface RecordedTaskCardProperties {
|
|
519
519
|
captionText: string;
|
|
520
520
|
conceptUrl: ConceptUrl;
|
|
@@ -659,7 +659,7 @@ interface VideoVoiceCard extends BaseCard {
|
|
|
659
659
|
};
|
|
660
660
|
type: CardType.VideoVoice;
|
|
661
661
|
}
|
|
662
|
-
|
|
662
|
+
type Card = TextUrlPromptCard | ConsentLegalCard | RecordedTaskCard | LikertCard | OpenTextCard | MultipleChoiceSingleSelectCard | MultipleChoiceMultiSelectCard | NPSCard | VideoVoiceCard;
|
|
663
663
|
|
|
664
664
|
interface RecordedTaskResponseType {
|
|
665
665
|
questionId: number;
|
|
@@ -667,7 +667,7 @@ interface RecordedTaskResponseType {
|
|
|
667
667
|
value: RecordedTaskResponseValueType;
|
|
668
668
|
}
|
|
669
669
|
|
|
670
|
-
|
|
670
|
+
type SprigEventMap = {
|
|
671
671
|
[InternalEventName.CurrentQuestion]: [
|
|
672
672
|
{
|
|
673
673
|
[InternalEventData.QuestionId]: number;
|
|
@@ -774,9 +774,9 @@ declare type SprigEventMap = {
|
|
|
774
774
|
[SprigRecordingEvent.StartTask]: [];
|
|
775
775
|
};
|
|
776
776
|
declare const eventEmitter: Emitter<SprigEventMap>;
|
|
777
|
-
|
|
777
|
+
type SprigEventEmitter = typeof eventEmitter;
|
|
778
778
|
|
|
779
|
-
|
|
779
|
+
type MatchType = "exactly" | "legacy";
|
|
780
780
|
interface InteractiveEvent {
|
|
781
781
|
id: number;
|
|
782
782
|
matchType: MatchType;
|
|
@@ -914,7 +914,6 @@ interface Config {
|
|
|
914
914
|
surveyId: number;
|
|
915
915
|
tabTitle: string;
|
|
916
916
|
ulEvents: typeof SprigEvent;
|
|
917
|
-
UpChunk: Window["UpChunk"];
|
|
918
917
|
useDesktopPrototype?: boolean;
|
|
919
918
|
useMobileStyling: boolean;
|
|
920
919
|
userId: UUID | null;
|
|
@@ -937,7 +936,7 @@ interface Experiment {
|
|
|
937
936
|
variation?: string;
|
|
938
937
|
}
|
|
939
938
|
|
|
940
|
-
|
|
939
|
+
type QueueItem = [string, ...unknown[]] | (() => void);
|
|
941
940
|
declare class SprigQueue {
|
|
942
941
|
paused: boolean;
|
|
943
942
|
queue: QueueItem[];
|
|
@@ -994,44 +993,6 @@ declare namespace optimizely {
|
|
|
994
993
|
}
|
|
995
994
|
}
|
|
996
995
|
|
|
997
|
-
declare namespace upchunk {
|
|
998
|
-
type AllowedMethods = "PUT" | "POST" | "PATCH";
|
|
999
|
-
|
|
1000
|
-
//Adapted from here: https://github.com/muxinc/upchunk/blob/master/src/upchunk.ts
|
|
1001
|
-
interface UpChunkOptions {
|
|
1002
|
-
endpoint: string | ((file?: File) => Promise<string>);
|
|
1003
|
-
file: File;
|
|
1004
|
-
method?: AllowedMethods;
|
|
1005
|
-
headers?: Headers;
|
|
1006
|
-
maxFileSize?: number;
|
|
1007
|
-
chunkSize?: number;
|
|
1008
|
-
attempts?: number;
|
|
1009
|
-
delayBeforeAttempt?: number;
|
|
1010
|
-
retryCodes?: number[];
|
|
1011
|
-
dynamicChunkSize?: boolean;
|
|
1012
|
-
maxChunkSize?: number;
|
|
1013
|
-
minChunkSize?: number;
|
|
1014
|
-
}
|
|
1015
|
-
|
|
1016
|
-
type UpChunkEventName =
|
|
1017
|
-
| "attempt"
|
|
1018
|
-
| "attemptFailure"
|
|
1019
|
-
| "chunkSuccess"
|
|
1020
|
-
| "error"
|
|
1021
|
-
| "offline"
|
|
1022
|
-
| "online"
|
|
1023
|
-
| "progress"
|
|
1024
|
-
| "success";
|
|
1025
|
-
|
|
1026
|
-
interface UpChunk {
|
|
1027
|
-
startTime: number;
|
|
1028
|
-
on: (eventName: UpChunkEventName, fn: (event: CustomEvent) => void) => void;
|
|
1029
|
-
}
|
|
1030
|
-
interface UpChunkModule {
|
|
1031
|
-
createUpload: (options: UpChunkOptions) => UpChunk;
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
|
-
|
|
1035
996
|
declare namespace sprigConfig {
|
|
1036
997
|
type IdentifyResult = Promise<
|
|
1037
998
|
{ success: boolean; message?: string } | undefined
|
|
@@ -1106,6 +1067,11 @@ declare namespace sprigConfig {
|
|
|
1106
1067
|
metadata?: SprigMetadata,
|
|
1107
1068
|
showSurveyCallback?: (surveyId?: number) => Promise<boolean>
|
|
1108
1069
|
) => IdentifyResult;
|
|
1070
|
+
trackPageView: (
|
|
1071
|
+
url: string,
|
|
1072
|
+
properties?: SprigProperties,
|
|
1073
|
+
showSurveyCallback?: (surveyId?: number) => Promise<boolean>
|
|
1074
|
+
) => void;
|
|
1109
1075
|
unmute: () => void;
|
|
1110
1076
|
}
|
|
1111
1077
|
|
|
@@ -1142,7 +1108,7 @@ declare namespace sprigConfig {
|
|
|
1142
1108
|
partnerAnonymousId: string | null;
|
|
1143
1109
|
replayNonce?: string;
|
|
1144
1110
|
reportError: (name: string, err: Error, extraInfo?: object) => void;
|
|
1145
|
-
sampleRate?:
|
|
1111
|
+
sampleRate?: number;
|
|
1146
1112
|
token: string | null;
|
|
1147
1113
|
UPDATES: typeof EVENTS;
|
|
1148
1114
|
viewSDKURL?: string;
|
|
@@ -1164,7 +1130,6 @@ declare global {
|
|
|
1164
1130
|
optimizely?: optimizely.Optimizely;
|
|
1165
1131
|
optimizelyDatafile?: object;
|
|
1166
1132
|
previewMode?: unknown;
|
|
1167
|
-
UpChunk: upchunk.UpChunkModule;
|
|
1168
1133
|
_Sprig?: sprigConfig.WindowSprig;
|
|
1169
1134
|
Sprig: sprigConfig.WindowSprig;
|
|
1170
1135
|
UserLeap: sprigConfig.WindowSprig;
|
|
@@ -1289,6 +1254,10 @@ declare class SprigAPI {
|
|
|
1289
1254
|
metadata?: SprigMetadata;
|
|
1290
1255
|
userId?: string;
|
|
1291
1256
|
}): void;
|
|
1257
|
+
/**
|
|
1258
|
+
* Tracks a page view with the provided URL and additional event properties.
|
|
1259
|
+
*/
|
|
1260
|
+
trackPageView(url: string, props?: SprigProperties, showSurveyCallback?: (surveyId?: number) => Promise<boolean>): void;
|
|
1292
1261
|
/**
|
|
1293
1262
|
* Apply a css string representing the customized styles
|
|
1294
1263
|
*/
|
|
@@ -1306,7 +1275,7 @@ declare class SprigAPI {
|
|
|
1306
1275
|
*/
|
|
1307
1276
|
teardown(): void;
|
|
1308
1277
|
}
|
|
1309
|
-
|
|
1278
|
+
type NpmConfig = {
|
|
1310
1279
|
envId?: string;
|
|
1311
1280
|
environmentId?: string;
|
|
1312
1281
|
path?: string;
|
|
@@ -1319,7 +1288,7 @@ declare const sprig: {
|
|
|
1319
1288
|
*/
|
|
1320
1289
|
configure: (config: NpmConfig) => sprigConfig.WindowSprig;
|
|
1321
1290
|
};
|
|
1322
|
-
|
|
1291
|
+
type WindowSprig$1 = typeof window.Sprig;
|
|
1323
1292
|
|
|
1324
1293
|
declare const _default: {
|
|
1325
1294
|
sprig: {
|