@plusscommunities/pluss-core-web 1.7.3-beta.1 → 1.7.4-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components.js +37233 -474
- package/dist/components.js.map +1 -1
- package/dist/index.js +37233 -474
- package/dist/index.js.map +1 -1
- package/package.json +22 -31
- package/.babelrc +0 -3
- package/dist/index.cjs.js +0 -10388
- package/dist/index.esm.js +0 -10349
- package/dist/index.umd.js +0 -10361
- package/rollup.config.js +0 -57
- package/src/actions/AuthActions.js +0 -83
- package/src/actions/LocalActions.js +0 -8
- package/src/actions/NavActions.js +0 -8
- package/src/actions/ScheduledActionsActions.js +0 -8
- package/src/actions/TemplateActions.js +0 -15
- package/src/actions/UsersActions.js +0 -95
- package/src/actions/index.js +0 -6
- package/src/actions/types.js +0 -23
- package/src/analytics.js +0 -183
- package/src/apis/analyticsActions.js +0 -53
- package/src/apis/authActions.js +0 -58
- package/src/apis/fileActions.js +0 -152
- package/src/apis/index.js +0 -10
- package/src/apis/profileActions.js +0 -133
- package/src/apis/scheduledActionsActions.js +0 -12
- package/src/apis/stringActions.js +0 -25
- package/src/apis/templateActions.js +0 -41
- package/src/apis/typeActions.js +0 -186
- package/src/apis/userActions.js +0 -169
- package/src/apis/utilityActions.js +0 -35
- package/src/colours.js +0 -134
- package/src/components/AddButton.js +0 -27
- package/src/components/AnalyticsFilter.js +0 -115
- package/src/components/Attachment.js +0 -27
- package/src/components/AudienceIncluder.js +0 -175
- package/src/components/AudienceSelector.js +0 -700
- package/src/components/Button.js +0 -66
- package/src/components/CheckBox.js +0 -77
- package/src/components/ColourOptions.js +0 -197
- package/src/components/ColourPicker.js +0 -267
- package/src/components/Comment.js +0 -46
- package/src/components/CommentSection.js +0 -116
- package/src/components/DatePicker.js +0 -290
- package/src/components/DropdownInput.js +0 -223
- package/src/components/DurationInput.js +0 -51
- package/src/components/ExportCsvPopup.js +0 -222
- package/src/components/FileInput.js +0 -389
- package/src/components/GenericInput.js +0 -169
- package/src/components/Header.js +0 -82
- package/src/components/HubSidebar.js +0 -134
- package/src/components/ImageInput.js +0 -987
- package/src/components/InputGroup.js +0 -18
- package/src/components/MakerPopup.js +0 -310
- package/src/components/MoreMenu.js +0 -22
- package/src/components/OptionsSection.js +0 -84
- package/src/components/OverlayPage.js +0 -74
- package/src/components/OverlayPageBottomButtons.js +0 -48
- package/src/components/OverlayPageContents.js +0 -48
- package/src/components/OverlayPageSection.js +0 -38
- package/src/components/P60Icon.js +0 -40
- package/src/components/PageTitle.js +0 -13
- package/src/components/Popup.js +0 -104
- package/src/components/ProfilePic.js +0 -50
- package/src/components/RadioButton.js +0 -144
- package/src/components/Reactions.js +0 -77
- package/src/components/SVGIcon.js +0 -33
- package/src/components/SideNavItem.js +0 -98
- package/src/components/StatBox.js +0 -49
- package/src/components/StatusButton.js +0 -22
- package/src/components/SuccessPopup.js +0 -57
- package/src/components/Tabs.js +0 -56
- package/src/components/Tag.js +0 -62
- package/src/components/Text.js +0 -20
- package/src/components/TextFormatPopup.js +0 -54
- package/src/components/TimePicker.js +0 -225
- package/src/components/UserListing.js +0 -111
- package/src/components/index.js +0 -46
- package/src/components/svg-icons.json +0 -821
- package/src/config.js +0 -25
- package/src/helper/HelpDeskWidget.js +0 -16
- package/src/helper/api/getUrl.js +0 -15
- package/src/helper/api/getUrlParams.js +0 -9
- package/src/helper/api/safeReadParams.js +0 -6
- package/src/helper/auth/getUserFromState.js +0 -8
- package/src/helper/colours/getAppColourFromState.js +0 -10
- package/src/helper/files/canvasImageUploader.js +0 -159
- package/src/helper/files/generateImageName.js +0 -10
- package/src/helper/files/get1400.js +0 -32
- package/src/helper/files/getExtension.js +0 -9
- package/src/helper/files/getFileName.js +0 -13
- package/src/helper/files/getThumb300.js +0 -36
- package/src/helper/files/isVideo.js +0 -8
- package/src/helper/helper.js +0 -97
- package/src/helper/index.js +0 -44
- package/src/helper/site/getMerchantsFromState.js +0 -9
- package/src/helper/site/getSiteLevelFromState.js +0 -34
- package/src/helper/site/getSiteName.js +0 -16
- package/src/helper/site/getSiteNameFromRoles.js +0 -12
- package/src/helper/site/getSiteSettingFromState.js +0 -10
- package/src/helper/storage/readJSONFromStorage.js +0 -9
- package/src/helper/storage/readStorageWithCookie.js +0 -22
- package/src/helper/storage/setLocalStorage.js +0 -5
- package/src/helper/strings/getFirstName.js +0 -10
- package/src/helper/strings/htmlDecode.js +0 -4
- package/src/helper/strings/htmlEncode.js +0 -4
- package/src/helper/strings/isEmail.js +0 -11
- package/src/helper/strings/isUrl.js +0 -13
- package/src/helper/strings/onlyAlphanumeric.js +0 -8
- package/src/helper/strings/randomString.js +0 -10
- package/src/helper/strings/toParagraphed.js +0 -17
- package/src/index.js +0 -12
- package/src/reducers/ScheduledActionsReducer.js +0 -14
- package/src/reducers/TemplatesReducer.js +0 -29
- package/src/reducers/index.js +0 -7
- package/src/session.js +0 -289
- package/src/urls.js +0 -21
package/rollup.config.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import styles from 'rollup-plugin-styles';
|
|
2
|
-
const autoprefixer = require('autoprefixer');
|
|
3
|
-
import babel from '@rollup/plugin-babel';
|
|
4
|
-
import json from '@rollup/plugin-json';
|
|
5
|
-
import localResolve from 'rollup-plugin-local-resolve';
|
|
6
|
-
|
|
7
|
-
// the entry point for the library
|
|
8
|
-
const input = 'src/index.js';
|
|
9
|
-
|
|
10
|
-
var MODE = [
|
|
11
|
-
{
|
|
12
|
-
fomart: 'cjs',
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
fomart: 'esm',
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
fomart: 'umd',
|
|
19
|
-
},
|
|
20
|
-
];
|
|
21
|
-
|
|
22
|
-
var config = [];
|
|
23
|
-
|
|
24
|
-
MODE.map((m) => {
|
|
25
|
-
var conf = {
|
|
26
|
-
input: input,
|
|
27
|
-
output: {
|
|
28
|
-
// then name of your package
|
|
29
|
-
name: '@plusscommunities/pluss-core-web',
|
|
30
|
-
file: `dist/index.${m.fomart}.js`,
|
|
31
|
-
format: m.fomart,
|
|
32
|
-
exports: 'auto',
|
|
33
|
-
},
|
|
34
|
-
// this externelizes react to prevent rollup from compiling it
|
|
35
|
-
external: ['react', /@babel\/runtime/],
|
|
36
|
-
plugins: [
|
|
37
|
-
// these are babel comfigurations
|
|
38
|
-
babel({
|
|
39
|
-
exclude: 'node_modules/**',
|
|
40
|
-
presets: ['@babel/preset-react', '@babel/preset-env'],
|
|
41
|
-
plugins: ['@babel/transform-runtime'],
|
|
42
|
-
babelHelpers: 'runtime',
|
|
43
|
-
}),
|
|
44
|
-
// this adds support for styles
|
|
45
|
-
styles({
|
|
46
|
-
postcss: {
|
|
47
|
-
plugins: [autoprefixer()],
|
|
48
|
-
},
|
|
49
|
-
}),
|
|
50
|
-
json(),
|
|
51
|
-
localResolve(),
|
|
52
|
-
],
|
|
53
|
-
};
|
|
54
|
-
config.push(conf);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
export default [...config];
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { SET_AUTH, CHANGE_SITE, UPDATE_PROFILE, LOGOUT } from './types';
|
|
2
|
-
// import { getEnabledFeatures } from '../session';
|
|
3
|
-
// import { authActions, typeActions } from '../apis';
|
|
4
|
-
|
|
5
|
-
// export const refreshAuthUser = (site) => {
|
|
6
|
-
// return (dispatch) => {
|
|
7
|
-
// const promises = [];
|
|
8
|
-
// promises.push(authActions.getUserSignin());
|
|
9
|
-
// promises.push(typeActions.getSite(site));
|
|
10
|
-
// promises.push(typeActions.getInterfaces(site));
|
|
11
|
-
|
|
12
|
-
// Promise.all(promises).then((res) => {
|
|
13
|
-
// const userRes = res[0].data;
|
|
14
|
-
// const siteSettingsRes = res[1].data;
|
|
15
|
-
// const interfaces = res[2].data;
|
|
16
|
-
// console.log(siteSettingsRes);
|
|
17
|
-
// dispatch({
|
|
18
|
-
// type: SET_AUTH,
|
|
19
|
-
// payload: {
|
|
20
|
-
// user: { ...userRes, uid: userRes.Id },
|
|
21
|
-
// features: getEnabledFeatures(siteSettingsRes, interfaces),
|
|
22
|
-
// hidden: [...(siteSettingsRes.Hidden || [])],
|
|
23
|
-
// siteSettings: { ...(siteSettingsRes.Settings || {}) },
|
|
24
|
-
// siteBranding: { ...(siteSettingsRes.Branding || {}) },
|
|
25
|
-
// },
|
|
26
|
-
// });
|
|
27
|
-
// });
|
|
28
|
-
// };
|
|
29
|
-
// };
|
|
30
|
-
|
|
31
|
-
export const setAuth = (stuff) => {
|
|
32
|
-
return {
|
|
33
|
-
type: SET_AUTH,
|
|
34
|
-
payload: stuff,
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export const setAuthUser = (auth, user, site) => {
|
|
39
|
-
return (dispatch) => {
|
|
40
|
-
if (!auth && !user && !site) {
|
|
41
|
-
dispatch({
|
|
42
|
-
type: LOGOUT,
|
|
43
|
-
payload: null,
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
dispatch({
|
|
47
|
-
type: SET_AUTH,
|
|
48
|
-
payload: {
|
|
49
|
-
auth,
|
|
50
|
-
user,
|
|
51
|
-
site,
|
|
52
|
-
originalSite: site,
|
|
53
|
-
},
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export const setRemember = (chooken) => {
|
|
59
|
-
return {
|
|
60
|
-
type: SET_AUTH,
|
|
61
|
-
payload: {
|
|
62
|
-
chooken,
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
export const setAuthLocation = (site) => {
|
|
68
|
-
console.log('setting auth location');
|
|
69
|
-
console.log(site);
|
|
70
|
-
return {
|
|
71
|
-
type: CHANGE_SITE,
|
|
72
|
-
payload: {
|
|
73
|
-
site,
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
export const updateProfile = (changes) => {
|
|
79
|
-
return {
|
|
80
|
-
type: UPDATE_PROFILE,
|
|
81
|
-
payload: changes,
|
|
82
|
-
};
|
|
83
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { TEMPLATES_LOADED, TEMPLATE_REMOVED } from './types';
|
|
2
|
-
|
|
3
|
-
export const templatesLoaded = (template) => {
|
|
4
|
-
return {
|
|
5
|
-
type: TEMPLATES_LOADED,
|
|
6
|
-
payload: template,
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const removeTemplate = (id) => {
|
|
11
|
-
return {
|
|
12
|
-
type: TEMPLATE_REMOVED,
|
|
13
|
-
payload: id,
|
|
14
|
-
};
|
|
15
|
-
};
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
import {
|
|
3
|
-
USERS_LOADED,
|
|
4
|
-
USER_REMOVED,
|
|
5
|
-
USERS_PURGE,
|
|
6
|
-
USERS_LOADING,
|
|
7
|
-
USERS_RESIDENT_COUNT_SET,
|
|
8
|
-
INVITE_CODES_LOADED,
|
|
9
|
-
INVITE_CODE_UPDATED,
|
|
10
|
-
INVITE_CODE_REMOVED,
|
|
11
|
-
} from './types';
|
|
12
|
-
import { userActions } from '../apis';
|
|
13
|
-
import { readStorageWithCookie } from '../helper';
|
|
14
|
-
|
|
15
|
-
export const usersUpdate = (site) => {
|
|
16
|
-
return (dispatch) => {
|
|
17
|
-
userActions.fetchUsers(site).then((res) => {
|
|
18
|
-
if (res.userFetchFail) {
|
|
19
|
-
} else {
|
|
20
|
-
const currentSite = readStorageWithCookie('site');
|
|
21
|
-
if (res.data != null && !_.isEmpty(res.data.results.Items) && res.data.results.Items[0].site === currentSite) {
|
|
22
|
-
const users = res.data.results.Items;
|
|
23
|
-
const allList = [];
|
|
24
|
-
Object.keys(users).forEach((userId) => {
|
|
25
|
-
allList.push({ ...users[userId], id: userId });
|
|
26
|
-
});
|
|
27
|
-
dispatch({
|
|
28
|
-
type: USERS_LOADED,
|
|
29
|
-
payload: allList,
|
|
30
|
-
});
|
|
31
|
-
} else {
|
|
32
|
-
dispatch({
|
|
33
|
-
type: USERS_LOADED,
|
|
34
|
-
payload: [],
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export const getUserCount = (site) => {
|
|
43
|
-
return (dispatch) => {
|
|
44
|
-
dispatch({
|
|
45
|
-
type: USERS_LOADING,
|
|
46
|
-
});
|
|
47
|
-
userActions.getSiteResidentsCount(site).then((res) => {
|
|
48
|
-
dispatch({
|
|
49
|
-
type: USERS_RESIDENT_COUNT_SET,
|
|
50
|
-
payload: res.data.results,
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export const usersLoaded = (events) => {
|
|
57
|
-
return {
|
|
58
|
-
type: USERS_LOADED,
|
|
59
|
-
payload: events,
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export const userKey = (id) => {
|
|
64
|
-
return {
|
|
65
|
-
type: USER_REMOVED,
|
|
66
|
-
payload: id,
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export const inviteCodesLoaded = (inviteCodes) => {
|
|
71
|
-
return {
|
|
72
|
-
type: INVITE_CODES_LOADED,
|
|
73
|
-
payload: inviteCodes,
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
export const inviteCodeUpdated = (inviteCode) => {
|
|
78
|
-
return {
|
|
79
|
-
type: INVITE_CODE_UPDATED,
|
|
80
|
-
payload: inviteCode,
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export const inviteCodeRemoved = (inviteCode) => {
|
|
85
|
-
return {
|
|
86
|
-
type: INVITE_CODE_REMOVED,
|
|
87
|
-
payload: inviteCode,
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export const clearUsers = () => {
|
|
92
|
-
return {
|
|
93
|
-
type: USERS_PURGE,
|
|
94
|
-
};
|
|
95
|
-
};
|
package/src/actions/index.js
DELETED
package/src/actions/types.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export const SET_AUTH = 'set_auth';
|
|
2
|
-
export const LOGOUT = 'LOGOUT';
|
|
3
|
-
export const CHANGE_SITE = 'CHANGE_SITE';
|
|
4
|
-
export const UPDATE_PROFILE = 'UPDATE_PROFILE';
|
|
5
|
-
|
|
6
|
-
export const ADD_RECENTLY_CREATED = 'ADD_RECENTLY_CREATED';
|
|
7
|
-
|
|
8
|
-
export const USERS_LOADED = 'USERS_LOADED';
|
|
9
|
-
export const USER_REMOVED = 'USER_REMOVED';
|
|
10
|
-
export const USERS_PURGE = 'USERS_PURGE';
|
|
11
|
-
export const USERS_LOADING = 'USERS_LOADING';
|
|
12
|
-
export const USERS_RESIDENT_COUNT_SET = 'USERS_RESIDENT_COUNT_SET';
|
|
13
|
-
|
|
14
|
-
export const INVITE_CODES_LOADED = 'INVITE_CODES_LOADED';
|
|
15
|
-
export const INVITE_CODE_UPDATED = 'INVITE_CODE_UPDATED';
|
|
16
|
-
export const INVITE_CODE_REMOVED = 'INVITE_CODE_REMOVED';
|
|
17
|
-
|
|
18
|
-
export const SET_NAV_DATA = 'SET_NAV_DATA';
|
|
19
|
-
|
|
20
|
-
export const TEMPLATES_LOADED = 'TEMPLATES_LOADED';
|
|
21
|
-
export const TEMPLATE_REMOVED = 'TEMPLATE_REMOVED';
|
|
22
|
-
|
|
23
|
-
export const SCHEDULED_ACTIONS_LOADED = 'SCHEDULED_ACTIONS_LOADED';
|
package/src/analytics.js
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
import moment from 'moment';
|
|
3
|
-
|
|
4
|
-
export const compileStats = (stats) => {
|
|
5
|
-
const totalStats = {};
|
|
6
|
-
Object.keys(stats).forEach((id) => {
|
|
7
|
-
Object.keys(stats[id]).forEach((activityId) => {
|
|
8
|
-
if (Array.isArray(stats[id][activityId])) {
|
|
9
|
-
if (!totalStats[activityId]) {
|
|
10
|
-
totalStats[activityId] = [];
|
|
11
|
-
}
|
|
12
|
-
Array.prototype.push.apply(totalStats[activityId], stats[id][activityId]);
|
|
13
|
-
totalStats[activityId] = _.uniq(totalStats[activityId]);
|
|
14
|
-
} else {
|
|
15
|
-
if (!totalStats[activityId]) {
|
|
16
|
-
totalStats[activityId] = 0;
|
|
17
|
-
}
|
|
18
|
-
totalStats[activityId] += stats[id][activityId];
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
return totalStats;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const getInsight = (stats, previousStats, source, key, activity) => {
|
|
26
|
-
let top = { Stats: { [activity]: 0 } };
|
|
27
|
-
Object.keys(stats).forEach((entityId) => {
|
|
28
|
-
if (stats[entityId][activity] && stats[entityId][activity] > top.Stats[activity]) {
|
|
29
|
-
const entity = _.find(source, (s) => {
|
|
30
|
-
return s[key] === entityId;
|
|
31
|
-
});
|
|
32
|
-
if (entity) {
|
|
33
|
-
top = { Stats: stats[entityId], Entity: entity };
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
if (top.Stats[activity] === 0) {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
if (previousStats) {
|
|
41
|
-
top.PreviousStats = previousStats[top.Entity[key]];
|
|
42
|
-
}
|
|
43
|
-
return top;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export const getAnalyticsFilterOptions = () => {
|
|
47
|
-
return [
|
|
48
|
-
{
|
|
49
|
-
text: 'Yesterday',
|
|
50
|
-
dayCount: 1,
|
|
51
|
-
prevText: 'day before',
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
text: 'Last 7 days',
|
|
55
|
-
dayCount: 7,
|
|
56
|
-
prevText: 'previous 7 days',
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
text: 'Last 14 days',
|
|
60
|
-
dayCount: 14,
|
|
61
|
-
prevText: 'previous 14 days',
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
text: 'Last 30 days',
|
|
65
|
-
dayCount: 30,
|
|
66
|
-
prevText: 'previous 30 days',
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
text: 'Last 90 days',
|
|
70
|
-
dayCount: 90,
|
|
71
|
-
prevText: 'previous 90 days',
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
text: 'Last 365 days',
|
|
75
|
-
dayCount: 365,
|
|
76
|
-
prevText: 'previous 365 days',
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
text: 'Custom Range',
|
|
80
|
-
dayCount: 0,
|
|
81
|
-
prevText: 'previous * days',
|
|
82
|
-
},
|
|
83
|
-
];
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
export const countActivities = (data, activityKey, countType) => {
|
|
87
|
-
let count = 0;
|
|
88
|
-
let set = new Set();
|
|
89
|
-
|
|
90
|
-
data.forEach((entry) => {
|
|
91
|
-
const stats = entry.Stats;
|
|
92
|
-
|
|
93
|
-
for (const entity in stats) {
|
|
94
|
-
const entityStats = stats[entity];
|
|
95
|
-
|
|
96
|
-
switch (countType) {
|
|
97
|
-
case 'unique':
|
|
98
|
-
if (entityStats[activityKey]) {
|
|
99
|
-
set.add(entity);
|
|
100
|
-
}
|
|
101
|
-
break;
|
|
102
|
-
case 'uniquearray':
|
|
103
|
-
if (entityStats[activityKey]) {
|
|
104
|
-
_.values(entityStats[activityKey]).forEach((value) => {
|
|
105
|
-
set.add(value);
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
break;
|
|
109
|
-
case 'total':
|
|
110
|
-
if (entityStats[activityKey]) {
|
|
111
|
-
count += entityStats[activityKey];
|
|
112
|
-
}
|
|
113
|
-
break;
|
|
114
|
-
default:
|
|
115
|
-
break;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
switch (countType) {
|
|
121
|
-
case 'unique':
|
|
122
|
-
case 'uniquearray':
|
|
123
|
-
console.log(countType, set);
|
|
124
|
-
return set.size;
|
|
125
|
-
case 'total':
|
|
126
|
-
return count;
|
|
127
|
-
default:
|
|
128
|
-
return 0;
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
export const generateDateRangeObjects = (startTime, endTime, groupBy = 'day') => {
|
|
133
|
-
const startDate = moment(startTime);
|
|
134
|
-
const endDate = moment(endTime);
|
|
135
|
-
const dates = {};
|
|
136
|
-
|
|
137
|
-
while (startDate.isSameOrBefore(endDate)) {
|
|
138
|
-
const dateString = startDate.format('DD-MM-YYYY');
|
|
139
|
-
dates[dateString] = {
|
|
140
|
-
Date: dateString,
|
|
141
|
-
Timestamp: startDate.valueOf(),
|
|
142
|
-
Stats: {},
|
|
143
|
-
};
|
|
144
|
-
startDate.add(1, groupBy);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return dates;
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
export const generateDateActivities = (data, activityKey, countType, startTime, endTime, groupBy = 'day') => {
|
|
151
|
-
const dates = generateDateRangeObjects(startTime, endTime, groupBy);
|
|
152
|
-
|
|
153
|
-
const result = [];
|
|
154
|
-
let formatToUse = 'DD-MM-YYYY';
|
|
155
|
-
let labelFormat = 'D MMM';
|
|
156
|
-
switch (groupBy) {
|
|
157
|
-
case 'month':
|
|
158
|
-
formatToUse = 'MM-YYYY';
|
|
159
|
-
labelFormat = 'MMMM';
|
|
160
|
-
break;
|
|
161
|
-
case 'week':
|
|
162
|
-
formatToUse = 'w-gggg';
|
|
163
|
-
labelFormat = '[Week of] D MMM';
|
|
164
|
-
break;
|
|
165
|
-
default:
|
|
166
|
-
break;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
Object.keys(dates).forEach((d) => {
|
|
170
|
-
const datesToUse = _.filter(data, (date) => {
|
|
171
|
-
return moment(date.Date, 'DD-MM-YYYY').format(formatToUse) === moment(d, 'DD-MM-YYYY').format(formatToUse);
|
|
172
|
-
}) || [dates[d]];
|
|
173
|
-
const compiledValue = {
|
|
174
|
-
date: d,
|
|
175
|
-
label: moment(d, 'DD-MM-YYYY').format(labelFormat),
|
|
176
|
-
value: countActivities(datesToUse, activityKey, countType),
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
result.push(compiledValue);
|
|
180
|
-
});
|
|
181
|
-
console.log(result);
|
|
182
|
-
return result;
|
|
183
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { authedFunction } from '../session';
|
|
2
|
-
import { getUrl } from '../helper';
|
|
3
|
-
|
|
4
|
-
export const analyticsActions = {
|
|
5
|
-
log: (site, actionType, entityType, entityId, data) => {
|
|
6
|
-
return authedFunction({
|
|
7
|
-
method: 'POST',
|
|
8
|
-
url: getUrl('analytics', 'log'),
|
|
9
|
-
data: {
|
|
10
|
-
site,
|
|
11
|
-
actionType,
|
|
12
|
-
entityType,
|
|
13
|
-
entityId,
|
|
14
|
-
data,
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
},
|
|
18
|
-
getEntityStats: (entityId, entityType) => {
|
|
19
|
-
return authedFunction({
|
|
20
|
-
method: 'GET',
|
|
21
|
-
url: getUrl('analytics', 'getentity', { entityId, entityType }),
|
|
22
|
-
});
|
|
23
|
-
},
|
|
24
|
-
getActivityLog: (entityId, entityType, actionType, minTime, maxTime) => {
|
|
25
|
-
const query = { entityId, entityType, actionType };
|
|
26
|
-
if (minTime) {
|
|
27
|
-
query.minTime = minTime;
|
|
28
|
-
}
|
|
29
|
-
if (maxTime) {
|
|
30
|
-
query.maxTime = maxTime;
|
|
31
|
-
}
|
|
32
|
-
return authedFunction({
|
|
33
|
-
method: 'GET',
|
|
34
|
-
url: getUrl('analytics', 'activity', query),
|
|
35
|
-
});
|
|
36
|
-
},
|
|
37
|
-
getAggregateUserStats: (site) => {
|
|
38
|
-
return authedFunction({
|
|
39
|
-
method: 'GET',
|
|
40
|
-
url: getUrl('analytics', 'users', { site }),
|
|
41
|
-
});
|
|
42
|
-
},
|
|
43
|
-
getAggregateEntityStats: (site, type, minTime, maxTime, raw) => {
|
|
44
|
-
const query = { site, type, minTime, maxTime };
|
|
45
|
-
if (raw) {
|
|
46
|
-
query.raw = raw;
|
|
47
|
-
}
|
|
48
|
-
return authedFunction({
|
|
49
|
-
method: 'GET',
|
|
50
|
-
url: getUrl('analytics', 'aggregate', query),
|
|
51
|
-
});
|
|
52
|
-
},
|
|
53
|
-
};
|
package/src/apis/authActions.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import { getUrl } from '../helper';
|
|
3
|
-
import { authedFunction } from '../session';
|
|
4
|
-
|
|
5
|
-
export const authActions = {
|
|
6
|
-
checkUserAuth: (userId) => {
|
|
7
|
-
let url = getUrl('auth', 'checkUserAuth');
|
|
8
|
-
return authedFunction({
|
|
9
|
-
method: 'POST',
|
|
10
|
-
url,
|
|
11
|
-
data: {
|
|
12
|
-
userId,
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
},
|
|
16
|
-
fetchForgotPasswordId: (input) => {
|
|
17
|
-
return axios({
|
|
18
|
-
method: 'POST',
|
|
19
|
-
url: getUrl('auth', 'checkForgotUser'),
|
|
20
|
-
data: {
|
|
21
|
-
user: {
|
|
22
|
-
email: input,
|
|
23
|
-
phoneNumber: input,
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
headers: { authorization: 'GwegChicken' },
|
|
27
|
-
});
|
|
28
|
-
},
|
|
29
|
-
disableUser: (username, site) => {
|
|
30
|
-
let url = getUrl('users', 'testUserDisbale');
|
|
31
|
-
const request = {
|
|
32
|
-
method: 'POST',
|
|
33
|
-
url,
|
|
34
|
-
data: {
|
|
35
|
-
username,
|
|
36
|
-
site,
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
return authedFunction(request);
|
|
40
|
-
},
|
|
41
|
-
getUserSignin: async () => {
|
|
42
|
-
return authedFunction({
|
|
43
|
-
method: 'POST',
|
|
44
|
-
url: getUrl('auth', 'getUserSignin'),
|
|
45
|
-
});
|
|
46
|
-
},
|
|
47
|
-
copyDummy: (site) => {
|
|
48
|
-
let url = getUrl('auth', 'copyDummy');
|
|
49
|
-
const request = {
|
|
50
|
-
method: 'POST',
|
|
51
|
-
url,
|
|
52
|
-
data: {
|
|
53
|
-
site,
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
return authedFunction(request);
|
|
57
|
-
},
|
|
58
|
-
};
|