diff --git a/background.js b/background.js index faf1d9b..a411008 100644 --- a/background.js +++ b/background.js @@ -1453,6 +1453,7 @@ const PERSISTED_SETTING_DEFAULTS = { madaoRoutingPlanId: '', madaoProviderId: '', madaoCountry: '', + madaoOperator: '', madaoAutoPickCountry: true, madaoReusePhone: true, madaoMinPrice: '', @@ -2245,6 +2246,13 @@ function normalizeMaDaoPrice(value = '') { return normalizeHeroSmsMaxPrice(value); } +function normalizeMaDaoOperator(value = '') { + return String(value || '') + .trim() + .toLowerCase() + .replace(/[^a-z0-9_-]+/g, ''); +} + function normalizePhonePreferredActivation(value) { if (!value || typeof value !== 'object' || Array.isArray(value)) { return null; @@ -3595,6 +3603,8 @@ function normalizePersistentSettingValue(key, value) { return normalizeMaDaoProviderId(value); case 'madaoCountry': return normalizeMaDaoCountry(value); + case 'madaoOperator': + return normalizeMaDaoOperator(value); case 'madaoAutoPickCountry': case 'madaoReusePhone': return Boolean(value); diff --git a/phone-sms/providers/madao.js b/phone-sms/providers/madao.js index b4185c2..c3a0320 100644 --- a/phone-sms/providers/madao.js +++ b/phone-sms/providers/madao.js @@ -255,6 +255,7 @@ service: normalizeText(options?.service || state?.madaoServiceName, DEFAULT_SERVICE), }; const country = normalizeCountry(options?.country || state?.madaoCountry); + const operator = normalizeProviderId(options?.operator || state?.madaoOperator); const minPrice = normalizePrice(options?.minPrice ?? state?.madaoMinPrice); const maxPrice = normalizePrice(options?.maxPrice ?? state?.madaoMaxPrice); @@ -268,6 +269,9 @@ if (country) { request.country = country; } + if (operator) { + request.metadata = { operator }; + } if (minPrice !== null) { request.min_price = minPrice; } diff --git a/sidepanel/sidepanel.html b/sidepanel/sidepanel.html index d3e2af7..1374717 100644 --- a/sidepanel/sidepanel.html +++ b/sidepanel/sidepanel.html @@ -1565,6 +1565,33 @@ + + +