2 Segment Extension
This topic provides information on Segment Extension. For every application you can override following two properties
To evaluate segment there is respective function in <CHANNEL_ROOT_PATH>/extensions/override/extensions.js file
evaluateSegment function,
Arguments ( roles: [], defaultSegment : String
)
roles[] (array) will contain all the roles mapped to the user defaultSegment
(string) will contain system evaluated default segment
Return Value (String,)
,Should return string representing what is the segment for respective component
(possible values: ANON | CORPADMIN | RETAIL | CORP | ADMIN) Description,
If you want to change user type for your application, you can do so by implementing this function and return required user type for your application.
init function,
Description,
This function takes no argument and returns nothing.
Implement this function if you want to perform any initialization.
getCurrencyFormattingOptions function,
Arguments (currency: String )
currency (string) will contain currency code
Return Value (Object),
Should return an object with the format given in the description.Description,
If you want to override the default formatting for a currency, you can implement this function and return the object in the following format for that currency code passed.
{
style: "currency",
currency: currencyCode,
maximumFractionDigits: maximumFractionDigits,
minimumFractionDigits: minimumFractionDigits,
useGrouping: true
}You can refer the below link for more formatting options,
Note:
- If any component is present in
<CHANNEL_ROOT_PATH>/extensions/componentswill take precedence over the<CHANNEL_ROOT_PATH>/components. - All components available under component folder are available for the extension
- If menu.json is to be changed and other are not changed, irrespective of the change, all files/folders within the base role, for example json/retail need to be copied for new role even if one file is changed. This is because when you change the context, using evaluateContext function above, the root for JSON lookup changes, that is why all the JSON files are then looked up from whatever value is being returned from the evaluateContext method. So, all the JSON files need to be present in new directory.
How to create/modify menu for new Context
Basic structure of your menu file should be as follows
All your entries will go in array named as “default”
There are two types of entries
- Single Menu Option
- Nested Menu Option
Single Menu Option
Here you can specify following options
| name | Name of the component you want to load. |
| module | Module name of the component. |
Note:
Also add component specific configurations wherever required. Please refer out of the box “menu.json” for each segment. For example below entries are required for some specific components only.| applicationType (optional) | It is component specific configuration. |
| moduleURL (optional) | It is component specific configuration. |
| type (optional) | It is component specific configuration. |
Nested Menu Option
This option you can use to group related menus together.
Following JSON denotes 1 menu group
In above JSON
name is, key in resource bundle
icon is, name of icon from Redwood font. This icon will be the icon you want along with the name.
submenus [] will contain entries same as entry you will do for Single menu option
Sample menu.json
All menu in OBDX are user specific and available under <CHANNEL_PATH>framework/json/menu folder.
If implementor wants to override it so for it they have to make an entry in extension.json. Refer section 2 OBDX Component Extension.



