<commit_before>/* exported onBuyClicked */

/**
 * Launches payment request for SPC.
 */
async function onBuyClicked() {
  try {
    const request = await createSPCPaymentRequest({
      credentialIds: [Uint8Array.from(
          atob(window.localStorage.getItem('no_credential_identifier')),
          c => c.charCodeAt(0))],
    });

    const result = await request.canMakePayment();
    info(result ? "Can make payment" : "Cannot make payment");
    const hEI = await request.hasEnrolledInstrument();
    info(hEI ? "Has enrolled instrument" : "No enrolled instrument");

    const instrumentResponse = await request.show();
    await instrumentResponse.complete('success')
    info(JSON.stringify(instrumentResponse, undefined, 2));
  } catch (err) {
    error(err);
  }
}<commit_msg>Bugfix; ignore hEI if it fails<commit_after>/* exported onBuyClicked */

/**
 * Launches payment request for SPC.
 */
async function onBuyClicked() {
  try {
    const request = await createSPCPaymentRequest({
      credentialIds: [Uint8Array.from(
          atob(window.localStorage.getItem('no_credential_identifier')),
          c => c.charCodeAt(0))],
    });

    const result = await request.canMakePayment();
    info(result ? "Can make payment" : "Cannot make payment");
    // We don't mind if this fails.
    try {
      const hEI = await request.hasEnrolledInstrument();
      info(hEI ? "Has enrolled instrument" : "No enrolled instrument");
    } catch (err) {
      error("Has enrolled instrument FAILED - " + err);
    }

    const instrumentResponse = await request.show();
    await instrumentResponse.complete('success')
    info(JSON.stringify(instrumentResponse, undefined, 2));
  } catch (err) {
    error(err);
  }
}
{'fraction_non_alphanumeric': 0.12623045744064854, 'fraction_numerical': 0.003474232773595831, 'mean_word_length': 3.4536082474226806, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3365417', 'n_tokens_mistral': 519, 'n_tokens_neox': 504, 'n_words': 131}