File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,15 +13,22 @@ export class FaqPipe implements PipeTransform {
1313 const [ productId , cardDisplay ] = args ;
1414 if ( ! productId ) return value ?? '' ;
1515
16- const ruleRegex = / \$ r u l e : ( [ \d . ] + ) \$ / gm;
16+ const ruleRegex = / \$ r u l e : ( . * ) \$ / gm;
1717 value = value . replace ( ruleRegex , ( match , p1 ) => {
18+ const [ rule , locale , version ] = p1 . split ( ':' ) ;
1819 if ( ! productId ) return p1 ;
1920
2021 const rulesUrl = this . metaService . getRulesByProductId ( productId ) ;
2122 if ( ! rulesUrl ) return p1 ;
2223
23- return `<a href="${ rulesUrl } /#${ p1 } " target="_blank">${
24- cardDisplay || p1
24+ const url = new URL ( rulesUrl ) ;
25+ url . hash = rule ;
26+ url . searchParams . set ( 'product' , productId ) ;
27+ if ( locale ) url . searchParams . set ( 'locale' , locale ) ;
28+ if ( version ) url . searchParams . set ( 'version' , version ) ;
29+
30+ return `<a href="${ url . toString ( ) } " target="_blank">${
31+ cardDisplay || rule || p1
2532 } </a>`;
2633 } ) ;
2734
You can’t perform that action at this time.
0 commit comments