generated from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MWPW-138459 XLG Entitlement support (#1649)
Co-authored-by: aem-code-sync[bot] <43241697+aem-code-sync[bot]@users.noreply.github.com>
- Loading branch information
1 parent
dba63ec
commit 151457b
Showing
9 changed files
with
333 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { getConfig } from '../../utils/utils.js'; | ||
|
||
export const ENTITLEMENT_MAP = { | ||
'9565ef55-faad-430b-b661-596ba7a036c4': 'all-apps', | ||
'c8d50cc2-491e-48df-a1b0-1509f0ca7323': 'photoshop', | ||
'fd30e9c7-9ae9-44db-8e70-5c652a5bb1d2': 'cc-all-apps', | ||
}; | ||
|
||
const getEntitlements = (data) => { | ||
const { entitlements = {} } = getConfig(); | ||
const entitlementMap = { ...entitlements, ...ENTITLEMENT_MAP }; | ||
|
||
return data.flatMap((destination) => { | ||
const ents = destination.segments?.flatMap((segment) => { | ||
const entMatch = entitlementMap[segment.id]; | ||
return entMatch ? [entMatch] : []; | ||
}); | ||
|
||
return ents || []; | ||
}); | ||
}; | ||
|
||
export default function init(data) { | ||
return getEntitlements(data); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.