@myinterview/widget-react 1.0.29 → 1.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -27743,7 +27743,7 @@ const MAX_FAILED_RECORDING_ATTEMPTS = 2;
27743
27743
  const MICROPHONE_RETAKE_COUNT = 100; // By reaching this number we understand the mic is stuck / muted
27744
27744
 
27745
27745
  /* eslint-disable react/jsx-no-useless-fragment */
27746
- const VideoQuestion = ({ src, isThinkingTime, onVideoEnds, hidden = false, }) => {
27746
+ const VideoQuestion = ({ src, isThinkingTime, onVideoEnds, hidden = false, isWidgetMinimized, }) => {
27747
27747
  var _a;
27748
27748
  const { t } = useTranslation();
27749
27749
  const isCloudflare = ['watch.videodelivery.net', 'cloudflarestream'].some((s) => src.includes(s));
@@ -27836,6 +27836,14 @@ const VideoQuestion = ({ src, isThinkingTime, onVideoEnds, hidden = false, }) =>
27836
27836
  setIsActive(false);
27837
27837
  }, VIDEO_INACTIVE_TIMEOUT);
27838
27838
  };
27839
+ useEffect(() => {
27840
+ var _a;
27841
+ if (isWidgetMinimized && !isThinkingTime) {
27842
+ if (isCloudflare)
27843
+ (_a = cloudFlarePlayerRef.current) === null || _a === void 0 ? void 0 : _a.pause();
27844
+ setIsPlaying(false);
27845
+ }
27846
+ }, [isWidgetMinimized]);
27839
27847
  const videoQuestionClassNames = classNames({
27840
27848
  'myinterview-widget-video-question': true,
27841
27849
  'myinterview-widget-video-question--hidden': hidden,
@@ -27995,7 +28003,7 @@ const InnerView = React__default.forwardRef(({ widgetMachine, sendToWidget, reco
27995
28003
  React__default.createElement("div", { className: contentClasseNames },
27996
28004
  isExplanationState && (React__default.createElement(Explanation, { isVideoQuestion: !!(currentQuestionObj === null || currentQuestionObj === void 0 ? void 0 : currentQuestionObj.videoQuestion), thinkingTime: currentQuestionObj.thinkingTime })),
27997
28005
  React__default.createElement(VideoCamera, { ref: videoRef, microphoneRef: microphoneRef, isCameraDisplayed: isCameraDisplayed, isPracticeModeDisplayed: !isQuestionMode && isRecording, errorType: RecorderError, isPermissionStepsOpen: isSliderModalOpen, onDisplayPermissionSteps: onOpenSliderModal, onReInitRecorder: onReInitRecorder, onClosePermissionSteps: onCloseSliderModal, onRecorderRetry: isSetupState ? onRecorderRetry : onReInitRecorder, isRecorderCanChangeSettings: ((isSetupState && isRecorderCanChangeSettings) || (RecorderError && isRecording)), videoDevices: videoDevices, audioDevices: audioDevices, selectedVideoDevice: selectedVideoDevice, selectedAudioDevice: selectedAudioDevice, handleDeviceChange: handleDeviceChange, canStartRecording: canStartRecording, currentQuestion: currentQuestion, numberOfQuestions: questions.length, currentQuestionObj: currentQuestionObj, isRecording: isRecording, durations: durations, recordingTime: recordingTime, isCountDown: isCountDown, countdown: countdown, isQuestionDisplayed: isQuestionDisplayed }),
27998
- (isVideoQuestionState || (isExplanationState && !!(currentQuestionObj === null || currentQuestionObj === void 0 ? void 0 : currentQuestionObj.videoQuestion))) && (React__default.createElement(VideoQuestion, { src: (currentQuestionObj === null || currentQuestionObj === void 0 ? void 0 : currentQuestionObj.videoQuestion) || '', isThinkingTime: isThinkingTime, onVideoEnds: onVideoEnds, hidden: isExplanationState })),
28006
+ (isVideoQuestionState || (isExplanationState && !!(currentQuestionObj === null || currentQuestionObj === void 0 ? void 0 : currentQuestionObj.videoQuestion))) && (React__default.createElement(VideoQuestion, { src: (currentQuestionObj === null || currentQuestionObj === void 0 ? void 0 : currentQuestionObj.videoQuestion) || '', isThinkingTime: isThinkingTime, onVideoEnds: onVideoEnds, isWidgetMinimized: isWidgetMinimized, hidden: isExplanationState })),
27999
28007
  previewRef && isPreviewState && (React__default.createElement(PreviewList, { previewRef: previewRef, onNextQuestion: onNextQuestion, onNextRetake: onNextRetake, onQuestionMode: onQuestionMode, isRetakeAvailable: isRetakeAvailable, totalRetakes: totalRetakes, isQuestionMode: isQuestionMode, isLastQuestion: isLastQuestion, isConnected: isConnected, currentQuestion: currentQuestion, numberOfQuestions: questions.length })),
28000
28008
  canStartRecording && (React__default.createElement(StartRecordingButton, { onClick: () => sendToWidget(EVENTS$4.NEXT_STEP), disabled: !!(currentQuestionObj === null || currentQuestionObj === void 0 ? void 0 : currentQuestionObj.videoQuestion) && !isQuestionVideoWatched && isVideoQuestionState, isExplanationState: isExplanationState, isVideoQuestionState: isVideoQuestionState, isVideoQuestion: !!(currentQuestionObj === null || currentQuestionObj === void 0 ? void 0 : currentQuestionObj.videoQuestion) })),
28001
28009
  isCountDown && countdown > DEFAULT_COUNT_DOWN && (React__default.createElement(StartNowButton, { onClick: () => sendToRecorder(EVENTS$5.FORCE_START) })),
@@ -34791,7 +34799,7 @@ const TopTips = () => {
34791
34799
  React__default.createElement($, { y: 1 })));
34792
34800
  };
34793
34801
 
34794
- const WelcomePage = ({ introVideo, welcomeTitle = t('welcome.title'), welcomeText, onContinue, logo, company, title, termsUrl = 'https://www.myinterview.com/terms/', privacyUrl = 'https://www.myinterview.com/privacy/', isResumed, }) => {
34802
+ const WelcomePage = ({ introVideo, welcomeTitle = t('welcome.title'), welcomeText, onContinue, logo, company, title, termsUrl = 'https://www.myinterview.com/terms/', privacyUrl = 'https://www.myinterview.com/privacy/', isResumed, isWidgetMinimized, }) => {
34795
34803
  const [isTextOpened, setIsTextOpened] = useState(false);
34796
34804
  const [shouldShowToggle, setShouldShowToggle] = useState(false);
34797
34805
  const [isTopTipsOpened, setIsTopTipsOpened] = useState(false);
@@ -34804,7 +34812,7 @@ const WelcomePage = ({ introVideo, welcomeTitle = t('welcome.title'), welcomeTex
34804
34812
  });
34805
34813
  return (React__default.createElement(React__default.Fragment, null,
34806
34814
  React__default.createElement("div", { className: "myinterview-widget-inner myinterview-widget-inner--welcome-page-state myinterview-widget-inner--no-snap" },
34807
- React__default.createElement(VideoQuestion, { src: introVideo, isThinkingTime: false, onVideoEnds: () => { } })),
34815
+ React__default.createElement(VideoQuestion, { src: introVideo, isThinkingTime: false, onVideoEnds: () => { }, isWidgetMinimized: isWidgetMinimized })),
34808
34816
  React__default.createElement("div", { className: "myinterview-widget-outer background-color--white myinterview-widget-outer--no-snap" },
34809
34817
  React__default.createElement(Header, { logo: logo || '', companyName: company || '', jobTitle: title || '', forDesktopLayout: true }),
34810
34818
  React__default.createElement("div", { className: "myinterview-widget-welcome-page myinterview-widget-scroll-indicator" },
@@ -34919,7 +34927,7 @@ const Main = ({ widgetConfig, setShouldShowWaterMark, isWidgetMinimized }) => {
34919
34927
  !isErrorState && !isLoading && (React__default.createElement(Header, { logo: (job === null || job === void 0 ? void 0 : job.logo) || '', companyName: (job === null || job === void 0 ? void 0 : job.company) || (company === null || company === void 0 ? void 0 : company.name) || '', jobTitle: (job === null || job === void 0 ? void 0 : job.title) || '', hidden: !isVideoQuestionState && !isWelcomeState })),
34920
34928
  React__default.createElement("div", { ref: viewsRef, className: viewsClassNames, onScroll: handleScroll }, isErrorState
34921
34929
  ? React__default.createElement(Error$1, { error: machine.context.error, onRetry: onRetry })
34922
- : isWelcomeState ? (React__default.createElement(WelcomePage, { introVideo: widgetConfig.config.introVideo || '', welcomeTitle: widgetConfig.config.welcomeTitle, welcomeText: widgetConfig.config.welcomeText || '', onContinue: onContinueClicked, logo: (job === null || job === void 0 ? void 0 : job.logo) || '', company: (job === null || job === void 0 ? void 0 : job.company) || (company === null || company === void 0 ? void 0 : company.name) || '', title: (job === null || job === void 0 ? void 0 : job.title) || '', termsUrl: job === null || job === void 0 ? void 0 : job.termsUrl, privacyUrl: job === null || job === void 0 ? void 0 : job.privacyUrl, isResumed: isResumed }))
34930
+ : isWelcomeState ? (React__default.createElement(WelcomePage, { introVideo: widgetConfig.config.introVideo || '', welcomeTitle: widgetConfig.config.welcomeTitle, welcomeText: widgetConfig.config.welcomeText || '', onContinue: onContinueClicked, logo: (job === null || job === void 0 ? void 0 : job.logo) || '', company: (job === null || job === void 0 ? void 0 : job.company) || (company === null || company === void 0 ? void 0 : company.name) || '', title: (job === null || job === void 0 ? void 0 : job.title) || '', termsUrl: job === null || job === void 0 ? void 0 : job.termsUrl, privacyUrl: job === null || job === void 0 ? void 0 : job.privacyUrl, isResumed: isResumed, isWidgetMinimized: isWidgetMinimized }))
34923
34931
  : isLoading || !recorderRef
34924
34932
  ? React__default.createElement(Loader, null)
34925
34933
  : (React__default.createElement(React__default.Fragment, null,