src/runtime/client-config-manager.js
/**
   * Determines whether a subscription or contribution button should be disabled.
   * @returns {!Promise<boolean|undefined>}
   */
Determines whether a subscription or contribution button should be disabled.
@returns {!Promise}
Determines whether a subscription or contribution button should be disabled . @returns { !Promise }
shouldEnableButton() {
    if (this.clientOptions_.disableButton) {
      return Promise.resolve(false);
    }
    if (!this.responsePromise_) {
      this.fetchClientConfig();
    }
    return this.responsePromise_.then((clientConfig) => {
      if (clientConfig.uiPredicates?.canDisplayButton) {
        return true;
      } else {
        return false;
      }
    });
  }
shouldEnableButton ( ) { if ( this . clientOptions_ . disableButton ) { return Promise . resolve ( false ) ; } if ( ! this . responsePromise_ ) { this . fetchClientConfig ( ) ; } return this . responsePromise_ . then ( ( clientConfig ) => { if ( clientConfig . uiPredicates ?. canDisplayButton ) { return true ; } else { return false ; } } ) ; }
Determines whether a subscription or contribution button should be disabled.
Determines whether a subscription or contribution button should be disabled .
// Disable button if disableButton is set to be true in clientOptions. // If disableButton is set to be false or not set, then always enable button. // This is for testing purpose. // UI predicates decides whether to enable button.