type PromptProductName = () => ( false | string )

export const prompt_product_name: PromptProductName = () => {
	let product_name: string | null;

	do {
		product_name = prompt( window._wetail_shipping.i18n[ 'Enter the name of the product' ], '' );
		if ( product_name === null ) {
			return false;
		}
		if ( !product_name.trim().length ) {
			alert( window._wetail_shipping.i18n[ 'The name of the product is empty. Please try again.' ] );
		}

	} while ( !product_name.trim().length );

	return product_name;
};
