@myinterview/widget-react 1.0.11 → 1.0.88

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 (202) hide show
  1. package/README.md +4 -4
  2. package/dist/cjs/index.js +31900 -0
  3. package/dist/cjs/index.js.map +1 -0
  4. package/dist/{esm → cjs/types}/App.d.ts +0 -0
  5. package/dist/{esm → cjs/types}/components/CountDown.d.ts +0 -0
  6. package/dist/{esm → cjs/types}/components/Counter.d.ts +0 -0
  7. package/dist/{esm → cjs/types}/components/DeviceSelector.d.ts +0 -0
  8. package/dist/{esm → cjs/types}/components/DeviceSelectorList.d.ts +0 -0
  9. package/dist/{esm → cjs/types}/components/DeviceSelectorListNative.d.ts +0 -0
  10. package/dist/{esm → cjs/types}/components/Error.d.ts +0 -0
  11. package/dist/{esm → cjs/types}/components/ErrorBoundaries.d.ts +0 -0
  12. package/dist/{esm → cjs/types}/components/Errors.d.ts +1 -4
  13. package/dist/{esm → cjs/types}/components/Explanation.d.ts +0 -0
  14. package/dist/{esm → cjs/types}/components/Footer.d.ts +0 -0
  15. package/dist/{esm → cjs/types}/components/Header.d.ts +0 -0
  16. package/dist/{esm → cjs/types}/components/InnerView.d.ts +0 -0
  17. package/dist/{esm → cjs/types}/components/Main.d.ts +2 -2
  18. package/dist/{esm → cjs/types}/components/OuterView.d.ts +0 -0
  19. package/dist/{esm → cjs/types}/components/PermissionSteps.d.ts +0 -0
  20. package/dist/{esm → cjs/types}/components/PracticeModeInfo.d.ts +0 -0
  21. package/dist/cjs/types/components/PreviewItem.d.ts +10 -0
  22. package/dist/{esm → cjs/types}/components/PreviewList.d.ts +0 -0
  23. package/dist/{esm → cjs/types}/components/Question.d.ts +0 -0
  24. package/dist/{esm → cjs/types}/components/QuestionItem.d.ts +0 -0
  25. package/dist/{esm → cjs/types}/components/QuestionsList.d.ts +0 -0
  26. package/dist/{esm → cjs/types}/components/RecorderModal.d.ts +0 -1
  27. package/dist/{esm → cjs/types}/components/Setup.d.ts +0 -0
  28. package/dist/{esm → cjs/types}/components/SetupChecks.d.ts +0 -0
  29. package/dist/{esm → cjs/types}/components/SliderModal.d.ts +0 -0
  30. package/dist/{esm → cjs/types}/components/Upload.d.ts +0 -0
  31. package/dist/{esm → cjs/types}/components/VideoCamera.d.ts +0 -1
  32. package/dist/{esm → cjs/types}/components/VideoQuestion.d.ts +0 -0
  33. package/dist/{esm → cjs/types}/components/VideoTimeBar.d.ts +0 -0
  34. package/dist/{esm → cjs/types}/components/WelcomePage.d.ts +0 -0
  35. package/dist/cjs/types/components/Widget.d.ts +9 -0
  36. package/dist/{esm → cjs/types}/components/icons/ClockIcon.d.ts +0 -0
  37. package/dist/{esm → cjs/types}/components/icons/Loading.d.ts +0 -0
  38. package/dist/{esm → cjs/types}/components/icons/NoCameraMic.d.ts +0 -0
  39. package/dist/{esm → cjs/types}/components/icons/PlayIcon.d.ts +0 -0
  40. package/dist/{esm → cjs/types}/components/icons/Retake.d.ts +0 -0
  41. package/dist/{esm → cjs/types}/components/icons/RotateScreenIcon.d.ts +0 -0
  42. package/dist/{esm → cjs/types}/components/ui/Loader.d.ts +0 -0
  43. package/dist/{esm → cjs/types}/components/ui/MicrophoneIndicator.d.ts +0 -0
  44. package/dist/{esm → cjs/types}/components/ui/PracticeMode.d.ts +0 -0
  45. package/dist/{esm → cjs/types}/components/ui/Progress.d.ts +0 -0
  46. package/dist/{esm → cjs/types}/components/ui/QuestionDuration.d.ts +0 -0
  47. package/dist/{esm → cjs/types}/components/ui/QuestionNumber.d.ts +0 -0
  48. package/dist/{esm → cjs/types}/components/ui/RecordingButton.d.ts +0 -0
  49. package/dist/{esm → cjs/types}/components/ui/RotateScreen.d.ts +0 -0
  50. package/dist/{esm → cjs/types}/components/ui/Signal.d.ts +0 -0
  51. package/dist/{esm → cjs/types}/components/ui/StartNowButton.d.ts +0 -0
  52. package/dist/{esm → cjs/types}/components/ui/StartRecordingButton.d.ts +0 -0
  53. package/dist/{esm → cjs/types}/components/ui/StopRecordingButton.d.ts +0 -0
  54. package/dist/{esm → cjs/types}/components/ui/UnsupportedModal.d.ts +0 -0
  55. package/dist/{esm → cjs/types}/config/index.d.ts +1 -2
  56. package/dist/{esm → cjs/types}/config/local.env.d.ts +0 -0
  57. package/dist/{esm → cjs/types}/config/prod.env.d.ts +0 -0
  58. package/dist/{esm → cjs/types}/config/staging.env.d.ts +0 -0
  59. package/dist/cjs/types/i18n/config.d.ts +430 -0
  60. package/dist/cjs/types/index.d.ts +2 -0
  61. package/dist/{esm → cjs/types}/interfaces/candidateInterface.d.ts +0 -0
  62. package/dist/{esm → cjs/types}/interfaces/candidateSessionInterface.d.ts +5 -10
  63. package/dist/{esm → cjs/types}/interfaces/companyInterface.d.ts +0 -0
  64. package/dist/cjs/types/interfaces/configInterface.d.ts +33 -0
  65. package/dist/{esm → cjs/types}/interfaces/jobInterface.d.ts +1 -9
  66. package/dist/{esm → cjs/types}/interfaces/microphoneInterface.d.ts +0 -0
  67. package/dist/{esm → cjs/types}/interfaces/networkInterface.d.ts +0 -0
  68. package/dist/{esm → cjs/types}/interfaces/previewInterface.d.ts +0 -0
  69. package/dist/{esm → cjs/types}/interfaces/recorderInterface.d.ts +0 -0
  70. package/dist/{esm → cjs/types}/interfaces/storageInterface.d.ts +0 -0
  71. package/dist/{esm → cjs/types}/interfaces/uploaderInterface.d.ts +0 -0
  72. package/dist/{esm → cjs/types}/interfaces/videoInterface.d.ts +0 -1
  73. package/dist/{esm → cjs/types}/interfaces/widgetInterface.d.ts +5 -24
  74. package/dist/{esm → cjs/types}/machines/acceleratorMachines/accUploaderMachine.d.ts +0 -0
  75. package/dist/{esm → cjs/types}/machines/acceleratorMachines/accWidgetMachine.d.ts +0 -0
  76. package/dist/{esm → cjs/types}/machines/acceleratorMachines/microphoneMachine.d.ts +0 -0
  77. package/dist/{esm → cjs/types}/machines/acceleratorMachines/networkMachine.d.ts +0 -0
  78. package/dist/{esm → cjs/types}/machines/acceleratorMachines/previewMachine.d.ts +0 -0
  79. package/dist/{esm → cjs/types}/machines/acceleratorMachines/recorderMachineV2.d.ts +0 -0
  80. package/dist/{esm → cjs/types}/machines/acceleratorMachines/storageMachine.d.ts +0 -0
  81. package/dist/{esm → cjs/types}/reportWebVitals.d.ts +0 -0
  82. package/dist/{esm → cjs/types}/services/axiosInstances.service.d.ts +0 -1
  83. package/dist/{esm → cjs/types}/services/s3.service.d.ts +0 -0
  84. package/dist/{esm → cjs/types}/services/session.service.d.ts +1 -12
  85. package/dist/{esm → cjs/types}/services/speedTest.service.d.ts +0 -0
  86. package/dist/cjs/types/services/video.service.d.ts +7 -0
  87. package/dist/{esm → cjs/types}/setupTests.d.ts +0 -0
  88. package/dist/{esm → cjs/types}/utils/authToken.utils.d.ts +0 -0
  89. package/dist/{esm → cjs/types}/utils/constants.utils.d.ts +2 -5
  90. package/dist/{esm → cjs/types}/utils/debug.utils.d.ts +0 -0
  91. package/dist/{esm → cjs/types}/utils/device.utils.d.ts +0 -0
  92. package/dist/{esm → cjs/types}/utils/errors.utils.d.ts +0 -0
  93. package/dist/{esm → cjs/types}/utils/formatters.utils.d.ts +0 -0
  94. package/dist/{esm → cjs/types}/utils/messages.utils.d.ts +0 -0
  95. package/dist/cjs/types/utils/permissionSteps.utils.d.ts +19 -0
  96. package/dist/{esm → cjs/types}/utils/practiceQuestions.utils.d.ts +0 -0
  97. package/dist/{esm → cjs/types}/utils/sentry.utils.d.ts +0 -0
  98. package/dist/{esm → cjs/types}/utils/statusCodes.utils.d.ts +0 -0
  99. package/dist/esm/index.js +1819 -9383
  100. package/dist/esm/index.js.map +1 -1
  101. package/dist/esm/types/App.d.ts +2 -0
  102. package/dist/esm/types/components/CountDown.d.ts +6 -0
  103. package/dist/esm/types/components/Counter.d.ts +8 -0
  104. package/dist/esm/types/components/DeviceSelector.d.ts +10 -0
  105. package/dist/esm/types/components/DeviceSelectorList.d.ts +9 -0
  106. package/dist/esm/types/components/DeviceSelectorListNative.d.ts +6 -0
  107. package/dist/esm/types/components/Error.d.ts +8 -0
  108. package/dist/esm/types/components/ErrorBoundaries.d.ts +9 -0
  109. package/dist/esm/types/components/Errors.d.ts +9 -0
  110. package/dist/esm/types/components/Explanation.d.ts +7 -0
  111. package/dist/esm/types/components/Footer.d.ts +2 -0
  112. package/dist/esm/types/components/Header.d.ts +10 -0
  113. package/dist/esm/types/components/InnerView.d.ts +12 -0
  114. package/dist/esm/types/components/Main.d.ts +8 -0
  115. package/dist/esm/types/components/OuterView.d.ts +8 -0
  116. package/dist/esm/types/components/PermissionSteps.d.ts +6 -0
  117. package/dist/esm/types/components/PracticeModeInfo.d.ts +8 -0
  118. package/dist/esm/types/components/PreviewItem.d.ts +10 -0
  119. package/dist/esm/types/components/PreviewList.d.ts +17 -0
  120. package/dist/esm/types/components/Question.d.ts +9 -0
  121. package/dist/esm/types/components/QuestionItem.d.ts +12 -0
  122. package/dist/esm/types/components/QuestionsList.d.ts +11 -0
  123. package/dist/esm/types/components/RecorderModal.d.ts +14 -0
  124. package/dist/esm/types/components/Setup.d.ts +6 -0
  125. package/dist/esm/types/components/SetupChecks.d.ts +14 -0
  126. package/dist/esm/types/components/SliderModal.d.ts +8 -0
  127. package/dist/esm/types/components/Upload.d.ts +13 -0
  128. package/dist/esm/types/components/VideoCamera.d.ts +28 -0
  129. package/dist/esm/types/components/VideoQuestion.d.ts +9 -0
  130. package/dist/esm/types/components/VideoTimeBar.d.ts +9 -0
  131. package/dist/esm/types/components/WelcomePage.d.ts +11 -0
  132. package/dist/esm/types/components/Widget.d.ts +9 -0
  133. package/dist/esm/types/components/icons/ClockIcon.d.ts +2 -0
  134. package/dist/esm/types/components/icons/Loading.d.ts +2 -0
  135. package/dist/esm/types/components/icons/NoCameraMic.d.ts +2 -0
  136. package/dist/esm/types/components/icons/PlayIcon.d.ts +6 -0
  137. package/dist/esm/types/components/icons/Retake.d.ts +2 -0
  138. package/dist/esm/types/components/icons/RotateScreenIcon.d.ts +2 -0
  139. package/dist/esm/types/components/ui/Loader.d.ts +2 -0
  140. package/dist/esm/types/components/ui/MicrophoneIndicator.d.ts +7 -0
  141. package/dist/esm/types/components/ui/PracticeMode.d.ts +2 -0
  142. package/dist/esm/types/components/ui/Progress.d.ts +6 -0
  143. package/dist/esm/types/components/ui/QuestionDuration.d.ts +6 -0
  144. package/dist/esm/types/components/ui/QuestionNumber.d.ts +7 -0
  145. package/dist/esm/types/components/ui/RecordingButton.d.ts +6 -0
  146. package/dist/esm/types/components/ui/RotateScreen.d.ts +2 -0
  147. package/dist/esm/types/components/ui/Signal.d.ts +9 -0
  148. package/dist/esm/types/components/ui/StartNowButton.d.ts +6 -0
  149. package/dist/esm/types/components/ui/StartRecordingButton.d.ts +10 -0
  150. package/dist/esm/types/components/ui/StopRecordingButton.d.ts +7 -0
  151. package/dist/esm/types/components/ui/UnsupportedModal.d.ts +6 -0
  152. package/dist/esm/types/config/index.d.ts +6 -0
  153. package/dist/esm/types/config/local.env.d.ts +6 -0
  154. package/dist/esm/types/config/prod.env.d.ts +6 -0
  155. package/dist/esm/types/config/staging.env.d.ts +6 -0
  156. package/dist/esm/{i18n → types/i18n}/config.d.ts +28 -37
  157. package/dist/esm/types/index.d.ts +2 -0
  158. package/dist/esm/types/interfaces/candidateInterface.d.ts +10 -0
  159. package/dist/esm/types/interfaces/candidateSessionInterface.d.ts +78 -0
  160. package/dist/esm/types/interfaces/companyInterface.d.ts +3 -0
  161. package/dist/esm/types/interfaces/configInterface.d.ts +33 -0
  162. package/dist/esm/types/interfaces/jobInterface.d.ts +22 -0
  163. package/dist/esm/types/interfaces/microphoneInterface.d.ts +36 -0
  164. package/dist/esm/types/interfaces/networkInterface.d.ts +9 -0
  165. package/dist/esm/types/interfaces/previewInterface.d.ts +14 -0
  166. package/dist/esm/types/interfaces/recorderInterface.d.ts +110 -0
  167. package/dist/esm/types/interfaces/storageInterface.d.ts +29 -0
  168. package/dist/esm/types/interfaces/uploaderInterface.d.ts +39 -0
  169. package/dist/esm/types/interfaces/videoInterface.d.ts +54 -0
  170. package/dist/esm/types/interfaces/widgetInterface.d.ts +192 -0
  171. package/dist/esm/types/machines/acceleratorMachines/accUploaderMachine.d.ts +6 -0
  172. package/dist/esm/types/machines/acceleratorMachines/accWidgetMachine.d.ts +6 -0
  173. package/dist/esm/types/machines/acceleratorMachines/microphoneMachine.d.ts +6 -0
  174. package/dist/esm/types/machines/acceleratorMachines/networkMachine.d.ts +5 -0
  175. package/dist/esm/types/machines/acceleratorMachines/previewMachine.d.ts +6 -0
  176. package/dist/esm/types/machines/acceleratorMachines/recorderMachineV2.d.ts +6 -0
  177. package/dist/esm/types/machines/acceleratorMachines/storageMachine.d.ts +6 -0
  178. package/dist/esm/types/reportWebVitals.d.ts +3 -0
  179. package/dist/esm/types/services/axiosInstances.service.d.ts +3 -0
  180. package/dist/esm/types/services/s3.service.d.ts +1 -0
  181. package/dist/esm/types/services/session.service.d.ts +46 -0
  182. package/dist/esm/types/services/speedTest.service.d.ts +2 -0
  183. package/dist/esm/types/services/video.service.d.ts +7 -0
  184. package/dist/esm/types/setupTests.d.ts +1 -0
  185. package/dist/esm/types/utils/authToken.utils.d.ts +7 -0
  186. package/dist/esm/types/utils/constants.utils.d.ts +9 -0
  187. package/dist/esm/types/utils/debug.utils.d.ts +19 -0
  188. package/dist/esm/types/utils/device.utils.d.ts +12 -0
  189. package/dist/esm/types/utils/errors.utils.d.ts +9 -0
  190. package/dist/esm/types/utils/formatters.utils.d.ts +5 -0
  191. package/dist/esm/types/utils/messages.utils.d.ts +16 -0
  192. package/dist/esm/types/utils/permissionSteps.utils.d.ts +19 -0
  193. package/dist/esm/types/utils/practiceQuestions.utils.d.ts +2 -0
  194. package/dist/esm/types/utils/sentry.utils.d.ts +4 -0
  195. package/dist/esm/types/utils/statusCodes.utils.d.ts +13 -0
  196. package/dist/index.d.ts +13 -45
  197. package/package.json +4 -4
  198. package/dist/esm/components/PreviewItem.d.ts +0 -16
  199. package/dist/esm/components/Widget.d.ts +0 -6
  200. package/dist/esm/index.d.ts +0 -4
  201. package/dist/esm/interfaces/configInterface.d.ts +0 -55
  202. package/dist/esm/services/video.service.d.ts +0 -7
@@ -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>>;
@@ -0,0 +1,6 @@
1
+ import { DoneInvokeEvent } from 'xstate';
2
+ import { RecorderInterface } from '../../interfaces/recorderInterface';
3
+ export declare const recorderMachineV2: import("xstate").StateMachine<RecorderInterface, any, DoneInvokeEvent<any>, {
4
+ value: any;
5
+ context: RecorderInterface;
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/storageInterface';
3
+ export declare const storageMachine: 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,3 @@
1
+ import { ReportHandler } from 'web-vitals';
2
+ declare const reportWebVitals: (onPerfEntry?: ReportHandler) => void;
3
+ export default reportWebVitals;
@@ -0,0 +1,3 @@
1
+ export declare const videoAxiosInstance: import("axios").AxiosInstance;
2
+ export declare const s3AxiosInstance: import("axios").AxiosInstance;
3
+ export declare const updateVideoAxiosAuth: (auth: string) => void;
@@ -0,0 +1 @@
1
+ export declare const uploadToS3: (url: string, data: File, onProgress?: ((e: any) => void) | undefined, timeout?: number) => Promise<void>;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * @author tht7 ( tht7 )
3
+ * @date 10/07/12022 6:36 pm
4
+ */
5
+ import { ICandidateSession } from '../interfaces/candidateSessionInterface';
6
+ /**
7
+ * This function will update the session in the database and cache it in the window object
8
+ * it will fill in the current session over the provided object
9
+ * @param session
10
+ * @param baseURL
11
+ */
12
+ export declare function updateSession(session: Partial<ICandidateSession>, baseURL?: string): Promise<ICandidateSession | undefined>;
13
+ /**
14
+ * This function will fetch the session from the sessionStorage and server
15
+ * it will then cache the session in the window object
16
+ * @param _session - in case you want to override the session, or save a new one to the cache
17
+ * @param _session_id - in case you want to override the session_id and fetch from the server
18
+ */
19
+ export declare function getCandidateSession(_session?: ICandidateSession, _session_id?: string): Promise<ICandidateSession | undefined>;
20
+ export declare function getSessionIdFromCache(): string | undefined | null;
21
+ /**
22
+ * this will remove the session from the sessionStorage, but not the window cache
23
+ * this should signal the end of this session
24
+ * however the end of a session is when the window gets closed
25
+ * so in order to prevent a new window from (maybe) getting the stale session
26
+ * we remove it from the sessionStorage
27
+ */
28
+ export declare function deleteSession(): void;
29
+ /** ehehehe this is a type that takes 2 types and matches all the keys of type V from type K */
30
+ declare type KeysMatching<T, V> = {
31
+ [K in keyof T]-?: T[K] extends (V | undefined) ? K : never;
32
+ }[keyof T];
33
+ /**
34
+ * A cute shortcut for updating a date event in the session
35
+ * just give it the key of the date event, and it will update it
36
+ * @param eventType
37
+ */
38
+ export declare function registerDateEvent(eventType: KeysMatching<ICandidateSession, Date>): Promise<ICandidateSession | undefined>;
39
+ /**
40
+ * Another cute shortcut for updating a number state of a session
41
+ * if no data is provided, it will just increment the number
42
+ * @param eventType
43
+ * @param data
44
+ */
45
+ export declare function registerCountEvent(eventType: KeysMatching<ICandidateSession, number>, data?: number): Promise<ICandidateSession | undefined>;
46
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare const ONE_MB_IN_BYTES = 1048576;
2
+ export declare const accSpeedTest: () => Promise<number>;
@@ -0,0 +1,7 @@
1
+ import { IConfigRequest, IConfigResponse } from '../interfaces/configInterface';
2
+ import { IVideo, IVideoFile } from '../interfaces/videoInterface';
3
+ export declare const createVideo: (config: IConfigRequest) => Promise<IConfigResponse>;
4
+ export declare const getVideo: (videoId: string) => Promise<IConfigResponse>;
5
+ export declare const updateVideo: ({ video_id, completed, uploaded, bandwidth }: IVideo) => Promise<IConfigResponse>;
6
+ export declare const updateVideoFile: (videoId: string, videoFile: IVideoFile) => Promise<IConfigResponse>;
7
+ export declare const getUploadUrl: (videoId: string, fileName: string, typeExtension: string) => Promise<IConfigResponse>;
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,7 @@
1
+ interface IGetToken {
2
+ type: string;
3
+ value: string;
4
+ secretKey: string;
5
+ }
6
+ export declare const getToken: ({ type, value, secretKey }: IGetToken) => string;
7
+ export {};
@@ -0,0 +1,9 @@
1
+ export declare const DEFAULT_COUNT_DOWN = 3;
2
+ export declare const DEFAULT_DURATION = 60;
3
+ export declare const ENOUGH_RECODING_TIME = 3;
4
+ export declare const SPEED_TEST_FILE_SIZE = 5;
5
+ export declare const FAST_UPLOAD_SPEED = 0.35;
6
+ export declare const SLOW_UPLOAD_SPEED = 0.1;
7
+ export declare const SPEED_TEST_TIMEOUT = 5000;
8
+ export declare const MICROPHONE_NO_SOUND_ERROR_CODE = 777;
9
+ export declare const VIDEO_INACTIVE_TIMEOUT = 2000;
@@ -0,0 +1,19 @@
1
+ export declare const enum DEBUG {
2
+ FETCHING_INTERVIEW = "Fetching interview data",
3
+ INTERVIEW_DATA_RECEIVED = "Interview data received",
4
+ FETCHING_INTERVIEW_ERROR = "Failed to fetch interview",
5
+ WELCOME_PAGE_STAGE = "In welcome page stage",
6
+ SETUP_STAGE = "In setup stage",
7
+ MEIDA_DEVICE_SUCCESS = "Media device available",
8
+ MEDIA_DEVICE_ERROR = "Media device error",
9
+ NO_SOUND_DETECTED = "No sound detected",
10
+ DEVICE_CHANGED = "Device changed",
11
+ SPEED_TEST_DONE = "Speed test result received",
12
+ PRACTICE_STARTED = "Practice started",
13
+ INTERVIEW_STARTED = "Interview started",
14
+ RETAKE_CLICKED = "Retake clicked",
15
+ QUESTION_SUBMITTED = "Qeustion submitted",
16
+ UPLOADING_STATE = "In uploading state",
17
+ UPLOAD_COMPLETED = "Upload completed",
18
+ INTERVIEW_SUBMITTED = "Interview submitted successfully"
19
+ }
@@ -0,0 +1,12 @@
1
+ export declare const isMobile: boolean;
2
+ export declare const isAndroid: boolean;
3
+ export declare const isSupportedIosDevice: boolean;
4
+ export declare const isSupportedDevice: boolean;
5
+ declare const PLATFORMS_OPTIONS: readonly ["ANDROID", "IOS", "MACBOOK", "WINDOWS"];
6
+ declare const BROWSERS_OPTIONS: readonly ["CHROME", "SAFARI", "FIREFOX", "SAMSUNG"];
7
+ declare type DEVICE_TYPE = {
8
+ PLATFORM: typeof PLATFORMS_OPTIONS[number];
9
+ BROWSER: typeof BROWSERS_OPTIONS[number];
10
+ };
11
+ export declare const DEVICE: DEVICE_TYPE;
12
+ export {};
@@ -0,0 +1,9 @@
1
+ import { STATUS_CODES } from './statusCodes.utils';
2
+ export interface IVideoError {
3
+ callId: string;
4
+ errorCode: number;
5
+ errorMessage: string;
6
+ statusCode: STATUS_CODES;
7
+ statusReason: string;
8
+ time: number;
9
+ }
@@ -0,0 +1,5 @@
1
+ export declare const twoDigitsNumber: (num: number) => string;
2
+ export declare const timeFormatter: (number: number) => string;
3
+ export declare const timeLeftInMinutesFormatter: (number: number) => string;
4
+ export declare const timerCountDown: (number: number) => string;
5
+ export declare const formattedDuration: (number: number) => string;
@@ -0,0 +1,16 @@
1
+ export declare const CAMERA_STATES_MESSAGES: {
2
+ WAITING: string;
3
+ ERROR: string;
4
+ READY: string;
5
+ };
6
+ export declare const MICROPHONE_STATES_MESSAGES: {
7
+ WAITING: string;
8
+ ERROR: string;
9
+ READY: string;
10
+ };
11
+ export declare const INTERNET_STATES_MESSAGES: {
12
+ DISCONNECTED: string;
13
+ TESTING: string;
14
+ SLOW_CONNECTION: string;
15
+ CONNECTED: string;
16
+ };
@@ -0,0 +1,19 @@
1
+ export declare const PERMISSION_STEPS: {
2
+ IOS: {
3
+ CHROME: string[];
4
+ SAFARI: string[];
5
+ };
6
+ ANDROID: {
7
+ CHROME: string[];
8
+ SAMSUNG: string[];
9
+ };
10
+ MACBOOK: {
11
+ CHROME: string[];
12
+ SAFARI: string[];
13
+ FIREFOX: string[];
14
+ };
15
+ WINDOWS: {
16
+ CHROME: string[];
17
+ FIREFOX: string[];
18
+ };
19
+ };
@@ -0,0 +1,2 @@
1
+ import { IQuestion } from '../interfaces/jobInterface';
2
+ export declare const PRACTICE_QUESTIONS: IQuestion[];
@@ -0,0 +1,4 @@
1
+ import * as Sentry from '@sentry/browser';
2
+ import { DoneInvokeEvent } from 'xstate';
3
+ export declare const SentryHub: Sentry.Hub;
4
+ export declare const SentryTrackingFn: (event: DoneInvokeEvent<any>, context: any, name: string) => void;
@@ -0,0 +1,13 @@
1
+ export declare const enum STATUS_CODES {
2
+ OK = 200,
3
+ CREATED = 201,
4
+ DELETED = 202,
5
+ BAD_REQUEST = 400,
6
+ UNAUTHORIZED = 401,
7
+ PAYMENT_REQUIRED = 402,
8
+ FORBIDDEN = 403,
9
+ NOT_FOUND = 404,
10
+ TOO_MANY_REQUESTS = 429,
11
+ SERVER_ERROR = 500,
12
+ SERVICE_UNAVAILABLE = 503
13
+ }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import React, { CSSProperties } from 'react';
1
+ import React from 'react';
2
2
 
3
3
  interface ICandidate {
4
4
  candidate_id?: string;
@@ -24,13 +24,9 @@ interface IQuestion {
24
24
  videoQuestion?: string;
25
25
  description?: string;
26
26
  }
27
- declare type IClientQuestion = Omit<IQuestion, 'numOfRetakes' | 'partDuration' | 'thinkingTime'> & {
28
- attempts?: number;
29
- duration?: number;
30
- thinkingTime?: number;
31
- };
32
27
  interface IJob {
33
28
  language?: string;
29
+ overlay?: string;
34
30
  transcriptLanguage?: string;
35
31
  title?: string;
36
32
  company?: string;
@@ -40,11 +36,7 @@ interface IJob {
40
36
  old_jobID?: string;
41
37
  apiKey?: string;
42
38
  company_id?: string;
43
- jobID?: string;
44
39
  }
45
- declare type IClientJob = Omit<IJob, 'questions'> & {
46
- questions?: IClientQuestion[];
47
- };
48
40
 
49
41
  interface IVideoPlatformOS {
50
42
  architecture: number;
@@ -71,7 +63,6 @@ interface IVideoFile {
71
63
  videoLength?: number;
72
64
  uploadUrl?: string;
73
65
  question?: string;
74
- selectedTake?: number;
75
66
  }
76
67
  interface IVideo {
77
68
  video_id: string;
@@ -98,52 +89,29 @@ interface IVideo {
98
89
  }
99
90
 
100
91
  declare type IMessageType = 'completed' | 'deadline' | 'applied' | 'inactiveJob';
101
- interface IOnFinish {
92
+ interface IOnCompleteCallback {
102
93
  redirectUrl?: string;
103
94
  video_id: string;
104
95
  }
105
96
  interface IOnError {
106
97
  messageType: IMessageType;
107
98
  }
108
- declare type IEnv = 'dev' | 'staging' | 'production';
109
99
  interface IConfig {
110
- auth: string;
111
- onWidgetClicked?: () => void;
112
- onFinish?: (data: IOnFinish) => void;
113
- onError?: (data: IOnError) => void;
114
- openAnimation?: boolean;
115
- debug?: boolean;
116
- practiceQuestions?: IQuestion[];
117
- overlay?: string;
118
- introVideo?: string;
119
- introVideoTitle?: string;
120
- env?: IEnv;
121
- }
122
- declare type IClientConfig = Omit<IConfig, 'practiceQuestions'> & {
123
- practiceQuestions?: IClientQuestion[];
124
- };
125
- interface IWidgetConfig {
126
100
  video?: IVideo;
127
101
  candidate: ICandidate;
128
102
  job?: IJob;
129
103
  company?: ICompany;
130
- config: IConfig;
131
- disabled?: boolean;
132
- buttonText?: string;
133
- buttonStyle?: CSSProperties;
104
+ config: {
105
+ auth: string;
106
+ onCompleteCallback?: (data: IOnCompleteCallback) => void;
107
+ onError?: (data: IOnError) => void;
108
+ };
134
109
  }
135
- declare type IClientWidgetConfig = Omit<IWidgetConfig, 'job' | 'config'> & {
136
- job: IClientJob;
137
- config: IClientConfig;
138
- };
139
110
 
140
- interface IGetToken {
141
- type: string;
142
- value: string;
143
- secretKey: string;
111
+ interface IProps extends IConfig {
112
+ disabled?: boolean;
113
+ buttonText?: string;
144
114
  }
145
- declare const getToken: ({ type, value, secretKey }: IGetToken) => string;
146
-
147
- declare const Widget: React.FC<IClientWidgetConfig>;
115
+ declare const Widget: React.FC<IProps>;
148
116
 
149
- export { IClientWidgetConfig, IWidgetConfig, Widget, getToken };
117
+ export { Widget };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myinterview/widget-react",
3
- "version": "1.0.11",
3
+ "version": "1.0.88",
4
4
  "description": "myInterview widget v3",
5
5
  "module": "dist/esm/index.js",
6
6
  "files": [
@@ -8,8 +8,8 @@
8
8
  ],
9
9
  "types": "dist/index.d.ts",
10
10
  "dependencies": {
11
- "@myinterview/component-library": "1.0.12",
12
11
  "@cloudflare/stream-react": "^1.8.0",
12
+ "@myinterview/component-library": "^0.0.86",
13
13
  "@sentry/react": "^7.7.0",
14
14
  "@sentry/tracing": "^7.7.0",
15
15
  "@xstate/react": "^3.0.1",
@@ -30,8 +30,8 @@
30
30
  "start-prod": "REACT_APP_ENV=prod HTTPS=true react-scripts start",
31
31
  "start-staging": "REACT_APP_ENV=staging HTTPS=true react-scripts start",
32
32
  "build": "react-scripts build",
33
- "publish-prod": "REACT_APP_ENV=prod rollup -c && npm publish",
34
- "publish-staging": "REACT_APP_ENV=staging rollup -c && npm publish --tag beta",
33
+ "rollup": "REACT_APP_ENV=prod rollup -c",
34
+ "rollup-staging": "REACT_APP_ENV=staging rollup -c",
35
35
  "test": "react-scripts test",
36
36
  "eject": "react-scripts eject"
37
37
  },
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- export interface IDimensions {
3
- x: number;
4
- y: number;
5
- width: number;
6
- }
7
- interface IProps {
8
- blob: string;
9
- onSelectVideo: () => void;
10
- isSelected: boolean;
11
- position: number;
12
- isPreviewMode: boolean;
13
- onPreviewMode: (dimensions: IDimensions) => void;
14
- }
15
- export declare const PreviewItem: React.FC<IProps>;
16
- export {};
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- import { IClientWidgetConfig } from '../interfaces/configInterface';
3
- import '../assets/styles/global.scss';
4
- import { getToken } from '../utils/authToken.utils';
5
- export declare const Widget: React.FC<IClientWidgetConfig>;
6
- export { getToken };
@@ -1,4 +0,0 @@
1
- import { Widget, getToken } from './components/Widget';
2
- import { IWidgetConfig, IClientWidgetConfig } from './interfaces/configInterface';
3
- export { Widget, getToken };
4
- export type { IWidgetConfig, IClientWidgetConfig };