Skip to content

v0.11.0

Choose a tag to compare

@ramonmalcolm10 ramonmalcolm10 released this 27 Sep 10:39
· 1 commit to main since this release

Phone numbers in the pre-chat form get a country picker, and CloudTrain checks the form when it is sent.

  • Country picker beside a phone field, preselected from the visitor's country (from CloudTrain, else the browser or device region). On the web it is a native select; in React Native, a button that opens a searchable list. No phone library is bundled: the picker is a ~0.9 KB table of countries and dialling codes, with emoji flags and the platform's own country names.
  • Checked by the server. Pressing Continue posts the form to POST /api/v1/leads, which validates every value - the phone with libphonenumber, the same rules as every other lead - and anything wrong is shown under its field.
  • The lead is saved at Continue, so a visitor who fills the form in and leaves is still a lead.
  • The business being out of leads for the month, or the server being unreachable, never stops the visitor from chatting.

SDK: submitLead(), PHONE_COUNTRIES, phoneCountriesByName(), defaultPhoneCountry(), flagEmoji(), countryName(), and Agent.visitor_country.

Needs a CloudTrain server with lead capture (the form only appears when the widget's "Ask for details before the chat" is on).