File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import { loadFragment } from '../fragment/fragment.js';
11
11
12
12
import renderAuthCombine from './renderAuthCombine.js' ;
13
13
import { renderAuthDropdown } from './renderAuthDropdown.js' ;
14
+ import { parseUrlHashTags , removeLink } from '../../scripts/hashTagParser.js' ;
14
15
15
16
// media query match that indicates mobile/tablet width
16
17
const isDesktop = window . matchMedia ( '(min-width: 900px)' ) ;
@@ -326,6 +327,20 @@ export default async function decorate(block) {
326
327
navWrapper . append ( nav ) ;
327
328
block . append ( navWrapper ) ;
328
329
330
+ parseUrlHashTags (
331
+ 'nav' ,
332
+ ( el , namespace , value ) => {
333
+ if ( namespace === 'display_for_' ) {
334
+ if ( value === 'desktop_only' && ! isDesktop . matches ) {
335
+ removeLink ( el ) ;
336
+ }
337
+ if ( value === 'mobile_only' && isDesktop . matches ) {
338
+ removeLink ( el ) ;
339
+ }
340
+ }
341
+ } ,
342
+ ) ;
343
+
329
344
renderAuthCombine (
330
345
navSections ,
331
346
( ) => ! isDesktop . matches && toggleMenu ( nav , navSections , false ) ,
Original file line number Diff line number Diff line change @@ -66,9 +66,10 @@ const updateTargetedBlocksVisibility = async () => {
66
66
parseUrlHashTags (
67
67
'main' ,
68
68
( el , namespace , value ) => {
69
+ const segments = activeRules . customerSegments . map ( ( s ) => s . name . toLowerCase ( ) ) ;
69
70
if ( value . startsWith ( 'segment' ) ) {
70
- const [ prefix , segmentToMatch ] = [ ...value . split ( '_' ) ] ;
71
- if ( ! activeRules . customerSegments . map ( ( segment ) => segment . name ) . includes ( segmentToMatch ) ) {
71
+ const [ _prefix , segment ] = [ ...value . split ( '_' ) ] ;
72
+ if ( ! segments . includes ( segment . toLowerCase ( ) ) ) {
72
73
hideLink ( el ) ;
73
74
} else {
74
75
showLink ( el ) ;
You can’t perform that action at this time.
0 commit comments