Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
static getDeep(keys) {
if (typeof keys === 'string') {
keys = keys.split('.');
}
if (!Array.isArray(keys)) {
throw new Error('The argument must be a dot string or an string array.');
}
/** @type {?} */
const selector = createSelector([ConfigState_1], (/**
* @param {?} state
* @return {?}
*/
function (state) {
return ((/** @type {?} */ (keys))).reduce((/**
* @param {?} acc
* @param {?} val
* @return {?}
*/
(acc, val) => {
if (acc) {
return acc[val];
}
return undefined;
}), state);
}));
static getDeep(keys: string[] | string) {
if (typeof keys === 'string') {
keys = keys.split('.');
}
if (!Array.isArray(keys)) {
throw new Error('The argument must be a dot string or an string array.');
}
const selector = createSelector(
[ConfigState],
(state: Config.State) => {
return (keys as string[]).reduce((acc, val) => {
if (acc) {
return acc[val];
}
return undefined;
}, state);
},
);
return selector;
}
static getDeep(keys) {
if (typeof keys === 'string') {
keys = keys.split('.');
}
if (!Array.isArray(keys)) {
throw new Error('The argument must be a dot string or an string array.');
}
/** @type {?} */
const selector = createSelector([ConfigState_1], (/**
* @param {?} state
* @return {?}
*/
(state) => {
return ((/** @type {?} */ (keys))).reduce((/**
* @param {?} acc
* @param {?} val
* @return {?}
*/
(acc, val) => {
if (acc) {
return acc[val];
}
return undefined;
}), state);
}));
static getCurrent() {
return createSelector(
[QueueState],
(state: QueueStateModel): QueueStateModel => state
);
}
static getApiUrl(key) {
/** @type {?} */
const selector = createSelector([ConfigState_1], (/**
* @param {?} state
* @return {?}
*/
function (state) {
return state.environment.apis[key || 'default'].url;
}));
return selector;
}
/**
static getGrantedPolicy(key: string) {
const selector = createSelector(
[ConfigState],
(state: Config.State): boolean => {
if (!key) return true;
return snq(() => state.auth.grantedPolicies[key], false);
},
);
return selector;
}
static getSettings(keyword) {
/** @type {?} */
const selector = createSelector([ConfigState_1], (/**
* @param {?} state
* @return {?}
*/
(state) => {
if (keyword) {
/** @type {?} */
const keys = snq((/**
* @return {?}
*/
() => Object.keys(state.setting.values).filter((/**
* @param {?} key
* @return {?}
*/
key => key.indexOf(keyword) > -1))), []);
if (keys.length) {
return keys.reduce((/**
static getApiUrl(key) {
/** @type {?} */
const selector = createSelector([ConfigState_1], (/**
* @param {?} state
* @return {?}
*/
(state) => {
return state.environment.apis[key || 'default'].url;
}));
return selector;
}
/**
static getConversationById(id: string) {
return createSelector(
[ChatBoxState],
(state: ChatBoxStateModel) => {
return state.conversations.find(con => con.id === id);
},
);
}
static getSetting(key) {
/** @type {?} */
const selector = createSelector([ConfigState_1], (/**
* @param {?} state
* @return {?}
*/
(state) => {
return snq((/**
* @return {?}
*/
() => state.setting.values[key]));
}));
return selector;
}
/**