@routebot/constants 0.3.42 → 0.3.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -209,21 +209,25 @@ module.exports = {
209
209
  COUNTRIES,
210
210
  COUNTRY_OPTIONS,
211
211
  getCountryByCode: (code) => {
212
- return COUNTRIES.find((country) => country.code === code);
212
+ return COUNTRIES.find((country) => country.code?.toUpperCase?.() === code?.toUpperCase?.());
213
213
  },
214
214
  getDialCodeByCountryCode: (code) => {
215
- const country = COUNTRIES.find((c) => c.code.toUpperCase() === code.toUpperCase());
215
+ const country = COUNTRIES.find((c) => c.code?.toUpperCase?.() === code?.toUpperCase?.());
216
216
  return country ? country.phonePrefix : null;
217
217
  },
218
218
  getCountryByPhonePrefix: (prefix) => {
219
- return COUNTRIES.find((country) => country.phonePrefix === prefix);
219
+ return COUNTRIES.find((country) => country?.phonePrefix === prefix);
220
220
  },
221
221
  isSmsEnabledForCountry: (code) => {
222
- const country = COUNTRIES.find((c) => c.code.toUpperCase() === code.toUpperCase());
222
+ const country = COUNTRIES.find((c) => c.code?.toUpperCase?.() === code?.toUpperCase?.());
223
+ return country ? country.smsEnabled : false;
224
+ },
225
+ isSmsEnabledForCountryPhonePrefixWithPlus: (prefix) => {
226
+ const country = COUNTRIES.find((c) => c?.phonePrefix === prefix);
223
227
  return country ? country.smsEnabled : false;
224
228
  },
225
229
  getAllCountryCodesLowerCase: () => {
226
- return COUNTRIES.map((country) => country.code.toLowerCase());
230
+ return COUNTRIES.map((country) => country.code?.toLowerCase?.());
227
231
  },
228
232
  getLocalizedCountryName,
229
233
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@routebot/constants",
3
- "version": "0.3.42",
3
+ "version": "0.3.44",
4
4
  "description": "Shared constants for RouteBot FE/BE",
5
5
  "main": "index.js",
6
6
  "files": [