-
Notifications
You must be signed in to change notification settings - Fork 264
Closed
Labels
Description
Overview
To enhance code reusability and promote consistent access of the AI Flag status across various components, we need to create a global getter function. This function will provide a centralized way to retrieve the current status of the AI Flag without duplicating code or maintaining multiple instances of the flag. By adding this global getter, we ensure that all parts of the Studio access the AI Flag consistently, and this ultimately provides a direct way to check if a logged in user has access to the AI feature on the front-end in Studio.
Description and outcomes
- Add the global getter function to
vuex/session/index.jsgetters - Name it
isAIFeatureEnabled - Abstract the function’s internal implementation details of the AI flag storage.
- Each user has a field name
feature_flagsthat contains mapping calledai_featurethat can be used to check for the status. - The
currentUsercan be obtained from the global session,state.session.currentUser
- Each user has a field name
- Write tests to verify that the global getter function correctly retrieves the AI flag status, not forgetting the edge cases(e.g enabled and disabled statuses)
Accessibility requirements
Not applicable
Acceptance criteria
- The global getter function, named
isAIFeatureEnabled, is added tovuex/session/index.js getters - The function returns the current status of the AI flag for a logged in user
- Unit tests for the global getter function are written to verify its correctness and behavior.