feat: add SMS Bower verification settings

This commit is contained in:
chick
2026-05-30 23:14:41 +08:00
parent b5980f5b46
commit b69490e632
6 changed files with 339 additions and 17 deletions
@@ -149,6 +149,14 @@ test('sidepanel html exposes phone verification toggle and multi-provider SMS ro
assert.match(html, /id="row-nex-sms-country-fallback"/);
assert.match(html, /id="row-nex-sms-service-code"/);
assert.match(html, /id="input-nex-sms-service-code"/);
assert.match(html, /id="row-sms-bower-api-key"/);
assert.match(html, /id="input-sms-bower-api-key"/);
assert.match(html, /id="row-sms-bower-country"/);
assert.match(html, /id="select-sms-bower-country"/);
assert.match(html, /id="row-sms-bower-country-fallback"/);
assert.doesNotMatch(html, /id="row-sms-bower-max-price"/);
assert.doesNotMatch(html, /id="input-sms-bower-min-price"/);
assert.doesNotMatch(html, /id="input-sms-bower-max-price"/);
assert.match(html, /id="row-madao-base-url"/);
assert.match(html, /id="input-madao-base-url"/);
assert.match(html, /id="row-madao-http-secret"/);
@@ -185,6 +193,30 @@ test('sidepanel html exposes phone verification toggle and multi-provider SMS ro
assert.doesNotMatch(html, /id="input-account-run-history-text-enabled"/);
});
test('SMS Bower sidepanel exposes HeroSMS-like user controls while hiding internal IDs', () => {
assert.match(sidepanelSource, /smsBowerApiKey:/);
assert.match(sidepanelSource, /rowSmsBowerApiKey/);
assert.match(sidepanelSource, /\[PHONE_SMS_PROVIDER_SMS_BOWER\]: Object\.freeze\(\{\s*rowKeys: Object\.freeze\(\[\s*'rowSmsBowerApiKey',\s*'rowSmsBowerCountry',\s*'rowSmsBowerCountryFallback',\s*'rowHeroSmsMaxPrice',\s*\]\),\s*\}\)/);
assert.match(sidepanelSource, /smsBowerApiKey:\s*smsBowerApiKeyValue/);
assert.match(sidepanelSource, /smsBowerCountryId:/);
assert.match(sidepanelSource, /smsBowerCountryLabel:/);
assert.match(sidepanelSource, /smsBowerCountryOrder:/);
assert.match(sidepanelSource, /smsBowerMinPrice:/);
assert.match(sidepanelSource, /smsBowerMaxPrice:/);
assert.match(sidepanelSource, /inputVerificationResendCount/);
assert.match(sidepanelSource, /rowPhoneVerificationResendCount/);
assert.match(sidepanelHtml, /id="row-sms-bower-country"/);
assert.match(sidepanelHtml, /id="select-sms-bower-country"/);
assert.match(sidepanelHtml, /id="row-sms-bower-country-fallback"/);
assert.doesNotMatch(sidepanelSource, /smsBowerProviderIds:/);
assert.doesNotMatch(sidepanelSource, /smsBowerExceptProviderIds:/);
assert.doesNotMatch(sidepanelSource, /case 'smsBowerProviderIds':/);
assert.doesNotMatch(sidepanelHtml, /id="input-sms-bower-country-id"/);
assert.doesNotMatch(sidepanelHtml, /id="input-sms-bower-provider-ids"/);
assert.doesNotMatch(sidepanelHtml, /id="input-sms-bower-except-provider-ids"/);
});
test('sidepanel loads live SMS country lists silently during startup', () => {
const heroLoader = extractFunction('loadHeroSmsCountries');
const fiveSimLoader = extractFunction('loadFiveSimCountries');
@@ -934,6 +966,8 @@ const rowNexSmsCountry = { style: { display: 'none' } };
const rowNexSmsCountryFallback = { style: { display: 'none' } };
const rowNexSmsServiceCode = { style: { display: 'none' } };
const rowSmsBowerApiKey = { style: { display: 'none' } };
const rowSmsBowerCountry = { style: { display: 'none' } };
const rowSmsBowerCountryFallback = { style: { display: 'none' } };
const rowMaDaoBaseUrl = { style: { display: 'none' } };
const rowMaDaoHttpSecret = { style: { display: 'none' } };
const rowMaDaoMode = { style: { display: 'none' } };
@@ -973,6 +1007,7 @@ const PHONE_SMS_PROVIDER_HERO_SMS = 'hero-sms';
const PHONE_SMS_PROVIDER_HERO = PHONE_SMS_PROVIDER_HERO_SMS;
const PHONE_SMS_PROVIDER_FIVE_SIM = '5sim';
const PHONE_SMS_PROVIDER_NEXSMS = 'nexsms';
const PHONE_SMS_PROVIDER_SMS_BOWER = 'sms-bower';
const PHONE_SMS_PROVIDER_MADAO = 'madao';
const MADAO_MODE_ROUTING_PLAN = 'routing_plan';
const MADAO_MODE_DIRECT = 'direct';
@@ -1013,6 +1048,9 @@ const PHONE_SMS_PROVIDER_UI_DESCRIPTORS = ${JSON.stringify({
'sms-bower': {
rowKeys: [
'rowSmsBowerApiKey',
'rowSmsBowerCountry',
'rowSmsBowerCountryFallback',
'rowHeroSmsMaxPrice',
],
},
madao: {
@@ -1464,6 +1502,7 @@ const PHONE_SMS_PROVIDER_HERO_SMS = 'hero-sms';
const PHONE_SMS_PROVIDER_HERO = PHONE_SMS_PROVIDER_HERO_SMS;
const PHONE_SMS_PROVIDER_FIVE_SIM = '5sim';
const PHONE_SMS_PROVIDER_NEXSMS = 'nexsms';
const PHONE_SMS_PROVIDER_SMS_BOWER = 'sms-bower';
const PHONE_SMS_PROVIDER_MADAO = 'madao';
const DEFAULT_PHONE_SMS_PROVIDER = PHONE_SMS_PROVIDER_HERO_SMS;
const DEFAULT_MADAO_BASE_URL = 'http://127.0.0.1:7822';
@@ -1523,6 +1562,9 @@ ${extractFunction('normalizeFiveSimProductValue')}
${extractFunction('normalizeNexSmsCountryIdValue')}
${extractFunction('normalizeNexSmsCountryOrderValue')}
${extractFunction('normalizeNexSmsServiceCodeValue')}
${extractFunction('normalizeSmsBowerCountryIdValue')}
${extractFunction('normalizeSmsBowerCountryLabelValue')}
${extractFunction('normalizeSmsBowerCountryOrderValue')}
function getSelectedPhoneSmsProvider() { return normalizePhoneSmsProvider(selectPhoneSmsProvider?.value || latestState?.phoneSmsProvider); }
function getSelectedPhoneSmsProviderOrder() { return ['nexsms', '5sim']; }
${extractFunction('normalizeFiveSimCountryId')}
@@ -1660,6 +1702,7 @@ const PHONE_SMS_PROVIDER_HERO_SMS = 'hero-sms';
const PHONE_SMS_PROVIDER_HERO = PHONE_SMS_PROVIDER_HERO_SMS;
const PHONE_SMS_PROVIDER_FIVE_SIM = '5sim';
const PHONE_SMS_PROVIDER_NEXSMS = 'nexsms';
const PHONE_SMS_PROVIDER_SMS_BOWER = 'sms-bower';
const PHONE_SMS_PROVIDER_MADAO = 'madao';
const DEFAULT_PHONE_SMS_PROVIDER = PHONE_SMS_PROVIDER_HERO_SMS;
const DEFAULT_PHONE_SMS_PROVIDER_ORDER = ['hero-sms', '5sim', 'nexsms', 'madao'];
@@ -1877,6 +1920,7 @@ const PHONE_SMS_PROVIDER_HERO_SMS = 'hero-sms';
const PHONE_SMS_PROVIDER_HERO = PHONE_SMS_PROVIDER_HERO_SMS;
const PHONE_SMS_PROVIDER_FIVE_SIM = '5sim';
const PHONE_SMS_PROVIDER_NEXSMS = 'nexsms';
const PHONE_SMS_PROVIDER_SMS_BOWER = 'sms-bower';
const PHONE_SMS_PROVIDER_MADAO = 'madao';
const DEFAULT_PHONE_SMS_PROVIDER = PHONE_SMS_PROVIDER_HERO_SMS;
const DEFAULT_FIVE_SIM_COUNTRY_ID = 'vietnam';
+4 -3
View File
@@ -91,9 +91,8 @@ test('SMS Bower provider acquires number, polls code, and updates activation sta
smsBowerServiceCode: 'ot',
smsBowerCountryId: 16,
smsBowerCountryLabel: 'United Kingdom',
smsBowerMaxPrice: '0.3',
smsBowerMinPrice: '0.1',
smsBowerProviderIds: '3170,3180',
smsBowerMaxPrice: '0.3',
};
const activation = await provider.requestActivation(state);
@@ -116,7 +115,9 @@ test('SMS Bower provider acquires number, polls code, and updates activation sta
assert.equal(acquireUrl.searchParams.get('country'), '16');
assert.equal(acquireUrl.searchParams.get('maxPrice'), '0.3');
assert.equal(acquireUrl.searchParams.get('minPrice'), '0.1');
assert.equal(acquireUrl.searchParams.get('providerIds'), '3170,3180');
assert.equal(acquireUrl.searchParams.get('providerIds'), null);
assert.equal(acquireUrl.searchParams.get('exceptProviderIds'), null);
assert.equal(acquireUrl.searchParams.get('phoneException'), null);
assert.deepStrictEqual(
requests.map((entry) => [entry.url.searchParams.get('action'), entry.url.searchParams.get('status')]),
[