@sprig-technologies/sprig-bundled 1.1.3 → 1.1.4

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
@@ -1467,6 +1467,11 @@ declare class ChunkedStreamIterable implements AsyncIterable<Blob> {
1467
1467
  get chunkByteSize(): number;
1468
1468
  [Symbol.asyncIterator](): AsyncIterator<Blob>;
1469
1469
  }
1470
+ /**
1471
+ * Checks if an upload chunk was partially received (HTTP 308) and needs a retry.
1472
+ * Validates against the 'Range' header to ensure the full chunk was processed.
1473
+ */
1474
+ declare const isIncompleteChunkUploadNeedingRetry: (res: XhrResponse | undefined, _options?: any) => res is XhrResponse;
1470
1475
  declare type EventName = 'attempt' | 'attemptFailure' | 'chunkSuccess' | 'error' | 'offline' | 'online' | 'progress' | 'success';
1471
1476
  declare type AllowedMethods = 'PUT' | 'POST' | 'PATCH';
1472
1477
  interface UpChunkOptions {
@@ -1564,9 +1569,10 @@ type _mux_upchunk_UpChunk = UpChunk;
1564
1569
  declare const _mux_upchunk_UpChunk: typeof UpChunk;
1565
1570
  type _mux_upchunk_UpChunkOptions = UpChunkOptions;
1566
1571
  declare const _mux_upchunk_getChunkSizeError: typeof getChunkSizeError;
1572
+ declare const _mux_upchunk_isIncompleteChunkUploadNeedingRetry: typeof isIncompleteChunkUploadNeedingRetry;
1567
1573
  declare const _mux_upchunk_isValidChunkSize: typeof isValidChunkSize;
1568
1574
  declare namespace _mux_upchunk {
1569
- export { _mux_upchunk_ChunkedStreamIterable as ChunkedStreamIterable, type _mux_upchunk_ChunkedStreamIterableOptions as ChunkedStreamIterableOptions, _mux_upchunk_UpChunk as UpChunk, type _mux_upchunk_UpChunkOptions as UpChunkOptions, createUpload$1 as createUpload, _mux_upchunk_getChunkSizeError as getChunkSizeError, _mux_upchunk_isValidChunkSize as isValidChunkSize };
1575
+ export { _mux_upchunk_ChunkedStreamIterable as ChunkedStreamIterable, type _mux_upchunk_ChunkedStreamIterableOptions as ChunkedStreamIterableOptions, _mux_upchunk_UpChunk as UpChunk, type _mux_upchunk_UpChunkOptions as UpChunkOptions, createUpload$1 as createUpload, _mux_upchunk_getChunkSizeError as getChunkSizeError, _mux_upchunk_isIncompleteChunkUploadNeedingRetry as isIncompleteChunkUploadNeedingRetry, _mux_upchunk_isValidChunkSize as isValidChunkSize };
1570
1576
  }
1571
1577
 
1572
1578
  declare enum NOTIFICATION_TYPES {
@@ -1815,41 +1821,8 @@ declare class Emitter<Events extends EventMap> {
1815
1821
  rawListeners<EventName extends keyof Events>(eventName: EventName): Array<Listener<Events[EventName]>>;
1816
1822
  }
1817
1823
 
1818
- declare const enum MediaType {
1819
- Video = "video",
1820
- Audio = "audio",
1821
- Screen = "screen"
1822
- }
1823
- declare const enum SprigRecordingEvent {
1824
- PermissionStatus = "permission.status",
1825
- AvPermission = "av.permission",
1826
- ScreenPermission = "screen.permission",
1827
- BeginRecording = "begin.recording",
1828
- StartTask = "start.task",
1829
- FinishTask = "finish.task"
1830
- }
1831
- declare const enum TaskStatus {
1832
- Abandoned = "abandoned",
1833
- GivenUp = "given.up",
1834
- Completed = "completed"
1835
- }
1836
- declare const enum SprigRecordingEventData {
1837
- ScreenPermissionRequested = "screen.permission.requested",
1838
- PermissionDescriptors = "permission.descriptors",
1839
- PermissionStatusCallback = "permission.status.callback",
1840
- StreamReadyCallback = "stream.ready.callback",
1841
- StreamCanceledCallback = "stream.canceled.callback",
1842
- TaskCompleteCallback = "task.complete.callback",
1843
- TaskResponse = "task.response",
1844
- TaskStatus = "task.status",
1845
- RecordingMediaTypes = "recording.media.types",
1846
- StartRecordingCallback = "start.recording.callback",
1847
- PassthroughData = "passthrough.data",
1848
- CurrentIndex = "current.index",
1849
- UploadCallback = "upload.callback",
1850
- ProgressCallback = "progress.callback",
1851
- BeginCallback = "begin.callback"
1852
- }
1824
+ type MediaType = "video" | "audio" | "screen";
1825
+ type TaskStatus = "abandoned" | "given.up" | "completed";
1853
1826
  interface PassthroughData {
1854
1827
  questionId: number;
1855
1828
  surveyId: number;
@@ -1862,51 +1835,23 @@ interface RecordedTaskResponseValueType {
1862
1835
  taskDurationMillisecond?: number;
1863
1836
  taskStatus: TaskStatus;
1864
1837
  }
1865
- declare enum BooleanOperator {
1866
- And = 1,
1867
- Or = 2
1868
- }
1838
+ declare const BOOLEAN_OPERATOR: {
1839
+ readonly And: 1;
1840
+ readonly Or: 2;
1841
+ };
1842
+ type BooleanOperator = (typeof BOOLEAN_OPERATOR)[keyof typeof BOOLEAN_OPERATOR];
1869
1843
 
1870
- declare const enum CardType {
1871
- ConsentLegal = "consentlegal",
1872
- Likert = "likert",
1873
- Matrix = "matrix",
1874
- MultipleChoice = "multiplechoice",
1875
- MultipleSelect = "multipleselect",
1876
- NPS = "nps",
1877
- Open = "open",
1878
- RecordedTask = "recordedtask",
1879
- TextUrlPrompt = "texturlprompt",
1880
- Thanks = "thanks",
1881
- Uploading = "uploading",
1882
- VideoVoice = "videovoice"
1883
- }
1844
+ type CardType = "consentlegal" | "likert" | "matrix" | "multiplechoice" | "multipleselect" | "nps" | "open" | "recordedtask" | "texturlprompt" | "thanks" | "uploading" | "videovoice";
1884
1845
  type ConceptUrl = string | null;
1885
1846
  interface BaseCard {
1886
1847
  name: number;
1887
1848
  surveyId: number;
1888
1849
  updatedAt: string;
1889
1850
  value?: unknown;
1851
+ type: CardType;
1890
1852
  }
1891
- declare const enum Comparator {
1892
- Answered = "answered",
1893
- Contains = "contains",
1894
- DoesNotContain = "notcontains",
1895
- DoesNotInclude = "list_dni",
1896
- Equal = "eq",
1897
- GivenUp = "given_up",
1898
- GreaterThan = "gt",
1899
- GreaterThanOrEqual = "gte",
1900
- LessThan = "lt",
1901
- LessThanOrEqual = "lte",
1902
- ListAll = "list_all",
1903
- ListAtLeastOne = "list_alo",
1904
- ListExact = "list_exact",
1905
- NotEqual = "neq",
1906
- Partial = "partial",
1907
- Skipped = "skipped"
1908
- }
1909
- 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">;
1910
1855
  type RoutingOption<C extends Comparator = DefaultComparator> = OldRoutingOption<C> | GroupRoutingOption;
1911
1856
  type OldRoutingOption<C extends Comparator = DefaultComparator> = {
1912
1857
  comparator: C;
@@ -1928,10 +1873,7 @@ type RoutingGroupOption = {
1928
1873
  type RoutingOptions<C extends Comparator = DefaultComparator> = RoutingOption<C | DefaultComparator>[] | null;
1929
1874
  /** @example <p>Body</p> */
1930
1875
  type RichTextBody = string;
1931
- declare const enum PromptActionType {
1932
- Continue = "CONTINUE",
1933
- External = "EXTERNAL"
1934
- }
1876
+ type PromptActionType = "CONTINUE" | "EXTERNAL";
1935
1877
  interface TextUrlPromptCard extends BaseCard {
1936
1878
  props: {
1937
1879
  message: string;
@@ -1948,13 +1890,9 @@ interface TextUrlPromptCard extends BaseCard {
1948
1890
  };
1949
1891
  routingOptions: RoutingOptions;
1950
1892
  };
1951
- type: CardType.TextUrlPrompt;
1952
- }
1953
- declare const enum AvPermission {
1954
- Camera = "camera",
1955
- Microphone = "microphone",
1956
- Screen = "screen"
1893
+ type: "texturlprompt";
1957
1894
  }
1895
+ type AvPermission = "camera" | "microphone" | "screen";
1958
1896
  interface ConsentLegalCard extends BaseCard {
1959
1897
  props: {
1960
1898
  message: string;
@@ -1977,18 +1915,14 @@ interface ConsentLegalCard extends BaseCard {
1977
1915
  };
1978
1916
  routingOptions: RoutingOptions;
1979
1917
  };
1980
- type: CardType.ConsentLegal;
1918
+ type: "consentlegal";
1981
1919
  }
1982
1920
  interface BaseTaskPage {
1983
1921
  buttonText: string;
1984
1922
  headline: string;
1923
+ type: RecordedTaskPageType;
1985
1924
  }
1986
- declare const enum RecordedTaskPageType {
1987
- AvPermission = "av_permission",
1988
- ScreenPermission = "screen_permission",
1989
- StartTask = "start_task",
1990
- CompleteTask = "complete_task"
1991
- }
1925
+ type RecordedTaskPageType = "av_permission" | "screen_permission" | "start_task" | "complete_task";
1992
1926
  interface PermissionTaskPage extends BaseTaskPage {
1993
1927
  captionText: string;
1994
1928
  headline: string;
@@ -2000,7 +1934,7 @@ interface PermissionTaskPage extends BaseTaskPage {
2000
1934
  skipButtonText?: string;
2001
1935
  svg: string;
2002
1936
  tryAgainButtonText: string;
2003
- type: RecordedTaskPageType.AvPermission;
1937
+ type: "av_permission";
2004
1938
  }
2005
1939
  interface ScreenTaskPage extends BaseTaskPage {
2006
1940
  captionText: string;
@@ -2008,19 +1942,19 @@ interface ScreenTaskPage extends BaseTaskPage {
2008
1942
  permissionDeniedHeadline: string;
2009
1943
  selectTabText: string;
2010
1944
  skipButtonText: string;
2011
- type: RecordedTaskPageType.ScreenPermission;
1945
+ type: "screen_permission";
2012
1946
  }
2013
1947
  interface StartTaskPage extends BaseTaskPage {
2014
1948
  captionText?: string;
2015
1949
  skipButtonText: string;
2016
1950
  taskDetail: string;
2017
- type: RecordedTaskPageType.StartTask;
1951
+ type: "start_task";
2018
1952
  }
2019
1953
  interface CompleteTaskPage extends BaseTaskPage {
2020
1954
  captionText?: string;
2021
1955
  skipButtonText: string;
2022
1956
  taskDetail: string;
2023
- type: RecordedTaskPageType.CompleteTask;
1957
+ type: "complete_task";
2024
1958
  }
2025
1959
  type RecordedTaskPage = PermissionTaskPage | ScreenTaskPage | StartTaskPage | CompleteTaskPage;
2026
1960
  interface RecordedTaskCardProperties {
@@ -2036,9 +1970,9 @@ interface RecordedTaskCard extends BaseCard {
2036
1970
  message: string;
2037
1971
  options: [];
2038
1972
  properties: RecordedTaskCardProperties;
2039
- routingOptions: RoutingOptions<Comparator.GivenUp>;
1973
+ routingOptions: RoutingOptions<"given_up">;
2040
1974
  };
2041
- type: CardType.RecordedTask;
1975
+ type: "recordedtask";
2042
1976
  }
2043
1977
  interface Labels {
2044
1978
  left: string;
@@ -2048,11 +1982,7 @@ interface RatingIcon {
2048
1982
  idx?: number;
2049
1983
  svg: string;
2050
1984
  }
2051
- declare enum ScaleLabelType {
2052
- Number = "number",
2053
- Smiley = "smiley",
2054
- Star = "star"
2055
- }
1985
+ type ScaleLabelType = "number" | "smiley" | "star";
2056
1986
  interface LikertCard extends BaseCard {
2057
1987
  props: {
2058
1988
  labels: Labels;
@@ -2068,9 +1998,9 @@ interface LikertCard extends BaseCard {
2068
1998
  scaleLabelType: ScaleLabelType;
2069
1999
  required: boolean;
2070
2000
  };
2071
- 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">;
2072
2002
  };
2073
- type: CardType.Likert;
2003
+ type: "likert";
2074
2004
  }
2075
2005
  interface OpenTextCard extends BaseCard {
2076
2006
  props: {
@@ -2081,14 +2011,15 @@ interface OpenTextCard extends BaseCard {
2081
2011
  buttonText?: string;
2082
2012
  captionText?: string;
2083
2013
  conceptUrl: ConceptUrl;
2014
+ footerHtml?: string;
2084
2015
  openTextPlaceholder?: string;
2085
2016
  required: boolean;
2086
2017
  richTextBody: RichTextBody;
2087
2018
  skipButtonText?: string;
2088
2019
  };
2089
- routingOptions: RoutingOptions<Comparator.Contains | Comparator.DoesNotContain>;
2020
+ routingOptions: RoutingOptions<"contains" | "notcontains">;
2090
2021
  };
2091
- type: CardType.Open;
2022
+ type: "open";
2092
2023
  }
2093
2024
  interface MultipleChoiceOption {
2094
2025
  createdAt: string;
@@ -2114,6 +2045,15 @@ interface CommonMultipleChoiceProps {
2114
2045
  buttonText?: string;
2115
2046
  captionText: string;
2116
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;
2117
2057
  randomize: "none" | "all";
2118
2058
  required: boolean;
2119
2059
  };
@@ -2123,17 +2063,17 @@ interface MultiChoiceCard<C extends Comparator = DefaultComparator> extends Base
2123
2063
  routingOptions: RoutingOptions<C>;
2124
2064
  };
2125
2065
  }
2126
- interface MultipleChoiceSingleSelectCard extends MultiChoiceCard<Comparator.Equal | Comparator.NotEqual | Comparator.ListAtLeastOne | Comparator.DoesNotInclude> {
2127
- type: CardType.MultipleChoice;
2066
+ interface MultipleChoiceSingleSelectCard extends MultiChoiceCard<"eq" | "neq" | "list_alo" | "list_dni"> {
2067
+ type: "multiplechoice";
2128
2068
  }
2129
- interface MultipleChoiceMultiSelectCard extends MultiChoiceCard<Comparator.ListAll | Comparator.ListAtLeastOne | Comparator.ListExact | Comparator.DoesNotInclude> {
2130
- type: CardType.MultipleSelect;
2069
+ interface MultipleChoiceMultiSelectCard extends MultiChoiceCard<"list_all" | "list_alo" | "list_exact" | "list_dni"> {
2070
+ type: "multipleselect";
2131
2071
  }
2132
2072
  interface MatrixCard extends BaseCard {
2133
2073
  props: {
2134
2074
  options: MultipleChoiceOption[];
2135
2075
  message: string;
2136
- routingOptions: RoutingOptions<Comparator.Skipped | Comparator.Partial | Comparator.Answered>;
2076
+ routingOptions: RoutingOptions<"skipped" | "partial" | "answered">;
2137
2077
  properties: {
2138
2078
  buttonText?: string;
2139
2079
  captionText: string;
@@ -2146,7 +2086,7 @@ interface MatrixCard extends BaseCard {
2146
2086
  required: boolean;
2147
2087
  };
2148
2088
  };
2149
- type: CardType.Matrix;
2089
+ type: "matrix";
2150
2090
  }
2151
2091
  interface NPSCard extends BaseCard {
2152
2092
  props: {
@@ -2166,9 +2106,9 @@ interface NPSCard extends BaseCard {
2166
2106
  };
2167
2107
  required: boolean;
2168
2108
  };
2169
- routingOptions: RoutingOptions<Comparator.Equal | Comparator.GreaterThan | Comparator.GreaterThanOrEqual | Comparator.LessThan | Comparator.LessThanOrEqual | Comparator.NotEqual>;
2109
+ routingOptions: RoutingOptions<"eq" | "gt" | "gte" | "lt" | "lte" | "neq">;
2170
2110
  };
2171
- type: CardType.NPS;
2111
+ type: "nps";
2172
2112
  }
2173
2113
  interface VideoVoiceCard extends BaseCard {
2174
2114
  props: {
@@ -2178,6 +2118,7 @@ interface VideoVoiceCard extends BaseCard {
2178
2118
  buttonText: string;
2179
2119
  captionText: string;
2180
2120
  conceptUrl: null;
2121
+ hideRecordedPrompt?: boolean;
2181
2122
  mediaType: "video" | "audio";
2182
2123
  required: boolean;
2183
2124
  skipButtonText: string;
@@ -2186,14 +2127,15 @@ interface VideoVoiceCard extends BaseCard {
2186
2127
  };
2187
2128
  routingOptions: RoutingOptions;
2188
2129
  };
2189
- type: CardType.VideoVoice;
2130
+ type: "videovoice";
2190
2131
  }
2191
2132
  type Card = TextUrlPromptCard | ConsentLegalCard | RecordedTaskCard | LikertCard | OpenTextCard | MatrixCard | MultipleChoiceSingleSelectCard | MultipleChoiceMultiSelectCard | NPSCard | VideoVoiceCard;
2192
2133
 
2193
- type MatchType = "exactly" | "legacy";
2134
+ type InteractiveMatchType = "exactly" | "legacy";
2135
+ type PageUrlMatchType = "contains" | "exactly" | "legacy" | "notContains" | "regex" | "startsWith";
2194
2136
  interface InteractiveEvent {
2195
2137
  id: number;
2196
- matchType: MatchType;
2138
+ matchType: InteractiveMatchType;
2197
2139
  name: string;
2198
2140
  pattern: string;
2199
2141
  properties: {
@@ -2204,19 +2146,22 @@ interface InteractiveEvent {
2204
2146
  }
2205
2147
  interface PageUrlEvent {
2206
2148
  id: number;
2207
- matchType: MatchType | "contains" | "notContains" | "regex" | "startsWith";
2149
+ matchType: PageUrlMatchType;
2208
2150
  pattern: string;
2209
2151
  }
2210
2152
 
2211
2153
  declare enum DismissReason {
2212
2154
  Closed = "close.click",
2213
2155
  Complete = "survey.completed",
2156
+ FeedbackClosed = "feedback.closed",
2214
2157
  PageChange = "page.change",
2215
2158
  API = "api",
2216
2159
  Override = "override"
2217
2160
  }
2161
+ type StudyType = "feedbackButton" | "inProductSurvey";
2218
2162
  declare enum SprigEvent {
2219
2163
  ReplayCapture = "replay.capture",
2164
+ FeedbackButtonLoaded = "feedback.button.loaded",
2220
2165
  SDKReady = "sdk.ready",
2221
2166
  SurveyAppeared = "survey.appeared",
2222
2167
  SurveyClosed = "survey.closed",
@@ -2232,10 +2177,8 @@ declare enum SprigEvent {
2232
2177
  VisitorIDUpdated = "visitor.id.updated",
2233
2178
  QuestionAnswered = "question.answered"
2234
2179
  }
2235
- declare enum SprigEventData {
2236
- SurveyId = "survey.id"
2237
- }
2238
2180
  declare const EVENTS: {
2181
+ FEEDBACK_BUTTON_LOADED: SprigEvent;
2239
2182
  SDK_READY: SprigEvent;
2240
2183
  SURVEY_APPEARED: SprigEvent;
2241
2184
  SURVEY_CLOSED: SprigEvent;
@@ -2259,65 +2202,50 @@ declare const EVENTS: {
2259
2202
  PAGE_CHANGE: DismissReason;
2260
2203
  OVERRIDE: DismissReason;
2261
2204
  };
2262
- SURVEY_ID: SprigEventData;
2205
+ SURVEY_ID: string;
2263
2206
  };
2264
2207
  };
2265
- declare const enum InternalEventName {
2266
- VerifyViewVersion = "verify.view.version",
2267
- CurrentQuestion = "survey.question",
2268
- ViewPrototypeClick = "question.prototype.click",
2269
- ViewAgreementClick = "question.agreement.click",
2270
- RecordedTaskStart = "recorded.task.start",
2271
- RecordedTaskPermissionScreen = "recorded.task.permission.screen",
2272
- SurveyComplete = "survey.complete"
2273
- }
2274
- declare const enum InternalEventData {
2275
- ViewVersion = "view.version",
2276
- QuestionId = "qid",
2277
- Props = "props"
2278
- }
2279
2208
 
2280
- interface RecordedTaskResponseType {
2281
- questionId: number;
2282
- type: CardType;
2283
- 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;
2284
2215
  }
2285
2216
 
2286
- declare enum ReplayDurationType {
2287
- After = "after",
2288
- Before = "before",
2289
- BeforeAndAfter = "beforeAndAfter"
2290
- }
2291
- declare enum ReplayEventType {
2292
- Click = "Sprig_Click",
2293
- Event = "Sprig_TrackEvent",
2294
- PageView = "Sprig_PageView",
2295
- SurveyShown = "Sprig_ShowSurvey",
2296
- SurveySubmitted = "Sprig_SubmitSurvey",
2297
- Noop = "Sprig_Noop"
2298
- }
2217
+ type ReplayDurationType = "after" | "before" | "beforeAndAfter";
2299
2218
  type EventDigest = {
2300
2219
  timestamp: number;
2301
- type: ReplayEventType.Click;
2220
+ type: "Sprig_Click";
2302
2221
  } | {
2303
2222
  timestamp: number;
2304
2223
  name: string;
2305
- type: ReplayEventType.Event;
2224
+ type: "Sprig_TrackEvent";
2306
2225
  } | {
2307
2226
  timestamp: number;
2308
- type: ReplayEventType.PageView;
2227
+ type: "Sprig_PageView";
2309
2228
  url: string;
2310
2229
  } | {
2311
2230
  timestamp: number;
2312
2231
  surveyId: string;
2313
- type: ReplayEventType.SurveyShown;
2232
+ type: "Sprig_ShowSurvey";
2314
2233
  } | {
2315
2234
  timestamp: number;
2316
2235
  surveyId: string;
2317
- type: ReplayEventType.SurveySubmitted;
2236
+ type: "Sprig_SubmitSurvey";
2318
2237
  };
2319
2238
 
2239
+ interface RecordedTaskResponseType {
2240
+ questionId: number;
2241
+ type: CardType;
2242
+ value: RecordedTaskResponseValueType;
2243
+ }
2244
+
2320
2245
  interface MobileReplayConfig {
2246
+ mobileMetricsReportingEnabled?: boolean;
2247
+ metricsReportingInterval?: number;
2248
+ metricsThresholds?: MetricThreshold[];
2321
2249
  maxMobileReplayDurationSeconds?: number;
2322
2250
  mobileReplaySettings?: {
2323
2251
  hideAllFormContents: boolean;
@@ -2326,26 +2254,32 @@ interface MobileReplayConfig {
2326
2254
  };
2327
2255
  }
2328
2256
  type SprigEventMap = {
2329
- [InternalEventName.CurrentQuestion]: [
2257
+ "survey.question": [
2330
2258
  {
2331
- [InternalEventData.QuestionId]: number;
2332
- [InternalEventData.Props]: unknown;
2259
+ qid: number;
2260
+ props: unknown;
2333
2261
  }
2334
2262
  ];
2335
- [InternalEventName.RecordedTaskPermissionScreen]: [];
2336
- [InternalEventName.RecordedTaskStart]: [];
2337
- [InternalEventName.SurveyComplete]: [];
2338
- [InternalEventName.VerifyViewVersion]: [
2263
+ "recorded.task.permission.screen": [];
2264
+ "recorded.task.start": [];
2265
+ "survey.complete": [number];
2266
+ "verify.view.version": [
2339
2267
  {
2340
- [InternalEventData.ViewVersion]: string;
2268
+ "view.version": string;
2341
2269
  }
2342
2270
  ];
2343
2271
  [SprigEvent.CloseSurveyOnOverlayClick]: [];
2272
+ [SprigEvent.FeedbackButtonLoaded]: [
2273
+ {
2274
+ name: string;
2275
+ "survey.id"?: number;
2276
+ }
2277
+ ];
2344
2278
  [SprigEvent.SDKReady]: [MobileReplayConfig];
2345
2279
  [SprigEvent.SurveyAppeared]: [
2346
2280
  {
2347
2281
  name: string;
2348
- [SprigEventData.SurveyId]: number;
2282
+ "survey.id": number;
2349
2283
  }
2350
2284
  ];
2351
2285
  [SprigEvent.SurveyDimensions]: [
@@ -2359,6 +2293,7 @@ type SprigEventMap = {
2359
2293
  {
2360
2294
  initiator?: string;
2361
2295
  name: string;
2296
+ studyType?: StudyType;
2362
2297
  }
2363
2298
  ];
2364
2299
  [SprigEvent.SurveyFadingOut]: [];
@@ -2380,19 +2315,20 @@ type SprigEventMap = {
2380
2315
  [SprigEvent.SurveyPresented]: [
2381
2316
  {
2382
2317
  name: string;
2383
- [SprigEventData.SurveyId]: number;
2318
+ "survey.id": number;
2384
2319
  }
2385
2320
  ];
2386
2321
  [SprigEvent.SurveyWillClose]: [
2387
2322
  {
2388
2323
  initiator: DismissReason;
2389
2324
  name?: string;
2325
+ studyType?: StudyType;
2390
2326
  }
2391
2327
  ];
2392
2328
  [SprigEvent.SurveyWillPresent]: [
2393
2329
  {
2394
2330
  name: string;
2395
- [SprigEventData.SurveyId]: number;
2331
+ "survey.id": number;
2396
2332
  }
2397
2333
  ];
2398
2334
  [SprigEvent.VisitorIDUpdated]: [{
@@ -2412,47 +2348,56 @@ type SprigEventMap = {
2412
2348
  uploadId: string;
2413
2349
  seconds: number;
2414
2350
  replayType: ReplayDurationType;
2415
- 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
+ };
2416
2361
  surveyId: number;
2417
2362
  }
2418
2363
  ];
2419
- [SprigRecordingEvent.AvPermission]: [
2364
+ "av.permission": [
2420
2365
  {
2421
- [SprigRecordingEventData.StreamReadyCallback]: (avStream: MediaStream | null, captureStream?: MediaStream | null) => void;
2422
- [SprigRecordingEventData.PermissionDescriptors]: AvPermission[];
2366
+ "stream.ready": (avStream: MediaStream | null, captureStream?: MediaStream | null) => void;
2367
+ "permission.descriptors": AvPermission[];
2423
2368
  }
2424
2369
  ];
2425
- [SprigRecordingEvent.BeginRecording]: [
2370
+ "begin.recording": [
2426
2371
  {
2427
- [SprigRecordingEventData.RecordingMediaTypes]: MediaType[];
2428
- [SprigRecordingEventData.StartRecordingCallback]: (mediaRecordingUids: UUID[]) => void;
2372
+ "recording.media.types": MediaType[];
2373
+ "start.recording.callback": (mediaRecordingUids: UUID[]) => void;
2429
2374
  }
2430
2375
  ];
2431
- [SprigRecordingEvent.FinishTask]: [
2376
+ "finish.task": [
2432
2377
  {
2433
- [SprigRecordingEventData.BeginCallback]: (mediaRecordingUid: UUID) => void;
2434
- [SprigRecordingEventData.CurrentIndex]: number;
2435
- [SprigRecordingEventData.PassthroughData]: PassthroughData;
2436
- [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: {
2437
2382
  detail: number;
2438
2383
  }) => void;
2439
- [SprigRecordingEventData.TaskCompleteCallback]: (taskDurationMillisecond: number) => void;
2440
- [SprigRecordingEventData.TaskResponse]: RecordedTaskResponseType;
2441
- [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;
2442
2387
  }
2443
2388
  ];
2444
- [SprigRecordingEvent.PermissionStatus]: [
2389
+ "permission.status": [
2445
2390
  {
2446
- [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;
2447
2392
  }
2448
2393
  ];
2449
- [SprigRecordingEvent.ScreenPermission]: [
2394
+ "screen.permission": [
2450
2395
  {
2451
- [SprigRecordingEventData.ScreenPermissionRequested]?: (data: boolean) => void;
2452
- [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;
2453
2398
  }
2454
2399
  ];
2455
- [SprigRecordingEvent.StartTask]: [];
2400
+ "start.task": [];
2456
2401
  };
2457
2402
  declare const eventEmitter: Emitter<SprigEventMap>;
2458
2403
  type SprigEventEmitter = typeof eventEmitter;
@@ -2465,42 +2410,20 @@ declare const LogLevels: {
2465
2410
  };
2466
2411
  type LogLevel = (typeof LogLevels)[keyof typeof LogLevels];
2467
2412
 
2468
- declare const enum FramePosition {
2469
- BottomLeft = "bottomLeft",
2470
- BottomRight = "bottomRight",
2471
- Center = "center",
2472
- TopLeft = "topLeft",
2473
- TopRight = "topRight"
2474
- }
2475
- declare const enum HttpHeader {
2476
- Error = "x-ul-error",
2477
- EnvironmentID = "x-ul-environment-id",
2478
- InstallationMethod = "x-ul-installation-method",
2479
- PartnerAnonymousId = "x-ul-anonymous-id",
2480
- Platform = "userleap-platform",
2481
- PreviewMode = "x-ul-preview-mode",
2482
- UserID = "x-ul-user-id",
2483
- VisitorID = "x-ul-visitor-id"
2484
- }
2485
- declare const enum Platform {
2486
- Email = "email",
2487
- Link = "link",
2488
- Web = "web"
2489
- }
2490
- declare const enum InstallationMethod {
2491
- Npm = "web-npm",
2492
- NpmBundled = "web-npm-bundled",
2493
- Gtm = "web-gtm",
2494
- Segment = "web-segment",
2495
- SegmentAndroid = "android-segment",
2496
- SegmentReactNative = "react-native-segment",
2497
- SegmentIOS = "ios-segment",
2498
- Snippet = "web-snippet"
2499
- }
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";
2500
2416
  interface Answer {
2501
2417
  questionId: number;
2502
2418
  value: unknown;
2503
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
+ }
2504
2427
  interface Config extends MobileReplayConfig {
2505
2428
  allResponses: unknown[];
2506
2429
  answers?: Answer[];
@@ -2544,23 +2467,25 @@ interface Config extends MobileReplayConfig {
2544
2467
  "accept-language"?: string;
2545
2468
  /** @example "Bearer 123" */
2546
2469
  Authorization?: string;
2547
- "Content-Type": string;
2548
- "userleap-platform": Platform;
2470
+ "Content-Type"?: string;
2471
+ "userleap-platform": Platform | "ios" | "android" | "video_recorder";
2549
2472
  /** @example "SJcVfq-7QQ" */
2550
- [HttpHeader.EnvironmentID]?: string;
2551
- [HttpHeader.InstallationMethod]: InstallationMethod;
2552
- [HttpHeader.PartnerAnonymousId]?: string;
2553
- [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;
2554
2478
  /** @example "2.18.0" */
2555
- "x-ul-sdk-version": string;
2479
+ "x-ul-sdk-version"?: string;
2556
2480
  /** For web-bundled sdk */
2557
2481
  "x-ul-package-version"?: string;
2558
- [HttpHeader.UserID]?: string;
2559
- [HttpHeader.VisitorID]?: UUID;
2482
+ "x-ul-user-id"?: string;
2483
+ "x-ul-visitor-id"?: string;
2560
2484
  };
2561
2485
  installationMethod?: InstallationMethod;
2562
2486
  interactiveEvents: InteractiveEvent[];
2563
2487
  interactiveEventsHandler?: (e: MouseEvent) => void;
2488
+ isOnQuestionsTab?: boolean;
2564
2489
  isPreview?: boolean;
2565
2490
  launchDarklyEnabled?: boolean;
2566
2491
  locale: string;
@@ -2584,6 +2509,7 @@ interface Config extends MobileReplayConfig {
2584
2509
  platform?: Platform;
2585
2510
  previewKey?: string | null;
2586
2511
  previewLanguage?: string;
2512
+ productConfig?: AppProductConfig;
2587
2513
  replayNonce?: string;
2588
2514
  replaySettings?: object;
2589
2515
  requireUserIdForTracking: boolean;
@@ -2593,6 +2519,7 @@ interface Config extends MobileReplayConfig {
2593
2519
  slugName: null;
2594
2520
  startingQuestionIdx?: number | null;
2595
2521
  styleNonce?: string;
2522
+ studyType?: StudyType;
2596
2523
  surveyId: number;
2597
2524
  tabTitle: string;
2598
2525
  ulEvents: typeof SprigEvent;
@@ -2632,10 +2559,7 @@ declare class SprigQueue {
2632
2559
  empty(): void;
2633
2560
  }
2634
2561
 
2635
- declare enum SurveyState {
2636
- Ready = "ready",
2637
- NoSurvey = "no survey"
2638
- }
2562
+ type SurveyState = "ready" | "no survey";
2639
2563
 
2640
2564
  declare namespace optimizely {
2641
2565
  interface Optimizely {
@@ -2679,6 +2603,7 @@ declare namespace optimizely {
2679
2603
  declare namespace sprigConfig {
2680
2604
  type IdentifyResult = Promise<
2681
2605
  | {
2606
+ error?: Error;
2682
2607
  success: boolean;
2683
2608
  message?: string;
2684
2609
  surveyState?: SurveyState;
@@ -2716,6 +2641,7 @@ declare namespace sprigConfig {
2716
2641
  }) => Promise<string | null>;
2717
2642
  _previewSurvey: (surveyTemplateId: UUID) => void;
2718
2643
  _reviewSurvey: (surveyId: number) => void;
2644
+ _reportMetric: (name: Metric, value: number) => void;
2719
2645
 
2720
2646
  // external apis
2721
2647
  addListener: (event: SprigEvent, listener: SprigListener) => Promise<void>;
@@ -2882,13 +2808,17 @@ declare class SprigAPI {
2882
2808
  * Include external events emitted from Sprig
2883
2809
  */
2884
2810
  UPDATES: {
2811
+ FEEDBACK_BUTTON_LOADED: SprigEvent;
2885
2812
  SDK_READY: SprigEvent;
2886
2813
  SURVEY_APPEARED: SprigEvent;
2887
2814
  SURVEY_CLOSED: SprigEvent;
2888
2815
  SURVEY_DIMENSIONS: SprigEvent;
2889
2816
  SURVEY_FADING_OUT: SprigEvent;
2890
2817
  SURVEY_HEIGHT: SprigEvent;
2891
- 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
+ */
2892
2822
  SURVEY_PRESENTED: SprigEvent;
2893
2823
  SURVEY_LIFE_CYCLE: SprigEvent;
2894
2824
  SURVEY_WILL_CLOSE: SprigEvent;
@@ -2905,7 +2835,7 @@ declare class SprigAPI {
2905
2835
  PAGE_CHANGE: DismissReason;
2906
2836
  OVERRIDE: DismissReason;
2907
2837
  };
2908
- SURVEY_ID: SprigEventData;
2838
+ SURVEY_ID: string;
2909
2839
  };
2910
2840
  };
2911
2841
  /**