`showWarningMessage` does not accept object as parameter in typed definition

WebViewer Version:
8.1.0, 8.3.0

Do you have an issue with a specific file(s)?
client/node_modules/@pdftron/webviewer/types.d.ts

Can you reproduce using one of our samples or online demos?
Angular Project and try to open a showWarningMessage:

const result = await instance.UI.showWarningMessage({
        title:"myTitle",
        message: "myMessage",
        confirmBtnText: "OK",
        onConfirm: () => {
          resolve(true);
        },
        onCancel: () => {
          resolve(false);
        },
      });

Are you using the WebViewer server?
No

Does the issue only happen on certain browsers?
No
Is your issue related to a front-end framework?
Yes, Angular
Is your issue related to annotations?
No
Please give a brief summary of your issue:
showWarningMessage does not accept object as parameter.

In line 390053 of the client/node_modules/@pdftron/webviewer/types.d.ts accept no parameter.

Workaround:

const ui = instance.UI as any;
const result = await ui.showWarningMessage({...

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Hi,

Thank you for contacting us regarding WebViewer and reporting this issue. We’ll update our typescript definition so that this doesn’t happen in the future. In the meantime, you can open the “type.d.ts” files and change the “showWarningMessage” definition to

     * @param options - Warning string message to display or an object for controlling the warning popup
     * @param options.confirmBtnText - The text that will be rendered in the confirm button
     * @param options.title - The title of the modal
     * @param options.message - The text that will rendered in the body of the modal
     * @param options.onConfirm - The callback function that will be invoked when the user clicks the Confirm button. The callback must return a Promise that resolves.
     * @param options.onCancel - The callback function that will be invoked when the user clicks the Cancel button. The callback must return a Promise that resolves.
     */
    function showWarningMessage(options: {
        confirmBtnText: string;
        title: string;
        message: string;
        onConfirm: (...params: any[]) => any;
        onCancel: (...params: any[]) => any;
    }): void;

The updated definition should show up in our next release of WebViewer (8.4)

Best Regards,

Andrew Yip
Software Developer
PDFTron Systems, Inc.
www.pdftron.com

1 Like