angularfreshdesk

Freshdesk feedback widget with Angular application


I try to install Freshdesk feedback widget on Angular (version 8.2.7) application.

I have created widget embeded code using Freshdesk admin portal.

The widget code is here:

<script>
    window.fwSettings={
    'widget_id': <MY PERSONAL ID>
    };
    !function(){if("function"!=typeof window.FreshworksWidget){var n=function(){n.q.push(arguments)};n.q=[],window.FreshworksWidget=n}}() 
</script>
<script type='text/javascript' src='https://widget.freshworks.com/widgets/47000002937.js' async defer></script>

After I have inserted this code before </body> tag.

And this script damage my Angular application.

The error is here:

main.ts:12 Error: Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.
Most likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)
    at Function.assertZonePatched (zone-evergreen.js:52) [<root>]
    at new NgZone (core.js:39456) [<root>]
    at getNgZone (core.js:40707) [<root>]
    at PlatformRef.bootstrapModuleFactory (core.js:40522) [<root>]
    at vendor.js:83613:31 [<root>]
    at widget.freshworks.com/widgetBase/bootstrap.js:1:20208 [<root>]

How fix this error?

Thanks for any help.


Solution

  • You can use Freshdesk Angular wrapper.

    It provided as ngx-freshdesk-webwidget NPM package.

    Source code, documentation and examples are available here.