All checks were successful
Build and Deploy Front / deploy (push) Successful in 3m57s
Co-authored-by: Cursor <cursoragent@cursor.com>
25 lines
891 B
TypeScript
25 lines
891 B
TypeScript
/** 小迪受众:客户侧(查价/轨迹)vs 运营排障(指引、不调客户工具) */
|
||
export type EdiAdvisorAudience = 'customer' | 'ops';
|
||
|
||
/**
|
||
* 解析是否运营排障受众。
|
||
* - 显式 audience 优先
|
||
* - H5:`/h5/admin/**` → ops;其余 `/h5/**` → customer(避免未登录默认 User 门户误判)
|
||
* - 其余:非客户/代理门户 → ops
|
||
*/
|
||
export function resolveIsOpsAudience(options: {
|
||
audience?: EdiAdvisorAudience | null;
|
||
path: string;
|
||
isCustomerPortal: boolean;
|
||
isAgentPortal: boolean;
|
||
}): boolean {
|
||
if (options.audience === 'ops') return true;
|
||
if (options.audience === 'customer') return false;
|
||
|
||
const path = options.path || '';
|
||
if (path === '/h5/admin' || path.startsWith('/h5/admin/')) return true;
|
||
if (path === '/h5' || path.startsWith('/h5/')) return false;
|
||
|
||
return !options.isCustomerPortal && !options.isAgentPortal;
|
||
}
|