import { keys , reduce } from 'ramda' ; import { CssModuleVariable } from '@ringcentral-integration/commons/modules/Brand' ; import { RcTheme } from '@ringcentral/juno' ; param value param theme returns export const getThemeValue = ( value , theme ) : string => { try { if ( typeof value === 'function' ) { const next = value ( { theme } ) ; return getThemeValue ( next , theme ) ; } return value ; } catch ( e ) { return '' ; } } ; param variable export const getCssVariableString = ( variable ) => `
--rc-blue: ${ variable . rcBlue };
--bigRed: ${ variable . bigRed };
--darkRed: ${ variable . darkRed };
--tomato: ${ variable . tomato };
--orange: ${ variable . orange };
--leaf: ${ variable . leaf };
--dark: ${ variable . dark };
--night: ${ variable . night };
--ash: ${ variable . ash };
--coin: ${ variable . coin };
--smoke: ${ variable . smoke };
--silver: ${ variable . silver };
--egg: ${ variable . egg };
--snow: ${ variable . snow };
--rc-orange: ${ variable . rcOrange };
--darkergray: ${ variable . darkergray };
--darkgray: ${ variable . darkgray };
--gray: ${ variable . gray };
--bggray: ${ variable . bggray };
--lightgray: ${ variable . lightgray };
--grey-light: ${ variable . greyLight };
--missed: ${ variable . missed };
--active: ${ variable . active };
--primary-color: ${ variable . primaryColor };
--primary-color-highlight: ${ variable . primaryColorHighlight };
--primary-color-highlight-solid: ${ variable . primaryColorHighlightSolid };
--line-panel-background-color: ${ variable . linePanelBackgroundColor };
--call-btn-color: ${ variable . callBtnColor };
--extension-background-color: ${ variable . extensionBackgroundColor };
--sms-bubble-background-color: ${ variable . smsBubbleBackgroundColor };
--brand-font-color: ${ variable . brandFontColor };
--brand-font-color-highlight: ${ variable . brandFontColorHighlight };
--jupiter-background-color: ${ variable . jupiterBackgroundColor };
${ '' }
--c2d-arrow-color: ${ variable . c2dArrowColor };
--add-meeting-btn-color: ${ variable . addMeetingBtnColor };
--add-meeting-btn-text-color: ${ variable . addMeetingBtnTextColor };
--ext-option-btn-color: ${ variable . extOptionBtnColor };` ; param variable param theme returns export const getThemeVariableValues = ( variable , theme ) => { return reduce ( ( acc , key ) => Object . assign ( acc , { [ key ] : getThemeValue ( variable [ key ] , theme ) } ) , { } as Record < keyof CssModuleVariable , string > , keys ( variable ) ) ; } ; param variable param theme returns export const getThemeVariableString = ( variable , theme ) => { const values = getThemeVariableValues ( variable , theme ) ; return getCssVariableString ( values ) ; } ;