266 lines
7.3 KiB
TypeScript
266 lines
7.3 KiB
TypeScript
import boursecuLogo from '@/assets/img/boursemes_logofull.png'
|
|
import boursecuSplashLogo from '@/assets/img/boursemes-splash.png'
|
|
import boursecuLoginLogo from '@/assets/img/boursemes-login.png'
|
|
import boursecuTransactionsIcon from '@/assets/img/boursecu-transactions-icon.png'
|
|
import boursecuPhysicalReceiveIcon from '@/assets/img/boursecu-physical-receive-icon.png'
|
|
import boursecuConvertIcon from '@/assets/img/boursecu-convert-icon.png'
|
|
import boursecuWalletIcon from '@/assets/img/boursecu-wallet-icon.png'
|
|
import boursecuBuySellIcon from '@/assets/img/boursecu-buy-sell-icon.png'
|
|
import boursecuAssetsIcon from '@/assets/img/boursecu-assets-icon.png'
|
|
import boursecuHomeIcon from '@/assets/img/boursecu-home-icon.png'
|
|
import boursecuSettingsIcon from '@/assets/img/boursecu-settings-icon.png'
|
|
|
|
import { getConfig } from '@/config/app-config'
|
|
|
|
export function getConfigApp(key: string) {
|
|
return getConfig(key)
|
|
}
|
|
|
|
/** Login URL در اپ اصلی */
|
|
export function getLoginAppUrl() {
|
|
const fallback = 'https://app.boursemes.com/home'
|
|
let configured: unknown
|
|
|
|
try {
|
|
configured = useRuntimeConfig().public.loginAppUrl
|
|
} catch {
|
|
configured =
|
|
(import.meta as ImportMeta & { env?: Record<string, string> }).env?.NUXT_PUBLIC_LOGIN_APP_URL ||
|
|
(import.meta as ImportMeta & { env?: Record<string, string> }).env?.VITE_LOGIN_APP_URL
|
|
}
|
|
|
|
if (typeof configured !== 'string' || !configured.trim()) {
|
|
return fallback
|
|
}
|
|
|
|
return configured.trim()
|
|
}
|
|
|
|
/** صفحه Login اپ اصلی با فلگ نصب PWA */
|
|
export function getLoginInstallPwaUrl() {
|
|
try {
|
|
return `${getLoginAppOrigin()}/login?installPwa=true`
|
|
} catch {
|
|
return 'https://app.boursemes.com/login?installPwa=true'
|
|
}
|
|
}
|
|
|
|
/** صفحه Login اپ اصلی روی بخش ثبتنام */
|
|
export function getLoginRegisterUrl() {
|
|
try {
|
|
return `${getLoginAppOrigin()}/login?register=true`
|
|
} catch {
|
|
return 'https://app.boursemes.com/login?register=true'
|
|
}
|
|
}
|
|
|
|
function getLoginAppOrigin() {
|
|
const loginUrl = getLoginAppUrl()
|
|
return import.meta.client
|
|
? new URL(loginUrl, window.location.origin).origin
|
|
: new URL(loginUrl).origin
|
|
}
|
|
|
|
/** boursecu-only branch */
|
|
export function isBoursecuProject() {
|
|
return true
|
|
}
|
|
|
|
/** فقط برای سازگاری با منطق پشتیبانی modular — در boursecu همیشه false */
|
|
export function isBazretalaProject() {
|
|
return false
|
|
}
|
|
|
|
const WALLET_DEPOSIT_QUICK_AMOUNTS_RIAL = [10_000_000, 50_000_000, 100_000_000] as const
|
|
|
|
export function getWalletDepositQuickAmountsRial(): readonly number[] {
|
|
return WALLET_DEPOSIT_QUICK_AMOUNTS_RIAL
|
|
}
|
|
|
|
export function getBoursecuTransactionsIcon() {
|
|
return boursecuTransactionsIcon
|
|
}
|
|
|
|
export function getBoursecuPhysicalReceiveIcon() {
|
|
return boursecuPhysicalReceiveIcon
|
|
}
|
|
|
|
export function getBoursecuConvertIcon() {
|
|
return boursecuConvertIcon
|
|
}
|
|
|
|
export function getBoursecuWalletIcon() {
|
|
return boursecuWalletIcon
|
|
}
|
|
|
|
export function getBoursecuBuySellIcon() {
|
|
return boursecuBuySellIcon
|
|
}
|
|
|
|
export function getBoursecuAssetsIcon() {
|
|
return boursecuAssetsIcon
|
|
}
|
|
|
|
export function getBoursecuHomeIcon() {
|
|
return boursecuHomeIcon
|
|
}
|
|
|
|
export function getBoursecuSettingsIcon() {
|
|
return boursecuSettingsIcon
|
|
}
|
|
|
|
export function getBoursecuActionIconSrc(actionId: string): string | undefined {
|
|
const icons: Record<string, string> = {
|
|
buySell: boursecuBuySellIcon,
|
|
wallet: boursecuWalletIcon,
|
|
assets: boursecuAssetsIcon,
|
|
transactions: boursecuTransactionsIcon,
|
|
physicalReceive: boursecuPhysicalReceiveIcon,
|
|
convert: boursecuConvertIcon,
|
|
home: boursecuHomeIcon,
|
|
settings: boursecuSettingsIcon,
|
|
}
|
|
|
|
return icons[actionId]
|
|
}
|
|
|
|
export function hasCustomLoginLogoLayout() {
|
|
return true
|
|
}
|
|
|
|
export const BOURSECU_BRAND_RED = '#bc3c3b'
|
|
export const BOURSECU_BRAND_BLUE = '#2178b5'
|
|
export const BOURSECU_BRAND_NAV = '#133050'
|
|
export const BOURSECU_COPPER_BG = '#b87333'
|
|
export const BOURSECU_COPPER_BG_LIGHT = '#fdf0e6'
|
|
export const BOURSECU_COPPER_BG_GRADIENT = 'linear-gradient(135deg, #c98a4a 0%, #a86528 100%)'
|
|
|
|
export function getProjectBrandRed() {
|
|
return BOURSECU_BRAND_RED
|
|
}
|
|
|
|
/** رنگ accent تم از تنظیمات tenant */
|
|
export function getProjectPrimaryColor() {
|
|
const color = getConfigApp('color')
|
|
return color != null ? String(color) : undefined
|
|
}
|
|
|
|
export function getBoursecuChartColor() {
|
|
return BOURSECU_BRAND_BLUE
|
|
}
|
|
|
|
export function resolveProjectColor(color?: string | null) {
|
|
if (!color) {
|
|
return color
|
|
}
|
|
|
|
if (color === 'red' || color.startsWith('red-')) {
|
|
return BOURSECU_BRAND_RED
|
|
}
|
|
|
|
return color
|
|
}
|
|
|
|
export function getProjectDesktopLoginBrandLogo(_avatar?: string | null) {
|
|
return getProjectSplashLogo()
|
|
}
|
|
|
|
export function getProjectLoginLogo(_avatar?: string | null) {
|
|
return boursecuLoginLogo
|
|
}
|
|
|
|
export function getProjectSplashLogo(_avatar?: string | null) {
|
|
return boursecuSplashLogo
|
|
}
|
|
|
|
export function getProjectNavLogo(_avatar?: string | null) {
|
|
return boursecuLogo
|
|
}
|
|
|
|
export function getProjectMobileNavLogo(_avatar?: string | null) {
|
|
return boursecuLoginLogo
|
|
}
|
|
|
|
export function getProjectSupportPhone() {
|
|
return ''
|
|
}
|
|
|
|
export function getProjectSupportPhoneLink() {
|
|
return 'tel:'
|
|
}
|
|
|
|
export function getProjectBaleLink() {
|
|
return 'https://ble.ir/'
|
|
}
|
|
|
|
export function getProjectBaleContactLink() {
|
|
return getProjectBaleLink()
|
|
}
|
|
|
|
export function getProjectSupportContactLink() {
|
|
return getProjectSupportPhoneLink()
|
|
}
|
|
|
|
export function getProjectFundHeaderBackground(defaultBackground: string) {
|
|
return defaultBackground
|
|
}
|
|
|
|
export function getProjectFundEmptyImage(defaultImage: string) {
|
|
return defaultImage
|
|
}
|
|
|
|
export function getProjectFundEmptyText() {
|
|
return 'یک گنج جدید بساز!'
|
|
}
|
|
|
|
export function getProjectLoginTaglineLines() {
|
|
return ['مرجع هوشمند معاملات', ' و سرمایهگذاری در صنعت مس']
|
|
}
|
|
|
|
export function getProjectSplashBackground() {
|
|
return BOURSECU_BRAND_NAV
|
|
}
|
|
|
|
export function resetAppSurfaceBackground() {
|
|
if (!import.meta.client) return
|
|
const background = '#ffffff'
|
|
document.documentElement.style.backgroundColor = background
|
|
document.body.style.backgroundColor = background
|
|
|
|
const metaTheme = document.querySelector('meta[name="theme-color"]')
|
|
if (metaTheme) {
|
|
metaTheme.setAttribute('content', background)
|
|
}
|
|
}
|
|
|
|
export function getProjectFontFamily() {
|
|
return "'dana', sans-serif"
|
|
}
|
|
|
|
export function applyProjectFont() {
|
|
if (!import.meta.client) return
|
|
document.documentElement.style.setProperty('--App-font-family', getProjectFontFamily())
|
|
document.documentElement.classList.add('font-dana')
|
|
}
|
|
|
|
export function isTWA() {
|
|
if (!import.meta.client) return false
|
|
if (sessionStorage.getItem('appMode') === 'twa') return true
|
|
if (document.referrer.startsWith('android-app://')) {
|
|
sessionStorage.setItem('appMode', 'twa')
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
export function applyProjectTheme() {
|
|
if (!import.meta.client) return
|
|
applyProjectFont()
|
|
document.documentElement.classList.add('project-boursecu')
|
|
document.documentElement.style.setProperty('--App-brand-nav', BOURSECU_BRAND_NAV)
|
|
document.documentElement.style.setProperty('--App-brand-red', BOURSECU_BRAND_RED)
|
|
document.documentElement.style.setProperty('--App-brand-red-50', '#f8ecec')
|
|
document.documentElement.style.setProperty('--App-brand-red-100', '#f0d8d8')
|
|
document.documentElement.style.setProperty('--App-brand-red-700', '#963130')
|
|
}
|