PageSourceSearch

https://vybelit.com/wp-content/plugins/wc-blacklist-manager/js/checkout-verification-view.js?ver=2.3.2

js vybelit.com collected 2026-10-08 00:03:37 UTC 7,118 bytes, 145 lines download raw bytes

1( function ( root, factory ) {
2	'use strict';
3	if ( typeof module === 'object' && module.exports ) {
4		module.exports = factory();
5	} else {
6		root.WCBlacklistCheckoutVerificationView = factory();
7	}
8}( typeof self !== 'undefined' ? self : this, function () {
9	'use strict';
10
11	function escapeHtml( value ) {
12		return String( value || '' ).replace( /[&<>'"]/g, function ( character ) {
13			return { '&': '&amp;', '<': '&lt;', '>': '&gt;', "'": '&#039;', '"': '&quot;' }[ character ];
14		} );
15	}
16
17	function activeChannel( state ) {
18		return ( state.channels || [] ).filter( function ( channel ) {
19			return channel.id === state.active_channel;
20		} )[ 0 ] || null;
21	}
22
23	function resendRemaining( state, now ) {
24		var channel = activeChannel( state );
25		var current = typeof now === 'number' ? now : Math.floor( Date.now() / 1000 );
26		if ( ! channel || ! channel.resend_available_at ) {
27			return 0;
28		}
29		return Math.max( 0, Number( channel.resend_available_at ) - current );
30	}
31
32	function formatStep( state, labels ) {
33		if ( Number( state.total_steps || 0 ) <= 1 ) {
34			return '';
35		}
36		return String( labels.step || 'Step %1$d of %2$d' )
37			.replace( '%1$d', Number( state.current_step || 1 ) )
38			.replace( '%2$d', Number( state.total_steps || 1 ) );
39	}
40
41	// Project copy only; the server's active channel remains authoritative.
42	function presentationLabels( state, labels ) {
43		var result = Object.assign( {}, labels );
44		var channel = activeChannel( state );
45		var specific = channel && labels.channels && Object.prototype.hasOwnProperty.call( labels.channels, channel.id ) ? labels.channels[ channel.id ] : null;
46		if ( specific && ! state.ready ) {
47			[ 'title', 'open', 'verify', 'codeLabel', 'resend', 'required' ].forEach( function ( key ) {
48				if ( typeof specific[ key ] === 'string' && specific[ key ] ) {
49					result[ key ] = specific[ key ];
50				}
51			} );
52		}
53		if ( state.ready && labels.complete ) {
54			result.title = labels.complete;
55		}
56		return result;
57	}
58
59	function channelMarkup( state, labels, busy, now, surface, idPrefix ) {
60		var channel = activeChannel( state );
61		if ( ! state.required ) {
62			return '';
63		}
64		if ( state.ready ) {
65			return '<p class="yobm-verification-complete">' + escapeHtml( labels.complete ) + '</p>';
66		}
67		if ( ! channel ) {
68			return '';
69		}
70		var prefix = idPrefix || 'yobm-verification';
71		var codeId = prefix + '-code-' + channel.id;
72		var description = channel.masked_destination ? channel.label + ': ' + channel.masked_destination : channel.label;
73		var remaining = resendRemaining( state, now );
74		var resendText = remaining > 0 ? String( labels.resendIn || 'Resend available in %d seconds.' ).replace( '%d', remaining ) : '';
75		var buttonClass = surface === 'classic' ? 'button ' : '';
76		var progress = formatStep( state, labels );
77		return '<div class="yobm-verification-channel" data-yobm-channel="' + escapeHtml( channel.id ) + '">' +
78			( progress ? '<p class="yobm-verification-progress">' + escapeHtml( progress ) + '</p>' : '' ) +
79			'<p class="yobm-verification-destination">' + escapeHtml( description ) + '</p>' +
80			( channel.locked ? '<p class="yobm-verification-locked">' + escapeHtml( labels.locked ) + '</p>' : '' ) +
81			'<div class="yobm-verification-controls">' +
82			'<label class="yobm-verification-code-label" for="' + escapeHtml( codeId ) + '">' + escapeHtml( labels.codeLabel || labels.enterCode ) + '</label>' +
83			'<input id="' + escapeHtml( codeId ) + '" class="yobm-verification-code" type="text" inputmode="numeric" autocomplete="one-time-code" ' + ( busy ? 'disabled' : '' ) + '>
83' +
84			'<button type="button" class="' + buttonClass + 'yobm-verification-verify" ' + ( busy ? 'disabled aria-busy="true"' : '' ) + '>' + escapeHtml( busy ? labels.working : labels.verify ) + '</button>' +
85			'<button type="button" class="' + buttonClass + 'yobm-verification-resend" ' + ( busy || remaining > 0 ? 'disabled' : '' ) + ( busy ? ' aria-busy="true"' : '' ) + '>' + escapeHtml( labels.resend ) + '</button>' +
86			'</div><p class="yobm-verification-resend-status" ' + ( remaining > 0 ? '' : 'hidden' ) + '>' + escapeHtml( resendText ) + '</p></div>';
87	}
88
89	function liveMarkup( message, isError, idPrefix ) {
90		return '<div id="' + escapeHtml( idPrefix ) + '-status" class="yobm-verification-live' + ( isError ? ' yobm-is-error' : '' ) + '" role="status" aria-live="polite" aria-atomic="true">' + escapeHtml( message ) + '</div>';
91	}
92
93	function dialogMarkup( body, status, labels, idPrefix, surface ) {
94		var buttonClass = surface === 'classic' ? 'button ' : '';
95		return '<button type="button" class="' + buttonClass + 'yobm-verification-open" aria-haspopup="dialog" aria-controls="' + escapeHtml( idPrefix ) + '-dialog" aria-expanded="false">' + escapeHtml( labels.open ) + '</button>' +
96			'<div id="' + escapeHtml( idPrefix ) + '-dialog" class="yobm-verification-dialog" role="dialog" aria-modal="true" aria-labelledby="' + escapeHtml( idPrefix ) + '-title" hidden>' +
97			'<div class="yobm-verification-backdrop"></div><div class="yobm-verification-panel" tabindex="-1">' +
98			'<button type="button" class="yobm-verification-close" aria-label="' + escapeHtml( labels.close ) + '">&times;</button>' +
99			'<h2 id="' + escapeHtml( idPrefix ) + '-title" class="yobm-verification-title">' + escapeHtml( labels.title ) + '</h2>' + body + status + '</div></div>';
100	}
101
102	function stepHeading( labels ) {
103		return '<h2 class="yobm-verification-title">' + escapeHtml( labels.title ) + '</h2>';
104	}
105
106	function render( state, mode, labels, busy, message, isError, now, surface, host ) {
107		labels = presentationLabels( state, labels );
108		var resolvedSurface = surface || 'classic';
109		var idPrefix = 'yobm-verification-' + ( host || resolvedSurface );
110		var content = channelMarkup( state, labels, busy, now, resolvedSurface, idPrefix );
111		var status = liveMarkup( message, isError, idPrefix );
112		var heading = state.required ? stepHeading( labels ) : '';
113		if ( mode === 'popup_modal' && state.required && ! state.ready ) {
114			return '<section class="yobm-verification-step">' + heading + dialogMarkup( content, status, labels, idPrefix, resolvedSurface ) + '</section>';
115		}
116		return '<section class="yobm-verification-step">' + heading + content + status + '</section>';
117	}
118
119	function nextIssueKey( state, context, previousKey, busy ) {
120		var channel = activeChannel( state );
121		if ( ! channel || channel.status === 'challenge_sent' || busy ) {
122			return '';
123		}
124		var candidate = channel.id + ':' + JSON.stringify( context );
125		return candidate === previousKey ? '' : candidate;
126	}
127
128	function validationError( state, labels ) {
129		var copy = presentationLabels( state, labels || {} );
130		return state.ready ? null : { message: copy.required || 'Complete checkout verification before placing the order.', hidden: false };
131	}
132
133	return {
134		activeChannel: activeChannel,
135		presentationLabels: presentationLabels,
136		resendRemaining: resendRemaining,
137		formatStep: formatStep,
138		channelMarkup: channelMarkup,
139		dialogMarkup: dialogMarkup,
140		stepHeading: stepHeading,
141		render: render,
142		nextIssueKey: nextIssueKey,
143		validationError: validationError
144	};
145} ) );

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.