@plusscommunities/pluss-core-web 1.4.36-auth.0 → 1.4.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +62 -126
- package/dist/index.esm.js +62 -126
- package/dist/index.umd.js +65 -129
- package/package.json +3 -8
- package/src/apis/fileActions.js +7 -28
- package/src/components/AudienceSelector.js +1 -1
- package/src/components/Comment.js +16 -1
- package/src/components/FileInput.js +1 -1
- package/src/components/ImageInput.js +2 -1
- package/src/components/UserListing.js +3 -0
- package/src/config.js +0 -5
- package/src/session.js +8 -5
package/dist/index.cjs.js
CHANGED
|
@@ -6,12 +6,12 @@ var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
|
6
6
|
var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
|
7
7
|
var _ = require('lodash');
|
|
8
8
|
var axios = require('axios');
|
|
9
|
+
var awsAmplify = require('aws-amplify');
|
|
9
10
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
10
11
|
var moment = require('moment');
|
|
11
12
|
var React = require('react');
|
|
12
13
|
var $ = require('jquery');
|
|
13
14
|
var Cookies = require('js-cookie');
|
|
14
|
-
var awsAmplify = require('aws-amplify');
|
|
15
15
|
var _classCallCheck = require('@babel/runtime/helpers/classCallCheck');
|
|
16
16
|
var _createClass = require('@babel/runtime/helpers/createClass');
|
|
17
17
|
var _inherits = require('@babel/runtime/helpers/inherits');
|
|
@@ -79,75 +79,7 @@ var CoreConfig = {
|
|
|
79
79
|
defaultAllowComments: true,
|
|
80
80
|
makeApiKey: '',
|
|
81
81
|
logo: '',
|
|
82
|
-
clientName: ''
|
|
83
|
-
AuthStrategy: {
|
|
84
|
-
getAccessToken: function () {
|
|
85
|
-
var _getAccessToken = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee() {
|
|
86
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
|
87
|
-
while (1) {
|
|
88
|
-
switch (_context.prev = _context.next) {
|
|
89
|
-
case 0:
|
|
90
|
-
return _context.abrupt("return", null);
|
|
91
|
-
|
|
92
|
-
case 1:
|
|
93
|
-
case "end":
|
|
94
|
-
return _context.stop();
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}, _callee);
|
|
98
|
-
}));
|
|
99
|
-
|
|
100
|
-
function getAccessToken() {
|
|
101
|
-
return _getAccessToken.apply(this, arguments);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return getAccessToken;
|
|
105
|
-
}(),
|
|
106
|
-
getCurrentUserId: function () {
|
|
107
|
-
var _getCurrentUserId = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2() {
|
|
108
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
|
109
|
-
while (1) {
|
|
110
|
-
switch (_context2.prev = _context2.next) {
|
|
111
|
-
case 0:
|
|
112
|
-
return _context2.abrupt("return", null);
|
|
113
|
-
|
|
114
|
-
case 1:
|
|
115
|
-
case "end":
|
|
116
|
-
return _context2.stop();
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}, _callee2);
|
|
120
|
-
}));
|
|
121
|
-
|
|
122
|
-
function getCurrentUserId() {
|
|
123
|
-
return _getCurrentUserId.apply(this, arguments);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return getCurrentUserId;
|
|
127
|
-
}(),
|
|
128
|
-
hasActiveSession: function () {
|
|
129
|
-
var _hasActiveSession = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3() {
|
|
130
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
|
|
131
|
-
while (1) {
|
|
132
|
-
switch (_context3.prev = _context3.next) {
|
|
133
|
-
case 0:
|
|
134
|
-
return _context3.abrupt("return", false);
|
|
135
|
-
|
|
136
|
-
case 1:
|
|
137
|
-
case "end":
|
|
138
|
-
return _context3.stop();
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}, _callee3);
|
|
142
|
-
}));
|
|
143
|
-
|
|
144
|
-
function hasActiveSession() {
|
|
145
|
-
return _hasActiveSession.apply(this, arguments);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return hasActiveSession;
|
|
149
|
-
}()
|
|
150
|
-
}
|
|
82
|
+
clientName: ''
|
|
151
83
|
},
|
|
152
84
|
init: function init(environment) {
|
|
153
85
|
CoreConfig.env = environment;
|
|
@@ -156,28 +88,29 @@ var CoreConfig = {
|
|
|
156
88
|
|
|
157
89
|
var getSessionTokenAWS = /*#__PURE__*/function () {
|
|
158
90
|
var _ref = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(prefix) {
|
|
159
|
-
var token;
|
|
91
|
+
var data, token;
|
|
160
92
|
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
|
161
93
|
while (1) {
|
|
162
94
|
switch (_context.prev = _context.next) {
|
|
163
95
|
case 0:
|
|
164
96
|
_context.next = 2;
|
|
165
|
-
return
|
|
97
|
+
return awsAmplify.Auth.currentSession();
|
|
166
98
|
|
|
167
99
|
case 2:
|
|
168
|
-
|
|
100
|
+
data = _context.sent;
|
|
101
|
+
token = data.getAccessToken().getJwtToken();
|
|
169
102
|
|
|
170
103
|
if (!___default['default'].isUndefined(prefix)) {
|
|
171
|
-
_context.next =
|
|
104
|
+
_context.next = 6;
|
|
172
105
|
break;
|
|
173
106
|
}
|
|
174
107
|
|
|
175
108
|
return _context.abrupt("return", token);
|
|
176
109
|
|
|
177
|
-
case
|
|
110
|
+
case 6:
|
|
178
111
|
return _context.abrupt("return", "".concat(prefix, " ").concat(token));
|
|
179
112
|
|
|
180
|
-
case
|
|
113
|
+
case 7:
|
|
181
114
|
case "end":
|
|
182
115
|
return _context.stop();
|
|
183
116
|
}
|
|
@@ -237,28 +170,30 @@ var unauthedFunction = function unauthedFunction(request) {
|
|
|
237
170
|
};
|
|
238
171
|
var getCurrentUserSub = /*#__PURE__*/function () {
|
|
239
172
|
var _ref3 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3() {
|
|
173
|
+
var user;
|
|
240
174
|
return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
|
|
241
175
|
while (1) {
|
|
242
176
|
switch (_context3.prev = _context3.next) {
|
|
243
177
|
case 0:
|
|
244
178
|
_context3.prev = 0;
|
|
245
179
|
_context3.next = 3;
|
|
246
|
-
return
|
|
180
|
+
return awsAmplify.Auth.currentUserInfo();
|
|
247
181
|
|
|
248
182
|
case 3:
|
|
249
|
-
|
|
183
|
+
user = _context3.sent;
|
|
184
|
+
return _context3.abrupt("return", user.id);
|
|
250
185
|
|
|
251
|
-
case
|
|
252
|
-
_context3.prev =
|
|
186
|
+
case 7:
|
|
187
|
+
_context3.prev = 7;
|
|
253
188
|
_context3.t0 = _context3["catch"](0);
|
|
254
189
|
return _context3.abrupt("return", null);
|
|
255
190
|
|
|
256
|
-
case
|
|
191
|
+
case 10:
|
|
257
192
|
case "end":
|
|
258
193
|
return _context3.stop();
|
|
259
194
|
}
|
|
260
195
|
}
|
|
261
|
-
}, _callee3, null, [[0,
|
|
196
|
+
}, _callee3, null, [[0, 7]]);
|
|
262
197
|
}));
|
|
263
198
|
|
|
264
199
|
return function getCurrentUserSub() {
|
|
@@ -267,19 +202,19 @@ var getCurrentUserSub = /*#__PURE__*/function () {
|
|
|
267
202
|
}();
|
|
268
203
|
var checkLoggedIn = /*#__PURE__*/function () {
|
|
269
204
|
var _ref4 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee4(self) {
|
|
270
|
-
var
|
|
205
|
+
var user;
|
|
271
206
|
return _regeneratorRuntime__default['default'].wrap(function _callee4$(_context4) {
|
|
272
207
|
while (1) {
|
|
273
208
|
switch (_context4.prev = _context4.next) {
|
|
274
209
|
case 0:
|
|
275
210
|
_context4.prev = 0;
|
|
276
211
|
_context4.next = 3;
|
|
277
|
-
return
|
|
212
|
+
return awsAmplify.Auth.currentAuthenticatedUser();
|
|
278
213
|
|
|
279
214
|
case 3:
|
|
280
|
-
|
|
215
|
+
user = _context4.sent;
|
|
281
216
|
|
|
282
|
-
if (
|
|
217
|
+
if (___default['default'].isUndefined(user) || user == null || user.username == null) {
|
|
283
218
|
console.log('redirecting to login');
|
|
284
219
|
self.props.history.push('/login');
|
|
285
220
|
}
|
|
@@ -1719,35 +1654,31 @@ function CanvasImageUploader(options) {
|
|
|
1719
1654
|
var fileActions = {
|
|
1720
1655
|
uploadMediaAsync: function () {
|
|
1721
1656
|
var _uploadMediaAsync = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(file, filename) {
|
|
1722
|
-
var newFilename,
|
|
1657
|
+
var newFilename, userId, url, _Config$env, baseUploadsUrl, uploadBucket;
|
|
1658
|
+
|
|
1723
1659
|
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
|
1724
1660
|
while (1) {
|
|
1725
1661
|
switch (_context.prev = _context.next) {
|
|
1726
1662
|
case 0:
|
|
1727
1663
|
newFilename = filename.replace(/[^a-z0-9+.]+/gi, '').toLowerCase();
|
|
1728
1664
|
_context.next = 3;
|
|
1729
|
-
return
|
|
1730
|
-
method: 'GET',
|
|
1731
|
-
url: getUrl('media', 'get/presignedurl', {
|
|
1732
|
-
filename: newFilename,
|
|
1733
|
-
contentType: file.type
|
|
1734
|
-
})
|
|
1735
|
-
});
|
|
1665
|
+
return getCurrentUserSub();
|
|
1736
1666
|
|
|
1737
1667
|
case 3:
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1668
|
+
userId = _context.sent;
|
|
1669
|
+
url = "uploads/users/".concat(userId, "/public/").concat(randomString(), "/").concat(newFilename);
|
|
1670
|
+
_Config$env = CoreConfig.env, baseUploadsUrl = _Config$env.baseUploadsUrl, uploadBucket = _Config$env.uploadBucket;
|
|
1671
|
+
_context.next = 8;
|
|
1672
|
+
return awsAmplify.Storage.put(url, file, {
|
|
1673
|
+
level: 'public',
|
|
1674
|
+
bucket: uploadBucket
|
|
1744
1675
|
});
|
|
1745
1676
|
|
|
1746
|
-
case 6:
|
|
1747
|
-
baseUploadsUrl = CoreConfig.env.baseUploadsUrl;
|
|
1748
|
-
return _context.abrupt("return", "".concat(baseUploadsUrl).concat(signedUrlRes.data.key));
|
|
1749
|
-
|
|
1750
1677
|
case 8:
|
|
1678
|
+
console.log('uploaded file', "".concat(baseUploadsUrl).concat(url));
|
|
1679
|
+
return _context.abrupt("return", "".concat(baseUploadsUrl).concat(url));
|
|
1680
|
+
|
|
1681
|
+
case 10:
|
|
1751
1682
|
case "end":
|
|
1752
1683
|
return _context.stop();
|
|
1753
1684
|
}
|
|
@@ -1761,15 +1692,6 @@ var fileActions = {
|
|
|
1761
1692
|
|
|
1762
1693
|
return uploadMediaAsync;
|
|
1763
1694
|
}(),
|
|
1764
|
-
// uploadMediaAsync: async (file, filename) => {
|
|
1765
|
-
// const newFilename = filename.replace(/[^a-z0-9+.]+/gi, '').toLowerCase();
|
|
1766
|
-
// const userId = await getCurrentUserSub();
|
|
1767
|
-
// const url = `uploads/users/${userId}/public/${randomString()}/${newFilename}`;
|
|
1768
|
-
// const { baseUploadsUrl, uploadBucket } = Config.env;
|
|
1769
|
-
// await Storage.put(url, file, { level: 'public', bucket: uploadBucket });
|
|
1770
|
-
// console.log('uploaded file', `${baseUploadsUrl}${url}`);
|
|
1771
|
-
// return `${baseUploadsUrl}${url}`;
|
|
1772
|
-
// },
|
|
1773
1695
|
// readBase64: async (file) => {
|
|
1774
1696
|
// return new Promise((resolve, reject) => {
|
|
1775
1697
|
// var reader = new FileReader();
|
|
@@ -1783,14 +1705,6 @@ var fileActions = {
|
|
|
1783
1705
|
// };
|
|
1784
1706
|
// });
|
|
1785
1707
|
// },
|
|
1786
|
-
getPresignedUrl: function getPresignedUrl(filename) {
|
|
1787
|
-
return authedFunction({
|
|
1788
|
-
method: 'GET',
|
|
1789
|
-
url: getUrl('media', 'get/presignedurl', {
|
|
1790
|
-
filename: filename
|
|
1791
|
-
})
|
|
1792
|
-
});
|
|
1793
|
-
},
|
|
1794
1708
|
compressImage: function compressImage(file, maxSize, quality, noCompress) {
|
|
1795
1709
|
return new Promise(function (resolve, reject) {
|
|
1796
1710
|
if (noCompress) {
|
|
@@ -4237,6 +4151,26 @@ var Comment = /*#__PURE__*/function (_Component) {
|
|
|
4237
4151
|
}
|
|
4238
4152
|
|
|
4239
4153
|
_createClass__default['default'](Comment, [{
|
|
4154
|
+
key: "renderImage",
|
|
4155
|
+
value: function renderImage(image) {
|
|
4156
|
+
if (___default['default'].isEmpty(image)) {
|
|
4157
|
+
return null;
|
|
4158
|
+
}
|
|
4159
|
+
|
|
4160
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
4161
|
+
className: "imageGrid"
|
|
4162
|
+
}, /*#__PURE__*/React__default['default'].createElement("a", {
|
|
4163
|
+
href: image,
|
|
4164
|
+
target: "_blank",
|
|
4165
|
+
rel: "noopener noreferrer"
|
|
4166
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
4167
|
+
className: "imageGrid_image",
|
|
4168
|
+
style: {
|
|
4169
|
+
backgroundImage: "url('".concat(get1400(image), "')")
|
|
4170
|
+
}
|
|
4171
|
+
})));
|
|
4172
|
+
}
|
|
4173
|
+
}, {
|
|
4240
4174
|
key: "renderComment",
|
|
4241
4175
|
value: function renderComment() {
|
|
4242
4176
|
var comment = this.props.comment;
|
|
@@ -4245,7 +4179,7 @@ var Comment = /*#__PURE__*/function (_Component) {
|
|
|
4245
4179
|
className: "comment"
|
|
4246
4180
|
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
4247
4181
|
className: "comment_text"
|
|
4248
|
-
}, toParagraphed(comment.Comment)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
4182
|
+
}, toParagraphed(comment.Comment)), this.renderImage(comment.Image), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
4249
4183
|
className: "comment_bottom"
|
|
4250
4184
|
}, /*#__PURE__*/React__default['default'].createElement(ProfilePic, {
|
|
4251
4185
|
className: "comment_profilePic",
|
|
@@ -5285,7 +5219,7 @@ var mapStateToProps$5 = function mapStateToProps() {
|
|
|
5285
5219
|
};
|
|
5286
5220
|
|
|
5287
5221
|
var FileInput = reactRedux.connect(mapStateToProps$5, {}, null, {
|
|
5288
|
-
|
|
5222
|
+
withRef: true
|
|
5289
5223
|
})(FileInputComponent);
|
|
5290
5224
|
|
|
5291
5225
|
function ownKeys$e(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -6994,6 +6928,7 @@ var ImageInputComponent = /*#__PURE__*/function (_Component) {
|
|
|
6994
6928
|
value: function renderLibraryImage(image, index, allowDelete) {
|
|
6995
6929
|
var _this7 = this;
|
|
6996
6930
|
|
|
6931
|
+
console.log(image);
|
|
6997
6932
|
var classes = 'imageInput imageInput-hasImage imageInput-libraryImage';
|
|
6998
6933
|
|
|
6999
6934
|
if (image.Selected) {
|
|
@@ -7392,7 +7327,7 @@ var mapStateToProps$2 = function mapStateToProps(state) {
|
|
|
7392
7327
|
};
|
|
7393
7328
|
|
|
7394
7329
|
var ImageInput = reactRedux.connect(mapStateToProps$2, {}, null, {
|
|
7395
|
-
|
|
7330
|
+
withRef: true
|
|
7396
7331
|
})(ImageInputComponent);
|
|
7397
7332
|
|
|
7398
7333
|
function _createSuper$m(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$m(); return function _createSuperInternal() { var Super = _getPrototypeOf__default['default'](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default['default'](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default['default'](this, result); }; }
|
|
@@ -8431,7 +8366,8 @@ var UserListing = /*#__PURE__*/function (_Component) {
|
|
|
8431
8366
|
marginRight: 8,
|
|
8432
8367
|
backgroundSize: 'cover',
|
|
8433
8368
|
backgroundPosition: 'center',
|
|
8434
|
-
backgroundImage: "url(".concat(this.getImage(), ")")
|
|
8369
|
+
backgroundImage: "url(".concat(this.getImage(), ")"),
|
|
8370
|
+
backgroundColor: COLOUR_BRANDING_MAIN
|
|
8435
8371
|
},
|
|
8436
8372
|
alt: "".concat(this.getText(), " Image")
|
|
8437
8373
|
});
|
|
@@ -9997,7 +9933,7 @@ var AudienceSelector = /*#__PURE__*/function (_Component) {
|
|
|
9997
9933
|
var toExport = reactRedux.connect(null, {
|
|
9998
9934
|
setAuth: setAuth
|
|
9999
9935
|
}, null, {
|
|
10000
|
-
|
|
9936
|
+
withRef: true
|
|
10001
9937
|
})(AudienceSelector);
|
|
10002
9938
|
|
|
10003
9939
|
function _createSuper$5(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$5(); return function _createSuperInternal() { var Super = _getPrototypeOf__default['default'](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default['default'](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default['default'](this, result); }; }
|
package/dist/index.esm.js
CHANGED
|
@@ -2,12 +2,12 @@ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
|
2
2
|
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
3
3
|
import _ from 'lodash';
|
|
4
4
|
import axios from 'axios';
|
|
5
|
+
import { Auth, Storage } from 'aws-amplify';
|
|
5
6
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
6
7
|
import moment from 'moment';
|
|
7
8
|
import React, { Component, PureComponent } from 'react';
|
|
8
9
|
import $ from 'jquery';
|
|
9
10
|
import Cookies from 'js-cookie';
|
|
10
|
-
import { Storage } from 'aws-amplify';
|
|
11
11
|
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
12
12
|
import _createClass from '@babel/runtime/helpers/createClass';
|
|
13
13
|
import _inherits from '@babel/runtime/helpers/inherits';
|
|
@@ -49,75 +49,7 @@ var CoreConfig = {
|
|
|
49
49
|
defaultAllowComments: true,
|
|
50
50
|
makeApiKey: '',
|
|
51
51
|
logo: '',
|
|
52
|
-
clientName: ''
|
|
53
|
-
AuthStrategy: {
|
|
54
|
-
getAccessToken: function () {
|
|
55
|
-
var _getAccessToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
56
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
57
|
-
while (1) {
|
|
58
|
-
switch (_context.prev = _context.next) {
|
|
59
|
-
case 0:
|
|
60
|
-
return _context.abrupt("return", null);
|
|
61
|
-
|
|
62
|
-
case 1:
|
|
63
|
-
case "end":
|
|
64
|
-
return _context.stop();
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}, _callee);
|
|
68
|
-
}));
|
|
69
|
-
|
|
70
|
-
function getAccessToken() {
|
|
71
|
-
return _getAccessToken.apply(this, arguments);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return getAccessToken;
|
|
75
|
-
}(),
|
|
76
|
-
getCurrentUserId: function () {
|
|
77
|
-
var _getCurrentUserId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
78
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
79
|
-
while (1) {
|
|
80
|
-
switch (_context2.prev = _context2.next) {
|
|
81
|
-
case 0:
|
|
82
|
-
return _context2.abrupt("return", null);
|
|
83
|
-
|
|
84
|
-
case 1:
|
|
85
|
-
case "end":
|
|
86
|
-
return _context2.stop();
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}, _callee2);
|
|
90
|
-
}));
|
|
91
|
-
|
|
92
|
-
function getCurrentUserId() {
|
|
93
|
-
return _getCurrentUserId.apply(this, arguments);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return getCurrentUserId;
|
|
97
|
-
}(),
|
|
98
|
-
hasActiveSession: function () {
|
|
99
|
-
var _hasActiveSession = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
100
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
101
|
-
while (1) {
|
|
102
|
-
switch (_context3.prev = _context3.next) {
|
|
103
|
-
case 0:
|
|
104
|
-
return _context3.abrupt("return", false);
|
|
105
|
-
|
|
106
|
-
case 1:
|
|
107
|
-
case "end":
|
|
108
|
-
return _context3.stop();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}, _callee3);
|
|
112
|
-
}));
|
|
113
|
-
|
|
114
|
-
function hasActiveSession() {
|
|
115
|
-
return _hasActiveSession.apply(this, arguments);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return hasActiveSession;
|
|
119
|
-
}()
|
|
120
|
-
}
|
|
52
|
+
clientName: ''
|
|
121
53
|
},
|
|
122
54
|
init: function init(environment) {
|
|
123
55
|
CoreConfig.env = environment;
|
|
@@ -126,28 +58,29 @@ var CoreConfig = {
|
|
|
126
58
|
|
|
127
59
|
var getSessionTokenAWS = /*#__PURE__*/function () {
|
|
128
60
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(prefix) {
|
|
129
|
-
var token;
|
|
61
|
+
var data, token;
|
|
130
62
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
131
63
|
while (1) {
|
|
132
64
|
switch (_context.prev = _context.next) {
|
|
133
65
|
case 0:
|
|
134
66
|
_context.next = 2;
|
|
135
|
-
return
|
|
67
|
+
return Auth.currentSession();
|
|
136
68
|
|
|
137
69
|
case 2:
|
|
138
|
-
|
|
70
|
+
data = _context.sent;
|
|
71
|
+
token = data.getAccessToken().getJwtToken();
|
|
139
72
|
|
|
140
73
|
if (!_.isUndefined(prefix)) {
|
|
141
|
-
_context.next =
|
|
74
|
+
_context.next = 6;
|
|
142
75
|
break;
|
|
143
76
|
}
|
|
144
77
|
|
|
145
78
|
return _context.abrupt("return", token);
|
|
146
79
|
|
|
147
|
-
case
|
|
80
|
+
case 6:
|
|
148
81
|
return _context.abrupt("return", "".concat(prefix, " ").concat(token));
|
|
149
82
|
|
|
150
|
-
case
|
|
83
|
+
case 7:
|
|
151
84
|
case "end":
|
|
152
85
|
return _context.stop();
|
|
153
86
|
}
|
|
@@ -207,28 +140,30 @@ var unauthedFunction = function unauthedFunction(request) {
|
|
|
207
140
|
};
|
|
208
141
|
var getCurrentUserSub = /*#__PURE__*/function () {
|
|
209
142
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
143
|
+
var user;
|
|
210
144
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
211
145
|
while (1) {
|
|
212
146
|
switch (_context3.prev = _context3.next) {
|
|
213
147
|
case 0:
|
|
214
148
|
_context3.prev = 0;
|
|
215
149
|
_context3.next = 3;
|
|
216
|
-
return
|
|
150
|
+
return Auth.currentUserInfo();
|
|
217
151
|
|
|
218
152
|
case 3:
|
|
219
|
-
|
|
153
|
+
user = _context3.sent;
|
|
154
|
+
return _context3.abrupt("return", user.id);
|
|
220
155
|
|
|
221
|
-
case
|
|
222
|
-
_context3.prev =
|
|
156
|
+
case 7:
|
|
157
|
+
_context3.prev = 7;
|
|
223
158
|
_context3.t0 = _context3["catch"](0);
|
|
224
159
|
return _context3.abrupt("return", null);
|
|
225
160
|
|
|
226
|
-
case
|
|
161
|
+
case 10:
|
|
227
162
|
case "end":
|
|
228
163
|
return _context3.stop();
|
|
229
164
|
}
|
|
230
165
|
}
|
|
231
|
-
}, _callee3, null, [[0,
|
|
166
|
+
}, _callee3, null, [[0, 7]]);
|
|
232
167
|
}));
|
|
233
168
|
|
|
234
169
|
return function getCurrentUserSub() {
|
|
@@ -237,19 +172,19 @@ var getCurrentUserSub = /*#__PURE__*/function () {
|
|
|
237
172
|
}();
|
|
238
173
|
var checkLoggedIn = /*#__PURE__*/function () {
|
|
239
174
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(self) {
|
|
240
|
-
var
|
|
175
|
+
var user;
|
|
241
176
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
242
177
|
while (1) {
|
|
243
178
|
switch (_context4.prev = _context4.next) {
|
|
244
179
|
case 0:
|
|
245
180
|
_context4.prev = 0;
|
|
246
181
|
_context4.next = 3;
|
|
247
|
-
return
|
|
182
|
+
return Auth.currentAuthenticatedUser();
|
|
248
183
|
|
|
249
184
|
case 3:
|
|
250
|
-
|
|
185
|
+
user = _context4.sent;
|
|
251
186
|
|
|
252
|
-
if (
|
|
187
|
+
if (_.isUndefined(user) || user == null || user.username == null) {
|
|
253
188
|
console.log('redirecting to login');
|
|
254
189
|
self.props.history.push('/login');
|
|
255
190
|
}
|
|
@@ -1689,35 +1624,31 @@ function CanvasImageUploader(options) {
|
|
|
1689
1624
|
var fileActions = {
|
|
1690
1625
|
uploadMediaAsync: function () {
|
|
1691
1626
|
var _uploadMediaAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(file, filename) {
|
|
1692
|
-
var newFilename,
|
|
1627
|
+
var newFilename, userId, url, _Config$env, baseUploadsUrl, uploadBucket;
|
|
1628
|
+
|
|
1693
1629
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
1694
1630
|
while (1) {
|
|
1695
1631
|
switch (_context.prev = _context.next) {
|
|
1696
1632
|
case 0:
|
|
1697
1633
|
newFilename = filename.replace(/[^a-z0-9+.]+/gi, '').toLowerCase();
|
|
1698
1634
|
_context.next = 3;
|
|
1699
|
-
return
|
|
1700
|
-
method: 'GET',
|
|
1701
|
-
url: getUrl('media', 'get/presignedurl', {
|
|
1702
|
-
filename: newFilename,
|
|
1703
|
-
contentType: file.type
|
|
1704
|
-
})
|
|
1705
|
-
});
|
|
1635
|
+
return getCurrentUserSub();
|
|
1706
1636
|
|
|
1707
1637
|
case 3:
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1638
|
+
userId = _context.sent;
|
|
1639
|
+
url = "uploads/users/".concat(userId, "/public/").concat(randomString(), "/").concat(newFilename);
|
|
1640
|
+
_Config$env = CoreConfig.env, baseUploadsUrl = _Config$env.baseUploadsUrl, uploadBucket = _Config$env.uploadBucket;
|
|
1641
|
+
_context.next = 8;
|
|
1642
|
+
return Storage.put(url, file, {
|
|
1643
|
+
level: 'public',
|
|
1644
|
+
bucket: uploadBucket
|
|
1714
1645
|
});
|
|
1715
1646
|
|
|
1716
|
-
case 6:
|
|
1717
|
-
baseUploadsUrl = CoreConfig.env.baseUploadsUrl;
|
|
1718
|
-
return _context.abrupt("return", "".concat(baseUploadsUrl).concat(signedUrlRes.data.key));
|
|
1719
|
-
|
|
1720
1647
|
case 8:
|
|
1648
|
+
console.log('uploaded file', "".concat(baseUploadsUrl).concat(url));
|
|
1649
|
+
return _context.abrupt("return", "".concat(baseUploadsUrl).concat(url));
|
|
1650
|
+
|
|
1651
|
+
case 10:
|
|
1721
1652
|
case "end":
|
|
1722
1653
|
return _context.stop();
|
|
1723
1654
|
}
|
|
@@ -1731,15 +1662,6 @@ var fileActions = {
|
|
|
1731
1662
|
|
|
1732
1663
|
return uploadMediaAsync;
|
|
1733
1664
|
}(),
|
|
1734
|
-
// uploadMediaAsync: async (file, filename) => {
|
|
1735
|
-
// const newFilename = filename.replace(/[^a-z0-9+.]+/gi, '').toLowerCase();
|
|
1736
|
-
// const userId = await getCurrentUserSub();
|
|
1737
|
-
// const url = `uploads/users/${userId}/public/${randomString()}/${newFilename}`;
|
|
1738
|
-
// const { baseUploadsUrl, uploadBucket } = Config.env;
|
|
1739
|
-
// await Storage.put(url, file, { level: 'public', bucket: uploadBucket });
|
|
1740
|
-
// console.log('uploaded file', `${baseUploadsUrl}${url}`);
|
|
1741
|
-
// return `${baseUploadsUrl}${url}`;
|
|
1742
|
-
// },
|
|
1743
1665
|
// readBase64: async (file) => {
|
|
1744
1666
|
// return new Promise((resolve, reject) => {
|
|
1745
1667
|
// var reader = new FileReader();
|
|
@@ -1753,14 +1675,6 @@ var fileActions = {
|
|
|
1753
1675
|
// };
|
|
1754
1676
|
// });
|
|
1755
1677
|
// },
|
|
1756
|
-
getPresignedUrl: function getPresignedUrl(filename) {
|
|
1757
|
-
return authedFunction({
|
|
1758
|
-
method: 'GET',
|
|
1759
|
-
url: getUrl('media', 'get/presignedurl', {
|
|
1760
|
-
filename: filename
|
|
1761
|
-
})
|
|
1762
|
-
});
|
|
1763
|
-
},
|
|
1764
1678
|
compressImage: function compressImage(file, maxSize, quality, noCompress) {
|
|
1765
1679
|
return new Promise(function (resolve, reject) {
|
|
1766
1680
|
if (noCompress) {
|
|
@@ -4207,6 +4121,26 @@ var Comment = /*#__PURE__*/function (_Component) {
|
|
|
4207
4121
|
}
|
|
4208
4122
|
|
|
4209
4123
|
_createClass(Comment, [{
|
|
4124
|
+
key: "renderImage",
|
|
4125
|
+
value: function renderImage(image) {
|
|
4126
|
+
if (_.isEmpty(image)) {
|
|
4127
|
+
return null;
|
|
4128
|
+
}
|
|
4129
|
+
|
|
4130
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
4131
|
+
className: "imageGrid"
|
|
4132
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
4133
|
+
href: image,
|
|
4134
|
+
target: "_blank",
|
|
4135
|
+
rel: "noopener noreferrer"
|
|
4136
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4137
|
+
className: "imageGrid_image",
|
|
4138
|
+
style: {
|
|
4139
|
+
backgroundImage: "url('".concat(get1400(image), "')")
|
|
4140
|
+
}
|
|
4141
|
+
})));
|
|
4142
|
+
}
|
|
4143
|
+
}, {
|
|
4210
4144
|
key: "renderComment",
|
|
4211
4145
|
value: function renderComment() {
|
|
4212
4146
|
var comment = this.props.comment;
|
|
@@ -4215,7 +4149,7 @@ var Comment = /*#__PURE__*/function (_Component) {
|
|
|
4215
4149
|
className: "comment"
|
|
4216
4150
|
}, /*#__PURE__*/React.createElement("p", {
|
|
4217
4151
|
className: "comment_text"
|
|
4218
|
-
}, toParagraphed(comment.Comment)), /*#__PURE__*/React.createElement("div", {
|
|
4152
|
+
}, toParagraphed(comment.Comment)), this.renderImage(comment.Image), /*#__PURE__*/React.createElement("div", {
|
|
4219
4153
|
className: "comment_bottom"
|
|
4220
4154
|
}, /*#__PURE__*/React.createElement(ProfilePic, {
|
|
4221
4155
|
className: "comment_profilePic",
|
|
@@ -5255,7 +5189,7 @@ var mapStateToProps$5 = function mapStateToProps() {
|
|
|
5255
5189
|
};
|
|
5256
5190
|
|
|
5257
5191
|
var FileInput = connect(mapStateToProps$5, {}, null, {
|
|
5258
|
-
|
|
5192
|
+
withRef: true
|
|
5259
5193
|
})(FileInputComponent);
|
|
5260
5194
|
|
|
5261
5195
|
function ownKeys$e(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -6964,6 +6898,7 @@ var ImageInputComponent = /*#__PURE__*/function (_Component) {
|
|
|
6964
6898
|
value: function renderLibraryImage(image, index, allowDelete) {
|
|
6965
6899
|
var _this7 = this;
|
|
6966
6900
|
|
|
6901
|
+
console.log(image);
|
|
6967
6902
|
var classes = 'imageInput imageInput-hasImage imageInput-libraryImage';
|
|
6968
6903
|
|
|
6969
6904
|
if (image.Selected) {
|
|
@@ -7362,7 +7297,7 @@ var mapStateToProps$2 = function mapStateToProps(state) {
|
|
|
7362
7297
|
};
|
|
7363
7298
|
|
|
7364
7299
|
var ImageInput = connect(mapStateToProps$2, {}, null, {
|
|
7365
|
-
|
|
7300
|
+
withRef: true
|
|
7366
7301
|
})(ImageInputComponent);
|
|
7367
7302
|
|
|
7368
7303
|
function _createSuper$m(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$m(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
@@ -8401,7 +8336,8 @@ var UserListing = /*#__PURE__*/function (_Component) {
|
|
|
8401
8336
|
marginRight: 8,
|
|
8402
8337
|
backgroundSize: 'cover',
|
|
8403
8338
|
backgroundPosition: 'center',
|
|
8404
|
-
backgroundImage: "url(".concat(this.getImage(), ")")
|
|
8339
|
+
backgroundImage: "url(".concat(this.getImage(), ")"),
|
|
8340
|
+
backgroundColor: COLOUR_BRANDING_MAIN
|
|
8405
8341
|
},
|
|
8406
8342
|
alt: "".concat(this.getText(), " Image")
|
|
8407
8343
|
});
|
|
@@ -9967,7 +9903,7 @@ var AudienceSelector = /*#__PURE__*/function (_Component) {
|
|
|
9967
9903
|
var toExport = connect(null, {
|
|
9968
9904
|
setAuth: setAuth
|
|
9969
9905
|
}, null, {
|
|
9970
|
-
|
|
9906
|
+
withRef: true
|
|
9971
9907
|
})(AudienceSelector);
|
|
9972
9908
|
|
|
9973
9909
|
function _createSuper$5(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$5(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
package/dist/index.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@babel/runtime/helpers/asyncToGenerator'), require('@babel/runtime/regenerator'), require('lodash'), require('axios'), require('@babel/runtime/helpers/defineProperty'), require('moment'), require('react'), require('jquery'), require('js-cookie'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@babel/runtime/helpers/asyncToGenerator', '@babel/runtime/regenerator', 'lodash', 'axios', '@babel/runtime/helpers/defineProperty', 'moment', 'react', 'jquery', 'js-cookie', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['@plusscommunities/pluss-core-web'] = {}, global._asyncToGenerator, global._regeneratorRuntime, global._, global.axios, global._defineProperty, global.moment, global.React, global.$, global.Cookies, global.
|
|
5
|
-
}(this, (function (exports, _asyncToGenerator, _regeneratorRuntime, _, axios, _defineProperty, moment, React, $, Cookies,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@babel/runtime/helpers/asyncToGenerator'), require('@babel/runtime/regenerator'), require('lodash'), require('axios'), require('aws-amplify'), require('@babel/runtime/helpers/defineProperty'), require('moment'), require('react'), require('jquery'), require('js-cookie'), require('@babel/runtime/helpers/classCallCheck'), require('@babel/runtime/helpers/createClass'), require('@babel/runtime/helpers/inherits'), require('@babel/runtime/helpers/possibleConstructorReturn'), require('@babel/runtime/helpers/getPrototypeOf'), require('react-fontawesome'), require('@babel/runtime/helpers/extends'), require('@babel/runtime/helpers/assertThisInitialized'), require('react-redux'), require('react-textarea-autosize'), require('@babel/runtime/helpers/toConsumableArray'), require('@babel/runtime/helpers/typeof'), require('react-dropzone'), require('react-router'), require('react-bootstrap'), require('@fortawesome/react-fontawesome'), require('@crello/react-lottie'), require('react-csv'), require('@babel/runtime/helpers/objectWithoutProperties'), require('react-color'), require('tinycolor2'), require('react-router-dom'), require('@fortawesome/free-solid-svg-icons')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@babel/runtime/helpers/asyncToGenerator', '@babel/runtime/regenerator', 'lodash', 'axios', 'aws-amplify', '@babel/runtime/helpers/defineProperty', 'moment', 'react', 'jquery', 'js-cookie', '@babel/runtime/helpers/classCallCheck', '@babel/runtime/helpers/createClass', '@babel/runtime/helpers/inherits', '@babel/runtime/helpers/possibleConstructorReturn', '@babel/runtime/helpers/getPrototypeOf', 'react-fontawesome', '@babel/runtime/helpers/extends', '@babel/runtime/helpers/assertThisInitialized', 'react-redux', 'react-textarea-autosize', '@babel/runtime/helpers/toConsumableArray', '@babel/runtime/helpers/typeof', 'react-dropzone', 'react-router', 'react-bootstrap', '@fortawesome/react-fontawesome', '@crello/react-lottie', 'react-csv', '@babel/runtime/helpers/objectWithoutProperties', 'react-color', 'tinycolor2', 'react-router-dom', '@fortawesome/free-solid-svg-icons'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['@plusscommunities/pluss-core-web'] = {}, global._asyncToGenerator, global._regeneratorRuntime, global._, global.axios, global.awsAmplify, global._defineProperty, global.moment, global.React, global.$, global.Cookies, global._classCallCheck, global._createClass, global._inherits, global._possibleConstructorReturn, global._getPrototypeOf, global.FontAwesome, global._extends, global._assertThisInitialized, global.reactRedux, global.Textarea, global._toConsumableArray, global._typeof, global.Dropzone, global.reactRouter, global.reactBootstrap, global.reactFontawesome, global.reactLottie, global.reactCsv, global._objectWithoutProperties, global.reactColor, global.tinycolor, global.reactRouterDom, global.freeSolidSvgIcons));
|
|
5
|
+
}(this, (function (exports, _asyncToGenerator, _regeneratorRuntime, _, axios, awsAmplify, _defineProperty, moment, React, $, Cookies, _classCallCheck, _createClass, _inherits, _possibleConstructorReturn, _getPrototypeOf, FontAwesome, _extends, _assertThisInitialized, reactRedux, Textarea, _toConsumableArray, _typeof, Dropzone, reactRouter, reactBootstrap, reactFontawesome, reactLottie, reactCsv, _objectWithoutProperties, reactColor, tinycolor, reactRouterDom, freeSolidSvgIcons) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -47,75 +47,7 @@
|
|
|
47
47
|
defaultAllowComments: true,
|
|
48
48
|
makeApiKey: '',
|
|
49
49
|
logo: '',
|
|
50
|
-
clientName: ''
|
|
51
|
-
AuthStrategy: {
|
|
52
|
-
getAccessToken: function () {
|
|
53
|
-
var _getAccessToken = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee() {
|
|
54
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
|
55
|
-
while (1) {
|
|
56
|
-
switch (_context.prev = _context.next) {
|
|
57
|
-
case 0:
|
|
58
|
-
return _context.abrupt("return", null);
|
|
59
|
-
|
|
60
|
-
case 1:
|
|
61
|
-
case "end":
|
|
62
|
-
return _context.stop();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}, _callee);
|
|
66
|
-
}));
|
|
67
|
-
|
|
68
|
-
function getAccessToken() {
|
|
69
|
-
return _getAccessToken.apply(this, arguments);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return getAccessToken;
|
|
73
|
-
}(),
|
|
74
|
-
getCurrentUserId: function () {
|
|
75
|
-
var _getCurrentUserId = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2() {
|
|
76
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
|
77
|
-
while (1) {
|
|
78
|
-
switch (_context2.prev = _context2.next) {
|
|
79
|
-
case 0:
|
|
80
|
-
return _context2.abrupt("return", null);
|
|
81
|
-
|
|
82
|
-
case 1:
|
|
83
|
-
case "end":
|
|
84
|
-
return _context2.stop();
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}, _callee2);
|
|
88
|
-
}));
|
|
89
|
-
|
|
90
|
-
function getCurrentUserId() {
|
|
91
|
-
return _getCurrentUserId.apply(this, arguments);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
return getCurrentUserId;
|
|
95
|
-
}(),
|
|
96
|
-
hasActiveSession: function () {
|
|
97
|
-
var _hasActiveSession = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3() {
|
|
98
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
|
|
99
|
-
while (1) {
|
|
100
|
-
switch (_context3.prev = _context3.next) {
|
|
101
|
-
case 0:
|
|
102
|
-
return _context3.abrupt("return", false);
|
|
103
|
-
|
|
104
|
-
case 1:
|
|
105
|
-
case "end":
|
|
106
|
-
return _context3.stop();
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}, _callee3);
|
|
110
|
-
}));
|
|
111
|
-
|
|
112
|
-
function hasActiveSession() {
|
|
113
|
-
return _hasActiveSession.apply(this, arguments);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return hasActiveSession;
|
|
117
|
-
}()
|
|
118
|
-
}
|
|
50
|
+
clientName: ''
|
|
119
51
|
},
|
|
120
52
|
init: function init(environment) {
|
|
121
53
|
CoreConfig.env = environment;
|
|
@@ -124,28 +56,29 @@
|
|
|
124
56
|
|
|
125
57
|
var getSessionTokenAWS = /*#__PURE__*/function () {
|
|
126
58
|
var _ref = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(prefix) {
|
|
127
|
-
var token;
|
|
59
|
+
var data, token;
|
|
128
60
|
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
|
129
61
|
while (1) {
|
|
130
62
|
switch (_context.prev = _context.next) {
|
|
131
63
|
case 0:
|
|
132
64
|
_context.next = 2;
|
|
133
|
-
return
|
|
65
|
+
return awsAmplify.Auth.currentSession();
|
|
134
66
|
|
|
135
67
|
case 2:
|
|
136
|
-
|
|
68
|
+
data = _context.sent;
|
|
69
|
+
token = data.getAccessToken().getJwtToken();
|
|
137
70
|
|
|
138
71
|
if (!___default['default'].isUndefined(prefix)) {
|
|
139
|
-
_context.next =
|
|
72
|
+
_context.next = 6;
|
|
140
73
|
break;
|
|
141
74
|
}
|
|
142
75
|
|
|
143
76
|
return _context.abrupt("return", token);
|
|
144
77
|
|
|
145
|
-
case
|
|
78
|
+
case 6:
|
|
146
79
|
return _context.abrupt("return", "".concat(prefix, " ").concat(token));
|
|
147
80
|
|
|
148
|
-
case
|
|
81
|
+
case 7:
|
|
149
82
|
case "end":
|
|
150
83
|
return _context.stop();
|
|
151
84
|
}
|
|
@@ -205,28 +138,30 @@
|
|
|
205
138
|
};
|
|
206
139
|
var getCurrentUserSub = /*#__PURE__*/function () {
|
|
207
140
|
var _ref3 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3() {
|
|
141
|
+
var user;
|
|
208
142
|
return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
|
|
209
143
|
while (1) {
|
|
210
144
|
switch (_context3.prev = _context3.next) {
|
|
211
145
|
case 0:
|
|
212
146
|
_context3.prev = 0;
|
|
213
147
|
_context3.next = 3;
|
|
214
|
-
return
|
|
148
|
+
return awsAmplify.Auth.currentUserInfo();
|
|
215
149
|
|
|
216
150
|
case 3:
|
|
217
|
-
|
|
151
|
+
user = _context3.sent;
|
|
152
|
+
return _context3.abrupt("return", user.id);
|
|
218
153
|
|
|
219
|
-
case
|
|
220
|
-
_context3.prev =
|
|
154
|
+
case 7:
|
|
155
|
+
_context3.prev = 7;
|
|
221
156
|
_context3.t0 = _context3["catch"](0);
|
|
222
157
|
return _context3.abrupt("return", null);
|
|
223
158
|
|
|
224
|
-
case
|
|
159
|
+
case 10:
|
|
225
160
|
case "end":
|
|
226
161
|
return _context3.stop();
|
|
227
162
|
}
|
|
228
163
|
}
|
|
229
|
-
}, _callee3, null, [[0,
|
|
164
|
+
}, _callee3, null, [[0, 7]]);
|
|
230
165
|
}));
|
|
231
166
|
|
|
232
167
|
return function getCurrentUserSub() {
|
|
@@ -235,19 +170,19 @@
|
|
|
235
170
|
}();
|
|
236
171
|
var checkLoggedIn = /*#__PURE__*/function () {
|
|
237
172
|
var _ref4 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee4(self) {
|
|
238
|
-
var
|
|
173
|
+
var user;
|
|
239
174
|
return _regeneratorRuntime__default['default'].wrap(function _callee4$(_context4) {
|
|
240
175
|
while (1) {
|
|
241
176
|
switch (_context4.prev = _context4.next) {
|
|
242
177
|
case 0:
|
|
243
178
|
_context4.prev = 0;
|
|
244
179
|
_context4.next = 3;
|
|
245
|
-
return
|
|
180
|
+
return awsAmplify.Auth.currentAuthenticatedUser();
|
|
246
181
|
|
|
247
182
|
case 3:
|
|
248
|
-
|
|
183
|
+
user = _context4.sent;
|
|
249
184
|
|
|
250
|
-
if (
|
|
185
|
+
if (___default['default'].isUndefined(user) || user == null || user.username == null) {
|
|
251
186
|
console.log('redirecting to login');
|
|
252
187
|
self.props.history.push('/login');
|
|
253
188
|
}
|
|
@@ -1687,35 +1622,31 @@
|
|
|
1687
1622
|
var fileActions = {
|
|
1688
1623
|
uploadMediaAsync: function () {
|
|
1689
1624
|
var _uploadMediaAsync = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(file, filename) {
|
|
1690
|
-
var newFilename,
|
|
1625
|
+
var newFilename, userId, url, _Config$env, baseUploadsUrl, uploadBucket;
|
|
1626
|
+
|
|
1691
1627
|
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
|
1692
1628
|
while (1) {
|
|
1693
1629
|
switch (_context.prev = _context.next) {
|
|
1694
1630
|
case 0:
|
|
1695
1631
|
newFilename = filename.replace(/[^a-z0-9+.]+/gi, '').toLowerCase();
|
|
1696
1632
|
_context.next = 3;
|
|
1697
|
-
return
|
|
1698
|
-
method: 'GET',
|
|
1699
|
-
url: getUrl('media', 'get/presignedurl', {
|
|
1700
|
-
filename: newFilename,
|
|
1701
|
-
contentType: file.type
|
|
1702
|
-
})
|
|
1703
|
-
});
|
|
1633
|
+
return getCurrentUserSub();
|
|
1704
1634
|
|
|
1705
1635
|
case 3:
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1636
|
+
userId = _context.sent;
|
|
1637
|
+
url = "uploads/users/".concat(userId, "/public/").concat(randomString(), "/").concat(newFilename);
|
|
1638
|
+
_Config$env = CoreConfig.env, baseUploadsUrl = _Config$env.baseUploadsUrl, uploadBucket = _Config$env.uploadBucket;
|
|
1639
|
+
_context.next = 8;
|
|
1640
|
+
return awsAmplify.Storage.put(url, file, {
|
|
1641
|
+
level: 'public',
|
|
1642
|
+
bucket: uploadBucket
|
|
1712
1643
|
});
|
|
1713
1644
|
|
|
1714
|
-
case 6:
|
|
1715
|
-
baseUploadsUrl = CoreConfig.env.baseUploadsUrl;
|
|
1716
|
-
return _context.abrupt("return", "".concat(baseUploadsUrl).concat(signedUrlRes.data.key));
|
|
1717
|
-
|
|
1718
1645
|
case 8:
|
|
1646
|
+
console.log('uploaded file', "".concat(baseUploadsUrl).concat(url));
|
|
1647
|
+
return _context.abrupt("return", "".concat(baseUploadsUrl).concat(url));
|
|
1648
|
+
|
|
1649
|
+
case 10:
|
|
1719
1650
|
case "end":
|
|
1720
1651
|
return _context.stop();
|
|
1721
1652
|
}
|
|
@@ -1729,15 +1660,6 @@
|
|
|
1729
1660
|
|
|
1730
1661
|
return uploadMediaAsync;
|
|
1731
1662
|
}(),
|
|
1732
|
-
// uploadMediaAsync: async (file, filename) => {
|
|
1733
|
-
// const newFilename = filename.replace(/[^a-z0-9+.]+/gi, '').toLowerCase();
|
|
1734
|
-
// const userId = await getCurrentUserSub();
|
|
1735
|
-
// const url = `uploads/users/${userId}/public/${randomString()}/${newFilename}`;
|
|
1736
|
-
// const { baseUploadsUrl, uploadBucket } = Config.env;
|
|
1737
|
-
// await Storage.put(url, file, { level: 'public', bucket: uploadBucket });
|
|
1738
|
-
// console.log('uploaded file', `${baseUploadsUrl}${url}`);
|
|
1739
|
-
// return `${baseUploadsUrl}${url}`;
|
|
1740
|
-
// },
|
|
1741
1663
|
// readBase64: async (file) => {
|
|
1742
1664
|
// return new Promise((resolve, reject) => {
|
|
1743
1665
|
// var reader = new FileReader();
|
|
@@ -1751,14 +1673,6 @@
|
|
|
1751
1673
|
// };
|
|
1752
1674
|
// });
|
|
1753
1675
|
// },
|
|
1754
|
-
getPresignedUrl: function getPresignedUrl(filename) {
|
|
1755
|
-
return authedFunction({
|
|
1756
|
-
method: 'GET',
|
|
1757
|
-
url: getUrl('media', 'get/presignedurl', {
|
|
1758
|
-
filename: filename
|
|
1759
|
-
})
|
|
1760
|
-
});
|
|
1761
|
-
},
|
|
1762
1676
|
compressImage: function compressImage(file, maxSize, quality, noCompress) {
|
|
1763
1677
|
return new Promise(function (resolve, reject) {
|
|
1764
1678
|
if (noCompress) {
|
|
@@ -4205,6 +4119,26 @@
|
|
|
4205
4119
|
}
|
|
4206
4120
|
|
|
4207
4121
|
_createClass__default['default'](Comment, [{
|
|
4122
|
+
key: "renderImage",
|
|
4123
|
+
value: function renderImage(image) {
|
|
4124
|
+
if (___default['default'].isEmpty(image)) {
|
|
4125
|
+
return null;
|
|
4126
|
+
}
|
|
4127
|
+
|
|
4128
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
4129
|
+
className: "imageGrid"
|
|
4130
|
+
}, /*#__PURE__*/React__default['default'].createElement("a", {
|
|
4131
|
+
href: image,
|
|
4132
|
+
target: "_blank",
|
|
4133
|
+
rel: "noopener noreferrer"
|
|
4134
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
4135
|
+
className: "imageGrid_image",
|
|
4136
|
+
style: {
|
|
4137
|
+
backgroundImage: "url('".concat(get1400(image), "')")
|
|
4138
|
+
}
|
|
4139
|
+
})));
|
|
4140
|
+
}
|
|
4141
|
+
}, {
|
|
4208
4142
|
key: "renderComment",
|
|
4209
4143
|
value: function renderComment() {
|
|
4210
4144
|
var comment = this.props.comment;
|
|
@@ -4213,7 +4147,7 @@
|
|
|
4213
4147
|
className: "comment"
|
|
4214
4148
|
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
4215
4149
|
className: "comment_text"
|
|
4216
|
-
}, toParagraphed(comment.Comment)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
4150
|
+
}, toParagraphed(comment.Comment)), this.renderImage(comment.Image), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
4217
4151
|
className: "comment_bottom"
|
|
4218
4152
|
}, /*#__PURE__*/React__default['default'].createElement(ProfilePic, {
|
|
4219
4153
|
className: "comment_profilePic",
|
|
@@ -5253,7 +5187,7 @@
|
|
|
5253
5187
|
};
|
|
5254
5188
|
|
|
5255
5189
|
var FileInput = reactRedux.connect(mapStateToProps$5, {}, null, {
|
|
5256
|
-
|
|
5190
|
+
withRef: true
|
|
5257
5191
|
})(FileInputComponent);
|
|
5258
5192
|
|
|
5259
5193
|
function ownKeys$e(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -6962,6 +6896,7 @@
|
|
|
6962
6896
|
value: function renderLibraryImage(image, index, allowDelete) {
|
|
6963
6897
|
var _this7 = this;
|
|
6964
6898
|
|
|
6899
|
+
console.log(image);
|
|
6965
6900
|
var classes = 'imageInput imageInput-hasImage imageInput-libraryImage';
|
|
6966
6901
|
|
|
6967
6902
|
if (image.Selected) {
|
|
@@ -7360,7 +7295,7 @@
|
|
|
7360
7295
|
};
|
|
7361
7296
|
|
|
7362
7297
|
var ImageInput = reactRedux.connect(mapStateToProps$2, {}, null, {
|
|
7363
|
-
|
|
7298
|
+
withRef: true
|
|
7364
7299
|
})(ImageInputComponent);
|
|
7365
7300
|
|
|
7366
7301
|
function _createSuper$m(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$m(); return function _createSuperInternal() { var Super = _getPrototypeOf__default['default'](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default['default'](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default['default'](this, result); }; }
|
|
@@ -8399,7 +8334,8 @@
|
|
|
8399
8334
|
marginRight: 8,
|
|
8400
8335
|
backgroundSize: 'cover',
|
|
8401
8336
|
backgroundPosition: 'center',
|
|
8402
|
-
backgroundImage: "url(".concat(this.getImage(), ")")
|
|
8337
|
+
backgroundImage: "url(".concat(this.getImage(), ")"),
|
|
8338
|
+
backgroundColor: COLOUR_BRANDING_MAIN
|
|
8403
8339
|
},
|
|
8404
8340
|
alt: "".concat(this.getText(), " Image")
|
|
8405
8341
|
});
|
|
@@ -9965,7 +9901,7 @@
|
|
|
9965
9901
|
var toExport = reactRedux.connect(null, {
|
|
9966
9902
|
setAuth: setAuth
|
|
9967
9903
|
}, null, {
|
|
9968
|
-
|
|
9904
|
+
withRef: true
|
|
9969
9905
|
})(AudienceSelector);
|
|
9970
9906
|
|
|
9971
9907
|
function _createSuper$5(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$5(); return function _createSuperInternal() { var Super = _getPrototypeOf__default['default'](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default['default'](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default['default'](this, result); }; }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plusscommunities/pluss-core-web",
|
|
3
|
-
"version": "1.4.36
|
|
3
|
+
"version": "1.4.36",
|
|
4
4
|
"description": "Core extension package for Pluss Communities platform",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,9 +9,6 @@
|
|
|
9
9
|
"patch": "npm version patch",
|
|
10
10
|
"betaupload": "npm run build && npm publish --access public --tag beta && rm -rf node_modules",
|
|
11
11
|
"betaupload:p": "npm run betapatch && npm run betaupload",
|
|
12
|
-
"authpatch": "npm version prepatch --preid=auth",
|
|
13
|
-
"authupload": "npm run build && npm publish --access public --tag auth && rm -rf node_modules",
|
|
14
|
-
"authupload:p": "npm run authpatch && npm run authupload",
|
|
15
12
|
"upload": "npm run build && npm publish --access public && rm -rf node_modules",
|
|
16
13
|
"upload:p": "npm run patch && npm run upload"
|
|
17
14
|
},
|
|
@@ -31,9 +28,7 @@
|
|
|
31
28
|
"rollup-plugin-styles": "^3.14.1"
|
|
32
29
|
},
|
|
33
30
|
"dependencies": {
|
|
34
|
-
"@babel/runtime": "^7.14.0"
|
|
35
|
-
},
|
|
36
|
-
"peerDependencies": {
|
|
31
|
+
"@babel/runtime": "^7.14.0",
|
|
37
32
|
"@fortawesome/fontawesome-svg-core": "^6.4.0",
|
|
38
33
|
"@fortawesome/free-solid-svg-icons": "^6.4.0",
|
|
39
34
|
"@fortawesome/react-fontawesome": "^0.2.0",
|
|
@@ -44,7 +39,7 @@
|
|
|
44
39
|
"react": "^16.14.0",
|
|
45
40
|
"react-dropzone": "^14.2.3",
|
|
46
41
|
"react-fontawesome": "^1.6.1",
|
|
47
|
-
"react-redux": "^
|
|
42
|
+
"react-redux": "^5.0.6",
|
|
48
43
|
"react-router-dom": "^4.2.2",
|
|
49
44
|
"react-textarea-autosize": "^7.1.0-1"
|
|
50
45
|
},
|
package/src/apis/fileActions.js
CHANGED
|
@@ -4,33 +4,18 @@ import { Storage } from 'aws-amplify';
|
|
|
4
4
|
import CanvasImageUploader from '../helper/files/canvasImageUploader';
|
|
5
5
|
import $ from 'jquery';
|
|
6
6
|
import { generateImageName, randomString, getUrl } from '../helper';
|
|
7
|
-
import Axios from 'axios';
|
|
8
7
|
|
|
9
8
|
export const fileActions = {
|
|
10
9
|
uploadMediaAsync: async (file, filename) => {
|
|
11
10
|
const newFilename = filename.replace(/[^a-z0-9+.]+/gi, '').toLowerCase();
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
url: getUrl('media', 'get/presignedurl', { filename: newFilename, contentType: file.type }),
|
|
15
|
-
});
|
|
16
|
-
await Axios.put(signedUrlRes.data.url, file, {
|
|
17
|
-
headers: {
|
|
18
|
-
'Content-Type': file.type,
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
const { baseUploadsUrl } = Config.env;
|
|
22
|
-
return `${baseUploadsUrl}${signedUrlRes.data.key}`;
|
|
23
|
-
},
|
|
24
|
-
// uploadMediaAsync: async (file, filename) => {
|
|
25
|
-
// const newFilename = filename.replace(/[^a-z0-9+.]+/gi, '').toLowerCase();
|
|
26
|
-
// const userId = await getCurrentUserSub();
|
|
27
|
-
// const url = `uploads/users/${userId}/public/${randomString()}/${newFilename}`;
|
|
11
|
+
const userId = await getCurrentUserSub();
|
|
12
|
+
const url = `uploads/users/${userId}/public/${randomString()}/${newFilename}`;
|
|
28
13
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
14
|
+
const { baseUploadsUrl, uploadBucket } = Config.env;
|
|
15
|
+
await Storage.put(url, file, { level: 'public', bucket: uploadBucket });
|
|
16
|
+
console.log('uploaded file', `${baseUploadsUrl}${url}`);
|
|
17
|
+
return `${baseUploadsUrl}${url}`;
|
|
18
|
+
},
|
|
34
19
|
|
|
35
20
|
// readBase64: async (file) => {
|
|
36
21
|
// return new Promise((resolve, reject) => {
|
|
@@ -45,12 +30,6 @@ export const fileActions = {
|
|
|
45
30
|
// };
|
|
46
31
|
// });
|
|
47
32
|
// },
|
|
48
|
-
getPresignedUrl: (filename) => {
|
|
49
|
-
return authedFunction({
|
|
50
|
-
method: 'GET',
|
|
51
|
-
url: getUrl('media', 'get/presignedurl', { filename }),
|
|
52
|
-
});
|
|
53
|
-
},
|
|
54
33
|
compressImage: (file, maxSize, quality, noCompress) => {
|
|
55
34
|
return new Promise((resolve, reject) => {
|
|
56
35
|
if (noCompress) {
|
|
@@ -647,6 +647,6 @@ class AudienceSelector extends Component {
|
|
|
647
647
|
}
|
|
648
648
|
}
|
|
649
649
|
|
|
650
|
-
const toExport = connect(null, { setAuth }, null, {
|
|
650
|
+
const toExport = connect(null, { setAuth }, null, { withRef: true })(AudienceSelector);
|
|
651
651
|
|
|
652
652
|
export { toExport as AudienceSelector };
|
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
import moment from 'moment';
|
|
3
|
-
import { toParagraphed } from '../helper';
|
|
3
|
+
import { get1400, toParagraphed } from '../helper';
|
|
4
4
|
import { ProfilePic } from './ProfilePic';
|
|
5
|
+
import _ from 'lodash';
|
|
5
6
|
|
|
6
7
|
class Comment extends Component {
|
|
8
|
+
renderImage(image) {
|
|
9
|
+
if (_.isEmpty(image)) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
return (
|
|
13
|
+
<div className="imageGrid">
|
|
14
|
+
<a href={image} target="_blank" rel="noopener noreferrer">
|
|
15
|
+
<div className="imageGrid_image" style={{ backgroundImage: `url('${get1400(image)}')` }}></div>
|
|
16
|
+
</a>
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
7
21
|
renderComment() {
|
|
8
22
|
const { comment } = this.props;
|
|
9
23
|
return (
|
|
10
24
|
<div key={comment.Id} className="comment">
|
|
11
25
|
<p className="comment_text">{toParagraphed(comment.Comment)}</p>
|
|
26
|
+
{this.renderImage(comment.Image)}
|
|
12
27
|
<div className="comment_bottom">
|
|
13
28
|
<ProfilePic className="comment_profilePic" size={25} image={comment.User.profilePic} />
|
|
14
29
|
<p className="comment_name">{comment.User.displayName}</p>
|
|
@@ -329,5 +329,5 @@ const mapStateToProps = () => {
|
|
|
329
329
|
return {};
|
|
330
330
|
};
|
|
331
331
|
|
|
332
|
-
const FileInput = connect(mapStateToProps, {}, null, {
|
|
332
|
+
const FileInput = connect(mapStateToProps, {}, null, { withRef: true })(FileInputComponent);
|
|
333
333
|
export { FileInput };
|
|
@@ -626,6 +626,7 @@ class ImageInputComponent extends Component {
|
|
|
626
626
|
}
|
|
627
627
|
|
|
628
628
|
renderLibraryImage(image, index, allowDelete) {
|
|
629
|
+
console.log(image);
|
|
629
630
|
let classes = 'imageInput imageInput-hasImage imageInput-libraryImage';
|
|
630
631
|
if (image.Selected) {
|
|
631
632
|
classes += ' imageInput-librarySelected';
|
|
@@ -983,5 +984,5 @@ const mapStateToProps = (state) => {
|
|
|
983
984
|
};
|
|
984
985
|
};
|
|
985
986
|
|
|
986
|
-
const ImageInput = connect(mapStateToProps, {}, null, {
|
|
987
|
+
const ImageInput = connect(mapStateToProps, {}, null, { withRef: true })(ImageInputComponent);
|
|
987
988
|
export { ImageInput };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
import { Text } from './Text';
|
|
3
3
|
import { ProfilePic } from './ProfilePic';
|
|
4
|
+
import { COLOUR_BRANDING_MAIN } from '../colours';
|
|
4
5
|
|
|
5
6
|
class UserListing extends Component {
|
|
6
7
|
getSize() {
|
|
@@ -71,10 +72,12 @@ class UserListing extends Component {
|
|
|
71
72
|
backgroundSize: 'cover',
|
|
72
73
|
backgroundPosition: 'center',
|
|
73
74
|
backgroundImage: `url(${this.getImage()})`,
|
|
75
|
+
backgroundColor: COLOUR_BRANDING_MAIN,
|
|
74
76
|
}}
|
|
75
77
|
alt={`${this.getText()} Image`}
|
|
76
78
|
/>
|
|
77
79
|
);
|
|
80
|
+
p;
|
|
78
81
|
}
|
|
79
82
|
return <ProfilePic size={this.getSize()} className="userListing_profilePic" image={this.getImage()} />;
|
|
80
83
|
}
|
package/src/config.js
CHANGED
|
@@ -17,11 +17,6 @@ const CoreConfig = {
|
|
|
17
17
|
makeApiKey: '',
|
|
18
18
|
logo: '',
|
|
19
19
|
clientName: '',
|
|
20
|
-
AuthStrategy: {
|
|
21
|
-
getAccessToken: async () => null,
|
|
22
|
-
getCurrentUserId: async () => null,
|
|
23
|
-
hasActiveSession: async () => false,
|
|
24
|
-
},
|
|
25
20
|
},
|
|
26
21
|
init: (environment) => {
|
|
27
22
|
CoreConfig.env = environment;
|
package/src/session.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import axios from 'axios';
|
|
3
|
-
import
|
|
3
|
+
import { Auth } from 'aws-amplify';
|
|
4
4
|
|
|
5
5
|
export const getSessionTokenAWS = async (prefix) => {
|
|
6
|
-
const
|
|
6
|
+
const data = await Auth.currentSession();
|
|
7
|
+
const token = data.getAccessToken().getJwtToken();
|
|
7
8
|
if (_.isUndefined(prefix)) return token;
|
|
8
9
|
return `${prefix} ${token}`;
|
|
9
10
|
};
|
|
11
|
+
|
|
10
12
|
// export const getRefreshTokenAWS = async () => {
|
|
11
13
|
// const data = await Auth.currentSession();
|
|
12
14
|
// return data.getRefreshToken().token;
|
|
@@ -32,7 +34,8 @@ export const unauthedFunction = (request) => {
|
|
|
32
34
|
|
|
33
35
|
export const getCurrentUserSub = async () => {
|
|
34
36
|
try {
|
|
35
|
-
|
|
37
|
+
const user = await Auth.currentUserInfo();
|
|
38
|
+
return user.id;
|
|
36
39
|
} catch (error) {
|
|
37
40
|
return null;
|
|
38
41
|
}
|
|
@@ -40,8 +43,8 @@ export const getCurrentUserSub = async () => {
|
|
|
40
43
|
|
|
41
44
|
export const checkLoggedIn = async (self) => {
|
|
42
45
|
try {
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
46
|
+
const user = await Auth.currentAuthenticatedUser();
|
|
47
|
+
if (_.isUndefined(user) || user == null || user.username == null) {
|
|
45
48
|
console.log('redirecting to login');
|
|
46
49
|
self.props.history.push('/login');
|
|
47
50
|
}
|