@sprig-technologies/sprig-browser 2.26.6 → 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: {
@@ -2087,14 +2011,15 @@ interface OpenTextCard extends BaseCard {
2087
2011
  buttonText?: string;
2088
2012
  captionText?: string;
2089
2013
  conceptUrl: ConceptUrl;
2014
+ footerHtml?: string;
2090
2015
  openTextPlaceholder?: string;
2091
2016
  required: boolean;
2092
2017
  richTextBody: RichTextBody;
2093
2018
  skipButtonText?: string;
2094
2019
  };
2095
- routingOptions: RoutingOptions<Comparator.Contains | Comparator.DoesNotContain>;
2020
+ routingOptions: RoutingOptions<"contains" | "notcontains">;
2096
2021
  };
2097
- type: CardType.Open;
2022
+ type: "open";
2098
2023
  }
2099
2024
  interface MultipleChoiceOption {
2100
2025
  createdAt: string;
@@ -2120,6 +2045,15 @@ interface CommonMultipleChoiceProps {
2120
2045
  buttonText?: string;
2121
2046
  captionText: string;
2122
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;
2123
2057
  randomize: "none" | "all";
2124
2058
  required: boolean;
2125
2059
  };
@@ -2129,17 +2063,17 @@ interface MultiChoiceCard<C extends Comparator = DefaultComparator> extends Base
2129
2063
  routingOptions: RoutingOptions<C>;
2130
2064
  };
2131
2065
  }
2132
- interface MultipleChoiceSingleSelectCard extends MultiChoiceCard<Comparator.Equal | Comparator.NotEqual | Comparator.ListAtLeastOne | Comparator.DoesNotInclude> {
2133
- type: CardType.MultipleChoice;
2066
+ interface MultipleChoiceSingleSelectCard extends MultiChoiceCard<"eq" | "neq" | "list_alo" | "list_dni"> {
2067
+ type: "multiplechoice";
2134
2068
  }
2135
- interface MultipleChoiceMultiSelectCard extends MultiChoiceCard<Comparator.ListAll | Comparator.ListAtLeastOne | Comparator.ListExact | Comparator.DoesNotInclude> {
2136
- type: CardType.MultipleSelect;
2069
+ interface MultipleChoiceMultiSelectCard extends MultiChoiceCard<"list_all" | "list_alo" | "list_exact" | "list_dni"> {
2070
+ type: "multipleselect";
2137
2071
  }
2138
2072
  interface MatrixCard extends BaseCard {
2139
2073
  props: {
2140
2074
  options: MultipleChoiceOption[];
2141
2075
  message: string;
2142
- routingOptions: RoutingOptions<Comparator.Skipped | Comparator.Partial | Comparator.Answered>;
2076
+ routingOptions: RoutingOptions<"skipped" | "partial" | "answered">;
2143
2077
  properties: {
2144
2078
  buttonText?: string;
2145
2079
  captionText: string;
@@ -2152,7 +2086,7 @@ interface MatrixCard extends BaseCard {
2152
2086
  required: boolean;
2153
2087
  };
2154
2088
  };
2155
- type: CardType.Matrix;
2089
+ type: "matrix";
2156
2090
  }
2157
2091
  interface NPSCard extends BaseCard {
2158
2092
  props: {
@@ -2172,9 +2106,9 @@ interface NPSCard extends BaseCard {
2172
2106
  };
2173
2107
  required: boolean;
2174
2108
  };
2175
- routingOptions: RoutingOptions<Comparator.Equal | Comparator.GreaterThan | Comparator.GreaterThanOrEqual | Comparator.LessThan | Comparator.LessThanOrEqual | Comparator.NotEqual>;
2109
+ routingOptions: RoutingOptions<"eq" | "gt" | "gte" | "lt" | "lte" | "neq">;
2176
2110
  };
2177
- type: CardType.NPS;
2111
+ type: "nps";
2178
2112
  }
2179
2113
  interface VideoVoiceCard extends BaseCard {
2180
2114
  props: {
@@ -2184,6 +2118,7 @@ interface VideoVoiceCard extends BaseCard {
2184
2118
  buttonText: string;
2185
2119
  captionText: string;
2186
2120
  conceptUrl: null;
2121
+ hideRecordedPrompt?: boolean;
2187
2122
  mediaType: "video" | "audio";
2188
2123
  required: boolean;
2189
2124
  skipButtonText: string;
@@ -2192,14 +2127,15 @@ interface VideoVoiceCard extends BaseCard {
2192
2127
  };
2193
2128
  routingOptions: RoutingOptions;
2194
2129
  };
2195
- type: CardType.VideoVoice;
2130
+ type: "videovoice";
2196
2131
  }
2197
2132
  type Card = TextUrlPromptCard | ConsentLegalCard | RecordedTaskCard | LikertCard | OpenTextCard | MatrixCard | MultipleChoiceSingleSelectCard | MultipleChoiceMultiSelectCard | NPSCard | VideoVoiceCard;
2198
2133
 
2199
- type MatchType = "exactly" | "legacy";
2134
+ type InteractiveMatchType = "exactly" | "legacy";
2135
+ type PageUrlMatchType = "contains" | "exactly" | "legacy" | "notContains" | "regex" | "startsWith";
2200
2136
  interface InteractiveEvent {
2201
2137
  id: number;
2202
- matchType: MatchType;
2138
+ matchType: InteractiveMatchType;
2203
2139
  name: string;
2204
2140
  pattern: string;
2205
2141
  properties: {
@@ -2210,19 +2146,22 @@ interface InteractiveEvent {
2210
2146
  }
2211
2147
  interface PageUrlEvent {
2212
2148
  id: number;
2213
- matchType: MatchType | "contains" | "notContains" | "regex" | "startsWith";
2149
+ matchType: PageUrlMatchType;
2214
2150
  pattern: string;
2215
2151
  }
2216
2152
 
2217
2153
  declare enum DismissReason {
2218
2154
  Closed = "close.click",
2219
2155
  Complete = "survey.completed",
2156
+ FeedbackClosed = "feedback.closed",
2220
2157
  PageChange = "page.change",
2221
2158
  API = "api",
2222
2159
  Override = "override"
2223
2160
  }
2161
+ type StudyType = "feedbackButton" | "inProductSurvey";
2224
2162
  declare enum SprigEvent {
2225
2163
  ReplayCapture = "replay.capture",
2164
+ FeedbackButtonLoaded = "feedback.button.loaded",
2226
2165
  SDKReady = "sdk.ready",
2227
2166
  SurveyAppeared = "survey.appeared",
2228
2167
  SurveyClosed = "survey.closed",
@@ -2238,10 +2177,8 @@ declare enum SprigEvent {
2238
2177
  VisitorIDUpdated = "visitor.id.updated",
2239
2178
  QuestionAnswered = "question.answered"
2240
2179
  }
2241
- declare enum SprigEventData {
2242
- SurveyId = "survey.id"
2243
- }
2244
2180
  declare const EVENTS: {
2181
+ FEEDBACK_BUTTON_LOADED: SprigEvent;
2245
2182
  SDK_READY: SprigEvent;
2246
2183
  SURVEY_APPEARED: SprigEvent;
2247
2184
  SURVEY_CLOSED: SprigEvent;
@@ -2265,65 +2202,50 @@ declare const EVENTS: {
2265
2202
  PAGE_CHANGE: DismissReason;
2266
2203
  OVERRIDE: DismissReason;
2267
2204
  };
2268
- SURVEY_ID: SprigEventData;
2205
+ SURVEY_ID: string;
2269
2206
  };
2270
2207
  };
2271
- declare const enum InternalEventName {
2272
- VerifyViewVersion = "verify.view.version",
2273
- CurrentQuestion = "survey.question",
2274
- ViewPrototypeClick = "question.prototype.click",
2275
- ViewAgreementClick = "question.agreement.click",
2276
- RecordedTaskStart = "recorded.task.start",
2277
- RecordedTaskPermissionScreen = "recorded.task.permission.screen",
2278
- SurveyComplete = "survey.complete"
2279
- }
2280
- declare const enum InternalEventData {
2281
- ViewVersion = "view.version",
2282
- QuestionId = "qid",
2283
- Props = "props"
2284
- }
2285
2208
 
2286
- interface RecordedTaskResponseType {
2287
- questionId: number;
2288
- type: CardType;
2289
- value: RecordedTaskResponseValueType;
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";
2211
+ interface MetricThreshold {
2212
+ metric: Metric;
2213
+ type: ThresholdType;
2214
+ value: number;
2290
2215
  }
2291
2216
 
2292
- declare enum ReplayDurationType {
2293
- After = "after",
2294
- Before = "before",
2295
- BeforeAndAfter = "beforeAndAfter"
2296
- }
2297
- declare enum ReplayEventType {
2298
- Click = "Sprig_Click",
2299
- Event = "Sprig_TrackEvent",
2300
- PageView = "Sprig_PageView",
2301
- SurveyShown = "Sprig_ShowSurvey",
2302
- SurveySubmitted = "Sprig_SubmitSurvey",
2303
- Noop = "Sprig_Noop"
2304
- }
2217
+ type ReplayDurationType = "after" | "before" | "beforeAndAfter";
2305
2218
  type EventDigest = {
2306
2219
  timestamp: number;
2307
- type: ReplayEventType.Click;
2220
+ type: "Sprig_Click";
2308
2221
  } | {
2309
2222
  timestamp: number;
2310
2223
  name: string;
2311
- type: ReplayEventType.Event;
2224
+ type: "Sprig_TrackEvent";
2312
2225
  } | {
2313
2226
  timestamp: number;
2314
- type: ReplayEventType.PageView;
2227
+ type: "Sprig_PageView";
2315
2228
  url: string;
2316
2229
  } | {
2317
2230
  timestamp: number;
2318
2231
  surveyId: string;
2319
- type: ReplayEventType.SurveyShown;
2232
+ type: "Sprig_ShowSurvey";
2320
2233
  } | {
2321
2234
  timestamp: number;
2322
2235
  surveyId: string;
2323
- type: ReplayEventType.SurveySubmitted;
2236
+ type: "Sprig_SubmitSurvey";
2324
2237
  };
2325
2238
 
2239
+ interface RecordedTaskResponseType {
2240
+ questionId: number;
2241
+ type: CardType;
2242
+ value: RecordedTaskResponseValueType;
2243
+ }
2244
+
2326
2245
  interface MobileReplayConfig {
2246
+ mobileMetricsReportingEnabled?: boolean;
2247
+ metricsReportingInterval?: number;
2248
+ metricsThresholds?: MetricThreshold[];
2327
2249
  maxMobileReplayDurationSeconds?: number;
2328
2250
  mobileReplaySettings?: {
2329
2251
  hideAllFormContents: boolean;
@@ -2332,26 +2254,32 @@ interface MobileReplayConfig {
2332
2254
  };
2333
2255
  }
2334
2256
  type SprigEventMap = {
2335
- [InternalEventName.CurrentQuestion]: [
2257
+ "survey.question": [
2336
2258
  {
2337
- [InternalEventData.QuestionId]: number;
2338
- [InternalEventData.Props]: unknown;
2259
+ qid: number;
2260
+ props: unknown;
2339
2261
  }
2340
2262
  ];
2341
- [InternalEventName.RecordedTaskPermissionScreen]: [];
2342
- [InternalEventName.RecordedTaskStart]: [];
2343
- [InternalEventName.SurveyComplete]: [];
2344
- [InternalEventName.VerifyViewVersion]: [
2263
+ "recorded.task.permission.screen": [];
2264
+ "recorded.task.start": [];
2265
+ "survey.complete": [number];
2266
+ "verify.view.version": [
2345
2267
  {
2346
- [InternalEventData.ViewVersion]: string;
2268
+ "view.version": string;
2347
2269
  }
2348
2270
  ];
2349
2271
  [SprigEvent.CloseSurveyOnOverlayClick]: [];
2272
+ [SprigEvent.FeedbackButtonLoaded]: [
2273
+ {
2274
+ name: string;
2275
+ "survey.id"?: number;
2276
+ }
2277
+ ];
2350
2278
  [SprigEvent.SDKReady]: [MobileReplayConfig];
2351
2279
  [SprigEvent.SurveyAppeared]: [
2352
2280
  {
2353
2281
  name: string;
2354
- [SprigEventData.SurveyId]: number;
2282
+ "survey.id": number;
2355
2283
  }
2356
2284
  ];
2357
2285
  [SprigEvent.SurveyDimensions]: [
@@ -2365,6 +2293,7 @@ type SprigEventMap = {
2365
2293
  {
2366
2294
  initiator?: string;
2367
2295
  name: string;
2296
+ studyType?: StudyType;
2368
2297
  }
2369
2298
  ];
2370
2299
  [SprigEvent.SurveyFadingOut]: [];
@@ -2386,19 +2315,20 @@ type SprigEventMap = {
2386
2315
  [SprigEvent.SurveyPresented]: [
2387
2316
  {
2388
2317
  name: string;
2389
- [SprigEventData.SurveyId]: number;
2318
+ "survey.id": number;
2390
2319
  }
2391
2320
  ];
2392
2321
  [SprigEvent.SurveyWillClose]: [
2393
2322
  {
2394
2323
  initiator: DismissReason;
2395
2324
  name?: string;
2325
+ studyType?: StudyType;
2396
2326
  }
2397
2327
  ];
2398
2328
  [SprigEvent.SurveyWillPresent]: [
2399
2329
  {
2400
2330
  name: string;
2401
- [SprigEventData.SurveyId]: number;
2331
+ "survey.id": number;
2402
2332
  }
2403
2333
  ];
2404
2334
  [SprigEvent.VisitorIDUpdated]: [{
@@ -2418,47 +2348,56 @@ type SprigEventMap = {
2418
2348
  uploadId: string;
2419
2349
  seconds: number;
2420
2350
  replayType: ReplayDurationType;
2421
- 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
+ };
2422
2361
  surveyId: number;
2423
2362
  }
2424
2363
  ];
2425
- [SprigRecordingEvent.AvPermission]: [
2364
+ "av.permission": [
2426
2365
  {
2427
- [SprigRecordingEventData.StreamReadyCallback]: (avStream: MediaStream | null, captureStream?: MediaStream | null) => void;
2428
- [SprigRecordingEventData.PermissionDescriptors]: AvPermission[];
2366
+ "stream.ready": (avStream: MediaStream | null, captureStream?: MediaStream | null) => void;
2367
+ "permission.descriptors": AvPermission[];
2429
2368
  }
2430
2369
  ];
2431
- [SprigRecordingEvent.BeginRecording]: [
2370
+ "begin.recording": [
2432
2371
  {
2433
- [SprigRecordingEventData.RecordingMediaTypes]: MediaType[];
2434
- [SprigRecordingEventData.StartRecordingCallback]: (mediaRecordingUids: UUID[]) => void;
2372
+ "recording.media.types": MediaType[];
2373
+ "start.recording.callback": (mediaRecordingUids: UUID[]) => void;
2435
2374
  }
2436
2375
  ];
2437
- [SprigRecordingEvent.FinishTask]: [
2376
+ "finish.task": [
2438
2377
  {
2439
- [SprigRecordingEventData.BeginCallback]: (mediaRecordingUid: UUID) => void;
2440
- [SprigRecordingEventData.CurrentIndex]: number;
2441
- [SprigRecordingEventData.PassthroughData]: PassthroughData;
2442
- [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: {
2443
2382
  detail: number;
2444
2383
  }) => void;
2445
- [SprigRecordingEventData.TaskCompleteCallback]: (taskDurationMillisecond: number) => void;
2446
- [SprigRecordingEventData.TaskResponse]: RecordedTaskResponseType;
2447
- [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;
2448
2387
  }
2449
2388
  ];
2450
- [SprigRecordingEvent.PermissionStatus]: [
2389
+ "permission.status": [
2451
2390
  {
2452
- [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;
2453
2392
  }
2454
2393
  ];
2455
- [SprigRecordingEvent.ScreenPermission]: [
2394
+ "screen.permission": [
2456
2395
  {
2457
- [SprigRecordingEventData.ScreenPermissionRequested]?: (data: boolean) => void;
2458
- [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;
2459
2398
  }
2460
2399
  ];
2461
- [SprigRecordingEvent.StartTask]: [];
2400
+ "start.task": [];
2462
2401
  };
2463
2402
  declare const eventEmitter: Emitter<SprigEventMap>;
2464
2403
  type SprigEventEmitter = typeof eventEmitter;
@@ -2471,42 +2410,20 @@ declare const LogLevels: {
2471
2410
  };
2472
2411
  type LogLevel = (typeof LogLevels)[keyof typeof LogLevels];
2473
2412
 
2474
- declare const enum FramePosition {
2475
- BottomLeft = "bottomLeft",
2476
- BottomRight = "bottomRight",
2477
- Center = "center",
2478
- TopLeft = "topLeft",
2479
- TopRight = "topRight"
2480
- }
2481
- declare const enum HttpHeader {
2482
- Error = "x-ul-error",
2483
- EnvironmentID = "x-ul-environment-id",
2484
- InstallationMethod = "x-ul-installation-method",
2485
- PartnerAnonymousId = "x-ul-anonymous-id",
2486
- Platform = "userleap-platform",
2487
- PreviewMode = "x-ul-preview-mode",
2488
- UserID = "x-ul-user-id",
2489
- VisitorID = "x-ul-visitor-id"
2490
- }
2491
- declare const enum Platform {
2492
- Email = "email",
2493
- Link = "link",
2494
- Web = "web"
2495
- }
2496
- declare const enum InstallationMethod {
2497
- Npm = "web-npm",
2498
- NpmBundled = "web-npm-bundled",
2499
- Gtm = "web-gtm",
2500
- Segment = "web-segment",
2501
- SegmentAndroid = "android-segment",
2502
- SegmentReactNative = "react-native-segment",
2503
- SegmentIOS = "ios-segment",
2504
- Snippet = "web-snippet"
2505
- }
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";
2506
2416
  interface Answer {
2507
2417
  questionId: number;
2508
2418
  value: unknown;
2509
2419
  }
2420
+ type FeedbackPlacement = "center-left" | "center-right" | "bottom-left" | "bottom-right";
2421
+ type FeedbackDesktopDisplay = "center-modal" | "slider";
2422
+ interface AppProductConfig {
2423
+ framePosition?: FramePosition;
2424
+ desktopDisplay?: FeedbackDesktopDisplay;
2425
+ placement?: FeedbackPlacement;
2426
+ }
2510
2427
  interface Config extends MobileReplayConfig {
2511
2428
  allResponses: unknown[];
2512
2429
  answers?: Answer[];
@@ -2550,23 +2467,25 @@ interface Config extends MobileReplayConfig {
2550
2467
  "accept-language"?: string;
2551
2468
  /** @example "Bearer 123" */
2552
2469
  Authorization?: string;
2553
- "Content-Type": string;
2554
- "userleap-platform": Platform;
2470
+ "Content-Type"?: string;
2471
+ "userleap-platform": Platform | "ios" | "android" | "video_recorder";
2555
2472
  /** @example "SJcVfq-7QQ" */
2556
- [HttpHeader.EnvironmentID]?: string;
2557
- [HttpHeader.InstallationMethod]: InstallationMethod;
2558
- [HttpHeader.PartnerAnonymousId]?: string;
2559
- [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;
2560
2478
  /** @example "2.18.0" */
2561
- "x-ul-sdk-version": string;
2479
+ "x-ul-sdk-version"?: string;
2562
2480
  /** For web-bundled sdk */
2563
2481
  "x-ul-package-version"?: string;
2564
- [HttpHeader.UserID]?: string;
2565
- [HttpHeader.VisitorID]?: UUID;
2482
+ "x-ul-user-id"?: string;
2483
+ "x-ul-visitor-id"?: string;
2566
2484
  };
2567
2485
  installationMethod?: InstallationMethod;
2568
2486
  interactiveEvents: InteractiveEvent[];
2569
2487
  interactiveEventsHandler?: (e: MouseEvent) => void;
2488
+ isOnQuestionsTab?: boolean;
2570
2489
  isPreview?: boolean;
2571
2490
  launchDarklyEnabled?: boolean;
2572
2491
  locale: string;
@@ -2590,6 +2509,7 @@ interface Config extends MobileReplayConfig {
2590
2509
  platform?: Platform;
2591
2510
  previewKey?: string | null;
2592
2511
  previewLanguage?: string;
2512
+ productConfig?: AppProductConfig;
2593
2513
  replayNonce?: string;
2594
2514
  replaySettings?: object;
2595
2515
  requireUserIdForTracking: boolean;
@@ -2599,6 +2519,7 @@ interface Config extends MobileReplayConfig {
2599
2519
  slugName: null;
2600
2520
  startingQuestionIdx?: number | null;
2601
2521
  styleNonce?: string;
2522
+ studyType?: StudyType;
2602
2523
  surveyId: number;
2603
2524
  tabTitle: string;
2604
2525
  ulEvents: typeof SprigEvent;
@@ -2638,10 +2559,7 @@ declare class SprigQueue {
2638
2559
  empty(): void;
2639
2560
  }
2640
2561
 
2641
- declare enum SurveyState {
2642
- Ready = "ready",
2643
- NoSurvey = "no survey"
2644
- }
2562
+ type SurveyState = "ready" | "no survey";
2645
2563
 
2646
2564
  declare namespace optimizely {
2647
2565
  interface Optimizely {
@@ -2685,6 +2603,7 @@ declare namespace optimizely {
2685
2603
  declare namespace sprigConfig {
2686
2604
  type IdentifyResult = Promise<
2687
2605
  | {
2606
+ error?: Error;
2688
2607
  success: boolean;
2689
2608
  message?: string;
2690
2609
  surveyState?: SurveyState;
@@ -2722,6 +2641,7 @@ declare namespace sprigConfig {
2722
2641
  }) => Promise<string | null>;
2723
2642
  _previewSurvey: (surveyTemplateId: UUID) => void;
2724
2643
  _reviewSurvey: (surveyId: number) => void;
2644
+ _reportMetric: (name: Metric, value: number) => void;
2725
2645
 
2726
2646
  // external apis
2727
2647
  addListener: (event: SprigEvent, listener: SprigListener) => Promise<void>;
@@ -2888,13 +2808,17 @@ declare class SprigAPI {
2888
2808
  * Include external events emitted from Sprig
2889
2809
  */
2890
2810
  UPDATES: {
2811
+ FEEDBACK_BUTTON_LOADED: SprigEvent;
2891
2812
  SDK_READY: SprigEvent;
2892
2813
  SURVEY_APPEARED: SprigEvent;
2893
2814
  SURVEY_CLOSED: SprigEvent;
2894
2815
  SURVEY_DIMENSIONS: SprigEvent;
2895
2816
  SURVEY_FADING_OUT: SprigEvent;
2896
2817
  SURVEY_HEIGHT: SprigEvent;
2897
- 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
+ */
2898
2822
  SURVEY_PRESENTED: SprigEvent;
2899
2823
  SURVEY_LIFE_CYCLE: SprigEvent;
2900
2824
  SURVEY_WILL_CLOSE: SprigEvent;
@@ -2911,7 +2835,7 @@ declare class SprigAPI {
2911
2835
  PAGE_CHANGE: DismissReason;
2912
2836
  OVERRIDE: DismissReason;
2913
2837
  };
2914
- SURVEY_ID: SprigEventData;
2838
+ SURVEY_ID: string;
2915
2839
  };
2916
2840
  };
2917
2841
  /**