@sprig-technologies/sprig-browser 2.19.7 → 2.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/index.cjs +687 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.d.ts +3 -0
  4. package/dist/index.js +6580 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/sprig-browser/index.d.ts +168 -0
  7. package/dist/src/constants/css.d.ts +43 -0
  8. package/dist/src/constants/sprigEvents.d.ts +62 -0
  9. package/dist/src/constants/sprigRecordingEvents.d.ts +40 -0
  10. package/dist/src/controller/OptimizelyIntegration.d.ts +40 -0
  11. package/dist/src/controller/Queue.d.ts +18 -0
  12. package/dist/src/controller/controller.d.ts +9 -0
  13. package/dist/src/controller/iframe.d.ts +17 -0
  14. package/dist/src/helpers/Deferred.d.ts +9 -0
  15. package/dist/src/helpers/conflicting_widgets/index.d.ts +4 -0
  16. package/dist/src/helpers/conflicting_widgets/intercom.d.ts +2 -0
  17. package/dist/src/helpers/document.d.ts +6 -0
  18. package/dist/src/helpers/eventEmitter.d.ts +85 -0
  19. package/dist/src/helpers/general.d.ts +9 -0
  20. package/dist/src/helpers/network.d.ts +15 -0
  21. package/dist/src/types/card.d.ts +292 -0
  22. package/dist/src/types/config.d.ts +232 -0
  23. package/dist/src/types/event.d.ts +18 -0
  24. package/dist/src/types/global.d.ts +179 -0
  25. package/dist/src/view/app.d.ts +3 -0
  26. package/dist/src/view/cards/consentLegalCard.d.ts +6 -0
  27. package/dist/src/view/cards/index.d.ts +10 -0
  28. package/dist/src/view/cards/likertCard/index.d.ts +1 -0
  29. package/dist/src/view/cards/likertCard/likertCard.d.ts +6 -0
  30. package/dist/src/view/cards/likertCard/likertOption.d.ts +16 -0
  31. package/dist/src/view/cards/multipleChoice/baseMultiChoiceCard.d.ts +15 -0
  32. package/dist/src/view/cards/multipleChoice/index.d.ts +2 -0
  33. package/dist/src/view/cards/multipleChoice/multiSelectCard.d.ts +5 -0
  34. package/dist/src/view/cards/multipleChoice/singleSelectCard.d.ts +5 -0
  35. package/dist/src/view/cards/npsCard.d.ts +8 -0
  36. package/dist/src/view/cards/openTextCard.d.ts +6 -0
  37. package/dist/src/view/cards/recordedTask/actions.d.ts +21 -0
  38. package/dist/src/view/cards/recordedTask/card.d.ts +5 -0
  39. package/dist/src/view/cards/recordedTask/components.d.ts +37 -0
  40. package/dist/src/view/cards/recordedTask/constants.d.ts +5 -0
  41. package/dist/src/view/cards/recordedTask/helpers.d.ts +6 -0
  42. package/dist/src/view/cards/recordedTask/index.d.ts +1 -0
  43. package/dist/src/view/cards/recordedTask/store.d.ts +24 -0
  44. package/dist/src/view/cards/textUrlPromptCard.d.ts +6 -0
  45. package/dist/src/view/cards/thanksCard.d.ts +5 -0
  46. package/dist/src/view/cards/types.d.ts +34 -0
  47. package/dist/src/view/cards/uploadingCard.d.ts +5 -0
  48. package/dist/src/view/cards/videoVoiceCard.d.ts +6 -0
  49. package/dist/src/view/components/header.d.ts +8 -0
  50. package/dist/src/view/components/index.d.ts +3 -0
  51. package/dist/src/view/components/mobileEmbedView.d.ts +19 -0
  52. package/dist/src/view/components/select.d.ts +25 -0
  53. package/dist/src/view/footer.d.ts +2 -0
  54. package/dist/src/view/helpers/card.d.ts +6 -0
  55. package/dist/src/view/helpers/getAttributedUrl.d.ts +6 -0
  56. package/dist/src/view/helpers/skipLogicHelpers.d.ts +34 -0
  57. package/dist/src/view/hooks/index.d.ts +1 -0
  58. package/dist/src/view/hooks/useAutoSize.d.ts +2 -0
  59. package/dist/src/view/logo.d.ts +5 -0
  60. package/dist/src/view/recorder/recorder.d.ts +2 -0
  61. package/dist/src/view/store.d.ts +2 -0
  62. package/dist/src/view/view.d.ts +6 -0
  63. package/dist/style.css +1 -0
  64. package/package.json +12 -10
  65. package/LICENSE.md +0 -176
  66. package/index.d.ts +0 -160
  67. package/index.js +0 -680
@@ -0,0 +1,179 @@
1
+ import { EVENTS } from "../constants/sprigEvents";
2
+ import { Config } from "./config";
3
+
4
+ declare namespace optimizely {
5
+ interface Optimizely {
6
+ get?: (key: "state") => {
7
+ getExperimentStates: (options: {
8
+ filter?: unknown;
9
+ isActive?: boolean;
10
+ }) => Record<string, OptimizelyExperimentState>;
11
+ };
12
+ }
13
+
14
+ // Ref: https://docs.developers.optimizely.com/web/docs/state#return-value-2
15
+ interface OptimizelyExperimentState {
16
+ /** Audiences the visitor was in when the experiment was activated.
17
+ * @example { "id": "6672770135", "name": "Chrome users" }
18
+ */
19
+ audiences: { id: number; name: string }[];
20
+ /** The name of the experiment
21
+ * @example OptimizelyExperimentState
22
+ * */
23
+ experimentName: string;
24
+ /** The ID of the experiment
25
+ * @example OptimizelyExperimentState
26
+ * */
27
+ id: string;
28
+ /** Indicates if the experiment is currently active */
29
+ isActive: boolean;
30
+ /** Indicates if the visitor is in the holdback (i.e., is excluded due traffic allocation) */
31
+ isInExperimentHoldback: boolean;
32
+ /** The name of the object. Required */
33
+ name: string;
34
+ /** An object with the name and the ID of the variation the visitor is bucketed in, or null if the visitor was not bucketed
35
+ * @example { "id": "6626731852", "name": "Variation #1" }
36
+ */
37
+ variation: { id: number; name: string } | null;
38
+ /** Indicates if the visitor was redirected due to this experiment */
39
+ visitorRedirected: boolean;
40
+ }
41
+ }
42
+
43
+ declare namespace upchunk {
44
+ type AllowedMethods = "PUT" | "POST" | "PATCH";
45
+
46
+ //Adapted from here: https://github.com/muxinc/upchunk/blob/master/src/upchunk.ts
47
+ export interface UpChunkOptions {
48
+ endpoint: string | ((file?: File) => Promise<string>);
49
+ file: File;
50
+ method?: AllowedMethods;
51
+ headers?: Headers;
52
+ maxFileSize?: number;
53
+ chunkSize?: number;
54
+ attempts?: number;
55
+ delayBeforeAttempt?: number;
56
+ retryCodes?: number[];
57
+ dynamicChunkSize?: boolean;
58
+ maxChunkSize?: number;
59
+ minChunkSize?: number;
60
+ }
61
+
62
+ type UpChunkEventName =
63
+ | "attempt"
64
+ | "attemptFailure"
65
+ | "chunkSuccess"
66
+ | "error"
67
+ | "offline"
68
+ | "online"
69
+ | "progress"
70
+ | "success";
71
+
72
+ export interface UpChunk {
73
+ startTime: number;
74
+ on: (eventName: UpChunkEventName, fn: (event: CustomEvent) => void) => void;
75
+ }
76
+ export interface UpChunkModule {
77
+ createUpload: (options: UpChunkOptions) => UpChunk;
78
+ }
79
+ }
80
+
81
+ type WindowSprig = Config & {
82
+ _API_URL: string;
83
+ _config: Config;
84
+ _gtm: unknown; // TODO: determine if boolean?
85
+ _queue: SprigQueue;
86
+ _segment: unknown; // TODO: determine if boolean?
87
+ appId: string;
88
+ container?: HTMLElement | null;
89
+ config: Config;
90
+ debugMode?: boolean;
91
+ delayingSurvey: boolean;
92
+ email?: string | null;
93
+ envId: string;
94
+ error?: Error;
95
+ frameId: string;
96
+ loaded: boolean;
97
+ locale?: string;
98
+ localStorageAvailable: boolean;
99
+ maxHeight?: number;
100
+ mobileHeadersJSON?: string;
101
+ nonce?: string;
102
+ partnerAnonymousId: string | null;
103
+ reportError: (name: string, err: Error) => void;
104
+ sampleRate?: unknown; // TODO: determine type
105
+ token: string | null;
106
+ UPDATES: typeof EVENTS;
107
+ viewSDKURL?: string;
108
+ windowDimensions?: {
109
+ height: number;
110
+ width: number;
111
+ };
112
+ } & ((name: "addListener", event: string, listener: SprigListener) => void) &
113
+ ((name: "applyStyles", styles: string) => void) &
114
+ ((name: "dismissActiveSurvey", reason?: string) => void) &
115
+ ((name: "displaySurvey", surveyId: number) => void) &
116
+ ((
117
+ name: "identifyAndSetAttributes",
118
+ payload: {
119
+ anonymousID?: string;
120
+ attributes: SprigAttributes;
121
+ userID?: string;
122
+ }
123
+ ) => void) &
124
+ ((
125
+ name: "identifyAndTrack",
126
+ payload: {
127
+ anonymousId?: string;
128
+ eventName: string;
129
+ metadata?: SprigMetadata;
130
+ userId?: string;
131
+ }
132
+ ) => void) &
133
+ ((name: "logoutUser") => void) &
134
+ ((name: "mute") => void) &
135
+ ((name: "previewSurvey", surveyTemplateId: string) => void) &
136
+ ((name: "removeAllListeners") => void) &
137
+ ((name: "removeAttributes", attributes: SprigAttributes) => void) &
138
+ ((name: "removeListener", event: string, listener: SprigListener) => void) &
139
+ ((name: "reviewSurvey", surveyId: number) => void) &
140
+ ((name: "setAttribute", attribute: string, value: string) => void) &
141
+ ((name: "setAttributes", attributes: SprigAttributes) => void) &
142
+ ((name: "setPartnerAnonymousId", partnerAnonymousId: string) => void) &
143
+ ((name: "setUserId", userId: string) => void) &
144
+ ((name: "setWindowDimensions", width: number, height: number) => void) &
145
+ ((name: "teardown") => void) &
146
+ ((
147
+ name: "track",
148
+ eventName: string,
149
+ properties?: SprigProperties,
150
+ metadata?: SprigMetadata
151
+ ) => void) &
152
+ ((name: "unmute") => void);
153
+
154
+ type IntercomProxy = typeof window.Intercom;
155
+ type SprigProxy = WindowSprig;
156
+
157
+ declare global {
158
+ interface Window {
159
+ __cfg: Config;
160
+ attachEvent?: typeof window.addEventListener;
161
+ Intercom: Intercom_.IntercomStatic & { ul_wasVisible?: boolean };
162
+ optimizely?: optimizely.Optimizely;
163
+ previewMode?: unknown;
164
+ UpChunk: upchunk.UpChunkModule;
165
+ _Sprig?: WindowSprig;
166
+ Sprig: WindowSprig;
167
+ UserLeap: WindowSprig;
168
+ }
169
+
170
+ type WindowSprig = SprigProxy;
171
+ type SprigAttributes = Record<string, boolean | number | string>;
172
+ type SprigListener = (data: unknown) => void;
173
+ type SprigMetadata = Record<string, unknown>;
174
+ type SprigProperties = Record<string, unknown>;
175
+
176
+ // common types
177
+ /** @example "123e4567-e89b-12d3-a456-426614174000" */
178
+ type UUID = string;
179
+ }
@@ -0,0 +1,3 @@
1
+ import { JSXInternal } from "preact/src/jsx";
2
+ declare const App: () => JSXInternal.Element;
3
+ export default App;
@@ -0,0 +1,6 @@
1
+ import { JSXInternal } from "preact/src/jsx";
2
+ import { ConsentLegalCard as ConsentLegalCardType } from "../../types/card";
3
+ import { BaseCardProps } from "./types";
4
+ declare type Props = ConsentLegalCardType["props"] & BaseCardProps;
5
+ declare const ConsentLegalCard: ({ className, message, next, properties, questionId, type, }: Props) => JSXInternal.Element;
6
+ export default ConsentLegalCard;
@@ -0,0 +1,10 @@
1
+ export { default as ConsentLegalCard } from "./consentLegalCard";
2
+ export { default as LikertCard } from "./likertCard";
3
+ export { MultipleChoiceSingleSelectCard, MultipleChoiceMultipleSelectCard, } from "./multipleChoice";
4
+ export { default as NPSCard } from "./npsCard";
5
+ export { default as OpenTextCard } from "./openTextCard";
6
+ export { default as RecordedTask } from "./recordedTask";
7
+ export { default as TextUrlPromptCard } from "./textUrlPromptCard";
8
+ export { default as ThanksCard } from "./thanksCard";
9
+ export { default as VideoVoiceCard } from "./videoVoiceCard";
10
+ export { default as UploadingCard } from "./uploadingCard";
@@ -0,0 +1 @@
1
+ export { default } from "./likertCard";
@@ -0,0 +1,6 @@
1
+ import { JSXInternal } from "preact/src/jsx";
2
+ import { LikertCard as LikertCardType } from "../../../types/card";
3
+ import { BaseCardProps } from "../types";
4
+ declare type Props = LikertCardType["props"] & BaseCardProps;
5
+ declare const LikertCard: ({ className, labels, message, next, properties, questionId, type, }: Props) => JSXInternal.Element;
6
+ export default LikertCard;
@@ -0,0 +1,16 @@
1
+ import { ScaleLabelType } from "../../../types/card";
2
+ interface Props {
3
+ activeValue: number;
4
+ border: string;
5
+ icon: string;
6
+ isPressed: boolean;
7
+ onSubmit: () => void;
8
+ range: number;
9
+ scaleLabelType: ScaleLabelType;
10
+ setActiveValue: (value: number) => void;
11
+ setIsPressed: (value: boolean) => void;
12
+ useMobileStyling: boolean;
13
+ value: number;
14
+ }
15
+ declare const LikertOption: ({ activeValue, border, icon, isPressed, onSubmit, range, scaleLabelType, setActiveValue, setIsPressed, useMobileStyling, value, }: Props) => import("preact").JSX.Element;
16
+ export default LikertOption;
@@ -0,0 +1,15 @@
1
+ import { JSXInternal } from "preact/src/jsx";
2
+ import { CommonMultipleChoiceProps } from "../../../types/card";
3
+ import { BaseCardProps } from "../types";
4
+ declare type MultiOptionProps = CommonMultipleChoiceProps & BaseCardProps & ExtraProps;
5
+ export interface OptionSelectedMap {
6
+ [id: string]: {
7
+ isSelected: boolean;
8
+ userText?: string;
9
+ };
10
+ }
11
+ interface ExtraProps {
12
+ onSubmit: (state: OptionSelectedMap) => void;
13
+ }
14
+ export declare const BaseMultiChoiceCard: ({ className, message, onSubmit, options, properties, questionId, type, }: MultiOptionProps) => JSXInternal.Element;
15
+ export {};
@@ -0,0 +1,2 @@
1
+ export { default as MultipleChoiceSingleSelectCard } from "./singleSelectCard";
2
+ export { default as MultipleChoiceMultipleSelectCard } from "./multiSelectCard";
@@ -0,0 +1,5 @@
1
+ import { MultipleChoiceMultiSelectCard as MultiSelectCardProps } from "../../../types/card";
2
+ import { BaseCardProps } from "../types";
3
+ declare type MultiSelectProps = MultiSelectCardProps["props"] & BaseCardProps;
4
+ declare const MultiSelectCard: (props: MultiSelectProps) => import("preact").JSX.Element;
5
+ export default MultiSelectCard;
@@ -0,0 +1,5 @@
1
+ import { MultipleChoiceSingleSelectCard as SingleSelectCardProps } from "../../../types/card";
2
+ import { BaseCardProps } from "../types";
3
+ declare type SingleSelectProps = SingleSelectCardProps["props"] & BaseCardProps;
4
+ declare const SingleSelectCard: (props: SingleSelectProps) => import("preact").JSX.Element;
5
+ export default SingleSelectCard;
@@ -0,0 +1,8 @@
1
+ import { JSXInternal } from "preact/src/jsx";
2
+ import { NPSCard as NpsCardType } from "../../types/card";
3
+ import { BaseCardProps } from "./types";
4
+ declare type Props = {
5
+ props: NpsCardType["props"];
6
+ } & BaseCardProps;
7
+ declare const NPSCard: ({ className, props: { labels, message, properties }, next, questionId, type, }: Props) => JSXInternal.Element;
8
+ export default NPSCard;
@@ -0,0 +1,6 @@
1
+ import { JSXInternal } from "preact/src/jsx";
2
+ import { OpenTextCard as OpenTextCardType } from "../../types/card";
3
+ import { BaseCardProps } from "./types";
4
+ declare type Props = OpenTextCardType["props"] & BaseCardProps;
5
+ declare const OpenTextCard: ({ className, message, next, properties, questionId, type, }: Props) => JSXInternal.Element;
6
+ export default OpenTextCard;
@@ -0,0 +1,21 @@
1
+ import { TaskStatus } from "../../../constants/sprigRecordingEvents";
2
+ import { PermissionTaskPage, RecordedTaskPage } from "../../../types/card";
3
+ import { RecordedTaskResponseType } from "./store";
4
+ export declare function requestAVPermissions({ currentPage, pages, }: {
5
+ currentPage: PermissionTaskPage;
6
+ pages: RecordedTaskPage[];
7
+ }): void;
8
+ export declare function initializeRecordTask({ pages, userId: visitorId, responseGroupUid, surveyId, questionId, next, }: {
9
+ questionId: number;
10
+ surveyId: number;
11
+ responseGroupUid: UUID;
12
+ userId: UUID | null;
13
+ next: (response: RecordedTaskResponseType) => void;
14
+ pages: RecordedTaskPage[];
15
+ }): RecordedTaskPage;
16
+ export declare function completeTask({ status }: {
17
+ status: TaskStatus;
18
+ }): void;
19
+ export declare function nextPage({ pages }: {
20
+ pages: RecordedTaskPage[];
21
+ }): void;
@@ -0,0 +1,5 @@
1
+ import { RecordedTaskCard as RecordedTaskCardType } from "../../../types/card";
2
+ import { BaseCardProps } from "../types";
3
+ declare type Props = RecordedTaskCardType["props"] & BaseCardProps;
4
+ declare const RecordedTaskCard: ({ className, properties, next, questionId, }: Props) => import("preact").JSX.Element;
5
+ export default RecordedTaskCard;
@@ -0,0 +1,37 @@
1
+ import { JSXInternal } from "preact/src/jsx";
2
+ import { CompleteTaskPage, PermissionTaskPage, RecordedTaskCardProperties, RecordedTaskPage, ScreenTaskPage, StartTaskPage } from "../../../types/card";
3
+ export declare const Button: ({ backgroundColor, classNames, content, handleClick, }: {
4
+ backgroundColor?: string | undefined;
5
+ classNames?: string | undefined;
6
+ content: string;
7
+ handleClick: JSXInternal.MouseEventHandler<HTMLButtonElement>;
8
+ }) => JSXInternal.Element;
9
+ export declare const StartTaskPageContent: ({ content, pages, }: {
10
+ content: StartTaskPage;
11
+ pages: RecordedTaskPage[];
12
+ }) => JSXInternal.Element;
13
+ export declare const CompleteTaskPageContent: ({ content, properties, }: {
14
+ content: CompleteTaskPage;
15
+ properties: RecordedTaskCardProperties;
16
+ }) => JSXInternal.Element;
17
+ export declare const ScreenPermissionPageContent: ({ content, pages, required, }: {
18
+ content: ScreenTaskPage;
19
+ required: boolean;
20
+ pages: RecordedTaskPage[];
21
+ }) => JSXInternal.Element;
22
+ export declare const AVPermissionRequestPageContent: ({ content, }: {
23
+ content: PermissionTaskPage;
24
+ }) => JSXInternal.Element;
25
+ export declare const AVPermissionFailurePageContent: ({ content, pages, required, }: {
26
+ content: PermissionTaskPage;
27
+ required: boolean;
28
+ pages: RecordedTaskPage[];
29
+ }) => JSXInternal.Element | null;
30
+ export declare const AVPermissionGrantedPageContent: ({ content, pages, required, }: {
31
+ content: PermissionTaskPage;
32
+ required: boolean;
33
+ pages: RecordedTaskPage[];
34
+ }) => JSXInternal.Element;
35
+ export declare const PageContent: ({ properties, }: {
36
+ properties: RecordedTaskCardProperties;
37
+ }) => JSXInternal.Element | null;
@@ -0,0 +1,5 @@
1
+ export declare const enum AvStreamStatus {
2
+ RequestNeeded = 1,
3
+ TryAgain = 2,
4
+ Ready = 3
5
+ }
@@ -0,0 +1,6 @@
1
+ import { RecordedTaskPage, PermissionTaskPage, ScreenTaskPage } from "../../../types/card";
2
+ import { AvStreamStatus } from "./constants";
3
+ export declare const isPermissionTaskPage: (page: RecordedTaskPage) => page is PermissionTaskPage;
4
+ export declare const isScreenTaskPage: (page: RecordedTaskPage) => page is ScreenTaskPage;
5
+ export declare const avStreamHasRequiredPermissions: (avstream: MediaStream, page: RecordedTaskPage) => boolean;
6
+ export declare const getAvStreamRequestStatus: (avstream: MediaStream | null | undefined, page: RecordedTaskPage) => AvStreamStatus;
@@ -0,0 +1 @@
1
+ export { default } from "./card";
@@ -0,0 +1,24 @@
1
+ import { MediaType, PassthroughData } from "../../../constants/sprigRecordingEvents";
2
+ import { CardType, RecordedTaskPage, RecordedTaskPageType } from "../../../types/card";
3
+ import { RecordedTaskResponseValueType } from "../types";
4
+ export interface RecordedTaskResponseType {
5
+ questionId: number;
6
+ type: CardType;
7
+ value: RecordedTaskResponseValueType;
8
+ }
9
+ export interface RecordedTaskState {
10
+ avStream: MediaStream | null | undefined;
11
+ currentPage: RecordedTaskPage | null;
12
+ mediaRecordingUids: UUID[] | null;
13
+ nextQuestion: (response: RecordedTaskResponseType) => void;
14
+ passthroughData?: PassthroughData;
15
+ recordingMediaTypes?: MediaType[];
16
+ screenPermissionRequested: boolean;
17
+ type?: RecordedTaskPageType;
18
+ }
19
+ export interface RecordedTaskActions {
20
+ reset: () => void;
21
+ updatePage: (newState: Partial<RecordedTaskState>) => void;
22
+ }
23
+ export declare type RecordedTaskStore = RecordedTaskState & RecordedTaskActions;
24
+ export declare const useRecordedTaskStore: import("zustand").UseBoundStore<import("zustand").StoreApi<RecordedTaskStore>>;
@@ -0,0 +1,6 @@
1
+ import { JSXInternal } from "preact/src/jsx";
2
+ import { TextUrlPromptCard as TextUrlPromptCardType } from "../../types/card";
3
+ import { BaseCardProps } from "./types";
4
+ declare type Props = TextUrlPromptCardType["props"] & BaseCardProps;
5
+ declare const TextUrlPromptCard: ({ className, message, next, properties, questionId, type, }: Props) => JSXInternal.Element;
6
+ export default TextUrlPromptCard;
@@ -0,0 +1,5 @@
1
+ import { ThanksCard as ThanksCardType } from "../../types/card";
2
+ import { BaseCardProps } from "./types";
3
+ declare type Props = ThanksCardType["props"] & BaseCardProps;
4
+ declare const ThanksCard: ({ className, questionId }: Props) => import("preact").JSX.Element;
5
+ export default ThanksCard;
@@ -0,0 +1,34 @@
1
+ import { JSXInternal } from "preact/src/jsx";
2
+ import { TaskStatus } from "../../constants/sprigRecordingEvents";
3
+ import { CardType } from "../../types/card";
4
+ export declare type MultiSelectValueType = Record<string, boolean>;
5
+ export declare type SingleSelectValueType = Record<string, string>;
6
+ export declare type MultiChoiceSecondaryValueType = Record<string, {
7
+ userText: string;
8
+ }> | null;
9
+ export interface RecordedTaskResponseValueType {
10
+ mediaRecordingUids?: string[] | null;
11
+ taskDurationMillisecond?: number;
12
+ taskStatus: TaskStatus;
13
+ }
14
+ export declare type SelectedValue = RecordedTaskResponseValueType | MultiSelectValueType | SingleSelectValueType | {
15
+ mediaRecordingUid: UUID | null;
16
+ } | {
17
+ submitted: boolean;
18
+ name?: string;
19
+ } | {
20
+ skipped: boolean;
21
+ } | string | string[] | number | null | undefined;
22
+ export declare type NextFnType = (options: {
23
+ value: SelectedValue;
24
+ secondaryValue?: MultiChoiceSecondaryValueType;
25
+ questionId: number;
26
+ type: CardType;
27
+ }) => void;
28
+ export interface BaseCardProps {
29
+ className: string;
30
+ next: NextFnType;
31
+ questionId: number;
32
+ type: CardType;
33
+ }
34
+ export declare type TouchKeyEvents = Pick<JSXInternal.DOMAttributes<HTMLDivElement>, "onClick" | "onKeyPress" | "onMouseDown" | "onMouseLeave" | "onMouseOver" | "onMouseUp" | "onTouchCancel" | "onTouchMove" | "onTouchStart" | "onTouchEnd">;
@@ -0,0 +1,5 @@
1
+ import { UploadingCard as UploadingCardType } from "../../types/card";
2
+ import { BaseCardProps } from "./types";
3
+ declare type Props = UploadingCardType["props"] & BaseCardProps;
4
+ declare const UploadingCard: ({ className }: Props) => import("preact").JSX.Element;
5
+ export default UploadingCard;
@@ -0,0 +1,6 @@
1
+ import { JSXInternal } from "preact/src/jsx";
2
+ import { VideoVoiceCard as VideoVoiceCardType } from "../../types/card";
3
+ import { BaseCardProps } from "./types";
4
+ declare type Props = VideoVoiceCardType["props"] & BaseCardProps;
5
+ declare const VideoVoiceCard: ({ className, message, next, properties, questionId, type, }: Props) => JSXInternal.Element;
6
+ export default VideoVoiceCard;
@@ -0,0 +1,8 @@
1
+ interface Props {
2
+ message?: string;
3
+ properties?: {
4
+ captionText?: string;
5
+ };
6
+ }
7
+ declare const Header: ({ message, properties }: Props) => import("preact").JSX.Element;
8
+ export default Header;
@@ -0,0 +1,3 @@
1
+ export { default as Header } from "./header";
2
+ export { default as MobileEmbedView } from "./mobileEmbedView";
3
+ export { default as Select } from "./select";
@@ -0,0 +1,19 @@
1
+ import { JSXInternal } from "preact/src/jsx";
2
+ import { ConceptUrl } from "../../types/card";
3
+ import { Platform } from "../../types/config";
4
+ declare const MobileEmbedView: ({ defaultBody, embeddedType, handleClickEmbedButton, hasViewedEmbed, platform, properties, useDesktopPrototype, }: {
5
+ defaultBody: () => JSXInternal.Element;
6
+ embeddedType?: "prototype" | "pdf" | undefined;
7
+ handleClickEmbedButton: (name: string) => void;
8
+ hasViewedEmbed: boolean;
9
+ platform?: Platform | undefined;
10
+ properties?: {
11
+ conceptUrl: ConceptUrl;
12
+ consentDocument?: {
13
+ url: string;
14
+ } | undefined;
15
+ viewDocumentText?: string | undefined;
16
+ } | undefined;
17
+ useDesktopPrototype?: boolean | undefined;
18
+ }) => JSXInternal.Element;
19
+ export default MobileEmbedView;
@@ -0,0 +1,25 @@
1
+ import { JSXInternal } from "preact/src/jsx";
2
+ /**
3
+ * Select component
4
+ */
5
+ declare const Select: ({ border, label, isSelected, value, text, id, isRadio, useMobileStyling, error, allowTextEntry, promptText, onUserInputChanged, }: {
6
+ border: string;
7
+ label: string;
8
+ isSelected: boolean;
9
+ value?: string | undefined;
10
+ text?: string | undefined;
11
+ index: number;
12
+ id?: string | undefined;
13
+ isRadio: boolean;
14
+ useMobileStyling: boolean;
15
+ error: boolean;
16
+ allowTextEntry: boolean;
17
+ promptText?: string | undefined;
18
+ onUserInputChanged: (args: {
19
+ id: string;
20
+ selected: boolean;
21
+ value?: string | undefined;
22
+ userText?: string | undefined;
23
+ }) => void;
24
+ }) => JSXInternal.Element;
25
+ export default Select;
@@ -0,0 +1,2 @@
1
+ declare const Footer: () => import("preact").JSX.Element;
2
+ export default Footer;
@@ -0,0 +1,6 @@
1
+ export declare const getButtonText: (properties?: {
2
+ buttonText?: string;
3
+ }) => string;
4
+ export declare const getSkipButtonText: (properties?: {
5
+ skipButtonText?: string;
6
+ }) => string;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Set visitor attributes and returns url with substitutions made
3
+ * @param rawUrl - url possibly containing tags like {{user_id}}
4
+ * @param visitorAttributes - attributes to substitute in the url
5
+ */
6
+ export declare const getAttributedUrl: (rawUrl?: string | undefined, visitorAttributes?: Record<string, string>) => string | undefined;
@@ -0,0 +1,34 @@
1
+ import { AppCard, CardType } from "../../types/card";
2
+ import { AppConfig } from "../../types/config";
3
+ import { SelectedValue } from "../cards/types";
4
+ /**
5
+ * @param response response object submitted
6
+ * @param type type of the question
7
+ * @param routingValue value used to determine routing from skip logic
8
+ * @returns
9
+ */
10
+ export declare const getHasValidAnswer: (response: {
11
+ value: unknown;
12
+ }, type: CardType, routingValue: {
13
+ taskStatus: unknown;
14
+ } | null | undefined) => boolean;
15
+ /**
16
+ * @param cards - Array of all cards
17
+ * @param index - Current index in the cards
18
+ * @param selectedValue - Value that was selected which determines routing options
19
+ * @param hasEndCard - is the thanks card configured
20
+ * @returns optional next index value, if next index is null, survey ends immediately
21
+ */
22
+ export declare const getNextCardIndex: ({ cards, index, hasEndCard, selectedValue, hasValidAnswer, uploadProgress, }: {
23
+ cards: AppCard[];
24
+ hasEndCard: boolean;
25
+ hasValidAnswer?: boolean | undefined;
26
+ index: number;
27
+ selectedValue: SelectedValue;
28
+ uploadProgress?: Record<string, {
29
+ isComplete: boolean;
30
+ isSubmitted: boolean;
31
+ progressPct: number;
32
+ }> | undefined;
33
+ }) => number | null;
34
+ export declare const getMaxRemainingCards: (cards: AppCard[], index: number) => number;
@@ -0,0 +1 @@
1
+ export { useAutoSize } from "./useAutoSize";
@@ -0,0 +1,2 @@
1
+ import { Ref } from "preact/hooks";
2
+ export declare const useAutoSize: (textAreaRef: Ref<HTMLTextAreaElement>, sizeUpdate: () => void) => () => void;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * UserLeap logo component
3
+ */
4
+ declare const Logo: () => import("preact").JSX.Element;
5
+ export default Logo;
@@ -0,0 +1,2 @@
1
+ declare const instance: any;
2
+ export default instance;
@@ -0,0 +1,2 @@
1
+ import { AppConfig } from "../types/config";
2
+ export declare const useConfig: import("zustand").UseBoundStore<import("zustand").StoreApi<AppConfig>>;
@@ -0,0 +1,6 @@
1
+ import { Config } from "../types/config";
2
+ declare function configure(config: Config): void;
3
+ declare const _default: {
4
+ configure: typeof configure;
5
+ };
6
+ export default _default;