Skip to content

Token editor scripts accidentally loaded in FSE themes #792

@unfulvio

Description

@unfulvio

Hey there 👋

When a gateway is active, the token editor scripts from the SV framework are attempted to be loaded in FSE themes, causing an uncaught error in console. Normally this doesn't affect functionality (at least in the gateways I saw this showing up) but all errors are raised to the developer. Still, it should be fixed:

Image
Uncaught ReferenceError: module is not defined
    at sv-wc-payment-gateway-token-editor.js?ver=1717151442:1:3213

Investigate fix (/payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php):

  /**
   * Load the editor scripts and styles.
   *
   * @since 4.3.0
   */
  public function enqueue_scripts_styles() {

        $screen = get_current_screen();

        if ( ! $screen || ! in_array( $screen->id, [ 'profile', 'user-edit' ], true ) ) {
                return;
        }

        //... rest of the method as is

hope this is helpful

cheers!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions