@plusscommunities/pluss-core-app 1.4.8 → 1.5.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 (186) hide show
  1. package/dist/module/actions/FollowerActions.js +34 -0
  2. package/dist/module/actions/FollowerActions.js.map +1 -0
  3. package/dist/module/actions/MediaActions.js +20 -0
  4. package/dist/module/actions/MediaActions.js.map +1 -0
  5. package/dist/module/actions/ResidentActions.js +26 -0
  6. package/dist/module/actions/ResidentActions.js.map +1 -0
  7. package/dist/module/actions/UserActions.js +214 -0
  8. package/dist/module/actions/UserActions.js.map +1 -0
  9. package/dist/module/actions/index.js +5 -0
  10. package/dist/module/actions/index.js.map +1 -0
  11. package/dist/module/actions/types.js +14 -0
  12. package/dist/module/actions/types.js.map +1 -0
  13. package/dist/module/apis/analyticsActions.js +20 -0
  14. package/dist/module/apis/analyticsActions.js.map +1 -0
  15. package/dist/module/apis/contactActions.js +27 -0
  16. package/dist/module/apis/contactActions.js.map +1 -0
  17. package/dist/module/apis/eventActions.js +163 -0
  18. package/dist/module/apis/eventActions.js.map +1 -0
  19. package/dist/module/apis/fileActions.js +96 -0
  20. package/dist/module/apis/fileActions.js.map +1 -0
  21. package/dist/module/apis/followerActions.js +38 -0
  22. package/dist/module/apis/followerActions.js.map +1 -0
  23. package/dist/module/apis/index.js +11 -0
  24. package/dist/module/apis/index.js.map +1 -0
  25. package/dist/module/apis/notificationActions.js +60 -0
  26. package/dist/module/apis/notificationActions.js.map +1 -0
  27. package/dist/module/apis/profileActions.js +14 -0
  28. package/dist/module/apis/profileActions.js.map +1 -0
  29. package/dist/module/apis/reactionActions.js +78 -0
  30. package/dist/module/apis/reactionActions.js.map +1 -0
  31. package/dist/module/apis/typeActions.js +15 -0
  32. package/dist/module/apis/typeActions.js.map +1 -0
  33. package/dist/module/apis/userActions.js +104 -0
  34. package/dist/module/apis/userActions.js.map +1 -0
  35. package/{assets → dist/module/assets}/icons/reactions/heart.png +0 -0
  36. package/{assets → dist/module/assets}/icons/reactions/party.png +0 -0
  37. package/{assets → dist/module/assets}/icons/reactions/sad.png +0 -0
  38. package/{assets → dist/module/assets}/icons/reactions/smile.png +0 -0
  39. package/dist/module/colours.js +149 -0
  40. package/dist/module/colours.js.map +1 -0
  41. package/dist/module/components/AddButton.js +45 -0
  42. package/dist/module/components/AddButton.js.map +1 -0
  43. package/dist/module/components/Attachment.js +59 -0
  44. package/dist/module/components/Attachment.js.map +1 -0
  45. package/dist/module/components/AudienceSelectorLauncher.js +70 -0
  46. package/dist/module/components/AudienceSelectorLauncher.js.map +1 -0
  47. package/dist/module/components/AudienceSelectorPage.js +376 -0
  48. package/dist/module/components/AudienceSelectorPage.js.map +1 -0
  49. package/dist/module/components/BackButton.js +62 -0
  50. package/dist/module/components/BackButton.js.map +1 -0
  51. package/dist/module/components/CategoryTabs.js +171 -0
  52. package/dist/module/components/CategoryTabs.js.map +1 -0
  53. package/dist/module/components/CommentReply.js +363 -0
  54. package/dist/module/components/CommentReply.js.map +1 -0
  55. package/dist/module/components/CommentSection.js +785 -0
  56. package/dist/module/components/CommentSection.js.map +1 -0
  57. package/dist/module/components/ConfirmPopup.js +85 -0
  58. package/dist/module/components/ConfirmPopup.js.map +1 -0
  59. package/dist/module/components/ConfirmationPopup.js +77 -0
  60. package/dist/module/components/ConfirmationPopup.js.map +1 -0
  61. package/dist/module/components/DropDownItem.js +82 -0
  62. package/dist/module/components/DropDownItem.js.map +1 -0
  63. package/dist/module/components/DropDownMenu.js +46 -0
  64. package/dist/module/components/DropDownMenu.js.map +1 -0
  65. package/dist/module/components/EmptyStateMain.js +50 -0
  66. package/dist/module/components/EmptyStateMain.js.map +1 -0
  67. package/dist/module/components/EmptyStateWidget.js +52 -0
  68. package/dist/module/components/EmptyStateWidget.js.map +1 -0
  69. package/dist/module/components/FontScaleButton.js +37 -0
  70. package/dist/module/components/FontScaleButton.js.map +1 -0
  71. package/dist/module/components/FontScalePopup.js +77 -0
  72. package/dist/module/components/FontScalePopup.js.map +1 -0
  73. package/dist/module/components/FormCard.js +28 -0
  74. package/dist/module/components/FormCard.js.map +1 -0
  75. package/dist/module/components/FormCardSection.js +240 -0
  76. package/dist/module/components/FormCardSection.js.map +1 -0
  77. package/dist/module/components/FormCardSectionOptionLauncher.js +77 -0
  78. package/dist/module/components/FormCardSectionOptionLauncher.js.map +1 -0
  79. package/dist/module/components/FormattedText.js +145 -0
  80. package/dist/module/components/FormattedText.js.map +1 -0
  81. package/dist/module/components/GenericInput.js +161 -0
  82. package/dist/module/components/GenericInput.js.map +1 -0
  83. package/dist/module/components/GenericInputSection.js +174 -0
  84. package/dist/module/components/GenericInputSection.js.map +1 -0
  85. package/dist/module/components/Header.js +491 -0
  86. package/dist/module/components/Header.js.map +1 -0
  87. package/dist/module/components/ImagePopup.js +257 -0
  88. package/dist/module/components/ImagePopup.js.map +1 -0
  89. package/dist/module/components/ImageUploadProgress.js +72 -0
  90. package/dist/module/components/ImageUploadProgress.js.map +1 -0
  91. package/dist/module/components/ImageUploader.js +850 -0
  92. package/dist/module/components/ImageUploader.js.map +1 -0
  93. package/dist/module/components/InlineButton.js +72 -0
  94. package/dist/module/components/InlineButton.js.map +1 -0
  95. package/dist/module/components/Input.js +164 -0
  96. package/dist/module/components/Input.js.map +1 -0
  97. package/dist/module/components/LoadingCircles.js +224 -0
  98. package/dist/module/components/LoadingCircles.js.map +1 -0
  99. package/dist/module/components/LoadingIndicator.js +95 -0
  100. package/dist/module/components/LoadingIndicator.js.map +1 -0
  101. package/dist/module/components/LoadingStateWidget.js +51 -0
  102. package/dist/module/components/LoadingStateWidget.js.map +1 -0
  103. package/dist/module/components/MediaPlayer.js +453 -0
  104. package/dist/module/components/MediaPlayer.js.map +1 -0
  105. package/dist/module/components/MiddlePopup.js +46 -0
  106. package/dist/module/components/MiddlePopup.js.map +1 -0
  107. package/dist/module/components/PDFPopup.js +188 -0
  108. package/dist/module/components/PDFPopup.js.map +1 -0
  109. package/dist/module/components/PlussChat.js +997 -0
  110. package/dist/module/components/PlussChat.js.map +1 -0
  111. package/dist/module/components/PlussChatMessage.js +204 -0
  112. package/dist/module/components/PlussChatMessage.js.map +1 -0
  113. package/dist/module/components/PlussChatTime.js +66 -0
  114. package/dist/module/components/PlussChatTime.js.map +1 -0
  115. package/dist/module/components/Popup.js +138 -0
  116. package/dist/module/components/Popup.js.map +1 -0
  117. package/dist/module/components/PopupMenu.js +128 -0
  118. package/dist/module/components/PopupMenu.js.map +1 -0
  119. package/dist/module/components/PositionedImage.js +333 -0
  120. package/dist/module/components/PositionedImage.js.map +1 -0
  121. package/dist/module/components/ProfilePic.js +119 -0
  122. package/dist/module/components/ProfilePic.js.map +1 -0
  123. package/dist/module/components/RadioButton.js +84 -0
  124. package/dist/module/components/RadioButton.js.map +1 -0
  125. package/dist/module/components/Reaction.js +129 -0
  126. package/dist/module/components/Reaction.js.map +1 -0
  127. package/dist/module/components/Reactions.js +84 -0
  128. package/dist/module/components/Reactions.js.map +1 -0
  129. package/dist/module/components/SharingTools.js +162 -0
  130. package/dist/module/components/SharingTools.js.map +1 -0
  131. package/dist/module/components/Spinner.js +25 -0
  132. package/dist/module/components/Spinner.js.map +1 -0
  133. package/dist/module/components/StickyFooter.js +37 -0
  134. package/dist/module/components/StickyFooter.js.map +1 -0
  135. package/dist/module/components/TextStyle.js +34 -0
  136. package/dist/module/components/TextStyle.js.map +1 -0
  137. package/dist/module/components/Toggle.js +70 -0
  138. package/dist/module/components/Toggle.js.map +1 -0
  139. package/dist/module/components/TouchableSearchBar.js +73 -0
  140. package/dist/module/components/TouchableSearchBar.js.map +1 -0
  141. package/dist/module/components/UserListPopup.js +146 -0
  142. package/dist/module/components/UserListPopup.js.map +1 -0
  143. package/dist/module/components/UserListing.js +291 -0
  144. package/dist/module/components/UserListing.js.map +1 -0
  145. package/dist/module/components/VideoPopup.js +123 -0
  146. package/dist/module/components/VideoPopup.js.map +1 -0
  147. package/dist/module/components/WarningPopup.js +87 -0
  148. package/dist/module/components/WarningPopup.js.map +1 -0
  149. package/dist/module/components/expo-image-picker-multiple/ImageBrowser.js +325 -0
  150. package/dist/module/components/expo-image-picker-multiple/ImageBrowser.js.map +1 -0
  151. package/dist/module/components/expo-image-picker-multiple/ImageTile.js +123 -0
  152. package/dist/module/components/expo-image-picker-multiple/ImageTile.js.map +1 -0
  153. package/dist/module/components/index.js +53 -0
  154. package/dist/module/components/index.js.map +1 -0
  155. package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js +416 -0
  156. package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js.map +1 -0
  157. package/dist/module/components/react-native-expo-image-cropper/ImageCropOverlay.js +405 -0
  158. package/dist/module/components/react-native-expo-image-cropper/ImageCropOverlay.js.map +1 -0
  159. package/dist/module/config.js +27 -0
  160. package/dist/module/config.js.map +1 -0
  161. package/dist/module/constants.js +16 -0
  162. package/dist/module/constants.js.map +1 -0
  163. package/dist/module/fonts/index.js +2 -0
  164. package/dist/module/fonts/index.js.map +1 -0
  165. package/dist/module/fonts/pluss60-icons.js +5 -0
  166. package/dist/module/fonts/pluss60-icons.js.map +1 -0
  167. package/dist/module/fonts/pluss60-icons.json +1097 -0
  168. package/dist/module/helper.js +436 -0
  169. package/dist/module/helper.js.map +1 -0
  170. package/dist/module/index.js +13 -0
  171. package/dist/module/index.js.map +1 -0
  172. package/dist/module/session.js +54 -0
  173. package/dist/module/session.js.map +1 -0
  174. package/dist/module/styles.js +67 -0
  175. package/dist/module/styles.js.map +1 -0
  176. package/package.json +24 -7
  177. package/src/assets/icons/reactions/heart.png +0 -0
  178. package/src/assets/icons/reactions/party.png +0 -0
  179. package/src/assets/icons/reactions/sad.png +0 -0
  180. package/src/assets/icons/reactions/smile.png +0 -0
  181. package/src/components/CommentReply.js +3 -5
  182. package/src/components/CommentSection.js +4 -4
  183. package/src/components/MediaPlayer.js +14 -4
  184. package/src/components/VideoPopup.js +1 -1
  185. package/src/constants.js +4 -4
  186. package/src/helper.js +4 -4
@@ -0,0 +1,436 @@
1
+ import _ from 'lodash';
2
+ import { Platform, StatusBar, Dimensions } from 'react-native';
3
+ import Constants from 'expo-constants';
4
+ import Config from './config';
5
+ import { LINEGREY } from './colours';
6
+ import { getSessionTokenAWS } from './session';
7
+ const TIMESTAMP_FORMAT = 'D MMM • h:mma';
8
+ const DATE_FORMAT = 'D MMM YYYY';
9
+
10
+ const getUrl = (baseAction, action, query) => {
11
+ const {
12
+ baseAPIUrl,
13
+ baseStage
14
+ } = Config.env;
15
+ let queryPart = '';
16
+
17
+ if (query) {
18
+ _.keys(query).forEach((key, index) => {
19
+ queryPart += `${index === 0 ? '?' : '&'}${key}=${encodeURIComponent(query[key])}`;
20
+ });
21
+ }
22
+
23
+ return `${baseAPIUrl}/${baseAction}-${baseStage}/${action}${queryPart}`;
24
+ };
25
+
26
+ const getAuthTokenHeader = () => {
27
+ return new Promise((resolve, reject) => {
28
+ getSessionTokenAWS().then(idToken => {
29
+ resolve(`Bearer ${idToken}`);
30
+ });
31
+ });
32
+ };
33
+
34
+ const getShadowStyle = () => {
35
+ if (Platform.OS === 'ios') {
36
+ return {
37
+ shadowColor: '#000',
38
+ shadowOffset: {
39
+ width: 0,
40
+ height: 1
41
+ },
42
+ shadowOpacity: 0.1,
43
+ shadowRadius: 3,
44
+ backgroundColor: '#fff'
45
+ };
46
+ }
47
+
48
+ return {
49
+ borderColor: LINEGREY,
50
+ backgroundColor: '#fff',
51
+ elevation: 8
52
+ };
53
+ };
54
+
55
+ const StatusBarHeight = size => {
56
+ return getStatusBarHeight() + size;
57
+ };
58
+
59
+ const getStatusBarHeight = () => {
60
+ return Platform.OS === 'ios' ? Constants.statusBarHeight : StatusBar.currentHeight;
61
+ };
62
+
63
+ const getSiteSettingFromState = (state, key, defaultValue) => {
64
+ if (state && state.user && state.user.siteSettings && !_.isUndefined(state.user.siteSettings[key])) {
65
+ return state.user.siteSettings[key];
66
+ }
67
+
68
+ return defaultValue || null;
69
+ };
70
+
71
+ const getValueOrDefault = (value, def) => {
72
+ return !_.isUndefined(value) ? value : def;
73
+ };
74
+
75
+ const getExtension = url => {
76
+ if (!url) {
77
+ return null;
78
+ }
79
+
80
+ const fileSplit = url.split('.');
81
+ return fileSplit[fileSplit.length - 1].toLowerCase();
82
+ };
83
+
84
+ const getFileName = (url, noExtension) => {
85
+ if (!url) {
86
+ return null;
87
+ }
88
+
89
+ const fileSplit = url.split('/');
90
+ const name = fileSplit[fileSplit.length - 1].toLowerCase();
91
+
92
+ if (!noExtension) {
93
+ return name;
94
+ }
95
+
96
+ return name.split('.')[0];
97
+ };
98
+
99
+ const isVideo = url => {
100
+ const extension = getExtension(url);
101
+ return ['mov', 'mp4'].includes(extension);
102
+ };
103
+
104
+ const isVideoUrl = url => {
105
+ const urlToCheck = getValidUrl(url);
106
+
107
+ if (isVideo(urlToCheck)) {
108
+ return true;
109
+ }
110
+
111
+ if (isYoutube(urlToCheck)) {
112
+ return true;
113
+ }
114
+
115
+ if (isVimeo(urlToCheck)) {
116
+ return true;
117
+ }
118
+
119
+ return false;
120
+ };
121
+
122
+ const isStockImage = url => {
123
+ return url.indexOf('https://pluss60-dev-uploads.s3.ap-southeast-2.amazonaws.com/uploads/library') !== -1;
124
+ };
125
+
126
+ const getThumb300 = url => {
127
+ if (!url) {
128
+ return url;
129
+ }
130
+
131
+ if (url.indexOf('https://plussprdstorage.blob.core.windows.net/') !== -1) {
132
+ return url.replace('https://plussprdstorage.blob.core.windows.net/', 'https://plusscdn.azureedge.net/');
133
+ }
134
+
135
+ if (url.indexOf('https://plusscdn.azureedge.net/') !== -1) {
136
+ return url.replace('/uploads/', '/uploads-thumb/').replace('/general/', '/general300/').replace('/uploads1400/', '/uploads-thumb/').replace('/general1400/', '/general300/');
137
+ }
138
+
139
+ if (isStockImage(url) || url.indexOf(Config.env.baseUploadsUrl) !== -1) {
140
+ const extension = getExtension(url);
141
+ let urlToUse = url;
142
+
143
+ if (extension !== 'jpg') {
144
+ urlToUse = `${url.substring(0, url.length - extension.length)}jpg`;
145
+ }
146
+
147
+ return urlToUse.replace('/1400/', '/thumb300/').replace('/uploads/', '/thumb300/');
148
+ }
149
+
150
+ return url;
151
+ };
152
+
153
+ const get1400 = url => {
154
+ if (!url) {
155
+ return url;
156
+ }
157
+
158
+ if (url.indexOf('https://plussprdstorage.blob.core.windows.net/') !== -1) {
159
+ return url.replace('https://plussprdstorage.blob.core.windows.net/', 'https://plusscdn.azureedge.net/');
160
+ }
161
+
162
+ if (url.indexOf('https://plusscdn.azureedge.net/') !== -1) {
163
+ return url.replace('/uploads/', '/uploads1400/').replace('/general/', '/general1400/');
164
+ }
165
+
166
+ if (isStockImage(url) || url.indexOf(Config.env.baseUploadsUrl) !== -1) {
167
+ const extension = getExtension(url);
168
+ let urlToUse = url;
169
+
170
+ if (extension !== 'jpg') {
171
+ urlToUse = `${url.substring(0, url.length - extension.length)}jpg`;
172
+ }
173
+
174
+ return urlToUse.replace('/uploads/', '/1400/');
175
+ }
176
+
177
+ return url;
178
+ };
179
+
180
+ const getMimeType = url => {
181
+ const extension = getExtension(url);
182
+
183
+ switch (extension) {
184
+ case 'mov':
185
+ return 'video/quicktime';
186
+
187
+ case 'mp4':
188
+ return 'video/mp4';
189
+
190
+ default:
191
+ return 'image/jpeg';
192
+ }
193
+ };
194
+
195
+ const getCompressed = url => {
196
+ if (!url || typeof url !== 'string') return '';
197
+ return url.replace('/uploads/', '/compressed/');
198
+ };
199
+
200
+ const imageExists = url => {
201
+ return new Promise(resolve => {
202
+ fetch(url, {
203
+ method: 'HEAD',
204
+ cache: 'no-cache'
205
+ }).then(response => {
206
+ resolve(response.status === 200);
207
+ }).catch(() => {
208
+ resolve(false);
209
+ });
210
+ });
211
+ };
212
+
213
+ const getPluralS = count => {
214
+ return count === 1 ? '' : 's';
215
+ };
216
+
217
+ const getPluralOptions = (count, singular, plural) => {
218
+ if (count === 1) {
219
+ return singular;
220
+ }
221
+
222
+ return plural;
223
+ };
224
+
225
+ const randomString = function () {
226
+ let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
227
+ return `xxxxxxxx4xxxyxxxxxxxxxxxxx${name}`.replace(/[xy]/g, c => {
228
+ // eslint-disable-next-line
229
+ var r = Math.random() * 16 | 0,
230
+ v = c === 'x' ? r : r & 0x3 | 0x8;
231
+ return v.toString(16);
232
+ });
233
+ };
234
+
235
+ const generateImageName = (name, source) => {
236
+ let result = randomString(name);
237
+
238
+ if (source) {
239
+ result += `.${_.last(source.split('.'))}`;
240
+ }
241
+
242
+ return result;
243
+ };
244
+
245
+ const getSite = site => {
246
+ return site === 'plussSpace' || site === 'hq' ? Config.env.preferredSite : site;
247
+ };
248
+
249
+ const getTakeoverThumb = uri => {
250
+ const filename = uri.split('/').pop();
251
+
252
+ switch (filename) {
253
+ default:
254
+ return {
255
+ uri
256
+ };
257
+ }
258
+ };
259
+
260
+ const getTakeoverImage = uri => {
261
+ const filename = uri.split('/').pop();
262
+
263
+ switch (filename) {
264
+ default:
265
+ return {
266
+ uri
267
+ };
268
+ }
269
+ };
270
+
271
+ const getImageSource = (uri, isThumb) => {
272
+ if (uri == null) return null;
273
+ if (isThumb) return getTakeoverThumb(uri);
274
+ return getTakeoverImage(uri);
275
+ };
276
+
277
+ const getFirstName = name => {
278
+ if (_.isEmpty(name)) {
279
+ return name;
280
+ }
281
+
282
+ return name.split(' ')[0];
283
+ };
284
+
285
+ const usersToSearchResult = (contacts, excludedUserIds) => {
286
+ let result = [];
287
+ contacts.forEach(user => {
288
+ result.push({
289
+ displayName: user.displayName,
290
+ id: user.objectID || user.id || user.ID || user.userId || user.Id,
291
+ profilePic: user.profilePic || user.photoURL || null,
292
+ unit: user.unit
293
+ });
294
+ });
295
+ result = _.reject(result, contact => {
296
+ return _.includes(excludedUserIds, contact.id);
297
+ });
298
+ return result;
299
+ };
300
+
301
+ const searchUsers = (source, term) => {
302
+ if (_.isEmpty(term)) {
303
+ return source;
304
+ }
305
+
306
+ return _.filter(source, user => {
307
+ const split = user.displayName.split(' ');
308
+ return _.some(split, part => {
309
+ return part.toLowerCase().indexOf(term.toLowerCase()) === 0;
310
+ });
311
+ });
312
+ };
313
+
314
+ const getTabSettingsFromState = state => {
315
+ const tabSettings = state.user && state.user.interface || getSiteSettingFromState(state, 'TabSettings', null);
316
+ return tabSettings;
317
+ };
318
+
319
+ const getEnabledTabsFromState = state => {
320
+ const tabSettings = getTabSettingsFromState(state);
321
+ return tabSettings ? tabSettings.filter(tab => tab.isEnabled) : [];
322
+ };
323
+
324
+ const getReactions = () => {
325
+ return [{
326
+ key: 'heart',
327
+ icon: require('./assets/icons/reactions/heart.png')
328
+ }, {
329
+ key: 'smile',
330
+ icon: require('./assets/icons/reactions/smile.png')
331
+ }, {
332
+ key: 'sad',
333
+ icon: require('./assets/icons/reactions/sad.png')
334
+ }, {
335
+ key: 'party',
336
+ icon: require('./assets/icons/reactions/party.png')
337
+ }];
338
+ };
339
+
340
+ const hasReacted = (reactions, userId) => {
341
+ return _.some(reactions, r => {
342
+ return !!r[userId];
343
+ });
344
+ };
345
+
346
+ const isTablet = () => {
347
+ return Dimensions.get('screen').width > 600;
348
+ };
349
+
350
+ const isVimeo = url => {
351
+ if (_.isEmpty(url)) {
352
+ return false;
353
+ }
354
+
355
+ if (url.indexOf('https://vimeo.com/') === 0) {
356
+ return true;
357
+ }
358
+
359
+ if (url.indexOf('https://player.vimeo.com/video/') === 0) {
360
+ return true;
361
+ }
362
+ };
363
+
364
+ const getVimeoEmbed = url => {
365
+ if (_.isEmpty(url)) {
366
+ return '';
367
+ }
368
+
369
+ if (url.indexOf('https://vimeo.com/') === 0) {
370
+ const vimeoId = 'lol'; //TODO
371
+
372
+ return `https://player.vimeo.com/video/${vimeoId}`;
373
+ }
374
+
375
+ return url; //TODO
376
+ };
377
+
378
+ const isYoutube = url => {
379
+ if (_.isUndefined(url) || _.isEmpty(url)) {
380
+ return false;
381
+ }
382
+
383
+ const regExp = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=|\?v=)([^#\&\?]*).*/;
384
+ const match = url.match(regExp);
385
+
386
+ if (match && match[2].length === 11) {
387
+ return true;
388
+ }
389
+
390
+ return false;
391
+ };
392
+
393
+ const getYoutubeEmbed = url => {
394
+ const regExp = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=|\?v=)([^#\&\?]*).*/;
395
+ const match = url.match(regExp);
396
+ return `https://www.youtube.com/embed/${match[2]}?autoplay=0`;
397
+ };
398
+
399
+ const getValidUrl = function () {
400
+ let url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
401
+ let newUrl = decodeURIComponent(url);
402
+ newUrl = newUrl.trim().replace(/\s/g, '');
403
+
404
+ if (/^(:\/\/)/.test(newUrl)) {
405
+ return `https${newUrl}`;
406
+ }
407
+
408
+ if (!/^(f|ht)tps?:\/\//i.test(newUrl)) {
409
+ return `https://${newUrl}`;
410
+ }
411
+
412
+ return newUrl;
413
+ };
414
+
415
+ const getUserPreview = user => {
416
+ return {
417
+ id: user.uid,
418
+ displayName: user.displayName,
419
+ profilePic: user.profilePic || null
420
+ };
421
+ };
422
+
423
+ const allowComments = canComment => {
424
+ if (canComment === false) {
425
+ return false;
426
+ }
427
+
428
+ if (canComment === true) {
429
+ return true;
430
+ }
431
+
432
+ return Config.env.defaultAllowComments;
433
+ };
434
+
435
+ export { TIMESTAMP_FORMAT, DATE_FORMAT, getUrl, getAuthTokenHeader, getShadowStyle, StatusBarHeight, getStatusBarHeight, getSiteSettingFromState, getValueOrDefault, getExtension, getFileName, isVideo, getThumb300, get1400, getMimeType, getCompressed, imageExists, getPluralS, getPluralOptions, randomString, generateImageName, getSite, getImageSource, getFirstName, usersToSearchResult, searchUsers, getEnabledTabsFromState, getReactions, hasReacted, isTablet, isYoutube, getYoutubeEmbed, getValidUrl, getUserPreview, allowComments, isVideoUrl };
436
+ //# sourceMappingURL=helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["helper.js"],"names":["_","Platform","StatusBar","Dimensions","Constants","Config","LINEGREY","getSessionTokenAWS","TIMESTAMP_FORMAT","DATE_FORMAT","getUrl","baseAction","action","query","baseAPIUrl","baseStage","env","queryPart","keys","forEach","key","index","encodeURIComponent","getAuthTokenHeader","Promise","resolve","reject","then","idToken","getShadowStyle","OS","shadowColor","shadowOffset","width","height","shadowOpacity","shadowRadius","backgroundColor","borderColor","elevation","StatusBarHeight","size","getStatusBarHeight","statusBarHeight","currentHeight","getSiteSettingFromState","state","defaultValue","user","siteSettings","isUndefined","getValueOrDefault","value","def","getExtension","url","fileSplit","split","length","toLowerCase","getFileName","noExtension","name","isVideo","extension","includes","isVideoUrl","urlToCheck","getValidUrl","isYoutube","isVimeo","isStockImage","indexOf","getThumb300","replace","baseUploadsUrl","urlToUse","substring","get1400","getMimeType","getCompressed","imageExists","fetch","method","cache","response","status","catch","getPluralS","count","getPluralOptions","singular","plural","randomString","c","r","Math","random","v","toString","generateImageName","source","result","last","getSite","site","preferredSite","getTakeoverThumb","uri","filename","pop","getTakeoverImage","getImageSource","isThumb","getFirstName","isEmpty","usersToSearchResult","contacts","excludedUserIds","push","displayName","id","objectID","ID","userId","Id","profilePic","photoURL","unit","contact","searchUsers","term","filter","some","part","getTabSettingsFromState","tabSettings","interface","getEnabledTabsFromState","tab","isEnabled","getReactions","icon","require","hasReacted","reactions","isTablet","get","getVimeoEmbed","vimeoId","regExp","match","getYoutubeEmbed","newUrl","decodeURIComponent","trim","test","getUserPreview","uid","allowComments","canComment","defaultAllowComments"],"mappings":"AAAA,OAAOA,CAAP,MAAc,QAAd;AACA,SAASC,QAAT,EAAmBC,SAAnB,EAA8BC,UAA9B,QAAgD,cAAhD;AACA,OAAOC,SAAP,MAAsB,gBAAtB;AACA,OAAOC,MAAP,MAAmB,UAAnB;AACA,SAASC,QAAT,QAAyB,WAAzB;AACA,SAASC,kBAAT,QAAmC,WAAnC;AAEA,MAAMC,gBAAgB,GAAG,eAAzB;AACA,MAAMC,WAAW,GAAG,YAApB;;AAEA,MAAMC,M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,CAAC,oBAAoBG,IAApB,CAAyBH,MAAzB,CAAL,EAAuC;AACrC,WAAQ,WAAUA,MAAO,EAAzB;AACD;;AAED,SAAOA,MAAP;AACD,CAZD;;AAcA,MAAMI,cAAc,GAAG7G,IAAI,IAAI;AAC7B,SAAO;AACLyE,IAAAA,EAAE,EAAEzE,IAAI,CAAC8G,GADJ;AAELtC,IAAAA,WAAW,EAAExE,IAAI,CAACwE,WAFb;AAGLM,IAAAA,UAAU,EAAE9E,IAAI,CAAC8E,UAAL,IAAmB;AAH1B,GAAP;AAKD,CAND;;AAQA,MAAMiC,aAAa,GAAGC,UAAU,IAAI;AAClC,MAAIA,UAAU,KAAK,KAAnB,EAA0B;AACxB,WAAO,KAAP;AACD;;AACD,MAAIA,UAAU,KAAK,IAAnB,EAAyB;AACvB,WAAO,IAAP;AACD;;AACD,SAAO3J,MAAM,CAACW,GAAP,CAAWiJ,oBAAlB;AACD,CARD;;AAUA,SACEzJ,gBADF,EAEEC,WAFF,EAGEC,MAHF,EAIEa,kBAJF,EAKEM,cALF,EAMEW,eANF,EAOEE,kBAPF,EAQEG,uBARF,EASEM,iBATF,EAUEG,YAVF,EAWEM,WAXF,EAYEG,OAZF,EAaEU,WAbF,EAcEK,OAdF,EAeEC,WAfF,EAgBEC,aAhBF,EAiBEC,WAjBF,EAkBEO,UAlBF,EAmBEE,gBAnBF,EAoBEG,YApBF,EAqBEO,iBArBF,EAsBEI,OAtBF,EAuBEQ,cAvBF,EAwBEE,YAxBF,EAyBEE,mBAzBF,EA0BEc,WA1BF,EA2BEQ,uBA3BF,EA4BEG,YA5BF,EA6BEG,UA7BF,EA8BEE,QA9BF,EA+BE7E,SA/BF,EAgCEmF,eAhCF,EAiCEpF,WAjCF,EAkCEyF,cAlCF,EAmCEE,aAnCF,EAoCE7F,UApCF","sourcesContent":["import _ from 'lodash';\nimport { Platform, StatusBar, Dimensions } from 'react-native';\nimport Constants from 'expo-constants';\nimport Config from './config';\nimport { LINEGREY } from './colours';\nimport { getSessionTokenAWS } from './session';\n\nconst TIMESTAMP_FORMAT = 'D MMM • h:mma';\nconst DATE_FORMAT = 'D MMM YYYY';\n\nconst getUrl = (baseAction, action, query) => {\n const { baseAPIUrl, baseStage } = Config.env;\n let queryPart = '';\n if (query) {\n _.keys(query).forEach((key, index) => {\n queryPart += `${index === 0 ? '?' : '&'}${key}=${encodeURIComponent(query[key])}`;\n });\n }\n return `${baseAPIUrl}/${baseAction}-${baseStage}/${action}${queryPart}`;\n};\n\nconst getAuthTokenHeader = () => {\n return new Promise((resolve, reject) => {\n getSessionTokenAWS().then(idToken => {\n resolve(`Bearer ${idToken}`);\n });\n });\n};\n\nconst getShadowStyle = () => {\n if (Platform.OS === 'ios') {\n return {\n shadowColor: '#000',\n shadowOffset: {\n width: 0,\n height: 1,\n },\n shadowOpacity: 0.1,\n shadowRadius: 3,\n backgroundColor: '#fff',\n };\n }\n return {\n borderColor: LINEGREY,\n backgroundColor: '#fff',\n elevation: 8,\n };\n};\n\nconst StatusBarHeight = size => {\n return getStatusBarHeight() + size;\n};\n\nconst getStatusBarHeight = () => {\n return Platform.OS === 'ios' ? Constants.statusBarHeight : StatusBar.currentHeight;\n};\n\nconst getSiteSettingFromState = (state, key, defaultValue) => {\n if (state && state.user && state.user.siteSettings && !_.isUndefined(state.user.siteSettings[key])) {\n return state.user.siteSettings[key];\n }\n return defaultValue || null;\n};\n\nconst getValueOrDefault = (value, def) => {\n return !_.isUndefined(value) ? value : def;\n};\n\nconst getExtension = url => {\n if (!url) {\n return null;\n }\n const fileSplit = url.split('.');\n return fileSplit[fileSplit.length - 1].toLowerCase();\n};\n\nconst getFileName = (url, noExtension) => {\n if (!url) {\n return null;\n }\n const fileSplit = url.split('/');\n const name = fileSplit[fileSplit.length - 1].toLowerCase();\n if (!noExtension) {\n return name;\n }\n return name.split('.')[0];\n};\n\nconst isVideo = url => {\n const extension = getExtension(url);\n return ['mov', 'mp4'].includes(extension);\n};\n\nconst isVideoUrl = url => {\n const urlToCheck = getValidUrl(url);\n if (isVideo(urlToCheck)) {\n return true;\n }\n if (isYoutube(urlToCheck)) {\n return true;\n }\n if (isVimeo(urlToCheck)) {\n return true;\n }\n return false;\n};\n\nconst isStockImage = url => {\n return url.indexOf('https://pluss60-dev-uploads.s3.ap-southeast-2.amazonaws.com/uploads/library') !== -1;\n};\n\nconst getThumb300 = url => {\n if (!url) {\n return url;\n }\n if (url.indexOf('https://plussprdstorage.blob.core.windows.net/') !== -1) {\n return url.replace('https://plussprdstorage.blob.core.windows.net/', 'https://plusscdn.azureedge.net/');\n }\n if (url.indexOf('https://plusscdn.azureedge.net/') !== -1) {\n return url\n .replace('/uploads/', '/uploads-thumb/')\n .replace('/general/', '/general300/')\n .replace('/uploads1400/', '/uploads-thumb/')\n .replace('/general1400/', '/general300/');\n }\n if (isStockImage(url) || url.indexOf(Config.env.baseUploadsUrl) !== -1) {\n const extension = getExtension(url);\n let urlToUse = url;\n if (extension !== 'jpg') {\n urlToUse = `${url.substring(0, url.length - extension.length)}jpg`;\n }\n return urlToUse.replace('/1400/', '/thumb300/').replace('/uploads/', '/thumb300/');\n }\n return url;\n};\n\nconst get1400 = url => {\n if (!url) {\n return url;\n }\n if (url.indexOf('https://plussprdstorage.blob.core.windows.net/') !== -1) {\n return url.replace('https://plussprdstorage.blob.core.windows.net/', 'https://plusscdn.azureedge.net/');\n }\n if (url.indexOf('https://plusscdn.azureedge.net/') !== -1) {\n return url.replace('/uploads/', '/uploads1400/').replace('/general/', '/general1400/');\n }\n if (isStockImage(url) || url.indexOf(Config.env.baseUploadsUrl) !== -1) {\n const extension = getExtension(url);\n let urlToUse = url;\n if (extension !== 'jpg') {\n urlToUse = `${url.substring(0, url.length - extension.length)}jpg`;\n }\n return urlToUse.replace('/uploads/', '/1400/');\n }\n return url;\n};\n\nconst getMimeType = url => {\n const extension = getExtension(url);\n switch (extension) {\n case 'mov':\n return 'video/quicktime';\n case 'mp4':\n return 'video/mp4';\n default:\n return 'image/jpeg';\n }\n};\n\nconst getCompressed = url => {\n if (!url || typeof url !== 'string') return '';\n return url.replace('/uploads/', '/compressed/');\n};\n\nconst imageExists = url => {\n return new Promise(resolve => {\n fetch(url, { method: 'HEAD', cache: 'no-cache' })\n .then(response => {\n resolve(response.status === 200);\n })\n .catch(() => {\n resolve(false);\n });\n });\n};\n\nconst getPluralS = count => {\n return count === 1 ? '' : 's';\n};\n\nconst getPluralOptions = (count, singular, plural) => {\n if (count === 1) {\n return singular;\n }\n return plural;\n};\n\nconst randomString = (name = '') => {\n return `xxxxxxxx4xxxyxxxxxxxxxxxxx${name}`.replace(/[xy]/g, c => {\n // eslint-disable-next-line\n var r = (Math.random() * 16) | 0,\n v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n};\n\nconst generateImageName = (name, source) => {\n let result = randomString(name);\n if (source) {\n result += `.${_.last(source.split('.'))}`;\n }\n return result;\n};\n\nconst getSite = site => {\n return site === 'plussSpace' || site === 'hq' ? Config.env.preferredSite : site;\n};\n\nconst getTakeoverThumb = uri => {\n const filename = uri.split('/').pop();\n switch (filename) {\n default:\n return { uri };\n }\n};\n\nconst getTakeoverImage = uri => {\n const filename = uri.split('/').pop();\n switch (filename) {\n default:\n return { uri };\n }\n};\n\nconst getImageSource = (uri, isThumb) => {\n if (uri == null) return null;\n if (isThumb) return getTakeoverThumb(uri);\n return getTakeoverImage(uri);\n};\n\nconst getFirstName = name => {\n if (_.isEmpty(name)) {\n return name;\n }\n return name.split(' ')[0];\n};\n\nconst usersToSearchResult = (contacts, excludedUserIds) => {\n let result = [];\n contacts.forEach(user => {\n result.push({\n displayName: user.displayName,\n id: user.objectID || user.id || user.ID || user.userId || user.Id,\n profilePic: user.profilePic || user.photoURL || null,\n unit: user.unit,\n });\n });\n result = _.reject(result, contact => {\n return _.includes(excludedUserIds, contact.id);\n });\n return result;\n};\n\nconst searchUsers = (source, term) => {\n if (_.isEmpty(term)) {\n return source;\n }\n return _.filter(source, user => {\n const split = user.displayName.split(' ');\n return _.some(split, part => {\n return part.toLowerCase().indexOf(term.toLowerCase()) === 0;\n });\n });\n};\n\nconst getTabSettingsFromState = state => {\n const tabSettings = (state.user && state.user.interface) || getSiteSettingFromState(state, 'TabSettings', null);\n return tabSettings;\n};\n\nconst getEnabledTabsFromState = state => {\n const tabSettings = getTabSettingsFromState(state);\n return tabSettings ? tabSettings.filter(tab => tab.isEnabled) : [];\n};\n\nconst getReactions = () => {\n return [\n {\n key: 'heart',\n icon: require('./assets/icons/reactions/heart.png'),\n },\n {\n key: 'smile',\n icon: require('./assets/icons/reactions/smile.png'),\n },\n {\n key: 'sad',\n icon: require('./assets/icons/reactions/sad.png'),\n },\n {\n key: 'party',\n icon: require('./assets/icons/reactions/party.png'),\n },\n ];\n};\n\nconst hasReacted = (reactions, userId) => {\n return _.some(reactions, r => {\n return !!r[userId];\n });\n};\n\nconst isTablet = () => {\n return Dimensions.get('screen').width > 600;\n};\n\nconst isVimeo = url => {\n if (_.isEmpty(url)) {\n return false;\n }\n if (url.indexOf('https://vimeo.com/') === 0) {\n return true;\n }\n if (url.indexOf('https://player.vimeo.com/video/') === 0) {\n return true;\n }\n};\n\nconst getVimeoEmbed = url => {\n if (_.isEmpty(url)) {\n return '';\n }\n if (url.indexOf('https://vimeo.com/') === 0) {\n const vimeoId = 'lol'; //TODO\n return `https://player.vimeo.com/video/${vimeoId}`;\n }\n return url; //TODO\n};\n\nconst isYoutube = url => {\n if (_.isUndefined(url) || _.isEmpty(url)) {\n return false;\n }\n const regExp = /^.*(youtu.be\\/|v\\/|u\\/\\w\\/|embed\\/|watch\\?v=|\\&v=|\\?v=)([^#\\&\\?]*).*/;\n const match = url.match(regExp);\n if (match && match[2].length === 11) {\n return true;\n }\n return false;\n};\n\nconst getYoutubeEmbed = url => {\n const regExp = /^.*(youtu.be\\/|v\\/|u\\/\\w\\/|embed\\/|watch\\?v=|\\&v=|\\?v=)([^#\\&\\?]*).*/;\n const match = url.match(regExp);\n return `https://www.youtube.com/embed/${match[2]}?autoplay=0`;\n};\n\nconst getValidUrl = (url = '') => {\n let newUrl = decodeURIComponent(url);\n newUrl = newUrl.trim().replace(/\\s/g, '');\n\n if (/^(:\\/\\/)/.test(newUrl)) {\n return `https${newUrl}`;\n }\n if (!/^(f|ht)tps?:\\/\\//i.test(newUrl)) {\n return `https://${newUrl}`;\n }\n\n return newUrl;\n};\n\nconst getUserPreview = user => {\n return {\n id: user.uid,\n displayName: user.displayName,\n profilePic: user.profilePic || null,\n };\n};\n\nconst allowComments = canComment => {\n if (canComment === false) {\n return false;\n }\n if (canComment === true) {\n return true;\n }\n return Config.env.defaultAllowComments;\n};\n\nexport {\n TIMESTAMP_FORMAT,\n DATE_FORMAT,\n getUrl,\n getAuthTokenHeader,\n getShadowStyle,\n StatusBarHeight,\n getStatusBarHeight,\n getSiteSettingFromState,\n getValueOrDefault,\n getExtension,\n getFileName,\n isVideo,\n getThumb300,\n get1400,\n getMimeType,\n getCompressed,\n imageExists,\n getPluralS,\n getPluralOptions,\n randomString,\n generateImageName,\n getSite,\n getImageSource,\n getFirstName,\n usersToSearchResult,\n searchUsers,\n getEnabledTabsFromState,\n getReactions,\n hasReacted,\n isTablet,\n isYoutube,\n getYoutubeEmbed,\n getValidUrl,\n getUserPreview,\n allowComments,\n isVideoUrl,\n};\n"]}
@@ -0,0 +1,13 @@
1
+ import Config from './config';
2
+ import Styles from './styles';
3
+ import * as Session from './session';
4
+ import * as Helper from './helper';
5
+ import * as Colours from './colours';
6
+ import * as Actions from './actions';
7
+ import * as ActionTypes from './actions/types';
8
+ import * as Apis from './apis';
9
+ import * as Components from './components';
10
+ import * as Fonts from './fonts';
11
+ import * as Constants from './constants';
12
+ export { Config, Styles, Session, Helper, Colours, Actions, ActionTypes, Apis, Components, Fonts, Constants };
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.js"],"names":["Config","Styles","Session","Helper","Colours","Actions","ActionTypes","Apis","Components","Fonts","Constants"],"mappings":"AAAA,OAAOA,MAAP,MAAmB,UAAnB;AACA,OAAOC,MAAP,MAAmB,UAAnB;AACA,OAAO,KAAKC,OAAZ,MAAyB,WAAzB;AACA,OAAO,KAAKC,MAAZ,MAAwB,UAAxB;AACA,OAAO,KAAKC,OAAZ,MAAyB,WAAzB;AACA,OAAO,KAAKC,OAAZ,MAAyB,WAAzB;AACA,OAAO,KAAKC,WAAZ,MAA6B,iBAA7B;AACA,OAAO,KAAKC,IAAZ,MAAsB,QAAtB;AACA,OAAO,KAAKC,UAAZ,MAA4B,cAA5B;AACA,OAAO,KAAKC,KAAZ,MAAuB,SAAvB;AACA,OAAO,KAAKC,SAAZ,MAA2B,aAA3B;AAEA,SAASV,MAAT,EAAiBC,MAAjB,EAAyBC,OAAzB,EAAkCC,MAAlC,EAA0CC,OAA1C,EAAmDC,OAAnD,EAA4DC,WAA5D,EAAyEC,IAAzE,EAA+EC,UAA/E,EAA2FC,KAA3F,EAAkGC,SAAlG","sourcesContent":["import Config from './config';\nimport Styles from './styles';\nimport * as Session from './session';\nimport * as Helper from './helper';\nimport * as Colours from './colours';\nimport * as Actions from './actions';\nimport * as ActionTypes from './actions/types';\nimport * as Apis from './apis';\nimport * as Components from './components';\nimport * as Fonts from './fonts';\nimport * as Constants from './constants';\n\nexport { Config, Styles, Session, Helper, Colours, Actions, ActionTypes, Apis, Components, Fonts, Constants };\n"]}
@@ -0,0 +1,54 @@
1
+ import _ from 'lodash';
2
+ import axios from 'axios';
3
+ import { Auth } from 'aws-amplify';
4
+ export const getSessionTokenAWS = async prefix => {
5
+ const data = await Auth.currentSession();
6
+ const token = data.accessToken.jwtToken;
7
+ if (_.isUndefined(prefix)) return token;
8
+ return `${prefix} ${token}`;
9
+ }; // export const getRefreshTokenAWS = async () => {
10
+ // const data = await Auth.currentSession();
11
+ // return data.getRefreshToken().token;
12
+ // };
13
+
14
+ export const getSessionUidAWS = () => {
15
+ return new Promise((resolve, reject) => {
16
+ Auth.currentSession().then(data => {
17
+ resolve(data.accessToken.payload.username);
18
+ }).catch(err => {
19
+ console.log('getSessionUidAWS error', err);
20
+ reject(err);
21
+ });
22
+ });
23
+ };
24
+ export const authedFunction = async request => {
25
+ const authkey = await getSessionTokenAWS();
26
+ if (!request.headers) request.headers = {};
27
+ request.headers.authkey = authkey;
28
+ return axios(request);
29
+ }; // export const LogoutAWS = () => {
30
+ // return new Promise((resolve, reject) => {
31
+ // Auth.signOut()
32
+ // .then(() => {
33
+ // resolve();
34
+ // })
35
+ // .catch(err => {
36
+ // reject(err);
37
+ // });
38
+ // });
39
+ // };
40
+ // export const isTheBest = auth => {
41
+ // return auth && auth.site === 'plussSpace' && auth.type === 'master';
42
+ // };
43
+
44
+ export const getApiError = error => {
45
+ if (!__DEV__) return error;
46
+
47
+ try {
48
+ const errorData = error.response.data;
49
+ return errorData || error;
50
+ } catch (e) {
51
+ return error;
52
+ }
53
+ };
54
+ //# sourceMappingURL=session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["session.js"],"names":["_","axios","Auth","getSessionTokenAWS","prefix","data","currentSession","token","accessToken","jwtToken","isUndefined","getSessionUidAWS","Promise","resolve","reject","then","payload","username","catch","err","console","log","authedFunction","request","authkey","headers","getApiError","error","__DEV__","errorData","response","e"],"mappings":"AAAA,OAAOA,CAAP,MAAc,QAAd;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,SAASC,IAAT,QAAqB,aAArB;AAEA,OAAO,MAAMC,kBAAkB,GAAG,MAAMC,MAAN,IAAgB;AAChD,QAAMC,IAAI,GAAG,MAAMH,IAAI,CAACI,cAAL,EAAnB;AACA,QAAMC,KAAK,GAAGF,IAAI,CAACG,WAAL,CAAiBC,QAA/B;AACA,MAAIT,CAAC,CAACU,WAAF,CAAcN,MAAd,CAAJ,EAA2B,OAAOG,KAAP;AAC3B,SAAQ,GAAEH,MAAO,IAAGG,KAAM,EAA1B;AACD,CALM,C,CAOP;AACA;AACA;AACA;;AAEA,OAAO,MAAMI,gBAAgB,GAAG,MAAM;AACpC,SAAO,IAAIC,OAAJ,CAAY,CAACC,OAAD,EAAUC,MAAV,KAAqB;AACtCZ,IAAAA,IAAI,CAACI,cAAL,GACGS,IADH,CACQV,IAAI,IAAI;AACZQ,MAAAA,OAAO,CAACR,IAAI,CAACG,WAAL,CAAiBQ,OAAjB,CAAyBC,QAA1B,CAAP;AACD,KAHH,EAIGC,KAJH,CAISC,GAAG,IAAI;AACZC,MAAAA,OAAO,CAACC,GAAR,CAAY,wBAAZ,EAAsCF,GAAtC;AACAL,MAAAA,MAAM,CAACK,GAAD,CAAN;AACD,KAPH;AAQD,GATM,CAAP;AAUD,CAXM;AAaP,OAAO,MAAMG,cAAc,GAAG,MAAMC,OAAN,IAAiB;AAC7C,QAAMC,OAAO,GAAG,MAAMrB,kBAAkB,EAAxC;AACA,MAAI,CAACoB,OAAO,CAACE,OAAb,EAAsBF,OAAO,CAACE,OAAR,GAAkB,EAAlB;AACtBF,EAAAA,OAAO,CAACE,OAAR,CAAgBD,OAAhB,GAA0BA,OAA1B;AAEA,SAAOvB,KAAK,CAACsB,OAAD,CAAZ;AACD,CANM,C,CAQP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;;AAEA,OAAO,MAAMG,WAAW,GAAGC,KAAK,IAAI;AAClC,MAAI,CAACC,OAAL,EAAc,OAAOD,KAAP;;AACd,MAAI;AACF,UAAME,SAAS,GAAGF,KAAK,CAACG,QAAN,CAAezB,IAAjC;AACA,WAAOwB,SAAS,IAAIF,KAApB;AACD,GAHD,CAGE,OAAOI,CAAP,EAAU;AACV,WAAOJ,KAAP;AACD;AACF,CARM","sourcesContent":["import _ from 'lodash';\nimport axios from 'axios';\nimport { Auth } from 'aws-amplify';\n\nexport const getSessionTokenAWS = async prefix => {\n const data = await Auth.currentSession();\n const token = data.accessToken.jwtToken;\n if (_.isUndefined(prefix)) return token;\n return `${prefix} ${token}`;\n};\n\n// export const getRefreshTokenAWS = async () => {\n// const data = await Auth.currentSession();\n// return data.getRefreshToken().token;\n// };\n\nexport const getSessionUidAWS = () => {\n return new Promise((resolve, reject) => {\n Auth.currentSession()\n .then(data => {\n resolve(data.accessToken.payload.username);\n })\n .catch(err => {\n console.log('getSessionUidAWS error', err);\n reject(err);\n });\n });\n};\n\nexport const authedFunction = async request => {\n const authkey = await getSessionTokenAWS();\n if (!request.headers) request.headers = {};\n request.headers.authkey = authkey;\n\n return axios(request);\n};\n\n// export const LogoutAWS = () => {\n// return new Promise((resolve, reject) => {\n// Auth.signOut()\n// .then(() => {\n// resolve();\n// })\n// .catch(err => {\n// reject(err);\n// });\n// });\n// };\n\n// export const isTheBest = auth => {\n// return auth && auth.site === 'plussSpace' && auth.type === 'master';\n// };\n\nexport const getApiError = error => {\n if (!__DEV__) return error;\n try {\n const errorData = error.response.data;\n return errorData || error;\n } catch (e) {\n return error;\n }\n};\n"]}
@@ -0,0 +1,67 @@
1
+ import { StyleSheet } from 'react-native';
2
+ import { COLOUR_GREEN } from './colours';
3
+ export default StyleSheet.create({
4
+ notificationBell: {
5
+ height: 70,
6
+ width: 55,
7
+ alignItems: 'center',
8
+ flexDirection: 'row',
9
+ justifyContent: 'space-between'
10
+ },
11
+ fill: {
12
+ flex: 1
13
+ },
14
+ genericPageContainer: {
15
+ flex: 1,
16
+ backgroundColor: '#fff'
17
+ },
18
+ addButton: {
19
+ position: 'absolute',
20
+ bottom: 16,
21
+ right: 16,
22
+ height: 48,
23
+ width: 48,
24
+ borderRadius: 23,
25
+ justifyContent: 'center',
26
+ zIndex: 200,
27
+ elevation: 2,
28
+ shadowColor: '#000',
29
+ shadowOffset: {
30
+ width: 0,
31
+ height: 2
32
+ },
33
+ shadowOpacity: 0.15,
34
+ shadowRadius: 6
35
+ },
36
+ addButtonIcon: {
37
+ color: '#fff',
38
+ fontSize: 16,
39
+ alignSelf: 'center'
40
+ },
41
+ backButton: {
42
+ height: 32,
43
+ width: 32,
44
+ borderRadius: 15,
45
+ justifyContent: 'center',
46
+ alignItems: 'center'
47
+ },
48
+ backButtonIcon: {
49
+ color: '#fff',
50
+ fontSize: 18
51
+ },
52
+ tickBox: {
53
+ height: 20,
54
+ width: 20,
55
+ backgroundColor: COLOUR_GREEN,
56
+ borderRadius: 10,
57
+ justifyContent: 'center',
58
+ alignItems: 'center'
59
+ },
60
+ tickIcon: {
61
+ color: '#fff',
62
+ fontSize: 17,
63
+ paddingTop: 1,
64
+ paddingLeft: 1
65
+ }
66
+ });
67
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["styles.js"],"names":["StyleSheet","COLOUR_GREEN","create","notificationBell","height","width","alignItems","flexDirection","justifyContent","fill","flex","genericPageContainer","backgroundColor","addButton","position","bottom","right","borderRadius","zIndex","elevation","shadowColor","shadowOffset","shadowOpacity","shadowRadius","addButtonIcon","color","fontSize","alignSelf","backButton","backButtonIcon","tickBox","tickIcon","paddingTop","paddingLeft"],"mappings":"AAAA,SAASA,UAAT,QAA2B,cAA3B;AACA,SAASC,YAAT,QAA6B,WAA7B;AAEA,eAAeD,UAAU,CAACE,MAAX,CAAkB;AAC/BC,EAAAA,gBAAgB,EAAE;AAChBC,IAAAA,MAAM,EAAE,EADQ;AAEhBC,IAAAA,KAAK,EAAE,EAFS;AAGhBC,IAAAA,UAAU,EAAE,QAHI;AAIhBC,IAAAA,aAAa,EAAE,KAJC;AAKhBC,IAAAA,cAAc,EAAE;AALA,GADa;AAQ/BC,EAAAA,IAAI,EAAE;AACJC,IAAAA,IAAI,EAAE;AADF,GARyB;AAW/BC,EAAAA,oBAAoB,EAAE;AACpBD,IAAAA,IAAI,EAAE,CADc;AAEpBE,IAAAA,eAAe,EAAE;AAFG,GAXS;AAe/BC,EAAAA,SAAS,EAAE;AACTC,IAAAA,QAAQ,EAAE,UADD;AAETC,IAAAA,MAAM,EAAE,EAFC;AAGTC,IAAAA,KAAK,EAAE,EAHE;AAITZ,IAAAA,MAAM,EAAE,EAJC;AAKTC,IAAAA,KAAK,EAA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N } from './colours';\n\nexport default StyleSheet.create({\n notificationBell: {\n height: 70,\n width: 55,\n alignItems: 'center',\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n fill: {\n flex: 1,\n },\n genericPageContainer: {\n flex: 1,\n backgroundColor: '#fff',\n },\n addButton: {\n position: 'absolute',\n bottom: 16,\n right: 16,\n height: 48,\n width: 48,\n borderRadius: 23,\n justifyContent: 'center',\n zIndex: 200,\n elevation: 2,\n shadowColor: '#000',\n shadowOffset: { width: 0, height: 2 },\n shadowOpacity: 0.15,\n shadowRadius: 6,\n },\n addButtonIcon: {\n color: '#fff',\n fontSize: 16,\n alignSelf: 'center',\n },\n backButton: {\n height: 32,\n width: 32,\n borderRadius: 15,\n justifyContent: 'center',\n alignItems: 'center',\n },\n backButtonIcon: {\n color: '#fff',\n fontSize: 18,\n },\n tickBox: {\n height: 20,\n width: 20,\n backgroundColor: COLOUR_GREEN,\n borderRadius: 10,\n justifyContent: 'center',\n alignItems: 'center',\n },\n tickIcon: {\n color: '#fff',\n fontSize: 17,\n paddingTop: 1,\n paddingLeft: 1,\n },\n});\n"]}