@myinterview/widget-react 1.0.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 (96) hide show
  1. package/README.md +46 -0
  2. package/dist/esm/App.d.ts +2 -0
  3. package/dist/esm/components/CountDown.d.ts +6 -0
  4. package/dist/esm/components/Counter.d.ts +8 -0
  5. package/dist/esm/components/DeviceSelector.d.ts +10 -0
  6. package/dist/esm/components/DeviceSelectorList.d.ts +9 -0
  7. package/dist/esm/components/DeviceSelectorListNative.d.ts +6 -0
  8. package/dist/esm/components/Error.d.ts +8 -0
  9. package/dist/esm/components/ErrorBoundaries.d.ts +9 -0
  10. package/dist/esm/components/Errors.d.ts +9 -0
  11. package/dist/esm/components/Explanation.d.ts +7 -0
  12. package/dist/esm/components/Footer.d.ts +2 -0
  13. package/dist/esm/components/Header.d.ts +10 -0
  14. package/dist/esm/components/InnerView.d.ts +12 -0
  15. package/dist/esm/components/Main.d.ts +8 -0
  16. package/dist/esm/components/OuterView.d.ts +8 -0
  17. package/dist/esm/components/PermissionSteps.d.ts +6 -0
  18. package/dist/esm/components/PracticeModeInfo.d.ts +8 -0
  19. package/dist/esm/components/PreviewItem.d.ts +10 -0
  20. package/dist/esm/components/PreviewList.d.ts +17 -0
  21. package/dist/esm/components/Question.d.ts +9 -0
  22. package/dist/esm/components/QuestionItem.d.ts +12 -0
  23. package/dist/esm/components/QuestionsList.d.ts +11 -0
  24. package/dist/esm/components/RecorderModal.d.ts +14 -0
  25. package/dist/esm/components/Setup.d.ts +6 -0
  26. package/dist/esm/components/SetupChecks.d.ts +14 -0
  27. package/dist/esm/components/SliderModal.d.ts +8 -0
  28. package/dist/esm/components/Upload.d.ts +13 -0
  29. package/dist/esm/components/VideoCamera.d.ts +28 -0
  30. package/dist/esm/components/VideoQuestion.d.ts +9 -0
  31. package/dist/esm/components/VideoTimeBar.d.ts +9 -0
  32. package/dist/esm/components/Widget.d.ts +9 -0
  33. package/dist/esm/components/icons/ClockIcon.d.ts +2 -0
  34. package/dist/esm/components/icons/Loading.d.ts +2 -0
  35. package/dist/esm/components/icons/NoCameraMic.d.ts +2 -0
  36. package/dist/esm/components/icons/PlayIcon.d.ts +6 -0
  37. package/dist/esm/components/icons/Retake.d.ts +2 -0
  38. package/dist/esm/components/icons/RotateScreenIcon.d.ts +2 -0
  39. package/dist/esm/components/ui/Loader.d.ts +2 -0
  40. package/dist/esm/components/ui/MicrophoneIndicator.d.ts +7 -0
  41. package/dist/esm/components/ui/PracticeMode.d.ts +2 -0
  42. package/dist/esm/components/ui/Progress.d.ts +6 -0
  43. package/dist/esm/components/ui/QuestionDuration.d.ts +6 -0
  44. package/dist/esm/components/ui/QuestionNumber.d.ts +7 -0
  45. package/dist/esm/components/ui/RecordingButton.d.ts +6 -0
  46. package/dist/esm/components/ui/RotateScreen.d.ts +2 -0
  47. package/dist/esm/components/ui/Signal.d.ts +9 -0
  48. package/dist/esm/components/ui/StartNowButton.d.ts +6 -0
  49. package/dist/esm/components/ui/StartRecordingButton.d.ts +10 -0
  50. package/dist/esm/components/ui/StopRecordingButton.d.ts +7 -0
  51. package/dist/esm/components/ui/UnsupportedModal.d.ts +6 -0
  52. package/dist/esm/config/index.d.ts +6 -0
  53. package/dist/esm/config/local.env.d.ts +6 -0
  54. package/dist/esm/config/prod.env.d.ts +6 -0
  55. package/dist/esm/config/staging.env.d.ts +6 -0
  56. package/dist/esm/i18n/config.d.ts +430 -0
  57. package/dist/esm/index.d.ts +2 -0
  58. package/dist/esm/index.js +32177 -0
  59. package/dist/esm/index.js.map +1 -0
  60. package/dist/esm/interfaces/candidateInterface.d.ts +10 -0
  61. package/dist/esm/interfaces/candidateSessionInterface.d.ts +78 -0
  62. package/dist/esm/interfaces/companyInterface.d.ts +3 -0
  63. package/dist/esm/interfaces/configInterface.d.ts +33 -0
  64. package/dist/esm/interfaces/jobInterface.d.ts +22 -0
  65. package/dist/esm/interfaces/microphoneInterface.d.ts +36 -0
  66. package/dist/esm/interfaces/networkInterface.d.ts +9 -0
  67. package/dist/esm/interfaces/previewInterface.d.ts +14 -0
  68. package/dist/esm/interfaces/recorderInterface.d.ts +110 -0
  69. package/dist/esm/interfaces/storageInterface.d.ts +29 -0
  70. package/dist/esm/interfaces/uploaderInterface.d.ts +39 -0
  71. package/dist/esm/interfaces/videoInterface.d.ts +54 -0
  72. package/dist/esm/interfaces/widgetInterface.d.ts +192 -0
  73. package/dist/esm/machines/acceleratorMachines/accUploaderMachine.d.ts +6 -0
  74. package/dist/esm/machines/acceleratorMachines/accWidgetMachine.d.ts +6 -0
  75. package/dist/esm/machines/acceleratorMachines/microphoneMachine.d.ts +6 -0
  76. package/dist/esm/machines/acceleratorMachines/networkMachine.d.ts +5 -0
  77. package/dist/esm/machines/acceleratorMachines/previewMachine.d.ts +6 -0
  78. package/dist/esm/machines/acceleratorMachines/recorderMachineV2.d.ts +6 -0
  79. package/dist/esm/machines/acceleratorMachines/storageMachine.d.ts +6 -0
  80. package/dist/esm/reportWebVitals.d.ts +3 -0
  81. package/dist/esm/services/axiosInstances.service.d.ts +3 -0
  82. package/dist/esm/services/s3.service.d.ts +1 -0
  83. package/dist/esm/services/session.service.d.ts +46 -0
  84. package/dist/esm/services/speedTest.service.d.ts +2 -0
  85. package/dist/esm/services/video.service.d.ts +7 -0
  86. package/dist/esm/setupTests.d.ts +1 -0
  87. package/dist/esm/utils/constants.utils.d.ts +9 -0
  88. package/dist/esm/utils/device.utils.d.ts +12 -0
  89. package/dist/esm/utils/errors.utils.d.ts +9 -0
  90. package/dist/esm/utils/formatters.utils.d.ts +5 -0
  91. package/dist/esm/utils/messages.utils.d.ts +16 -0
  92. package/dist/esm/utils/practiceQuestions.utils.d.ts +2 -0
  93. package/dist/esm/utils/sentry.utils.d.ts +4 -0
  94. package/dist/esm/utils/statusCodes.utils.d.ts +13 -0
  95. package/dist/index.d.ts +117 -0
  96. package/package.json +98 -0
@@ -0,0 +1,10 @@
1
+ export interface ICandidate {
2
+ candidate_id?: string;
3
+ email: string;
4
+ username: string;
5
+ phone?: string;
6
+ video_id?: string;
7
+ redirectUrl?: string;
8
+ apiKey?: string;
9
+ company_id?: string;
10
+ }
@@ -0,0 +1,78 @@
1
+ /**
2
+ * @author tht7 ( tht7 )
3
+ * @date 10/07/12022 6:48 pm
4
+ */
5
+ declare global {
6
+ interface Window {
7
+ candidateSession?: ICandidateSession;
8
+ }
9
+ }
10
+ export declare const enum CandidateSessionError {
11
+ NO_CANDIDATE_FOUND = "NO_CANDIDATE_FOUND",
12
+ NO_JOB_FOUND = "NO_JOB_FOUND",
13
+ DEADLINE_EXPIRED = "DEADLINE_EXPIRED",
14
+ NO_AUDIO = "NO_AUDIO",
15
+ NO_VIDEO = "NO_VIDEO",
16
+ PERMISSIONS_BLOCKED = "PERMISSIONS_BLOCKED",
17
+ JOB_INACTIVE = "JOB_INACTIVE",
18
+ SUBSCRIPTION_PAUSED = "SUBSCRIPTION_PAUSED",
19
+ SUBSCRIPTION_CANCELLED = "SUBSCRIPTION_CANCELLED",
20
+ INTERVIEW_ALREADY_COMPLETED = "INTERVIEW_ALREADY_COMPLETED"
21
+ }
22
+ export declare const enum CandidateSessionWarnings {
23
+ LOW_LIGHT = "LOW_LIGHT",
24
+ LOW_VOLUME = "LOW_VOLUME",
25
+ SLOW_CONNECTION = "SLOW_CONNECTION"
26
+ }
27
+ export declare type CandidateSessionSourceType = 'direct' | 'email' | 'sms' | 'email_reminder' | 'sms_reminder';
28
+ export declare const enum CandidateSessionSourceMap {
29
+ direct_start_inter = "direct",
30
+ reminder_start_inter = "email_reminder",
31
+ reminder_sms_start_inter = "sms_reminder",
32
+ email_start_inter = "email",
33
+ sms_start_inter = "sms"
34
+ }
35
+ export interface ICandidateSession {
36
+ session_id: string;
37
+ duration: number;
38
+ error?: keyof typeof CandidateSessionError;
39
+ warnings?: (keyof typeof CandidateSessionWarnings)[];
40
+ reload_count: number;
41
+ files_uploaded_count: number;
42
+ company_id: string;
43
+ apiKey: string;
44
+ job_id?: string;
45
+ candidate_id?: string;
46
+ video_id?: string;
47
+ email?: string;
48
+ source?: CandidateSessionSourceType;
49
+ userAgent?: string;
50
+ ip?: string;
51
+ candidate_location?: string;
52
+ first_interaction?: Date;
53
+ form_filled?: Date;
54
+ document_uploaded?: Date;
55
+ top_tips_shown?: Date;
56
+ top_tips_clicked?: Date;
57
+ top_tips_positive_rating?: boolean;
58
+ widget_shown?: Date;
59
+ widget_practiced?: Date;
60
+ widget_camera_setup?: Date;
61
+ widget_camera_error?: Date;
62
+ widget_microphone_setup?: Date;
63
+ widget_microphone_error?: Date;
64
+ widget_slow_internet_setup?: Date;
65
+ widget_high_internet_setup?: Date;
66
+ widget_medium_internet_setup?: Date;
67
+ widget_no_internet_setup?: Date;
68
+ widget_start_click_setup?: Date;
69
+ widget_change_camera_setup?: Date;
70
+ widget_change_mic_setup?: Date;
71
+ widget_exit?: Date;
72
+ widget_retake_count: number;
73
+ widget_submitted?: Date;
74
+ widget_completed?: Date;
75
+ page_closed: Date;
76
+ createdAt: Date;
77
+ updatedAt: Date;
78
+ }
@@ -0,0 +1,3 @@
1
+ export interface ICompany {
2
+ shouldShowWaterMark: boolean;
3
+ }
@@ -0,0 +1,33 @@
1
+ import { ICandidate } from './candidateInterface';
2
+ import { ICompany } from './companyInterface';
3
+ import { IJob } from './jobInterface';
4
+ import { IVideo } from './videoInterface';
5
+ export declare type IMessageType = 'completed' | 'deadline' | 'applied' | 'inactiveJob';
6
+ export interface IOnCompleteCallback {
7
+ redirectUrl?: string;
8
+ video_id: string;
9
+ }
10
+ export interface IOnError {
11
+ messageType: IMessageType;
12
+ }
13
+ export interface IConfig {
14
+ video?: IVideo;
15
+ candidate: ICandidate;
16
+ job?: IJob;
17
+ company?: ICompany;
18
+ config: {
19
+ auth: string;
20
+ onCompleteCallback?: (data: IOnCompleteCallback) => void;
21
+ onError?: (data: IOnError) => void;
22
+ };
23
+ }
24
+ export interface IConfigResponse {
25
+ video: IVideo;
26
+ candidate: ICandidate;
27
+ job: IJob;
28
+ }
29
+ export interface IConfigRequest {
30
+ video?: IVideo;
31
+ candidate?: ICandidate;
32
+ job?: IJob;
33
+ }
@@ -0,0 +1,22 @@
1
+ export interface IQuestion {
2
+ question: string;
3
+ numOfRetakes: number;
4
+ partDuration: number;
5
+ thinkingTime: number;
6
+ timeLimit?: number;
7
+ videoQuestion?: string;
8
+ description?: string;
9
+ }
10
+ export interface IJob {
11
+ language?: string;
12
+ overlay?: string;
13
+ transcriptLanguage?: string;
14
+ title?: string;
15
+ company?: string;
16
+ job_id?: string;
17
+ logo?: string;
18
+ questions?: IQuestion[];
19
+ old_jobID?: string;
20
+ apiKey?: string;
21
+ company_id?: string;
22
+ }
@@ -0,0 +1,36 @@
1
+ export interface InitialState {
2
+ mediaStream: MediaStream | null;
3
+ micData: number;
4
+ retakes: number;
5
+ }
6
+ export declare const enum STATES {
7
+ INACTIVE = "inactive",
8
+ ACTIVE = "active",
9
+ NOT_RECEIVING_DATA = "notReceivingData",
10
+ RECEIVING_DATA = "receivingData",
11
+ DATA_CHECK = "dataCheck"
12
+ }
13
+ export declare const enum ACTIONS {
14
+ CONSOLE_LOG = "consoleLog",
15
+ SET_MEDIA_STREAM = "setMediaStream",
16
+ UPDATE_MIC = "updateMic",
17
+ UPDATE_RETAKES = "UPDATE_RETAKES",
18
+ CLEAN_RETAKES = "CLEAN_RETAKES",
19
+ SENTRY = "sentry"
20
+ }
21
+ export declare const enum EVENTS {
22
+ ON_SET_MEDIA_STREAM = "ON_SET_MEDIA_STREAM",
23
+ SEND_DATA = "SEND_DATA",
24
+ MIC_CHECK = "MIC_CHECK",
25
+ SEND_ERROR = "SEND_ERROR",
26
+ UPDATE_RETAKES = "UPDATE_RETAKES",
27
+ CLEAN_RETAKES = "CLEAN_RETAKES"
28
+ }
29
+ export declare const enum SERVICES {
30
+ CHECK_MICROPHONE_LEVEL = "checkMicrophoneLevel"
31
+ }
32
+ export declare const enum GUARDS {
33
+ IS_MEDIA_STREAM_AVAILABLE = "isMediaStreamAvailable",
34
+ IS_MIC_NOT_RECEIVING_DATA = "isMicNotReceivingData",
35
+ IS_MIC_RECEIVING_DATA = "isMicReceivingData"
36
+ }
@@ -0,0 +1,9 @@
1
+ export declare const enum STATES {
2
+ READY = "ready"
3
+ }
4
+ export declare const enum ACTIONS {
5
+ SET_CONNECTION = "setConnection"
6
+ }
7
+ export declare const enum EVENTS {
8
+ CONNECTION_CHANGED = "CONNECTION_CHANGED"
9
+ }
@@ -0,0 +1,14 @@
1
+ export interface PreviewInterface {
2
+ videosUrls: string[];
3
+ }
4
+ export declare const enum STATES {
5
+ IDLE = "idle",
6
+ ERROR = "error",
7
+ FINISH = "finish"
8
+ }
9
+ export declare const enum EVENTS {
10
+ TAKES_RECEIVED = "TAKES_RECEIVED"
11
+ }
12
+ export declare const enum ACTIONS {
13
+ SET_TAKES = "setTakes"
14
+ }
@@ -0,0 +1,110 @@
1
+ import { ActorRef, DoneInvokeEvent } from 'xstate';
2
+ import { RefObject } from 'react';
3
+ export interface RecorderInterface {
4
+ isDefaultConstraint: boolean;
5
+ audioDevices?: MediaDeviceInfo[];
6
+ videoDevices?: MediaDeviceInfo[];
7
+ selectedAudioDevice?: MediaDeviceInfo;
8
+ selectedVideoDevice?: MediaDeviceInfo;
9
+ mediaRecorder?: MediaRecorder | null;
10
+ mediaStream?: MediaStream | null;
11
+ videoRef: RefObject<HTMLVideoElement>;
12
+ microphoneRef: ActorRef<DoneInvokeEvent<any>> | null;
13
+ speedTestLevel: SPEED_TEST_LEVEL;
14
+ videoBitsPerSecond: number;
15
+ mimeType: string;
16
+ mimeTypes: string[];
17
+ error: {};
18
+ countdown: number;
19
+ recordingTime: number;
20
+ facingMode: any;
21
+ durations: number;
22
+ constraint: ConstrainProps;
23
+ autoStart: boolean;
24
+ isMicError: boolean;
25
+ }
26
+ interface ConstrainProps {
27
+ video: {
28
+ width: {
29
+ min?: number;
30
+ ideal?: number;
31
+ max: number;
32
+ };
33
+ aspectRatio?: number;
34
+ };
35
+ audio: boolean;
36
+ }
37
+ export declare type mediaDeviceType = 'video' | 'audio';
38
+ export declare const enum STATES {
39
+ INIT = "init",
40
+ IDLE = "idle",
41
+ RECORDING = "recording",
42
+ WAITING = "waiting",
43
+ ERROR = "error"
44
+ }
45
+ export declare const enum RECORDER_STATES {
46
+ INIT_RECORDER = "initRecorder",
47
+ COUNT_DOWN = "countDown",
48
+ COLLECTING_BLOBS = "collectingBlobs",
49
+ RECORDER_TIMER = "recorderTimer",
50
+ RECORDER_SENDING_BLOBS = "recorderSendingBlobs"
51
+ }
52
+ export declare const enum RECORDER_EVENTS {
53
+ PAUSE = "PAUSE",
54
+ START_RECORDING = "START_RECORDING",
55
+ STOP_RECORDING = "STOP_RECORDING",
56
+ RETRY = "RETRY",
57
+ SET_QUESTION_PARAMS = "SET_QUESTION_PARAMS",
58
+ CHANGE_VIDEO_DEVICE = "CHANGE_VIDEO_DEVICE",
59
+ CHANGE_AUDIO_DEVICE = "CHANGE_AUDIO_DEVICE",
60
+ TICK = "TICK",
61
+ FORCE_START = "FORCE_START",
62
+ INIT_RECORDER = "INIT_RECORDER",
63
+ SAVE = "SAVE",
64
+ RE_INIT = "RE_INIT",
65
+ MIC_DATA_RECEIVED = "MIC_DATA_RECEIVED",
66
+ SPEED_TEST_RESULT_UPDATED = "SPEED_TEST_RESULT_UPDATED"
67
+ }
68
+ export declare const enum ACTIONS {
69
+ CLEAN_MIC_ERROR = "CLEAN_MIC_ERROR",
70
+ SET_MIC_ERROR = "setMicError",
71
+ DISABLE_AUTO_START = "disableAutoStart",
72
+ AUTO_START = "autoStart",
73
+ PAUSE_MEDIA_RECORDER = "pauseMediaRecorder",
74
+ ACTIVATE_MEDIA_RECORDER = "activateMediaRecorder",
75
+ SESSION_EVENT = "sessionEvent",
76
+ DISABLE_DEFAULT_CONSTRAINT = "disableDefaultConstraint",
77
+ SET_DEFAULT_CONSTRAINT = "setDefaultConstraint",
78
+ SET_MEDIA_STREAM = "setMediaStream",
79
+ SET_ERROR = "setError",
80
+ SET_INITIAL_CONTEXT = "setInitialContext",
81
+ STOP_MEDIA_STREAM = "stopMediaStream",
82
+ SET_MEDIA_STREAM_AUDIO_CHANGE = "setMediaStreamAudioChange",
83
+ SET_MEDIA_STREAM_VIDEO_CHANGE = "setMediaStreamVideoChange",
84
+ SET_MIC_MEDIA_STREAM = "SET_MIC_MEDIA_STREAM",
85
+ SAVE_TAKE = "SAVE_TAKE",
86
+ CLEAN = "CLEAN",
87
+ SET_QUESTION_PARAMS = "SET_QUESTION_PARAMS",
88
+ RESET = "REST",
89
+ SEND_ERROR = "SEND_ERROR",
90
+ SET_MEDIA_RECORDER = "setMediaRecorder",
91
+ SET_MIME_TYPE = "setmimeType",
92
+ SET_TIME_TO_START = "setTimeToStart",
93
+ SET_RECORDING_TIME = "setRecordingTime",
94
+ STOP_MEDIA_RECORDER = "stopMediaRecorder",
95
+ FORCE_START = "forceStart",
96
+ STOP_MIC = "stopMic",
97
+ SET_SPEED_TEST = "setSpeedTest",
98
+ SET_CONSTRAINT = "setConstraint",
99
+ SENTRY = "sentry"
100
+ }
101
+ export declare const enum RECORDER_SERVICE {
102
+ GET_MEDIA_STREAM = "getMediaStream",
103
+ GET_MEDIA_RECORDER = "getMediaRecorder"
104
+ }
105
+ export declare const enum SPEED_TEST_LEVEL {
106
+ LOW = 0,
107
+ MEDIUM = 1,
108
+ HIGH = 2
109
+ }
110
+ export {};
@@ -0,0 +1,29 @@
1
+ export interface ITakeObj {
2
+ file: File[];
3
+ objectUrl: string;
4
+ }
5
+ interface IFilesQuestion {
6
+ [questionNumber: number]: ITakeObj[];
7
+ }
8
+ export interface InitialState {
9
+ questions: IFilesQuestion;
10
+ practice: IFilesQuestion;
11
+ }
12
+ export declare const enum EVENTS {
13
+ STORE_TAKE = "STORE_TAKE",
14
+ GET_TAKE = "GET_TAKE",
15
+ GET_TAKES = "GET_TAKES",
16
+ REMOVE_TAKES = "REMOVE_TAKES"
17
+ }
18
+ export declare const enum ACTIONS {
19
+ CONSOLE_LOG = "consoleLog",
20
+ STORE_TAKE = "storeTake",
21
+ SEND_TAKE = "sendTake",
22
+ SEND_TAKES = "sendTakes",
23
+ REMOVE_TAKES = "removeTakes"
24
+ }
25
+ export declare const enum TAKE_TYPES {
26
+ QUESTION = "question",
27
+ PRACTICE = "practice"
28
+ }
29
+ export {};
@@ -0,0 +1,39 @@
1
+ import { IVideoFile } from './videoInterface';
2
+ interface ILastUploadChunkl {
3
+ loaded: number;
4
+ timeStamp: number;
5
+ }
6
+ export interface InitialState {
7
+ isConnected: boolean;
8
+ currentQuestion: number | null;
9
+ file: File | null;
10
+ signedUrl: string;
11
+ uploadSpeed: number;
12
+ lastUploadChunk: ILastUploadChunkl;
13
+ videoId: string;
14
+ videoFile: IVideoFile;
15
+ }
16
+ export declare const enum STATES {
17
+ IDLE = "idle",
18
+ UPLOADING = "uploading",
19
+ GET_SIGNED_URL = "getSignedUrl",
20
+ UPLOAD_TO_S3 = "uploadToS3",
21
+ UPLOADED = "uploaded",
22
+ FINISHED = "finished"
23
+ }
24
+ export declare const enum ACTIONS {
25
+ SET_UPLOADED = "setUploaded",
26
+ CONSOLE_LOG = "consoleLog",
27
+ SET_CONNECTION = "setConnection",
28
+ SET_SIGNED_URL = "setSignedUrl",
29
+ SET_VIDEO_FILE = "setVideoFile",
30
+ INITIAL_UPLOAD_TIMESTAMP = "initialUploadTimestamp",
31
+ UPDATE_UPLOAD_SPEED = "updateUploadSpeed",
32
+ SEND_UPLOAD_PROGRESS = "sendUploadProgress",
33
+ UPDATE_PARENT = "updateParent",
34
+ SENTRY = "sentry"
35
+ }
36
+ export declare const enum GUARDS {
37
+ CAN_UPLOAD = "canUplaod"
38
+ }
39
+ export {};
@@ -0,0 +1,54 @@
1
+ export interface IVideoPlatformOS {
2
+ architecture: number;
3
+ family: string;
4
+ version: string;
5
+ }
6
+ export interface IVideoPlatform {
7
+ description: string;
8
+ layout: string;
9
+ manufacturer: string;
10
+ name: string;
11
+ prerelease: string;
12
+ product: string;
13
+ ua: string;
14
+ version: string;
15
+ os: IVideoPlatformOS;
16
+ }
17
+ export interface IVideoFile {
18
+ completed: boolean;
19
+ uploaded: boolean;
20
+ filename: string;
21
+ retakes: number;
22
+ started: boolean;
23
+ videoLength?: number;
24
+ uploadUrl?: string;
25
+ question?: string;
26
+ }
27
+ export interface IVideo {
28
+ video_id: string;
29
+ bandwidth?: string;
30
+ clicked?: boolean;
31
+ started?: boolean;
32
+ completed?: boolean;
33
+ uploaded?: boolean;
34
+ jobID?: string;
35
+ platform?: IVideoPlatform;
36
+ quality?: string;
37
+ referrer?: string;
38
+ cvUrl?: string;
39
+ videos: IVideoFile[];
40
+ processTime?: number;
41
+ files?: string[];
42
+ personalInfo?: Record<string, string>;
43
+ language?: string;
44
+ gdprTimestamp?: string;
45
+ tracking?: {
46
+ reminder: number;
47
+ source: number;
48
+ };
49
+ }
50
+ export declare const enum VIDEO_STATUS {
51
+ INCOMPLETED = 0,
52
+ COMPLETED = 1,
53
+ UPLOADED = 2
54
+ }
@@ -0,0 +1,192 @@
1
+ import { RefObject } from 'react';
2
+ import { ActorRef, BaseActionObject, DoneInvokeEvent, Event, EventData, ResolveTypegenMeta, SCXML, ServiceMap, SingleOrArray, State, TypegenDisabled } from 'xstate';
3
+ import { IConfig } from './configInterface';
4
+ import { CAMERA_STATES_MESSAGES, INTERNET_STATES_MESSAGES, MICROPHONE_STATES_MESSAGES } from '../utils/messages.utils';
5
+ import { TAKE_TYPES } from './storageInterface';
6
+ import { IQuestion } from './jobInterface';
7
+ import { IVideoError } from '../utils/errors.utils';
8
+ declare type IUploaderRef = {
9
+ [uploaderRef: string]: ActorRef<DoneInvokeEvent<any>>;
10
+ };
11
+ export declare type ICameraStateKey = keyof typeof CAMERA_STATES_MESSAGES;
12
+ export declare type IMicrophoneStateKey = keyof typeof MICROPHONE_STATES_MESSAGES;
13
+ export declare type IInternetStateKey = keyof typeof INTERNET_STATES_MESSAGES;
14
+ export declare const CAMERA_STATES: {
15
+ [K in ICameraStateKey]: K;
16
+ };
17
+ export declare const MICROPHONE_STATES: {
18
+ [K in IMicrophoneStateKey]: K;
19
+ };
20
+ export declare const INTERNET_STATES: {
21
+ [K in IInternetStateKey]: K;
22
+ };
23
+ export interface IChecksMetaObj {
24
+ key: 'camera' | 'microphone' | 'internet';
25
+ state: ICameraStateKey | IMicrophoneStateKey | IInternetStateKey;
26
+ message?: string;
27
+ }
28
+ export interface IChecksState {
29
+ camera: ICameraStateKey;
30
+ microphone: IMicrophoneStateKey;
31
+ internet: IInternetStateKey;
32
+ }
33
+ interface IChecksMessage {
34
+ camera: string;
35
+ microphone: string;
36
+ internet: string;
37
+ }
38
+ export interface InitialState {
39
+ speedTestResult: number;
40
+ config: IConfig;
41
+ questions: IQuestion[];
42
+ isConnected: boolean;
43
+ videoRef: RefObject<HTMLVideoElement>;
44
+ networkRef: ActorRef<DoneInvokeEvent<any>> | null;
45
+ recorderRef: ActorRef<DoneInvokeEvent<any>> | null;
46
+ storageRef: ActorRef<DoneInvokeEvent<any>> | null;
47
+ previewRef: ActorRef<DoneInvokeEvent<any>> | null;
48
+ uploaderRefs: IUploaderRef;
49
+ currentQuestion: number;
50
+ currentTake: number;
51
+ selectedTake: number | null;
52
+ recordingType: TAKE_TYPES;
53
+ checksState: IChecksState;
54
+ checksMessage: IChecksMessage;
55
+ totalFileSize: number;
56
+ totalUploadedFilesSize: {
57
+ [questionNumber: string]: number;
58
+ };
59
+ totalUploadSpeed: {
60
+ [questionNumber: string]: number;
61
+ };
62
+ error: IVideoError | null;
63
+ }
64
+ export interface IWidgetMachineProps {
65
+ widgetMachine: State<InitialState, DoneInvokeEvent<any>, any, {
66
+ value: any;
67
+ context: InitialState;
68
+ }, ResolveTypegenMeta<TypegenDisabled, DoneInvokeEvent<any>, BaseActionObject, ServiceMap>>;
69
+ sendToWidget: (event: SCXML.Event<DoneInvokeEvent<any>> | SingleOrArray<Event<DoneInvokeEvent<any>>>, payload?: EventData | undefined) => void;
70
+ }
71
+ export declare const enum STATES {
72
+ INIT = "init",
73
+ SETUP = "setup",
74
+ SETUP__INIT_STORAGE = "initStorage",
75
+ SETUP__INIT_RECORDER = "initRecorder",
76
+ SETUP__TEST = "test",
77
+ SETUP__TEST__CAMERA = "testCamera",
78
+ SETUP__TEST__CAMERA__WAITING = "testCameraWaiting",
79
+ SETUP__TEST__CAMERA__ERROR = "testCameraError",
80
+ SETUP__TEST__CAMERA__SUCCESS = "testCameraSuccess",
81
+ SETUP__TEST__MICROPHONE = "testMicrophone",
82
+ SETUP__TEST__MICROPHONE__WAITING = "testMicrophoneWaiting",
83
+ SETUP__TEST__MICROPHONE__ERROR = "testMicrophoneError",
84
+ SETUP__TEST__MICROPHONE__SUCCESS = "testMicrophoneSuccess",
85
+ SETUP__TEST__INTERNET = "testInternet",
86
+ SETUP__TEST__INTERNET__IDLE = "testInternetIdle",
87
+ SETUP__TEST__INTERNET__TESTING = "testInternetTesting",
88
+ SETUP__TEST__INTERNET__FINISHED = "testInternetFinished",
89
+ INTERVIEW = "interview",
90
+ INTERVIEW__INIT = "interviewInit",
91
+ INTERVIEW__EXPLANATION = "interviewExplanation",
92
+ INTERVIEW__QUESTION = "interviewQuestion",
93
+ INTERVIEW__VIDEO_QUESTION = "interviewVideoQuestion",
94
+ INTERVIEW__RECORDING = "interviewRecording",
95
+ PREVIEW = "preview",
96
+ RE_INIT_RECORDER = "reInitRecorder",
97
+ RE_INIT_RECORDER__NEXT_RETAKE = "reInitRecorderNextRetake",
98
+ RE_INIT_RECORDER__NEXT_QUESTION = "reInitRecorderNextQuestion",
99
+ UPLOADING = "uploading",
100
+ CONFIRM = "confirm",
101
+ FINISHED = "finished",
102
+ ERROR = "error"
103
+ }
104
+ export declare const enum ACTIONS {
105
+ CONSOLE_LOG = "consoleLog",
106
+ SET_CONNECTION = "setConnection",
107
+ SET_CONFIG = "getConfig",
108
+ SET_NEXT_QUESTION = "setNextQuestion",
109
+ SET_SPEED_TEST = "setSpeedTest",
110
+ SET_CHECKS = "setChecks",
111
+ SET_PRACTICE_MODE = "setPracticeMode",
112
+ SET_QUESTION_MODE = "setQuestionMode",
113
+ SPAWN_NETWORK = "spawnNetwork",
114
+ SPAWN_RECORDER = "spawnRecorder",
115
+ SPAWN_UPLOADER = "spawnUploader",
116
+ SPAWN_STORAGE = "spawnStorage",
117
+ SPAWN_PREVIEW = "spawnPreview",
118
+ STOP_RECORDER = "stopRecorder",
119
+ STOP_PREVIEW = "stopPreview",
120
+ STORE_TAKE = "storeTake",
121
+ GET_TAKE = "getTake",
122
+ GET_TAKES = "getTakes",
123
+ SEND_TAKES = "sendTakes",
124
+ UPDATE_VIDEO_FILE_COMPLETED = "updateVideoFileCompleted",
125
+ UPDATE_TOTAL_FILES_SIZE = "updateTotalFileSize",
126
+ UPDATE_TOTAL_UPLOADED_FILES_SIZE = "updateTotalUploadedFileSize",
127
+ UPDATE_QUESTION_NUMBER = "updateQuestionNumber",
128
+ UPDATE_RETAKES_NUMBER = "updateRetakesNumber",
129
+ UPDATE_AXION_AUTH = "updateAxiosAuth",
130
+ RECORDER_RE_INIT = "recorderReInit",
131
+ UPDATE_RECORDER_PARAMS = "updateRecorderParams",
132
+ UPDATE_TOTAL_UPLOADED = "updateTotalUploaded",
133
+ SET_VIDEO_ERROR = "setVideoError",
134
+ UPDATE_RECORDER_SPEED_TEST = "updateRecorderSpeedTest",
135
+ SENTRY = "sentry",
136
+ SET_SESSION = "setSession",
137
+ SESSION_EVENT = "sessionEvent",
138
+ REVOKE_MEMORY = "revokeMemory",
139
+ UPDATE_VIDEO_OBJECT = "updateVideoObject",
140
+ UPDATE_VIDEO_PART = "updateVideoPart"
141
+ }
142
+ export declare const enum EVENTS {
143
+ SPAWN_UPLOADER = "SPAWN_UPLOADER",
144
+ TEST = "TEST",
145
+ PRACTICE_MODE = "PRACTICE_MODE",
146
+ QUESTION_MODE = "QUESTION_MODE",
147
+ IDLE = "IDLE",
148
+ PREVIEW = "PREVIEW",
149
+ BACK = "BACK",
150
+ STOP_RECORDING = "STOP_RECORDING",
151
+ GET_TAKES = "GET_TAKES",
152
+ TAKE_TO_UPLOAD_RECEIVED = "TAKE_TO_UPLOAD_RECEIVED",
153
+ TAKES_RECEIVED = "TAKES_RECEIVED",
154
+ NEXT_STEP = "NEXT_STEP",
155
+ NEXT_QUESTION = "NEXT_QUESTION",
156
+ NEXT_RETAKE = "NEXT_RETAKE",
157
+ READY_TO_START_RECORDING = "READY_TO_START_RECORDING",
158
+ UPLOADER_PROGRESS = "UPLOADER_PROGRESS",
159
+ UPLOADER_FINISHED = "UPLOADER_FINISHED",
160
+ RECORDER_ERROR = "RECORDER_ERROR",
161
+ RETRY = "RETRY"
162
+ }
163
+ export declare const enum SERVICES {
164
+ UPDATE_VIDEO_OBJECT_CALL = "updateVideoObjectCall",
165
+ UPDATE_VIDEO_PART_CALL = "updateVideoPartCall"
166
+ }
167
+ export declare const enum GUARDS {
168
+ NO_STORAGE = "noStorage",
169
+ NO_RECORDER = "noRecorder",
170
+ IS_THINKING_TIME = "isThinkingTime",
171
+ IS_VIDEO_QUESTION = "isVideoQuestion",
172
+ IS_QUESTION_MODE = "isQuestionMode",
173
+ IS_PRACTICE_MODE = "isPracticeMod",
174
+ IS_NOT_LAST_TAKE = "isNotLastTake",
175
+ IS_LAST_INTERVIEW_QUESTION = "isLastInterviewQuestion",
176
+ IS_UPLOAD_FINISHED = "isUploadFinished",
177
+ CAN_RETEST_SPEED_CONNECTION = "canRetestSpeedConnection",
178
+ IS_CONNECTED = "isConnected",
179
+ IS_DISCONNECTED = "isDisconnected",
180
+ CAN_START_INTERVIEW = "canStartInterview",
181
+ ARE_ALL_QUESTIONS_UPLOADED = "areAllQuestionsUploaded"
182
+ }
183
+ export declare const enum TAGS {
184
+ SETUP = "setup",
185
+ SHOW_CAMERA = "showCamera",
186
+ CAN_START_RECORDING = "canStartRecording",
187
+ DISPLAY_OUTER_VIEW = "displayOuterView",
188
+ DISPLAY_QUESTION = "displayQuestion",
189
+ DISPLAY_QUESTIONS_LIST = "displayQuestionsList",
190
+ LOADING = "loading"
191
+ }
192
+ export {};
@@ -0,0 +1,6 @@
1
+ import { DoneInvokeEvent } from 'xstate';
2
+ import { InitialState } from '../../interfaces/uploaderInterface';
3
+ export declare const accUploaderMachine: import("xstate").StateMachine<InitialState, any, DoneInvokeEvent<any>, {
4
+ value: any;
5
+ context: InitialState;
6
+ }, import("xstate").BaseActionObject, import("xstate").ServiceMap, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, DoneInvokeEvent<any>, import("xstate").BaseActionObject, import("xstate").ServiceMap>>;
@@ -0,0 +1,6 @@
1
+ import { DoneInvokeEvent } from 'xstate';
2
+ import { InitialState } from '../../interfaces/widgetInterface';
3
+ export declare const accWidgetMachine: import("xstate").StateMachine<InitialState, any, DoneInvokeEvent<any>, {
4
+ value: any;
5
+ context: InitialState;
6
+ }, import("xstate").BaseActionObject, import("xstate").ServiceMap, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, DoneInvokeEvent<any>, import("xstate").BaseActionObject, import("xstate").ServiceMap>>;
@@ -0,0 +1,6 @@
1
+ import { DoneInvokeEvent } from 'xstate';
2
+ import { InitialState } from '../../interfaces/microphoneInterface';
3
+ export declare const microphoneMachine: import("xstate").StateMachine<InitialState, any, DoneInvokeEvent<any>, {
4
+ value: any;
5
+ context: InitialState;
6
+ }, import("xstate").BaseActionObject, import("xstate").ServiceMap, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, DoneInvokeEvent<any>, import("xstate").BaseActionObject, import("xstate").ServiceMap>>;
@@ -0,0 +1,5 @@
1
+ import { DoneInvokeEvent } from 'xstate';
2
+ export declare const networkMachine: import("xstate").StateMachine<{}, any, DoneInvokeEvent<any>, {
3
+ value: any;
4
+ context: {};
5
+ }, import("xstate").BaseActionObject, import("xstate").ServiceMap, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, DoneInvokeEvent<any>, import("xstate").BaseActionObject, import("xstate").ServiceMap>>;
@@ -0,0 +1,6 @@
1
+ import { DoneInvokeEvent } from 'xstate';
2
+ import { PreviewInterface } from '../../interfaces/previewInterface';
3
+ export declare const previewMachine: import("xstate").StateMachine<PreviewInterface, any, DoneInvokeEvent<any>, {
4
+ value: any;
5
+ context: PreviewInterface;
6
+ }, import("xstate").BaseActionObject, import("xstate").ServiceMap, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, DoneInvokeEvent<any>, import("xstate").BaseActionObject, import("xstate").ServiceMap>>;