@sprig-technologies/sprig-browser 2.27.0 → 2.28.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.d.ts CHANGED
@@ -1821,41 +1821,8 @@ declare class Emitter<Events extends EventMap> {
1821
1821
  rawListeners<EventName extends keyof Events>(eventName: EventName): Array<Listener<Events[EventName]>>;
1822
1822
  }
1823
1823
 
1824
- declare const enum MediaType {
1825
- Video = "video",
1826
- Audio = "audio",
1827
- Screen = "screen"
1828
- }
1829
- declare const enum SprigRecordingEvent {
1830
- PermissionStatus = "permission.status",
1831
- AvPermission = "av.permission",
1832
- ScreenPermission = "screen.permission",
1833
- BeginRecording = "begin.recording",
1834
- StartTask = "start.task",
1835
- FinishTask = "finish.task"
1836
- }
1837
- declare const enum TaskStatus {
1838
- Abandoned = "abandoned",
1839
- GivenUp = "given.up",
1840
- Completed = "completed"
1841
- }
1842
- declare const enum SprigRecordingEventData {
1843
- ScreenPermissionRequested = "screen.permission.requested",
1844
- PermissionDescriptors = "permission.descriptors",
1845
- PermissionStatusCallback = "permission.status.callback",
1846
- StreamReadyCallback = "stream.ready.callback",
1847
- StreamCanceledCallback = "stream.canceled.callback",
1848
- TaskCompleteCallback = "task.complete.callback",
1849
- TaskResponse = "task.response",
1850
- TaskStatus = "task.status",
1851
- RecordingMediaTypes = "recording.media.types",
1852
- StartRecordingCallback = "start.recording.callback",
1853
- PassthroughData = "passthrough.data",
1854
- CurrentIndex = "current.index",
1855
- UploadCallback = "upload.callback",
1856
- ProgressCallback = "progress.callback",
1857
- BeginCallback = "begin.callback"
1858
- }
1824
+ type MediaType = "video" | "audio" | "screen";
1825
+ type TaskStatus = "abandoned" | "given.up" | "completed";
1859
1826
  interface PassthroughData {
1860
1827
  questionId: number;
1861
1828
  surveyId: number;
@@ -1868,51 +1835,23 @@ interface RecordedTaskResponseValueType {
1868
1835
  taskDurationMillisecond?: number;
1869
1836
  taskStatus: TaskStatus;
1870
1837
  }
1871
- declare enum BooleanOperator {
1872
- And = 1,
1873
- Or = 2
1874
- }
1838
+ declare const BOOLEAN_OPERATOR: {
1839
+ readonly And: 1;
1840
+ readonly Or: 2;
1841
+ };
1842
+ type BooleanOperator = (typeof BOOLEAN_OPERATOR)[keyof typeof BOOLEAN_OPERATOR];
1875
1843
 
1876
- declare const enum CardType {
1877
- ConsentLegal = "consentlegal",
1878
- Likert = "likert",
1879
- Matrix = "matrix",
1880
- MultipleChoice = "multiplechoice",
1881
- MultipleSelect = "multipleselect",
1882
- NPS = "nps",
1883
- Open = "open",
1884
- RecordedTask = "recordedtask",
1885
- TextUrlPrompt = "texturlprompt",
1886
- Thanks = "thanks",
1887
- Uploading = "uploading",
1888
- VideoVoice = "videovoice"
1889
- }
1844
+ type CardType = "consentlegal" | "likert" | "matrix" | "multiplechoice" | "multipleselect" | "nps" | "open" | "recordedtask" | "texturlprompt" | "thanks" | "uploading" | "videovoice";
1890
1845
  type ConceptUrl = string | null;
1891
1846
  interface BaseCard {
1892
1847
  name: number;
1893
1848
  surveyId: number;
1894
1849
  updatedAt: string;
1895
1850
  value?: unknown;
1851
+ type: CardType;
1896
1852
  }
1897
- declare const enum Comparator {
1898
- Answered = "answered",
1899
- Contains = "contains",
1900
- DoesNotContain = "notcontains",
1901
- DoesNotInclude = "list_dni",
1902
- Equal = "eq",
1903
- GivenUp = "given_up",
1904
- GreaterThan = "gt",
1905
- GreaterThanOrEqual = "gte",
1906
- LessThan = "lt",
1907
- LessThanOrEqual = "lte",
1908
- ListAll = "list_all",
1909
- ListAtLeastOne = "list_alo",
1910
- ListExact = "list_exact",
1911
- NotEqual = "neq",
1912
- Partial = "partial",
1913
- Skipped = "skipped"
1914
- }
1915
- type DefaultComparator = Comparator.Answered | Comparator.Skipped;
1853
+ type Comparator = "answered" | "contains" | "notcontains" | "list_dni" | "eq" | "given_up" | "gt" | "gte" | "lt" | "lte" | "list_all" | "list_alo" | "list_exact" | "neq" | "partial" | "skipped";
1854
+ type DefaultComparator = Extract<Comparator, "answered" | "skipped">;
1916
1855
  type RoutingOption<C extends Comparator = DefaultComparator> = OldRoutingOption<C> | GroupRoutingOption;
1917
1856
  type OldRoutingOption<C extends Comparator = DefaultComparator> = {
1918
1857
  comparator: C;
@@ -1934,10 +1873,7 @@ type RoutingGroupOption = {
1934
1873
  type RoutingOptions<C extends Comparator = DefaultComparator> = RoutingOption<C | DefaultComparator>[] | null;
1935
1874
  /** @example <p>Body</p> */
1936
1875
  type RichTextBody = string;
1937
- declare const enum PromptActionType {
1938
- Continue = "CONTINUE",
1939
- External = "EXTERNAL"
1940
- }
1876
+ type PromptActionType = "CONTINUE" | "EXTERNAL";
1941
1877
  interface TextUrlPromptCard extends BaseCard {
1942
1878
  props: {
1943
1879
  message: string;
@@ -1954,13 +1890,9 @@ interface TextUrlPromptCard extends BaseCard {
1954
1890
  };
1955
1891
  routingOptions: RoutingOptions;
1956
1892
  };
1957
- type: CardType.TextUrlPrompt;
1958
- }
1959
- declare const enum AvPermission {
1960
- Camera = "camera",
1961
- Microphone = "microphone",
1962
- Screen = "screen"
1893
+ type: "texturlprompt";
1963
1894
  }
1895
+ type AvPermission = "camera" | "microphone" | "screen";
1964
1896
  interface ConsentLegalCard extends BaseCard {
1965
1897
  props: {
1966
1898
  message: string;
@@ -1983,18 +1915,14 @@ interface ConsentLegalCard extends BaseCard {
1983
1915
  };
1984
1916
  routingOptions: RoutingOptions;
1985
1917
  };
1986
- type: CardType.ConsentLegal;
1918
+ type: "consentlegal";
1987
1919
  }
1988
1920
  interface BaseTaskPage {
1989
1921
  buttonText: string;
1990
1922
  headline: string;
1923
+ type: RecordedTaskPageType;
1991
1924
  }
1992
- declare const enum RecordedTaskPageType {
1993
- AvPermission = "av_permission",
1994
- ScreenPermission = "screen_permission",
1995
- StartTask = "start_task",
1996
- CompleteTask = "complete_task"
1997
- }
1925
+ type RecordedTaskPageType = "av_permission" | "screen_permission" | "start_task" | "complete_task";
1998
1926
  interface PermissionTaskPage extends BaseTaskPage {
1999
1927
  captionText: string;
2000
1928
  headline: string;
@@ -2006,7 +1934,7 @@ interface PermissionTaskPage extends BaseTaskPage {
2006
1934
  skipButtonText?: string;
2007
1935
  svg: string;
2008
1936
  tryAgainButtonText: string;
2009
- type: RecordedTaskPageType.AvPermission;
1937
+ type: "av_permission";
2010
1938
  }
2011
1939
  interface ScreenTaskPage extends BaseTaskPage {
2012
1940
  captionText: string;
@@ -2014,19 +1942,19 @@ interface ScreenTaskPage extends BaseTaskPage {
2014
1942
  permissionDeniedHeadline: string;
2015
1943
  selectTabText: string;
2016
1944
  skipButtonText: string;
2017
- type: RecordedTaskPageType.ScreenPermission;
1945
+ type: "screen_permission";
2018
1946
  }
2019
1947
  interface StartTaskPage extends BaseTaskPage {
2020
1948
  captionText?: string;
2021
1949
  skipButtonText: string;
2022
1950
  taskDetail: string;
2023
- type: RecordedTaskPageType.StartTask;
1951
+ type: "start_task";
2024
1952
  }
2025
1953
  interface CompleteTaskPage extends BaseTaskPage {
2026
1954
  captionText?: string;
2027
1955
  skipButtonText: string;
2028
1956
  taskDetail: string;
2029
- type: RecordedTaskPageType.CompleteTask;
1957
+ type: "complete_task";
2030
1958
  }
2031
1959
  type RecordedTaskPage = PermissionTaskPage | ScreenTaskPage | StartTaskPage | CompleteTaskPage;
2032
1960
  interface RecordedTaskCardProperties {
@@ -2042,9 +1970,9 @@ interface RecordedTaskCard extends BaseCard {
2042
1970
  message: string;
2043
1971
  options: [];
2044
1972
  properties: RecordedTaskCardProperties;
2045
- routingOptions: RoutingOptions<Comparator.GivenUp>;
1973
+ routingOptions: RoutingOptions<"given_up">;
2046
1974
  };
2047
- type: CardType.RecordedTask;
1975
+ type: "recordedtask";
2048
1976
  }
2049
1977
  interface Labels {
2050
1978
  left: string;
@@ -2054,11 +1982,7 @@ interface RatingIcon {
2054
1982
  idx?: number;
2055
1983
  svg: string;
2056
1984
  }
2057
- declare enum ScaleLabelType {
2058
- Number = "number",
2059
- Smiley = "smiley",
2060
- Star = "star"
2061
- }
1985
+ type ScaleLabelType = "number" | "smiley" | "star";
2062
1986
  interface LikertCard extends BaseCard {
2063
1987
  props: {
2064
1988
  labels: Labels;
@@ -2074,9 +1998,9 @@ interface LikertCard extends BaseCard {
2074
1998
  scaleLabelType: ScaleLabelType;
2075
1999
  required: boolean;
2076
2000
  };
2077
- routingOptions: RoutingOptions<Comparator.Equal | Comparator.GivenUp | Comparator.GreaterThan | Comparator.GreaterThanOrEqual | Comparator.LessThan | Comparator.LessThanOrEqual | Comparator.NotEqual>;
2001
+ routingOptions: RoutingOptions<"eq" | "given_up" | "gt" | "gte" | "lt" | "lte" | "neq">;
2078
2002
  };
2079
- type: CardType.Likert;
2003
+ type: "likert";
2080
2004
  }
2081
2005
  interface OpenTextCard extends BaseCard {
2082
2006
  props: {
@@ -2093,9 +2017,9 @@ interface OpenTextCard extends BaseCard {
2093
2017
  richTextBody: RichTextBody;
2094
2018
  skipButtonText?: string;
2095
2019
  };
2096
- routingOptions: RoutingOptions<Comparator.Contains | Comparator.DoesNotContain>;
2020
+ routingOptions: RoutingOptions<"contains" | "notcontains">;
2097
2021
  };
2098
- type: CardType.Open;
2022
+ type: "open";
2099
2023
  }
2100
2024
  interface MultipleChoiceOption {
2101
2025
  createdAt: string;
@@ -2121,6 +2045,15 @@ interface CommonMultipleChoiceProps {
2121
2045
  buttonText?: string;
2122
2046
  captionText: string;
2123
2047
  conceptUrl: ConceptUrl;
2048
+ isDropdown?: boolean;
2049
+ /**
2050
+ * Placeholder text on the dropdown button when no items are selected
2051
+ */
2052
+ dropdownPlaceholderText?: string;
2053
+ /**
2054
+ * Text when multiple items are selected, such as "2 items selected" / "3 items selected"
2055
+ */
2056
+ dropdownMultiselectedText?: string;
2124
2057
  randomize: "none" | "all";
2125
2058
  required: boolean;
2126
2059
  };
@@ -2130,17 +2063,17 @@ interface MultiChoiceCard<C extends Comparator = DefaultComparator> extends Base
2130
2063
  routingOptions: RoutingOptions<C>;
2131
2064
  };
2132
2065
  }
2133
- interface MultipleChoiceSingleSelectCard extends MultiChoiceCard<Comparator.Equal | Comparator.NotEqual | Comparator.ListAtLeastOne | Comparator.DoesNotInclude> {
2134
- type: CardType.MultipleChoice;
2066
+ interface MultipleChoiceSingleSelectCard extends MultiChoiceCard<"eq" | "neq" | "list_alo" | "list_dni"> {
2067
+ type: "multiplechoice";
2135
2068
  }
2136
- interface MultipleChoiceMultiSelectCard extends MultiChoiceCard<Comparator.ListAll | Comparator.ListAtLeastOne | Comparator.ListExact | Comparator.DoesNotInclude> {
2137
- type: CardType.MultipleSelect;
2069
+ interface MultipleChoiceMultiSelectCard extends MultiChoiceCard<"list_all" | "list_alo" | "list_exact" | "list_dni"> {
2070
+ type: "multipleselect";
2138
2071
  }
2139
2072
  interface MatrixCard extends BaseCard {
2140
2073
  props: {
2141
2074
  options: MultipleChoiceOption[];
2142
2075
  message: string;
2143
- routingOptions: RoutingOptions<Comparator.Skipped | Comparator.Partial | Comparator.Answered>;
2076
+ routingOptions: RoutingOptions<"skipped" | "partial" | "answered">;
2144
2077
  properties: {
2145
2078
  buttonText?: string;
2146
2079
  captionText: string;
@@ -2153,7 +2086,7 @@ interface MatrixCard extends BaseCard {
2153
2086
  required: boolean;
2154
2087
  };
2155
2088
  };
2156
- type: CardType.Matrix;
2089
+ type: "matrix";
2157
2090
  }
2158
2091
  interface NPSCard extends BaseCard {
2159
2092
  props: {
@@ -2173,9 +2106,9 @@ interface NPSCard extends BaseCard {
2173
2106
  };
2174
2107
  required: boolean;
2175
2108
  };
2176
- routingOptions: RoutingOptions<Comparator.Equal | Comparator.GreaterThan | Comparator.GreaterThanOrEqual | Comparator.LessThan | Comparator.LessThanOrEqual | Comparator.NotEqual>;
2109
+ routingOptions: RoutingOptions<"eq" | "gt" | "gte" | "lt" | "lte" | "neq">;
2177
2110
  };
2178
- type: CardType.NPS;
2111
+ type: "nps";
2179
2112
  }
2180
2113
  interface VideoVoiceCard extends BaseCard {
2181
2114
  props: {
@@ -2185,6 +2118,7 @@ interface VideoVoiceCard extends BaseCard {
2185
2118
  buttonText: string;
2186
2119
  captionText: string;
2187
2120
  conceptUrl: null;
2121
+ hideRecordedPrompt?: boolean;
2188
2122
  mediaType: "video" | "audio";
2189
2123
  required: boolean;
2190
2124
  skipButtonText: string;
@@ -2193,7 +2127,7 @@ interface VideoVoiceCard extends BaseCard {
2193
2127
  };
2194
2128
  routingOptions: RoutingOptions;
2195
2129
  };
2196
- type: CardType.VideoVoice;
2130
+ type: "videovoice";
2197
2131
  }
2198
2132
  type Card = TextUrlPromptCard | ConsentLegalCard | RecordedTaskCard | LikertCard | OpenTextCard | MatrixCard | MultipleChoiceSingleSelectCard | MultipleChoiceMultiSelectCard | NPSCard | VideoVoiceCard;
2199
2133
 
@@ -2224,12 +2158,10 @@ declare enum DismissReason {
2224
2158
  API = "api",
2225
2159
  Override = "override"
2226
2160
  }
2227
- declare enum StudyType {
2228
- Feedback = "feedbackButton",
2229
- IPS = "inProductSurvey"
2230
- }
2161
+ type StudyType = "feedbackButton" | "inProductSurvey";
2231
2162
  declare enum SprigEvent {
2232
2163
  ReplayCapture = "replay.capture",
2164
+ FeedbackButtonLoaded = "feedback.button.loaded",
2233
2165
  SDKReady = "sdk.ready",
2234
2166
  SurveyAppeared = "survey.appeared",
2235
2167
  SurveyClosed = "survey.closed",
@@ -2245,10 +2177,8 @@ declare enum SprigEvent {
2245
2177
  VisitorIDUpdated = "visitor.id.updated",
2246
2178
  QuestionAnswered = "question.answered"
2247
2179
  }
2248
- declare enum SprigEventData {
2249
- SurveyId = "survey.id"
2250
- }
2251
2180
  declare const EVENTS: {
2181
+ FEEDBACK_BUTTON_LOADED: SprigEvent;
2252
2182
  SDK_READY: SprigEvent;
2253
2183
  SURVEY_APPEARED: SprigEvent;
2254
2184
  SURVEY_CLOSED: SprigEvent;
@@ -2272,66 +2202,38 @@ declare const EVENTS: {
2272
2202
  PAGE_CHANGE: DismissReason;
2273
2203
  OVERRIDE: DismissReason;
2274
2204
  };
2275
- SURVEY_ID: SprigEventData;
2205
+ SURVEY_ID: string;
2276
2206
  };
2277
2207
  };
2278
- declare const enum InternalEventName {
2279
- VerifyViewVersion = "verify.view.version",
2280
- CurrentQuestion = "survey.question",
2281
- ViewPrototypeClick = "question.prototype.click",
2282
- ViewAgreementClick = "question.agreement.click",
2283
- RecordedTaskStart = "recorded.task.start",
2284
- RecordedTaskPermissionScreen = "recorded.task.permission.screen",
2285
- SurveyComplete = "survey.complete"
2286
- }
2287
- declare const enum InternalEventData {
2288
- ViewVersion = "view.version",
2289
- QuestionId = "qid",
2290
- Props = "props"
2291
- }
2292
2208
 
2293
- declare const enum ThresholdType {
2294
- Max = "max",
2295
- Min = "min"
2296
- }
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";
2210
+ type ThresholdType = "max" | "min";
2297
2211
  interface MetricThreshold {
2298
- metric: string;
2212
+ metric: Metric;
2299
2213
  type: ThresholdType;
2300
2214
  value: number;
2301
2215
  }
2302
2216
 
2303
- declare enum ReplayDurationType {
2304
- After = "after",
2305
- Before = "before",
2306
- BeforeAndAfter = "beforeAndAfter"
2307
- }
2308
- declare enum ReplayEventType {
2309
- Click = "Sprig_Click",
2310
- Event = "Sprig_TrackEvent",
2311
- PageView = "Sprig_PageView",
2312
- SurveyShown = "Sprig_ShowSurvey",
2313
- SurveySubmitted = "Sprig_SubmitSurvey",
2314
- Noop = "Sprig_Noop"
2315
- }
2217
+ type ReplayDurationType = "after" | "before" | "beforeAndAfter";
2316
2218
  type EventDigest = {
2317
2219
  timestamp: number;
2318
- type: ReplayEventType.Click;
2220
+ type: "Sprig_Click";
2319
2221
  } | {
2320
2222
  timestamp: number;
2321
2223
  name: string;
2322
- type: ReplayEventType.Event;
2224
+ type: "Sprig_TrackEvent";
2323
2225
  } | {
2324
2226
  timestamp: number;
2325
- type: ReplayEventType.PageView;
2227
+ type: "Sprig_PageView";
2326
2228
  url: string;
2327
2229
  } | {
2328
2230
  timestamp: number;
2329
2231
  surveyId: string;
2330
- type: ReplayEventType.SurveyShown;
2232
+ type: "Sprig_ShowSurvey";
2331
2233
  } | {
2332
2234
  timestamp: number;
2333
2235
  surveyId: string;
2334
- type: ReplayEventType.SurveySubmitted;
2236
+ type: "Sprig_SubmitSurvey";
2335
2237
  };
2336
2238
 
2337
2239
  interface RecordedTaskResponseType {
@@ -2352,26 +2254,32 @@ interface MobileReplayConfig {
2352
2254
  };
2353
2255
  }
2354
2256
  type SprigEventMap = {
2355
- [InternalEventName.CurrentQuestion]: [
2257
+ "survey.question": [
2356
2258
  {
2357
- [InternalEventData.QuestionId]: number;
2358
- [InternalEventData.Props]: unknown;
2259
+ qid: number;
2260
+ props: unknown;
2359
2261
  }
2360
2262
  ];
2361
- [InternalEventName.RecordedTaskPermissionScreen]: [];
2362
- [InternalEventName.RecordedTaskStart]: [];
2363
- [InternalEventName.SurveyComplete]: [];
2364
- [InternalEventName.VerifyViewVersion]: [
2263
+ "recorded.task.permission.screen": [];
2264
+ "recorded.task.start": [];
2265
+ "survey.complete": [number];
2266
+ "verify.view.version": [
2365
2267
  {
2366
- [InternalEventData.ViewVersion]: string;
2268
+ "view.version": string;
2367
2269
  }
2368
2270
  ];
2369
2271
  [SprigEvent.CloseSurveyOnOverlayClick]: [];
2272
+ [SprigEvent.FeedbackButtonLoaded]: [
2273
+ {
2274
+ name: string;
2275
+ "survey.id"?: number;
2276
+ }
2277
+ ];
2370
2278
  [SprigEvent.SDKReady]: [MobileReplayConfig];
2371
2279
  [SprigEvent.SurveyAppeared]: [
2372
2280
  {
2373
2281
  name: string;
2374
- [SprigEventData.SurveyId]: number;
2282
+ "survey.id": number;
2375
2283
  }
2376
2284
  ];
2377
2285
  [SprigEvent.SurveyDimensions]: [
@@ -2407,7 +2315,7 @@ type SprigEventMap = {
2407
2315
  [SprigEvent.SurveyPresented]: [
2408
2316
  {
2409
2317
  name: string;
2410
- [SprigEventData.SurveyId]: number;
2318
+ "survey.id": number;
2411
2319
  }
2412
2320
  ];
2413
2321
  [SprigEvent.SurveyWillClose]: [
@@ -2420,7 +2328,7 @@ type SprigEventMap = {
2420
2328
  [SprigEvent.SurveyWillPresent]: [
2421
2329
  {
2422
2330
  name: string;
2423
- [SprigEventData.SurveyId]: number;
2331
+ "survey.id": number;
2424
2332
  }
2425
2333
  ];
2426
2334
  [SprigEvent.VisitorIDUpdated]: [{
@@ -2440,47 +2348,56 @@ type SprigEventMap = {
2440
2348
  uploadId: string;
2441
2349
  seconds: number;
2442
2350
  replayType: ReplayDurationType;
2443
- generateVideoUploadUrlPayload: object;
2351
+ generateVideoUploadUrlPayload: {
2352
+ isReplay: boolean;
2353
+ mediaRecordingUid: string;
2354
+ mediaType: MediaType;
2355
+ questionId: number;
2356
+ responseGroupUid: string;
2357
+ surveyId: number;
2358
+ updatedAt: string;
2359
+ visitorId: string | null;
2360
+ };
2444
2361
  surveyId: number;
2445
2362
  }
2446
2363
  ];
2447
- [SprigRecordingEvent.AvPermission]: [
2364
+ "av.permission": [
2448
2365
  {
2449
- [SprigRecordingEventData.StreamReadyCallback]: (avStream: MediaStream | null, captureStream?: MediaStream | null) => void;
2450
- [SprigRecordingEventData.PermissionDescriptors]: AvPermission[];
2366
+ "stream.ready": (avStream: MediaStream | null, captureStream?: MediaStream | null) => void;
2367
+ "permission.descriptors": AvPermission[];
2451
2368
  }
2452
2369
  ];
2453
- [SprigRecordingEvent.BeginRecording]: [
2370
+ "begin.recording": [
2454
2371
  {
2455
- [SprigRecordingEventData.RecordingMediaTypes]: MediaType[];
2456
- [SprigRecordingEventData.StartRecordingCallback]: (mediaRecordingUids: UUID[]) => void;
2372
+ "recording.media.types": MediaType[];
2373
+ "start.recording.callback": (mediaRecordingUids: UUID[]) => void;
2457
2374
  }
2458
2375
  ];
2459
- [SprigRecordingEvent.FinishTask]: [
2376
+ "finish.task": [
2460
2377
  {
2461
- [SprigRecordingEventData.BeginCallback]: (mediaRecordingUid: UUID) => void;
2462
- [SprigRecordingEventData.CurrentIndex]: number;
2463
- [SprigRecordingEventData.PassthroughData]: PassthroughData;
2464
- [SprigRecordingEventData.ProgressCallback]: (mediaRecordingUid: UUID, data: {
2378
+ "begin.callback": (mediaRecordingUid: UUID) => void;
2379
+ "current.index": number;
2380
+ "passthrough.data": PassthroughData;
2381
+ "progress.callback": (mediaRecordingUid: UUID, data: {
2465
2382
  detail: number;
2466
2383
  }) => void;
2467
- [SprigRecordingEventData.TaskCompleteCallback]: (taskDurationMillisecond: number) => void;
2468
- [SprigRecordingEventData.TaskResponse]: RecordedTaskResponseType;
2469
- [SprigRecordingEventData.UploadCallback]: (mediaRecordingUid: UUID | null, successOrError: true | unknown) => void;
2384
+ "task.complete.callback": (taskDurationMillisecond: number) => void;
2385
+ "task.response": RecordedTaskResponseType;
2386
+ "upload.callback": (mediaRecordingUid: UUID | null, successOrError: true | unknown) => void;
2470
2387
  }
2471
2388
  ];
2472
- [SprigRecordingEvent.PermissionStatus]: [
2389
+ "permission.status": [
2473
2390
  {
2474
- [SprigRecordingEventData.PermissionStatusCallback]: (avStream: MediaStream | undefined, hasVideoPermission: boolean, hasScreenPermission: boolean, captureStream: MediaStream | undefined) => void;
2391
+ "permission.status.callback": (avStream: MediaStream | undefined, hasVideoPermission: boolean, hasScreenPermission: boolean, captureStream: MediaStream | undefined) => void;
2475
2392
  }
2476
2393
  ];
2477
- [SprigRecordingEvent.ScreenPermission]: [
2394
+ "screen.permission": [
2478
2395
  {
2479
- [SprigRecordingEventData.ScreenPermissionRequested]?: (data: boolean) => void;
2480
- [SprigRecordingEventData.StreamReadyCallback]: (avStream: MediaStream | null, captureStream: MediaStream | null) => void;
2396
+ "screen.permission.requested"?: (data: boolean) => void;
2397
+ "stream.ready.callback": (avStream: MediaStream | null, captureStream: MediaStream | null) => void;
2481
2398
  }
2482
2399
  ];
2483
- [SprigRecordingEvent.StartTask]: [];
2400
+ "start.task": [];
2484
2401
  };
2485
2402
  declare const eventEmitter: Emitter<SprigEventMap>;
2486
2403
  type SprigEventEmitter = typeof eventEmitter;
@@ -2493,52 +2410,15 @@ declare const LogLevels: {
2493
2410
  };
2494
2411
  type LogLevel = (typeof LogLevels)[keyof typeof LogLevels];
2495
2412
 
2496
- declare const enum FramePosition {
2497
- BottomLeft = "bottomLeft",
2498
- BottomRight = "bottomRight",
2499
- Center = "center",
2500
- TopLeft = "topLeft",
2501
- TopRight = "topRight"
2502
- }
2503
- declare const enum HttpHeader {
2504
- Error = "x-ul-error",
2505
- EnvironmentID = "x-ul-environment-id",
2506
- InstallationMethod = "x-ul-installation-method",
2507
- PartnerAnonymousId = "x-ul-anonymous-id",
2508
- Platform = "userleap-platform",
2509
- PreviewMode = "x-ul-preview-mode",
2510
- UserID = "x-ul-user-id",
2511
- VisitorID = "x-ul-visitor-id"
2512
- }
2513
- declare const enum Platform {
2514
- Email = "email",
2515
- Link = "link",
2516
- Web = "web"
2517
- }
2518
- declare const enum InstallationMethod {
2519
- Npm = "web-npm",
2520
- NpmBundled = "web-npm-bundled",
2521
- Gtm = "web-gtm",
2522
- Segment = "web-segment",
2523
- SegmentAndroid = "android-segment",
2524
- SegmentReactNative = "react-native-segment",
2525
- SegmentIOS = "ios-segment",
2526
- Snippet = "web-snippet"
2527
- }
2413
+ type FramePosition = "bottomLeft" | "bottomRight" | "center" | "topLeft" | "topRight";
2414
+ type Platform = "email" | "link" | "web";
2415
+ type InstallationMethod = "web-npm" | "web-npm-bundled" | "web-gtm" | "web-segment" | "android-segment" | "react-native-segment" | "ios-segment" | "web-snippet";
2528
2416
  interface Answer {
2529
2417
  questionId: number;
2530
2418
  value: unknown;
2531
2419
  }
2532
- declare enum FeedbackPlacement {
2533
- CenterLeft = "center-left",
2534
- CenterRight = "center-right",
2535
- BottomLeft = "bottom-left",
2536
- BottomRight = "bottom-right"
2537
- }
2538
- declare enum FeedbackDesktopDisplay {
2539
- CenterModal = "center-modal",
2540
- Slider = "slider"
2541
- }
2420
+ type FeedbackPlacement = "center-left" | "center-right" | "bottom-left" | "bottom-right";
2421
+ type FeedbackDesktopDisplay = "center-modal" | "slider";
2542
2422
  interface AppProductConfig {
2543
2423
  framePosition?: FramePosition;
2544
2424
  desktopDisplay?: FeedbackDesktopDisplay;
@@ -2587,19 +2467,20 @@ interface Config extends MobileReplayConfig {
2587
2467
  "accept-language"?: string;
2588
2468
  /** @example "Bearer 123" */
2589
2469
  Authorization?: string;
2590
- "Content-Type": string;
2591
- "userleap-platform": Platform;
2470
+ "Content-Type"?: string;
2471
+ "userleap-platform": Platform | "ios" | "android" | "video_recorder";
2592
2472
  /** @example "SJcVfq-7QQ" */
2593
- [HttpHeader.EnvironmentID]?: string;
2594
- [HttpHeader.InstallationMethod]: InstallationMethod;
2595
- [HttpHeader.PartnerAnonymousId]?: string;
2596
- [HttpHeader.PreviewMode]?: string;
2473
+ "x-ul-environment-id"?: string;
2474
+ "x-ul-installation-method": InstallationMethod;
2475
+ "x-ul-anonymous-id"?: string;
2476
+ "x-ul-error"?: string;
2477
+ "x-ul-preview-mode"?: string;
2597
2478
  /** @example "2.18.0" */
2598
- "x-ul-sdk-version": string;
2479
+ "x-ul-sdk-version"?: string;
2599
2480
  /** For web-bundled sdk */
2600
2481
  "x-ul-package-version"?: string;
2601
- [HttpHeader.UserID]?: string;
2602
- [HttpHeader.VisitorID]?: UUID;
2482
+ "x-ul-user-id"?: string;
2483
+ "x-ul-visitor-id"?: string;
2603
2484
  };
2604
2485
  installationMethod?: InstallationMethod;
2605
2486
  interactiveEvents: InteractiveEvent[];
@@ -2678,10 +2559,7 @@ declare class SprigQueue {
2678
2559
  empty(): void;
2679
2560
  }
2680
2561
 
2681
- declare enum SurveyState {
2682
- Ready = "ready",
2683
- NoSurvey = "no survey"
2684
- }
2562
+ type SurveyState = "ready" | "no survey";
2685
2563
 
2686
2564
  declare namespace optimizely {
2687
2565
  interface Optimizely {
@@ -2725,6 +2603,7 @@ declare namespace optimizely {
2725
2603
  declare namespace sprigConfig {
2726
2604
  type IdentifyResult = Promise<
2727
2605
  | {
2606
+ error?: Error;
2728
2607
  success: boolean;
2729
2608
  message?: string;
2730
2609
  surveyState?: SurveyState;
@@ -2762,7 +2641,7 @@ declare namespace sprigConfig {
2762
2641
  }) => Promise<string | null>;
2763
2642
  _previewSurvey: (surveyTemplateId: UUID) => void;
2764
2643
  _reviewSurvey: (surveyId: number) => void;
2765
- _reportMetric: (name: string, value: number) => void;
2644
+ _reportMetric: (name: Metric, value: number) => void;
2766
2645
 
2767
2646
  // external apis
2768
2647
  addListener: (event: SprigEvent, listener: SprigListener) => Promise<void>;
@@ -2929,18 +2808,20 @@ declare class SprigAPI {
2929
2808
  * Include external events emitted from Sprig
2930
2809
  */
2931
2810
  UPDATES: {
2811
+ FEEDBACK_BUTTON_LOADED: SprigEvent;
2932
2812
  SDK_READY: SprigEvent;
2933
2813
  SURVEY_APPEARED: SprigEvent;
2934
2814
  SURVEY_CLOSED: SprigEvent;
2935
2815
  SURVEY_DIMENSIONS: SprigEvent;
2936
2816
  SURVEY_FADING_OUT: SprigEvent;
2937
2817
  SURVEY_HEIGHT: SprigEvent;
2938
- SURVEY_WIDTH: SprigEvent;
2818
+ SURVEY_WIDTH: SprigEvent; /**
2819
+ * Track an event to show survey if eligible
2820
+ * @param eventName name of event to track
2821
+ */
2939
2822
  SURVEY_PRESENTED: SprigEvent;
2940
2823
  SURVEY_LIFE_CYCLE: SprigEvent;
2941
- SURVEY_WILL_CLOSE: SprigEvent; /**
2942
- * Attach a user id to the visitor
2943
- */
2824
+ SURVEY_WILL_CLOSE: SprigEvent;
2944
2825
  SURVEY_WILL_PRESENT: SprigEvent;
2945
2826
  QUESTION_ANSWERED: SprigEvent;
2946
2827
  REPLAY_CAPTURE: SprigEvent;
@@ -2954,7 +2835,7 @@ declare class SprigAPI {
2954
2835
  PAGE_CHANGE: DismissReason;
2955
2836
  OVERRIDE: DismissReason;
2956
2837
  };
2957
- SURVEY_ID: SprigEventData;
2838
+ SURVEY_ID: string;
2958
2839
  };
2959
2840
  };
2960
2841
  /**