@plusscommunities/pluss-core-web 1.7.3-beta.0 → 1.7.3-beta.1
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/.babelrc +3 -0
- package/dist/components.js +390 -33094
- package/dist/components.js.map +1 -1
- package/dist/index.cjs.js +10388 -0
- package/dist/index.esm.js +10349 -0
- package/dist/index.js +394 -33098
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +10361 -0
- package/package.json +31 -22
- package/rollup.config.js +57 -0
- package/src/actions/AuthActions.js +83 -0
- package/src/actions/LocalActions.js +8 -0
- package/src/actions/NavActions.js +8 -0
- package/src/actions/ScheduledActionsActions.js +8 -0
- package/src/actions/TemplateActions.js +15 -0
- package/src/actions/UsersActions.js +95 -0
- package/src/actions/index.js +6 -0
- package/src/actions/types.js +23 -0
- package/src/analytics.js +183 -0
- package/src/apis/analyticsActions.js +53 -0
- package/src/apis/authActions.js +58 -0
- package/src/apis/fileActions.js +152 -0
- package/src/apis/index.js +10 -0
- package/src/apis/profileActions.js +133 -0
- package/src/apis/scheduledActionsActions.js +12 -0
- package/src/apis/stringActions.js +25 -0
- package/src/apis/templateActions.js +41 -0
- package/src/apis/typeActions.js +186 -0
- package/src/apis/userActions.js +169 -0
- package/src/apis/utilityActions.js +35 -0
- package/src/colours.js +134 -0
- package/src/components/AddButton.js +27 -0
- package/src/components/AnalyticsFilter.js +115 -0
- package/src/components/Attachment.js +27 -0
- package/src/components/AudienceIncluder.js +175 -0
- package/src/components/AudienceSelector.js +700 -0
- package/src/components/Button.js +66 -0
- package/src/components/CheckBox.js +77 -0
- package/src/components/ColourOptions.js +197 -0
- package/src/components/ColourPicker.js +267 -0
- package/src/components/Comment.js +46 -0
- package/src/components/CommentSection.js +116 -0
- package/src/components/DatePicker.js +290 -0
- package/src/components/DropdownInput.js +223 -0
- package/src/components/DurationInput.js +51 -0
- package/src/components/ExportCsvPopup.js +222 -0
- package/src/components/FileInput.js +389 -0
- package/src/components/GenericInput.js +169 -0
- package/src/components/Header.js +82 -0
- package/src/components/HubSidebar.js +134 -0
- package/src/components/ImageInput.js +987 -0
- package/src/components/InputGroup.js +18 -0
- package/src/components/MakerPopup.js +310 -0
- package/src/components/MoreMenu.js +22 -0
- package/src/components/OptionsSection.js +84 -0
- package/src/components/OverlayPage.js +74 -0
- package/src/components/OverlayPageBottomButtons.js +48 -0
- package/src/components/OverlayPageContents.js +48 -0
- package/src/components/OverlayPageSection.js +38 -0
- package/src/components/P60Icon.js +40 -0
- package/src/components/PageTitle.js +13 -0
- package/src/components/Popup.js +104 -0
- package/src/components/ProfilePic.js +50 -0
- package/src/components/RadioButton.js +144 -0
- package/src/components/Reactions.js +77 -0
- package/src/components/SVGIcon.js +33 -0
- package/src/components/SideNavItem.js +98 -0
- package/src/components/StatBox.js +49 -0
- package/src/components/StatusButton.js +22 -0
- package/src/components/SuccessPopup.js +57 -0
- package/src/components/Tabs.js +56 -0
- package/src/components/Tag.js +62 -0
- package/src/components/Text.js +20 -0
- package/src/components/TextFormatPopup.js +54 -0
- package/src/components/TimePicker.js +225 -0
- package/src/components/UserListing.js +111 -0
- package/src/components/index.js +46 -0
- package/src/components/svg-icons.json +821 -0
- package/src/config.js +25 -0
- package/src/helper/HelpDeskWidget.js +16 -0
- package/src/helper/api/getUrl.js +15 -0
- package/src/helper/api/getUrlParams.js +9 -0
- package/src/helper/api/safeReadParams.js +6 -0
- package/src/helper/auth/getUserFromState.js +8 -0
- package/src/helper/colours/getAppColourFromState.js +10 -0
- package/src/helper/files/canvasImageUploader.js +159 -0
- package/src/helper/files/generateImageName.js +10 -0
- package/src/helper/files/get1400.js +32 -0
- package/src/helper/files/getExtension.js +9 -0
- package/src/helper/files/getFileName.js +13 -0
- package/src/helper/files/getThumb300.js +36 -0
- package/src/helper/files/isVideo.js +8 -0
- package/src/helper/helper.js +97 -0
- package/src/helper/index.js +44 -0
- package/src/helper/site/getMerchantsFromState.js +9 -0
- package/src/helper/site/getSiteLevelFromState.js +34 -0
- package/src/helper/site/getSiteName.js +16 -0
- package/src/helper/site/getSiteNameFromRoles.js +12 -0
- package/src/helper/site/getSiteSettingFromState.js +10 -0
- package/src/helper/storage/readJSONFromStorage.js +9 -0
- package/src/helper/storage/readStorageWithCookie.js +22 -0
- package/src/helper/storage/setLocalStorage.js +5 -0
- package/src/helper/strings/getFirstName.js +10 -0
- package/src/helper/strings/htmlDecode.js +4 -0
- package/src/helper/strings/htmlEncode.js +4 -0
- package/src/helper/strings/isEmail.js +11 -0
- package/src/helper/strings/isUrl.js +13 -0
- package/src/helper/strings/onlyAlphanumeric.js +8 -0
- package/src/helper/strings/randomString.js +10 -0
- package/src/helper/strings/toParagraphed.js +17 -0
- package/src/index.js +12 -0
- package/src/reducers/ScheduledActionsReducer.js +14 -0
- package/src/reducers/TemplatesReducer.js +29 -0
- package/src/reducers/index.js +7 -0
- package/src/session.js +289 -0
- package/src/urls.js +21 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { getCurrentUserSub, authedFunction } from '../session';
|
|
2
|
+
import Config from '../config';
|
|
3
|
+
import { Storage } from 'aws-amplify';
|
|
4
|
+
import CanvasImageUploader from '../helper/files/canvasImageUploader';
|
|
5
|
+
import $ from 'jquery';
|
|
6
|
+
import { generateImageName, randomString, getUrl } from '../helper';
|
|
7
|
+
|
|
8
|
+
export const fileActions = {
|
|
9
|
+
uploadMediaAsync: async (file, filename) => {
|
|
10
|
+
const newFilename = filename.replace(/[^a-z0-9+.]+/gi, '').toLowerCase();
|
|
11
|
+
const userId = await getCurrentUserSub();
|
|
12
|
+
const url = `uploads/users/${userId}/public/${randomString()}/${newFilename}`;
|
|
13
|
+
|
|
14
|
+
const { baseUploadsUrl, uploadBucket } = Config.env;
|
|
15
|
+
await Storage.put(url, file, { level: 'public', bucket: uploadBucket });
|
|
16
|
+
console.log('uploaded file', `${baseUploadsUrl}${url}`);
|
|
17
|
+
return `${baseUploadsUrl}${url}`;
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
// readBase64: async (file) => {
|
|
21
|
+
// return new Promise((resolve, reject) => {
|
|
22
|
+
// var reader = new FileReader();
|
|
23
|
+
// reader.readAsDataURL(file);
|
|
24
|
+
// reader.onload = () => {
|
|
25
|
+
// resolve(reader.result);
|
|
26
|
+
// //resolve(reader.result.split(',')[1]);
|
|
27
|
+
// };
|
|
28
|
+
// reader.onerror = (error) => {
|
|
29
|
+
// reject(error);
|
|
30
|
+
// };
|
|
31
|
+
// });
|
|
32
|
+
// },
|
|
33
|
+
compressImage: (file, maxSize, quality, noCompress) => {
|
|
34
|
+
return new Promise((resolve, reject) => {
|
|
35
|
+
if (noCompress) {
|
|
36
|
+
resolve(file);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
var $canvas = $('<canvas>');
|
|
40
|
+
$canvas.css('display', 'none');
|
|
41
|
+
$('body').append($canvas);
|
|
42
|
+
|
|
43
|
+
var canvasUploader = new CanvasImageUploader({
|
|
44
|
+
maxSize: maxSize,
|
|
45
|
+
jpegQuality: quality,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
canvasUploader.readImageToCanvas(file, $canvas, function () {
|
|
49
|
+
canvasUploader.saveCanvasToImageData($canvas[0]);
|
|
50
|
+
console.log(file);
|
|
51
|
+
resolve(fileActions.blobToFile(canvasUploader.getImageData(), file.name));
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
blobToFile: (theBlob, fileName) => {
|
|
56
|
+
const file = new File([theBlob], fileName, { lastModified: new Date() });
|
|
57
|
+
console.log(file);
|
|
58
|
+
return file;
|
|
59
|
+
},
|
|
60
|
+
putCanvas: (canvas, filename) => {
|
|
61
|
+
return new Promise((resolve, reject) => {
|
|
62
|
+
const img = canvas.getTrimmedCanvas().toDataURL('image/png');
|
|
63
|
+
const imageData = Buffer.from(img.replace(/^data:image\/\w+;base64,/, ''), 'base64');
|
|
64
|
+
|
|
65
|
+
canvas.off();
|
|
66
|
+
|
|
67
|
+
const imgName = generateImageName(filename);
|
|
68
|
+
|
|
69
|
+
Storage.put(`images/${imgName}.png`, imageData, {
|
|
70
|
+
contentType: 'image/png',
|
|
71
|
+
level: 'public',
|
|
72
|
+
})
|
|
73
|
+
.then((res) => {
|
|
74
|
+
console.log('put the image');
|
|
75
|
+
return resolve(res);
|
|
76
|
+
})
|
|
77
|
+
.catch((err) => {
|
|
78
|
+
return reject(err);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
getMediaFolders: (site) => {
|
|
83
|
+
// console.log('getMediaFolders', 'site', site);
|
|
84
|
+
const query = { site };
|
|
85
|
+
return authedFunction({
|
|
86
|
+
method: 'GET',
|
|
87
|
+
url: getUrl('media', 'folders', query),
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
addMediaFolder: (site, name, published) => {
|
|
91
|
+
return authedFunction({
|
|
92
|
+
method: 'POST',
|
|
93
|
+
url: getUrl('media', 'addFolder'),
|
|
94
|
+
data: {
|
|
95
|
+
site,
|
|
96
|
+
name,
|
|
97
|
+
published,
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
updateMediaFolder: (id, site, name, published) => {
|
|
102
|
+
// console.log('updateMediaFolder', 'id', id, 'site', site, 'name', name, 'published', published);
|
|
103
|
+
return authedFunction({
|
|
104
|
+
method: 'POST',
|
|
105
|
+
url: getUrl('media', 'updateFolder'),
|
|
106
|
+
data: {
|
|
107
|
+
id,
|
|
108
|
+
site,
|
|
109
|
+
name,
|
|
110
|
+
published,
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
},
|
|
114
|
+
deleteMediaFolder: (id, site) => {
|
|
115
|
+
return authedFunction({
|
|
116
|
+
method: 'POST',
|
|
117
|
+
url: getUrl('media', 'deleteFolder'),
|
|
118
|
+
data: {
|
|
119
|
+
id,
|
|
120
|
+
site,
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
},
|
|
124
|
+
addImagesToFolder: (id, site, images) => {
|
|
125
|
+
return authedFunction({
|
|
126
|
+
method: 'POST',
|
|
127
|
+
url: getUrl('media', 'addImages'),
|
|
128
|
+
data: {
|
|
129
|
+
id,
|
|
130
|
+
site,
|
|
131
|
+
images,
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
},
|
|
135
|
+
deleteImagesFromFolder: (id, site, images) => {
|
|
136
|
+
return authedFunction({
|
|
137
|
+
method: 'POST',
|
|
138
|
+
url: getUrl('media', 'deleteImages'),
|
|
139
|
+
data: {
|
|
140
|
+
id,
|
|
141
|
+
site,
|
|
142
|
+
images,
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
},
|
|
146
|
+
getMediaLibrary: () => {
|
|
147
|
+
return authedFunction({
|
|
148
|
+
method: 'GET',
|
|
149
|
+
url: 'https://pluss60.pluss60-api.com/media-demo/library',
|
|
150
|
+
});
|
|
151
|
+
},
|
|
152
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './analyticsActions';
|
|
2
|
+
export * from './authActions';
|
|
3
|
+
export * from './fileActions';
|
|
4
|
+
export * from './typeActions';
|
|
5
|
+
export * from './stringActions';
|
|
6
|
+
export * from './userActions';
|
|
7
|
+
export * from './profileActions';
|
|
8
|
+
export * from './utilityActions';
|
|
9
|
+
export * from './templateActions';
|
|
10
|
+
export * from './scheduledActionsActions';
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { authedFunction } from '../session';
|
|
2
|
+
import { getUrl } from '../helper';
|
|
3
|
+
|
|
4
|
+
export const profileActions = {
|
|
5
|
+
addEC: (userId, name, phone, email, relationship) => {
|
|
6
|
+
return authedFunction({
|
|
7
|
+
method: 'POST',
|
|
8
|
+
url: getUrl('profile', 'emergencycontacts/add'),
|
|
9
|
+
data: { userId, name, phone, email, relationship },
|
|
10
|
+
});
|
|
11
|
+
},
|
|
12
|
+
editEC: (id, userId, name, phone, email, relationship) => {
|
|
13
|
+
return authedFunction({
|
|
14
|
+
method: 'POST',
|
|
15
|
+
url: getUrl('profile', 'emergencycontacts/edit'),
|
|
16
|
+
data: { id, userId, name, phone, email, relationship },
|
|
17
|
+
});
|
|
18
|
+
},
|
|
19
|
+
deleteEC: (id) => {
|
|
20
|
+
return authedFunction({
|
|
21
|
+
method: 'POST',
|
|
22
|
+
url: getUrl('profile', 'emergencycontacts/delete'),
|
|
23
|
+
data: { id },
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
getECs: (userId) => {
|
|
27
|
+
return authedFunction({
|
|
28
|
+
method: 'GET',
|
|
29
|
+
url: getUrl('profile', 'emergencycontacts/user', { userId }),
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
addPD: (userId, name, url, isPublic) => {
|
|
33
|
+
return authedFunction({
|
|
34
|
+
method: 'POST',
|
|
35
|
+
url: getUrl('profile', 'personaldocuments/add'),
|
|
36
|
+
data: { userId, name, url, isPublic },
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
editPD: (id, userId, name, url, isPublic) => {
|
|
40
|
+
return authedFunction({
|
|
41
|
+
method: 'POST',
|
|
42
|
+
url: getUrl('profile', 'personaldocuments/edit'),
|
|
43
|
+
data: { id, userId, name, url, isPublic },
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
deletePD: (id) => {
|
|
47
|
+
return authedFunction({
|
|
48
|
+
method: 'POST',
|
|
49
|
+
url: getUrl('profile', 'personaldocuments/delete'),
|
|
50
|
+
data: { id },
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
getPDs: (userId) => {
|
|
54
|
+
return authedFunction({
|
|
55
|
+
method: 'GET',
|
|
56
|
+
url: getUrl('profile', 'personaldocuments/user', { userId }),
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
addPN: (userId, title, text, attachments) => {
|
|
60
|
+
return authedFunction({
|
|
61
|
+
method: 'POST',
|
|
62
|
+
url: getUrl('profile', 'personalnotes/add'),
|
|
63
|
+
data: { userId, title, text, attachments },
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
editPN: (id, title, text, attachments) => {
|
|
67
|
+
return authedFunction({
|
|
68
|
+
method: 'POST',
|
|
69
|
+
url: getUrl('profile', 'personalnotes/edit'),
|
|
70
|
+
data: { id, title, text, attachments },
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
deletePN: (id) => {
|
|
74
|
+
return authedFunction({
|
|
75
|
+
method: 'POST',
|
|
76
|
+
url: getUrl('profile', 'personalnotes/delete'),
|
|
77
|
+
data: { id },
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
getPNs: (userId) => {
|
|
81
|
+
return authedFunction({
|
|
82
|
+
method: 'GET',
|
|
83
|
+
url: getUrl('profile', 'personalnotes/user', { userId }),
|
|
84
|
+
});
|
|
85
|
+
},
|
|
86
|
+
addUserTag: (site, title) => {
|
|
87
|
+
return authedFunction({
|
|
88
|
+
method: 'POST',
|
|
89
|
+
url: getUrl('profile', 'usertags/add'),
|
|
90
|
+
data: { site, title },
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
editUserTag: (id, title) => {
|
|
94
|
+
return authedFunction({
|
|
95
|
+
method: 'POST',
|
|
96
|
+
url: getUrl('profile', 'usertags/edit'),
|
|
97
|
+
data: { id, title },
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
deleteUserTag: (id) => {
|
|
101
|
+
return authedFunction({
|
|
102
|
+
method: 'POST',
|
|
103
|
+
url: getUrl('profile', 'usertags/delete'),
|
|
104
|
+
data: { id },
|
|
105
|
+
});
|
|
106
|
+
},
|
|
107
|
+
attachUserTag: (tagId, userId) => {
|
|
108
|
+
return authedFunction({
|
|
109
|
+
method: 'POST',
|
|
110
|
+
url: getUrl('profile', 'usertags/attach'),
|
|
111
|
+
data: { tagId, userId },
|
|
112
|
+
});
|
|
113
|
+
},
|
|
114
|
+
detachUserTag: (tagId, userId) => {
|
|
115
|
+
return authedFunction({
|
|
116
|
+
method: 'POST',
|
|
117
|
+
url: getUrl('profile', 'usertags/detach'),
|
|
118
|
+
data: { tagId, userId },
|
|
119
|
+
});
|
|
120
|
+
},
|
|
121
|
+
getUserTagsByUser: (userId) => {
|
|
122
|
+
return authedFunction({
|
|
123
|
+
method: 'GET',
|
|
124
|
+
url: getUrl('profile', 'usertags/user', { userId }),
|
|
125
|
+
});
|
|
126
|
+
},
|
|
127
|
+
getUserTagsBySite: (site) => {
|
|
128
|
+
return authedFunction({
|
|
129
|
+
method: 'GET',
|
|
130
|
+
url: getUrl('profile', 'usertags/site', { site }),
|
|
131
|
+
});
|
|
132
|
+
},
|
|
133
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getUrl } from '../helper';
|
|
2
|
+
import { authedFunction } from '../session';
|
|
3
|
+
|
|
4
|
+
export const scheduledActionsActions = {
|
|
5
|
+
getActions: (site, entityKey) => {
|
|
6
|
+
const query = { site, entityKey };
|
|
7
|
+
return authedFunction({
|
|
8
|
+
method: 'GET',
|
|
9
|
+
url: getUrl('scheduledactions', 'get/list', query),
|
|
10
|
+
});
|
|
11
|
+
},
|
|
12
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { getUrl } from '../helper';
|
|
3
|
+
import { authedFunction } from '../session';
|
|
4
|
+
|
|
5
|
+
export const stringActions = {
|
|
6
|
+
getString: (site, id, useDefault) => {
|
|
7
|
+
let url = getUrl('strings', `get/${site}_${id}`, useDefault ? { useDefault } : undefined);
|
|
8
|
+
return axios({
|
|
9
|
+
method: 'GET',
|
|
10
|
+
url,
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
setString: (site, key, value) => {
|
|
14
|
+
let url = getUrl('strings', 'set');
|
|
15
|
+
return authedFunction({
|
|
16
|
+
method: 'POST',
|
|
17
|
+
url,
|
|
18
|
+
data: {
|
|
19
|
+
site,
|
|
20
|
+
key,
|
|
21
|
+
value,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { getUrl, htmlEncode } from '../helper';
|
|
2
|
+
import { authedFunction } from '../session';
|
|
3
|
+
|
|
4
|
+
export const templateActions = {
|
|
5
|
+
getTemplates: (site, featureKey) => {
|
|
6
|
+
const query = { site, featureKey };
|
|
7
|
+
return authedFunction({
|
|
8
|
+
method: 'GET',
|
|
9
|
+
url: getUrl('templates', 'get/list', query),
|
|
10
|
+
});
|
|
11
|
+
},
|
|
12
|
+
getTemplate: (site, featureKey, rowId) => {
|
|
13
|
+
return authedFunction({
|
|
14
|
+
method: 'GET',
|
|
15
|
+
url: getUrl('templates', 'get/single', { site, featureKey, rowId }),
|
|
16
|
+
});
|
|
17
|
+
},
|
|
18
|
+
createTemplate: (template) => {
|
|
19
|
+
template.content = htmlEncode(template.content);
|
|
20
|
+
return authedFunction({
|
|
21
|
+
method: 'POST',
|
|
22
|
+
url: getUrl('templates', 'update/add'),
|
|
23
|
+
data: template,
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
editTemplate: (template) => {
|
|
27
|
+
template.content = htmlEncode(template.content);
|
|
28
|
+
return authedFunction({
|
|
29
|
+
method: 'POST',
|
|
30
|
+
url: getUrl('templates', 'update/edit'),
|
|
31
|
+
data: template,
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
deleteTemplate: (site, rowId) => {
|
|
35
|
+
return authedFunction({
|
|
36
|
+
method: 'POST',
|
|
37
|
+
url: getUrl('templates', 'update/delete'),
|
|
38
|
+
data: { site, rowId },
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
};
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { getUrl } from '../helper';
|
|
2
|
+
import { authedFunction, unauthedFunction } from '../session';
|
|
3
|
+
|
|
4
|
+
export const typeActions = {
|
|
5
|
+
getSubdomains: () => {
|
|
6
|
+
return authedFunction({
|
|
7
|
+
method: 'GET',
|
|
8
|
+
url: getUrl('types', 'subdomains/get'),
|
|
9
|
+
});
|
|
10
|
+
},
|
|
11
|
+
getSubdomain: (key) => {
|
|
12
|
+
return unauthedFunction({
|
|
13
|
+
method: 'GET',
|
|
14
|
+
url: getUrl('types', `subdomains/get/${key}`),
|
|
15
|
+
});
|
|
16
|
+
},
|
|
17
|
+
updateSubdomain: (key, background) => {
|
|
18
|
+
return authedFunction({
|
|
19
|
+
method: 'POST',
|
|
20
|
+
url: getUrl('types', 'subdomains/update'),
|
|
21
|
+
data: {
|
|
22
|
+
Key: key,
|
|
23
|
+
Background: background,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
getSites: () => {
|
|
28
|
+
let url = getUrl('types', 'getsites');
|
|
29
|
+
return authedFunction({
|
|
30
|
+
method: 'POST',
|
|
31
|
+
url,
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
getSite: async (id) => {
|
|
35
|
+
let url = getUrl('types', `getsite`, { site: id });
|
|
36
|
+
return authedFunction({
|
|
37
|
+
method: 'GET',
|
|
38
|
+
url,
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
getUserTypes: (site) => {
|
|
42
|
+
let url = getUrl('types', 'getusertypes');
|
|
43
|
+
return authedFunction({
|
|
44
|
+
method: 'POST',
|
|
45
|
+
url,
|
|
46
|
+
data: {
|
|
47
|
+
site,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
setTypePermissions: (type, adminId) => {
|
|
52
|
+
let url = getUrl('types', 'setusertypepermissions');
|
|
53
|
+
return authedFunction({
|
|
54
|
+
method: 'POST',
|
|
55
|
+
url,
|
|
56
|
+
data: {
|
|
57
|
+
type,
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
deleteUserType: (site, type) => {
|
|
62
|
+
let url = getUrl('types', 'usertype/delete');
|
|
63
|
+
return authedFunction({
|
|
64
|
+
method: 'POST',
|
|
65
|
+
url,
|
|
66
|
+
data: {
|
|
67
|
+
site,
|
|
68
|
+
id: type,
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
createNewSite: (siteName, options) => {
|
|
73
|
+
let url = getUrl('types', 'setNewSite');
|
|
74
|
+
const request = {
|
|
75
|
+
method: 'POST',
|
|
76
|
+
url,
|
|
77
|
+
data: {
|
|
78
|
+
siteName,
|
|
79
|
+
...options,
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
return authedFunction(request);
|
|
83
|
+
},
|
|
84
|
+
signUpNewSite: (site, user) => {
|
|
85
|
+
let url = getUrl('types', 'site/signup');
|
|
86
|
+
const request = {
|
|
87
|
+
method: 'POST',
|
|
88
|
+
url,
|
|
89
|
+
data: { site, user },
|
|
90
|
+
};
|
|
91
|
+
return unauthedFunction(request);
|
|
92
|
+
},
|
|
93
|
+
getInterface: (id) => {
|
|
94
|
+
return authedFunction({
|
|
95
|
+
method: 'GET',
|
|
96
|
+
url: getUrl('types', `interfaces/get/${id}`),
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
getInterfaces: (site, type) => {
|
|
100
|
+
const q = { site };
|
|
101
|
+
if (type) {
|
|
102
|
+
q.type = type;
|
|
103
|
+
}
|
|
104
|
+
return authedFunction({
|
|
105
|
+
method: 'GET',
|
|
106
|
+
url: getUrl('types', 'interfaces/get', q),
|
|
107
|
+
});
|
|
108
|
+
},
|
|
109
|
+
deleteInterface: (id) => {
|
|
110
|
+
const request = {
|
|
111
|
+
method: 'POST',
|
|
112
|
+
url: getUrl('types', 'interfaces/remove'),
|
|
113
|
+
data: { id },
|
|
114
|
+
};
|
|
115
|
+
return authedFunction(request);
|
|
116
|
+
},
|
|
117
|
+
saveInterface: (site, type, title, settings, id) => {
|
|
118
|
+
const request = {
|
|
119
|
+
method: 'POST',
|
|
120
|
+
url: getUrl('types', 'interfaces/save'),
|
|
121
|
+
data: { site, type, title, settings, id },
|
|
122
|
+
};
|
|
123
|
+
return authedFunction(request);
|
|
124
|
+
},
|
|
125
|
+
attachInterface: (site, typeName, interfaceId) => {
|
|
126
|
+
const request = {
|
|
127
|
+
method: 'POST',
|
|
128
|
+
url: getUrl('types', 'interfaces/attach'),
|
|
129
|
+
data: { site, typeName, interfaceId },
|
|
130
|
+
};
|
|
131
|
+
return authedFunction(request);
|
|
132
|
+
},
|
|
133
|
+
getSiteBranding: (site) => {
|
|
134
|
+
const request = {
|
|
135
|
+
method: 'GET',
|
|
136
|
+
url: getUrl('types', 'branding/get', { site }),
|
|
137
|
+
};
|
|
138
|
+
return unauthedFunction(request);
|
|
139
|
+
},
|
|
140
|
+
generateSiteBranding: (url) => {
|
|
141
|
+
const request = {
|
|
142
|
+
method: 'GET',
|
|
143
|
+
url: getUrl('types', 'branding/generate', { url }),
|
|
144
|
+
};
|
|
145
|
+
return unauthedFunction(request);
|
|
146
|
+
},
|
|
147
|
+
editSiteBranding: (siteName, branding) => {
|
|
148
|
+
let url = getUrl('types', 'editsitebranding');
|
|
149
|
+
const request = {
|
|
150
|
+
method: 'POST',
|
|
151
|
+
url,
|
|
152
|
+
data: {
|
|
153
|
+
siteName,
|
|
154
|
+
branding,
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
return authedFunction(request);
|
|
158
|
+
},
|
|
159
|
+
editSiteSettings: (site, values) => {
|
|
160
|
+
return authedFunction({
|
|
161
|
+
method: 'POST',
|
|
162
|
+
url: getUrl('types', 'site/edit'),
|
|
163
|
+
data: {
|
|
164
|
+
Id: site,
|
|
165
|
+
...values,
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
},
|
|
169
|
+
getDefaultTVSettings: () => {
|
|
170
|
+
return {
|
|
171
|
+
widgets: [],
|
|
172
|
+
};
|
|
173
|
+
},
|
|
174
|
+
getDefaultTabSettings: () => {
|
|
175
|
+
return [
|
|
176
|
+
{
|
|
177
|
+
key: 'tab0',
|
|
178
|
+
tabTitle: 'Home',
|
|
179
|
+
type: 'home',
|
|
180
|
+
isEnabled: true,
|
|
181
|
+
widgets: [],
|
|
182
|
+
widgetOptions: [],
|
|
183
|
+
},
|
|
184
|
+
];
|
|
185
|
+
},
|
|
186
|
+
};
|