@@ -264,4 +264,89 @@ public static async Task<IModalReference> PromptModal(
264264
265265 return result . Data as string ;
266266 }
267+
268+ /// <summary>
269+ /// Shows a verification modal dialog that requires the user to type a confirmation value before proceeding.
270+ /// </summary>
271+ /// <param name="modalService">The modal service instance.</param>
272+ /// <param name="message">The message text to display in the verification dialog.</param>
273+ /// <param name="title">The title of the dialog. Defaults to "Verify".</param>
274+ /// <param name="verifyValue">The text the user must type to enable the primary action. Defaults to "APPROVE".</param>
275+ /// <param name="type">The visual variant of the dialog. Defaults to <see cref="ModalVariant.Danger"/>.</param>
276+ /// <param name="primaryAction">The text for the primary action button. Defaults to "OK".</param>
277+ /// <param name="secondaryAction">The text for the secondary action button. Defaults to "Cancel".</param>
278+ /// <returns>
279+ /// A task that returns an <see cref="IModalReference"/> which can be used to interact with the modal and await its result.
280+ /// </returns>
281+ /// <remarks>
282+ /// This method displays a <see cref="VerifyModal"/> component with the specified parameters,
283+ /// including the value the user must type to confirm the action.
284+ /// </remarks>
285+ public static async Task < IModalReference > VerifyModal (
286+ this ModalService modalService ,
287+ string message ,
288+ string title = "Verify" ,
289+ string verifyValue = "APPROVE" ,
290+ ModalVariant type = ModalVariant . Danger ,
291+ string primaryAction = "OK" ,
292+ string secondaryAction = "Cancel" )
293+ {
294+ var parameters = ModalService . CreateParameters (
295+ message : message ,
296+ title : title ,
297+ type : type ,
298+ primaryAction : primaryAction ,
299+ secondaryAction : secondaryAction ) ;
300+
301+ parameters [ nameof ( Controls . VerifyModal . VerifyValue ) ] = verifyValue ;
302+
303+ return await modalService . Show < VerifyModal > ( parameters ) ;
304+ }
305+
306+ /// <summary>
307+ /// Shows a verification modal dialog and returns whether the user completed the verification.
308+ /// </summary>
309+ /// <param name="modalService">The modal service instance.</param>
310+ /// <param name="message">The message text to display in the verification dialog.</param>
311+ /// <param name="title">The title of the dialog. Defaults to "Verify".</param>
312+ /// <param name="verifyValue">The text the user must type to enable the primary action. Defaults to "APPROVE".</param>
313+ /// <param name="type">The visual variant of the dialog. Defaults to <see cref="ModalVariant.Danger"/>.</param>
314+ /// <param name="primaryAction">The text for the primary action button. Defaults to "OK".</param>
315+ /// <param name="secondaryAction">The text for the secondary action button. Defaults to "Cancel".</param>
316+ /// <returns>
317+ /// A task that returns <c>true</c> if the user verified and confirmed the action; otherwise, <c>false</c> if cancelled.
318+ /// </returns>
319+ /// <remarks>
320+ /// This is a convenience method that shows a verification dialog and automatically awaits the result,
321+ /// returning a boolean indicating whether the dialog was confirmed or cancelled.
322+ /// </remarks>
323+ /// <example>
324+ /// <code>
325+ /// if (await modalService.Verify("Are you sure you want to delete all records?"))
326+ /// {
327+ /// // User verified, proceed with the destructive action
328+ /// }
329+ /// </code>
330+ /// </example>
331+ public static async Task < bool > Verify (
332+ this ModalService modalService ,
333+ string message ,
334+ string title = "Verify" ,
335+ string verifyValue = "APPROVE" ,
336+ ModalVariant type = ModalVariant . Danger ,
337+ string primaryAction = "OK" ,
338+ string secondaryAction = "Cancel" )
339+ {
340+ var modal = await modalService . VerifyModal (
341+ message : message ,
342+ title : title ,
343+ verifyValue : verifyValue ,
344+ type : type ,
345+ primaryAction : primaryAction ,
346+ secondaryAction : secondaryAction
347+ ) ;
348+
349+ var result = await modal . Result ;
350+ return ! result . Cancelled ;
351+ }
267352}
0 commit comments