@myinterview/widget-react 1.1.47 → 1.1.49-development-4577eb9

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.
@@ -38,6 +38,7 @@ interface IConfig {
38
38
  forcedView?: IViews;
39
39
  useSafeUpload?: boolean;
40
40
  useLightDom?: boolean;
41
+ antiCheat?: boolean;
41
42
  }
42
43
  export type IClientConfig = Omit<IConfig, 'practiceQuestions'> & {
43
44
  practiceQuestions?: IClientQuestion[];
@@ -21,6 +21,7 @@ export interface IQuestionTextAnswer extends IQuestion {
21
21
  config?: {
22
22
  minChars?: number;
23
23
  maxChars?: number;
24
+ antiCheat?: boolean;
24
25
  };
25
26
  }
26
27
  export interface IMultipleChoiceOptionDefinition {
@@ -6,6 +6,7 @@ interface IProps {
6
6
  currentQuestion: number;
7
7
  numberOfQuestions: number;
8
8
  timer: number;
9
+ antiCheat: boolean;
9
10
  onSubmitAssessment: (answer: IMultipleAnswer[] | string, isValidAnswer: boolean) => void;
10
11
  }
11
12
  export declare const AssessmentController: React.FC<IProps>;
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  interface IProps {
3
3
  onAnswer: (answer: string) => void;
4
4
  maxChars?: number;
5
+ antiCheat?: boolean;
5
6
  }
6
7
  export declare const AssessmentFreeText: React.FC<IProps>;
7
8
  export {};
package/dist/esm/index.js CHANGED
@@ -35427,7 +35427,7 @@ const prod_config = {
35427
35427
  const config$1 = (configEnv) => {
35428
35428
  let env = configEnv;
35429
35429
  try {
35430
- env !== null && env !== void 0 ? env : (env = "prod");
35430
+ env !== null && env !== void 0 ? env : (env = "staging");
35431
35431
  }
35432
35432
  catch (_a) { }
35433
35433
  switch (env) {
@@ -35446,8 +35446,8 @@ const configGenerator = () => {
35446
35446
  let environment;
35447
35447
  let release;
35448
35448
  try {
35449
- environment !== null && environment !== void 0 ? environment : (environment = "prod");
35450
- release !== null && release !== void 0 ? release : (release = "1.1.47");
35449
+ environment !== null && environment !== void 0 ? environment : (environment = "staging");
35450
+ release !== null && release !== void 0 ? release : (release = "1.1.49");
35451
35451
  }
35452
35452
  catch (_a) {
35453
35453
  console.error('sentry configGenerator error');
@@ -45228,9 +45228,14 @@ const CharactersLimit = ({ currentLength, maxLength }) => (React__default.create
45228
45228
  ' ',
45229
45229
  maxLength));
45230
45230
 
45231
- const AssessmentFreeText = ({ onAnswer, maxChars = DEFAULT_ASSESSMENT_MAX_CHARS }) => {
45231
+ const AssessmentFreeText = ({ onAnswer, maxChars = DEFAULT_ASSESSMENT_MAX_CHARS, antiCheat = false }) => {
45232
45232
  const { t } = useTranslation();
45233
45233
  const [answerInput, setAnswerInput] = useState('');
45234
+ const handlePaste = (e) => {
45235
+ if (antiCheat) {
45236
+ e.preventDefault();
45237
+ }
45238
+ };
45234
45239
  const handleChange = (e) => {
45235
45240
  const val = e.target.value;
45236
45241
  const valToSet = maxChars && val.length > maxChars ? val.substring(0, maxChars) : val;
@@ -45238,7 +45243,7 @@ const AssessmentFreeText = ({ onAnswer, maxChars = DEFAULT_ASSESSMENT_MAX_CHARS
45238
45243
  onAnswer(valToSet);
45239
45244
  };
45240
45245
  return (React__default.createElement("div", { className: "myinterview-widget-assessment__free-text" },
45241
- React__default.createElement("textarea", { className: "myinterview-widget-assessment__input myinterview-widget-scroll-indicator", value: answerInput, placeholder: t('assessment.free_text.input_placeholder'), onChange: handleChange }),
45246
+ React__default.createElement("textarea", { className: "myinterview-widget-assessment__input myinterview-widget-scroll-indicator", value: answerInput, placeholder: t('assessment.free_text.input_placeholder'), onPaste: handlePaste, onDrop: handlePaste, onChange: handleChange }),
45242
45247
  !!maxChars && React__default.createElement(CharactersLimit, { currentLength: answerInput.length, maxLength: maxChars })));
45243
45248
  };
45244
45249
 
@@ -45277,8 +45282,8 @@ const ANSWER_COMPONENTS = {
45277
45282
  [ANSWER_TYPES.SINGLE]: AssessmentSingleSelect,
45278
45283
  [ANSWER_TYPES.MULTIPLE]: AssessmentMultiSelect,
45279
45284
  };
45280
- const AssessmentController = ({ currentQuestionObj, timer, currentQuestion, numberOfQuestions, onSubmitAssessment }) => {
45281
- var _a, _b;
45285
+ const AssessmentController = ({ currentQuestionObj, timer, currentQuestion, numberOfQuestions, antiCheat, onSubmitAssessment }) => {
45286
+ var _a, _b, _c;
45282
45287
  const { t } = useTranslation();
45283
45288
  const answerToSubmit = useRef(currentQuestionObj.answerType !== ANSWER_TYPES.TEXT ? [] : '');
45284
45289
  const AnswerComponent = useMemo(() => ANSWER_COMPONENTS[currentQuestionObj.answerType], [currentQuestionObj.answerType]);
@@ -45311,7 +45316,7 @@ const AssessmentController = ({ currentQuestionObj, timer, currentQuestion, numb
45311
45316
  React__default.createElement(CountDown, { countDown: timer, forceMobileCounter: true, numberOfSecondsToHighlight: SECONDS_LEFT_HIGHLIGHT }))),
45312
45317
  React__default.createElement(Question, { questionObj: currentQuestionObj }),
45313
45318
  React__default.createElement(AnswerInstructions, { currentQuestionObj: currentQuestionObj }),
45314
- React__default.createElement(AnswerComponent, Object.assign({ answerOptions: answerOptions, onAnswer: onAnswer }, (currentQuestionObj.answerType === ANSWER_TYPES.TEXT) && { maxChars: (_b = currentQuestionObj.config) === null || _b === void 0 ? void 0 : _b.maxChars })),
45319
+ React__default.createElement(AnswerComponent, Object.assign({ answerOptions: answerOptions, onAnswer: onAnswer }, (currentQuestionObj.answerType === ANSWER_TYPES.TEXT) && { maxChars: (_b = currentQuestionObj.config) === null || _b === void 0 ? void 0 : _b.maxChars, antiCheat: antiCheat || ((_c = currentQuestionObj.config) === null || _c === void 0 ? void 0 : _c.antiCheat) })),
45315
45320
  React__default.createElement(C, { disabled: !isValidAnswer, className: "myinterview-widget-assessment__submit-button", onClick: () => onSubmit(false) }, t('buttons.SUBMIT'))));
45316
45321
  };
45317
45322
 
@@ -45460,7 +45465,7 @@ const InnerView = React__default.forwardRef(({ widgetMachine, sendToWidget, reco
45460
45465
  isExplanationState && (React__default.createElement(Explanation, { isVideoQuestion: !!(currentQuestionObj === null || currentQuestionObj === void 0 ? void 0 : currentQuestionObj.videoQuestion), isAssessment: isAssessment, timeLimit: isAssessment ? currentQuestionObj.partDuration : currentQuestionObj.thinkingTime, answerType: currentQuestionObj.answerType || ANSWER_TYPES.VIDEO, duration: currentQuestionObj.partDuration, takes: currentQuestionObj.numOfRetakes })),
45461
45466
  React__default.createElement(VideoCamera, { recordWithoutVideo: recordWithoutVideo, myinterviewRef: myinterviewRef, ref: videoRef, microphoneRef: microphoneRef, isCameraDisplayed: isCameraDisplayed, isPracticeModeDisplayed: !isQuestionMode && isRecording, errorType: errorType, isPermissionStepsOpen: isSliderModalOpen, onDisplayPermissionSteps: onOpenSliderModal, onReInitRecorder: onReInitRecorder, onClosePermissionSteps: onCloseSliderModal, onRecorderRetry: isSetupState ? onRecorderRetry : onReInitRecorder, isRecorderCanChangeSettings: isRecorderCanChangeSettings, 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, isAssessment: isAssessment }),
45462
45467
  isAssessmentState && !!(currentQuestionObj === null || currentQuestionObj === void 0 ? void 0 : currentQuestionObj.answerType) && (currentQuestionObj === null || currentQuestionObj === void 0 ? void 0 : currentQuestionObj.answerType) !== ANSWER_TYPES.VIDEO
45463
- && (React__default.createElement(AssessmentController, { currentQuestionObj: currentQuestionObj, timer: timer, currentQuestion: currentQuestion, numberOfQuestions: questions.length, onSubmitAssessment: onSubmitAssessment })),
45468
+ && (React__default.createElement(AssessmentController, { currentQuestionObj: currentQuestionObj, timer: timer, currentQuestion: currentQuestion, numberOfQuestions: questions.length, onSubmitAssessment: onSubmitAssessment, antiCheat: !!widgetConfig.config.antiCheat })),
45464
45469
  isTimesUpState && React__default.createElement(TimesUp, { onContinue: onContinue }),
45465
45470
  (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, onVideoStateChanged: onVideoStateChanged })),
45466
45471
  previewRef && isPreviewState && (React__default.createElement(PreviewList, { myinterviewRef: myinterviewRef, previewRef: previewRef, onNextQuestion: onNextQuestion, onNextRetake: onNextRetake, onQuestionMode: onQuestionMode, isRetakeAvailable: isRetakeAvailable, totalRetakes: totalRetakes, isQuestionMode: isQuestionMode, isLastQuestion: isLastQuestion, isConnected: isConnected, currentQuestion: currentQuestion, numberOfQuestions: questions.length })),
@@ -55086,7 +55091,7 @@ const DivComponent = React__default.forwardRef((_a, ref) => {
55086
55091
  return React__default.createElement("div", Object.assign({ ref: ref }, props), children);
55087
55092
  });
55088
55093
  const Widget = forwardRef(({ candidate, job, video, config, disabled = false, buttonText = 'START INTERVIEW', buttonStyle = {}, children, styleUrls = [], fontsUrls = [], }, clientRef) => {
55089
- const widget_version = "1.1.47";
55094
+ const widget_version = "1.1.49";
55090
55095
  const [isWidgetOpen, setIsWidgetOpen] = useState(false);
55091
55096
  const [isWidgetMinimized, setIsWidgetMinimized] = useState(false);
55092
55097
  const [isIncognitoMode, setIsIncognitoMode] = useState(false);