Skip to content

Add a global getter that references the AI Flag in studio #4276

@akolson

Description

@akolson

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.js getters
  • Name it isAIFeatureEnabled
  • Abstract the function’s internal implementation details of the AI flag storage.
    • Each user has a field name feature_flags that contains mapping called ai_feature that can be used to check for the status.
    • The currentUser can be obtained from the global session, state.session.currentUser
  • 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

  1. The global getter function, named isAIFeatureEnabled, is added to vuex/session/index.js getters
  2. The function returns the current status of the AI flag for a logged in user
  3. Unit tests for the global getter function are written to verify its correctness and behavior.

Resources

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions