@myinterview/widget-react 1.0.37-beta-30edb9a → 1.0.37-beta-3440f1a

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.
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import { IVideoCorruptedMessagesKey } from '../interfaces/widgetInterface';
3
3
  import { IDeviceSelectorList } from './DeviceSelectorList';
4
- export declare type VIDEO_ERRORS = Exclude<IVideoCorruptedMessagesKey, 'NO_ERROR'>;
5
- export declare type MODAL_ERROR_KEY = 'MEDIA_PERMISSION' | 'NO_SOUND' | 'CONNECTION' | VIDEO_ERRORS;
4
+ export type VIDEO_ERRORS = Exclude<IVideoCorruptedMessagesKey, 'NO_ERROR'>;
5
+ export type MODAL_ERROR_KEY = 'MEDIA_PERMISSION' | 'NO_SOUND' | 'CONNECTION' | VIDEO_ERRORS;
6
6
  interface IProps extends Partial<IDeviceSelectorList> {
7
7
  errorType: MODAL_ERROR_KEY;
8
8
  onDisplayPermissionSteps?: () => void;
package/dist/esm/index.js CHANGED
@@ -15112,11 +15112,18 @@ function safeJoin(input, delimiter) {
15112
15112
  }
15113
15113
 
15114
15114
  /**
15115
- * Checks if the value matches a regex or includes the string
15116
- * @param value The string value to be checked against
15117
- * @param pattern Either a regex or a string that must be contained in value
15115
+ * Checks if the given value matches a regex or string
15116
+ *
15117
+ * @param value The string to test
15118
+ * @param pattern Either a regex or a string against which `value` will be matched
15119
+ * @param requireExactStringMatch If true, `value` must match `pattern` exactly. If false, `value` will match
15120
+ * `pattern` if it contains `pattern`. Only applies to string-type patterns.
15118
15121
  */
15119
- function isMatchingPattern(value, pattern) {
15122
+ function isMatchingPattern(
15123
+ value,
15124
+ pattern,
15125
+ requireExactStringMatch = false,
15126
+ ) {
15120
15127
  if (!isString$1(value)) {
15121
15128
  return false;
15122
15129
  }
@@ -15124,12 +15131,31 @@ function isMatchingPattern(value, pattern) {
15124
15131
  if (isRegExp(pattern)) {
15125
15132
  return pattern.test(value);
15126
15133
  }
15127
- if (typeof pattern === 'string') {
15128
- return value.indexOf(pattern) !== -1;
15134
+ if (isString$1(pattern)) {
15135
+ return requireExactStringMatch ? value === pattern : value.includes(pattern);
15129
15136
  }
15137
+
15130
15138
  return false;
15131
15139
  }
15132
15140
 
15141
+ /**
15142
+ * Test the given string against an array of strings and regexes. By default, string matching is done on a
15143
+ * substring-inclusion basis rather than a strict equality basis
15144
+ *
15145
+ * @param testString The string to test
15146
+ * @param patterns The patterns against which to test the string
15147
+ * @param requireExactStringMatch If true, `testString` must match one of the given string patterns exactly in order to
15148
+ * count. If false, `testString` will match a string pattern if it contains that pattern.
15149
+ * @returns
15150
+ */
15151
+ function stringMatchesSomePattern(
15152
+ testString,
15153
+ patterns = [],
15154
+ requireExactStringMatch = false,
15155
+ ) {
15156
+ return patterns.some(pattern => isMatchingPattern(testString, pattern, requireExactStringMatch));
15157
+ }
15158
+
15133
15159
  /**
15134
15160
  * Replace a method in an object with a wrapped version of itself.
15135
15161
  *
@@ -17514,6 +17540,8 @@ class Scope {
17514
17540
 
17515
17541
  /** Request Mode Session Status */
17516
17542
 
17543
+ // NOTE: Any field which gets added here should get added not only to the constructor but also to the `clone` method.
17544
+
17517
17545
  constructor() {
17518
17546
  this._notifyingListeners = false;
17519
17547
  this._scopeListeners = [];
@@ -17547,6 +17575,7 @@ class Scope {
17547
17575
  newScope._eventProcessors = [...scope._eventProcessors];
17548
17576
  newScope._requestSession = scope._requestSession;
17549
17577
  newScope._attachments = [...scope._attachments];
17578
+ newScope._sdkProcessingMetadata = { ...scope._sdkProcessingMetadata };
17550
17579
  }
17551
17580
  return newScope;
17552
17581
  }
@@ -17681,7 +17710,7 @@ class Scope {
17681
17710
  // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
17682
17711
  delete this._contexts[key];
17683
17712
  } else {
17684
- this._contexts = { ...this._contexts, [key]: context };
17713
+ this._contexts[key] = context;
17685
17714
  }
17686
17715
 
17687
17716
  this._notifyScopeListeners();
@@ -19306,13 +19335,17 @@ class BaseClient {
19306
19335
  * @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send.
19307
19336
  */
19308
19337
  _processEvent(event, hint, scope) {
19309
- const { beforeSend, sampleRate } = this.getOptions();
19338
+ const options = this.getOptions();
19339
+ const { sampleRate } = options;
19310
19340
 
19311
19341
  if (!this._isEnabled()) {
19312
19342
  return rejectedSyncPromise(new SentryError('SDK not enabled, will not capture event.', 'log'));
19313
19343
  }
19314
19344
 
19315
19345
  const isTransaction = event.type === 'transaction';
19346
+ const beforeSendProcessorName = isTransaction ? 'beforeSendTransaction' : 'beforeSend';
19347
+ const beforeSendProcessor = options[beforeSendProcessorName];
19348
+
19316
19349
  // 1.0 === 100% events are sent
19317
19350
  // 0.0 === 0% events are sent
19318
19351
  // Sampling for transaction happens somewhere else
@@ -19330,21 +19363,21 @@ class BaseClient {
19330
19363
  .then(prepared => {
19331
19364
  if (prepared === null) {
19332
19365
  this.recordDroppedEvent('event_processor', event.type || 'error');
19333
- throw new SentryError('An event processor returned null, will not send event.', 'log');
19366
+ throw new SentryError('An event processor returned `null`, will not send event.', 'log');
19334
19367
  }
19335
19368
 
19336
19369
  const isInternalException = hint.data && (hint.data ).__sentry__ === true;
19337
- if (isInternalException || isTransaction || !beforeSend) {
19370
+ if (isInternalException || !beforeSendProcessor) {
19338
19371
  return prepared;
19339
19372
  }
19340
19373
 
19341
- const beforeSendResult = beforeSend(prepared, hint);
19342
- return _ensureBeforeSendRv(beforeSendResult);
19374
+ const beforeSendResult = beforeSendProcessor(prepared, hint);
19375
+ return _validateBeforeSendResult(beforeSendResult, beforeSendProcessorName);
19343
19376
  })
19344
19377
  .then(processedEvent => {
19345
19378
  if (processedEvent === null) {
19346
19379
  this.recordDroppedEvent('before_send', event.type || 'error');
19347
- throw new SentryError('`beforeSend` returned `null`, will not send event.', 'log');
19380
+ throw new SentryError(`\`${beforeSendProcessorName}\` returned \`null\`, will not send event.`, 'log');
19348
19381
  }
19349
19382
 
19350
19383
  const session = scope && scope.getSession();
@@ -19447,26 +19480,29 @@ class BaseClient {
19447
19480
  }
19448
19481
 
19449
19482
  /**
19450
- * Verifies that return value of configured `beforeSend` is of expected type.
19483
+ * Verifies that return value of configured `beforeSend` or `beforeSendTransaction` is of expected type, and returns the value if so.
19451
19484
  */
19452
- function _ensureBeforeSendRv(rv) {
19453
- const nullErr = '`beforeSend` method has to return `null` or a valid event.';
19454
- if (isThenable(rv)) {
19455
- return rv.then(
19485
+ function _validateBeforeSendResult(
19486
+ beforeSendResult,
19487
+ beforeSendProcessorName,
19488
+ ) {
19489
+ const invalidValueError = `\`${beforeSendProcessorName}\` must return \`null\` or a valid event.`;
19490
+ if (isThenable(beforeSendResult)) {
19491
+ return beforeSendResult.then(
19456
19492
  event => {
19457
- if (!(isPlainObject$1(event) || event === null)) {
19458
- throw new SentryError(nullErr);
19493
+ if (!isPlainObject$1(event) && event !== null) {
19494
+ throw new SentryError(invalidValueError);
19459
19495
  }
19460
19496
  return event;
19461
19497
  },
19462
19498
  e => {
19463
- throw new SentryError(`beforeSend rejected with ${e}`);
19499
+ throw new SentryError(`\`${beforeSendProcessorName}\` rejected with ${e}`);
19464
19500
  },
19465
19501
  );
19466
- } else if (!(isPlainObject$1(rv) || rv === null)) {
19467
- throw new SentryError(nullErr);
19502
+ } else if (!isPlainObject$1(beforeSendResult) && beforeSendResult !== null) {
19503
+ throw new SentryError(invalidValueError);
19468
19504
  }
19469
- return rv;
19505
+ return beforeSendResult;
19470
19506
  }
19471
19507
 
19472
19508
  const DEFAULT_TRANSPORT_BUFFER_SIZE = 30;
@@ -19550,7 +19586,7 @@ function createTransport(
19550
19586
  };
19551
19587
  }
19552
19588
 
19553
- const SDK_VERSION = '7.17.3';
19589
+ const SDK_VERSION = '7.20.1';
19554
19590
 
19555
19591
  let originalFunctionToString;
19556
19592
 
@@ -19681,9 +19717,7 @@ function _isIgnoredError(event, ignoreErrors) {
19681
19717
  return false;
19682
19718
  }
19683
19719
 
19684
- return _getPossibleEventMessages(event).some(message =>
19685
- ignoreErrors.some(pattern => isMatchingPattern(message, pattern)),
19686
- );
19720
+ return _getPossibleEventMessages(event).some(message => stringMatchesSomePattern(message, ignoreErrors));
19687
19721
  }
19688
19722
 
19689
19723
  function _isDeniedUrl(event, denyUrls) {
@@ -19692,7 +19726,7 @@ function _isDeniedUrl(event, denyUrls) {
19692
19726
  return false;
19693
19727
  }
19694
19728
  const url = _getEventFilterUrl(event);
19695
- return !url ? false : denyUrls.some(pattern => isMatchingPattern(url, pattern));
19729
+ return !url ? false : stringMatchesSomePattern(url, denyUrls);
19696
19730
  }
19697
19731
 
19698
19732
  function _isAllowedUrl(event, allowUrls) {
@@ -19701,7 +19735,7 @@ function _isAllowedUrl(event, allowUrls) {
19701
19735
  return true;
19702
19736
  }
19703
19737
  const url = _getEventFilterUrl(event);
19704
- return !url ? true : allowUrls.some(pattern => isMatchingPattern(url, pattern));
19738
+ return !url ? true : stringMatchesSomePattern(url, allowUrls);
19705
19739
  }
19706
19740
 
19707
19741
  function _getPossibleEventMessages(event) {
@@ -28277,7 +28311,7 @@ const StopRecordingButton = ({ onClick, disabled }) => {
28277
28311
  };
28278
28312
 
28279
28313
  const InnerView = React__default.forwardRef(({ widgetMachine, sendToWidget, recorderRef, isSliderModalOpen, isWidgetMinimized, onOpenSliderModal, onCloseSliderModal, onRecorderRetry, onReInitRecorder, myinterviewRef, }, videoRef) => {
28280
- var _a;
28314
+ var _a, _b;
28281
28315
  const [recorderMachine, sendToRecorder] = useActor(recorderRef);
28282
28316
  const [isQuestionVideoWatched, setIsQuestionVideoWatched] = useState(false);
28283
28317
  const innerRef = useRef(null);
@@ -28294,7 +28328,7 @@ const InnerView = React__default.forwardRef(({ widgetMachine, sendToWidget, reco
28294
28328
  const isRetakeAvailable = currentTake < (currentQuestionObj === null || currentQuestionObj === void 0 ? void 0 : currentQuestionObj.numOfRetakes);
28295
28329
  const totalRetakes = currentQuestionObj === null || currentQuestionObj === void 0 ? void 0 : currentQuestionObj.numOfRetakes;
28296
28330
  const isQuestionMode = recordingType === TAKE_TYPES.QUESTION;
28297
- const lastUnuploadedQuestion = (_a = widgetConfig.video) === null || _a === void 0 ? void 0 : _a.videos.reduce((acc, v, idx) => (!v.uploaded ? idx + 1 : acc), 0);
28331
+ const lastUnuploadedQuestion = (_b = (_a = widgetConfig.video) === null || _a === void 0 ? void 0 : _a.videos) === null || _b === void 0 ? void 0 : _b.reduce((acc, v, idx) => (!v.uploaded ? idx + 1 : acc), 0);
28298
28332
  const isLastQuestion = currentQuestion === (isQuestionMode ? lastUnuploadedQuestion : questions.length);
28299
28333
  const isUploadingState = widgetMachine.matches(STATES$4.UPLOADING);
28300
28334
  const isConfirmState = widgetMachine.matches(STATES$4.CONFIRM);
@@ -30838,6 +30872,7 @@ const Upload = ({ isConnected, totalFileSize, totalUploadedFilesSize, totalUploa
30838
30872
  };
30839
30873
 
30840
30874
  const OuterView = ({ widgetMachine, sendToWidget, recorderRef }) => {
30875
+ var _a;
30841
30876
  const { questions, currentQuestion, widgetConfig: { job, video, company }, recordingType, isConnected, totalFileSize, totalUploadedFilesSize, totalUploadSpeed, } = widgetMachine.context;
30842
30877
  const [recorderMachine] = useActor(recorderRef);
30843
30878
  const { countdown } = recorderMachine.context;
@@ -30851,7 +30886,7 @@ const OuterView = ({ widgetMachine, sendToWidget, recorderRef }) => {
30851
30886
  const isRecording = recorderMachine.matches({ [STATES$5.RECORDING]: STATES$5.COLLECTING_BLOBS });
30852
30887
  const isCountDown = recorderMachine.matches({ [STATES$5.RECORDING]: STATES$5.COUNT_DOWN });
30853
30888
  const isPracticeMode = recordingType === TAKE_TYPES.PRACTICE;
30854
- const questionsStatus = (video === null || video === void 0 ? void 0 : video.videos.map((v, idx) => (v.uploaded || (v.completed && currentQuestion > idx + 1) ? VIDEO_STATUS.COMPLETED : VIDEO_STATUS.INCOMPLETED))) || [];
30889
+ const questionsStatus = ((_a = video === null || video === void 0 ? void 0 : video.videos) === null || _a === void 0 ? void 0 : _a.map((v, idx) => (v.uploaded || (v.completed && currentQuestion > idx + 1) ? VIDEO_STATUS.COMPLETED : VIDEO_STATUS.INCOMPLETED))) || [];
30855
30890
  const outerViewClassNames = classNames({
30856
30891
  'myinterview-widget-outer': true,
30857
30892
  'myinterview-widget-outer--hidden': !isOuterViewDisplayed,
@@ -33235,6 +33270,8 @@ const microphoneMachine = createMachine({
33235
33270
  };
33236
33271
  }
33237
33272
  const ctx = new AudioContext();
33273
+ window.audioContext = ctx; // debug
33274
+ window.context = context; // debug
33238
33275
  let mic = ctx.createMediaStreamSource(context.mediaStream);
33239
33276
  let analyser = ctx.createAnalyser();
33240
33277
  analyser.fftSize = 256;
@@ -33465,6 +33502,10 @@ const recorderMachineV2 = createMachine({
33465
33502
  initial: STATES$5.INIT,
33466
33503
  context: initialState,
33467
33504
  entry: [ACTIONS$6.SET_MIC_MACHINE],
33505
+ exit: [
33506
+ ACTIONS$6.STOP_MEDIA_STREAM,
33507
+ ACTIONS$6.STOP_MICROPHONE_MACHINE,
33508
+ ],
33468
33509
  // global events !! THOSE events triggered from all possible states!!!!
33469
33510
  on: {
33470
33511
  // when received info from mic, tell parent , that all good
@@ -34189,7 +34230,7 @@ const accUploaderMachine = createMachine({
34189
34230
  {
34190
34231
  actions: [ACTIONS$2.SET_VIDEO_FILE],
34191
34232
  target: STATES$2.FINISHED,
34192
- cond: (context, event) => event.data.data.data.video.videos[Number(context.currentQuestion) - 1].uploaded,
34233
+ cond: (context, event) => (event.data.data.data.video.videos || [])[Number(context.currentQuestion) - 1].uploaded,
34193
34234
  },
34194
34235
  {
34195
34236
  actions: [ACTIONS$2.SET_VIDEO_FILE],
@@ -34220,9 +34261,12 @@ const accUploaderMachine = createMachine({
34220
34261
  [ACTIONS$2.SET_SIGNED_URL]: assign((_, event) => ({
34221
34262
  signedUrl: event.data.data.data.uploadUrl || '',
34222
34263
  })),
34223
- [ACTIONS$2.SET_VIDEO_FILE]: assign((context, event) => ({
34224
- videoFile: (Object.assign(Object.assign({}, context.videoFile), event.data.data.data.video.videos[Number(context.currentQuestion) - 1])),
34225
- })),
34264
+ [ACTIONS$2.SET_VIDEO_FILE]: assign((context, event) => {
34265
+ var _a;
34266
+ return ({
34267
+ videoFile: (Object.assign(Object.assign({}, context.videoFile), (_a = event.data.data.data.video.videos) === null || _a === void 0 ? void 0 : _a[Number(context.currentQuestion) - 1])),
34268
+ });
34269
+ }),
34226
34270
  [ACTIONS$2.INITIAL_UPLOAD_TIMESTAMP]: assign(({ lastUploadChunk }) => ({ lastUploadChunk: Object.assign(Object.assign({}, lastUploadChunk), { timeStamp: performance.now() }) })),
34227
34271
  // @ts-ignore
34228
34272
  [ACTIONS$2.UPDATE_UPLOAD_SPEED]: assign(({ lastUploadChunk }, { total, loaded, timeStamp }) => ({
@@ -35017,10 +35061,10 @@ const accWidgetMachine = createMachine({
35017
35061
  };
35018
35062
  }),
35019
35063
  [ACTIONS$5.SPAWN_UPLOADER]: assign(({ widgetConfig, uploaderRefs, isConnected, currentQuestion, currentTake, }, event) => {
35020
- var _a, _b;
35064
+ var _a, _b, _c;
35021
35065
  return ({
35022
35066
  uploaderRefs: Object.assign(Object.assign({}, uploaderRefs), { [getUploaderName(currentQuestion)]: spawn(accUploaderMachine.withContext(Object.assign(Object.assign({}, accUploaderMachine.context), { isConnected,
35023
- currentQuestion, file: event.data.file, videoId: ((_a = widgetConfig === null || widgetConfig === void 0 ? void 0 : widgetConfig.video) === null || _a === void 0 ? void 0 : _a.video_id) || '', videoFile: Object.assign(Object.assign(Object.assign({}, accUploaderMachine.context.videoFile), (_b = widgetConfig === null || widgetConfig === void 0 ? void 0 : widgetConfig.video) === null || _b === void 0 ? void 0 : _b.videos[currentQuestion - 1]), { retakes: currentTake, selectedTake: event.data.selectedTake }) })), { name: getUploaderName(currentQuestion), autoForward: true }) }),
35067
+ currentQuestion, file: event.data.file, videoId: ((_a = widgetConfig === null || widgetConfig === void 0 ? void 0 : widgetConfig.video) === null || _a === void 0 ? void 0 : _a.video_id) || '', videoFile: Object.assign(Object.assign(Object.assign({}, accUploaderMachine.context.videoFile), (_c = (_b = widgetConfig === null || widgetConfig === void 0 ? void 0 : widgetConfig.video) === null || _b === void 0 ? void 0 : _b.videos) === null || _c === void 0 ? void 0 : _c[currentQuestion - 1]), { retakes: currentTake, selectedTake: event.data.selectedTake }) })), { name: getUploaderName(currentQuestion), autoForward: true }) }),
35024
35068
  });
35025
35069
  }),
35026
35070
  [ACTIONS$5.STORE_TAKE]: send((context, event) => ({
@@ -35040,9 +35084,9 @@ const accWidgetMachine = createMachine({
35040
35084
  data: event.data,
35041
35085
  }), { to: (context) => context.previewRef }),
35042
35086
  [ACTIONS$5.UPDATE_VIDEO_FILE_COMPLETED]: assign(({ widgetConfig, currentQuestion }) => {
35043
- var _a;
35087
+ var _a, _b;
35044
35088
  return ({
35045
- widgetConfig: Object.assign(Object.assign({}, widgetConfig), { video: Object.assign(Object.assign({}, widgetConfig === null || widgetConfig === void 0 ? void 0 : widgetConfig.video), { videos: (_a = widgetConfig === null || widgetConfig === void 0 ? void 0 : widgetConfig.video) === null || _a === void 0 ? void 0 : _a.videos.map((video, idx) => (idx !== currentQuestion - 1 ? video : (Object.assign(Object.assign({}, video), { completed: true })))) }) }),
35089
+ widgetConfig: Object.assign(Object.assign({}, widgetConfig), { video: Object.assign(Object.assign({}, widgetConfig === null || widgetConfig === void 0 ? void 0 : widgetConfig.video), { videos: (_b = (_a = widgetConfig === null || widgetConfig === void 0 ? void 0 : widgetConfig.video) === null || _a === void 0 ? void 0 : _a.videos) === null || _b === void 0 ? void 0 : _b.map((video, idx) => (idx !== currentQuestion - 1 ? video : (Object.assign(Object.assign({}, video), { completed: true })))) }) }),
35046
35090
  });
35047
35091
  }),
35048
35092
  [ACTIONS$5.UPDATE_TOTAL_FILES_SIZE]: assign(({ totalFileSize }, event) => ({
@@ -35053,9 +35097,9 @@ const accWidgetMachine = createMachine({
35053
35097
  totalUploadSpeed: Object.assign(Object.assign({}, totalUploadSpeed), { [event.data.questionNumber]: event.data.uploadSpeed }),
35054
35098
  })),
35055
35099
  [ACTIONS$5.UPDATE_QUESTION_NUMBER]: assign(({ currentQuestion, questions, widgetConfig, recordingType, }) => {
35056
- var _a, _b;
35100
+ var _a, _b, _c;
35057
35101
  const questionNumberIdx = recordingType === TAKE_TYPES.QUESTION
35058
- ? (_b = (_a = widgetConfig.video) === null || _a === void 0 ? void 0 : _a.videos.findIndex((video, idx) => !video.uploaded && idx > currentQuestion - 1)) !== null && _b !== void 0 ? _b : questions.length
35102
+ ? (_c = (_b = (_a = widgetConfig.video) === null || _a === void 0 ? void 0 : _a.videos) === null || _b === void 0 ? void 0 : _b.findIndex((video, idx) => !video.uploaded && idx > currentQuestion - 1)) !== null && _c !== void 0 ? _c : questions.length
35059
35103
  : Math.min(currentQuestion + 1, questions.length);
35060
35104
  return {
35061
35105
  currentQuestion: Math.min(questionNumberIdx + 1, questions.length || 0),
@@ -35075,9 +35119,9 @@ const accWidgetMachine = createMachine({
35075
35119
  },
35076
35120
  }), { to: (context) => context.recorderRef }),
35077
35121
  [ACTIONS$5.UPDATE_TOTAL_UPLOADED]: assign(({ widgetConfig }, { data: { questionNumber, videoFile } }) => {
35078
- var _a;
35122
+ var _a, _b;
35079
35123
  return ({
35080
- widgetConfig: Object.assign(Object.assign({}, widgetConfig), { video: Object.assign(Object.assign({}, widgetConfig.video), { videos: (_a = widgetConfig.video) === null || _a === void 0 ? void 0 : _a.videos.map((video, idx) => ((idx !== questionNumber - 1) ? video : videoFile)) }) }),
35124
+ widgetConfig: Object.assign(Object.assign({}, widgetConfig), { video: Object.assign(Object.assign({}, widgetConfig.video), { videos: (_b = (_a = widgetConfig.video) === null || _a === void 0 ? void 0 : _a.videos) === null || _b === void 0 ? void 0 : _b.map((video, idx) => ((idx !== questionNumber - 1) ? video : videoFile)) }) }),
35081
35125
  });
35082
35126
  }),
35083
35127
  [ACTIONS$5.SET_VIDEO_ERROR]: assign((_, event) => ({
@@ -35085,9 +35129,9 @@ const accWidgetMachine = createMachine({
35085
35129
  })),
35086
35130
  [ACTIONS$5.REVOKE_MEMORY]: send((_, event) => ({ type: EVENTS$3.REMOVE_TAKES, data: { questionToRemove: event.data.questionNumber } }), { to: ({ storageRef }) => storageRef }),
35087
35131
  [ACTIONS$5.UPDATE_VIDEO_OBJECT]: assign(({ widgetConfig, recordingType }) => {
35088
- var _a;
35132
+ var _a, _b;
35089
35133
  return ({
35090
- widgetConfig: Object.assign(Object.assign({}, widgetConfig), { video: Object.assign(Object.assign({}, widgetConfig.video), { started: recordingType === TAKE_TYPES.QUESTION, completed: !!((_a = widgetConfig.video) === null || _a === void 0 ? void 0 : _a.videos.every((v) => v.completed)) }) }),
35134
+ widgetConfig: Object.assign(Object.assign({}, widgetConfig), { video: Object.assign(Object.assign({}, widgetConfig.video), { started: recordingType === TAKE_TYPES.QUESTION, completed: !!((_b = (_a = widgetConfig.video) === null || _a === void 0 ? void 0 : _a.videos) === null || _b === void 0 ? void 0 : _b.every((v) => v.completed)) }) }),
35091
35135
  });
35092
35136
  }),
35093
35137
  [ACTIONS$5.UPDATE_VIDEO_PART]: assign(({ widgetConfig, recordingType, currentQuestion }, event) => {
@@ -35118,9 +35162,10 @@ const accWidgetMachine = createMachine({
35118
35162
  return updateVideo(Object.assign(Object.assign({}, video), { bandwidth: `${speedTestResult} MB/s` }));
35119
35163
  },
35120
35164
  [SERVICES$1.UPDATE_VIDEO_PART_CALL]: ({ widgetConfig: { video }, recordingType, currentQuestion }) => (callback, onReceive) => {
35165
+ var _a;
35121
35166
  if (recordingType === TAKE_TYPES.PRACTICE)
35122
35167
  return Promise.resolve();
35123
- return updateVideoFile((video === null || video === void 0 ? void 0 : video.video_id) || '', video === null || video === void 0 ? void 0 : video.videos[currentQuestion - 1]);
35168
+ return updateVideoFile((video === null || video === void 0 ? void 0 : video.video_id) || '', (_a = video === null || video === void 0 ? void 0 : video.videos) === null || _a === void 0 ? void 0 : _a[currentQuestion - 1]);
35124
35169
  },
35125
35170
  },
35126
35171
  guards: {
@@ -35131,12 +35176,12 @@ const accWidgetMachine = createMachine({
35131
35176
  [GUARDS$2.IS_QUESTION_MODE]: ({ recordingType }) => recordingType === TAKE_TYPES.QUESTION,
35132
35177
  [GUARDS$2.IS_PRACTICE_MODE]: ({ recordingType }) => recordingType === TAKE_TYPES.PRACTICE,
35133
35178
  [GUARDS$2.IS_NOT_LAST_TAKE]: ({ questions, currentQuestion, currentTake }) => currentTake < questions[currentQuestion - 1].numOfRetakes,
35134
- [GUARDS$2.IS_LAST_INTERVIEW_QUESTION]: ({ widgetConfig, currentQuestion, recordingType }) => { var _a; return recordingType === TAKE_TYPES.QUESTION && (((_a = widgetConfig.video) === null || _a === void 0 ? void 0 : _a.videos.reduce((acc, v, idx) => (!v.uploaded ? idx + 1 : acc), 0)) || 0) === currentQuestion; },
35179
+ [GUARDS$2.IS_LAST_INTERVIEW_QUESTION]: ({ widgetConfig, currentQuestion, recordingType }) => { var _a, _b; return recordingType === TAKE_TYPES.QUESTION && (((_b = (_a = widgetConfig.video) === null || _a === void 0 ? void 0 : _a.videos) === null || _b === void 0 ? void 0 : _b.reduce((acc, v, idx) => (!v.uploaded ? idx + 1 : acc), 0)) || 0) === currentQuestion; },
35135
35180
  [GUARDS$2.CAN_RETEST_SPEED_CONNECTION]: ({ speedTestResult }) => (speedTestResult || 0) < FAST_UPLOAD_SPEED,
35136
35181
  [GUARDS$2.IS_CONNECTED]: ({ isConnected }) => isConnected,
35137
35182
  [GUARDS$2.IS_DISCONNECTED]: ({ isConnected }) => !isConnected,
35138
35183
  [GUARDS$2.CAN_START_INTERVIEW]: ({ checksState }) => checksState.camera === CAMERA_STATES.READY && checksState.microphone === MICROPHONE_STATES.READY && [INTERNET_STATES.CONNECTED, INTERNET_STATES.SLOW_CONNECTION].includes(checksState.internet),
35139
- [GUARDS$2.ARE_ALL_QUESTIONS_UPLOADED]: ({ widgetConfig }) => { var _a; return !!((_a = widgetConfig.video) === null || _a === void 0 ? void 0 : _a.videos.every((video) => video.uploaded)); },
35184
+ [GUARDS$2.ARE_ALL_QUESTIONS_UPLOADED]: ({ widgetConfig }) => { var _a, _b; return !!((_b = (_a = widgetConfig.video) === null || _a === void 0 ? void 0 : _a.videos) === null || _b === void 0 ? void 0 : _b.every((video) => video.uploaded)); },
35140
35185
  [GUARDS$2.SHOULD_SHOW_WELCOME]: ({ widgetConfig }) => !!widgetConfig.config.introVideo,
35141
35186
  [GUARDS$2.IS_NO_SOUND_ERROR]: (_, { data }) => data.code === MICROPHONE_NO_SOUND_ERROR_CODE,
35142
35187
  [GUARDS$2.IS_VIDEO_CORRUPTED]: (_, { data }) => !data.size,
@@ -35294,7 +35339,7 @@ const Main = ({ widgetConfig, setShouldShowWaterMark, myinterviewRef, isWidgetMi
35294
35339
  (_b = (_a = widgetConfig.config).onError) === null || _b === void 0 ? void 0 : _b.call(_a, { messageType: 'applied' });
35295
35340
  }
35296
35341
  }, [isErrorState]);
35297
- const isResumed = useMemo(() => { var _a; return !!((_a = widgetConfig.video) === null || _a === void 0 ? void 0 : _a.videos.some((v) => v.uploaded)); }, [widgetConfig.video]);
35342
+ const isResumed = useMemo(() => { var _a, _b; return !!((_b = (_a = widgetConfig.video) === null || _a === void 0 ? void 0 : _a.videos) === null || _b === void 0 ? void 0 : _b.some((v) => v.uploaded)); }, [widgetConfig.video]);
35298
35343
  const handleScroll = (e) => {
35299
35344
  var _a, _b;
35300
35345
  const { scrollTop } = e.target;
@@ -42409,9 +42454,11 @@ const Widget = ({ candidate, job, video, config, disabled = false, buttonText =
42409
42454
  // TODO: Analytics
42410
42455
  };
42411
42456
  const onMinimize = () => {
42457
+ var _a;
42412
42458
  setLayoutStyleProperties();
42413
42459
  revertBodyStyling();
42414
42460
  setIsWidgetMinimized(true);
42461
+ (_a = config.onWidgetClose) === null || _a === void 0 ? void 0 : _a.call(config);
42415
42462
  };
42416
42463
  const layoutClassNames = classNames({
42417
42464
  'myinterview-widget__layout': true,
@@ -42439,7 +42486,7 @@ const Widget = ({ candidate, job, video, config, disabled = false, buttonText =
42439
42486
  React__default.createElement(Main, { myinterviewRef: myinterviewRef, widgetConfig: {
42440
42487
  config: Object.assign(Object.assign({}, config), { onFinish: onInterviewCompleted, onError, practiceQuestions: (config.practiceQuestions || []).map((q) => (Object.assign(Object.assign({}, q), { numOfRetakes: q.attempts || DEFAULT_ATTEMPTS, partDuration: q.duration || DEFAULT_DURATION, thinkingTime: q.thinkingTime || DEFAULT_THINKING_TIME }))) }),
42441
42488
  job: Object.assign(Object.assign({}, job), { questions: (job.questions || []).map((q) => (Object.assign(Object.assign({}, q), { numOfRetakes: q.attempts || DEFAULT_ATTEMPTS, partDuration: q.duration || DEFAULT_DURATION, thinkingTime: q.thinkingTime || DEFAULT_THINKING_TIME }))) }),
42442
- video,
42489
+ video: Object.assign(Object.assign({}, video), { referrer: (video === null || video === void 0 ? void 0 : video.referrer) || window.location.href }),
42443
42490
  candidate,
42444
42491
  }, setShouldShowWaterMark: setShouldShowWaterMark, isWidgetMinimized: isWidgetMinimized })))))))));
42445
42492
  return (React__default.createElement(A.div, { id: "quote", ref: myinterviewRef }, Content));