@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.
Files changed (116) hide show
  1. package/dist/components.js +37233 -474
  2. package/dist/components.js.map +1 -1
  3. package/dist/index.js +37233 -474
  4. package/dist/index.js.map +1 -1
  5. package/package.json +22 -31
  6. package/.babelrc +0 -3
  7. package/dist/index.cjs.js +0 -10388
  8. package/dist/index.esm.js +0 -10349
  9. package/dist/index.umd.js +0 -10361
  10. package/rollup.config.js +0 -57
  11. package/src/actions/AuthActions.js +0 -83
  12. package/src/actions/LocalActions.js +0 -8
  13. package/src/actions/NavActions.js +0 -8
  14. package/src/actions/ScheduledActionsActions.js +0 -8
  15. package/src/actions/TemplateActions.js +0 -15
  16. package/src/actions/UsersActions.js +0 -95
  17. package/src/actions/index.js +0 -6
  18. package/src/actions/types.js +0 -23
  19. package/src/analytics.js +0 -183
  20. package/src/apis/analyticsActions.js +0 -53
  21. package/src/apis/authActions.js +0 -58
  22. package/src/apis/fileActions.js +0 -152
  23. package/src/apis/index.js +0 -10
  24. package/src/apis/profileActions.js +0 -133
  25. package/src/apis/scheduledActionsActions.js +0 -12
  26. package/src/apis/stringActions.js +0 -25
  27. package/src/apis/templateActions.js +0 -41
  28. package/src/apis/typeActions.js +0 -186
  29. package/src/apis/userActions.js +0 -169
  30. package/src/apis/utilityActions.js +0 -35
  31. package/src/colours.js +0 -134
  32. package/src/components/AddButton.js +0 -27
  33. package/src/components/AnalyticsFilter.js +0 -115
  34. package/src/components/Attachment.js +0 -27
  35. package/src/components/AudienceIncluder.js +0 -175
  36. package/src/components/AudienceSelector.js +0 -700
  37. package/src/components/Button.js +0 -66
  38. package/src/components/CheckBox.js +0 -77
  39. package/src/components/ColourOptions.js +0 -197
  40. package/src/components/ColourPicker.js +0 -267
  41. package/src/components/Comment.js +0 -46
  42. package/src/components/CommentSection.js +0 -116
  43. package/src/components/DatePicker.js +0 -290
  44. package/src/components/DropdownInput.js +0 -223
  45. package/src/components/DurationInput.js +0 -51
  46. package/src/components/ExportCsvPopup.js +0 -222
  47. package/src/components/FileInput.js +0 -389
  48. package/src/components/GenericInput.js +0 -169
  49. package/src/components/Header.js +0 -82
  50. package/src/components/HubSidebar.js +0 -134
  51. package/src/components/ImageInput.js +0 -987
  52. package/src/components/InputGroup.js +0 -18
  53. package/src/components/MakerPopup.js +0 -310
  54. package/src/components/MoreMenu.js +0 -22
  55. package/src/components/OptionsSection.js +0 -84
  56. package/src/components/OverlayPage.js +0 -74
  57. package/src/components/OverlayPageBottomButtons.js +0 -48
  58. package/src/components/OverlayPageContents.js +0 -48
  59. package/src/components/OverlayPageSection.js +0 -38
  60. package/src/components/P60Icon.js +0 -40
  61. package/src/components/PageTitle.js +0 -13
  62. package/src/components/Popup.js +0 -104
  63. package/src/components/ProfilePic.js +0 -50
  64. package/src/components/RadioButton.js +0 -144
  65. package/src/components/Reactions.js +0 -77
  66. package/src/components/SVGIcon.js +0 -33
  67. package/src/components/SideNavItem.js +0 -98
  68. package/src/components/StatBox.js +0 -49
  69. package/src/components/StatusButton.js +0 -22
  70. package/src/components/SuccessPopup.js +0 -57
  71. package/src/components/Tabs.js +0 -56
  72. package/src/components/Tag.js +0 -62
  73. package/src/components/Text.js +0 -20
  74. package/src/components/TextFormatPopup.js +0 -54
  75. package/src/components/TimePicker.js +0 -225
  76. package/src/components/UserListing.js +0 -111
  77. package/src/components/index.js +0 -46
  78. package/src/components/svg-icons.json +0 -821
  79. package/src/config.js +0 -25
  80. package/src/helper/HelpDeskWidget.js +0 -16
  81. package/src/helper/api/getUrl.js +0 -15
  82. package/src/helper/api/getUrlParams.js +0 -9
  83. package/src/helper/api/safeReadParams.js +0 -6
  84. package/src/helper/auth/getUserFromState.js +0 -8
  85. package/src/helper/colours/getAppColourFromState.js +0 -10
  86. package/src/helper/files/canvasImageUploader.js +0 -159
  87. package/src/helper/files/generateImageName.js +0 -10
  88. package/src/helper/files/get1400.js +0 -32
  89. package/src/helper/files/getExtension.js +0 -9
  90. package/src/helper/files/getFileName.js +0 -13
  91. package/src/helper/files/getThumb300.js +0 -36
  92. package/src/helper/files/isVideo.js +0 -8
  93. package/src/helper/helper.js +0 -97
  94. package/src/helper/index.js +0 -44
  95. package/src/helper/site/getMerchantsFromState.js +0 -9
  96. package/src/helper/site/getSiteLevelFromState.js +0 -34
  97. package/src/helper/site/getSiteName.js +0 -16
  98. package/src/helper/site/getSiteNameFromRoles.js +0 -12
  99. package/src/helper/site/getSiteSettingFromState.js +0 -10
  100. package/src/helper/storage/readJSONFromStorage.js +0 -9
  101. package/src/helper/storage/readStorageWithCookie.js +0 -22
  102. package/src/helper/storage/setLocalStorage.js +0 -5
  103. package/src/helper/strings/getFirstName.js +0 -10
  104. package/src/helper/strings/htmlDecode.js +0 -4
  105. package/src/helper/strings/htmlEncode.js +0 -4
  106. package/src/helper/strings/isEmail.js +0 -11
  107. package/src/helper/strings/isUrl.js +0 -13
  108. package/src/helper/strings/onlyAlphanumeric.js +0 -8
  109. package/src/helper/strings/randomString.js +0 -10
  110. package/src/helper/strings/toParagraphed.js +0 -17
  111. package/src/index.js +0 -12
  112. package/src/reducers/ScheduledActionsReducer.js +0 -14
  113. package/src/reducers/TemplatesReducer.js +0 -29
  114. package/src/reducers/index.js +0 -7
  115. package/src/session.js +0 -289
  116. package/src/urls.js +0 -21
@@ -1,11 +0,0 @@
1
- import _ from 'lodash';
2
-
3
- const isEmail = (email) => {
4
- if (_.isEmpty(email)) return false;
5
- const atpos = email.indexOf('@');
6
- const dotpos = email.lastIndexOf('.');
7
- if (atpos < 1 || dotpos < atpos + 2 || dotpos + 2 >= email.length) return false;
8
- return true;
9
- };
10
-
11
- export default isEmail;
@@ -1,13 +0,0 @@
1
- import _ from 'lodash';
2
-
3
- const isUrl = (url) => {
4
- if (_.isEmpty(url)) return false;
5
-
6
- const dotpos = url.lastIndexOf('.');
7
- if (dotpos < 2 || dotpos + 2 >= url.length) {
8
- return false;
9
- }
10
- return true;
11
- };
12
-
13
- export default isUrl;
@@ -1,8 +0,0 @@
1
- const onlyAlphanumeric = (input) => {
2
- if (!input) {
3
- return input;
4
- }
5
- return input.replace(/[^a-z0-9]/gi, '');
6
- };
7
-
8
- export default onlyAlphanumeric;
@@ -1,10 +0,0 @@
1
- const randomString = () => {
2
- return 'xxxxxxxx4xxxyxxxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
3
- // eslint-disable-next-line
4
- var r = (Math.random() * 16) | 0,
5
- v = c === 'x' ? r : (r & 0x3) | 0x8;
6
- return v.toString(16);
7
- });
8
- };
9
-
10
- export default randomString;
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- import _ from 'lodash';
3
-
4
- const toParagraphed = (text, style) => {
5
- if (!text) return text;
6
- text = text.replace(/\t/g, '\u00a0\u00a0\u00a0\u00a0');
7
- const textSplit = text.split('\n');
8
- return _.map(textSplit, (t, i) => {
9
- return (
10
- <span key={`paragraph_${i}`} style={{ display: 'block', ...style }}>
11
- {t || '\u00A0'}
12
- </span>
13
- );
14
- });
15
- };
16
-
17
- export default toParagraphed;
package/src/index.js DELETED
@@ -1,12 +0,0 @@
1
- import Config from './config';
2
- import * as Session from './session';
3
- import * as Analytics from './analytics';
4
- import * as Helper from './helper';
5
- import * as Colours from './colours';
6
- import * as Actions from './actions';
7
- import * as Apis from './apis';
8
- import * as Components from './components';
9
- import { Urls } from './urls'
10
- import { Reducers } from './reducers';
11
-
12
- export { Config, Session, Analytics, Helper, Colours, Actions, Apis, Components, Reducers, Urls };
@@ -1,14 +0,0 @@
1
- import { SCHEDULED_ACTIONS_LOADED } from '../actions/types';
2
-
3
- const INITIAL_STATE = {
4
- list: [],
5
- };
6
-
7
- export default (state = INITIAL_STATE, action) => {
8
- switch (action.type) {
9
- case SCHEDULED_ACTIONS_LOADED:
10
- return { ...state, list: action.payload };
11
- default:
12
- return state;
13
- }
14
- };
@@ -1,29 +0,0 @@
1
- import _ from 'lodash';
2
-
3
- import { TEMPLATES_LOADED, TEMPLATE_REMOVED } from '../actions/types';
4
-
5
- const INITIAL_STATE = {
6
- list: [],
7
- };
8
-
9
- export default (state = INITIAL_STATE, action) => {
10
- switch (action.type) {
11
- case TEMPLATES_LOADED:
12
- const result = _.unionWith(action.payload, state.list, (v1, v2) => {
13
- return v1 != null && v2 != null && v1.RowId === v2.RowId;
14
- });
15
- return { ...state, list: result };
16
- case TEMPLATE_REMOVED:
17
- const index = _.findIndex(state.list, (app) => {
18
- return app != null && app.RowId === action.payload;
19
- });
20
- if (index > -1) {
21
- const newTemplates = [...state.list];
22
- newTemplates.splice(index, 1);
23
- return { ...state, list: newTemplates };
24
- }
25
- return state;
26
- default:
27
- return state;
28
- }
29
- };
@@ -1,7 +0,0 @@
1
- import TemplatesReducer from './TemplatesReducer';
2
- import ScheduledActionsReducer from './ScheduledActionsReducer';
3
-
4
- export const Reducers = {
5
- templates: TemplatesReducer,
6
- scheduledActions: ScheduledActionsReducer,
7
- };
package/src/session.js DELETED
@@ -1,289 +0,0 @@
1
- import _ from 'lodash';
2
- import axios from 'axios';
3
- import { Auth } from 'aws-amplify';
4
-
5
- export const getSessionTokenAWS = async (prefix) => {
6
- const data = await Auth.currentSession();
7
- const token = data.getAccessToken().getJwtToken();
8
- if (_.isUndefined(prefix)) return token;
9
- return `${prefix} ${token}`;
10
- };
11
-
12
- // export const getRefreshTokenAWS = async () => {
13
- // const data = await Auth.currentSession();
14
- // return data.getRefreshToken().token;
15
- // };
16
-
17
- export const authedFunction = async (request) => {
18
- try {
19
- const authkey = await getSessionTokenAWS();
20
-
21
- if (!request.headers) request.headers = {};
22
- request.headers.authkey = authkey;
23
-
24
- return await axios(request);
25
- } catch (error) {
26
- console.error('authedFunction error', error, request);
27
- throw error;
28
- }
29
- };
30
-
31
- export const unauthedFunction = (request) => {
32
- return axios(request);
33
- };
34
-
35
- export const getCurrentUserSub = async () => {
36
- try {
37
- const user = await Auth.currentUserInfo();
38
- return user.id;
39
- } catch (error) {
40
- return null;
41
- }
42
- };
43
-
44
- export const checkLoggedIn = async (self) => {
45
- try {
46
- const user = await Auth.currentAuthenticatedUser();
47
- if (_.isUndefined(user) || user == null || user.username == null) {
48
- console.log('redirecting to login');
49
- self.props.history.push('/login');
50
- }
51
- } catch (error) {
52
- if (error === 'not authenticated') {
53
- console.log('redirecting to logout');
54
- self.props.history.push('/logout');
55
- }
56
- }
57
- };
58
-
59
- // export const checkLogInScreen = (self, auth) => {
60
- // if (auth.auth) {
61
- // if (auth.auth === 'KIOSK') {
62
- // console.log('redirecting to tv');
63
- // self.props.history.push('/tv');
64
- // } else {
65
- // console.log('redirecting to mastermenu');
66
- // self.props.history.push('/mastermenu');
67
- // }
68
- // }
69
- // };
70
-
71
- // export const getAdminTypes = (additionalTypes) => {
72
- // if (!additionalTypes) {
73
- // additionalTypes = [];
74
- // }
75
- // return ['admin', 'master', 'villageStaff', ...additionalTypes];
76
- // };
77
-
78
- // export const isAdmin = (auth) => {
79
- // return isAuthed(auth, getAdminTypes(null));
80
- // };
81
-
82
- // export const isAdminMaster = (auth) => {
83
- // return auth.auth === 'master';
84
- // };
85
-
86
- // export const isAuthed = (auth, validTypes) => {
87
- // return _.some(validTypes, (type) => {
88
- // return type === auth.auth;
89
- // });
90
- // };
91
-
92
- export const isTheBest = (auth, isPlussSpaceMaster) => {
93
- if (auth && auth.user) {
94
- if (isPlussSpaceMaster) {
95
- // only plussSpace master
96
- return validateAccess('plussSpace', 'master', auth);
97
- }
98
- // any master
99
- return validateAccess('hq', 'master', auth);
100
- }
101
- return false;
102
- };
103
-
104
- // export const getRolesWithAccess = (roles, type) => {
105
- // return _.filter(roles, (role) => {
106
- // return role.type === 'master' || (!_.isEmpty(role.Permission) && _.includes(role.Permissions, type));
107
- // });
108
- // };
109
-
110
- // export const mapRolesToSites = (roles) => {
111
- // return _.sortBy(
112
- // roles.map((r) => {
113
- // return {
114
- // Id: r.site,
115
- // Key: r.site,
116
- // siteName: (r.siteInfo && r.siteInfo.siteName) || r.site,
117
- // Title: (r.siteInfo && r.siteInfo.siteName) || r.site,
118
- // };
119
- // }),
120
- // (r) => {
121
- // return r.siteName.toLowerCase();
122
- // },
123
- // );
124
- // };
125
-
126
- // export const getCurrentUserType = (auth) => {
127
- // if (!auth) {
128
- // return {};
129
- // }
130
- // const roles = auth && auth.user ? auth.user.Roles : [];
131
- // const role = _.find(roles, (r) => {
132
- // return r.site === auth.site;
133
- // });
134
- // if (!role) {
135
- // // catch for no role
136
- // return { typeName: auth.auth, displayName: auth.auth, site: auth.site };
137
- // }
138
- // const userType = _.find(auth.userTypes || [], (ut) => {
139
- // return ut.site === role.site && ut.typeName === role.type;
140
- // });
141
- // if (!userType) {
142
- // return { typeName: role.type, displayName: role.type, site: role.site };
143
- // }
144
- // return userType;
145
- // };
146
-
147
- export const validateAccess = (site, type, auth, noRole) => {
148
- const roles = auth && auth.user ? auth.user.Roles : [];
149
- if (_.isEmpty(roles)) return noRole;
150
- if (site === 'plussSpace' && type === 'master') {
151
- return _.some(roles, (r) => r.site === 'plussSpace' && r.type === 'master');
152
- }
153
- if (_.some(roles, (r) => r.type === 'master')) return true;
154
- const role = _.find(roles, (r) => r.site === site);
155
- if (!role) return false;
156
- if (type === 'any') return true;
157
- return !_.isEmpty(role.Permissions) && _.includes(role.Permissions, type);
158
- };
159
-
160
- export const getApiError = (error) => {
161
- try {
162
- const errorData = error.response.data;
163
- const errorMessage = errorData && errorData.error;
164
- return errorMessage || errorData || error;
165
- } catch (e) {
166
- return error;
167
- }
168
- };
169
-
170
- // export const getEnabledFeatures = (siteInfo, interfaces) => {
171
- // const interfaceSettings = !_.isEmpty(interfaces)
172
- // ? interfaces.map((t) => {
173
- // if (t.Type === 'TV') {
174
- // return t;
175
- // }
176
- // return t.Settings;
177
- // })
178
- // : [];
179
-
180
- // const siteSettings = siteInfo && siteInfo.Settings ? siteInfo.Settings : {};
181
- // const hidden = siteInfo && siteInfo.Hidden ? siteInfo.Hidden : [];
182
- // const notHidden = siteInfo && siteInfo.NotHidden ? siteInfo.NotHidden : [];
183
- // const defaultFeatures = ['users', 'alerts'];
184
- // let features = [...defaultFeatures];
185
- // if (siteSettings.TabSettings) {
186
- // interfaceSettings.push(siteSettings.TabSettings);
187
- // } else {
188
- // features = [...features, ...(siteSettings.HomeWidgets || ['events', 'news'])];
189
- // if (!_.includes(hidden, 'whatsOn')) {
190
- // // second tab is enabled - add features
191
- // features.push(siteSettings.MainWidget1 || 'events');
192
- // }
193
- // if (!_.includes(hidden, 'marketplace')) {
194
- // // third tab is enabled - add features
195
- // features = [...features, ...(siteSettings.Widgets2 || ['services', 'offers', 'facilities'])];
196
- // }
197
- // if (!_.includes(hidden, 'people')) {
198
- // // fourth tab is enabled - add features
199
- // features.push(siteSettings.MainWidget3 || 'people');
200
- // }
201
- // }
202
-
203
- // interfaceSettings.forEach((s) => {
204
- // if (!Array.isArray(s) && s.Type && s.Type === 'TV') {
205
- // // TV Views
206
- // features = [
207
- // ...features,
208
- // ...s.Settings.widgets.map((w) => {
209
- // return w.key;
210
- // }),
211
- // ];
212
- // } else {
213
- // // App Views
214
- // (s || []).forEach((t) => {
215
- // if (t.isEnabled) {
216
- // features = [...features, ...t.widgets];
217
- // }
218
- // });
219
- // }
220
- // });
221
-
222
- // if (
223
- // (siteSettings.TabSettings &&
224
- // _.some(siteSettings.TabSettings, (t) => {
225
- // return t.type === 'menu' && t.isEnabled;
226
- // })) ||
227
- // (!siteSettings.TabSettings && !_.includes(hidden, 'more'))
228
- // ) {
229
- // // more tab is enabled - add features
230
- // if (!_.includes(hidden, 'maintenanceRequest')) {
231
- // features.push('maintenance');
232
- // }
233
- // if (!_.includes(hidden, 'infoPages')) {
234
- // features.push('infoPages');
235
- // }
236
- // if (!_.includes(hidden, 'maps')) {
237
- // features.push('maps');
238
- // }
239
- // if (!_.includes(hidden, 'importantContacts')) {
240
- // features.push('importantContacts');
241
- // }
242
- // if (!_.includes(hidden, 'feedback')) {
243
- // features.push('feedback');
244
- // }
245
- // if (!_.includes(hidden, 'surveys')) {
246
- // features.push('surveys');
247
- // }
248
- // }
249
- // if (_.includes(notHidden, 'visitors')) {
250
- // features.push('visitors');
251
- // }
252
- // if (_.includes(features, 'services')) {
253
- // features.push('sponsors');
254
- // }
255
- // return _.uniq(features);
256
- // };
257
-
258
- // export const isFeatureEnabled = (features, key) => {
259
- // if (_.includes(features, key)) {
260
- // return true;
261
- // }
262
- // switch (key) {
263
- // case 'userManagement':
264
- // return _.includes(features, 'users');
265
- // case 'maintenanceTracking':
266
- // case 'maintenanceTypes':
267
- // return _.includes(features, 'maintenance');
268
- // case 'welcomePages':
269
- // return _.includes(features, 'news');
270
- // case 'polls':
271
- // return _.includes(features, 'surveys');
272
- // case 'terms':
273
- // return true;
274
- // default:
275
- // return false;
276
- // }
277
- // };
278
-
279
- export const isTVEnabled = (interfaces, feature) => {
280
- return _.some(interfaces, (t) => {
281
- return (
282
- t.Type === 'TV' &&
283
- (!feature ||
284
- _.some(t.Settings.widgets, (f) => {
285
- return f.key === feature;
286
- }))
287
- );
288
- });
289
- };
package/src/urls.js DELETED
@@ -1,21 +0,0 @@
1
- const HelpGuide = {
2
- Dashboard: 'https://www.plusscommunities.com/user-guide',
3
- FeaturePicker: 'https://www.plusscommunities.com/getting-started-on-community-manager',
4
- News: 'https://www.plusscommunities.com/news-feature',
5
- Events: 'https://www.plusscommunities.com/events-feature',
6
- Alerts: 'https://www.plusscommunities.com/alerts-feature',
7
- Gallery: 'https://www.plusscommunities.com/gallery-feature',
8
- Groups: 'https://www.plusscommunities.com/groups-feature',
9
- Maintenance: 'https://www.plusscommunities.com/maintenance-feature',
10
- Facilities: 'https://www.plusscommunities.com/facilities-feature',
11
- Services: 'https://www.plusscommunities.com/services-feature',
12
- Offers: 'https://www.plusscommunities.com/offers-feature',
13
- Survey: 'https://www.plusscommunities.com/surveys-feature',
14
- Information: 'https://www.plusscommunities.com/information-feature',
15
- Users: 'https://www.plusscommunities.com/managing-your-users',
16
- Payment: 'https://www.plusscommunities.com/setting-up-your-payment-gateway',
17
- };
18
-
19
- export const Urls = {
20
- HelpGuide,
21
- };