@plusscommunities/pluss-core-web 1.0.5 → 1.0.6

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.
Files changed (62) hide show
  1. package/dist/index.cjs.js +7349 -1360
  2. package/dist/index.esm.js +7341 -1358
  3. package/dist/index.umd.js +7346 -1364
  4. package/package.json +5 -3
  5. package/src/actions/AuthActions.js +83 -0
  6. package/src/actions/UsersActions.js +65 -0
  7. package/src/actions/index.js +2 -2
  8. package/src/actions/types.js +9 -9
  9. package/src/analytics.js +73 -0
  10. package/src/apis/analyticsActions.js +49 -0
  11. package/src/apis/authActions.js +58 -0
  12. package/src/apis/fileActions.js +92 -94
  13. package/src/apis/index.js +7 -0
  14. package/src/apis/profileActions.js +133 -0
  15. package/src/apis/stringActions.js +25 -0
  16. package/src/apis/typeActions.js +186 -0
  17. package/src/apis/userActions.js +128 -0
  18. package/src/apis/utilityActions.js +35 -0
  19. package/src/colours.js +16 -16
  20. package/src/components/AnalyticsFilter.js +110 -0
  21. package/src/components/AudienceIncluder.js +174 -0
  22. package/src/components/AudienceSelector.js +549 -0
  23. package/src/components/CheckBox.js +77 -0
  24. package/src/components/DatePicker.js +268 -0
  25. package/src/components/DropdownInput.js +223 -0
  26. package/src/components/FileInput.js +314 -0
  27. package/src/components/ImageInput.js +971 -0
  28. package/src/components/MakerPopup.js +300 -0
  29. package/src/components/OptionsSection.js +64 -0
  30. package/src/components/P60Icon.js +40 -0
  31. package/src/components/ProfilePic.js +35 -0
  32. package/src/components/Reactions.js +77 -0
  33. package/src/components/Tag.js +62 -0
  34. package/src/components/TextFormatPopup.js +54 -0
  35. package/src/components/TimePicker.js +205 -0
  36. package/src/components/UserListing.js +64 -0
  37. package/src/components/index.js +23 -7
  38. package/src/components/svg-icons.json +6 -0
  39. package/src/config.js +10 -0
  40. package/src/helper/HelpDeskWidget.js +52 -0
  41. package/src/helper/api/getUrl.js +15 -0
  42. package/src/helper/api/getUrlParams.js +9 -0
  43. package/src/helper/api/safeReadParams.js +6 -0
  44. package/src/helper/colours.js/getAppColourFromState.js +10 -0
  45. package/src/helper/files/canvasImageUploader.js +159 -0
  46. package/src/helper/files/get1400.js +28 -0
  47. package/src/helper/files/getExtension.js +9 -0
  48. package/src/helper/files/getFileName.js +13 -0
  49. package/src/helper/files/getThumb300.js +32 -0
  50. package/src/helper/files/isVideo.js +8 -0
  51. package/src/{helper.js → helper/helper.js} +19 -130
  52. package/src/helper/index.js +29 -0
  53. package/src/helper/site/getSiteName.js +16 -0
  54. package/src/helper/site/getSiteNameFromRoles.js +12 -0
  55. package/src/helper/storage/readJSONFromStorage.js +9 -0
  56. package/src/helper/storage/setLocalStorage.js +5 -0
  57. package/src/helper/strings/isEmail.js +11 -0
  58. package/src/helper/strings/onlyAlphanumeric.js +8 -0
  59. package/src/helper/strings/randomString.js +10 -0
  60. package/src/helper/strings/toParagraphed.js +17 -0
  61. package/src/index.js +2 -1
  62. package/src/session.js +107 -107
package/src/apis/index.js CHANGED
@@ -1 +1,8 @@
1
+ export * from './analyticsActions';
2
+ export * from './authActions';
1
3
  export * from './fileActions';
4
+ export * from './typeActions';
5
+ export * from './stringActions';
6
+ export * from './userActions';
7
+ export * from './profileActions';
8
+ export * from './utilityActions';
@@ -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,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,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
+ };
@@ -0,0 +1,128 @@
1
+ import _ from 'lodash';
2
+ import { authedFunction } from '../session';
3
+ import { getUrl } from '../helper';
4
+
5
+ export const userActions = {
6
+ createNewUser: (user, userExtra) => {
7
+ return authedFunction({
8
+ method: 'POST',
9
+ url: getUrl('users', 'add'),
10
+ data: {
11
+ user,
12
+ userExtra,
13
+ },
14
+ });
15
+ },
16
+ bulkNewUser: (users, site) => {
17
+ return authedFunction({
18
+ method: 'POST',
19
+ url: getUrl('users', 'addbulk'),
20
+ data: {
21
+ site,
22
+ users,
23
+ },
24
+ });
25
+ },
26
+ getbulks: (site) => {
27
+ return authedFunction({
28
+ method: 'POST',
29
+ url: getUrl('users', 'getbulks'),
30
+ data: {
31
+ site,
32
+ },
33
+ });
34
+ },
35
+ fetchUsers: (site) => {
36
+ return authedFunction({
37
+ method: 'POST',
38
+ url: getUrl('users', 'get'),
39
+ data: {
40
+ site,
41
+ },
42
+ });
43
+ },
44
+ fetchUser: (site, userId) => {
45
+ return authedFunction({
46
+ method: 'POST',
47
+ url: getUrl('users', 'getsingle'),
48
+ data: {
49
+ site,
50
+ userId,
51
+ },
52
+ });
53
+ },
54
+ updateUser: (site, userId, user) => {
55
+ return authedFunction({
56
+ method: 'POST',
57
+ url: getUrl('users', 'manageUser'),
58
+ data: {
59
+ site,
60
+ userId,
61
+ user,
62
+ },
63
+ });
64
+ },
65
+ getSiteResidentsCount: (site) => {
66
+ return authedFunction({
67
+ method: 'POST',
68
+ url: getUrl('users', 'getexp'),
69
+ data: { site, isCount: true },
70
+ });
71
+ },
72
+ sendWelcomeEmail: (site, userId) => {
73
+ return authedFunction({
74
+ method: 'POST',
75
+ url: getUrl('users', 'welcome/email'),
76
+ data: { site, userId },
77
+ });
78
+ },
79
+ sendWelcomeText: (site, userId) => {
80
+ return authedFunction({
81
+ method: 'POST',
82
+ url: getUrl('users', 'welcome/text'),
83
+ data: { site, userId },
84
+ });
85
+ },
86
+ getInviteCode: (userId, type, site) => {
87
+ const query = {};
88
+ if (!_.isEmpty(userId)) {
89
+ query.userId = userId;
90
+ }
91
+ if (!_.isEmpty(type)) {
92
+ query.type = type;
93
+ }
94
+ if (!_.isEmpty(site)) {
95
+ query.site = site;
96
+ }
97
+ return authedFunction({
98
+ method: 'GET',
99
+ url: getUrl('users', 'invite/get', query),
100
+ });
101
+ },
102
+ generateInviteCode: (userId, type, site) => {
103
+ const data = {};
104
+ if (!_.isEmpty(userId)) {
105
+ data.userId = userId;
106
+ }
107
+ if (!_.isEmpty(type)) {
108
+ data.type = type;
109
+ }
110
+ if (!_.isEmpty(site)) {
111
+ data.site = site;
112
+ }
113
+ return authedFunction({
114
+ method: 'POST',
115
+ url: getUrl('users', 'invite/generate'),
116
+ data,
117
+ });
118
+ },
119
+ updateProfile: (input) => {
120
+ return authedFunction({
121
+ method: 'POST',
122
+ url: getUrl('users', 'updateProfile'),
123
+ data: {
124
+ details: input,
125
+ },
126
+ });
127
+ },
128
+ };