UNPKG

952 BJavaScriptView Raw
1import _ from 'lodash';
2
3export const DEFAULT_DECISION_TREE_VERSION = '1';
4
5export const IN_BROWSER = typeof window !== 'undefined';
6
7export const AGENT_ID_MAX_LENGTH = 36;
8export const AGENT_ID_ALLOWED_REGEXP = /^([a-z0-9_-]){1,36}$/i;
9
10export const TYPES = {
11 continuous: 'continuous',
12 enum: 'enum',
13 timezone: 'timezone',
14 time_of_day: 'time_of_day',
15 day_of_week: 'day_of_week',
16 day_of_month: 'day_of_month',
17 month_of_year: 'month_of_year'
18};
19
20export const TYPE_ANY = 'any';
21
22export const GENERATED_TIME_TYPES = [
23 TYPES.time_of_day,
24 TYPES.day_of_week,
25 TYPES.day_of_month,
26 TYPES.month_of_year
27];
28
29export const OPERATORS = {
30 IS: 'is',
31 IN: '[in[',
32 GTE: '>=',
33 LT: '<'
34};
35
36export const deprecation = _.memoize(((oldFunction, newFunction) =>
37 console.warn(`DEPRECATION WARNING: the '${oldFunction}' function of the craft ai client is deprecated. It will be removed in the future, '${newFunction}' should be used instead.`)
38));