Skip to content

@mega-yfue/eufy-sdk / tuya / resolveCountryCode

Function: resolveCountryCode()

ts
function resolveCountryCode(
   phoneCode?, 
   region?, 
   isoCode?
): string;

Resolve the Tuya countryCode login field. Priority:

  1. phoneCode — an explicit numeric dial code (e.g. "49") when the caller already has one.
  2. isoCode — an ISO 3166-1 alpha-2 code (e.g. "DE" from MegaClientConfig.countryCode) looked up via isoToDialCode. Covers the full eufy market range, so a German user on the EU shard correctly receives "49" rather than the coarse region fallback's "44".
  3. region — coarse mega shard prefix fallback: "EU""44", "CN""86", else "1".

Parameters

phoneCode?

string

region?

string

isoCode?

string

Returns

string

Independent and unofficial. Not affiliated with, endorsed by, or sponsored by Anker Innovations, Anker eufy, or eufy. "Anker eufy", "eufy" and "Anker" are trademarks of their respective owners. Use responsibly — rapid or failed logins can trigger captcha or temporary cooldowns.