<commit_before>(ns frontend.intercom
  (:require [frontend.utils :as utils :include-macros true]))

(defn raise-dialog [ch]
  (try
    (js/Intercom "show")
    (catch :default e
      (utils/notify-error ch "Uh-oh, our Help system isn't available. Please email us instead, at <EMAIL>")
      (utils/merror e))))

(defn user-link []
  (let [path (.. js/window -location -pathname)
        re (js/RegExp. "/gh/([^/]+/[^/]+)")]
    (when-let [match (.match path re)]
      (str "https://www.intercom.io/apps/vnk4oztr/users"
           "?utf8=%E2%9C%93"
           "&filters%5B0%5D%5Battr%5D=custom_data.pr-followed"
           "&filters%5B0%5D%5Bcomparison%5D=contains&filters%5B0%5D%5Bvalue%5D="
           (second path)))))

(defn track [event & [metadata]]
  (utils/swallow-errors (js/Intercom "trackEvent" (name event) metadata)))<commit_msg>convert to js to that it works<commit_after>(ns frontend.intercom
  (:require [frontend.utils :as utils :include-macros true]))

(defn raise-dialog [ch]
  (try
    (js/Intercom "show")
    (catch :default e
      (utils/notify-error ch "Uh-oh, our Help system isn't available. Please email us instead, at <EMAIL>")
      (utils/merror e))))

(defn user-link []
  (let [path (.. js/window -location -pathname)
        re (js/RegExp. "/gh/([^/]+/[^/]+)")]
    (when-let [match (.match path re)]
      (str "https://www.intercom.io/apps/vnk4oztr/users"
           "?utf8=%E2%9C%93"
           "&filters%5B0%5D%5Battr%5D=custom_data.pr-followed"
           "&filters%5B0%5D%5Bcomparison%5D=contains&filters%5B0%5D%5Bvalue%5D="
           (second path)))))

(defn track [event & [metadata]]
  (utils/swallow-errors (js/Intercom "trackEvent" (name event) (clj->js metadata))))
{'fraction_non_alphanumeric': 0.18213660245183888, 'fraction_numerical': 0.024518388791593695, 'mean_word_length': 3.2531017369727047, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '7423582', 'n_tokens_mistral': 658, 'n_tokens_neox': 641, 'n_words': 136}