Problem/Motivation

Running the Client Hub widget on real sites shows several gaps:

  • No per-environment off switch. Enabled is exported config, so it is the same on every environment after a config import. Teams need the widget off on local or staging without changing exported config.
  • No page exclusions. The widget can be limited by role and theme, but not by page (for example login, checkout or node edit forms).
  • Overlap with other widgets. Chat, cookie banners or back-to-top buttons often sit in the same corner as the launcher. The widget renders in a shadow root, so theme CSS can't move it.
  • Hard-to-use settings page. On sites with many roles or themes, the checkbox lists push the rest of the form far down the page, and the fields have no grouping.
  • Missed setup step. New users miss that the site's domain must be registered for the key in the Client Hub. Without it the browser shows a CORS error, with no hint from Drupal.

Proposed resolution

  • Kill switch: $settings['vardot_hub_disabled'] = TRUE; in settings.php turns the widget off on that environment, overriding Enabled. The settings form shows a warning while it is active.
  • Skip on these paths: a textarea, one path per line, with * wildcards and <front>, as in core block visibility. Both the internal path and its alias are matched, case-insensitively. A missing leading slash is added on save. The url.path cache context is added only when paths are set.
  • Position: move the widget Up and/or Left, each with an amount and a unit (px, or % of the screen height / width). The browser limits the amount to 50 for % and 1000 for px, updating the limit when the unit changes, and saving caps the values too. When set, a small library adds a stylesheet inside the widget's open shadow root that moves the launcher, panel and recording bar together and keeps the panel on screen. The corner itself stays a Client Hub setting.
  • Settings page: group fields into Connection, Visibility and Position. Roles and themes go in collapsible sections titled with the selected count, collapsed when there are more than 10 options. Skip paths go in a Pages fieldset. Saving reloads the settings page.
  • Help: hook_help() for the help page and the settings page, listing the setup steps: select a key, then register the site's origin (shown on the page, including http:// or https://) for that key in the Client Hub.
  • Note: the position feature relies on the widget's internal class names. A data attribute supported by the widget itself (for example data-offset-up) would be more robust long term.

    Remaining tasks

    • Review
    • Run the functional tests (kill switch, skip paths, position settings, collapse threshold, help text)
    • Manual browser check of the position shift for each Hub placement (bottom/middle, left/right)

    User interface changes

    • Settings form regrouped into Connection, Visibility (Roles, Themes, Pages) and Position.
    • New fields: Skip on these paths; Up and Left amounts with a px / % unit.
    • Warning on the form when the kill switch is set.
    • Help text on the settings page and at /admin/help/vardot_hub.

    API changes

    • New setting: $settings['vardot_hub_disabled'].
    • New libraries vardot_hub/offset (with drupalSettings.vardotHub.offset) and vardot_hub/settings_form.

    Data model changes

    New keys in vardot_hub.settings: skip_paths (string), offset_up and offset_left (integer), offset_up_unit and offset_left_unit (string, px or %).

    Issue fork vardot_hub-3635481

    Command icon Show commands

    Start within a Git clone of the project using the version control instructions.

    Or, if you do not have SSH keys set up on git.drupalcode.org:

    Comments

    yazanmajadba created an issue. See original summary.

    yasmeensalah’s picture

    Status: Needs review » Fixed

    Now that this issue is closed, review the contribution record.

    As a contributor, attribute any organization that helped you, or if you volunteered your own time.

    Maintainers, credit people who helped resolve this issue.