@sprig-technologies/sprig-browser 2.19.7 → 2.20.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.cjs +687 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +6580 -0
- package/dist/index.js.map +1 -0
- package/dist/sprig-browser/index.d.ts +168 -0
- package/dist/src/constants/css.d.ts +43 -0
- package/dist/src/constants/sprigEvents.d.ts +62 -0
- package/dist/src/constants/sprigRecordingEvents.d.ts +40 -0
- package/dist/src/controller/OptimizelyIntegration.d.ts +40 -0
- package/dist/src/controller/Queue.d.ts +18 -0
- package/dist/src/controller/controller.d.ts +9 -0
- package/dist/src/controller/iframe.d.ts +17 -0
- package/dist/src/helpers/Deferred.d.ts +9 -0
- package/dist/src/helpers/conflicting_widgets/index.d.ts +4 -0
- package/dist/src/helpers/conflicting_widgets/intercom.d.ts +2 -0
- package/dist/src/helpers/document.d.ts +6 -0
- package/dist/src/helpers/eventEmitter.d.ts +85 -0
- package/dist/src/helpers/general.d.ts +9 -0
- package/dist/src/helpers/network.d.ts +15 -0
- package/dist/src/types/card.d.ts +292 -0
- package/dist/src/types/config.d.ts +232 -0
- package/dist/src/types/event.d.ts +18 -0
- package/dist/src/types/global.d.ts +179 -0
- package/dist/src/view/app.d.ts +3 -0
- package/dist/src/view/cards/consentLegalCard.d.ts +6 -0
- package/dist/src/view/cards/index.d.ts +10 -0
- package/dist/src/view/cards/likertCard/index.d.ts +1 -0
- package/dist/src/view/cards/likertCard/likertCard.d.ts +6 -0
- package/dist/src/view/cards/likertCard/likertOption.d.ts +16 -0
- package/dist/src/view/cards/multipleChoice/baseMultiChoiceCard.d.ts +15 -0
- package/dist/src/view/cards/multipleChoice/index.d.ts +2 -0
- package/dist/src/view/cards/multipleChoice/multiSelectCard.d.ts +5 -0
- package/dist/src/view/cards/multipleChoice/singleSelectCard.d.ts +5 -0
- package/dist/src/view/cards/npsCard.d.ts +8 -0
- package/dist/src/view/cards/openTextCard.d.ts +6 -0
- package/dist/src/view/cards/recordedTask/actions.d.ts +21 -0
- package/dist/src/view/cards/recordedTask/card.d.ts +5 -0
- package/dist/src/view/cards/recordedTask/components.d.ts +37 -0
- package/dist/src/view/cards/recordedTask/constants.d.ts +5 -0
- package/dist/src/view/cards/recordedTask/helpers.d.ts +6 -0
- package/dist/src/view/cards/recordedTask/index.d.ts +1 -0
- package/dist/src/view/cards/recordedTask/store.d.ts +24 -0
- package/dist/src/view/cards/textUrlPromptCard.d.ts +6 -0
- package/dist/src/view/cards/thanksCard.d.ts +5 -0
- package/dist/src/view/cards/types.d.ts +34 -0
- package/dist/src/view/cards/uploadingCard.d.ts +5 -0
- package/dist/src/view/cards/videoVoiceCard.d.ts +6 -0
- package/dist/src/view/components/header.d.ts +8 -0
- package/dist/src/view/components/index.d.ts +3 -0
- package/dist/src/view/components/mobileEmbedView.d.ts +19 -0
- package/dist/src/view/components/select.d.ts +25 -0
- package/dist/src/view/footer.d.ts +2 -0
- package/dist/src/view/helpers/card.d.ts +6 -0
- package/dist/src/view/helpers/getAttributedUrl.d.ts +6 -0
- package/dist/src/view/helpers/skipLogicHelpers.d.ts +34 -0
- package/dist/src/view/hooks/index.d.ts +1 -0
- package/dist/src/view/hooks/useAutoSize.d.ts +2 -0
- package/dist/src/view/logo.d.ts +5 -0
- package/dist/src/view/recorder/recorder.d.ts +2 -0
- package/dist/src/view/store.d.ts +2 -0
- package/dist/src/view/view.d.ts +6 -0
- package/dist/style.css +1 -0
- package/package.json +12 -10
- package/LICENSE.md +0 -176
- package/index.d.ts +0 -160
- package/index.js +0 -680
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { InstallationMethod } from "../src/types/config";
|
|
2
|
+
export declare class SprigAPI {
|
|
3
|
+
/**
|
|
4
|
+
* include external events emitted from Sprig
|
|
5
|
+
*/
|
|
6
|
+
UPDATES: {
|
|
7
|
+
SDK_READY: import("../src/constants/sprigEvents").SprigEvent;
|
|
8
|
+
SURVEY_APPEARED: import("../src/constants/sprigEvents").SprigEvent;
|
|
9
|
+
SURVEY_CLOSED: import("../src/constants/sprigEvents").SprigEvent;
|
|
10
|
+
SURVEY_DIMENSIONS: import("../src/constants/sprigEvents").SprigEvent;
|
|
11
|
+
SURVEY_FADING_OUT: import("../src/constants/sprigEvents").SprigEvent;
|
|
12
|
+
SURVEY_HEIGHT: import("../src/constants/sprigEvents").SprigEvent;
|
|
13
|
+
SURVEY_PRESENTED: import("../src/constants/sprigEvents").SprigEvent;
|
|
14
|
+
SURVEY_LIFE_CYCLE: import("../src/constants/sprigEvents").SprigEvent;
|
|
15
|
+
SURVEY_WILL_CLOSE: import("../src/constants/sprigEvents").SprigEvent;
|
|
16
|
+
SURVEY_WILL_PRESENT: import("../src/constants/sprigEvents").SprigEvent;
|
|
17
|
+
CLOSE_SURVEY_ON_OVERLAY_CLICK: import("../src/constants/sprigEvents").SprigEvent;
|
|
18
|
+
VISITOR_ID_UPDATED: import("../src/constants/sprigEvents").SprigEvent;
|
|
19
|
+
DATA: {
|
|
20
|
+
DISMISS_REASONS: {
|
|
21
|
+
API: import("../src/constants/sprigEvents").DismissReason;
|
|
22
|
+
CLOSED: import("../src/constants/sprigEvents").DismissReason;
|
|
23
|
+
/**
|
|
24
|
+
* Remove all listeners set on Sprig
|
|
25
|
+
*/
|
|
26
|
+
COMPLETE: import("../src/constants/sprigEvents").DismissReason;
|
|
27
|
+
PAGE_CHANGE: import("../src/constants/sprigEvents").DismissReason;
|
|
28
|
+
OVERRIDE: import("../src/constants/sprigEvents").DismissReason;
|
|
29
|
+
};
|
|
30
|
+
SURVEY_ID: import("../src/constants/sprigEvents").SprigEventData;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Triggers displaying specified survey. Does submit answers!
|
|
35
|
+
* @returns
|
|
36
|
+
*/
|
|
37
|
+
displaySurvey(surveyId: number): void;
|
|
38
|
+
/**
|
|
39
|
+
* Triggers displaying specified survey template. Does not submit answers
|
|
40
|
+
*/
|
|
41
|
+
previewSurvey(surveyTemplateId: string): void;
|
|
42
|
+
/**
|
|
43
|
+
* Triggers displaying specified survey. Does not submit answers
|
|
44
|
+
*/
|
|
45
|
+
reviewSurvey(surveyId: number): void;
|
|
46
|
+
/**
|
|
47
|
+
* pauses api interactions
|
|
48
|
+
*/
|
|
49
|
+
mute(): void;
|
|
50
|
+
/**
|
|
51
|
+
* restart api interactions
|
|
52
|
+
*/
|
|
53
|
+
unmute(): void;
|
|
54
|
+
/**
|
|
55
|
+
* Manually dismiss an opened survey
|
|
56
|
+
*/
|
|
57
|
+
dismissActiveSurvey(): void;
|
|
58
|
+
/**
|
|
59
|
+
* Set an arbitrary attribute on the visitor
|
|
60
|
+
*/
|
|
61
|
+
setAttribute(attribute: string, value: string): void;
|
|
62
|
+
/**
|
|
63
|
+
* Set attributes on visitor
|
|
64
|
+
*/
|
|
65
|
+
setAttributes(attributes: SprigAttributes): void;
|
|
66
|
+
/**
|
|
67
|
+
* Set identifiers and attributes on visitor
|
|
68
|
+
*/
|
|
69
|
+
identifyAndSetAttributes(payload: {
|
|
70
|
+
anonymousID?: string;
|
|
71
|
+
attributes: SprigAttributes;
|
|
72
|
+
userID?: string;
|
|
73
|
+
}): void;
|
|
74
|
+
/**
|
|
75
|
+
* Remove attributes on visitor
|
|
76
|
+
*/
|
|
77
|
+
removeAttributes(attributes: SprigAttributes): void;
|
|
78
|
+
/**
|
|
79
|
+
* Add a listener for an event defined in ulEvents
|
|
80
|
+
*/
|
|
81
|
+
addListener(event: string, listener: SprigListener): void;
|
|
82
|
+
/**
|
|
83
|
+
* Remove a listener for an event defined in ulEvents
|
|
84
|
+
*/
|
|
85
|
+
removeListener(event: string, listener: SprigListener): void;
|
|
86
|
+
/**
|
|
87
|
+
* Remove all listeners set on Sprig
|
|
88
|
+
*/
|
|
89
|
+
removeAllListeners(): void;
|
|
90
|
+
/**
|
|
91
|
+
* Attach an email address to visitor
|
|
92
|
+
*/
|
|
93
|
+
setEmail(email: string): void;
|
|
94
|
+
/**
|
|
95
|
+
* Attach a user id to the visitor
|
|
96
|
+
*/
|
|
97
|
+
setUserId(userId: string): void;
|
|
98
|
+
/**
|
|
99
|
+
* Set a partner anonymous id for future requests.
|
|
100
|
+
*/
|
|
101
|
+
setPartnerAnonymousId(partnerAnonymousId: string): void;
|
|
102
|
+
/**
|
|
103
|
+
* track an event to show survey if eligible
|
|
104
|
+
* @param eventName name of event to track
|
|
105
|
+
* @param properties event properties (optional)
|
|
106
|
+
* @param metadata event metadata (optional)
|
|
107
|
+
* @returns
|
|
108
|
+
*/
|
|
109
|
+
track(eventName: string, properties?: Record<string, unknown>, metadata?: SprigMetadata): void;
|
|
110
|
+
/**
|
|
111
|
+
* optionally set userId and/or anonymousId, track an event to show survey if eligible
|
|
112
|
+
* @param payload
|
|
113
|
+
* @param payload.anonymousId anonymousId (optional)
|
|
114
|
+
* @param payload.eventName name of event to track
|
|
115
|
+
* @param payload.metadata event metadata (optional)
|
|
116
|
+
* @param payload.userId userId (optional)
|
|
117
|
+
* @returns
|
|
118
|
+
*/
|
|
119
|
+
identifyAndTrack(payload: {
|
|
120
|
+
anonymousId?: string;
|
|
121
|
+
eventName: string;
|
|
122
|
+
metadata?: SprigMetadata;
|
|
123
|
+
userId?: string;
|
|
124
|
+
}): void;
|
|
125
|
+
/**
|
|
126
|
+
* @param styleString css string representing the customized styles
|
|
127
|
+
*/
|
|
128
|
+
applyStyles(styleString: string): void;
|
|
129
|
+
/**
|
|
130
|
+
Set viewport dimensions, in int pixels. necessary if Sprig is installed in an iframe/component defaulting to 0 width and height.
|
|
131
|
+
*/
|
|
132
|
+
setWindowDimensions(width: number, height: number): void;
|
|
133
|
+
/**
|
|
134
|
+
* logs out current visitor and associated ids
|
|
135
|
+
*/
|
|
136
|
+
logoutUser(): void;
|
|
137
|
+
/**
|
|
138
|
+
* clears Sprig from window
|
|
139
|
+
*/
|
|
140
|
+
teardown(): void;
|
|
141
|
+
}
|
|
142
|
+
declare type NpmConfig = {
|
|
143
|
+
envId?: string;
|
|
144
|
+
environmentId?: string;
|
|
145
|
+
installationMethod?: InstallationMethod;
|
|
146
|
+
path?: string;
|
|
147
|
+
} & Partial<WindowSprig>;
|
|
148
|
+
export declare const sprig: {
|
|
149
|
+
/**
|
|
150
|
+
* Sets up the sprig api and load the sprig sdk on document load
|
|
151
|
+
* @param config
|
|
152
|
+
* @returns an instance of the sprig api
|
|
153
|
+
*/
|
|
154
|
+
configure: (config: NpmConfig) => import("../src/types/global").WindowSprig;
|
|
155
|
+
};
|
|
156
|
+
declare const _default: {
|
|
157
|
+
sprig: {
|
|
158
|
+
/**
|
|
159
|
+
* Sets up the sprig api and load the sprig sdk on document load
|
|
160
|
+
* @param config
|
|
161
|
+
* @returns an instance of the sprig api
|
|
162
|
+
*/
|
|
163
|
+
configure: (config: NpmConfig) => import("../src/types/global").WindowSprig;
|
|
164
|
+
};
|
|
165
|
+
SprigAPI: typeof SprigAPI;
|
|
166
|
+
configure: (config: NpmConfig) => import("../src/types/global").WindowSprig;
|
|
167
|
+
};
|
|
168
|
+
export default _default;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare const APP_ID = "ul-app";
|
|
2
|
+
export declare const enum CssConstant {
|
|
3
|
+
Caption = "ul-caption",
|
|
4
|
+
CardContainer = "ul-card__container",
|
|
5
|
+
CardMainContent = "ul-card-main-content",
|
|
6
|
+
Choice = "choice",
|
|
7
|
+
ChoiceCheckbox = "select-checkbox",
|
|
8
|
+
ChoiceGroup = "ul-card__choices",
|
|
9
|
+
ChoiceLabel = "select-label",
|
|
10
|
+
ChoiceLabelContainer = "choice-label-container",
|
|
11
|
+
ChoiceRadio = "select-radio",
|
|
12
|
+
ChoiceTextEntryContainer = "choice-text-entry-container",
|
|
13
|
+
ChoiceTextInput = "choice-text-input",
|
|
14
|
+
CloseButton = "close-btn",
|
|
15
|
+
CloseContainer = "close-container",
|
|
16
|
+
ConsentLegalNameInput = "ul-consent-legal__name-input",
|
|
17
|
+
CustomStyle = "ul-custom-style",
|
|
18
|
+
DesktopSuffix = "--desktop",
|
|
19
|
+
FadeInTransition = "fade-in-transition",
|
|
20
|
+
LikertNumber = "likert-number",
|
|
21
|
+
LikertSmiley = "likert-smiley",
|
|
22
|
+
LikertStar = "likert-star",
|
|
23
|
+
LoadingSpinner = "ul-loading-spinner",
|
|
24
|
+
LoadingSpinnerContainer = "ul-loading-spinner-container",
|
|
25
|
+
LoadingSpinnerFirst = "first",
|
|
26
|
+
LoadingSpinnerFourth = "fourth",
|
|
27
|
+
LoadingSpinnerSecond = "second",
|
|
28
|
+
LoadingSpinnerThird = "third",
|
|
29
|
+
MobileSuffix = "--mobile",
|
|
30
|
+
NPSNumber = "nps-number",
|
|
31
|
+
OpenTextInput = "ul-card-text__input",
|
|
32
|
+
QuestionHeader = "ul-question",
|
|
33
|
+
VideoCard = "ul-card--video",
|
|
34
|
+
CheckmarkButton = "ul-button-checkmark",
|
|
35
|
+
InactiveButton = "ul-button-inactive",
|
|
36
|
+
LeftAlignButton = "ul-button-left-align",
|
|
37
|
+
SubmitButtonDisabled = "submit-button-disabled"
|
|
38
|
+
}
|
|
39
|
+
export declare const DEFAULT_BORDER_COLOR = "#e6e6e6";
|
|
40
|
+
export declare const DEFAULT_TRANSPARENT_COLOR = "#ffffff";
|
|
41
|
+
export declare const ERROR_BORDER_COLOR = "#bd282a";
|
|
42
|
+
export declare const MOBILE_MAX_WIDTH = 500;
|
|
43
|
+
export declare const EMBED_MOBILE_MAX_WIDTH = 1030;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export declare const enum DismissReason {
|
|
2
|
+
Closed = "close.click",
|
|
3
|
+
Complete = "survey.completed",
|
|
4
|
+
PageChange = "page.change",
|
|
5
|
+
API = "api",
|
|
6
|
+
Override = "override"
|
|
7
|
+
}
|
|
8
|
+
export declare enum SprigEvent {
|
|
9
|
+
SDKReady = "sdk.ready",
|
|
10
|
+
SurveyAppeared = "survey.appeared",
|
|
11
|
+
SurveyClosed = "survey.closed",
|
|
12
|
+
SurveyDimensions = "survey.dimensions",
|
|
13
|
+
SurveyFadingOut = "survey.fadingOut",
|
|
14
|
+
SurveyHeight = "survey.height",
|
|
15
|
+
SurveyPresented = "survey.presented",
|
|
16
|
+
SurveyLifeCycle = "survey.lifeCycle",
|
|
17
|
+
SurveyWillClose = "survey.willClose",
|
|
18
|
+
SurveyWillPresent = "survey.will.present",
|
|
19
|
+
CloseSurveyOnOverlayClick = "close.survey.overlayClick",
|
|
20
|
+
VisitorIDUpdated = "visitor.id.updated"
|
|
21
|
+
}
|
|
22
|
+
export declare const enum SprigEventData {
|
|
23
|
+
SurveyId = "survey.id"
|
|
24
|
+
}
|
|
25
|
+
export declare const EVENTS: {
|
|
26
|
+
SDK_READY: SprigEvent;
|
|
27
|
+
SURVEY_APPEARED: SprigEvent;
|
|
28
|
+
SURVEY_CLOSED: SprigEvent;
|
|
29
|
+
SURVEY_DIMENSIONS: SprigEvent;
|
|
30
|
+
SURVEY_FADING_OUT: SprigEvent;
|
|
31
|
+
SURVEY_HEIGHT: SprigEvent;
|
|
32
|
+
SURVEY_PRESENTED: SprigEvent;
|
|
33
|
+
SURVEY_LIFE_CYCLE: SprigEvent;
|
|
34
|
+
SURVEY_WILL_CLOSE: SprigEvent;
|
|
35
|
+
SURVEY_WILL_PRESENT: SprigEvent;
|
|
36
|
+
CLOSE_SURVEY_ON_OVERLAY_CLICK: SprigEvent;
|
|
37
|
+
VISITOR_ID_UPDATED: SprigEvent;
|
|
38
|
+
DATA: {
|
|
39
|
+
DISMISS_REASONS: {
|
|
40
|
+
API: DismissReason;
|
|
41
|
+
CLOSED: DismissReason;
|
|
42
|
+
COMPLETE: DismissReason;
|
|
43
|
+
PAGE_CHANGE: DismissReason;
|
|
44
|
+
OVERRIDE: DismissReason;
|
|
45
|
+
};
|
|
46
|
+
SURVEY_ID: SprigEventData;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export declare const enum InternalEventName {
|
|
50
|
+
VerifyViewVersion = "verify.view.version",
|
|
51
|
+
CurrentQuestion = "survey.question",
|
|
52
|
+
ViewPrototypeClick = "question.prototype.click",
|
|
53
|
+
ViewAgreementClick = "question.agreement.click",
|
|
54
|
+
RecordedTaskStart = "recorded.task.start",
|
|
55
|
+
RecordedTaskPermissionScreen = "recorded.task.permission.screen",
|
|
56
|
+
SurveyComplete = "survey.complete"
|
|
57
|
+
}
|
|
58
|
+
export declare const enum InternalEventData {
|
|
59
|
+
ViewVersion = "view.version",
|
|
60
|
+
QuestionId = "qid",
|
|
61
|
+
Props = "props"
|
|
62
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const enum MediaType {
|
|
2
|
+
Video = "video",
|
|
3
|
+
Audio = "audio",
|
|
4
|
+
Screen = "screen"
|
|
5
|
+
}
|
|
6
|
+
export declare const enum SprigRecordingEvent {
|
|
7
|
+
PermissionStatus = "permission.status",
|
|
8
|
+
AvPermission = "av.permission",
|
|
9
|
+
ScreenPermission = "screen.permission",
|
|
10
|
+
BeginRecording = "begin.recording",
|
|
11
|
+
StartTask = "start.task",
|
|
12
|
+
FinishTask = "finish.task"
|
|
13
|
+
}
|
|
14
|
+
export declare const enum TaskStatus {
|
|
15
|
+
Abandoned = "abandoned",
|
|
16
|
+
GivenUp = "given.up",
|
|
17
|
+
Completed = "completed"
|
|
18
|
+
}
|
|
19
|
+
export declare const enum SprigRecordingEventData {
|
|
20
|
+
PermissionDescriptors = "permission.descriptors",
|
|
21
|
+
PermissionStatusCallback = "permission.status.callback",
|
|
22
|
+
StreamReadyCallback = "stream.ready.callback",
|
|
23
|
+
StreamCanceledCallback = "stream.canceled.callback",
|
|
24
|
+
TaskCompleteCallback = "task.complete.callback",
|
|
25
|
+
TaskResponse = "task.response",
|
|
26
|
+
TaskStatus = "task.status",
|
|
27
|
+
RecordingMediaTypes = "recording.media.types",
|
|
28
|
+
StartRecordingCallback = "start.recording.callback",
|
|
29
|
+
PassthroughData = "passthrough.data",
|
|
30
|
+
CurrentIndex = "current.index",
|
|
31
|
+
UploadCallback = "upload.callback",
|
|
32
|
+
ProgressCallback = "progress.callback",
|
|
33
|
+
BeginCallback = "begin.callback"
|
|
34
|
+
}
|
|
35
|
+
export interface PassthroughData {
|
|
36
|
+
questionId: number;
|
|
37
|
+
surveyId: number;
|
|
38
|
+
visitorId: string | null;
|
|
39
|
+
responseGroupUid: UUID;
|
|
40
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const OPTIMIZELY_EVENT_PREFIX = "!optimizely_experiments_";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param state the object returned from optimizely getExperimentStates
|
|
5
|
+
* @returns simplified object with experiment id to variation name pairing
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export declare const extractExperimentState: (state: Record<string, {
|
|
9
|
+
variation: {
|
|
10
|
+
name: string;
|
|
11
|
+
};
|
|
12
|
+
}>) => Record<string, string>;
|
|
13
|
+
interface Experiment {
|
|
14
|
+
id: string;
|
|
15
|
+
variation?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare class OptimizelyIntegration {
|
|
18
|
+
_optimizelyData: Record<string, string>;
|
|
19
|
+
/**
|
|
20
|
+
* @param data object containing experimentIds as keys and variation name as the value
|
|
21
|
+
* @example { environments: [ { id: 1, variation: 'Variation 1' } ] }
|
|
22
|
+
* @returns boolean if set action was successful
|
|
23
|
+
*/
|
|
24
|
+
setOptimizelyExperiment(data: {
|
|
25
|
+
experiments: Experiment[];
|
|
26
|
+
}): boolean;
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @returns all active experiments to variation
|
|
30
|
+
*/
|
|
31
|
+
getAllOptimizelyExperiments(): Record<string, string>;
|
|
32
|
+
/**
|
|
33
|
+
* @returns the variation name associated to the experimentId the current user is bucketed in.
|
|
34
|
+
*/
|
|
35
|
+
getOptimizelyVariationName(experimentId: string): string;
|
|
36
|
+
transformExperimentId(experimentId: string): string;
|
|
37
|
+
getAndSetWebOptimizelyExperiments(): boolean;
|
|
38
|
+
}
|
|
39
|
+
declare const optimizely: OptimizelyIntegration;
|
|
40
|
+
export default optimizely;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare type QueueItem = string[] | (() => void);
|
|
2
|
+
declare class SprigQueue {
|
|
3
|
+
paused: boolean;
|
|
4
|
+
queue: QueueItem[];
|
|
5
|
+
ul: WindowSprig;
|
|
6
|
+
constructor(ul: WindowSprig, queue: QueueItem[]);
|
|
7
|
+
flush(queue: QueueItem[]): void;
|
|
8
|
+
isPaused(): boolean;
|
|
9
|
+
pause(): void;
|
|
10
|
+
unpause(): void;
|
|
11
|
+
push(action: string[] | (() => void)): void;
|
|
12
|
+
perform(func: () => void): void | Promise<unknown>;
|
|
13
|
+
/**
|
|
14
|
+
* Removes all queued items
|
|
15
|
+
*/
|
|
16
|
+
empty(): void;
|
|
17
|
+
}
|
|
18
|
+
export default SprigQueue;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Config } from "../types/config";
|
|
2
|
+
/**
|
|
3
|
+
* Initialize frame and bootstrap data
|
|
4
|
+
* @param config this is included in the compilation step (points to the default viewSDKURL)
|
|
5
|
+
* @param config.envId Environment Id
|
|
6
|
+
* @param config.path Frame script url
|
|
7
|
+
* @param [config.border] Border color
|
|
8
|
+
*/
|
|
9
|
+
export default function sprigInitializer(config?: Partial<Config>): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ProductConfig } from "../types/config";
|
|
2
|
+
export declare const createContainer: () => void;
|
|
3
|
+
export declare const removeContainer: (initiator?: unknown) => void;
|
|
4
|
+
export declare const removeContainerOnClose: () => void;
|
|
5
|
+
/**
|
|
6
|
+
* Create iframe
|
|
7
|
+
*/
|
|
8
|
+
export declare const createFrame: (productConfig: ProductConfig, useMobileStyling: boolean) => {
|
|
9
|
+
frameId: string;
|
|
10
|
+
contentWinDocHead: HTMLHeadElement | undefined;
|
|
11
|
+
contentWindow: Window | null;
|
|
12
|
+
hasOverlay: boolean;
|
|
13
|
+
iframe: HTMLIFrameElement & {
|
|
14
|
+
eventEmitter?: import("../helpers/eventEmitter").SprigEventEmitter | undefined;
|
|
15
|
+
setHeight?: ((height: number) => void) | undefined;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const isTargetElement: (element: EventTarget | null) => element is HTMLElement;
|
|
2
|
+
export declare const isTargetInputElement: (element: EventTarget | null) => element is HTMLInputElement;
|
|
3
|
+
export declare const isTargetTextAreaElement: (element: EventTarget | null) => element is HTMLTextAreaElement;
|
|
4
|
+
export declare const overrideStyles: (document: Document, styleString: string, nonce?: string) => void;
|
|
5
|
+
export declare const calculateFrameHeight: (document: Document) => number;
|
|
6
|
+
export declare const resetScrollPosition: (document: Document) => void;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { StrictEventEmitter } from "strict-event-emitter";
|
|
2
|
+
import { SprigEvent, InternalEventName, InternalEventData, DismissReason } from "../constants/sprigEvents";
|
|
3
|
+
import { MediaType, PassthroughData, SprigRecordingEvent, SprigRecordingEventData } from "../constants/sprigRecordingEvents";
|
|
4
|
+
import { AvPermission } from "../types/card";
|
|
5
|
+
import { RecordedTaskResponseType } from "../view/cards/recordedTask/store";
|
|
6
|
+
interface SprigEventMap {
|
|
7
|
+
[InternalEventName.CurrentQuestion]: (data: {
|
|
8
|
+
[InternalEventData.QuestionId]: number;
|
|
9
|
+
[InternalEventData.Props]: unknown;
|
|
10
|
+
}) => void;
|
|
11
|
+
[InternalEventName.RecordedTaskPermissionScreen]: () => void;
|
|
12
|
+
[InternalEventName.RecordedTaskStart]: () => void;
|
|
13
|
+
[InternalEventName.SurveyComplete]: () => void;
|
|
14
|
+
[InternalEventName.VerifyViewVersion]: (data: {
|
|
15
|
+
[InternalEventData.ViewVersion]: string;
|
|
16
|
+
}) => void;
|
|
17
|
+
[SprigEvent.CloseSurveyOnOverlayClick]: () => void;
|
|
18
|
+
[SprigEvent.SDKReady]: () => void;
|
|
19
|
+
[SprigEvent.SurveyAppeared]: () => void;
|
|
20
|
+
[SprigEvent.SurveyDimensions]: (data: {
|
|
21
|
+
contentFrameHeight: number;
|
|
22
|
+
contentFrameWidth: number;
|
|
23
|
+
name: string;
|
|
24
|
+
}) => void;
|
|
25
|
+
[SprigEvent.SurveyClosed]: (data: {
|
|
26
|
+
initiator?: unknown;
|
|
27
|
+
name: string;
|
|
28
|
+
}) => void;
|
|
29
|
+
[SprigEvent.SurveyFadingOut]: () => void;
|
|
30
|
+
[SprigEvent.SurveyHeight]: (data: {
|
|
31
|
+
name: string;
|
|
32
|
+
contentFrameHeight: number;
|
|
33
|
+
}) => void;
|
|
34
|
+
[SprigEvent.SurveyLifeCycle]: (data: {
|
|
35
|
+
state: string;
|
|
36
|
+
}) => void;
|
|
37
|
+
[SprigEvent.SurveyPresented]: (data: {
|
|
38
|
+
name: string;
|
|
39
|
+
}) => void;
|
|
40
|
+
[SprigEvent.SurveyWillClose]: (data: {
|
|
41
|
+
initiator: DismissReason;
|
|
42
|
+
name?: string;
|
|
43
|
+
}) => void;
|
|
44
|
+
[SprigEvent.SurveyWillPresent]: (data: {
|
|
45
|
+
name: string;
|
|
46
|
+
"survey.id": number;
|
|
47
|
+
}) => void;
|
|
48
|
+
[SprigEvent.VisitorIDUpdated]: (data: {
|
|
49
|
+
visitorId: string | null;
|
|
50
|
+
}) => void;
|
|
51
|
+
[SprigRecordingEvent.AvPermission]: (data: {
|
|
52
|
+
[SprigRecordingEventData.StreamCanceledCallback]: () => void;
|
|
53
|
+
[SprigRecordingEventData.StreamReadyCallback]: (avStream: MediaStream | null, captureStream?: MediaStream | null) => void;
|
|
54
|
+
[SprigRecordingEventData.PermissionDescriptors]: AvPermission[];
|
|
55
|
+
}) => void;
|
|
56
|
+
[SprigRecordingEvent.BeginRecording]: (data: {
|
|
57
|
+
[SprigRecordingEventData.RecordingMediaTypes]: MediaType[];
|
|
58
|
+
[SprigRecordingEventData.StartRecordingCallback]: (mediaRecordingUids: UUID[]) => void;
|
|
59
|
+
}) => void;
|
|
60
|
+
[SprigRecordingEvent.FinishTask]: (data: {
|
|
61
|
+
[SprigRecordingEventData.BeginCallback]: (mediaRecordingUid: UUID) => void;
|
|
62
|
+
[SprigRecordingEventData.CurrentIndex]: number;
|
|
63
|
+
[SprigRecordingEventData.PassthroughData]: PassthroughData;
|
|
64
|
+
[SprigRecordingEventData.ProgressCallback]: (mediaRecordingUid: UUID, data: {
|
|
65
|
+
detail: number;
|
|
66
|
+
}) => void;
|
|
67
|
+
[SprigRecordingEventData.TaskCompleteCallback]: (taskDurationMillisecond: number) => void;
|
|
68
|
+
[SprigRecordingEventData.TaskResponse]: RecordedTaskResponseType;
|
|
69
|
+
[SprigRecordingEventData.UploadCallback]: (mediaRecordingUid: UUID | null, successOrError: true | unknown) => void;
|
|
70
|
+
}) => void;
|
|
71
|
+
[SprigRecordingEvent.PermissionStatus]: (data: {
|
|
72
|
+
[SprigRecordingEventData.PermissionStatusCallback]: (avStream: MediaStream | undefined, hasVideoPermission: boolean, hasScreenPermission: boolean) => void;
|
|
73
|
+
}) => void;
|
|
74
|
+
[SprigRecordingEvent.ScreenPermission]: (data: {
|
|
75
|
+
[SprigRecordingEventData.StreamCanceledCallback]: () => void;
|
|
76
|
+
[SprigRecordingEventData.StreamReadyCallback]: (avStream: MediaStream | null, captureStream: MediaStream | null) => void;
|
|
77
|
+
}) => void;
|
|
78
|
+
[SprigRecordingEvent.StartTask]: () => void;
|
|
79
|
+
}
|
|
80
|
+
export declare type EventPayload = {
|
|
81
|
+
[Property in keyof SprigEventMap]: Parameters<SprigEventMap[Property]>[0];
|
|
82
|
+
};
|
|
83
|
+
export declare type SprigEventEmitter = StrictEventEmitter<SprigEventMap>;
|
|
84
|
+
declare const eventEmitter: StrictEventEmitter<SprigEventMap>;
|
|
85
|
+
export default eventEmitter;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Config } from "../types/config";
|
|
2
|
+
export declare const delay: (ms: number) => Promise<void>;
|
|
3
|
+
/**
|
|
4
|
+
* Get true or false for whether to direct embed from platform headers
|
|
5
|
+
* @returns user meta information
|
|
6
|
+
*/
|
|
7
|
+
export declare const shouldDirectEmbed: ({ "userleap-platform": platform, }: Config["headers"]) => boolean;
|
|
8
|
+
export declare const getClasses: (baseClass: string, useMobileStyling: boolean) => string[];
|
|
9
|
+
export declare const getPlatformClass: (baseClass: string, platform: string) => string[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Config } from "../types/config";
|
|
2
|
+
export declare const NETWORK_CONFIG: {
|
|
3
|
+
RATELIMIT_RESET_DEFAULT: number;
|
|
4
|
+
};
|
|
5
|
+
declare type Result = {
|
|
6
|
+
error?: Error;
|
|
7
|
+
ok?: boolean;
|
|
8
|
+
json?: any;
|
|
9
|
+
reportError?: boolean;
|
|
10
|
+
status?: number;
|
|
11
|
+
} & Partial<Response>;
|
|
12
|
+
export declare const killNetworkRequests: (reason?: string) => void;
|
|
13
|
+
export declare function getHttpHeaders(Sprig?: Partial<WindowSprig>): Config["headers"];
|
|
14
|
+
export declare const ulFetch: (url: string, options: RequestInit, attempt?: number, shouldDropOnRateLimit?: boolean, shouldRetryRequest?: boolean) => Promise<Result>;
|
|
15
|
+
export {};
|