Skip to main content

Brand Kit Key Service

The Brand Kit Key Service manages caching brand kit key/value pairs into a dictionary held in memory. It's the deck or presentation's job to cache the brand kit dictionary in a script tag during the presentation render process. Access the dictionary with getBrandKitKeyValue, getBrandKitKeyDictionary and update with updateBrandKitKeyValue.

Methods​

getBrandKitKeyDictionary()​

Description​

  • Gets the brand kit key dictionary from the head of the presentation html document and caches it in memory for future retrieval.

Return Value: Object​

Code Example​

const dictionary = digideckCore.brandKitKeyService.getBrandKitKeyDictionary();

updateBrandKitKeyValue(brandKitKey, brandKitKeyValue)​

Description​

  • Updates a brand kit key value in the dictionary.

Return Value: null​

Options:​

  • brandKitKey: String The brand kit key to update.
  • brandKitKeyValue: Any The value to set for the brand kit key.

Code Example​

digideckCore.brandKitKeyService.updateBrandKitKeyValue('$b_primary_color', '#ff0000');

getBrandKitKeyValue(brandKitKey)​

Description​

  • Gets the value for a specific brand kit key from the dictionary.

Return Value: Any|undefined​

Options:​

  • brandKitKey: String The brand kit key to get the value for.

Code Example​

const value = digideckCore.brandKitKeyService.getBrandKitKeyValue('$b_primary_color');

convertBrandKitKeyValuesToKeysInComponentOptions(componentId, componentOptions)​

Description​

  • Converts brand kit key values back to their original keys in component options.

Return Value: Object​

Options:​

  • componentId: String The ID of the component.
  • componentOptions: Object The component options to convert.

Code Example​

const convertedOptions = digideckCore.brandKitKeyService.convertBrandKitKeyValuesToKeysInComponentOptions(componentId, componentOptions);

convertBrandKitKeyValueToKey(componentId, componentOptionKey, componentOptionValue)​

Description​

  • Converts a single brand kit key value back to its original key.

Return Value: Any​

Options:​

  • componentId: String The ID of the component.
  • componentOptionKey: String The component option key.
  • componentOptionValue: Any The component option value to convert.

Code Example​

const convertedValue = digideckCore.brandKitKeyService.convertBrandKitKeyValueToKey(componentId, 'background-color', '#ff0000');

convertBrandKitKeysToValuesInComponentOptions(componentOptions)​

Description​

  • Converts brand kit keys to their actual values in component options.

Return Value: Object​

Options:​

  • componentOptions: Object The component options to convert.

Code Example​

const convertedOptions = digideckCore.brandKitKeyService.convertBrandKitKeysToValuesInComponentOptions(componentOptions);