@plusscommunities/pluss-core-app 1.0.7 → 1.1.2

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 (47) hide show
  1. package/assets/icons/reactions/heart.png +0 -0
  2. package/assets/icons/reactions/party.png +0 -0
  3. package/assets/icons/reactions/sad.png +0 -0
  4. package/assets/icons/reactions/smile.png +0 -0
  5. package/package.json +6 -2
  6. package/src/actions/FollowerActions.js +40 -0
  7. package/src/actions/ResidentActions.js +29 -0
  8. package/src/actions/UserActions.js +221 -0
  9. package/src/actions/index.js +3 -0
  10. package/src/actions/types.js +8 -0
  11. package/src/apis/analyticsActions.js +20 -0
  12. package/src/apis/contactActions.js +23 -0
  13. package/src/apis/eventActions.js +147 -0
  14. package/src/apis/followerActions.js +32 -0
  15. package/src/apis/index.js +5 -0
  16. package/src/apis/reactionActions.js +23 -23
  17. package/src/apis/userActions.js +98 -0
  18. package/src/colours.js +6 -6
  19. package/src/components/BackButton.js +57 -0
  20. package/src/components/CategoryTabs.js +182 -0
  21. package/src/components/DropDownItem.js +73 -0
  22. package/src/components/DropDownMenu.js +37 -0
  23. package/src/components/FontScaleButton.js +38 -0
  24. package/src/components/FontScalePopup.js +73 -0
  25. package/src/components/FormattedText.js +131 -0
  26. package/src/components/ImageUploader.js +9 -20
  27. package/src/components/Input.js +187 -0
  28. package/src/components/PlussChat.js +885 -0
  29. package/src/components/PlussChatMessage.js +208 -0
  30. package/src/components/PlussChatTime.js +63 -0
  31. package/src/components/PositionedImage.js +260 -0
  32. package/src/components/Reaction.js +111 -0
  33. package/src/components/Reactions.js +75 -0
  34. package/src/components/StickyFooter.js +34 -0
  35. package/src/components/TextStyle.js +6 -1
  36. package/src/components/Toggle.js +84 -0
  37. package/src/components/TouchableSearchBar.js +62 -0
  38. package/src/components/UserListPopup.js +140 -0
  39. package/src/components/UserListing.js +262 -0
  40. package/src/components/WarningPopup.js +79 -0
  41. package/src/components/index.js +18 -0
  42. package/src/config.js +9 -1
  43. package/src/constants.js +24 -0
  44. package/src/helper.js +199 -29
  45. package/src/index.js +3 -1
  46. package/src/session.js +12 -12
  47. package/src/styles.js +33 -0
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@plusscommunities/pluss-core-app",
3
- "version": "1.0.7",
3
+ "version": "1.1.2",
4
4
  "description": "Core extension package for Pluss Communities platform",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
7
- "upload": "npm version patch && npm publish",
7
+ "upload": "npm version patch && npm publish --access public && rm -rf node_modules",
8
8
  "test": "echo \"Error: no test specified\" && exit 1"
9
9
  },
10
10
  "author": "Phillip Suh",
@@ -36,5 +36,9 @@
36
36
  "react-native-iphone-x-helper": "^1.3.1",
37
37
  "react-native-webview": "11.2.3",
38
38
  "react-redux": "^5.0.5"
39
+ },
40
+ "peerDependencies": {
41
+ "react-native-gifted-chat": "^0.16.3",
42
+ "axios": "^0.16.2"
39
43
  }
40
44
  }
@@ -0,0 +1,40 @@
1
+ import _ from 'lodash';
2
+ import { LOAD_FOLLOWERS, ADD_FOLLOWER, REMOVE_FOLLOWER } from './types';
3
+ import { followerActions } from '../apis/followerActions';
4
+
5
+ export const loadFollowers = followers => {
6
+ return {
7
+ type: LOAD_FOLLOWERS,
8
+ payload: followers,
9
+ };
10
+ };
11
+
12
+ export const getFollowers = userId => {
13
+ return async dispatch => {
14
+ followerActions
15
+ .getFollowing(userId)
16
+ .then(res => {
17
+ // console.log('getFollowing', res.data);
18
+ if (res.data != null && res.data.Items != null && !_.isEmpty(res.data.Items)) {
19
+ dispatch(loadFollowers(res.data.Items));
20
+ }
21
+ })
22
+ .catch(error => {
23
+ console.log('getFollowing', error);
24
+ });
25
+ };
26
+ };
27
+
28
+ export const addFollower = user => {
29
+ return {
30
+ type: ADD_FOLLOWER,
31
+ payload: user,
32
+ };
33
+ };
34
+
35
+ export const removeFollower = userId => {
36
+ return {
37
+ type: REMOVE_FOLLOWER,
38
+ payload: userId,
39
+ };
40
+ };
@@ -0,0 +1,29 @@
1
+ import { UPDATE_RESIDENTS, LOADED_RESIDENTS, LOADED_LINKED_USERS, LOADED_LINKED_TO_USERS } from './types';
2
+
3
+ export const updateResidents = userContact => {
4
+ return {
5
+ type: UPDATE_RESIDENTS,
6
+ payload: userContact,
7
+ };
8
+ };
9
+
10
+ export const residentsLoaded = list => {
11
+ return {
12
+ type: LOADED_RESIDENTS,
13
+ payload: list,
14
+ };
15
+ };
16
+
17
+ export const linkedUsersLoaded = linkedUsers => {
18
+ return {
19
+ type: LOADED_LINKED_USERS,
20
+ payload: linkedUsers,
21
+ };
22
+ };
23
+
24
+ export const linkedToUsersLoaded = linkedToUsers => {
25
+ return {
26
+ type: LOADED_LINKED_TO_USERS,
27
+ payload: linkedToUsers,
28
+ };
29
+ };
@@ -0,0 +1,221 @@
1
+ // import axios from 'axios';
2
+ import {
3
+ // SAVE_PROFILE_PIC_SUCCESS,
4
+ // SAVE_PROFILE_PIC_FAIL,
5
+ // ONBOARDING_UPDATE,
6
+ // HOME_ONBOARDING_UPDATE,
7
+ // USER_UPDATED,
8
+ UPDATE_USER_STATE,
9
+ // UPDATE_USER_STATE_FAIL,
10
+ } from './types';
11
+ // import { baseUrl } from '../config';
12
+ // import { userActions } from '../webapi';
13
+
14
+ // const ROOT_URL = baseUrl;
15
+
16
+ // export const updateProfilePic = uri => {
17
+ // return async dispatch => {
18
+ // let userID = null;
19
+ // let token = null;
20
+ // if (userID) {
21
+ // dispatch({
22
+ // type: SAVE_PROFILE_PIC_SUCCESS,
23
+ // payload: { profilePic: uri },
24
+ // });
25
+ // await axios({
26
+ // method: 'post',
27
+ // url: `${ROOT_URL}/updateProfilePic`,
28
+ // data: {
29
+ // uri,
30
+ // userID,
31
+ // },
32
+ // headers: {
33
+ // authorization: `Bearer ${token}`,
34
+ // },
35
+ // })
36
+ // .then(() => {
37
+ // dispatch({
38
+ // type: SAVE_PROFILE_PIC_SUCCESS,
39
+ // payload: { profilePic: uri },
40
+ // });
41
+ // })
42
+ // .catch(error => {
43
+ // console.log(error.response.data);
44
+ // dispatch({ type: SAVE_PROFILE_PIC_FAIL });
45
+ // });
46
+ // }
47
+ // };
48
+ // };
49
+
50
+ // export const updateUser = (input, callback) => {
51
+ // return async dispatch => {
52
+ // console.log('update User Action hit');
53
+ // dispatch({
54
+ // type: USER_UPDATED,
55
+ // payload: input,
56
+ // });
57
+ // };
58
+ // };
59
+
60
+ export const softUpdateUser = input => {
61
+ return {
62
+ type: UPDATE_USER_STATE,
63
+ payload: input,
64
+ };
65
+ };
66
+
67
+ export const updateNavRead = input => {
68
+ return async dispatch => {
69
+ setTimeout(() => {
70
+ dispatch({
71
+ type: UPDATE_USER_STATE,
72
+ payload: { openedNotifs: input },
73
+ });
74
+ }, 500);
75
+ };
76
+ };
77
+
78
+ /*
79
+ Update user data without triggering uploadingProfile or uploadingProfilePic
80
+ */
81
+ // export const silentUpdateUser = (input, immediate) => {
82
+ // return async dispatch => {
83
+ // if (immediate) {
84
+ // dispatch({
85
+ // type: UPDATE_USER_STATE,
86
+ // payload: input,
87
+ // });
88
+ // }
89
+ // userActions
90
+ // .updateProfile(input)
91
+ // .then(res => {
92
+ // if (res.data.userCreationFail) {
93
+ // console.log('user update failed', res.data.message);
94
+ // dispatch({
95
+ // type: UPDATE_USER_STATE_FAIL,
96
+ // payload: res.data.message,
97
+ // });
98
+ // } else {
99
+ // dispatch({
100
+ // type: UPDATE_USER_STATE,
101
+ // payload: input,
102
+ // });
103
+ // }
104
+ // })
105
+ // .catch(err => {
106
+ // console.log('user update fail -- Silent Upate', err);
107
+ // });
108
+ // };
109
+ // };
110
+
111
+ // export const seenOnboarding = () => {
112
+ // return async dispatch => {
113
+ // dispatch({ type: ONBOARDING_UPDATE });
114
+ // let userID = null;
115
+ // let token = null;
116
+ // if (userID) {
117
+ // await axios({
118
+ // method: 'post',
119
+ // url: `${ROOT_URL}/updateProfile`,
120
+ // data: {
121
+ // userID,
122
+ // details: {
123
+ // onBoardingSeen: true,
124
+ // },
125
+ // },
126
+ // headers: {
127
+ // authorization: `Bearer ${token}`,
128
+ // },
129
+ // })
130
+ // .then(() => {})
131
+ // .catch(() => {
132
+ // console.log('onBoarding update fail');
133
+ // });
134
+ // }
135
+ // };
136
+ // };
137
+
138
+ /*
139
+ Will combine this eventually with above function
140
+ */
141
+ // export const seenHomeOnboarding = () => {
142
+ // return async dispatch => {
143
+ // dispatch({ type: HOME_ONBOARDING_UPDATE });
144
+ // let userID = null;
145
+ // let token = null;
146
+ // if (userID) {
147
+ // await axios({
148
+ // method: 'post',
149
+ // url: `${ROOT_URL}/updateProfile`,
150
+ // data: {
151
+ // userID,
152
+ // details: {
153
+ // homeOnboardingSeen: true,
154
+ // },
155
+ // },
156
+ // headers: {
157
+ // authorization: `Bearer ${token}`,
158
+ // },
159
+ // })
160
+ // .then(() => {})
161
+ // .catch(() => {
162
+ // console.log('onBoarding update fail');
163
+ // });
164
+ // }
165
+ // };
166
+ // };
167
+
168
+ /*
169
+ Triggered at app startup for saving user current home takeover.
170
+ */
171
+ // export const updateUserStartupTakeover = async input => {
172
+ // let userID = null;
173
+ // let token = null;
174
+ // if (userID) {
175
+ // await axios({
176
+ // method: 'post',
177
+ // url: `${ROOT_URL}/updateProfile`,
178
+ // data: {
179
+ // userID,
180
+ // details: input,
181
+ // },
182
+ // headers: {
183
+ // authorization: `Bearer ${token}`,
184
+ // },
185
+ // })
186
+ // .then(() => {})
187
+ // .catch(() => {
188
+ // console.log('startup takeover save fail -- Update User Startup Takeover');
189
+ // });
190
+ // }
191
+ // };
192
+
193
+ // export const registerStandaloneUser = takeover => {
194
+ // return async dispatch => {
195
+ // let userObj = null;
196
+ // if (userObj && takeover) {
197
+ // await axios({
198
+ // method: 'post',
199
+ // url: `${ROOT_URL}/registerStandaloneUser`,
200
+ // data: {
201
+ // userObj,
202
+ // takeoverKey: takeover.Key,
203
+ // },
204
+ // headers: {
205
+ // authorization: 'Gweg',
206
+ // },
207
+ // })
208
+ // .then(() => {
209
+ // dispatch({
210
+ // type: UPDATE_USER_STATE,
211
+ // payload: { standaloneRegistered: true },
212
+ // });
213
+ // })
214
+ // .catch(() => {
215
+ // console.log('register standalone user -- fail');
216
+ // });
217
+ // } else {
218
+ // console.log('Failed to detect user for takeover registration');
219
+ // }
220
+ // };
221
+ // };
@@ -1 +1,4 @@
1
1
  export * from './MediaActions';
2
+ export * from './FollowerActions';
3
+ export * from './ResidentActions';
4
+ export * from './UserActions';
@@ -3,3 +3,11 @@ export const CHANGE_ROLE = 'CHANGE_ROLE';
3
3
  export const IMAGE_LIBRARY_LOADED = 'IMAGE_LIBRARY_LOADED';
4
4
  export const STOCK_IMAGES_LOADED = 'STOCK_IMAGES_LOADED';
5
5
  export const IMAGE_FOLDER_UPDATED = 'IMAGE_FOLDER_UPDATED';
6
+ export const LOAD_FOLLOWERS = 'LOAD_FOLLOWERS';
7
+ export const ADD_FOLLOWER = 'ADD_FOLLOWER';
8
+ export const REMOVE_FOLLOWER = 'REMOVE_FOLLOWER';
9
+ export const UPDATE_RESIDENTS = 'UPDATE_RESIDENTS';
10
+ export const LOADED_RESIDENTS = 'LOADED_RESIDENTS';
11
+ export const LOADED_LINKED_USERS = 'LOADED_LINKED_USERS';
12
+ export const LOADED_LINKED_TO_USERS = 'LOADED_LINKED_TO_USERS';
13
+ export const UPDATE_USER_STATE = 'UPDATE_USER_STATE';
@@ -0,0 +1,20 @@
1
+ import { getUrl } from '../helper';
2
+ import { authedFunction } from '../session';
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
+ }).catch(error => {
17
+ console.log('log error', error);
18
+ });
19
+ },
20
+ };
@@ -0,0 +1,23 @@
1
+ import { getUrl } from '../helper';
2
+ import { authedFunction } from '../session';
3
+
4
+ export const contactActions = {
5
+ getSiteResidents: async site => {
6
+ return authedFunction({
7
+ method: 'POST',
8
+ url: getUrl('users', 'getexp'),
9
+ data: { site },
10
+ });
11
+ },
12
+ getSingleExpoResidents: async id => {
13
+ return authedFunction({
14
+ method: 'POST',
15
+ url: getUrl('users', 'getexpsingle'),
16
+ data: { id },
17
+ });
18
+ },
19
+ syncContacts: async (userKey, contacts) => {
20
+ // deprecated
21
+ return null;
22
+ },
23
+ };
@@ -0,0 +1,147 @@
1
+ import { getUrl, getAuthTokenHeader } from '../helper';
2
+ import { authedFunction } from '../session';
3
+
4
+ export const eventActions = {
5
+ addEvent: data => {
6
+ const request = {
7
+ method: 'POST',
8
+ url: getUrl('events', 'add'),
9
+ data: {
10
+ event: data,
11
+ },
12
+ };
13
+ return authedFunction(request);
14
+ },
15
+ getEvents: (site, time) => {
16
+ const query = {
17
+ site,
18
+ };
19
+ if (time) {
20
+ query.time = time;
21
+ }
22
+ return authedFunction({
23
+ method: 'GET',
24
+ url: getUrl('events', 'get', query),
25
+ });
26
+ },
27
+ getEvent: (site, id) => {
28
+ const query = {
29
+ site,
30
+ };
31
+ return authedFunction({
32
+ method: 'GET',
33
+ url: getUrl('events', `get/${id}`, query),
34
+ });
35
+ },
36
+ getEventReps: (site, eventId) => {
37
+ return authedFunction({
38
+ method: 'GET',
39
+ url: getUrl('eventreps', 'get', { site, eventId }),
40
+ });
41
+ },
42
+ getUserEventReps: async time => {
43
+ const request = {
44
+ method: 'GET',
45
+ url: getUrl('usereventreps', 'get', time ? { time } : null),
46
+ headers: {},
47
+ };
48
+ request.headers.authorization = await getAuthTokenHeader();
49
+ return authedFunction(request);
50
+ },
51
+ getUpcomingUserEventReps: async (userId, time) => {
52
+ const request = {
53
+ method: 'GET',
54
+ url: getUrl('usereventreps', 'getupcoming', { userId, time }),
55
+ headers: {},
56
+ };
57
+ return authedFunction(request);
58
+ },
59
+ getSubmissions: async site => {
60
+ return authedFunction({
61
+ method: 'GET',
62
+ url: getUrl('events', 'submissions/get', { site }),
63
+ });
64
+ },
65
+ handleEventSubmission: (site, id, action) => {
66
+ return authedFunction({
67
+ method: 'POST',
68
+ url: getUrl('events', 'submissions/handle'),
69
+ data: {
70
+ site,
71
+ id,
72
+ action,
73
+ },
74
+ });
75
+ },
76
+ getEventInvites: async () => {
77
+ const request = {
78
+ method: 'GET',
79
+ url: getUrl('eventinvites', 'get'),
80
+ headers: {},
81
+ };
82
+ request.headers.authorization = await getAuthTokenHeader();
83
+ return authedFunction(request);
84
+ },
85
+ registerForEvent: async (site, userID, eventId, repId, count, notes, waitlistCount, user) => {
86
+ const request = {
87
+ method: 'POST',
88
+ url: getUrl('eventreps', 'register'),
89
+ data: {
90
+ userID,
91
+ eventId,
92
+ repId,
93
+ site,
94
+ count,
95
+ notes,
96
+ waitlistCount,
97
+ user,
98
+ },
99
+ };
100
+ return authedFunction(request);
101
+ },
102
+ removeEventAttendee: async (site, userID, eventId, repId) => {
103
+ const request = {
104
+ method: 'POST',
105
+ url: getUrl('eventreps', 'remove'),
106
+ data: {
107
+ site,
108
+ userID,
109
+ eventId,
110
+ repId,
111
+ },
112
+ headers: {},
113
+ };
114
+ request.headers.authorization = await getAuthTokenHeader();
115
+ return authedFunction(request);
116
+ },
117
+ addEventFeedback: async (site, userID, eventId, repId, feedback, rating) => {
118
+ // deprecated
119
+ return null;
120
+ },
121
+ sendEventInvite: async (site, userID, inviteId, eventId, repId) => {
122
+ const request = {
123
+ method: 'POST',
124
+ url: getUrl('eventinvites', 'send'),
125
+ data: {
126
+ site,
127
+ userID,
128
+ inviteId,
129
+ eventId,
130
+ repId,
131
+ },
132
+ headers: {},
133
+ };
134
+ request.headers.authorization = await getAuthTokenHeader();
135
+ return authedFunction(request);
136
+ },
137
+ removeEventInvite: async (userID, site, eventId, repId) => {
138
+ const request = {
139
+ method: 'POST',
140
+ url: getUrl('eventinvites', 'remove'),
141
+ data: { site, eventId, repId },
142
+ headers: {},
143
+ };
144
+ request.headers.authorization = await getAuthTokenHeader();
145
+ return authedFunction(request);
146
+ },
147
+ };
@@ -0,0 +1,32 @@
1
+ import { getUrl, getAuthTokenHeader } from '../helper';
2
+ import { authedFunction } from '../session';
3
+
4
+ export const followerActions = {
5
+ addFollower: async (contact, userID) => {
6
+ const request = {
7
+ method: 'POST',
8
+ url: getUrl('followers', 'addFollower'),
9
+ data: { contact, userID },
10
+ headers: {},
11
+ };
12
+ request.headers.authorization = await getAuthTokenHeader();
13
+ return authedFunction(request);
14
+ },
15
+ removeFollower: async (contactID, userID) => {
16
+ const request = {
17
+ method: 'POST',
18
+ url: getUrl('followers', 'removeFollower'),
19
+ data: { contactID, userID },
20
+ headers: {},
21
+ };
22
+ request.headers.authorization = await getAuthTokenHeader();
23
+ return authedFunction(request);
24
+ },
25
+ getFollowing: async () => {
26
+ const request = {
27
+ method: 'GET',
28
+ url: getUrl('followers', 'getFollowing'),
29
+ };
30
+ return authedFunction(request);
31
+ },
32
+ };
package/src/apis/index.js CHANGED
@@ -1,2 +1,7 @@
1
1
  export * from './reactionActions';
2
2
  export * from './fileActions';
3
+ export * from './followerActions';
4
+ export * from './contactActions';
5
+ export * from './eventActions';
6
+ export * from './analyticsActions';
7
+ export { default as userActions } from './userActions';
@@ -3,29 +3,29 @@ import { getUrl } from '../helper';
3
3
  import { authedFunction } from '../session';
4
4
 
5
5
  export const reactionActions = {
6
- // add: (entityId, entityType, reaction, site) => {
7
- // return authedFunction({
8
- // method: 'POST',
9
- // url: getUrl('reactions', 'add'),
10
- // data: {
11
- // entityId,
12
- // entityType,
13
- // reaction,
14
- // site,
15
- // },
16
- // });
17
- // },
18
- // remove: (entityId, entityType, reaction) => {
19
- // return authedFunction({
20
- // method: 'POST',
21
- // url: getUrl('reactions', 'remove'),
22
- // data: {
23
- // entityId,
24
- // entityType,
25
- // reaction,
26
- // },
27
- // });
28
- // },
6
+ add: (entityId, entityType, reaction, site) => {
7
+ return authedFunction({
8
+ method: 'POST',
9
+ url: getUrl('reactions', 'add'),
10
+ data: {
11
+ entityId,
12
+ entityType,
13
+ reaction,
14
+ site,
15
+ },
16
+ });
17
+ },
18
+ remove: (entityId, entityType, reaction) => {
19
+ return authedFunction({
20
+ method: 'POST',
21
+ url: getUrl('reactions', 'remove'),
22
+ data: {
23
+ entityId,
24
+ entityType,
25
+ reaction,
26
+ },
27
+ });
28
+ },
29
29
  addComment: (entityId, entityType, site, comment, image) => {
30
30
  const data = {
31
31
  entityId,