File "utils.js"

Full Path: /home/fresvfqn/waterdamagerestorationandrepairsmithtown.com/wp-content/plugins/astra-sites/inc/lib/onboarding/assets/src/template-preview/utils.js
File size: 618 bytes
MIME-type: text/plain
Charset: utf-8

export const withinIframe = () => {
	if ( window.location.href !== window.parent.location.href ) {
		return true;
	}
	return false;
};

export const getStorgeData = ( key ) => {
	return JSON.parse( localStorage.getItem( key ) );
};

export const shouldAddPreviewParam = ( element ) => {
	const link = element.href;

	if ( link === '' ) {
		return false;
	}

	if ( ! link.includes( window.location.origin ) ) {
		return false;
	}

	if ( link.includes( 'wp-admin' ) ) {
		return false;
	}

	if ( link.includes( '.php' ) ) {
		return false;
	}

	if ( link.includes( 'customize' ) ) {
		return false;
	}

	return true;
};