Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
componentDidMount() {
if (this.props.polaris.appBridge == null) {
return;
}
// eslint-disable-next-line no-console
console.warn(
'Deprecation: Using `Modal` in an embedded app is deprecated and will be removed in v5.0. Use `Modal` from `@shopify/app-bridge-react` instead: https://help.shopify.com/en/api/embedded-apps/app-bridge/react-components/modal',
);
const transformProps = this.transformProps();
if (transformProps) {
this.appBridgeModal = AppBridgeModal.create(
this.props.polaris.appBridge,
transformProps,
);
}
if (this.appBridgeModal) {
this.appBridgeModal.subscribe(
AppBridgeModal.Action.CLOSE,
this.props.onClose,
);
}
const {open} = this.props;
if (open) {
this.focusReturnPointNode = document.activeElement as HTMLElement;