@myinterview/widget-react 1.1.24-development-9fb08e2 → 1.1.24-export-ref-actions-02

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,3 +1,6 @@
1
1
  import React from 'react';
2
- import { IClientWidgetConfig } from '../interfaces/configInterface';
3
- export declare const Widget: React.FC<IClientWidgetConfig>;
2
+ import { IWidgetRef } from '../interfaces/configInterface';
3
+ export declare const Widget: React.ForwardRefExoticComponent<Omit<import("../interfaces/configInterface").IWidgetConfig, "config" | "event_id" | "job"> & {
4
+ job: import("../interfaces/jobInterface").IClientJob;
5
+ config: import("../interfaces/configInterface").IClientConfig;
6
+ } & React.RefAttributes<IWidgetRef>>;
@@ -1,4 +1,4 @@
1
1
  import { Widget } from './components/Widget';
2
- import { IWidgetConfig, IClientWidgetConfig } from './interfaces/configInterface';
2
+ import { IWidgetConfig, IClientWidgetConfig, IWidgetRef } from './interfaces/configInterface';
3
3
  export { Widget };
4
- export type { IWidgetConfig, IClientWidgetConfig };
4
+ export type { IWidgetConfig, IClientWidgetConfig, IWidgetRef };
package/dist/cjs/index.js CHANGED
@@ -30258,7 +30258,7 @@ const configGenerator = () => {
30258
30258
  let release;
30259
30259
  try {
30260
30260
  environment !== null && environment !== void 0 ? environment : (environment = "staging");
30261
- release !== null && release !== void 0 ? release : (release = "1.1.24");
30261
+ release !== null && release !== void 0 ? release : (release = "1.1.24-export-ref-actions-02");
30262
30262
  }
30263
30263
  catch (_a) {
30264
30264
  console.error('sentry configGenerator error');
@@ -48555,7 +48555,7 @@ const useAccessibility = () => {
48555
48555
  return { setSitekey, shutdown };
48556
48556
  };
48557
48557
 
48558
- const Widget = ({ candidate, job, video, config, disabled = false, buttonText = 'START INTERVIEW', buttonStyle = {}, children, styleUrls = [], fontsUrls = [], }) => {
48558
+ const Widget = React.forwardRef(({ candidate, job, video, config, disabled = false, buttonText = 'START INTERVIEW', buttonStyle = {}, children, styleUrls = [], fontsUrls = [], }, clientRef) => {
48559
48559
  const [isWidgetOpen, setIsWidgetOpen] = React.useState(false);
48560
48560
  const [isWidgetMinimized, setIsWidgetMinimized] = React.useState(false);
48561
48561
  const [isIncognitoMode, setIsIncognitoMode] = React.useState(false);
@@ -48565,6 +48565,8 @@ const Widget = ({ candidate, job, video, config, disabled = false, buttonText =
48565
48565
  const [shouldShowWaterMark, setShouldShowWaterMark] = React.useState(false);
48566
48566
  const [isCustomStyleProvided, setIsCustomStyleProvided] = React.useState(false);
48567
48567
  const { setSitekey, shutdown } = useAccessibility();
48568
+ if (!candidate || !config)
48569
+ return null;
48568
48570
  React.useEffect(() => {
48569
48571
  if (isAndroid) {
48570
48572
  detectIncognito().then((res) => {
@@ -48651,6 +48653,10 @@ const Widget = ({ candidate, job, video, config, disabled = false, buttonText =
48651
48653
  emitTrackEvent({ eventType: EVENT_TYPES.WIDGET_MINIMIZED });
48652
48654
  shutdown();
48653
48655
  };
48656
+ React.useImperativeHandle(clientRef, () => ({
48657
+ open: () => { var _a; return (_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.click(); },
48658
+ close: onMinimize,
48659
+ }), []);
48654
48660
  const layoutClassNames = classNames({
48655
48661
  'myinterview-widget__layout': true,
48656
48662
  'myinterview-widget-no-select': true,
@@ -48683,7 +48689,7 @@ const Widget = ({ candidate, job, video, config, disabled = false, buttonText =
48683
48689
  video: Object.assign(Object.assign({}, video), { referrer: (video === null || video === void 0 ? void 0 : video.referrer) || window.location.href }),
48684
48690
  candidate,
48685
48691
  }, setShouldShowWaterMark: setShouldShowWaterMark, isWidgetMinimized: isWidgetMinimized, onMinimize: onMinimize }))))))))));
48686
- };
48692
+ });
48687
48693
 
48688
48694
  exports.Widget = Widget;
48689
48695
  //# sourceMappingURL=index.js.map