( function ( $ ) {
	if ( typeof shc4wcSureForms === 'undefined' ) {
		return;
	}

	function bindSquareHostedMethod() {
		$( document ).on(
			'srfm_payment_method_changed',
			function ( event ) {
				var detail = event.detail || {};
				if ( detail.paymentMethod !== shc4wcSureForms.method ) {
					return;
				}

				var $container = $( '.shc4wc-sureforms-payment' );
				if ( $container.length && ! $container.find( '.shc4wc-sureforms-note' ).length ) {
					$container.append(
						'<p class="shc4wc-sureforms-note">' + shc4wcSureForms.i18n.label + '</p>'
					);
				}
			}
		);
	}

	$( bindSquareHostedMethod );
}( jQuery ) );
