@sprig-technologies/sprig-bundled 1.1.2 → 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,16 +2177,15 @@ 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;
2242
2185
  SURVEY_DIMENSIONS: SprigEvent;
2243
2186
  SURVEY_FADING_OUT: SprigEvent;
2244
2187
  SURVEY_HEIGHT: SprigEvent;
2188
+ SURVEY_WIDTH: SprigEvent;
2245
2189
  SURVEY_PRESENTED: SprigEvent;
2246
2190
  SURVEY_LIFE_CYCLE: SprigEvent;
2247
2191
  SURVEY_WILL_CLOSE: SprigEvent;
@@ -2258,65 +2202,50 @@ declare const EVENTS: {
2258
2202
  PAGE_CHANGE: DismissReason;
2259
2203
  OVERRIDE: DismissReason;
2260
2204
  };
2261
- SURVEY_ID: SprigEventData;
2205
+ SURVEY_ID: string;
2262
2206
  };
2263
2207
  };
2264
- declare const enum InternalEventName {
2265
- VerifyViewVersion = "verify.view.version",
2266
- CurrentQuestion = "survey.question",
2267
- ViewPrototypeClick = "question.prototype.click",
2268
- ViewAgreementClick = "question.agreement.click",
2269
- RecordedTaskStart = "recorded.task.start",
2270
- RecordedTaskPermissionScreen = "recorded.task.permission.screen",
2271
- SurveyComplete = "survey.complete"
2272
- }
2273
- declare const enum InternalEventData {
2274
- ViewVersion = "view.version",
2275
- QuestionId = "qid",
2276
- Props = "props"
2277
- }
2278
2208
 
2279
- interface RecordedTaskResponseType {
2280
- questionId: number;
2281
- type: CardType;
2282
- 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;
2283
2215
  }
2284
2216
 
2285
- declare enum ReplayDurationType {
2286
- After = "after",
2287
- Before = "before",
2288
- BeforeAndAfter = "beforeAndAfter"
2289
- }
2290
- declare enum ReplayEventType {
2291
- Click = "Sprig_Click",
2292
- Event = "Sprig_TrackEvent",
2293
- PageView = "Sprig_PageView",
2294
- SurveyShown = "Sprig_ShowSurvey",
2295
- SurveySubmitted = "Sprig_SubmitSurvey",
2296
- Noop = "Sprig_Noop"
2297
- }
2217
+ type ReplayDurationType = "after" | "before" | "beforeAndAfter";
2298
2218
  type EventDigest = {
2299
2219
  timestamp: number;
2300
- type: ReplayEventType.Click;
2220
+ type: "Sprig_Click";
2301
2221
  } | {
2302
2222
  timestamp: number;
2303
2223
  name: string;
2304
- type: ReplayEventType.Event;
2224
+ type: "Sprig_TrackEvent";
2305
2225
  } | {
2306
2226
  timestamp: number;
2307
- type: ReplayEventType.PageView;
2227
+ type: "Sprig_PageView";
2308
2228
  url: string;
2309
2229
  } | {
2310
2230
  timestamp: number;
2311
2231
  surveyId: string;
2312
- type: ReplayEventType.SurveyShown;
2232
+ type: "Sprig_ShowSurvey";
2313
2233
  } | {
2314
2234
  timestamp: number;
2315
2235
  surveyId: string;
2316
- type: ReplayEventType.SurveySubmitted;
2236
+ type: "Sprig_SubmitSurvey";
2317
2237
  };
2318
2238
 
2239
+ interface RecordedTaskResponseType {
2240
+ questionId: number;
2241
+ type: CardType;
2242
+ value: RecordedTaskResponseValueType;
2243
+ }
2244
+
2319
2245
  interface MobileReplayConfig {
2246
+ mobileMetricsReportingEnabled?: boolean;
2247
+ metricsReportingInterval?: number;
2248
+ metricsThresholds?: MetricThreshold[];
2320
2249
  maxMobileReplayDurationSeconds?: number;
2321
2250
  mobileReplaySettings?: {
2322
2251
  hideAllFormContents: boolean;
@@ -2325,26 +2254,32 @@ interface MobileReplayConfig {
2325
2254
  };
2326
2255
  }
2327
2256
  type SprigEventMap = {
2328
- [InternalEventName.CurrentQuestion]: [
2257
+ "survey.question": [
2329
2258
  {
2330
- [InternalEventData.QuestionId]: number;
2331
- [InternalEventData.Props]: unknown;
2259
+ qid: number;
2260
+ props: unknown;
2332
2261
  }
2333
2262
  ];
2334
- [InternalEventName.RecordedTaskPermissionScreen]: [];
2335
- [InternalEventName.RecordedTaskStart]: [];
2336
- [InternalEventName.SurveyComplete]: [];
2337
- [InternalEventName.VerifyViewVersion]: [
2263
+ "recorded.task.permission.screen": [];
2264
+ "recorded.task.start": [];
2265
+ "survey.complete": [number];
2266
+ "verify.view.version": [
2338
2267
  {
2339
- [InternalEventData.ViewVersion]: string;
2268
+ "view.version": string;
2340
2269
  }
2341
2270
  ];
2342
2271
  [SprigEvent.CloseSurveyOnOverlayClick]: [];
2272
+ [SprigEvent.FeedbackButtonLoaded]: [
2273
+ {
2274
+ name: string;
2275
+ "survey.id"?: number;
2276
+ }
2277
+ ];
2343
2278
  [SprigEvent.SDKReady]: [MobileReplayConfig];
2344
2279
  [SprigEvent.SurveyAppeared]: [
2345
2280
  {
2346
2281
  name: string;
2347
- [SprigEventData.SurveyId]: number;
2282
+ "survey.id": number;
2348
2283
  }
2349
2284
  ];
2350
2285
  [SprigEvent.SurveyDimensions]: [
@@ -2358,6 +2293,7 @@ type SprigEventMap = {
2358
2293
  {
2359
2294
  initiator?: string;
2360
2295
  name: string;
2296
+ studyType?: StudyType;
2361
2297
  }
2362
2298
  ];
2363
2299
  [SprigEvent.SurveyFadingOut]: [];
@@ -2379,19 +2315,20 @@ type SprigEventMap = {
2379
2315
  [SprigEvent.SurveyPresented]: [
2380
2316
  {
2381
2317
  name: string;
2382
- [SprigEventData.SurveyId]: number;
2318
+ "survey.id": number;
2383
2319
  }
2384
2320
  ];
2385
2321
  [SprigEvent.SurveyWillClose]: [
2386
2322
  {
2387
2323
  initiator: DismissReason;
2388
2324
  name?: string;
2325
+ studyType?: StudyType;
2389
2326
  }
2390
2327
  ];
2391
2328
  [SprigEvent.SurveyWillPresent]: [
2392
2329
  {
2393
2330
  name: string;
2394
- [SprigEventData.SurveyId]: number;
2331
+ "survey.id": number;
2395
2332
  }
2396
2333
  ];
2397
2334
  [SprigEvent.VisitorIDUpdated]: [{
@@ -2411,47 +2348,56 @@ type SprigEventMap = {
2411
2348
  uploadId: string;
2412
2349
  seconds: number;
2413
2350
  replayType: ReplayDurationType;
2414
- 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
+ };
2415
2361
  surveyId: number;
2416
2362
  }
2417
2363
  ];
2418
- [SprigRecordingEvent.AvPermission]: [
2364
+ "av.permission": [
2419
2365
  {
2420
- [SprigRecordingEventData.StreamReadyCallback]: (avStream: MediaStream | null, captureStream?: MediaStream | null) => void;
2421
- [SprigRecordingEventData.PermissionDescriptors]: AvPermission[];
2366
+ "stream.ready": (avStream: MediaStream | null, captureStream?: MediaStream | null) => void;
2367
+ "permission.descriptors": AvPermission[];
2422
2368
  }
2423
2369
  ];
2424
- [SprigRecordingEvent.BeginRecording]: [
2370
+ "begin.recording": [
2425
2371
  {
2426
- [SprigRecordingEventData.RecordingMediaTypes]: MediaType[];
2427
- [SprigRecordingEventData.StartRecordingCallback]: (mediaRecordingUids: UUID[]) => void;
2372
+ "recording.media.types": MediaType[];
2373
+ "start.recording.callback": (mediaRecordingUids: UUID[]) => void;
2428
2374
  }
2429
2375
  ];
2430
- [SprigRecordingEvent.FinishTask]: [
2376
+ "finish.task": [
2431
2377
  {
2432
- [SprigRecordingEventData.BeginCallback]: (mediaRecordingUid: UUID) => void;
2433
- [SprigRecordingEventData.CurrentIndex]: number;
2434
- [SprigRecordingEventData.PassthroughData]: PassthroughData;
2435
- [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: {
2436
2382
  detail: number;
2437
2383
  }) => void;
2438
- [SprigRecordingEventData.TaskCompleteCallback]: (taskDurationMillisecond: number) => void;
2439
- [SprigRecordingEventData.TaskResponse]: RecordedTaskResponseType;
2440
- [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;
2441
2387
  }
2442
2388
  ];
2443
- [SprigRecordingEvent.PermissionStatus]: [
2389
+ "permission.status": [
2444
2390
  {
2445
- [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;
2446
2392
  }
2447
2393
  ];
2448
- [SprigRecordingEvent.ScreenPermission]: [
2394
+ "screen.permission": [
2449
2395
  {
2450
- [SprigRecordingEventData.ScreenPermissionRequested]?: (data: boolean) => void;
2451
- [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;
2452
2398
  }
2453
2399
  ];
2454
- [SprigRecordingEvent.StartTask]: [];
2400
+ "start.task": [];
2455
2401
  };
2456
2402
  declare const eventEmitter: Emitter<SprigEventMap>;
2457
2403
  type SprigEventEmitter = typeof eventEmitter;
@@ -2462,44 +2408,22 @@ declare const LogLevels: {
2462
2408
  readonly Info: 3;
2463
2409
  readonly Debug: 4;
2464
2410
  };
2465
- type LogLevel = typeof LogLevels[keyof typeof LogLevels];
2411
+ type LogLevel = (typeof LogLevels)[keyof typeof LogLevels];
2466
2412
 
2467
- declare const enum FramePosition {
2468
- BottomLeft = "bottomLeft",
2469
- BottomRight = "bottomRight",
2470
- Center = "center",
2471
- TopLeft = "topLeft",
2472
- TopRight = "topRight"
2473
- }
2474
- declare const enum HttpHeader {
2475
- Error = "x-ul-error",
2476
- EnvironmentID = "x-ul-environment-id",
2477
- InstallationMethod = "x-ul-installation-method",
2478
- PartnerAnonymousId = "x-ul-anonymous-id",
2479
- Platform = "userleap-platform",
2480
- PreviewMode = "x-ul-preview-mode",
2481
- UserID = "x-ul-user-id",
2482
- VisitorID = "x-ul-visitor-id"
2483
- }
2484
- declare const enum Platform {
2485
- Email = "email",
2486
- Link = "link",
2487
- Web = "web"
2488
- }
2489
- declare const enum InstallationMethod {
2490
- Npm = "web-npm",
2491
- NpmBundled = "web-npm-bundled",
2492
- Gtm = "web-gtm",
2493
- Segment = "web-segment",
2494
- SegmentAndroid = "android-segment",
2495
- SegmentReactNative = "react-native-segment",
2496
- SegmentIOS = "ios-segment",
2497
- Snippet = "web-snippet"
2498
- }
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";
2499
2416
  interface Answer {
2500
2417
  questionId: number;
2501
2418
  value: unknown;
2502
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
+ }
2503
2427
  interface Config extends MobileReplayConfig {
2504
2428
  allResponses: unknown[];
2505
2429
  answers?: Answer[];
@@ -2543,23 +2467,25 @@ interface Config extends MobileReplayConfig {
2543
2467
  "accept-language"?: string;
2544
2468
  /** @example "Bearer 123" */
2545
2469
  Authorization?: string;
2546
- "Content-Type": string;
2547
- "userleap-platform": Platform;
2470
+ "Content-Type"?: string;
2471
+ "userleap-platform": Platform | "ios" | "android" | "video_recorder";
2548
2472
  /** @example "SJcVfq-7QQ" */
2549
- [HttpHeader.EnvironmentID]?: string;
2550
- [HttpHeader.InstallationMethod]: InstallationMethod;
2551
- [HttpHeader.PartnerAnonymousId]?: string;
2552
- [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;
2553
2478
  /** @example "2.18.0" */
2554
- "x-ul-sdk-version": string;
2479
+ "x-ul-sdk-version"?: string;
2555
2480
  /** For web-bundled sdk */
2556
2481
  "x-ul-package-version"?: string;
2557
- [HttpHeader.UserID]?: string;
2558
- [HttpHeader.VisitorID]?: UUID;
2482
+ "x-ul-user-id"?: string;
2483
+ "x-ul-visitor-id"?: string;
2559
2484
  };
2560
2485
  installationMethod?: InstallationMethod;
2561
2486
  interactiveEvents: InteractiveEvent[];
2562
2487
  interactiveEventsHandler?: (e: MouseEvent) => void;
2488
+ isOnQuestionsTab?: boolean;
2563
2489
  isPreview?: boolean;
2564
2490
  launchDarklyEnabled?: boolean;
2565
2491
  locale: string;
@@ -2583,6 +2509,7 @@ interface Config extends MobileReplayConfig {
2583
2509
  platform?: Platform;
2584
2510
  previewKey?: string | null;
2585
2511
  previewLanguage?: string;
2512
+ productConfig?: AppProductConfig;
2586
2513
  replayNonce?: string;
2587
2514
  replaySettings?: object;
2588
2515
  requireUserIdForTracking: boolean;
@@ -2592,6 +2519,7 @@ interface Config extends MobileReplayConfig {
2592
2519
  slugName: null;
2593
2520
  startingQuestionIdx?: number | null;
2594
2521
  styleNonce?: string;
2522
+ studyType?: StudyType;
2595
2523
  surveyId: number;
2596
2524
  tabTitle: string;
2597
2525
  ulEvents: typeof SprigEvent;
@@ -2631,10 +2559,7 @@ declare class SprigQueue {
2631
2559
  empty(): void;
2632
2560
  }
2633
2561
 
2634
- declare enum SurveyState {
2635
- Ready = "ready",
2636
- NoSurvey = "no survey"
2637
- }
2562
+ type SurveyState = "ready" | "no survey";
2638
2563
 
2639
2564
  declare namespace optimizely {
2640
2565
  interface Optimizely {
@@ -2678,6 +2603,7 @@ declare namespace optimizely {
2678
2603
  declare namespace sprigConfig {
2679
2604
  type IdentifyResult = Promise<
2680
2605
  | {
2606
+ error?: Error;
2681
2607
  success: boolean;
2682
2608
  message?: string;
2683
2609
  surveyState?: SurveyState;
@@ -2715,6 +2641,7 @@ declare namespace sprigConfig {
2715
2641
  }) => Promise<string | null>;
2716
2642
  _previewSurvey: (surveyTemplateId: UUID) => void;
2717
2643
  _reviewSurvey: (surveyId: number) => void;
2644
+ _reportMetric: (name: Metric, value: number) => void;
2718
2645
 
2719
2646
  // external apis
2720
2647
  addListener: (event: SprigEvent, listener: SprigListener) => Promise<void>;
@@ -2745,7 +2672,10 @@ declare namespace sprigConfig {
2745
2672
  ) => Promise<void>;
2746
2673
  removeSurveyListener: (listener: SprigListener) => Promise<void>;
2747
2674
  reviewSurvey: (surveyId: number) => void;
2748
- setAttribute: (attribute: string, value: string | number) => IdentifyResult;
2675
+ setAttribute: (
2676
+ attribute: string,
2677
+ value: string | number | boolean,
2678
+ ) => IdentifyResult;
2749
2679
  setAttributes: (attributes?: SprigAttributes) => IdentifyResult;
2750
2680
  setPartnerAnonymousId: (
2751
2681
  partnerAnonymousId: string,
@@ -2837,7 +2767,7 @@ declare global {
2837
2767
  };
2838
2768
  Intercom: { ul_wasVisible?: boolean } & ((
2839
2769
  method: string,
2840
- data: unknown,
2770
+ data?: unknown,
2841
2771
  ) => void);
2842
2772
  optimizely?: optimizely.Optimizely;
2843
2773
  optimizelyDatafile?: object;
@@ -2878,12 +2808,17 @@ declare class SprigAPI {
2878
2808
  * Include external events emitted from Sprig
2879
2809
  */
2880
2810
  UPDATES: {
2811
+ FEEDBACK_BUTTON_LOADED: SprigEvent;
2881
2812
  SDK_READY: SprigEvent;
2882
2813
  SURVEY_APPEARED: SprigEvent;
2883
2814
  SURVEY_CLOSED: SprigEvent;
2884
2815
  SURVEY_DIMENSIONS: SprigEvent;
2885
2816
  SURVEY_FADING_OUT: SprigEvent;
2886
2817
  SURVEY_HEIGHT: SprigEvent;
2818
+ SURVEY_WIDTH: SprigEvent; /**
2819
+ * Track an event to show survey if eligible
2820
+ * @param eventName name of event to track
2821
+ */
2887
2822
  SURVEY_PRESENTED: SprigEvent;
2888
2823
  SURVEY_LIFE_CYCLE: SprigEvent;
2889
2824
  SURVEY_WILL_CLOSE: SprigEvent;
@@ -2900,7 +2835,7 @@ declare class SprigAPI {
2900
2835
  PAGE_CHANGE: DismissReason;
2901
2836
  OVERRIDE: DismissReason;
2902
2837
  };
2903
- SURVEY_ID: SprigEventData;
2838
+ SURVEY_ID: string;
2904
2839
  };
2905
2840
  };
2906
2841
  /**
@@ -2922,7 +2857,7 @@ declare class SprigAPI {
2922
2857
  /**
2923
2858
  * Set an arbitrary attribute on the visitor
2924
2859
  */
2925
- setAttribute(attribute: string, value: string): void;
2860
+ setAttribute(attribute: string, value: string | number | boolean): void;
2926
2861
  /**
2927
2862
  * Set attributes on visitor
2928
2863
  */