Source: widget/bpm/Widget.js

(function() {
    /**
     * @namespace bpm
     * @memberof Help4.widget
     */
    Help4.widget.bpm = {};

    const NAME = 'bpm';

    /**
     * BPM functionality widget
     * @augments Help4.widget.Widget
     */
    Help4.widget.bpm.Widget = class extends Help4.widget.Widget {
        /** @override */
        constructor() {
            super({
                params: {
                    visible: {init: true}
                }
            });
        }

        /** @override */
        getName() {
            return NAME;
        }

        /**
         * @override
         * @returns {Promise<Help4.widget.Widget.Descriptor>}
         */
        async _onGetDescriptor() {
            const {
                Localization,
                control2: {ICONS},
                widget: {COLOR}
            } = Help4;

            const {bpm: {arisBaseUrl, arisTenant}, WM} = /** @type {Help4.typedef.SystemConfiguration} */ this.getContext().configuration;
            const text = Localization.getText('button.widget.bpm');

            return {
                id: NAME,
                enabled: WM < 2 && !!arisBaseUrl && !!arisTenant,
                showPanel: true,
                tile: {
                    text,
                    title: text,
                    icon: ICONS.bpm,
                    color: COLOR.color5,
                    position: 5
                }
            };
        }

        /** @override */
        async _onBeforeActivate() {
            const {
                core: {screenId},
                bpm: {arisBaseUrl, arisTenant}
            } = this.getContext().configuration;

            // URL pattern: <base Url>/?executabletype=<EXECTYPE>&screenId=<Fiori-Intent>#<Tenant>/onlineguide
            const url = `${arisBaseUrl}/?executabletype=FIORI&screenId=${screenId}#${arisTenant}/onlineguide`;
            Help4.windowOpen(url);

            return false;  // prevent widget from activating
        }
    }
})();