<commit_before>class BillingFormModal extends PaymentFormModal

  constructor:(options={}, data)->

    options.callback = (formData) => @emit 'PaymentInfoSubmitted', formData

    options.additionalFields =
      company             :
        label             : 'Company & VAT'
        placeholder       : 'Company (optional)'
        defaultValue      : data.company
        nextElementFlat   :
          vatNumber       :
            placeholder   : 'VAT Number (optional)'
            defaultValue  : data.vatNumber 

      address             :
        label             : 'Address & ZIP'
        placeholder       : 'Address (optional)'
        defaultValue      : data.address1
        nextElementFlat   :
          zip             :
            placeholder   : 'ZIP (optional)'
            defaultValue  : data.zip

      city                :
        label             : 'City & Country'
        placeholder       : 'City (optional)'
        defaultValue      : data.city
        nextElementFlat   :
          country         :
            itemClass     : KDSelectBox
            defaultValue  : data.country or defaultCountry

      phone               :
        label             : 'Phone'
        placeholder       : '(optional)'
        defaultValue      : data.phone

    super options, data

    # set up a loader to compensate for latency while we load the country list
    @countryLoader = new KDLoaderView
      size        : { width: 14 }
      showLoader  : yes

    @billingForm.fields.country.addSubView @countryLoader

  setCountryData: ({ countries, countryOfIp }) ->
    { country } = @billingForm.inputs

    country.setSelectOptions _.values countries

    country.setValue(
      if countries[countryOfIp]
      then countryOfIp
      else 'US'
    )

    @countryLoader.hide()

  handleFormData:-><commit_msg>bugfix: reference error defaultCountry => 'US'<commit_after>class BillingFormModal extends PaymentFormModal

  constructor:(options={}, data)->

    options.callback = (formData) => @emit 'PaymentInfoSubmitted', formData

    options.additionalFields =
      company             :
        label             : 'Company & VAT'
        placeholder       : 'Company (optional)'
        defaultValue      : data.company
        nextElementFlat   :
          vatNumber       :
            placeholder   : 'VAT Number (optional)'
            defaultValue  : data.vatNumber 

      address             :
        label             : 'Address & ZIP'
        placeholder       : 'Address (optional)'
        defaultValue      : data.address1
        nextElementFlat   :
          zip             :
            placeholder   : 'ZIP (optional)'
            defaultValue  : data.zip

      city                :
        label             : 'City & Country'
        placeholder       : 'City (optional)'
        defaultValue      : data.city
        nextElementFlat   :
          country         :
            itemClass     : KDSelectBox
            defaultValue  : data.country or 'US'

      phone               :
        label             : 'Phone'
        placeholder       : '(optional)'
        defaultValue      : data.phone

    super options, data

    # set up a loader to compensate for latency while we load the country list
    @countryLoader = new KDLoaderView
      size        : { width: 14 }
      showLoader  : yes

    @billingForm.fields.country.addSubView @countryLoader

  setCountryData: ({ countries, countryOfIp }) ->
    { country } = @billingForm.inputs

    country.setSelectOptions _.values countries

    country.setValue(
      if countries[countryOfIp]
      then countryOfIp
      else 'US'
    )

    @countryLoader.hide()

  handleFormData:->
{'fraction_non_alphanumeric': 0.07592542556065929, 'fraction_numerical': 0.0016211834639286678, 'mean_word_length': 1.5744089012517386, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, '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': '7244768', 'n_tokens_mistral': 946, 'n_tokens_neox': 895, 'n_words': 229}