feat: add SMS Bower verification settings
This commit is contained in:
@@ -1546,6 +1546,26 @@
|
||||
data-hide-label="隐藏 SMS Bower Token" aria-label="显示 SMS Bower Token" title="显示 SMS Bower Token"></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="data-row" id="row-sms-bower-country" style="display:none;">
|
||||
<span class="data-label">地区选择</span>
|
||||
<div class="data-inline hero-sms-country-stack">
|
||||
<select id="select-sms-bower-country" class="data-input mono" multiple size="6">
|
||||
<option value="6" selected>印度尼西亚 (Indonesia) #6</option>
|
||||
<option value="52">泰国 (Thailand) #52</option>
|
||||
<option value="16">英国 (United Kingdom) #16</option>
|
||||
<option value="12">美国 (United States) #12</option>
|
||||
<option value="0">俄罗斯 (Russia) #0</option>
|
||||
</select>
|
||||
<span class="data-value hero-sms-country-note">可多选,按列表顺序作为购买重试顺序。</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="data-row" id="row-sms-bower-country-fallback" style="display:none;">
|
||||
<span class="data-label">生效顺序</span>
|
||||
<div class="data-inline data-value-actions">
|
||||
<span id="display-sms-bower-country-fallback-order" class="data-value data-value-fill mono country-order-list">Indonesia #6</span>
|
||||
<button id="btn-sms-bower-country-clear" class="btn btn-ghost btn-xs data-inline-btn" type="button">清空</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="data-row" id="row-madao-base-url" style="display:none;">
|
||||
<span class="data-label">MaDao 地址</span>
|
||||
<input type="text" id="input-madao-base-url" class="data-input mono"
|
||||
|
||||
+202
-9
@@ -455,6 +455,8 @@ const rowNexSmsCountry = document.getElementById('row-nex-sms-country');
|
||||
const rowNexSmsCountryFallback = document.getElementById('row-nex-sms-country-fallback');
|
||||
const rowNexSmsServiceCode = document.getElementById('row-nex-sms-service-code');
|
||||
const rowSmsBowerApiKey = document.getElementById('row-sms-bower-api-key');
|
||||
const rowSmsBowerCountry = document.getElementById('row-sms-bower-country');
|
||||
const rowSmsBowerCountryFallback = document.getElementById('row-sms-bower-country-fallback');
|
||||
const rowMaDaoBaseUrl = document.getElementById('row-madao-base-url');
|
||||
const rowMaDaoHttpSecret = document.getElementById('row-madao-http-secret');
|
||||
const rowMaDaoMode = document.getElementById('row-madao-mode');
|
||||
@@ -541,6 +543,9 @@ const nexSmsCountryMenuShell = document.getElementById('nex-sms-country-menu-she
|
||||
const btnNexSmsCountryMenu = document.getElementById('btn-nex-sms-country-menu');
|
||||
const nexSmsCountryMenu = document.getElementById('nex-sms-country-menu');
|
||||
const btnNexSmsCountryClear = document.getElementById('btn-nex-sms-country-clear');
|
||||
const selectSmsBowerCountry = document.getElementById('select-sms-bower-country');
|
||||
const displaySmsBowerCountryFallbackOrder = document.getElementById('display-sms-bower-country-fallback-order');
|
||||
const btnSmsBowerCountryClear = document.getElementById('btn-sms-bower-country-clear');
|
||||
const selectPhoneSmsProviderOrder = document.getElementById('select-phone-sms-provider-order');
|
||||
const phoneSmsProviderOrderMenuShell = document.getElementById('phone-sms-provider-order-menu-shell');
|
||||
const btnPhoneSmsProviderOrderMenu = document.getElementById('btn-phone-sms-provider-order-menu');
|
||||
@@ -696,8 +701,6 @@ const DEFAULT_FIVE_SIM_OPERATOR = 'any';
|
||||
const DEFAULT_FIVE_SIM_PRODUCT = 'openai';
|
||||
const DEFAULT_NEX_SMS_COUNTRY_ORDER = Object.freeze([1]);
|
||||
const DEFAULT_NEX_SMS_SERVICE_CODE = 'ot';
|
||||
const DEFAULT_SMS_BOWER_COUNTRY_ORDER = Object.freeze([52]);
|
||||
const DEFAULT_SMS_BOWER_SERVICE_CODE = 'ot';
|
||||
const DEFAULT_MADAO_BASE_URL = 'http://127.0.0.1:7822';
|
||||
const MADAO_MODE_ROUTING_PLAN = 'routing_plan';
|
||||
const MADAO_MODE_DIRECT = 'direct';
|
||||
@@ -742,6 +745,9 @@ const PHONE_SMS_PROVIDER_UI_DESCRIPTORS = Object.freeze({
|
||||
[PHONE_SMS_PROVIDER_SMS_BOWER]: Object.freeze({
|
||||
rowKeys: Object.freeze([
|
||||
'rowSmsBowerApiKey',
|
||||
'rowSmsBowerCountry',
|
||||
'rowSmsBowerCountryFallback',
|
||||
'rowHeroSmsMaxPrice',
|
||||
]),
|
||||
}),
|
||||
[PHONE_SMS_PROVIDER_MADAO]: Object.freeze({
|
||||
@@ -781,6 +787,8 @@ function getPhoneSmsProviderUiRowMap() {
|
||||
rowNexSmsCountryFallback,
|
||||
rowNexSmsServiceCode,
|
||||
rowSmsBowerApiKey,
|
||||
rowSmsBowerCountry,
|
||||
rowSmsBowerCountryFallback,
|
||||
rowMaDaoBaseUrl,
|
||||
rowMaDaoHttpSecret,
|
||||
rowMaDaoMode,
|
||||
@@ -4785,6 +4793,15 @@ function collectSettingsPayload() {
|
||||
const fiveSimMinPriceValue = phoneSmsProviderValue === PHONE_SMS_PROVIDER_FIVE_SIM
|
||||
? currentPhoneSmsMinPriceValue
|
||||
: normalizePhoneSmsMinPriceValueSafe(latestState?.fiveSimMinPrice || '', PHONE_SMS_PROVIDER_FIVE_SIM);
|
||||
const smsBowerProviderConstant = typeof PHONE_SMS_PROVIDER_SMS_BOWER !== 'undefined'
|
||||
? PHONE_SMS_PROVIDER_SMS_BOWER
|
||||
: 'sms-bower';
|
||||
const smsBowerMaxPriceValue = phoneSmsProviderValue === smsBowerProviderConstant
|
||||
? currentPhoneSmsMaxPriceValue
|
||||
: normalizeHeroSmsMaxPriceValue(latestState?.smsBowerMaxPrice || '');
|
||||
const smsBowerMinPriceValue = phoneSmsProviderValue === smsBowerProviderConstant
|
||||
? currentPhoneSmsMinPriceValue
|
||||
: normalizePhoneSmsMinPriceValueSafe(latestState?.smsBowerMinPrice || '', smsBowerProviderConstant);
|
||||
const defaultFiveSimProduct = typeof DEFAULT_FIVE_SIM_PRODUCT !== 'undefined'
|
||||
? DEFAULT_FIVE_SIM_PRODUCT
|
||||
: 'openai';
|
||||
@@ -4912,6 +4929,34 @@ function collectSettingsPayload() {
|
||||
.map((country) => normalizeNexSmsCountryIdForPayload(country.id, -1))
|
||||
.filter((countryId) => countryId >= 0)
|
||||
: normalizeNexSmsCountryOrderForPayload(latestState?.nexSmsCountryOrder || []);
|
||||
const normalizeSmsBowerCountryIdForPayload = typeof normalizeSmsBowerCountryIdValue === 'function'
|
||||
? normalizeSmsBowerCountryIdValue
|
||||
: ((value, fallback = 6) => {
|
||||
const parsed = Math.floor(Number(value));
|
||||
return Number.isFinite(parsed) && parsed >= 0 ? parsed : fallback;
|
||||
});
|
||||
const normalizeSmsBowerCountryLabelForPayload = typeof normalizeSmsBowerCountryLabelValue === 'function'
|
||||
? normalizeSmsBowerCountryLabelValue
|
||||
: ((value = '', fallback = 'Indonesia') => String(value || '').trim() || fallback);
|
||||
const normalizeSmsBowerCountryOrderForPayload = typeof normalizeSmsBowerCountryOrderValue === 'function'
|
||||
? normalizeSmsBowerCountryOrderValue
|
||||
: ((value = []) => {
|
||||
const values = Array.isArray(value) ? value : [value];
|
||||
const mapped = values
|
||||
.map((entry) => normalizeSmsBowerCountryIdForPayload(entry && typeof entry === 'object' ? entry.id : entry, -1))
|
||||
.filter((entry) => entry >= 0);
|
||||
return mapped.length > 0
|
||||
? mapped.map((id) => ({ id, label: id === 6 ? 'Indonesia' : `Country #${id}` }))
|
||||
: [{ id: 6, label: 'Indonesia' }];
|
||||
});
|
||||
const smsBowerSelectedCountries = phoneSmsProviderValue === smsBowerProviderConstant && typeof getSelectedSmsBowerCountries === 'function'
|
||||
? getSelectedSmsBowerCountries()
|
||||
: normalizeSmsBowerCountryOrderForPayload(latestState?.smsBowerCountryOrder || []);
|
||||
const smsBowerCountry = smsBowerSelectedCountries[0] || {
|
||||
id: normalizeSmsBowerCountryIdForPayload(latestState?.smsBowerCountryId),
|
||||
label: normalizeSmsBowerCountryLabelForPayload(latestState?.smsBowerCountryLabel),
|
||||
};
|
||||
const smsBowerCountryOrderValue = smsBowerSelectedCountries.map((country) => country.id);
|
||||
const heroSmsCountryFallback = phoneSmsProviderValue === PHONE_SMS_PROVIDER_HERO_SMS
|
||||
? selectedPhoneSmsCountryFallback
|
||||
: normalizeHeroSmsCountryFallbackList(latestState?.heroSmsCountryFallback || []);
|
||||
@@ -5304,6 +5349,11 @@ function collectSettingsPayload() {
|
||||
nexSmsCountryOrder: nexSmsCountryOrderValue,
|
||||
nexSmsServiceCode: nexSmsServiceCodeValue,
|
||||
smsBowerApiKey: smsBowerApiKeyValue,
|
||||
smsBowerCountryId: smsBowerCountry.id,
|
||||
smsBowerCountryLabel: smsBowerCountry.label,
|
||||
smsBowerCountryOrder: smsBowerCountryOrderValue,
|
||||
smsBowerMinPrice: smsBowerMinPriceValue,
|
||||
smsBowerMaxPrice: smsBowerMaxPriceValue,
|
||||
madaoBaseUrl: maDaoBaseUrlValue,
|
||||
madaoHttpSecret: maDaoHttpSecretValue,
|
||||
madaoMode: maDaoModeValue,
|
||||
@@ -5544,6 +5594,9 @@ function normalizePhoneSmsMaxPriceValue(value = '', provider = getSelectedPhoneS
|
||||
if (normalizedProvider === PHONE_SMS_PROVIDER_MADAO) {
|
||||
return normalizeMaDaoPriceValue(value);
|
||||
}
|
||||
if (normalizedProvider === PHONE_SMS_PROVIDER_SMS_BOWER && typeof window !== 'undefined' && window.PhoneSmsBowerProvider?.normalizeSmsBowerMaxPrice) {
|
||||
return window.PhoneSmsBowerProvider.normalizeSmsBowerMaxPrice(value);
|
||||
}
|
||||
return normalizeHeroSmsMaxPriceValue(value);
|
||||
}
|
||||
|
||||
@@ -5555,9 +5608,54 @@ function normalizePhoneSmsMinPriceValue(value = '', provider = getSelectedPhoneS
|
||||
if (normalizedProvider === PHONE_SMS_PROVIDER_MADAO) {
|
||||
return normalizeMaDaoPriceValue(value);
|
||||
}
|
||||
if (normalizedProvider === PHONE_SMS_PROVIDER_SMS_BOWER && typeof window !== 'undefined' && window.PhoneSmsBowerProvider?.normalizeSmsBowerMaxPrice) {
|
||||
return window.PhoneSmsBowerProvider.normalizeSmsBowerMaxPrice(value);
|
||||
}
|
||||
return normalizeHeroSmsMaxPriceValue(value);
|
||||
}
|
||||
|
||||
function normalizeSmsBowerCountryIdValue(value, fallback = 6) {
|
||||
if (typeof window !== 'undefined' && window.PhoneSmsBowerProvider?.normalizeSmsBowerCountryId) {
|
||||
return window.PhoneSmsBowerProvider.normalizeSmsBowerCountryId(value, fallback);
|
||||
}
|
||||
const parsed = Math.floor(Number(value));
|
||||
if (Number.isFinite(parsed) && parsed >= 0) {
|
||||
return parsed;
|
||||
}
|
||||
const fallbackParsed = Math.floor(Number(fallback));
|
||||
return Number.isFinite(fallbackParsed) && fallbackParsed >= 0 ? fallbackParsed : 6;
|
||||
}
|
||||
|
||||
function normalizeSmsBowerCountryLabelValue(value = '', fallback = 'Indonesia') {
|
||||
if (typeof window !== 'undefined' && window.PhoneSmsBowerProvider?.normalizeSmsBowerCountryLabel) {
|
||||
return window.PhoneSmsBowerProvider.normalizeSmsBowerCountryLabel(value, fallback);
|
||||
}
|
||||
return String(value || '').trim() || fallback;
|
||||
}
|
||||
|
||||
function normalizeSmsBowerCountryOrderValue(value = []) {
|
||||
const source = Array.isArray(value)
|
||||
? value
|
||||
: String(value || '').split(/[\r\n,,;;]+/).map((entry) => String(entry || '').trim()).filter(Boolean);
|
||||
const seen = new Set();
|
||||
const normalized = [];
|
||||
source.forEach((entry) => {
|
||||
const rawId = entry && typeof entry === 'object' && !Array.isArray(entry)
|
||||
? (entry.id ?? entry.countryId)
|
||||
: String(entry || '').trim().match(/^(\d+)/)?.[1];
|
||||
const id = normalizeSmsBowerCountryIdValue(rawId, -1);
|
||||
if (id < 0 || seen.has(id)) {
|
||||
return;
|
||||
}
|
||||
seen.add(id);
|
||||
const rawLabel = entry && typeof entry === 'object' && !Array.isArray(entry)
|
||||
? (entry.label ?? entry.countryLabel)
|
||||
: String(entry || '').trim().replace(/^\d+\s*(?:[:|/-]\s*)?/, '');
|
||||
normalized.push({ id, label: normalizeSmsBowerCountryLabelValue(rawLabel, id === 6 ? 'Indonesia' : `Country #${id}`) });
|
||||
});
|
||||
return normalized;
|
||||
}
|
||||
|
||||
function getPhoneSmsProviderCount() {
|
||||
const rootScope = typeof window !== 'undefined' ? window : globalThis;
|
||||
const registryIds = rootScope.PhoneSmsProviderRegistry?.getProviderIds?.();
|
||||
@@ -7624,6 +7722,27 @@ function getSelectedNexSmsCountries() {
|
||||
});
|
||||
}
|
||||
|
||||
function getSelectedSmsBowerCountries() {
|
||||
const selected = Array.from(selectSmsBowerCountry?.options || [])
|
||||
.filter((option) => option.selected)
|
||||
.map((option) => ({
|
||||
id: normalizeSmsBowerCountryIdValue(option.value, -1),
|
||||
label: normalizeSmsBowerCountryLabelValue(option.textContent, `Country #${option.value}`),
|
||||
}))
|
||||
.filter((country) => country.id >= 0);
|
||||
return selected.length ? selected : [{ id: 6, label: 'Indonesia' }];
|
||||
}
|
||||
|
||||
function renderSmsBowerCountryFallbackOrder(countries = getSelectedSmsBowerCountries()) {
|
||||
if (!displaySmsBowerCountryFallbackOrder) {
|
||||
return;
|
||||
}
|
||||
const normalized = normalizeSmsBowerCountryOrderValue(countries);
|
||||
displaySmsBowerCountryFallbackOrder.textContent = normalized.length
|
||||
? normalized.map((country, index) => `${index + 1}. ${country.label}(${country.id})`).join(' → ')
|
||||
: 'Indonesia #6';
|
||||
}
|
||||
|
||||
function updateHeroSmsPlatformDisplay() {
|
||||
if (!displayHeroSmsPlatform) {
|
||||
return;
|
||||
@@ -7633,9 +7752,11 @@ function updateHeroSmsPlatformDisplay() {
|
||||
? (getSelectedFiveSimCountries()[0] || { id: DEFAULT_FIVE_SIM_COUNTRY_ID, label: DEFAULT_FIVE_SIM_COUNTRY_LABEL })
|
||||
: (provider === PHONE_SMS_PROVIDER_NEXSMS
|
||||
? (getSelectedNexSmsCountries()[0] || { id: DEFAULT_NEX_SMS_COUNTRY_ORDER[0], label: `Country #${DEFAULT_NEX_SMS_COUNTRY_ORDER[0]}` })
|
||||
: (provider === PHONE_SMS_PROVIDER_MADAO
|
||||
? { id: '', label: normalizeMaDaoModeValue(selectMaDaoMode?.value || latestState?.madaoMode) === MADAO_MODE_DIRECT ? 'direct' : getSelectedMaDaoRoutingPlanLabel() }
|
||||
: getSelectedHeroSmsCountryOption()));
|
||||
: (provider === PHONE_SMS_PROVIDER_SMS_BOWER
|
||||
? (getSelectedSmsBowerCountries()[0] || { id: 6, label: 'Indonesia' })
|
||||
: (provider === PHONE_SMS_PROVIDER_MADAO
|
||||
? { id: '', label: normalizeMaDaoModeValue(selectMaDaoMode?.value || latestState?.madaoMode) === MADAO_MODE_DIRECT ? 'direct' : getSelectedMaDaoRoutingPlanLabel() }
|
||||
: getSelectedHeroSmsCountryOption())));
|
||||
const countryText = selected?.label ? ` / ${selected.label}` : '';
|
||||
displayHeroSmsPlatform.textContent = `${getPhoneSmsProviderLabel(provider)} / OpenAI${countryText}`;
|
||||
if (inputHeroSmsApiKey) {
|
||||
@@ -12419,6 +12540,22 @@ function applySettingsState(state) {
|
||||
? normalizeNexSmsServiceCodeValue(state?.nexSmsServiceCode || defaultNexSmsServiceCode)
|
||||
: String(state?.nexSmsServiceCode || defaultNexSmsServiceCode).trim().toLowerCase().replace(/[^a-z0-9_-]+/g, '') || defaultNexSmsServiceCode;
|
||||
}
|
||||
if (typeof inputSmsBowerApiKey !== 'undefined' && inputSmsBowerApiKey) {
|
||||
inputSmsBowerApiKey.value = String(state?.smsBowerApiKey || '');
|
||||
}
|
||||
if (typeof selectSmsBowerCountry !== 'undefined' && selectSmsBowerCountry) {
|
||||
const selectedIds = new Set(
|
||||
normalizeSmsBowerCountryOrderValue(state?.smsBowerCountryOrder || [state?.smsBowerCountryId || 6])
|
||||
.map((country) => String(country.id))
|
||||
);
|
||||
if (!selectedIds.size) {
|
||||
selectedIds.add('6');
|
||||
}
|
||||
Array.from(selectSmsBowerCountry.options || []).forEach((option) => {
|
||||
option.selected = selectedIds.has(String(option.value));
|
||||
});
|
||||
renderSmsBowerCountryFallbackOrder();
|
||||
}
|
||||
if (typeof inputMaDaoBaseUrl !== 'undefined' && inputMaDaoBaseUrl) {
|
||||
inputMaDaoBaseUrl.value = normalizeMaDaoBaseUrlValue(state?.madaoBaseUrl);
|
||||
}
|
||||
@@ -12474,15 +12611,22 @@ function applySettingsState(state) {
|
||||
if (typeof selectHeroSmsOperator !== 'undefined' && selectHeroSmsOperator) {
|
||||
setHeroSmsOperatorSelectValue(state?.heroSmsOperator);
|
||||
}
|
||||
const smsBowerProviderConstant = typeof PHONE_SMS_PROVIDER_SMS_BOWER !== 'undefined'
|
||||
? PHONE_SMS_PROVIDER_SMS_BOWER
|
||||
: 'sms-bower';
|
||||
if (inputHeroSmsMaxPrice) {
|
||||
inputHeroSmsMaxPrice.value = restoredPhoneSmsProvider === PHONE_SMS_PROVIDER_FIVE_SIM
|
||||
? normalizeFiveSimMaxPriceValue(state?.fiveSimMaxPrice || '')
|
||||
: normalizeHeroSmsMaxPriceValue(state?.heroSmsMaxPrice || '');
|
||||
: (restoredPhoneSmsProvider === smsBowerProviderConstant
|
||||
? normalizePhoneSmsMaxPriceValue(state?.smsBowerMaxPrice || '', smsBowerProviderConstant)
|
||||
: normalizeHeroSmsMaxPriceValue(state?.heroSmsMaxPrice || ''));
|
||||
}
|
||||
if (typeof inputHeroSmsMinPrice !== 'undefined' && inputHeroSmsMinPrice) {
|
||||
inputHeroSmsMinPrice.value = restoredPhoneSmsProvider === PHONE_SMS_PROVIDER_FIVE_SIM
|
||||
? normalizePhoneSmsMinPriceValue(state?.fiveSimMinPrice || '', PHONE_SMS_PROVIDER_FIVE_SIM)
|
||||
: normalizePhoneSmsMinPriceValue(state?.heroSmsMinPrice || '', restoredPhoneSmsProvider);
|
||||
: (restoredPhoneSmsProvider === smsBowerProviderConstant
|
||||
? normalizePhoneSmsMinPriceValue(state?.smsBowerMinPrice || '', smsBowerProviderConstant)
|
||||
: normalizePhoneSmsMinPriceValue(state?.heroSmsMinPrice || '', restoredPhoneSmsProvider));
|
||||
}
|
||||
if (inputFiveSimOperator) {
|
||||
inputFiveSimOperator.value = normalizeFiveSimOperator(state?.fiveSimOperator);
|
||||
@@ -17735,6 +17879,23 @@ function buildPhoneSmsProviderStatePatch(provider = getSelectedPhoneSmsProvider(
|
||||
nexSmsServiceCode: normalizeNexSmsServiceCodeValue(inputNexSmsServiceCode?.value || latestState?.nexSmsServiceCode || DEFAULT_NEX_SMS_SERVICE_CODE),
|
||||
};
|
||||
}
|
||||
if (normalizedProvider === PHONE_SMS_PROVIDER_SMS_BOWER) {
|
||||
const smsBowerCountries = typeof getSelectedSmsBowerCountries === 'function'
|
||||
? getSelectedSmsBowerCountries()
|
||||
: normalizeSmsBowerCountryOrderValue(latestState?.smsBowerCountryOrder || []);
|
||||
const currentPrimary = smsBowerCountries[0] || {
|
||||
id: normalizeSmsBowerCountryIdValue(latestState?.smsBowerCountryId || 6),
|
||||
label: normalizeSmsBowerCountryLabelValue(latestState?.smsBowerCountryLabel || 'Indonesia'),
|
||||
};
|
||||
return {
|
||||
smsBowerApiKey: String(inputSmsBowerApiKey?.value || ''),
|
||||
smsBowerCountryId: currentPrimary.id,
|
||||
smsBowerCountryLabel: currentPrimary.label,
|
||||
smsBowerCountryOrder: smsBowerCountries.map((country) => country.id),
|
||||
smsBowerMinPrice: normalizePhoneSmsMinPriceValue(inputHeroSmsMinPrice?.value || '', PHONE_SMS_PROVIDER_SMS_BOWER),
|
||||
smsBowerMaxPrice: normalizePhoneSmsMaxPriceValue(inputHeroSmsMaxPrice?.value || '', PHONE_SMS_PROVIDER_SMS_BOWER),
|
||||
};
|
||||
}
|
||||
if (normalizedProvider === PHONE_SMS_PROVIDER_MADAO) {
|
||||
const maDaoMode = normalizeMaDaoModeValue(selectMaDaoMode?.value || latestState?.madaoMode);
|
||||
const maDaoDirectModeValue = typeof MADAO_MODE_DIRECT !== 'undefined'
|
||||
@@ -17801,6 +17962,17 @@ function applyPhoneSmsProviderFieldsToInputs(provider = getSelectedPhoneSmsProvi
|
||||
if (typeof inputSmsBowerApiKey !== 'undefined' && inputSmsBowerApiKey) {
|
||||
inputSmsBowerApiKey.value = String(state?.smsBowerApiKey || '');
|
||||
}
|
||||
if (typeof selectSmsBowerCountry !== 'undefined' && selectSmsBowerCountry) {
|
||||
const selectedIds = new Set(
|
||||
normalizeSmsBowerCountryOrderValue(state?.smsBowerCountryOrder || [state?.smsBowerCountryId || 6])
|
||||
.map((country) => String(country.id))
|
||||
);
|
||||
if (!selectedIds.size) selectedIds.add('6');
|
||||
Array.from(selectSmsBowerCountry.options || []).forEach((option) => {
|
||||
option.selected = selectedIds.has(String(option.value));
|
||||
});
|
||||
renderSmsBowerCountryFallbackOrder();
|
||||
}
|
||||
if (typeof inputMaDaoBaseUrl !== 'undefined' && inputMaDaoBaseUrl) {
|
||||
inputMaDaoBaseUrl.value = normalizeMaDaoBaseUrlValue(state?.madaoBaseUrl);
|
||||
}
|
||||
@@ -17841,12 +18013,16 @@ function applyPhoneSmsProviderFieldsToInputs(provider = getSelectedPhoneSmsProvi
|
||||
if (inputHeroSmsMaxPrice) {
|
||||
inputHeroSmsMaxPrice.value = normalizedProvider === PHONE_SMS_PROVIDER_FIVE_SIM
|
||||
? normalizeFiveSimMaxPriceValue(state?.fiveSimMaxPrice || '')
|
||||
: normalizeHeroSmsMaxPriceValue(state?.heroSmsMaxPrice || '');
|
||||
: (normalizedProvider === PHONE_SMS_PROVIDER_SMS_BOWER
|
||||
? normalizePhoneSmsMaxPriceValue(state?.smsBowerMaxPrice || '', PHONE_SMS_PROVIDER_SMS_BOWER)
|
||||
: normalizeHeroSmsMaxPriceValue(state?.heroSmsMaxPrice || ''));
|
||||
}
|
||||
if (typeof inputHeroSmsMinPrice !== 'undefined' && inputHeroSmsMinPrice) {
|
||||
inputHeroSmsMinPrice.value = normalizedProvider === PHONE_SMS_PROVIDER_FIVE_SIM
|
||||
? normalizePhoneSmsMinPriceValue(state?.fiveSimMinPrice || '', PHONE_SMS_PROVIDER_FIVE_SIM)
|
||||
: normalizePhoneSmsMinPriceValue(state?.heroSmsMinPrice || '', PHONE_SMS_PROVIDER_HERO_SMS);
|
||||
: (normalizedProvider === PHONE_SMS_PROVIDER_SMS_BOWER
|
||||
? normalizePhoneSmsMinPriceValue(state?.smsBowerMinPrice || '', PHONE_SMS_PROVIDER_SMS_BOWER)
|
||||
: normalizePhoneSmsMinPriceValue(state?.heroSmsMinPrice || '', PHONE_SMS_PROVIDER_HERO_SMS));
|
||||
}
|
||||
if (typeof inputHeroSmsPreferredPrice !== 'undefined' && inputHeroSmsPreferredPrice) {
|
||||
inputHeroSmsPreferredPrice.value = normalizeHeroSmsMaxPriceValue(state?.heroSmsPreferredPrice || '');
|
||||
@@ -18379,6 +18555,23 @@ selectNexSmsCountry?.addEventListener('change', () => {
|
||||
saveSettings({ silent: true }).catch(() => { });
|
||||
});
|
||||
|
||||
selectSmsBowerCountry?.addEventListener('change', () => {
|
||||
renderSmsBowerCountryFallbackOrder();
|
||||
updateHeroSmsPlatformDisplay();
|
||||
markSettingsDirty(true);
|
||||
saveSettings({ silent: true }).catch(() => { });
|
||||
});
|
||||
|
||||
btnSmsBowerCountryClear?.addEventListener('click', () => {
|
||||
Array.from(selectSmsBowerCountry?.options || []).forEach((option) => {
|
||||
option.selected = String(option.value) === '6';
|
||||
});
|
||||
renderSmsBowerCountryFallbackOrder();
|
||||
updateHeroSmsPlatformDisplay();
|
||||
markSettingsDirty(true);
|
||||
saveSettings({ silent: true }).catch(() => { });
|
||||
});
|
||||
|
||||
btnHeroSmsPricePreview?.addEventListener('click', async () => {
|
||||
try {
|
||||
await previewHeroSmsPriceTiers();
|
||||
|
||||
Reference in New Issue
Block a user