@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.
@@ -66,4 +66,8 @@ export interface IWidgetConfigRequest {
66
66
  candidate?: ICandidate;
67
67
  job?: IJob;
68
68
  }
69
+ export interface IWidgetRef {
70
+ open: () => void;
71
+ close: () => void;
72
+ }
69
73
  export {};
@@ -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/esm/index.js CHANGED
@@ -30232,7 +30232,7 @@ const configGenerator = () => {
30232
30232
  let release;
30233
30233
  try {
30234
30234
  environment !== null && environment !== void 0 ? environment : (environment = "staging");
30235
- release !== null && release !== void 0 ? release : (release = "1.1.24");
30235
+ release !== null && release !== void 0 ? release : (release = "1.1.24-export-ref-actions-02");
30236
30236
  }
30237
30237
  catch (_a) {
30238
30238
  console.error('sentry configGenerator error');
@@ -48529,7 +48529,7 @@ const useAccessibility = () => {
48529
48529
  return { setSitekey, shutdown };
48530
48530
  };
48531
48531
 
48532
- const Widget = ({ candidate, job, video, config, disabled = false, buttonText = 'START INTERVIEW', buttonStyle = {}, children, styleUrls = [], fontsUrls = [], }) => {
48532
+ const Widget = forwardRef(({ candidate, job, video, config, disabled = false, buttonText = 'START INTERVIEW', buttonStyle = {}, children, styleUrls = [], fontsUrls = [], }, clientRef) => {
48533
48533
  const [isWidgetOpen, setIsWidgetOpen] = useState(false);
48534
48534
  const [isWidgetMinimized, setIsWidgetMinimized] = useState(false);
48535
48535
  const [isIncognitoMode, setIsIncognitoMode] = useState(false);
@@ -48539,6 +48539,8 @@ const Widget = ({ candidate, job, video, config, disabled = false, buttonText =
48539
48539
  const [shouldShowWaterMark, setShouldShowWaterMark] = useState(false);
48540
48540
  const [isCustomStyleProvided, setIsCustomStyleProvided] = useState(false);
48541
48541
  const { setSitekey, shutdown } = useAccessibility();
48542
+ if (!candidate || !config)
48543
+ return null;
48542
48544
  useEffect(() => {
48543
48545
  if (isAndroid) {
48544
48546
  detectIncognito().then((res) => {
@@ -48625,6 +48627,10 @@ const Widget = ({ candidate, job, video, config, disabled = false, buttonText =
48625
48627
  emitTrackEvent({ eventType: EVENT_TYPES.WIDGET_MINIMIZED });
48626
48628
  shutdown();
48627
48629
  };
48630
+ useImperativeHandle(clientRef, () => ({
48631
+ open: () => { var _a; return (_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.click(); },
48632
+ close: onMinimize,
48633
+ }), []);
48628
48634
  const layoutClassNames = classNames({
48629
48635
  'myinterview-widget__layout': true,
48630
48636
  'myinterview-widget-no-select': true,
@@ -48657,7 +48663,7 @@ const Widget = ({ candidate, job, video, config, disabled = false, buttonText =
48657
48663
  video: Object.assign(Object.assign({}, video), { referrer: (video === null || video === void 0 ? void 0 : video.referrer) || window.location.href }),
48658
48664
  candidate,
48659
48665
  }, setShouldShowWaterMark: setShouldShowWaterMark, isWidgetMinimized: isWidgetMinimized, onMinimize: onMinimize }))))))))));
48660
- };
48666
+ });
48661
48667
 
48662
48668
  export { Widget };
48663
48669
  //# sourceMappingURL=index.js.map