Skip to main content

Brand Kit Component Registry Service

The Brand Kit Component Registry Service manages keeping a record in memory for what components are using a brand kit key. When a component gets a value that is a brand kit key, it should cache the componentId in a dictionary in which the key is the brand kit key and the value is an array of componentIds. That way, we can easily find all componentIds that are associated with a current brand kit key and update them.

Methods

getComponentsWithBrandKitKey(brandKitKey)

Description

  • Gets an array of component IDs that are using a specific brand kit key.

Return Value: Array<String>

Options:

  • brandKitKey: String The brand kit key to find components for.

Code Example

const componentIds = digideckCore.brandKitComponentRegistryService.getComponentsWithBrandKitKey('$b_primary_color');

addComponentToKeyRegistry(brandKitKey, componentId)

Description

  • Adds a component ID to the registry for a specific brand kit key. If the component is already registered, it will not be added again.

Return Value: null

Options:

  • brandKitKey: String The brand kit key to register the component for.
  • componentId: String The ID of the component to register.

Code Example

digideckCore.brandKitComponentRegistryService.addComponentToKeyRegistry('$b_primary_color', 'component-123');

removeComponentFromKeyRegistry(brandKitKey, componentId)

Description

  • Removes a component ID from the registry for a specific brand kit key.

Return Value: null

Options:

  • brandKitKey: String The brand kit key to remove the component from.
  • componentId: String The ID of the component to remove.

Code Example

digideckCore.brandKitComponentRegistryService.removeComponentFromKeyRegistry('$b_primary_color', 'component-123');