woocommerce/plugins/woocommerce-blocks/assets/js/utils/is-site-editor-page.ts

22 lines
404 B
TypeScript
Raw Normal View History

/**
* Internal dependencies
*/
import { isObject } from '../types/type-guards';
export const isSiteEditorPage = ( store: unknown ): boolean => {
if ( isObject( store ) ) {
const editedPostType = (
store as {
getEditedPostType: () => string;
}
).getEditedPostType();
return (
editedPostType === 'wp_template' ||
editedPostType === 'wp_template_part'
);
}
return false;
};