@plusscommunities/pluss-core-web 1.8.7-beta.0 → 1.8.8-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components.js +496 -603
- package/dist/components.js.map +1 -1
- package/dist/index.js +682 -747
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/components.js
CHANGED
|
@@ -8,7 +8,6 @@ import moment from 'moment';
|
|
|
8
8
|
import $ from 'jquery';
|
|
9
9
|
import 'js-cookie';
|
|
10
10
|
import { connect } from 'react-redux';
|
|
11
|
-
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
12
11
|
import Textarea from 'react-textarea-autosize';
|
|
13
12
|
import Dropzone from 'react-dropzone';
|
|
14
13
|
import axios from 'axios';
|
|
@@ -25,7 +24,7 @@ import { ResponsiveContainer, BarChart, XAxis, YAxis, Tooltip, Bar, Cell } from
|
|
|
25
24
|
|
|
26
25
|
class AddButton extends Component {
|
|
27
26
|
getClasses() {
|
|
28
|
-
|
|
27
|
+
let classes = "addButton";
|
|
29
28
|
if (this.props.inactive) {
|
|
30
29
|
classes += " addButton--inactive";
|
|
31
30
|
}
|
|
@@ -57,12 +56,12 @@ class AddButton extends Component {
|
|
|
57
56
|
// const COLOUR_2 = '#3179cb';
|
|
58
57
|
// const COLOUR_3 = '#1bb7ee';
|
|
59
58
|
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
const COLOUR_BRANDING_MAIN = "#4a57b7";
|
|
60
|
+
const COLOUR_BRANDING_INACTIVE = "#dbddf1";
|
|
62
61
|
// const TEXT_SUPER_LIGHT = '#d2d9e5';
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
const COLOUR_DUSK = "#536280";
|
|
63
|
+
const COLOUR_DUSK_LIGHT = "#67758f";
|
|
64
|
+
const LINEGREY = COLOUR_BRANDING_INACTIVE;
|
|
66
65
|
// const BORDER_LINE_GREY = COLOUR_BRANDING_INACTIVE;
|
|
67
66
|
|
|
68
67
|
// const COLOUR_TEAL = '#49bdbb';
|
|
@@ -71,7 +70,7 @@ var LINEGREY = COLOUR_BRANDING_INACTIVE;
|
|
|
71
70
|
// const COLOUR_BLUE_ALPHA10 = 'rgba(0, 131, 238, 0.1)';
|
|
72
71
|
// const COLOUR_DARKBLUE = '#191e78';
|
|
73
72
|
// const COLOUR_PURPLE = '#6e79c5';
|
|
74
|
-
|
|
73
|
+
const COLOUR_RED = "#c02743";
|
|
75
74
|
// const COLOUR_TANGERINE = '#ff8c75';
|
|
76
75
|
// const COLOUR_CITRON = '#bdbd27';
|
|
77
76
|
// const COLOUR_GRAPEFRUIT = '#ff6363';
|
|
@@ -81,16 +80,16 @@ var COLOUR_RED = "#c02743";
|
|
|
81
80
|
// const COLOUR_NAV_GREY = '#f6f6f6';
|
|
82
81
|
// const COLOUR_TRANSPARENT = 'rgba(0,0,0,0)';
|
|
83
82
|
// const COLOUR_SIDEBAR = '#303030';
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
const COLOUR_LIGHTGREY = "#8695b2";
|
|
84
|
+
const INACTIVE_TEXT = COLOUR_LIGHTGREY;
|
|
85
|
+
const COLOUR_BRANDING_APP = "#4a57b7";
|
|
87
86
|
|
|
88
|
-
|
|
87
|
+
const getFileName = (url, noExtension) => {
|
|
89
88
|
if (!url) {
|
|
90
89
|
return null;
|
|
91
90
|
}
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
const fileSplit = url.split("/");
|
|
92
|
+
const name = fileSplit[fileSplit.length - 1].toLowerCase();
|
|
94
93
|
if (!noExtension) {
|
|
95
94
|
return name;
|
|
96
95
|
}
|
|
@@ -128,7 +127,7 @@ function ownKeys$m(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymb
|
|
|
128
127
|
function _objectSpread$m(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$m(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$m(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
129
128
|
class Button extends Component {
|
|
130
129
|
getClasses() {
|
|
131
|
-
|
|
130
|
+
let string = "";
|
|
132
131
|
if (this.props.inline) string = string + "buttonWrapper--inline ";
|
|
133
132
|
if (this.props.isActive) string = string + "button--active ";
|
|
134
133
|
if (this.props.buttonType) string = string + "button--".concat(this.props.buttonType);
|
|
@@ -145,7 +144,7 @@ class Button extends Component {
|
|
|
145
144
|
return "button";
|
|
146
145
|
}
|
|
147
146
|
getButtonTextClasses() {
|
|
148
|
-
|
|
147
|
+
let result = "buttonText";
|
|
149
148
|
if (this.props.leftIcon) {
|
|
150
149
|
result = result + " buttonTextWithIcon";
|
|
151
150
|
}
|
|
@@ -199,7 +198,7 @@ class CheckBox extends PureComponent {
|
|
|
199
198
|
});
|
|
200
199
|
}
|
|
201
200
|
generateClassNames() {
|
|
202
|
-
|
|
201
|
+
let result = "checkBox";
|
|
203
202
|
if (this.props.isActive) {
|
|
204
203
|
result = result + " checkBox--active";
|
|
205
204
|
}
|
|
@@ -212,14 +211,14 @@ class CheckBox extends PureComponent {
|
|
|
212
211
|
return result;
|
|
213
212
|
}
|
|
214
213
|
getLabelClasses() {
|
|
215
|
-
|
|
214
|
+
let result = "actionText pointer";
|
|
216
215
|
if (this.props.disabled) {
|
|
217
216
|
result = result + " actionText--disabled";
|
|
218
217
|
}
|
|
219
218
|
return result;
|
|
220
219
|
}
|
|
221
220
|
getBoxStyle() {
|
|
222
|
-
|
|
221
|
+
const result = {};
|
|
223
222
|
if (this.props.highlightColour && this.props.isActive) {
|
|
224
223
|
result.borderColor = this.props.highlightColour;
|
|
225
224
|
result.backgroundColor = this.props.highlightColour;
|
|
@@ -257,7 +256,7 @@ class CheckBox extends PureComponent {
|
|
|
257
256
|
});
|
|
258
257
|
}
|
|
259
258
|
}
|
|
260
|
-
|
|
259
|
+
const styles$9 = {
|
|
261
260
|
row: {
|
|
262
261
|
display: "flex",
|
|
263
262
|
flexDirection: "row",
|
|
@@ -265,7 +264,7 @@ var styles$9 = {
|
|
|
265
264
|
}
|
|
266
265
|
};
|
|
267
266
|
|
|
268
|
-
|
|
267
|
+
const CoreConfig = {
|
|
269
268
|
env: {
|
|
270
269
|
baseStage: "",
|
|
271
270
|
baseAPIUrl: "",
|
|
@@ -289,19 +288,19 @@ var CoreConfig = {
|
|
|
289
288
|
}
|
|
290
289
|
};
|
|
291
290
|
|
|
292
|
-
|
|
293
|
-
|
|
291
|
+
const getUrl = function (baseAction, action, query) {
|
|
292
|
+
let {
|
|
294
293
|
url,
|
|
295
294
|
stage
|
|
296
295
|
} = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {
|
|
297
296
|
url: null,
|
|
298
297
|
stage: null
|
|
299
298
|
};
|
|
300
|
-
|
|
299
|
+
const {
|
|
301
300
|
baseAPIUrl,
|
|
302
301
|
baseStage
|
|
303
302
|
} = CoreConfig.env;
|
|
304
|
-
|
|
303
|
+
let queryPart = "";
|
|
305
304
|
if (query) {
|
|
306
305
|
_.keys(query).forEach((key, index) => {
|
|
307
306
|
queryPart += "".concat(index === 0 ? "?" : "&").concat(key, "=").concat(encodeURIComponent(query[key]));
|
|
@@ -310,27 +309,27 @@ var getUrl = function getUrl(baseAction, action, query) {
|
|
|
310
309
|
return "".concat(url || baseAPIUrl, "/").concat(baseAction, "-").concat(stage || baseStage, "/").concat(action).concat(queryPart);
|
|
311
310
|
};
|
|
312
311
|
|
|
313
|
-
|
|
312
|
+
const getAppColourFromState = state => {
|
|
314
313
|
if (!state || !state.auth || !state.auth.siteBranding || !state.auth.siteBranding.MainBrandingColour) {
|
|
315
314
|
return CoreConfig.env.colourBrandingApp;
|
|
316
315
|
}
|
|
317
316
|
return state.auth.siteBranding.MainBrandingColour;
|
|
318
317
|
};
|
|
319
318
|
|
|
320
|
-
|
|
319
|
+
const getExtension = url => {
|
|
321
320
|
if (!url) {
|
|
322
321
|
return null;
|
|
323
322
|
}
|
|
324
|
-
|
|
323
|
+
const fileSplit = url.split(".");
|
|
325
324
|
return fileSplit[fileSplit.length - 1].toLowerCase();
|
|
326
325
|
};
|
|
327
326
|
|
|
328
|
-
|
|
329
|
-
|
|
327
|
+
const isVideo = url => {
|
|
328
|
+
const extension = getExtension(url);
|
|
330
329
|
return ["mov", "mp4"].includes(extension);
|
|
331
330
|
};
|
|
332
331
|
|
|
333
|
-
|
|
332
|
+
const get1400 = url => {
|
|
334
333
|
if (!url) {
|
|
335
334
|
return url;
|
|
336
335
|
}
|
|
@@ -343,13 +342,13 @@ var get1400 = url => {
|
|
|
343
342
|
if (url.indexOf("https://plusscdn.azureedge.net/") !== -1) {
|
|
344
343
|
return url.replace("/uploads/", "/uploads1400/").replace("/general/", "/general1400/");
|
|
345
344
|
}
|
|
346
|
-
|
|
345
|
+
const {
|
|
347
346
|
baseUploadsUrl,
|
|
348
347
|
baseLibraryUrl
|
|
349
348
|
} = CoreConfig.env;
|
|
350
349
|
if (url.indexOf(baseUploadsUrl) !== -1 || url.indexOf(baseLibraryUrl) !== -1) {
|
|
351
|
-
|
|
352
|
-
|
|
350
|
+
const extension = getExtension(url);
|
|
351
|
+
let urlToUse = url;
|
|
353
352
|
if (extension !== "jpg") {
|
|
354
353
|
urlToUse = "".concat(url.substring(0, url.length - (extension.length + 1)), ".jpg");
|
|
355
354
|
}
|
|
@@ -358,7 +357,7 @@ var get1400 = url => {
|
|
|
358
357
|
return url;
|
|
359
358
|
};
|
|
360
359
|
|
|
361
|
-
|
|
360
|
+
const generateImageName = name => {
|
|
362
361
|
return "xxxxxxxx4xxxyxxxxxxxxxxxxx".concat(name).replace(/[xy]/g, c => {
|
|
363
362
|
// eslint-disable-next-line
|
|
364
363
|
var r = Math.random() * 16 | 0,
|
|
@@ -367,7 +366,7 @@ var generateImageName = name => {
|
|
|
367
366
|
});
|
|
368
367
|
};
|
|
369
368
|
|
|
370
|
-
|
|
369
|
+
const getThumb300 = url => {
|
|
371
370
|
if (!url) {
|
|
372
371
|
return url;
|
|
373
372
|
}
|
|
@@ -380,13 +379,13 @@ var getThumb300 = url => {
|
|
|
380
379
|
if (url.indexOf("https://plusscdn.azureedge.net/") !== -1) {
|
|
381
380
|
return url.replace("/uploads/", "/uploads-thumb/").replace("/general/", "/general300/").replace("/uploads1400/", "/uploads-thumb/").replace("/general1400/", "/general300/");
|
|
382
381
|
}
|
|
383
|
-
|
|
382
|
+
const {
|
|
384
383
|
baseUploadsUrl,
|
|
385
384
|
baseLibraryUrl
|
|
386
385
|
} = CoreConfig.env;
|
|
387
386
|
if (url.indexOf(baseUploadsUrl) !== -1 || url.indexOf(baseLibraryUrl) !== -1) {
|
|
388
|
-
|
|
389
|
-
|
|
387
|
+
const extension = getExtension(url);
|
|
388
|
+
let urlToUse = url;
|
|
390
389
|
if (extension !== "jpg") {
|
|
391
390
|
urlToUse = "".concat(url.substring(0, url.length - (extension.length + 1)), ".jpg");
|
|
392
391
|
}
|
|
@@ -395,14 +394,14 @@ var getThumb300 = url => {
|
|
|
395
394
|
return url;
|
|
396
395
|
};
|
|
397
396
|
|
|
398
|
-
|
|
397
|
+
const getFirstName = string => {
|
|
399
398
|
if (_.isEmpty(string)) {
|
|
400
399
|
return "";
|
|
401
400
|
}
|
|
402
401
|
return string.split(" ")[0];
|
|
403
402
|
};
|
|
404
403
|
|
|
405
|
-
|
|
404
|
+
const randomString = () => {
|
|
406
405
|
return "xxxxxxxx4xxxyxxxxxxxxxxxxx".replace(/[xy]/g, c => {
|
|
407
406
|
// eslint-disable-next-line
|
|
408
407
|
var r = Math.random() * 16 | 0,
|
|
@@ -413,10 +412,10 @@ var randomString = () => {
|
|
|
413
412
|
|
|
414
413
|
function ownKeys$k(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
415
414
|
function _objectSpread$k(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$k(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$k(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
416
|
-
|
|
415
|
+
const toParagraphed = (text, style) => {
|
|
417
416
|
if (!text) return text;
|
|
418
417
|
text = text.replace(/\t/g, "\u00a0\u00a0\u00a0\u00a0");
|
|
419
|
-
|
|
418
|
+
const textSplit = text.split("\n");
|
|
420
419
|
return _.map(textSplit, (t, i) => {
|
|
421
420
|
return /*#__PURE__*/jsx("span", {
|
|
422
421
|
iconStyle: _objectSpread$k({
|
|
@@ -427,7 +426,7 @@ var toParagraphed = (text, style) => {
|
|
|
427
426
|
});
|
|
428
427
|
};
|
|
429
428
|
|
|
430
|
-
|
|
429
|
+
const getPluralOptions = (count, singular, plural) => {
|
|
431
430
|
if (count === 1) {
|
|
432
431
|
return singular;
|
|
433
432
|
}
|
|
@@ -484,12 +483,12 @@ class ProfilePicComponent extends Component {
|
|
|
484
483
|
return this.renderPic();
|
|
485
484
|
}
|
|
486
485
|
}
|
|
487
|
-
|
|
486
|
+
const mapStateToProps$6 = state => {
|
|
488
487
|
return {
|
|
489
488
|
colourBrandingApp: getAppColourFromState(state)
|
|
490
489
|
};
|
|
491
490
|
};
|
|
492
|
-
|
|
491
|
+
const ProfilePic = connect(mapStateToProps$6, {})(ProfilePicComponent);
|
|
493
492
|
|
|
494
493
|
class Comment extends Component {
|
|
495
494
|
renderImage(image) {
|
|
@@ -512,7 +511,7 @@ class Comment extends Component {
|
|
|
512
511
|
});
|
|
513
512
|
}
|
|
514
513
|
renderComment() {
|
|
515
|
-
|
|
514
|
+
const {
|
|
516
515
|
comment
|
|
517
516
|
} = this.props;
|
|
518
517
|
return /*#__PURE__*/jsxs("div", {
|
|
@@ -545,23 +544,21 @@ class Comment extends Component {
|
|
|
545
544
|
|
|
546
545
|
class CommentSection extends Component {
|
|
547
546
|
constructor(props) {
|
|
548
|
-
var _this;
|
|
549
547
|
super(props);
|
|
550
|
-
_this = this;
|
|
551
548
|
_defineProperty(this, "onHandleChange", event => {
|
|
552
549
|
var stateChange = {};
|
|
553
550
|
stateChange[event.target.getAttribute("id")] = event.target.value;
|
|
554
551
|
this.setState(stateChange);
|
|
555
552
|
});
|
|
556
|
-
_defineProperty(this, "onAddComment",
|
|
557
|
-
|
|
553
|
+
_defineProperty(this, "onAddComment", async () => {
|
|
554
|
+
const {
|
|
558
555
|
commentInput
|
|
559
|
-
} =
|
|
560
|
-
|
|
556
|
+
} = this.state;
|
|
557
|
+
this.setState({
|
|
561
558
|
commentInput: ""
|
|
562
559
|
});
|
|
563
|
-
|
|
564
|
-
})
|
|
560
|
+
this.props.onAddComment(commentInput);
|
|
561
|
+
});
|
|
565
562
|
_defineProperty(this, "getComments", () => {
|
|
566
563
|
if (!this.props.onlyParents) {
|
|
567
564
|
return this.props.comments;
|
|
@@ -574,7 +571,7 @@ class CommentSection extends Component {
|
|
|
574
571
|
if (!this.props.onOpenThread) {
|
|
575
572
|
return null;
|
|
576
573
|
}
|
|
577
|
-
|
|
574
|
+
const threadComments = _.filter(this.props.comments, innerC => {
|
|
578
575
|
return innerC.ParentId === c.Id;
|
|
579
576
|
});
|
|
580
577
|
if (_.isEmpty(threadComments)) {
|
|
@@ -590,7 +587,7 @@ class CommentSection extends Component {
|
|
|
590
587
|
})
|
|
591
588
|
});
|
|
592
589
|
}
|
|
593
|
-
|
|
590
|
+
const profilePics = _.take(_.uniqBy(threadComments, c => c.UserId), 3);
|
|
594
591
|
return /*#__PURE__*/jsxs("div", {
|
|
595
592
|
className: "comment_reply comment_reply-hasReplies",
|
|
596
593
|
children: [profilePics.map(c => {
|
|
@@ -663,7 +660,7 @@ class DatePicker extends Component {
|
|
|
663
660
|
}
|
|
664
661
|
onNewProps(nextProps, forceUpdate) {
|
|
665
662
|
if (!!nextProps.shownMonth && nextProps.shownMonth !== this.props.shownMonth) {
|
|
666
|
-
|
|
663
|
+
const shownMonth = new Date(nextProps.shownMonth.getFullYear(), nextProps.shownMonth.getMonth() + 1, 0);
|
|
667
664
|
this.setState({
|
|
668
665
|
shownMonth
|
|
669
666
|
});
|
|
@@ -671,19 +668,19 @@ class DatePicker extends Component {
|
|
|
671
668
|
} else if (this.props.multiple && nextProps.selectedDates !== this.props.selectedDates) {
|
|
672
669
|
this.generateGrid(this.state.shownMonth, nextProps.selectedDates);
|
|
673
670
|
} else if (forceUpdate || nextProps.selectedDate !== this.props.selectedDate) {
|
|
674
|
-
|
|
671
|
+
let dateToUse = nextProps.selectedDate;
|
|
675
672
|
if (!(dateToUse instanceof Date)) {
|
|
676
673
|
dateToUse = new Date(dateToUse);
|
|
677
674
|
}
|
|
678
675
|
if (isNaN(dateToUse)) {
|
|
679
676
|
dateToUse = new Date();
|
|
680
677
|
}
|
|
681
|
-
|
|
678
|
+
const shownMonth = this.props.shownMonth ? this.state.shownMonth : dateToUse;
|
|
682
679
|
this.setState({
|
|
683
|
-
shownMonth:
|
|
680
|
+
shownMonth: shownMonth,
|
|
684
681
|
selectedDate: dateToUse
|
|
685
682
|
});
|
|
686
|
-
this.generateGrid(
|
|
683
|
+
this.generateGrid(shownMonth, dateToUse);
|
|
687
684
|
}
|
|
688
685
|
}
|
|
689
686
|
getDate() {
|
|
@@ -709,13 +706,13 @@ class DatePicker extends Component {
|
|
|
709
706
|
}
|
|
710
707
|
isDateEnabled(date) {
|
|
711
708
|
if (this.props.enabledDates) {
|
|
712
|
-
|
|
709
|
+
const found = this.props.enabledDates.find(d => moment(d.day).format("YYYYMMDD") === date.format("YYYYMMDD"));
|
|
713
710
|
if (found) return found.enabled;
|
|
714
711
|
}
|
|
715
712
|
return null;
|
|
716
713
|
}
|
|
717
714
|
changeMonth(change) {
|
|
718
|
-
|
|
715
|
+
const newShownDate = new Date(this.state.shownMonth.getFullYear(), this.state.shownMonth.getMonth() + 1 + change, 0);
|
|
719
716
|
this.setState({
|
|
720
717
|
shownMonth: newShownDate
|
|
721
718
|
}, () => {
|
|
@@ -724,9 +721,9 @@ class DatePicker extends Component {
|
|
|
724
721
|
this.generateGrid(newShownDate);
|
|
725
722
|
}
|
|
726
723
|
selectRange(date) {
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
724
|
+
const d1 = moment(this.state.lastSelected, "DD-MM-YYYY");
|
|
725
|
+
const d2 = moment(date, "DD-MM-YYYY");
|
|
726
|
+
let startDate, endDate;
|
|
730
727
|
if (d1.valueOf() > d2.valueOf()) {
|
|
731
728
|
// clicked an earlier day
|
|
732
729
|
startDate = moment(d2);
|
|
@@ -736,7 +733,7 @@ class DatePicker extends Component {
|
|
|
736
733
|
startDate = moment(d1);
|
|
737
734
|
endDate = moment(d2);
|
|
738
735
|
}
|
|
739
|
-
|
|
736
|
+
const dateRange = [startDate.format("DD-MM-YYYY")];
|
|
740
737
|
while (startDate.format("DD-MM-YYYY") !== endDate.format("DD-MM-YYYY")) {
|
|
741
738
|
startDate.add(1, "d");
|
|
742
739
|
dateRange.push(startDate.format("DD-MM-YYYY"));
|
|
@@ -752,13 +749,13 @@ class DatePicker extends Component {
|
|
|
752
749
|
}));
|
|
753
750
|
} else {
|
|
754
751
|
// select the range
|
|
755
|
-
|
|
752
|
+
const newSelection = [...this.props.selectedDates, ...dateRange];
|
|
756
753
|
this.props.selectDate(_.uniq(newSelection));
|
|
757
754
|
}
|
|
758
755
|
}
|
|
759
756
|
selectDate(date, e) {
|
|
760
|
-
|
|
761
|
-
|
|
757
|
+
const enabled = this.isDateEnabled(date);
|
|
758
|
+
const isBeforeMinDate = this.props.minDate && moment(date).isBefore(this.props.minDate);
|
|
762
759
|
console.log("selected a date", {
|
|
763
760
|
date,
|
|
764
761
|
enabled,
|
|
@@ -766,14 +763,14 @@ class DatePicker extends Component {
|
|
|
766
763
|
});
|
|
767
764
|
if (enabled === false || isBeforeMinDate) return;
|
|
768
765
|
if (this.props.multiple) {
|
|
769
|
-
|
|
766
|
+
const dateKey = moment(date).format("DD-MM-YYYY");
|
|
770
767
|
if (e.shiftKey && this.state.lastSelected && this.state.lastSelected !== dateKey) {
|
|
771
768
|
// shift-click to select range
|
|
772
769
|
this.selectRange(dateKey);
|
|
773
770
|
} else {
|
|
774
771
|
// toggle single date
|
|
775
|
-
|
|
776
|
-
|
|
772
|
+
const index = this.props.selectedDates.indexOf(dateKey);
|
|
773
|
+
const newSelection = [...this.props.selectedDates];
|
|
777
774
|
if (index > -1) {
|
|
778
775
|
newSelection.splice(index, 1);
|
|
779
776
|
} else {
|
|
@@ -789,16 +786,16 @@ class DatePicker extends Component {
|
|
|
789
786
|
}
|
|
790
787
|
}
|
|
791
788
|
generateGrid(date, selectedDate) {
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
789
|
+
const month = moment(date);
|
|
790
|
+
let dateToTarget = moment(date).endOf("month");
|
|
791
|
+
let dateToModify = moment(date).startOf("month");
|
|
792
|
+
const selectedDateToUse = this.props.multiple ? selectedDate || this.props.selectedDates || [] : moment(selectedDate || this.state.selectedDate);
|
|
796
793
|
|
|
797
794
|
// set dateToModify to be Sunday of that week
|
|
798
795
|
while (dateToModify.day() !== 0) {
|
|
799
796
|
dateToModify = dateToModify.add(-1, "day");
|
|
800
797
|
}
|
|
801
|
-
|
|
798
|
+
const rows = [[]];
|
|
802
799
|
while (dateToTarget.day() !== 6) {
|
|
803
800
|
dateToTarget = dateToTarget.add(1, "day");
|
|
804
801
|
}
|
|
@@ -809,7 +806,7 @@ class DatePicker extends Component {
|
|
|
809
806
|
// week has filled - add new row
|
|
810
807
|
rows.push([]);
|
|
811
808
|
}
|
|
812
|
-
|
|
809
|
+
const thisDate = moment(dateToModify);
|
|
813
810
|
rows[rows.length - 1].push({
|
|
814
811
|
date: thisDate,
|
|
815
812
|
dateKey: thisDate.format("DD-MM-YYYY"),
|
|
@@ -832,7 +829,7 @@ class DatePicker extends Component {
|
|
|
832
829
|
return /*#__PURE__*/jsx("div", {
|
|
833
830
|
className: "datepicker__row marginTop-8",
|
|
834
831
|
children: row.map(date => {
|
|
835
|
-
|
|
832
|
+
let classes = "datepicker__date";
|
|
836
833
|
if (date.isFaded) {
|
|
837
834
|
classes += " datepicker__date--faded";
|
|
838
835
|
}
|
|
@@ -932,21 +929,21 @@ class DatePicker extends Component {
|
|
|
932
929
|
}
|
|
933
930
|
|
|
934
931
|
function DurationInput(_ref) {
|
|
935
|
-
|
|
932
|
+
let {
|
|
936
933
|
handleChange,
|
|
937
934
|
label,
|
|
938
935
|
value,
|
|
939
936
|
className,
|
|
940
937
|
labelWidth
|
|
941
938
|
} = _ref;
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
939
|
+
const hours = Math.floor(value / 60);
|
|
940
|
+
const minutes = value % 60;
|
|
941
|
+
const handleHourChange = event => {
|
|
942
|
+
const newHours = Math.max(0, Math.min(+event.target.value, 24));
|
|
946
943
|
handleChange(newHours * 60 + minutes);
|
|
947
944
|
};
|
|
948
|
-
|
|
949
|
-
|
|
945
|
+
const handleMinuteChange = event => {
|
|
946
|
+
const newMinutes = Math.max(0, Math.min(+event.target.value, 59));
|
|
950
947
|
handleChange(hours * 60 + newMinutes);
|
|
951
948
|
};
|
|
952
949
|
return /*#__PURE__*/jsxs("div", {
|
|
@@ -993,55 +990,40 @@ function DurationInput(_ref) {
|
|
|
993
990
|
});
|
|
994
991
|
}
|
|
995
992
|
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
});
|
|
1003
|
-
return function getSessionTokenAWS(_x) {
|
|
1004
|
-
return _ref.apply(this, arguments);
|
|
1005
|
-
};
|
|
1006
|
-
}();
|
|
993
|
+
const getSessionTokenAWS = async prefix => {
|
|
994
|
+
const data = await Auth.currentSession();
|
|
995
|
+
const token = data.getAccessToken().getJwtToken();
|
|
996
|
+
if (_.isUndefined(prefix)) return token;
|
|
997
|
+
return "".concat(prefix, " ").concat(token);
|
|
998
|
+
};
|
|
1007
999
|
|
|
1008
1000
|
// export const getRefreshTokenAWS = async () => {
|
|
1009
1001
|
// const data = await Auth.currentSession();
|
|
1010
1002
|
// return data.getRefreshToken().token;
|
|
1011
1003
|
// };
|
|
1012
1004
|
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
return function authedFunction(_x2) {
|
|
1026
|
-
return _ref2.apply(this, arguments);
|
|
1027
|
-
};
|
|
1028
|
-
}();
|
|
1029
|
-
var unauthedFunction = request => {
|
|
1005
|
+
const authedFunction = async request => {
|
|
1006
|
+
try {
|
|
1007
|
+
const authkey = await getSessionTokenAWS();
|
|
1008
|
+
if (!request.headers) request.headers = {};
|
|
1009
|
+
request.headers.authkey = authkey;
|
|
1010
|
+
return await axios(request);
|
|
1011
|
+
} catch (error) {
|
|
1012
|
+
console.error("authedFunction error", error, request);
|
|
1013
|
+
throw error;
|
|
1014
|
+
}
|
|
1015
|
+
};
|
|
1016
|
+
const unauthedFunction = request => {
|
|
1030
1017
|
return axios(request);
|
|
1031
1018
|
};
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
});
|
|
1041
|
-
return function getCurrentUserSub() {
|
|
1042
|
-
return _ref3.apply(this, arguments);
|
|
1043
|
-
};
|
|
1044
|
-
}();
|
|
1019
|
+
const getCurrentUserSub = async () => {
|
|
1020
|
+
try {
|
|
1021
|
+
const user = await Auth.currentUserInfo();
|
|
1022
|
+
return user.id;
|
|
1023
|
+
} catch (error) {
|
|
1024
|
+
return null;
|
|
1025
|
+
}
|
|
1026
|
+
};
|
|
1045
1027
|
|
|
1046
1028
|
// export const getRolesWithAccess = (roles, type) => {
|
|
1047
1029
|
// return _.filter(roles, (role) => {
|
|
@@ -1086,91 +1068,28 @@ var getCurrentUserSub = /*#__PURE__*/function () {
|
|
|
1086
1068
|
// return userType;
|
|
1087
1069
|
// };
|
|
1088
1070
|
|
|
1089
|
-
|
|
1090
|
-
|
|
1071
|
+
const validateAccess = (site, type, auth, noRole) => {
|
|
1072
|
+
const roles = auth && auth.user ? auth.user.Roles : [];
|
|
1091
1073
|
if (_.isEmpty(roles)) return noRole;
|
|
1092
1074
|
if (site === "plussSpace" && type === "master") {
|
|
1093
1075
|
return _.some(roles, r => r.site === "plussSpace" && r.type === "master");
|
|
1094
1076
|
}
|
|
1095
1077
|
if (_.some(roles, r => r.type === "master")) return true;
|
|
1096
|
-
|
|
1078
|
+
const role = _.find(roles, r => r.site === site);
|
|
1097
1079
|
if (!role) return false;
|
|
1098
1080
|
if (type === "any") return true;
|
|
1099
1081
|
return !_.isEmpty(role.Permissions) && _.includes(role.Permissions, type);
|
|
1100
1082
|
};
|
|
1101
|
-
|
|
1083
|
+
const getApiError = error => {
|
|
1102
1084
|
try {
|
|
1103
|
-
|
|
1104
|
-
|
|
1085
|
+
const errorData = error.response.data;
|
|
1086
|
+
const errorMessage = errorData && errorData.error;
|
|
1105
1087
|
return errorMessage || errorData || error;
|
|
1106
1088
|
} catch (e) {
|
|
1107
1089
|
return error;
|
|
1108
1090
|
}
|
|
1109
1091
|
};
|
|
1110
1092
|
|
|
1111
|
-
({
|
|
1112
|
-
checkUserAuth: userId => {
|
|
1113
|
-
var url = getUrl("auth", "checkUserAuth");
|
|
1114
|
-
return authedFunction({
|
|
1115
|
-
method: "POST",
|
|
1116
|
-
url,
|
|
1117
|
-
data: {
|
|
1118
|
-
userId
|
|
1119
|
-
}
|
|
1120
|
-
});
|
|
1121
|
-
},
|
|
1122
|
-
fetchForgotPasswordId: input => {
|
|
1123
|
-
return axios({
|
|
1124
|
-
method: "POST",
|
|
1125
|
-
url: getUrl("auth", "checkForgotUser"),
|
|
1126
|
-
data: {
|
|
1127
|
-
user: {
|
|
1128
|
-
email: input,
|
|
1129
|
-
phoneNumber: input
|
|
1130
|
-
}
|
|
1131
|
-
},
|
|
1132
|
-
headers: {
|
|
1133
|
-
authorization: "GwegChicken"
|
|
1134
|
-
}
|
|
1135
|
-
});
|
|
1136
|
-
},
|
|
1137
|
-
disableUser: (username, site) => {
|
|
1138
|
-
var url = getUrl("users", "testUserDisbale");
|
|
1139
|
-
var request = {
|
|
1140
|
-
method: "POST",
|
|
1141
|
-
url,
|
|
1142
|
-
data: {
|
|
1143
|
-
username,
|
|
1144
|
-
site
|
|
1145
|
-
}
|
|
1146
|
-
};
|
|
1147
|
-
return authedFunction(request);
|
|
1148
|
-
},
|
|
1149
|
-
getUserSignin: function () {
|
|
1150
|
-
var _getUserSignin = _asyncToGenerator(function* () {
|
|
1151
|
-
return authedFunction({
|
|
1152
|
-
method: "POST",
|
|
1153
|
-
url: getUrl("auth", "getUserSignin")
|
|
1154
|
-
});
|
|
1155
|
-
});
|
|
1156
|
-
function getUserSignin() {
|
|
1157
|
-
return _getUserSignin.apply(this, arguments);
|
|
1158
|
-
}
|
|
1159
|
-
return getUserSignin;
|
|
1160
|
-
}(),
|
|
1161
|
-
copyDummy: site => {
|
|
1162
|
-
var url = getUrl("auth", "copyDummy");
|
|
1163
|
-
var request = {
|
|
1164
|
-
method: "POST",
|
|
1165
|
-
url,
|
|
1166
|
-
data: {
|
|
1167
|
-
site
|
|
1168
|
-
}
|
|
1169
|
-
};
|
|
1170
|
-
return authedFunction(request);
|
|
1171
|
-
}
|
|
1172
|
-
});
|
|
1173
|
-
|
|
1174
1093
|
/**
|
|
1175
1094
|
* ADAPTED FROM:
|
|
1176
1095
|
*
|
|
@@ -1255,7 +1174,7 @@ function CanvasImageUploader(options) {
|
|
|
1255
1174
|
/**
|
|
1256
1175
|
* Run to initialize CanvasImageUploader.
|
|
1257
1176
|
*/
|
|
1258
|
-
newImage: function
|
|
1177
|
+
newImage: function () {
|
|
1259
1178
|
imageData = null;
|
|
1260
1179
|
image = new Image();
|
|
1261
1180
|
},
|
|
@@ -1263,7 +1182,7 @@ function CanvasImageUploader(options) {
|
|
|
1263
1182
|
* Returns the image data if any file has been read.
|
|
1264
1183
|
* @returns {Blob|null}
|
|
1265
1184
|
*/
|
|
1266
|
-
getImageData: function
|
|
1185
|
+
getImageData: function () {
|
|
1267
1186
|
return imageData;
|
|
1268
1187
|
},
|
|
1269
1188
|
/**
|
|
@@ -1273,7 +1192,7 @@ function CanvasImageUploader(options) {
|
|
|
1273
1192
|
* @param $destination The destination canvas to draw onto.
|
|
1274
1193
|
* @param maxSize Maximum width or height of the destination canvas.
|
|
1275
1194
|
*/
|
|
1276
|
-
copyToCanvas: function
|
|
1195
|
+
copyToCanvas: function (source, $destination, maxSize) {
|
|
1277
1196
|
var size = calculateSize(source, maxSize);
|
|
1278
1197
|
setDimensions($destination, size);
|
|
1279
1198
|
var destCtx = $destination[0].getContext("2d");
|
|
@@ -1285,7 +1204,7 @@ function CanvasImageUploader(options) {
|
|
|
1285
1204
|
* @param $canvas The canvas (jQuery) object to draw on.
|
|
1286
1205
|
* @param callback Function that is called when the operation has finished.
|
|
1287
1206
|
*/
|
|
1288
|
-
readImageToCanvas: function
|
|
1207
|
+
readImageToCanvas: function (file, $canvas, callback) {
|
|
1289
1208
|
this.newImage();
|
|
1290
1209
|
if (!file) return;
|
|
1291
1210
|
var reader = new FileReader();
|
|
@@ -1302,35 +1221,29 @@ function CanvasImageUploader(options) {
|
|
|
1302
1221
|
* Get this data using the method getImageData().
|
|
1303
1222
|
* @param canvas
|
|
1304
1223
|
*/
|
|
1305
|
-
saveCanvasToImageData: function
|
|
1224
|
+
saveCanvasToImageData: function (canvas) {
|
|
1306
1225
|
var base64 = canvas.toDataURL("image/jpeg", options.jpegQuality).replace(/^data:image\/(png|jpeg|jpg|gif);base64,/, "");
|
|
1307
1226
|
imageData = base64toBlob(base64, "image/jpeg"); // Byte array
|
|
1308
1227
|
}
|
|
1309
1228
|
};
|
|
1310
1229
|
}
|
|
1311
1230
|
|
|
1312
|
-
|
|
1313
|
-
uploadMediaAsync:
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
});
|
|
1329
|
-
function uploadMediaAsync(_x, _x2) {
|
|
1330
|
-
return _uploadMediaAsync.apply(this, arguments);
|
|
1331
|
-
}
|
|
1332
|
-
return uploadMediaAsync;
|
|
1333
|
-
}(),
|
|
1231
|
+
const fileActions = {
|
|
1232
|
+
uploadMediaAsync: async (file, filename) => {
|
|
1233
|
+
const newFilename = filename.replace(/[^a-z0-9+.]+/gi, "").toLowerCase();
|
|
1234
|
+
const userId = await getCurrentUserSub();
|
|
1235
|
+
const url = "uploads/users/".concat(userId, "/public/").concat(randomString(), "/").concat(newFilename);
|
|
1236
|
+
const {
|
|
1237
|
+
baseUploadsUrl,
|
|
1238
|
+
uploadBucket
|
|
1239
|
+
} = CoreConfig.env;
|
|
1240
|
+
await Storage.put(url, file, {
|
|
1241
|
+
level: "public",
|
|
1242
|
+
bucket: uploadBucket
|
|
1243
|
+
});
|
|
1244
|
+
console.log("uploaded file", "".concat(baseUploadsUrl).concat(url));
|
|
1245
|
+
return "".concat(baseUploadsUrl).concat(url);
|
|
1246
|
+
},
|
|
1334
1247
|
// readBase64: async (file) => {
|
|
1335
1248
|
// return new Promise((resolve, reject) => {
|
|
1336
1249
|
// var reader = new FileReader();
|
|
@@ -1365,7 +1278,7 @@ var fileActions = {
|
|
|
1365
1278
|
});
|
|
1366
1279
|
},
|
|
1367
1280
|
blobToFile: (theBlob, fileName) => {
|
|
1368
|
-
|
|
1281
|
+
const file = new File([theBlob], fileName, {
|
|
1369
1282
|
lastModified: new Date()
|
|
1370
1283
|
});
|
|
1371
1284
|
console.log(file);
|
|
@@ -1373,10 +1286,10 @@ var fileActions = {
|
|
|
1373
1286
|
},
|
|
1374
1287
|
putCanvas: (canvas, filename) => {
|
|
1375
1288
|
return new Promise((resolve, reject) => {
|
|
1376
|
-
|
|
1377
|
-
|
|
1289
|
+
const img = canvas.getTrimmedCanvas().toDataURL("image/png");
|
|
1290
|
+
const imageData = Buffer.from(img.replace(/^data:image\/\w+;base64,/, ""), "base64");
|
|
1378
1291
|
canvas.off();
|
|
1379
|
-
|
|
1292
|
+
const imgName = generateImageName(filename);
|
|
1380
1293
|
Storage.put("images/".concat(imgName, ".png"), imageData, {
|
|
1381
1294
|
contentType: "image/png",
|
|
1382
1295
|
level: "public"
|
|
@@ -1390,7 +1303,7 @@ var fileActions = {
|
|
|
1390
1303
|
},
|
|
1391
1304
|
getMediaFolders: site => {
|
|
1392
1305
|
// console.log('getMediaFolders', 'site', site);
|
|
1393
|
-
|
|
1306
|
+
const query = {
|
|
1394
1307
|
site
|
|
1395
1308
|
};
|
|
1396
1309
|
return authedFunction({
|
|
@@ -1464,7 +1377,7 @@ var fileActions = {
|
|
|
1464
1377
|
|
|
1465
1378
|
function ownKeys$h(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1466
1379
|
function _objectSpread$h(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$h(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$h(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1467
|
-
|
|
1380
|
+
const typeActions = {
|
|
1468
1381
|
getSubdomains: () => {
|
|
1469
1382
|
return authedFunction({
|
|
1470
1383
|
method: "GET",
|
|
@@ -1488,29 +1401,23 @@ var typeActions = {
|
|
|
1488
1401
|
});
|
|
1489
1402
|
},
|
|
1490
1403
|
getSites: () => {
|
|
1491
|
-
|
|
1404
|
+
let url = getUrl("types", "getsites");
|
|
1492
1405
|
return authedFunction({
|
|
1493
1406
|
method: "POST",
|
|
1494
1407
|
url
|
|
1495
1408
|
});
|
|
1496
1409
|
},
|
|
1497
|
-
getSite:
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
site: id
|
|
1501
|
-
});
|
|
1502
|
-
return authedFunction({
|
|
1503
|
-
method: "GET",
|
|
1504
|
-
url
|
|
1505
|
-
});
|
|
1410
|
+
getSite: async id => {
|
|
1411
|
+
let url = getUrl("types", "getsite", {
|
|
1412
|
+
site: id
|
|
1506
1413
|
});
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
}
|
|
1414
|
+
return authedFunction({
|
|
1415
|
+
method: "GET",
|
|
1416
|
+
url
|
|
1417
|
+
});
|
|
1418
|
+
},
|
|
1512
1419
|
getUserTypes: site => {
|
|
1513
|
-
|
|
1420
|
+
let url = getUrl("types", "getusertypes");
|
|
1514
1421
|
return authedFunction({
|
|
1515
1422
|
method: "POST",
|
|
1516
1423
|
url,
|
|
@@ -1520,7 +1427,7 @@ var typeActions = {
|
|
|
1520
1427
|
});
|
|
1521
1428
|
},
|
|
1522
1429
|
setTypePermissions: (type, adminId) => {
|
|
1523
|
-
|
|
1430
|
+
let url = getUrl("types", "setusertypepermissions");
|
|
1524
1431
|
return authedFunction({
|
|
1525
1432
|
method: "POST",
|
|
1526
1433
|
url,
|
|
@@ -1530,7 +1437,7 @@ var typeActions = {
|
|
|
1530
1437
|
});
|
|
1531
1438
|
},
|
|
1532
1439
|
deleteUserType: (site, type) => {
|
|
1533
|
-
|
|
1440
|
+
let url = getUrl("types", "usertype/delete");
|
|
1534
1441
|
return authedFunction({
|
|
1535
1442
|
method: "POST",
|
|
1536
1443
|
url,
|
|
@@ -1541,8 +1448,8 @@ var typeActions = {
|
|
|
1541
1448
|
});
|
|
1542
1449
|
},
|
|
1543
1450
|
createNewSite: (siteName, options) => {
|
|
1544
|
-
|
|
1545
|
-
|
|
1451
|
+
let url = getUrl("types", "setNewSite");
|
|
1452
|
+
const request = {
|
|
1546
1453
|
method: "POST",
|
|
1547
1454
|
url,
|
|
1548
1455
|
data: _objectSpread$h({
|
|
@@ -1552,8 +1459,8 @@ var typeActions = {
|
|
|
1552
1459
|
return authedFunction(request);
|
|
1553
1460
|
},
|
|
1554
1461
|
signUpNewSite: (site, user) => {
|
|
1555
|
-
|
|
1556
|
-
|
|
1462
|
+
let url = getUrl("types", "site/signup");
|
|
1463
|
+
const request = {
|
|
1557
1464
|
method: "POST",
|
|
1558
1465
|
url,
|
|
1559
1466
|
data: {
|
|
@@ -1570,7 +1477,7 @@ var typeActions = {
|
|
|
1570
1477
|
});
|
|
1571
1478
|
},
|
|
1572
1479
|
getInterfaces: (site, type) => {
|
|
1573
|
-
|
|
1480
|
+
const q = {
|
|
1574
1481
|
site
|
|
1575
1482
|
};
|
|
1576
1483
|
if (type) {
|
|
@@ -1582,7 +1489,7 @@ var typeActions = {
|
|
|
1582
1489
|
});
|
|
1583
1490
|
},
|
|
1584
1491
|
deleteInterface: id => {
|
|
1585
|
-
|
|
1492
|
+
const request = {
|
|
1586
1493
|
method: "POST",
|
|
1587
1494
|
url: getUrl("types", "interfaces/remove"),
|
|
1588
1495
|
data: {
|
|
@@ -1592,7 +1499,7 @@ var typeActions = {
|
|
|
1592
1499
|
return authedFunction(request);
|
|
1593
1500
|
},
|
|
1594
1501
|
saveInterface: (site, type, title, settings, id) => {
|
|
1595
|
-
|
|
1502
|
+
const request = {
|
|
1596
1503
|
method: "POST",
|
|
1597
1504
|
url: getUrl("types", "interfaces/save"),
|
|
1598
1505
|
data: {
|
|
@@ -1606,7 +1513,7 @@ var typeActions = {
|
|
|
1606
1513
|
return authedFunction(request);
|
|
1607
1514
|
},
|
|
1608
1515
|
attachInterface: (site, typeName, interfaceId) => {
|
|
1609
|
-
|
|
1516
|
+
const request = {
|
|
1610
1517
|
method: "POST",
|
|
1611
1518
|
url: getUrl("types", "interfaces/attach"),
|
|
1612
1519
|
data: {
|
|
@@ -1618,7 +1525,7 @@ var typeActions = {
|
|
|
1618
1525
|
return authedFunction(request);
|
|
1619
1526
|
},
|
|
1620
1527
|
getSiteBranding: site => {
|
|
1621
|
-
|
|
1528
|
+
const request = {
|
|
1622
1529
|
method: "GET",
|
|
1623
1530
|
url: getUrl("types", "branding/get", {
|
|
1624
1531
|
site
|
|
@@ -1627,7 +1534,7 @@ var typeActions = {
|
|
|
1627
1534
|
return unauthedFunction(request);
|
|
1628
1535
|
},
|
|
1629
1536
|
generateSiteBranding: url => {
|
|
1630
|
-
|
|
1537
|
+
const request = {
|
|
1631
1538
|
method: "GET",
|
|
1632
1539
|
url: getUrl("types", "branding/generate", {
|
|
1633
1540
|
url
|
|
@@ -1636,8 +1543,8 @@ var typeActions = {
|
|
|
1636
1543
|
return unauthedFunction(request);
|
|
1637
1544
|
},
|
|
1638
1545
|
editSiteBranding: (siteName, branding) => {
|
|
1639
|
-
|
|
1640
|
-
|
|
1546
|
+
let url = getUrl("types", "editsitebranding");
|
|
1547
|
+
const request = {
|
|
1641
1548
|
method: "POST",
|
|
1642
1549
|
url,
|
|
1643
1550
|
data: {
|
|
@@ -1673,7 +1580,7 @@ var typeActions = {
|
|
|
1673
1580
|
}
|
|
1674
1581
|
};
|
|
1675
1582
|
|
|
1676
|
-
|
|
1583
|
+
const userActions = {
|
|
1677
1584
|
createNewUser: (user, userExtra) => {
|
|
1678
1585
|
return authedFunction({
|
|
1679
1586
|
method: "POST",
|
|
@@ -1773,7 +1680,7 @@ var userActions = {
|
|
|
1773
1680
|
});
|
|
1774
1681
|
},
|
|
1775
1682
|
getInviteCode: (userId, type, site) => {
|
|
1776
|
-
|
|
1683
|
+
const query = {};
|
|
1777
1684
|
if (!_.isEmpty(userId)) {
|
|
1778
1685
|
query.userId = userId;
|
|
1779
1686
|
}
|
|
@@ -1789,7 +1696,7 @@ var userActions = {
|
|
|
1789
1696
|
});
|
|
1790
1697
|
},
|
|
1791
1698
|
generateInviteCode: (userId, type, site) => {
|
|
1792
|
-
|
|
1699
|
+
const data = {};
|
|
1793
1700
|
if (!_.isEmpty(userId)) {
|
|
1794
1701
|
data.userId = userId;
|
|
1795
1702
|
}
|
|
@@ -1837,9 +1744,9 @@ var userActions = {
|
|
|
1837
1744
|
}
|
|
1838
1745
|
});
|
|
1839
1746
|
},
|
|
1840
|
-
getInviteCodes: function
|
|
1841
|
-
|
|
1842
|
-
|
|
1747
|
+
getInviteCodes: function (site) {
|
|
1748
|
+
let excludeFamily = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1749
|
+
const action = excludeFamily ? "excludeFamily" : "all";
|
|
1843
1750
|
return authedFunction({
|
|
1844
1751
|
method: "GET",
|
|
1845
1752
|
url: getUrl("users", "invite/get/".concat(action), {
|
|
@@ -1866,7 +1773,7 @@ var userActions = {
|
|
|
1866
1773
|
}
|
|
1867
1774
|
};
|
|
1868
1775
|
|
|
1869
|
-
|
|
1776
|
+
const profileActions = {
|
|
1870
1777
|
addEC: (userId, name, phone, email, relationship) => {
|
|
1871
1778
|
return authedFunction({
|
|
1872
1779
|
method: "POST",
|
|
@@ -2061,7 +1968,7 @@ var profileActions = {
|
|
|
2061
1968
|
}
|
|
2062
1969
|
};
|
|
2063
1970
|
|
|
2064
|
-
|
|
1971
|
+
const utilityActions = {
|
|
2065
1972
|
getUpvotyToken: () => {
|
|
2066
1973
|
return authedFunction({
|
|
2067
1974
|
method: "GET",
|
|
@@ -2095,15 +2002,13 @@ var utilityActions = {
|
|
|
2095
2002
|
|
|
2096
2003
|
function ownKeys$g(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2097
2004
|
function _objectSpread$g(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$g(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$g(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2098
|
-
|
|
2005
|
+
const DEFAULT_INPUT$1 = {
|
|
2099
2006
|
uploadingFile: false,
|
|
2100
2007
|
value: ""
|
|
2101
2008
|
};
|
|
2102
2009
|
class FileInputComponent extends Component {
|
|
2103
2010
|
constructor() {
|
|
2104
|
-
var _this;
|
|
2105
2011
|
super(...arguments);
|
|
2106
|
-
_this = this;
|
|
2107
2012
|
_defineProperty(this, "state", {
|
|
2108
2013
|
inputs: [{
|
|
2109
2014
|
uploadingFile: false,
|
|
@@ -2115,7 +2020,7 @@ class FileInputComponent extends Component {
|
|
|
2115
2020
|
return this.props.accept;
|
|
2116
2021
|
}
|
|
2117
2022
|
if (typeof this.props.accept === "string") {
|
|
2118
|
-
|
|
2023
|
+
const accept = {
|
|
2119
2024
|
[this.props.accept]: [".".concat(_.last(this.props.accept.split("/")))]
|
|
2120
2025
|
};
|
|
2121
2026
|
return accept;
|
|
@@ -2127,12 +2032,12 @@ class FileInputComponent extends Component {
|
|
|
2127
2032
|
return;
|
|
2128
2033
|
}
|
|
2129
2034
|
if (!this.props.multiple) {
|
|
2130
|
-
|
|
2035
|
+
const file = _.find(inputs, i => {
|
|
2131
2036
|
return !i.uploadingFile && !_.isEmpty(i.value);
|
|
2132
2037
|
});
|
|
2133
2038
|
this.props.refreshCallback(file ? file.value : undefined);
|
|
2134
2039
|
} else {
|
|
2135
|
-
|
|
2040
|
+
const files = _.filter(inputs, i => {
|
|
2136
2041
|
return !i.uploadingFile && !_.isEmpty(i.value);
|
|
2137
2042
|
}).map(i => {
|
|
2138
2043
|
return i.value;
|
|
@@ -2142,18 +2047,18 @@ class FileInputComponent extends Component {
|
|
|
2142
2047
|
});
|
|
2143
2048
|
_defineProperty(this, "onDrop", files => {
|
|
2144
2049
|
if (this.props.multiple) {
|
|
2145
|
-
|
|
2050
|
+
const newInputs = _.clone(this.state.inputs);
|
|
2146
2051
|
files.forEach(file => {
|
|
2147
2052
|
if (this.props.limit && newInputs.length === this.props.limit) {
|
|
2148
2053
|
// hit limit - replace last input if it's empty
|
|
2149
2054
|
if (_.isEmpty(newInputs[newInputs.length - 1].value)) {
|
|
2150
|
-
|
|
2055
|
+
const newInput = newInputs[newInputs.length - 1];
|
|
2151
2056
|
this.handleFile(newInput, file);
|
|
2152
2057
|
}
|
|
2153
2058
|
} else {
|
|
2154
|
-
|
|
2155
|
-
newInputs.splice(newInputs.length - 1, 0,
|
|
2156
|
-
this.handleFile(
|
|
2059
|
+
const newInput = _objectSpread$g({}, DEFAULT_INPUT$1);
|
|
2060
|
+
newInputs.splice(newInputs.length - 1, 0, newInput);
|
|
2061
|
+
this.handleFile(newInput, file);
|
|
2157
2062
|
}
|
|
2158
2063
|
});
|
|
2159
2064
|
this.setState({
|
|
@@ -2164,37 +2069,32 @@ class FileInputComponent extends Component {
|
|
|
2164
2069
|
this.handleFile(this.state.inputs[0], files[0]);
|
|
2165
2070
|
}
|
|
2166
2071
|
});
|
|
2167
|
-
_defineProperty(this, "handleFile",
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
inputs: newInputs
|
|
2176
|
-
});
|
|
2177
|
-
_this.checkRefreshCallback(newInputs);
|
|
2178
|
-
if (_this.props.handleFile) {
|
|
2179
|
-
yield _this.props.handleFile(file, newInputs);
|
|
2180
|
-
_this.checkSetDisplayValue(input, "");
|
|
2181
|
-
} else {
|
|
2182
|
-
try {
|
|
2183
|
-
var uploadFile = file;
|
|
2184
|
-
var url = yield fileActions.uploadMediaAsync(uploadFile, uploadFile.name);
|
|
2185
|
-
_this.checkSetDisplayValue(input, url);
|
|
2186
|
-
} catch (error) {
|
|
2187
|
-
console.log("handleFile error", error);
|
|
2188
|
-
_this.setState({
|
|
2189
|
-
uploadingFile: false
|
|
2190
|
-
});
|
|
2191
|
-
}
|
|
2192
|
-
}
|
|
2072
|
+
_defineProperty(this, "handleFile", async (input, file) => {
|
|
2073
|
+
if (!file || input.uploadingFile) {
|
|
2074
|
+
return;
|
|
2075
|
+
}
|
|
2076
|
+
input.uploadingFile = true;
|
|
2077
|
+
const newInputs = _.clone(this.state.inputs);
|
|
2078
|
+
this.setState({
|
|
2079
|
+
inputs: newInputs
|
|
2193
2080
|
});
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2081
|
+
this.checkRefreshCallback(newInputs);
|
|
2082
|
+
if (this.props.handleFile) {
|
|
2083
|
+
await this.props.handleFile(file, newInputs);
|
|
2084
|
+
this.checkSetDisplayValue(input, "");
|
|
2085
|
+
} else {
|
|
2086
|
+
try {
|
|
2087
|
+
let uploadFile = file;
|
|
2088
|
+
const url = await fileActions.uploadMediaAsync(uploadFile, uploadFile.name);
|
|
2089
|
+
this.checkSetDisplayValue(input, url);
|
|
2090
|
+
} catch (error) {
|
|
2091
|
+
console.log("handleFile error", error);
|
|
2092
|
+
this.setState({
|
|
2093
|
+
uploadingFile: false
|
|
2094
|
+
});
|
|
2095
|
+
}
|
|
2096
|
+
}
|
|
2097
|
+
});
|
|
2198
2098
|
}
|
|
2199
2099
|
componentDidMount() {
|
|
2200
2100
|
setTimeout(() => {
|
|
@@ -2220,7 +2120,7 @@ class FileInputComponent extends Component {
|
|
|
2220
2120
|
}]
|
|
2221
2121
|
});
|
|
2222
2122
|
} else {
|
|
2223
|
-
|
|
2123
|
+
const inputs = [];
|
|
2224
2124
|
_.forEach(val, str => {
|
|
2225
2125
|
inputs.push({
|
|
2226
2126
|
uploadingImage: false,
|
|
@@ -2234,7 +2134,7 @@ class FileInputComponent extends Component {
|
|
|
2234
2134
|
}
|
|
2235
2135
|
}
|
|
2236
2136
|
getClassNames(input, inputsLength) {
|
|
2237
|
-
|
|
2137
|
+
let classes = "clearfix imageInput";
|
|
2238
2138
|
if (input.uploadingFile) {
|
|
2239
2139
|
classes += " imageInput-uploading";
|
|
2240
2140
|
} else if (!_.isEmpty(input.value) && !this.props.onlyAllowUpload) {
|
|
@@ -2257,16 +2157,16 @@ class FileInputComponent extends Component {
|
|
|
2257
2157
|
checkSetDisplayValue(input, value) {
|
|
2258
2158
|
input.value = value;
|
|
2259
2159
|
input.uploadingFile = false;
|
|
2260
|
-
|
|
2160
|
+
const newInputs = _.clone(this.state.inputs);
|
|
2261
2161
|
this.setState({
|
|
2262
2162
|
inputs: newInputs
|
|
2263
2163
|
});
|
|
2264
2164
|
this.checkRefreshCallback(newInputs);
|
|
2265
2165
|
}
|
|
2266
2166
|
removeFile(input) {
|
|
2267
|
-
|
|
2167
|
+
const newState = {};
|
|
2268
2168
|
input.value = "";
|
|
2269
|
-
|
|
2169
|
+
const newInputs = _.clone(this.state.inputs);
|
|
2270
2170
|
if (newInputs.length > 1) {
|
|
2271
2171
|
newInputs.splice(newInputs.indexOf(input), 1);
|
|
2272
2172
|
if (newInputs.length === this.props.limit - 1 && !_.isEmpty(newInputs[newInputs.length - 1].value)) {
|
|
@@ -2282,7 +2182,7 @@ class FileInputComponent extends Component {
|
|
|
2282
2182
|
}
|
|
2283
2183
|
}
|
|
2284
2184
|
renderInput(input, index, inputsLength) {
|
|
2285
|
-
|
|
2185
|
+
const renderContent = () => {
|
|
2286
2186
|
if (this.props.onlyAllowUpload) {
|
|
2287
2187
|
return null;
|
|
2288
2188
|
}
|
|
@@ -2306,7 +2206,7 @@ class FileInputComponent extends Component {
|
|
|
2306
2206
|
accept: this.getAccept(),
|
|
2307
2207
|
onDrop: files => this.onDrop(files, true),
|
|
2308
2208
|
children: state => {
|
|
2309
|
-
|
|
2209
|
+
const {
|
|
2310
2210
|
getRootProps,
|
|
2311
2211
|
getInputProps
|
|
2312
2212
|
} = state;
|
|
@@ -2331,7 +2231,7 @@ class FileInputComponent extends Component {
|
|
|
2331
2231
|
iconStyle: _objectSpread$g({}, this.props.style)
|
|
2332
2232
|
});
|
|
2333
2233
|
};
|
|
2334
|
-
|
|
2234
|
+
const renderRemove = () => {
|
|
2335
2235
|
return !this.props.disableRemove && !this.props.disabled && (this.props.simpleStyle ? /*#__PURE__*/jsx(Icon$1, {
|
|
2336
2236
|
icon: "xmark",
|
|
2337
2237
|
className: "imageInput_removeIcon",
|
|
@@ -2342,7 +2242,7 @@ class FileInputComponent extends Component {
|
|
|
2342
2242
|
children: "remove"
|
|
2343
2243
|
}));
|
|
2344
2244
|
};
|
|
2345
|
-
|
|
2245
|
+
const renderDownload = () => {
|
|
2346
2246
|
if (this.props.noDownload) return null;
|
|
2347
2247
|
return /*#__PURE__*/jsx("a", {
|
|
2348
2248
|
href: input.value,
|
|
@@ -2362,7 +2262,7 @@ class FileInputComponent extends Component {
|
|
|
2362
2262
|
accept: this.getAccept(),
|
|
2363
2263
|
onDrop: this.onDrop,
|
|
2364
2264
|
children: state => {
|
|
2365
|
-
|
|
2265
|
+
const {
|
|
2366
2266
|
getRootProps,
|
|
2367
2267
|
getInputProps,
|
|
2368
2268
|
isDragActive
|
|
@@ -2420,10 +2320,10 @@ class FileInputComponent extends Component {
|
|
|
2420
2320
|
});
|
|
2421
2321
|
}
|
|
2422
2322
|
}
|
|
2423
|
-
|
|
2323
|
+
const mapStateToProps$5 = () => {
|
|
2424
2324
|
return {};
|
|
2425
2325
|
};
|
|
2426
|
-
|
|
2326
|
+
const FileInput = connect(mapStateToProps$5, {}, null, {
|
|
2427
2327
|
forwardRef: true
|
|
2428
2328
|
})(FileInputComponent);
|
|
2429
2329
|
|
|
@@ -2451,7 +2351,7 @@ class GenericInput extends Component {
|
|
|
2451
2351
|
return !_.isUndefined(this.props.showError) && (typeof this.props.showError === "function" && this.props.showError() || typeof this.props.showError === "boolean" && this.props.showError);
|
|
2452
2352
|
}
|
|
2453
2353
|
getClassNames() {
|
|
2454
|
-
|
|
2354
|
+
let string = "".concat(this.props.className, " genericInputContainer");
|
|
2455
2355
|
if (!_.isUndefined(this.props.disabled) && this.props.disabled) {
|
|
2456
2356
|
string += " genericInput-disabled";
|
|
2457
2357
|
}
|
|
@@ -2470,7 +2370,7 @@ class GenericInput extends Component {
|
|
|
2470
2370
|
return string;
|
|
2471
2371
|
}
|
|
2472
2372
|
getLabelStyle() {
|
|
2473
|
-
|
|
2373
|
+
const style = {};
|
|
2474
2374
|
if (_.isEmpty(this.props.value) && !this.props.alwaysShowLabel) {
|
|
2475
2375
|
style.opacity = 0;
|
|
2476
2376
|
}
|
|
@@ -2577,7 +2477,7 @@ class GenericInput extends Component {
|
|
|
2577
2477
|
});
|
|
2578
2478
|
}
|
|
2579
2479
|
}
|
|
2580
|
-
|
|
2480
|
+
const styles$8 = {
|
|
2581
2481
|
row: {
|
|
2582
2482
|
display: "flex",
|
|
2583
2483
|
flexDirection: "row",
|
|
@@ -2586,8 +2486,8 @@ var styles$8 = {
|
|
|
2586
2486
|
}
|
|
2587
2487
|
};
|
|
2588
2488
|
|
|
2589
|
-
|
|
2590
|
-
|
|
2489
|
+
const SET_AUTH = "set_auth";
|
|
2490
|
+
const SET_NAV_DATA = "SET_NAV_DATA";
|
|
2591
2491
|
|
|
2592
2492
|
// import { getEnabledFeatures } from '../session';
|
|
2593
2493
|
// import { authActions, typeActions } from '../apis';
|
|
@@ -2618,14 +2518,14 @@ var SET_NAV_DATA = "SET_NAV_DATA";
|
|
|
2618
2518
|
// };
|
|
2619
2519
|
// };
|
|
2620
2520
|
|
|
2621
|
-
|
|
2521
|
+
const setAuth = stuff => {
|
|
2622
2522
|
return {
|
|
2623
2523
|
type: SET_AUTH,
|
|
2624
2524
|
payload: stuff
|
|
2625
2525
|
};
|
|
2626
2526
|
};
|
|
2627
2527
|
|
|
2628
|
-
|
|
2528
|
+
const setNavData = data => {
|
|
2629
2529
|
return {
|
|
2630
2530
|
type: SET_NAV_DATA,
|
|
2631
2531
|
payload: data
|
|
@@ -2714,13 +2614,13 @@ class Header extends Component {
|
|
|
2714
2614
|
return this.renderHeader();
|
|
2715
2615
|
}
|
|
2716
2616
|
}
|
|
2717
|
-
|
|
2617
|
+
const mapStateToProps$4 = state => {
|
|
2718
2618
|
return {
|
|
2719
2619
|
auth: state.auth,
|
|
2720
2620
|
isSideMenuOpen: state.nav.isSideMenuOpen
|
|
2721
2621
|
};
|
|
2722
2622
|
};
|
|
2723
|
-
|
|
2623
|
+
let exportObj$4 = connect(mapStateToProps$4, {
|
|
2724
2624
|
setNavData
|
|
2725
2625
|
})(withRouter(Header));
|
|
2726
2626
|
|
|
@@ -2750,7 +2650,7 @@ class SideNavItem extends Component {
|
|
|
2750
2650
|
}
|
|
2751
2651
|
}
|
|
2752
2652
|
getClassNames() {
|
|
2753
|
-
|
|
2653
|
+
let result = "";
|
|
2754
2654
|
if (this.props.className) {
|
|
2755
2655
|
result += " ".concat(this.props.className);
|
|
2756
2656
|
}
|
|
@@ -2805,7 +2705,7 @@ class SideNavItem extends Component {
|
|
|
2805
2705
|
});
|
|
2806
2706
|
}
|
|
2807
2707
|
}
|
|
2808
|
-
|
|
2708
|
+
const styles$7 = {
|
|
2809
2709
|
section: {
|
|
2810
2710
|
display: "flex",
|
|
2811
2711
|
alignItems: "center",
|
|
@@ -2817,7 +2717,7 @@ var styles$7 = {
|
|
|
2817
2717
|
borderRadius: 5
|
|
2818
2718
|
}
|
|
2819
2719
|
};
|
|
2820
|
-
|
|
2720
|
+
let exportObj$3 = connect(null, {})(withRouter(SideNavItem));
|
|
2821
2721
|
|
|
2822
2722
|
function ownKeys$d(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2823
2723
|
function _objectSpread$d(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$d(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$d(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -2826,11 +2726,11 @@ class HubSidebar extends PureComponent {
|
|
|
2826
2726
|
super(props);
|
|
2827
2727
|
_defineProperty(this, "renderHelpGuide", () => {
|
|
2828
2728
|
if (!this.props.helpGuide) return null;
|
|
2829
|
-
|
|
2729
|
+
const {
|
|
2830
2730
|
text,
|
|
2831
2731
|
url
|
|
2832
2732
|
} = this.props.helpGuide;
|
|
2833
|
-
|
|
2733
|
+
const onHelpGuidePress = () => {
|
|
2834
2734
|
if (!url) return;
|
|
2835
2735
|
window.open(url, "_blank");
|
|
2836
2736
|
};
|
|
@@ -2931,13 +2831,13 @@ class HubSidebar extends PureComponent {
|
|
|
2931
2831
|
});
|
|
2932
2832
|
}
|
|
2933
2833
|
}
|
|
2934
|
-
|
|
2834
|
+
const mapStateToProps$3 = state => {
|
|
2935
2835
|
return {
|
|
2936
2836
|
auth: state.auth,
|
|
2937
2837
|
isSideMenuOpen: state.nav.isSideMenuOpen
|
|
2938
2838
|
};
|
|
2939
2839
|
};
|
|
2940
|
-
|
|
2840
|
+
let exportObj$2 = connect(mapStateToProps$3, {
|
|
2941
2841
|
setNavData
|
|
2942
2842
|
})(HubSidebar);
|
|
2943
2843
|
|
|
@@ -3045,7 +2945,7 @@ class Popup extends Component {
|
|
|
3045
2945
|
|
|
3046
2946
|
function ownKeys$b(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3047
2947
|
function _objectSpread$b(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$b(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$b(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3048
|
-
|
|
2948
|
+
const DEFAULT_INPUT = {
|
|
3049
2949
|
uploadingImage: false,
|
|
3050
2950
|
value: "",
|
|
3051
2951
|
displayValue: ""
|
|
@@ -3076,7 +2976,7 @@ class ImageInputComponent extends Component {
|
|
|
3076
2976
|
saveErrorMessage: ""
|
|
3077
2977
|
});
|
|
3078
2978
|
_defineProperty(this, "getAccept", () => {
|
|
3079
|
-
|
|
2979
|
+
const accept = {
|
|
3080
2980
|
"image/*": [".jpeg", ".png"]
|
|
3081
2981
|
};
|
|
3082
2982
|
if (this.props.allowVideo) {
|
|
@@ -3084,21 +2984,21 @@ class ImageInputComponent extends Component {
|
|
|
3084
2984
|
}
|
|
3085
2985
|
return accept;
|
|
3086
2986
|
});
|
|
3087
|
-
_defineProperty(this, "refreshFolders",
|
|
3088
|
-
|
|
2987
|
+
_defineProperty(this, "refreshFolders", async () => {
|
|
2988
|
+
const res = await fileActions.getMediaFolders(this.props.auth.site);
|
|
3089
2989
|
return res.data;
|
|
3090
|
-
})
|
|
2990
|
+
});
|
|
3091
2991
|
_defineProperty(this, "checkRefreshCallback", inputs => {
|
|
3092
2992
|
if (_.isUndefined(this.props.refreshCallback)) {
|
|
3093
2993
|
return;
|
|
3094
2994
|
}
|
|
3095
2995
|
if (!this.props.multiple) {
|
|
3096
|
-
|
|
2996
|
+
const image = _.find(inputs, i => {
|
|
3097
2997
|
return !i.uploadingImage && !_.isEmpty(i.value);
|
|
3098
2998
|
});
|
|
3099
2999
|
this.props.refreshCallback(image ? image.value : undefined);
|
|
3100
3000
|
} else {
|
|
3101
|
-
|
|
3001
|
+
const images = _.filter(inputs, i => {
|
|
3102
3002
|
return !i.uploadingImage && !_.isEmpty(i.value);
|
|
3103
3003
|
}).map(i => {
|
|
3104
3004
|
return i.value;
|
|
@@ -3108,8 +3008,8 @@ class ImageInputComponent extends Component {
|
|
|
3108
3008
|
});
|
|
3109
3009
|
_defineProperty(this, "parseImagesArray", images => {
|
|
3110
3010
|
return _.map(images, f => {
|
|
3111
|
-
|
|
3112
|
-
|
|
3011
|
+
const uri = typeof f === "string" ? f : f.uri;
|
|
3012
|
+
const image1400 = get1400(uri);
|
|
3113
3013
|
return {
|
|
3114
3014
|
Value: uri,
|
|
3115
3015
|
Thumb: getThumb300(uri),
|
|
@@ -3122,7 +3022,7 @@ class ImageInputComponent extends Component {
|
|
|
3122
3022
|
this.setState({
|
|
3123
3023
|
addFolderOpen: true
|
|
3124
3024
|
}, () => {
|
|
3125
|
-
|
|
3025
|
+
const input = document.getElementById("addFolderInput");
|
|
3126
3026
|
if (input) input.focus();
|
|
3127
3027
|
});
|
|
3128
3028
|
});
|
|
@@ -3137,22 +3037,22 @@ class ImageInputComponent extends Component {
|
|
|
3137
3037
|
_defineProperty(this, "saveFolder", () => {
|
|
3138
3038
|
this.setState({
|
|
3139
3039
|
addingFolder: true
|
|
3140
|
-
},
|
|
3040
|
+
}, async () => {
|
|
3141
3041
|
try {
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3042
|
+
await fileActions.addMediaFolder(this.props.auth.site, this.state.addFolderInput);
|
|
3043
|
+
const folders = await this.refreshFolders();
|
|
3044
|
+
this.setState(_objectSpread$b({
|
|
3145
3045
|
addingFolder: false,
|
|
3146
3046
|
folders
|
|
3147
|
-
},
|
|
3047
|
+
}, this.cancelAddStates));
|
|
3148
3048
|
} catch (error) {
|
|
3149
3049
|
console.log("addFolder - error", error);
|
|
3150
|
-
|
|
3050
|
+
this.setState({
|
|
3151
3051
|
addingFolder: false,
|
|
3152
3052
|
saveErrorMessage: getApiError(error).message
|
|
3153
3053
|
});
|
|
3154
3054
|
}
|
|
3155
|
-
})
|
|
3055
|
+
});
|
|
3156
3056
|
});
|
|
3157
3057
|
_defineProperty(this, "isStockFolder", folder => {
|
|
3158
3058
|
if (!folder) folder = this.state.selectedFolder;
|
|
@@ -3173,22 +3073,22 @@ class ImageInputComponent extends Component {
|
|
|
3173
3073
|
});
|
|
3174
3074
|
});
|
|
3175
3075
|
_defineProperty(this, "onDrop", function (files) {
|
|
3176
|
-
|
|
3076
|
+
let fromLibrary = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
3177
3077
|
if (_this.props.multiple) {
|
|
3178
|
-
|
|
3078
|
+
const newInputs = _.clone(_this.state.inputs);
|
|
3179
3079
|
files.forEach(file => {
|
|
3180
3080
|
if (_this.props.limit && newInputs.length === _this.props.limit) {
|
|
3181
3081
|
// hit limit - replace last input if it's empty
|
|
3182
3082
|
if (_.isEmpty(newInputs[newInputs.length - 1].value)) {
|
|
3183
|
-
|
|
3083
|
+
const newInput = newInputs[newInputs.length - 1];
|
|
3184
3084
|
_this.handleFile(newInput, file);
|
|
3185
3085
|
}
|
|
3186
3086
|
} else {
|
|
3187
|
-
|
|
3087
|
+
const newInput = _objectSpread$b(_objectSpread$b({}, DEFAULT_INPUT), {}, {
|
|
3188
3088
|
fromLibrary
|
|
3189
3089
|
});
|
|
3190
|
-
newInputs.splice(newInputs.length - 1, 0,
|
|
3191
|
-
_this.handleFile(
|
|
3090
|
+
newInputs.splice(newInputs.length - 1, 0, newInput);
|
|
3091
|
+
_this.handleFile(newInput, file);
|
|
3192
3092
|
}
|
|
3193
3093
|
});
|
|
3194
3094
|
_this.setState({
|
|
@@ -3199,35 +3099,30 @@ class ImageInputComponent extends Component {
|
|
|
3199
3099
|
_this.handleFile(_this.state.inputs[0], files[0]);
|
|
3200
3100
|
}
|
|
3201
3101
|
});
|
|
3202
|
-
_defineProperty(this, "handleFile",
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3102
|
+
_defineProperty(this, "handleFile", async (input, file) => {
|
|
3103
|
+
if (!file || input.uploadingImage) {
|
|
3104
|
+
return;
|
|
3105
|
+
}
|
|
3106
|
+
input.uploadingImage = true;
|
|
3107
|
+
const newInputs = _.clone(this.state.inputs);
|
|
3108
|
+
this.setState({
|
|
3109
|
+
inputs: newInputs
|
|
3110
|
+
});
|
|
3111
|
+
this.checkRefreshCallback(newInputs);
|
|
3112
|
+
try {
|
|
3113
|
+
let uploadFile = file;
|
|
3114
|
+
if (!isVideo(file.name)) {
|
|
3115
|
+
uploadFile = await fileActions.compressImage(file, this.props.maxSize || 1400, this.props.quality || 0.8, this.props.noCompress || false);
|
|
3206
3116
|
}
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3117
|
+
const url = await fileActions.uploadMediaAsync(uploadFile, uploadFile.name);
|
|
3118
|
+
this.checkSetDisplayValue(input, url);
|
|
3119
|
+
} catch (error) {
|
|
3120
|
+
console.log("handleFile error", error);
|
|
3121
|
+
this.setState({
|
|
3122
|
+
uploadingImage: false
|
|
3211
3123
|
});
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
var uploadFile = file;
|
|
3215
|
-
if (!isVideo(file.name)) {
|
|
3216
|
-
uploadFile = yield fileActions.compressImage(file, _this.props.maxSize || 1400, _this.props.quality || 0.8, _this.props.noCompress || false);
|
|
3217
|
-
}
|
|
3218
|
-
var url = yield fileActions.uploadMediaAsync(uploadFile, uploadFile.name);
|
|
3219
|
-
_this.checkSetDisplayValue(input, url);
|
|
3220
|
-
} catch (error) {
|
|
3221
|
-
console.log("handleFile error", error);
|
|
3222
|
-
_this.setState({
|
|
3223
|
-
uploadingImage: false
|
|
3224
|
-
});
|
|
3225
|
-
}
|
|
3226
|
-
});
|
|
3227
|
-
return function (_x, _x2) {
|
|
3228
|
-
return _ref3.apply(this, arguments);
|
|
3229
|
-
};
|
|
3230
|
-
}());
|
|
3124
|
+
}
|
|
3125
|
+
});
|
|
3231
3126
|
_defineProperty(this, "handleChange", event => {
|
|
3232
3127
|
var stateChange = {};
|
|
3233
3128
|
stateChange[event.target.getAttribute("id")] = event.target.value;
|
|
@@ -3236,63 +3131,63 @@ class ImageInputComponent extends Component {
|
|
|
3236
3131
|
_defineProperty(this, "deleteFolder", (event, folder) => {
|
|
3237
3132
|
event.stopPropagation();
|
|
3238
3133
|
if (window.confirm("Are you sure you want to delete ".concat(folder.Name, "?"))) {
|
|
3239
|
-
|
|
3134
|
+
const deletingFolder = _objectSpread$b({}, this.state.deletingFolder);
|
|
3240
3135
|
deletingFolder[folder.RowId] = true;
|
|
3241
3136
|
this.setState(_objectSpread$b({
|
|
3242
3137
|
deletingFolder: _.clone(deletingFolder)
|
|
3243
|
-
}, this.cancelAddStates),
|
|
3138
|
+
}, this.cancelAddStates), async () => {
|
|
3244
3139
|
try {
|
|
3245
|
-
|
|
3246
|
-
|
|
3140
|
+
await fileActions.deleteMediaFolder(folder.RowId, this.props.auth.site);
|
|
3141
|
+
const folders = await this.refreshFolders();
|
|
3247
3142
|
deletingFolder[folder.RowId] = false;
|
|
3248
|
-
|
|
3143
|
+
this.setState({
|
|
3249
3144
|
deletingFolder: _.clone(deletingFolder),
|
|
3250
3145
|
folders
|
|
3251
3146
|
});
|
|
3252
3147
|
} catch (error) {
|
|
3253
3148
|
console.log("addFolder - error", getApiError(error));
|
|
3254
3149
|
deletingFolder[folder.RowId] = false;
|
|
3255
|
-
|
|
3150
|
+
this.setState({
|
|
3256
3151
|
deletingFolder: _.clone(deletingFolder)
|
|
3257
3152
|
});
|
|
3258
3153
|
}
|
|
3259
|
-
})
|
|
3154
|
+
});
|
|
3260
3155
|
}
|
|
3261
3156
|
});
|
|
3262
3157
|
_defineProperty(this, "deleteImage", (event, image) => {
|
|
3263
3158
|
if (window.confirm("Are you sure you want to delete the image?")) {
|
|
3264
3159
|
// Unselect the image first if selected
|
|
3265
3160
|
if (image.Selected) this.toggleLibraryItem(image);
|
|
3266
|
-
|
|
3161
|
+
const deletingImage = _objectSpread$b({}, this.state.deletingImage);
|
|
3267
3162
|
deletingImage[image.Value] = true;
|
|
3268
3163
|
this.setState({
|
|
3269
3164
|
deletingImage: _.clone(deletingImage)
|
|
3270
|
-
},
|
|
3165
|
+
}, async () => {
|
|
3271
3166
|
try {
|
|
3272
|
-
|
|
3167
|
+
const {
|
|
3273
3168
|
selectedFolder
|
|
3274
|
-
} =
|
|
3275
|
-
|
|
3169
|
+
} = this.state;
|
|
3170
|
+
const {
|
|
3276
3171
|
RowId,
|
|
3277
3172
|
Images
|
|
3278
3173
|
} = selectedFolder;
|
|
3279
|
-
|
|
3280
|
-
|
|
3174
|
+
await fileActions.deleteImagesFromFolder(RowId, this.props.auth.site, [image.Value]);
|
|
3175
|
+
const images = Images.filter(i => i.uri !== image.Value);
|
|
3281
3176
|
selectedFolder.Images = images;
|
|
3282
|
-
selectedFolder.parsedImages =
|
|
3177
|
+
selectedFolder.parsedImages = this.parseImagesArray(images);
|
|
3283
3178
|
deletingImage[image.Value] = false;
|
|
3284
|
-
|
|
3179
|
+
this.setState({
|
|
3285
3180
|
deletingImage: _.clone(deletingImage),
|
|
3286
3181
|
selectedFolder: _.clone(selectedFolder)
|
|
3287
3182
|
});
|
|
3288
3183
|
} catch (error) {
|
|
3289
3184
|
console.log("deleteImage - error", getApiError(error));
|
|
3290
3185
|
deletingImage[image.Value] = false;
|
|
3291
|
-
|
|
3186
|
+
this.setState({
|
|
3292
3187
|
deletingImage: _.clone(deletingImage)
|
|
3293
3188
|
});
|
|
3294
3189
|
}
|
|
3295
|
-
})
|
|
3190
|
+
});
|
|
3296
3191
|
}
|
|
3297
3192
|
});
|
|
3298
3193
|
_defineProperty(this, "canManageLibrary", () => {
|
|
@@ -3345,7 +3240,7 @@ class ImageInputComponent extends Component {
|
|
|
3345
3240
|
}]
|
|
3346
3241
|
});
|
|
3347
3242
|
} else {
|
|
3348
|
-
|
|
3243
|
+
const inputs = [];
|
|
3349
3244
|
_.forEach(val, str => {
|
|
3350
3245
|
inputs.push({
|
|
3351
3246
|
uploadingImage: false,
|
|
@@ -3363,7 +3258,7 @@ class ImageInputComponent extends Component {
|
|
|
3363
3258
|
if (_.isEmpty(displayValue)) {
|
|
3364
3259
|
return null;
|
|
3365
3260
|
}
|
|
3366
|
-
|
|
3261
|
+
const image = isVideo(displayValue) ? get1400(displayValue) : displayValue;
|
|
3367
3262
|
if (this.props.noCompress) {
|
|
3368
3263
|
return {
|
|
3369
3264
|
backgroundImage: "url(".concat(image, ")"),
|
|
@@ -3375,7 +3270,7 @@ class ImageInputComponent extends Component {
|
|
|
3375
3270
|
};
|
|
3376
3271
|
}
|
|
3377
3272
|
getContainerClasses() {
|
|
3378
|
-
|
|
3273
|
+
let result = this.props.className || "";
|
|
3379
3274
|
if (this.props.noMenu) {
|
|
3380
3275
|
result += " imageInputOuter-noMenu";
|
|
3381
3276
|
}
|
|
@@ -3388,7 +3283,7 @@ class ImageInputComponent extends Component {
|
|
|
3388
3283
|
return result;
|
|
3389
3284
|
}
|
|
3390
3285
|
getClassNames(input, inputsLength) {
|
|
3391
|
-
|
|
3286
|
+
let classes = "imageInput";
|
|
3392
3287
|
if (input.uploadingImage) {
|
|
3393
3288
|
classes += " imageInput-uploading";
|
|
3394
3289
|
} else if (!_.isEmpty(input.value) && !this.props.onlyAllowUpload) {
|
|
@@ -3406,47 +3301,45 @@ class ImageInputComponent extends Component {
|
|
|
3406
3301
|
return "";
|
|
3407
3302
|
}
|
|
3408
3303
|
getFolders() {
|
|
3409
|
-
var _this2 = this;
|
|
3410
3304
|
this.setState({
|
|
3411
3305
|
loadingFolders: true
|
|
3412
|
-
},
|
|
3306
|
+
}, async () => {
|
|
3413
3307
|
try {
|
|
3414
|
-
|
|
3415
|
-
|
|
3308
|
+
const folders = await this.refreshFolders();
|
|
3309
|
+
this.setState({
|
|
3416
3310
|
loadingFolders: false,
|
|
3417
3311
|
folders
|
|
3418
3312
|
});
|
|
3419
3313
|
} catch (error) {
|
|
3420
3314
|
console.log("getFolders - error", error);
|
|
3421
|
-
|
|
3315
|
+
this.setState({
|
|
3422
3316
|
loadingFolders: false
|
|
3423
3317
|
});
|
|
3424
3318
|
}
|
|
3425
|
-
})
|
|
3319
|
+
});
|
|
3426
3320
|
}
|
|
3427
3321
|
getLibrary() {
|
|
3428
|
-
var _this3 = this;
|
|
3429
3322
|
if (this.state.libraryLoadTriggered) return;
|
|
3430
3323
|
this.setState({
|
|
3431
3324
|
libraryLoadTriggered: true
|
|
3432
|
-
},
|
|
3325
|
+
}, async () => {
|
|
3433
3326
|
try {
|
|
3434
|
-
|
|
3327
|
+
const res = await fileActions.getMediaLibrary();
|
|
3435
3328
|
// console.log('getLibrary', res.data);
|
|
3436
|
-
|
|
3329
|
+
this.setState({
|
|
3437
3330
|
libraryLoaded: true,
|
|
3438
|
-
imageLibrary:
|
|
3331
|
+
imageLibrary: this.parseImagesArray(res.data)
|
|
3439
3332
|
});
|
|
3440
3333
|
} catch (error) {
|
|
3441
3334
|
console.log("getLibrary - error", error);
|
|
3442
3335
|
}
|
|
3443
|
-
})
|
|
3336
|
+
});
|
|
3444
3337
|
}
|
|
3445
3338
|
toggleLibraryItem(image) {
|
|
3446
|
-
|
|
3339
|
+
const newInputs = _.clone(this.state.inputs);
|
|
3447
3340
|
if (image.Selected) {
|
|
3448
3341
|
// Unselelct selected image
|
|
3449
|
-
|
|
3342
|
+
const index = _.findIndex(newInputs, input => {
|
|
3450
3343
|
return input.value === image.Value || input.value === image[1400];
|
|
3451
3344
|
});
|
|
3452
3345
|
if (index !== -1) {
|
|
@@ -3455,7 +3348,7 @@ class ImageInputComponent extends Component {
|
|
|
3455
3348
|
image.Selected = false;
|
|
3456
3349
|
} else {
|
|
3457
3350
|
// Select unselected image
|
|
3458
|
-
|
|
3351
|
+
const newFile = {
|
|
3459
3352
|
uploadingImage: false,
|
|
3460
3353
|
value: image.Value,
|
|
3461
3354
|
displayValue: image[1400],
|
|
@@ -3481,28 +3374,28 @@ class ImageInputComponent extends Component {
|
|
|
3481
3374
|
this.checkRefreshCallback(newInputs);
|
|
3482
3375
|
}
|
|
3483
3376
|
checkSetDisplayValue(input, value) {
|
|
3484
|
-
|
|
3485
|
-
|
|
3377
|
+
const displayValue = get1400(value);
|
|
3378
|
+
const storeValue = isVideo(value) || this.props.noCompress ? value : get1400(value);
|
|
3486
3379
|
$("<img/>").attr("src", "".concat(displayValue, "?t=").concat(moment().valueOf())).on("load", () => {
|
|
3487
3380
|
$(this).remove();
|
|
3488
3381
|
input.value = storeValue;
|
|
3489
3382
|
input.displayValue = storeValue;
|
|
3490
3383
|
input.uploadingImage = false;
|
|
3491
|
-
|
|
3384
|
+
const newInputs = _.clone(this.state.inputs);
|
|
3492
3385
|
this.setState({
|
|
3493
3386
|
inputs: newInputs
|
|
3494
3387
|
}, () => {
|
|
3495
|
-
|
|
3388
|
+
const {
|
|
3496
3389
|
selectedTab,
|
|
3497
3390
|
selectedFolder
|
|
3498
3391
|
} = this.state;
|
|
3499
3392
|
if (selectedTab === "library" && selectedFolder) {
|
|
3500
3393
|
// Uploading to a user folder
|
|
3501
|
-
|
|
3394
|
+
const {
|
|
3502
3395
|
RowId,
|
|
3503
3396
|
Images
|
|
3504
3397
|
} = selectedFolder;
|
|
3505
|
-
|
|
3398
|
+
const images = [...Images, value];
|
|
3506
3399
|
fileActions.addImagesToFolder(RowId, this.props.auth.site, [value]).catch(error => {
|
|
3507
3400
|
console.log("addImagesToFolder error", error);
|
|
3508
3401
|
});
|
|
@@ -3522,12 +3415,12 @@ class ImageInputComponent extends Component {
|
|
|
3522
3415
|
});
|
|
3523
3416
|
}
|
|
3524
3417
|
removeImage(input) {
|
|
3525
|
-
|
|
3418
|
+
const newState = {};
|
|
3526
3419
|
if (input.fromLibrary) {
|
|
3527
3420
|
input.fromLibrary = undefined;
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3421
|
+
const selectedFolderImages = this.state.selectedFolder ? this.state.selectedFolder.parsedImages : [];
|
|
3422
|
+
const imageList = this.isStockFolder() ? this.state.imageLibrary : selectedFolderImages;
|
|
3423
|
+
const libraryFile = _.find(imageList, f => {
|
|
3531
3424
|
return f.Value === input.value || f[1400] === input.value;
|
|
3532
3425
|
});
|
|
3533
3426
|
if (libraryFile) {
|
|
@@ -3541,7 +3434,7 @@ class ImageInputComponent extends Component {
|
|
|
3541
3434
|
}
|
|
3542
3435
|
input.value = "";
|
|
3543
3436
|
input.displayValue = "";
|
|
3544
|
-
|
|
3437
|
+
const newInputs = _.clone(this.state.inputs);
|
|
3545
3438
|
if (newInputs.length > 1) {
|
|
3546
3439
|
newInputs.splice(newInputs.indexOf(input), 1);
|
|
3547
3440
|
if (newInputs.length === this.props.limit - 1 && !_.isEmpty(newInputs[newInputs.length - 1].value)) {
|
|
@@ -3559,7 +3452,7 @@ class ImageInputComponent extends Component {
|
|
|
3559
3452
|
});
|
|
3560
3453
|
}
|
|
3561
3454
|
renderInput(input, index, inputsLength) {
|
|
3562
|
-
|
|
3455
|
+
const renderContent = () => {
|
|
3563
3456
|
if (this.props.onlyAllowUpload) {
|
|
3564
3457
|
return null;
|
|
3565
3458
|
}
|
|
@@ -3582,7 +3475,7 @@ class ImageInputComponent extends Component {
|
|
|
3582
3475
|
accept: this.getAccept(),
|
|
3583
3476
|
onDrop: files => this.onDrop(files, true),
|
|
3584
3477
|
children: state => {
|
|
3585
|
-
|
|
3478
|
+
const {
|
|
3586
3479
|
getRootProps,
|
|
3587
3480
|
getInputProps
|
|
3588
3481
|
} = state;
|
|
@@ -3606,7 +3499,7 @@ class ImageInputComponent extends Component {
|
|
|
3606
3499
|
style: _objectSpread$b(_objectSpread$b({}, this.getImageStyle(input.displayValue)), this.props.style)
|
|
3607
3500
|
});
|
|
3608
3501
|
};
|
|
3609
|
-
|
|
3502
|
+
const renderRemove = () => {
|
|
3610
3503
|
return !this.props.disableRemove && !this.props.disabled && (this.props.simpleStyle ? /*#__PURE__*/jsx(Icon$1, {
|
|
3611
3504
|
icon: "xmark",
|
|
3612
3505
|
className: "imageInput_removeIcon",
|
|
@@ -3617,7 +3510,7 @@ class ImageInputComponent extends Component {
|
|
|
3617
3510
|
children: "remove"
|
|
3618
3511
|
}));
|
|
3619
3512
|
};
|
|
3620
|
-
|
|
3513
|
+
const renderDownload = () => {
|
|
3621
3514
|
if (isVideo(input.displayValue)) return null;
|
|
3622
3515
|
if (this.props.noDownload) return null;
|
|
3623
3516
|
return /*#__PURE__*/jsx("a", {
|
|
@@ -3631,7 +3524,7 @@ class ImageInputComponent extends Component {
|
|
|
3631
3524
|
})
|
|
3632
3525
|
});
|
|
3633
3526
|
};
|
|
3634
|
-
|
|
3527
|
+
const mediaText = this.props.allowVideo ? "media" : "image".concat(this.props.multiple ? "s" : "");
|
|
3635
3528
|
return /*#__PURE__*/jsxs("div", {
|
|
3636
3529
|
className: this.getClassNames(input, inputsLength),
|
|
3637
3530
|
style: _objectSpread$b({}, this.props.style),
|
|
@@ -3640,7 +3533,7 @@ class ImageInputComponent extends Component {
|
|
|
3640
3533
|
accept: this.getAccept(),
|
|
3641
3534
|
onDrop: this.onDrop,
|
|
3642
3535
|
children: state => {
|
|
3643
|
-
|
|
3536
|
+
const {
|
|
3644
3537
|
getRootProps,
|
|
3645
3538
|
getInputProps,
|
|
3646
3539
|
isDragActive
|
|
@@ -3681,7 +3574,7 @@ class ImageInputComponent extends Component {
|
|
|
3681
3574
|
}
|
|
3682
3575
|
renderLibraryImage(image, index, allowDelete) {
|
|
3683
3576
|
// console.log(image);
|
|
3684
|
-
|
|
3577
|
+
let classes = "imageInput imageInput-hasImage imageInput-libraryImage";
|
|
3685
3578
|
if (image.Selected) {
|
|
3686
3579
|
classes += " imageInput-librarySelected";
|
|
3687
3580
|
}
|
|
@@ -3746,7 +3639,7 @@ class ImageInputComponent extends Component {
|
|
|
3746
3639
|
});
|
|
3747
3640
|
}
|
|
3748
3641
|
renderAddFolder() {
|
|
3749
|
-
|
|
3642
|
+
const isSaving = this.state.addingFolder;
|
|
3750
3643
|
if (this.state.addFolderOpen) {
|
|
3751
3644
|
return /*#__PURE__*/jsxs("div", {
|
|
3752
3645
|
className: "imageFolderContainer",
|
|
@@ -3804,8 +3697,8 @@ class ImageInputComponent extends Component {
|
|
|
3804
3697
|
});
|
|
3805
3698
|
}
|
|
3806
3699
|
renderFolder(folder, index) {
|
|
3807
|
-
|
|
3808
|
-
|
|
3700
|
+
const timeStamp = moment(folder.Timestamp).format("DD MMM, YYYY, h:mma");
|
|
3701
|
+
const countText = "".concat(folder.Images ? folder.Images.length : 0, " images");
|
|
3809
3702
|
return /*#__PURE__*/jsxs("div", {
|
|
3810
3703
|
className: "imageFolderContainer",
|
|
3811
3704
|
onClick: this.selectFolder.bind(this, folder),
|
|
@@ -3873,10 +3766,10 @@ class ImageInputComponent extends Component {
|
|
|
3873
3766
|
});
|
|
3874
3767
|
}
|
|
3875
3768
|
renderFolderImages() {
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3769
|
+
const stockFolder = this.isStockFolder();
|
|
3770
|
+
const canDelete = !stockFolder && this.canManageLibrary();
|
|
3771
|
+
const uploadingImages = this.state.inputs.filter(i => i.uploadingImage);
|
|
3772
|
+
const mediaText = this.props.allowVideo ? "media" : "image".concat(this.props.multiple ? "s" : "");
|
|
3880
3773
|
return /*#__PURE__*/jsxs("div", {
|
|
3881
3774
|
className: "imageInputContainer imageInputContainer-library",
|
|
3882
3775
|
style: _objectSpread$b({}, this.props.style),
|
|
@@ -3888,7 +3781,7 @@ class ImageInputComponent extends Component {
|
|
|
3888
3781
|
accept: this.getAccept(),
|
|
3889
3782
|
onDrop: files => this.onDrop(files, true),
|
|
3890
3783
|
children: state => {
|
|
3891
|
-
|
|
3784
|
+
const {
|
|
3892
3785
|
getRootProps,
|
|
3893
3786
|
getInputProps,
|
|
3894
3787
|
isDragActive
|
|
@@ -3952,7 +3845,7 @@ class ImageInputComponent extends Component {
|
|
|
3952
3845
|
if (this.state.selectedTab === "upload") {
|
|
3953
3846
|
return null;
|
|
3954
3847
|
}
|
|
3955
|
-
|
|
3848
|
+
let content = null;
|
|
3956
3849
|
if (this.state.selectedFolder) {
|
|
3957
3850
|
content = this.renderFolderImages();
|
|
3958
3851
|
} else {
|
|
@@ -3986,7 +3879,7 @@ class ImageInputComponent extends Component {
|
|
|
3986
3879
|
accept: this.getAccept(),
|
|
3987
3880
|
onDrop: files => this.onDrop(files, true),
|
|
3988
3881
|
children: state => {
|
|
3989
|
-
|
|
3882
|
+
const {
|
|
3990
3883
|
getRootProps,
|
|
3991
3884
|
getInputProps
|
|
3992
3885
|
} = state;
|
|
@@ -4024,7 +3917,7 @@ class ImageInputComponent extends Component {
|
|
|
4024
3917
|
});
|
|
4025
3918
|
}
|
|
4026
3919
|
}
|
|
4027
|
-
|
|
3920
|
+
const styles$6 = {
|
|
4028
3921
|
addFolderInputContainer: {
|
|
4029
3922
|
marginBottom: "0px",
|
|
4030
3923
|
paddingRight: "100px",
|
|
@@ -4058,12 +3951,12 @@ var styles$6 = {
|
|
|
4058
3951
|
cursor: "pointer"
|
|
4059
3952
|
}
|
|
4060
3953
|
};
|
|
4061
|
-
|
|
3954
|
+
const mapStateToProps$2 = state => {
|
|
4062
3955
|
return {
|
|
4063
3956
|
auth: state.auth
|
|
4064
3957
|
};
|
|
4065
3958
|
};
|
|
4066
|
-
|
|
3959
|
+
const ImageInput = connect(mapStateToProps$2, {}, null, {
|
|
4067
3960
|
forwardRef: true
|
|
4068
3961
|
})(ImageInputComponent);
|
|
4069
3962
|
|
|
@@ -4131,7 +4024,7 @@ class OverlayPage extends Component {
|
|
|
4131
4024
|
});
|
|
4132
4025
|
}
|
|
4133
4026
|
}
|
|
4134
|
-
|
|
4027
|
+
const styles$5 = {
|
|
4135
4028
|
pageWrapper: {
|
|
4136
4029
|
position: "fixed",
|
|
4137
4030
|
zIndex: 100,
|
|
@@ -4178,7 +4071,7 @@ class OverlayPageContents extends Component {
|
|
|
4178
4071
|
});
|
|
4179
4072
|
}
|
|
4180
4073
|
}
|
|
4181
|
-
|
|
4074
|
+
const styles$4 = {
|
|
4182
4075
|
wrapper: {
|
|
4183
4076
|
clear: "both",
|
|
4184
4077
|
whiteSpace: "nowrap",
|
|
@@ -4208,7 +4101,7 @@ class OverlayPageSection extends Component {
|
|
|
4208
4101
|
}));
|
|
4209
4102
|
}
|
|
4210
4103
|
}
|
|
4211
|
-
|
|
4104
|
+
const styles$3 = {
|
|
4212
4105
|
wrapper: {
|
|
4213
4106
|
/* height: '100%',
|
|
4214
4107
|
overflowY: 'auto',
|
|
@@ -4245,7 +4138,7 @@ class OverlayPageBottomButtons extends Component {
|
|
|
4245
4138
|
});
|
|
4246
4139
|
}
|
|
4247
4140
|
}
|
|
4248
|
-
|
|
4141
|
+
const styles$2 = {
|
|
4249
4142
|
wrapper: {
|
|
4250
4143
|
padding: 12,
|
|
4251
4144
|
paddingRight: 24,
|
|
@@ -4275,7 +4168,7 @@ function ownKeys$5(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymb
|
|
|
4275
4168
|
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$5(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4276
4169
|
class RadioButton extends Component {
|
|
4277
4170
|
generateClassNames(e) {
|
|
4278
|
-
|
|
4171
|
+
let string = "radioButton";
|
|
4279
4172
|
if (this.props.isActive === e) {
|
|
4280
4173
|
string = string + " radioButton--active";
|
|
4281
4174
|
}
|
|
@@ -4285,7 +4178,7 @@ class RadioButton extends Component {
|
|
|
4285
4178
|
return string;
|
|
4286
4179
|
}
|
|
4287
4180
|
generateWrapperClassNames() {
|
|
4288
|
-
|
|
4181
|
+
let string = "radioButtonWrapper";
|
|
4289
4182
|
if (this.props.disabled) {
|
|
4290
4183
|
string = string + " radioButton--disabled";
|
|
4291
4184
|
}
|
|
@@ -4298,7 +4191,7 @@ class RadioButton extends Component {
|
|
|
4298
4191
|
return string;
|
|
4299
4192
|
}
|
|
4300
4193
|
getButtonStyle(e) {
|
|
4301
|
-
|
|
4194
|
+
const result = {};
|
|
4302
4195
|
if (this.props.highlightColour && this.props.isActive === e) {
|
|
4303
4196
|
result.borderColor = this.props.highlightColour;
|
|
4304
4197
|
}
|
|
@@ -4395,7 +4288,7 @@ class RadioButton extends Component {
|
|
|
4395
4288
|
});
|
|
4396
4289
|
}
|
|
4397
4290
|
}
|
|
4398
|
-
|
|
4291
|
+
const styles$1 = {
|
|
4399
4292
|
row: {
|
|
4400
4293
|
display: "flex",
|
|
4401
4294
|
flexDirection: "row"
|
|
@@ -4538,7 +4431,7 @@ class SuccessPopup extends Component {
|
|
|
4538
4431
|
}
|
|
4539
4432
|
}
|
|
4540
4433
|
|
|
4541
|
-
|
|
4434
|
+
const getReactions = () => {
|
|
4542
4435
|
return [{
|
|
4543
4436
|
key: "heart",
|
|
4544
4437
|
icon: "https://pluss60-demo-media.s3-ap-southeast-2.amazonaws.com/assets/emojis/heart.png"
|
|
@@ -4624,7 +4517,7 @@ class Reactions extends Component {
|
|
|
4624
4517
|
// 3. A curated palette guarantees contrast and visual distinctiveness.
|
|
4625
4518
|
// Future enhancement: use site branding colours with collision fallback to this palette.
|
|
4626
4519
|
// Wraps around via modulo for 10+ sites (unlikely in practice).
|
|
4627
|
-
|
|
4520
|
+
const SITE_COLOURS = ["#5e9efc",
|
|
4628
4521
|
// Blue
|
|
4629
4522
|
"#49bdbb",
|
|
4630
4523
|
// Teal
|
|
@@ -4644,10 +4537,10 @@ var SITE_COLOURS = ["#5e9efc",
|
|
|
4644
4537
|
// Grapefruit
|
|
4645
4538
|
"#536280" // Dusk
|
|
4646
4539
|
];
|
|
4647
|
-
|
|
4540
|
+
const getSiteColour = index => {
|
|
4648
4541
|
return SITE_COLOURS[index % SITE_COLOURS.length];
|
|
4649
4542
|
};
|
|
4650
|
-
|
|
4543
|
+
const getAnalyticsFilterOptions = () => {
|
|
4651
4544
|
return [{
|
|
4652
4545
|
text: "Yesterday",
|
|
4653
4546
|
dayCount: 1,
|
|
@@ -4695,7 +4588,7 @@ class AnalyticsFilter extends PureComponent {
|
|
|
4695
4588
|
});
|
|
4696
4589
|
});
|
|
4697
4590
|
_defineProperty(this, "selectFilter", key => {
|
|
4698
|
-
|
|
4591
|
+
const selectedFilter = _.find(this.state.filterOptions, o => {
|
|
4699
4592
|
return o.dayCount === key;
|
|
4700
4593
|
});
|
|
4701
4594
|
this.setState({
|
|
@@ -4736,8 +4629,8 @@ class AnalyticsFilter extends PureComponent {
|
|
|
4736
4629
|
});
|
|
4737
4630
|
}
|
|
4738
4631
|
});
|
|
4739
|
-
|
|
4740
|
-
|
|
4632
|
+
const filterOptions = getAnalyticsFilterOptions();
|
|
4633
|
+
const _selectedFilter = this.props.defaultFilter || filterOptions[1];
|
|
4741
4634
|
this.state = {
|
|
4742
4635
|
filterOptions,
|
|
4743
4636
|
selectedFilter: _selectedFilter,
|
|
@@ -4908,7 +4801,7 @@ class TimePicker extends Component {
|
|
|
4908
4801
|
}
|
|
4909
4802
|
onNewProps(nextProps, forceUpdate) {
|
|
4910
4803
|
if (forceUpdate || nextProps.selectedTime !== this.props.selectedTime) {
|
|
4911
|
-
|
|
4804
|
+
let mDate = moment(nextProps.selectedTime, "h:mma");
|
|
4912
4805
|
if (!mDate.isValid()) {
|
|
4913
4806
|
this.setState({
|
|
4914
4807
|
selectedTime: null,
|
|
@@ -4917,7 +4810,7 @@ class TimePicker extends Component {
|
|
|
4917
4810
|
mInput: ""
|
|
4918
4811
|
});
|
|
4919
4812
|
} else {
|
|
4920
|
-
|
|
4813
|
+
const minutesFocused = document.getElementById("time_minute_".concat(this.state.id)) === document.activeElement;
|
|
4921
4814
|
this.setState({
|
|
4922
4815
|
selectedTime: mDate,
|
|
4923
4816
|
hourInput: mDate.format("h"),
|
|
@@ -4928,14 +4821,14 @@ class TimePicker extends Component {
|
|
|
4928
4821
|
}
|
|
4929
4822
|
}
|
|
4930
4823
|
getDefaultTime() {
|
|
4931
|
-
|
|
4824
|
+
const result = moment();
|
|
4932
4825
|
result.hour(12);
|
|
4933
4826
|
result.minute(0);
|
|
4934
4827
|
result.second(0);
|
|
4935
4828
|
return result;
|
|
4936
4829
|
}
|
|
4937
4830
|
onChangeHour(event) {
|
|
4938
|
-
|
|
4831
|
+
let hour = 0;
|
|
4939
4832
|
if (!_.isEmpty(event.target.value)) {
|
|
4940
4833
|
hour = parseInt(event.target.value, 10);
|
|
4941
4834
|
} else {
|
|
@@ -4948,8 +4841,8 @@ class TimePicker extends Component {
|
|
|
4948
4841
|
return;
|
|
4949
4842
|
}
|
|
4950
4843
|
hour = Math.max(Math.min(12, hour), 0);
|
|
4951
|
-
|
|
4952
|
-
|
|
4844
|
+
const dateToUse = this.state.selectedTime || this.getDefaultTime();
|
|
4845
|
+
const selectNext = hour > 1; // if hour is > 1, assume user is done typing and select minutes input
|
|
4953
4846
|
if (dateToUse.format("a") === "pm") {
|
|
4954
4847
|
hour += 12;
|
|
4955
4848
|
}
|
|
@@ -4963,7 +4856,7 @@ class TimePicker extends Component {
|
|
|
4963
4856
|
}
|
|
4964
4857
|
}
|
|
4965
4858
|
onChangeMinute(event) {
|
|
4966
|
-
|
|
4859
|
+
let minute = 0;
|
|
4967
4860
|
if (!_.isEmpty(event.target.value)) {
|
|
4968
4861
|
minute = parseInt(event.target.value, 10);
|
|
4969
4862
|
} else {
|
|
@@ -4976,7 +4869,7 @@ class TimePicker extends Component {
|
|
|
4976
4869
|
return;
|
|
4977
4870
|
}
|
|
4978
4871
|
minute = Math.max(Math.min(59, minute), 0);
|
|
4979
|
-
|
|
4872
|
+
const dateToUse = this.state.selectedTime || this.getDefaultTime();
|
|
4980
4873
|
dateToUse.minute(minute);
|
|
4981
4874
|
this.setState({
|
|
4982
4875
|
selectedTime: moment(dateToUse)
|
|
@@ -4994,7 +4887,7 @@ class TimePicker extends Component {
|
|
|
4994
4887
|
}
|
|
4995
4888
|
}
|
|
4996
4889
|
onChangeM(event) {
|
|
4997
|
-
|
|
4890
|
+
const dateToUse = this.state.selectedTime || this.getDefaultTime();
|
|
4998
4891
|
if (event.target.value.toLowerCase().indexOf("a") > -1) {
|
|
4999
4892
|
// am
|
|
5000
4893
|
if (dateToUse.format("a") === "pm") {
|
|
@@ -5027,7 +4920,7 @@ class TimePicker extends Component {
|
|
|
5027
4920
|
});
|
|
5028
4921
|
}
|
|
5029
4922
|
render() {
|
|
5030
|
-
|
|
4923
|
+
const {
|
|
5031
4924
|
disabled
|
|
5032
4925
|
} = this.props;
|
|
5033
4926
|
if (disabled) {
|
|
@@ -5249,12 +5142,12 @@ class AudienceIncluder extends Component {
|
|
|
5249
5142
|
});
|
|
5250
5143
|
}
|
|
5251
5144
|
}
|
|
5252
|
-
|
|
5145
|
+
const mapStateToProps$1 = state => {
|
|
5253
5146
|
return {
|
|
5254
5147
|
auth: state.auth
|
|
5255
5148
|
};
|
|
5256
5149
|
};
|
|
5257
|
-
|
|
5150
|
+
let exportObj$1 = connect(mapStateToProps$1, {})(withRouter(AudienceIncluder));
|
|
5258
5151
|
|
|
5259
5152
|
function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5260
5153
|
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -5292,7 +5185,7 @@ class DropdownInput extends Component {
|
|
|
5292
5185
|
return "off";
|
|
5293
5186
|
}
|
|
5294
5187
|
getClassNames() {
|
|
5295
|
-
|
|
5188
|
+
let string = "";
|
|
5296
5189
|
if (this.props.className) {
|
|
5297
5190
|
string += "".concat(this.props.className, " ");
|
|
5298
5191
|
}
|
|
@@ -5311,7 +5204,7 @@ class DropdownInput extends Component {
|
|
|
5311
5204
|
return string;
|
|
5312
5205
|
}
|
|
5313
5206
|
getLabelStyle() {
|
|
5314
|
-
|
|
5207
|
+
const style = {};
|
|
5315
5208
|
if (_.isEmpty(this.props.value) && !this.props.alwaysShowLabel) {
|
|
5316
5209
|
style.opacity = 0;
|
|
5317
5210
|
}
|
|
@@ -5429,7 +5322,7 @@ class DropdownInput extends Component {
|
|
|
5429
5322
|
});
|
|
5430
5323
|
}
|
|
5431
5324
|
}
|
|
5432
|
-
|
|
5325
|
+
const styles = {
|
|
5433
5326
|
row: {
|
|
5434
5327
|
display: "flex",
|
|
5435
5328
|
flexDirection: "row",
|
|
@@ -5468,11 +5361,11 @@ class AudienceSelector extends Component {
|
|
|
5468
5361
|
super(props);
|
|
5469
5362
|
_this = this;
|
|
5470
5363
|
_defineProperty(this, "onChangeSelection", () => {
|
|
5471
|
-
|
|
5364
|
+
const {
|
|
5472
5365
|
updateValidation,
|
|
5473
5366
|
onChange
|
|
5474
5367
|
} = this.props;
|
|
5475
|
-
|
|
5368
|
+
const isValid = this.validateAudienceSelection();
|
|
5476
5369
|
if (updateValidation) updateValidation(isValid);
|
|
5477
5370
|
if (onChange) onChange(this.getAudienceType(), this.getAudienceTypeSelection(), isValid);
|
|
5478
5371
|
});
|
|
@@ -5488,14 +5381,14 @@ class AudienceSelector extends Component {
|
|
|
5488
5381
|
return !_.isEmpty(this.state.AudienceTagList);
|
|
5489
5382
|
});
|
|
5490
5383
|
_defineProperty(this, "getAvailableAudienceTags", function () {
|
|
5491
|
-
|
|
5492
|
-
|
|
5384
|
+
let includeSelected = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
5385
|
+
const {
|
|
5493
5386
|
categories,
|
|
5494
5387
|
types,
|
|
5495
5388
|
tagList,
|
|
5496
5389
|
AudienceTagList
|
|
5497
5390
|
} = _this.state;
|
|
5498
|
-
|
|
5391
|
+
const categoryTags = categories.map(c => {
|
|
5499
5392
|
return {
|
|
5500
5393
|
AudienceType: "Category",
|
|
5501
5394
|
AudienceTypeSelection: c.Key,
|
|
@@ -5503,7 +5396,7 @@ class AudienceSelector extends Component {
|
|
|
5503
5396
|
Title: c.Title
|
|
5504
5397
|
};
|
|
5505
5398
|
});
|
|
5506
|
-
|
|
5399
|
+
const userTypeTags = types.map(t => {
|
|
5507
5400
|
return {
|
|
5508
5401
|
AudienceType: "UserType",
|
|
5509
5402
|
AudienceTypeSelection: t.typeName,
|
|
@@ -5511,7 +5404,7 @@ class AudienceSelector extends Component {
|
|
|
5511
5404
|
Title: "User Type: ".concat(t.displayName)
|
|
5512
5405
|
};
|
|
5513
5406
|
});
|
|
5514
|
-
|
|
5407
|
+
const userTagTags = tagList.map(t => {
|
|
5515
5408
|
return {
|
|
5516
5409
|
AudienceType: "UserTags",
|
|
5517
5410
|
AudienceTypeSelection: t.Id,
|
|
@@ -5519,17 +5412,17 @@ class AudienceSelector extends Component {
|
|
|
5519
5412
|
Title: "User Tag: ".concat(t.Title)
|
|
5520
5413
|
};
|
|
5521
5414
|
});
|
|
5522
|
-
|
|
5415
|
+
const result = [...categoryTags, ...userTypeTags, ...userTagTags];
|
|
5523
5416
|
return includeSelected ? result : result.filter(t => !_.some(AudienceTagList, at => at.Id === t.Id));
|
|
5524
5417
|
});
|
|
5525
5418
|
_defineProperty(this, "onAttachAudienceTag", tag => {
|
|
5526
|
-
|
|
5419
|
+
const AudienceTagList = [...this.state.AudienceTagList, tag];
|
|
5527
5420
|
this.setState({
|
|
5528
5421
|
AudienceTagList
|
|
5529
5422
|
}, this.onChangeSelection);
|
|
5530
5423
|
});
|
|
5531
5424
|
_defineProperty(this, "onDetachAudienceTag", tag => {
|
|
5532
|
-
|
|
5425
|
+
const AudienceTagList = _.filter(this.state.AudienceTagList, at => at.Id !== tag.Id);
|
|
5533
5426
|
this.setState({
|
|
5534
5427
|
AudienceTagList
|
|
5535
5428
|
}, this.onChangeSelection);
|
|
@@ -5562,7 +5455,7 @@ class AudienceSelector extends Component {
|
|
|
5562
5455
|
};
|
|
5563
5456
|
}
|
|
5564
5457
|
componentDidMount() {
|
|
5565
|
-
|
|
5458
|
+
const {
|
|
5566
5459
|
custom,
|
|
5567
5460
|
disallowSingleUsers,
|
|
5568
5461
|
allowTags
|
|
@@ -5572,7 +5465,7 @@ class AudienceSelector extends Component {
|
|
|
5572
5465
|
if (allowTags || custom) this.getUserTags();
|
|
5573
5466
|
}
|
|
5574
5467
|
componentDidUpdate(prevProps) {
|
|
5575
|
-
|
|
5468
|
+
const newState = {};
|
|
5576
5469
|
if (prevProps.audienceType !== this.props.audienceType) newState.AudienceType = this.props.audienceType;
|
|
5577
5470
|
if (!_.isEqual(prevProps.audienceTypeSelection, this.props.audienceTypeSelection)) newState.AudienceTagList = this.props.audienceTypeSelection;
|
|
5578
5471
|
if (!_.isEmpty(newState)) this.setState(newState);
|
|
@@ -5588,7 +5481,7 @@ class AudienceSelector extends Component {
|
|
|
5588
5481
|
return this.state.AudienceType;
|
|
5589
5482
|
}
|
|
5590
5483
|
getAudienceTypeSelection() {
|
|
5591
|
-
|
|
5484
|
+
const {
|
|
5592
5485
|
AudienceType,
|
|
5593
5486
|
AudienceTagList,
|
|
5594
5487
|
Category,
|
|
@@ -5625,7 +5518,7 @@ class AudienceSelector extends Component {
|
|
|
5625
5518
|
}).catch(error => {});
|
|
5626
5519
|
}
|
|
5627
5520
|
setType(type, selection) {
|
|
5628
|
-
|
|
5521
|
+
const newState = {
|
|
5629
5522
|
AudienceType: type
|
|
5630
5523
|
};
|
|
5631
5524
|
if (type === "Custom") newState.AudienceTagList = selection;
|
|
@@ -5645,7 +5538,7 @@ class AudienceSelector extends Component {
|
|
|
5645
5538
|
setTimeout(this.onChangeSelection, 50);
|
|
5646
5539
|
}
|
|
5647
5540
|
getOptions() {
|
|
5648
|
-
|
|
5541
|
+
const options = [{
|
|
5649
5542
|
Label: "All users",
|
|
5650
5543
|
Value: "All",
|
|
5651
5544
|
onChange: () => this.onChangeOption("All")
|
|
@@ -5687,7 +5580,7 @@ class AudienceSelector extends Component {
|
|
|
5687
5580
|
return options;
|
|
5688
5581
|
}
|
|
5689
5582
|
validateAudienceSelection() {
|
|
5690
|
-
|
|
5583
|
+
const {
|
|
5691
5584
|
AudienceType,
|
|
5692
5585
|
includeList
|
|
5693
5586
|
} = this.state;
|
|
@@ -5707,7 +5600,7 @@ class AudienceSelector extends Component {
|
|
|
5707
5600
|
setTimeout(this.onChangeSelection, 50);
|
|
5708
5601
|
}
|
|
5709
5602
|
getTypeTitle() {
|
|
5710
|
-
|
|
5603
|
+
const typeObject = _.find(this.state.types, t => {
|
|
5711
5604
|
return t.typeName === this.state.Type;
|
|
5712
5605
|
});
|
|
5713
5606
|
if (typeObject) {
|
|
@@ -5716,7 +5609,7 @@ class AudienceSelector extends Component {
|
|
|
5716
5609
|
return "";
|
|
5717
5610
|
}
|
|
5718
5611
|
getTagTitle() {
|
|
5719
|
-
|
|
5612
|
+
const tag = _.find(this.state.tagList, t => {
|
|
5720
5613
|
return t.Id === this.state.Tag;
|
|
5721
5614
|
});
|
|
5722
5615
|
if (tag) {
|
|
@@ -5733,14 +5626,14 @@ class AudienceSelector extends Component {
|
|
|
5733
5626
|
e.Title = e.displayName;
|
|
5734
5627
|
e.Key = e.typeName;
|
|
5735
5628
|
if (e.category) {
|
|
5736
|
-
|
|
5629
|
+
const category = _.find(this.state.categories, c => {
|
|
5737
5630
|
return c.Key === e.category;
|
|
5738
5631
|
});
|
|
5739
|
-
|
|
5632
|
+
const shortName = category ? "(".concat(category.ShortName, ") ") : "";
|
|
5740
5633
|
e.Title = "".concat(shortName, " ").concat(e.Title);
|
|
5741
5634
|
}
|
|
5742
5635
|
});
|
|
5743
|
-
|
|
5636
|
+
const newState = {
|
|
5744
5637
|
types: res.data
|
|
5745
5638
|
};
|
|
5746
5639
|
if (!_.some(res.data, t => t.category === "family")) {
|
|
@@ -5751,25 +5644,25 @@ class AudienceSelector extends Component {
|
|
|
5751
5644
|
}
|
|
5752
5645
|
getUserList() {
|
|
5753
5646
|
if (this.state.AudienceType === "UserType" && !_.isEmpty(this.state.Type)) {
|
|
5754
|
-
|
|
5647
|
+
let users = [];
|
|
5755
5648
|
this.state.userList.forEach(element => {
|
|
5756
5649
|
if (element.type !== this.state.Type) users.push(element);
|
|
5757
5650
|
});
|
|
5758
5651
|
return _.sortBy(users, "displayName");
|
|
5759
5652
|
}
|
|
5760
5653
|
if (this.state.AudienceType === "Category" && !_.isEmpty(this.state.Category)) {
|
|
5761
|
-
|
|
5762
|
-
|
|
5654
|
+
let users = [];
|
|
5655
|
+
let types = _.filter(this.state.types, type => {
|
|
5763
5656
|
return type.category === this.state.Category;
|
|
5764
5657
|
}).map(type => {
|
|
5765
5658
|
return type.typeName;
|
|
5766
5659
|
});
|
|
5767
5660
|
this.state.userList.forEach(element => {
|
|
5768
5661
|
if (types.indexOf(element.type) === -1) {
|
|
5769
|
-
|
|
5662
|
+
users.push(element);
|
|
5770
5663
|
}
|
|
5771
5664
|
});
|
|
5772
|
-
return _.sortBy(
|
|
5665
|
+
return _.sortBy(users, "displayName");
|
|
5773
5666
|
}
|
|
5774
5667
|
return _.sortBy(this.state.userList, "displayName");
|
|
5775
5668
|
}
|
|
@@ -5782,7 +5675,7 @@ class AudienceSelector extends Component {
|
|
|
5782
5675
|
setTimeout(this.onChangeSelection, 50);
|
|
5783
5676
|
}
|
|
5784
5677
|
getCatTitle() {
|
|
5785
|
-
|
|
5678
|
+
const typeObject = _.find(this.state.categories, t => {
|
|
5786
5679
|
return t.Key === this.state.Category;
|
|
5787
5680
|
});
|
|
5788
5681
|
if (typeObject) {
|
|
@@ -5822,30 +5715,30 @@ class AudienceSelector extends Component {
|
|
|
5822
5715
|
}
|
|
5823
5716
|
getUserExcludeList() {
|
|
5824
5717
|
if (this.state.AudienceType === "UserType" && !_.isEmpty(this.state.Type)) {
|
|
5825
|
-
|
|
5718
|
+
let users = [];
|
|
5826
5719
|
this.state.userList.forEach(element => {
|
|
5827
5720
|
if (element.type === this.state.Type) users.push(element);
|
|
5828
5721
|
});
|
|
5829
5722
|
return _.sortBy(users, "displayName");
|
|
5830
5723
|
}
|
|
5831
5724
|
if (this.state.AudienceType === "Category" && !_.isEmpty(this.state.Category)) {
|
|
5832
|
-
|
|
5833
|
-
|
|
5725
|
+
let users = [];
|
|
5726
|
+
let types = _.filter(this.state.types, type => {
|
|
5834
5727
|
return type.category === this.state.Category;
|
|
5835
5728
|
}).map(type => {
|
|
5836
5729
|
return type.typeName;
|
|
5837
5730
|
});
|
|
5838
5731
|
this.state.userList.forEach(element => {
|
|
5839
5732
|
if (types.indexOf(element.type) > -1) {
|
|
5840
|
-
|
|
5733
|
+
users.push(element);
|
|
5841
5734
|
}
|
|
5842
5735
|
});
|
|
5843
|
-
return _.sortBy(
|
|
5736
|
+
return _.sortBy(users, "displayName");
|
|
5844
5737
|
}
|
|
5845
5738
|
return _.sortBy(this.state.userList, "displayName");
|
|
5846
5739
|
}
|
|
5847
5740
|
addToInc(user) {
|
|
5848
|
-
|
|
5741
|
+
let list = [...this.state.includeList];
|
|
5849
5742
|
list.push({
|
|
5850
5743
|
Id: user.Id,
|
|
5851
5744
|
displayName: user.displayName,
|
|
@@ -5865,7 +5758,7 @@ class AudienceSelector extends Component {
|
|
|
5865
5758
|
setTimeout(this.onChangeSelection, 50);
|
|
5866
5759
|
}
|
|
5867
5760
|
addToEx(user) {
|
|
5868
|
-
|
|
5761
|
+
let list = [...this.state.excludeList];
|
|
5869
5762
|
list.push({
|
|
5870
5763
|
Id: user.Id,
|
|
5871
5764
|
displayName: user.displayName,
|
|
@@ -5953,10 +5846,10 @@ class AudienceSelector extends Component {
|
|
|
5953
5846
|
}, "includes");
|
|
5954
5847
|
}
|
|
5955
5848
|
renderAssignedAudiences() {
|
|
5956
|
-
|
|
5849
|
+
const {
|
|
5957
5850
|
AudienceTagList
|
|
5958
5851
|
} = this.state;
|
|
5959
|
-
|
|
5852
|
+
const {
|
|
5960
5853
|
maxWidth
|
|
5961
5854
|
} = this.props;
|
|
5962
5855
|
return /*#__PURE__*/jsxs("div", {
|
|
@@ -5979,10 +5872,10 @@ class AudienceSelector extends Component {
|
|
|
5979
5872
|
});
|
|
5980
5873
|
}
|
|
5981
5874
|
renderAvailableAudiences() {
|
|
5982
|
-
|
|
5875
|
+
const {
|
|
5983
5876
|
maxWidth
|
|
5984
5877
|
} = this.props;
|
|
5985
|
-
|
|
5878
|
+
const tags = this.getAvailableAudienceTags();
|
|
5986
5879
|
return /*#__PURE__*/jsx("div", {
|
|
5987
5880
|
className: "availableAudienceTags",
|
|
5988
5881
|
iconStyle: {
|
|
@@ -6092,7 +5985,7 @@ class AudienceSelector extends Component {
|
|
|
6092
5985
|
});
|
|
6093
5986
|
}
|
|
6094
5987
|
}
|
|
6095
|
-
|
|
5988
|
+
const toExport = connect(null, {
|
|
6096
5989
|
setAuth
|
|
6097
5990
|
}, null, {
|
|
6098
5991
|
forwardRef: true
|
|
@@ -6217,14 +6110,14 @@ class OptionsSection extends Component {
|
|
|
6217
6110
|
return _.find(this.props.options, o => this.props.selected === o.key);
|
|
6218
6111
|
}
|
|
6219
6112
|
getTitle() {
|
|
6220
|
-
|
|
6113
|
+
const selectedOption = this.getSelectedOption();
|
|
6221
6114
|
if (!selectedOption) {
|
|
6222
6115
|
return "";
|
|
6223
6116
|
}
|
|
6224
6117
|
return selectedOption.text;
|
|
6225
6118
|
}
|
|
6226
6119
|
renderOptionButton(o) {
|
|
6227
|
-
|
|
6120
|
+
const isSelected = this.props.selected === o.key;
|
|
6228
6121
|
return /*#__PURE__*/jsxs("div", {
|
|
6229
6122
|
className: "optionsButton".concat(isSelected ? " optionsButton-selected" : ""),
|
|
6230
6123
|
onClick: () => {
|
|
@@ -6244,7 +6137,7 @@ class OptionsSection extends Component {
|
|
|
6244
6137
|
}, o.key);
|
|
6245
6138
|
}
|
|
6246
6139
|
renderContent() {
|
|
6247
|
-
|
|
6140
|
+
const selectedOption = this.getSelectedOption();
|
|
6248
6141
|
if (selectedOption && selectedOption.content) {
|
|
6249
6142
|
return selectedOption.content;
|
|
6250
6143
|
}
|
|
@@ -6311,7 +6204,7 @@ class MakerPopup extends Component {
|
|
|
6311
6204
|
}).Title;
|
|
6312
6205
|
});
|
|
6313
6206
|
_defineProperty(this, "compileData", () => {
|
|
6314
|
-
|
|
6207
|
+
const result = {};
|
|
6315
6208
|
this.props.inputs.forEach(input => {
|
|
6316
6209
|
result[input.key] = this.state[input.key];
|
|
6317
6210
|
});
|
|
@@ -6321,7 +6214,7 @@ class MakerPopup extends Component {
|
|
|
6321
6214
|
return _objectSpread$1(_objectSpread$1({}, result), this.props.requestData);
|
|
6322
6215
|
});
|
|
6323
6216
|
_defineProperty(this, "compileRequestData", () => {
|
|
6324
|
-
|
|
6217
|
+
const result = {};
|
|
6325
6218
|
if (!this.props.hideFormat) {
|
|
6326
6219
|
result.format = this.state.selectedFormat;
|
|
6327
6220
|
}
|
|
@@ -6345,7 +6238,7 @@ class MakerPopup extends Component {
|
|
|
6345
6238
|
if (!this.isReadyToSubmit()) {
|
|
6346
6239
|
return;
|
|
6347
6240
|
}
|
|
6348
|
-
|
|
6241
|
+
const data = this.compileRequestData();
|
|
6349
6242
|
this.setState({
|
|
6350
6243
|
submitting: true
|
|
6351
6244
|
});
|
|
@@ -6547,12 +6440,12 @@ class MakerPopup extends Component {
|
|
|
6547
6440
|
});
|
|
6548
6441
|
}
|
|
6549
6442
|
}
|
|
6550
|
-
|
|
6443
|
+
const mapStateToProps = state => {
|
|
6551
6444
|
return {
|
|
6552
6445
|
auth: state.auth
|
|
6553
6446
|
};
|
|
6554
6447
|
};
|
|
6555
|
-
|
|
6448
|
+
let exportObj = connect(mapStateToProps, {})(MakerPopup);
|
|
6556
6449
|
|
|
6557
6450
|
class ExportCsvPopup extends Component {
|
|
6558
6451
|
constructor(props) {
|
|
@@ -6567,12 +6460,12 @@ class ExportCsvPopup extends Component {
|
|
|
6567
6460
|
if (this.props.onClose) this.props.onClose();
|
|
6568
6461
|
});
|
|
6569
6462
|
_defineProperty(this, "onToggleColumn", key => {
|
|
6570
|
-
|
|
6571
|
-
|
|
6463
|
+
const columns = _.cloneDeep(this.state.columns);
|
|
6464
|
+
const column = columns.find(c => c.key === key);
|
|
6572
6465
|
if (column) {
|
|
6573
6466
|
column.selected = !column.selected;
|
|
6574
6467
|
if (!column.key) columns.map(c => c.selected = column.selected); // Toggle all
|
|
6575
|
-
|
|
6468
|
+
const selectedHeaders = columns.filter(c => c.key && c.selected);
|
|
6576
6469
|
this.setState({
|
|
6577
6470
|
columns,
|
|
6578
6471
|
selectedHeaders
|
|
@@ -6580,7 +6473,7 @@ class ExportCsvPopup extends Component {
|
|
|
6580
6473
|
}
|
|
6581
6474
|
});
|
|
6582
6475
|
_defineProperty(this, "onToggleStartDateFilter", () => {
|
|
6583
|
-
|
|
6476
|
+
const {
|
|
6584
6477
|
filterDateStartVisible
|
|
6585
6478
|
} = this.state;
|
|
6586
6479
|
if (filterDateStartVisible) {
|
|
@@ -6594,7 +6487,7 @@ class ExportCsvPopup extends Component {
|
|
|
6594
6487
|
}
|
|
6595
6488
|
});
|
|
6596
6489
|
_defineProperty(this, "onToggleEndDateFilter", () => {
|
|
6597
|
-
|
|
6490
|
+
const {
|
|
6598
6491
|
filterDateEndVisible
|
|
6599
6492
|
} = this.state;
|
|
6600
6493
|
if (filterDateEndVisible) {
|
|
@@ -6608,10 +6501,10 @@ class ExportCsvPopup extends Component {
|
|
|
6608
6501
|
}
|
|
6609
6502
|
});
|
|
6610
6503
|
_defineProperty(this, "onDateFilterStartChanged", date => {
|
|
6611
|
-
|
|
6504
|
+
const {
|
|
6612
6505
|
filterDateEnd
|
|
6613
6506
|
} = this.state;
|
|
6614
|
-
|
|
6507
|
+
const start = moment(date);
|
|
6615
6508
|
if (start.isSameOrBefore(filterDateEnd)) {
|
|
6616
6509
|
this.setState({
|
|
6617
6510
|
filterDateStart: start.startOf("day"),
|
|
@@ -6620,10 +6513,10 @@ class ExportCsvPopup extends Component {
|
|
|
6620
6513
|
}
|
|
6621
6514
|
});
|
|
6622
6515
|
_defineProperty(this, "onDateFilterEndChanged", date => {
|
|
6623
|
-
|
|
6516
|
+
const {
|
|
6624
6517
|
filterDateStart
|
|
6625
6518
|
} = this.state;
|
|
6626
|
-
|
|
6519
|
+
const end = moment(date);
|
|
6627
6520
|
if (end.isSameOrAfter(filterDateStart)) {
|
|
6628
6521
|
this.setState({
|
|
6629
6522
|
filterDateEnd: end.endOf("day"),
|
|
@@ -6632,32 +6525,32 @@ class ExportCsvPopup extends Component {
|
|
|
6632
6525
|
}
|
|
6633
6526
|
});
|
|
6634
6527
|
_defineProperty(this, "getSelectedSource", () => {
|
|
6635
|
-
|
|
6528
|
+
const {
|
|
6636
6529
|
source
|
|
6637
6530
|
} = this.props;
|
|
6638
|
-
|
|
6531
|
+
const {
|
|
6639
6532
|
selectedHeaders
|
|
6640
6533
|
} = this.state;
|
|
6641
|
-
|
|
6534
|
+
let result = source;
|
|
6642
6535
|
|
|
6643
6536
|
// apply timestamp filter
|
|
6644
6537
|
if (this.props.timestampFilter) {
|
|
6645
|
-
|
|
6538
|
+
const {
|
|
6646
6539
|
filterDateStart,
|
|
6647
6540
|
filterDateEnd
|
|
6648
6541
|
} = this.state;
|
|
6649
|
-
|
|
6542
|
+
const {
|
|
6650
6543
|
filterKey
|
|
6651
6544
|
} = this.props.timestampFilter;
|
|
6652
|
-
|
|
6653
|
-
|
|
6545
|
+
const minDate = filterDateStart.valueOf();
|
|
6546
|
+
const maxDate = filterDateEnd.valueOf();
|
|
6654
6547
|
result = _.filter(source, item => {
|
|
6655
6548
|
return item[filterKey] >= minDate && item[filterKey] <= maxDate;
|
|
6656
6549
|
});
|
|
6657
6550
|
}
|
|
6658
6551
|
|
|
6659
6552
|
// map result to columns
|
|
6660
|
-
|
|
6553
|
+
const selectedheaderKeys = selectedHeaders.map(h => h.key);
|
|
6661
6554
|
return result.map(i => _.pick(i, selectedheaderKeys));
|
|
6662
6555
|
});
|
|
6663
6556
|
_defineProperty(this, "renderTimestampFilter", () => {
|
|
@@ -6693,7 +6586,7 @@ class ExportCsvPopup extends Component {
|
|
|
6693
6586
|
});
|
|
6694
6587
|
});
|
|
6695
6588
|
_defineProperty(this, "renderContent", () => {
|
|
6696
|
-
|
|
6589
|
+
const {
|
|
6697
6590
|
saving,
|
|
6698
6591
|
columns
|
|
6699
6592
|
} = this.state;
|
|
@@ -6729,7 +6622,7 @@ class ExportCsvPopup extends Component {
|
|
|
6729
6622
|
})
|
|
6730
6623
|
});
|
|
6731
6624
|
});
|
|
6732
|
-
|
|
6625
|
+
const state = {
|
|
6733
6626
|
columns: props.columns,
|
|
6734
6627
|
selectedHeaders: props.columns.filter(c => c.key && c.selected),
|
|
6735
6628
|
selectedSource: [],
|
|
@@ -6742,13 +6635,13 @@ class ExportCsvPopup extends Component {
|
|
|
6742
6635
|
this.state = state;
|
|
6743
6636
|
}
|
|
6744
6637
|
render() {
|
|
6745
|
-
|
|
6638
|
+
const {
|
|
6746
6639
|
selectedHeaders
|
|
6747
6640
|
} = this.state;
|
|
6748
|
-
|
|
6641
|
+
const {
|
|
6749
6642
|
filename
|
|
6750
6643
|
} = this.props;
|
|
6751
|
-
|
|
6644
|
+
const buttons = [{
|
|
6752
6645
|
type: "primary",
|
|
6753
6646
|
isActive: this.canSave(),
|
|
6754
6647
|
text: /*#__PURE__*/jsx(CSVLink, {
|
|
@@ -6787,11 +6680,11 @@ class ExportCsvPopup extends Component {
|
|
|
6787
6680
|
}
|
|
6788
6681
|
}
|
|
6789
6682
|
|
|
6790
|
-
|
|
6683
|
+
const _excluded = ["id", "label", "help", "showError", "required"];
|
|
6791
6684
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6792
6685
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6793
6686
|
function InputGroup(_ref) {
|
|
6794
|
-
|
|
6687
|
+
let {
|
|
6795
6688
|
id,
|
|
6796
6689
|
label,
|
|
6797
6690
|
help,
|
|
@@ -6826,7 +6719,7 @@ class Tabs extends Component {
|
|
|
6826
6719
|
};
|
|
6827
6720
|
}
|
|
6828
6721
|
getTabClass(tab) {
|
|
6829
|
-
|
|
6722
|
+
let classes = "tab";
|
|
6830
6723
|
if (this.props.selectedTab === tab.value) {
|
|
6831
6724
|
classes += " tab-selected";
|
|
6832
6725
|
}
|
|
@@ -6868,7 +6761,7 @@ class ColourOptions extends Component {
|
|
|
6868
6761
|
constructor(props) {
|
|
6869
6762
|
super(props);
|
|
6870
6763
|
_defineProperty(this, "setColourCircle", () => {
|
|
6871
|
-
|
|
6764
|
+
const tc = tinycolor(this.state.colour);
|
|
6872
6765
|
this.setState({
|
|
6873
6766
|
colourCircleTop: 100 - 100 * tc.getBrightness() / 255,
|
|
6874
6767
|
colourCircleLeft: 100 * tc.toHsv().h / 360
|
|
@@ -6876,13 +6769,13 @@ class ColourOptions extends Component {
|
|
|
6876
6769
|
});
|
|
6877
6770
|
_defineProperty(this, "onColourChange", color => {
|
|
6878
6771
|
// console.log('onColourChange', color);
|
|
6879
|
-
|
|
6772
|
+
const colour = (typeof color === "object" ? color.hex : color).toUpperCase();
|
|
6880
6773
|
this.setState({
|
|
6881
6774
|
selectedColour: colour,
|
|
6882
6775
|
colour
|
|
6883
6776
|
}, () => {
|
|
6884
6777
|
this.setColourCircle();
|
|
6885
|
-
|
|
6778
|
+
const {
|
|
6886
6779
|
onColourSelected
|
|
6887
6780
|
} = this.props;
|
|
6888
6781
|
if (onColourSelected) onColourSelected(this.state.colour);
|
|
@@ -6906,7 +6799,7 @@ class ColourOptions extends Component {
|
|
|
6906
6799
|
}
|
|
6907
6800
|
componentDidUpdate(prevProps) {
|
|
6908
6801
|
if (this.props.value !== prevProps.value) {
|
|
6909
|
-
|
|
6802
|
+
const {
|
|
6910
6803
|
value
|
|
6911
6804
|
} = this.props;
|
|
6912
6805
|
this.setState({
|
|
@@ -6916,11 +6809,11 @@ class ColourOptions extends Component {
|
|
|
6916
6809
|
}
|
|
6917
6810
|
}
|
|
6918
6811
|
getQuickChoiceTabs() {
|
|
6919
|
-
|
|
6812
|
+
const {
|
|
6920
6813
|
options
|
|
6921
6814
|
} = this.props;
|
|
6922
|
-
|
|
6923
|
-
|
|
6815
|
+
const optionsArray = typeof options === "string" ? options.split(",").map(o => o.trim()) : options;
|
|
6816
|
+
const available = [{
|
|
6924
6817
|
value: "vibrant",
|
|
6925
6818
|
text: "Vibrant"
|
|
6926
6819
|
}, {
|
|
@@ -6933,7 +6826,7 @@ class ColourOptions extends Component {
|
|
|
6933
6826
|
return !optionsArray || optionsArray.length === 0 ? available : available.filter(o => optionsArray.includes(o.value));
|
|
6934
6827
|
}
|
|
6935
6828
|
renderColourQuickChoicesCircle(colour, selectedColour) {
|
|
6936
|
-
|
|
6829
|
+
const isSelected = selectedColour.toLowerCase() === colour.toLowerCase();
|
|
6937
6830
|
return /*#__PURE__*/jsx("div", {
|
|
6938
6831
|
className: "colourQuickChoices_circle".concat(isSelected ? " colourQuickChoices_circle-selected" : ""),
|
|
6939
6832
|
style: {
|
|
@@ -6947,11 +6840,11 @@ class ColourOptions extends Component {
|
|
|
6947
6840
|
});
|
|
6948
6841
|
}
|
|
6949
6842
|
renderColourOptions() {
|
|
6950
|
-
|
|
6843
|
+
const {
|
|
6951
6844
|
selectedColour,
|
|
6952
6845
|
selectedOption
|
|
6953
6846
|
} = this.state;
|
|
6954
|
-
|
|
6847
|
+
let content;
|
|
6955
6848
|
switch (selectedOption) {
|
|
6956
6849
|
case "picker":
|
|
6957
6850
|
content = /*#__PURE__*/jsx("div", {
|
|
@@ -7019,7 +6912,7 @@ class ColourOptions extends Component {
|
|
|
7019
6912
|
content = null;
|
|
7020
6913
|
break;
|
|
7021
6914
|
}
|
|
7022
|
-
|
|
6915
|
+
const tabs = this.getQuickChoiceTabs();
|
|
7023
6916
|
return /*#__PURE__*/jsxs("div", {
|
|
7024
6917
|
children: [tabs && tabs.length > 1 ? /*#__PURE__*/jsx(Tabs, {
|
|
7025
6918
|
onSelectTab: this.onSelectOption,
|
|
@@ -7046,7 +6939,7 @@ class ColourPicker extends Component {
|
|
|
7046
6939
|
constructor(props) {
|
|
7047
6940
|
super(props);
|
|
7048
6941
|
_defineProperty(this, "setColourCircle", () => {
|
|
7049
|
-
|
|
6942
|
+
const tc = tinycolor(this.state.colour);
|
|
7050
6943
|
this.setState({
|
|
7051
6944
|
colourCircleTop: 100 - 100 * tc.getBrightness() / 255,
|
|
7052
6945
|
colourCircleLeft: 100 * tc.toHsv().h / 360
|
|
@@ -7060,7 +6953,7 @@ class ColourPicker extends Component {
|
|
|
7060
6953
|
});
|
|
7061
6954
|
_defineProperty(this, "onColourChange", color => {
|
|
7062
6955
|
// console.log('onColourChange', color);
|
|
7063
|
-
|
|
6956
|
+
let colour = color;
|
|
7064
6957
|
if (typeof color === "object") {
|
|
7065
6958
|
colour = color.hex;
|
|
7066
6959
|
}
|
|
@@ -7074,7 +6967,7 @@ class ColourPicker extends Component {
|
|
|
7074
6967
|
});
|
|
7075
6968
|
});
|
|
7076
6969
|
_defineProperty(this, "onDone", () => {
|
|
7077
|
-
|
|
6970
|
+
const {
|
|
7078
6971
|
colourPickerOpen,
|
|
7079
6972
|
selectedColour
|
|
7080
6973
|
} = this.state;
|
|
@@ -7083,14 +6976,14 @@ class ColourPicker extends Component {
|
|
|
7083
6976
|
colour: selectedColour
|
|
7084
6977
|
}, () => {
|
|
7085
6978
|
this.setColourCircle();
|
|
7086
|
-
|
|
6979
|
+
const {
|
|
7087
6980
|
onColourSelected
|
|
7088
6981
|
} = this.props;
|
|
7089
6982
|
if (onColourSelected) onColourSelected(this.state.colour);
|
|
7090
6983
|
});
|
|
7091
6984
|
});
|
|
7092
6985
|
_defineProperty(this, "onCancel", () => {
|
|
7093
|
-
|
|
6986
|
+
const {
|
|
7094
6987
|
colourPickerOpen,
|
|
7095
6988
|
colour
|
|
7096
6989
|
} = this.state;
|
|
@@ -7113,7 +7006,7 @@ class ColourPicker extends Component {
|
|
|
7113
7006
|
}
|
|
7114
7007
|
componentDidUpdate(prevProps) {
|
|
7115
7008
|
if (this.props.value !== prevProps.value) {
|
|
7116
|
-
|
|
7009
|
+
const {
|
|
7117
7010
|
value
|
|
7118
7011
|
} = this.props;
|
|
7119
7012
|
this.setState({
|
|
@@ -7123,11 +7016,11 @@ class ColourPicker extends Component {
|
|
|
7123
7016
|
}
|
|
7124
7017
|
}
|
|
7125
7018
|
getQuickChoiceTabs() {
|
|
7126
|
-
|
|
7019
|
+
const {
|
|
7127
7020
|
options
|
|
7128
7021
|
} = this.props;
|
|
7129
|
-
|
|
7130
|
-
|
|
7022
|
+
const optionsArray = typeof options === "string" ? options.split(",").map(o => o.trim()) : options;
|
|
7023
|
+
const available = [{
|
|
7131
7024
|
value: "vibrant",
|
|
7132
7025
|
text: "Vibrant"
|
|
7133
7026
|
}, {
|
|
@@ -7140,7 +7033,7 @@ class ColourPicker extends Component {
|
|
|
7140
7033
|
return !optionsArray || optionsArray.length === 0 ? available : available.filter(o => optionsArray.includes(o.value));
|
|
7141
7034
|
}
|
|
7142
7035
|
renderColourQuickChoicesCircle(colour, selectedColour) {
|
|
7143
|
-
|
|
7036
|
+
const isSelected = selectedColour.toLowerCase() === colour.toLowerCase();
|
|
7144
7037
|
return /*#__PURE__*/jsx("div", {
|
|
7145
7038
|
className: "colourQuickChoices_circle".concat(isSelected ? " colourQuickChoices_circle-selected" : ""),
|
|
7146
7039
|
style: {
|
|
@@ -7154,11 +7047,11 @@ class ColourPicker extends Component {
|
|
|
7154
7047
|
});
|
|
7155
7048
|
}
|
|
7156
7049
|
renderColourOptions() {
|
|
7157
|
-
|
|
7050
|
+
const {
|
|
7158
7051
|
selectedColour,
|
|
7159
7052
|
selectedOption
|
|
7160
7053
|
} = this.state;
|
|
7161
|
-
|
|
7054
|
+
let content;
|
|
7162
7055
|
switch (selectedOption) {
|
|
7163
7056
|
case "picker":
|
|
7164
7057
|
content = /*#__PURE__*/jsx("div", {
|
|
@@ -7226,7 +7119,7 @@ class ColourPicker extends Component {
|
|
|
7226
7119
|
content = null;
|
|
7227
7120
|
break;
|
|
7228
7121
|
}
|
|
7229
|
-
|
|
7122
|
+
const tabs = this.getQuickChoiceTabs();
|
|
7230
7123
|
return /*#__PURE__*/jsxs("div", {
|
|
7231
7124
|
children: [tabs && tabs.length > 1 ? /*#__PURE__*/jsx(Tabs, {
|
|
7232
7125
|
onSelectTab: this.onSelectOption,
|
|
@@ -7239,11 +7132,11 @@ class ColourPicker extends Component {
|
|
|
7239
7132
|
});
|
|
7240
7133
|
}
|
|
7241
7134
|
renderColourPopup() {
|
|
7242
|
-
|
|
7135
|
+
const {
|
|
7243
7136
|
colourPickerOpen
|
|
7244
7137
|
} = this.state;
|
|
7245
7138
|
if (!colourPickerOpen) return null;
|
|
7246
|
-
|
|
7139
|
+
const {
|
|
7247
7140
|
title
|
|
7248
7141
|
} = this.props;
|
|
7249
7142
|
return /*#__PURE__*/jsx(Popup, {
|
|
@@ -7271,12 +7164,12 @@ class ColourPicker extends Component {
|
|
|
7271
7164
|
});
|
|
7272
7165
|
}
|
|
7273
7166
|
render() {
|
|
7274
|
-
|
|
7167
|
+
const {
|
|
7275
7168
|
colourCircleTop,
|
|
7276
7169
|
colourCircleLeft,
|
|
7277
7170
|
colour
|
|
7278
7171
|
} = this.state;
|
|
7279
|
-
|
|
7172
|
+
const {
|
|
7280
7173
|
children,
|
|
7281
7174
|
showHex
|
|
7282
7175
|
} = this.props;
|
|
@@ -7312,10 +7205,10 @@ class ColourPicker extends Component {
|
|
|
7312
7205
|
}
|
|
7313
7206
|
}
|
|
7314
7207
|
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7208
|
+
const BAR_HEIGHT = 48;
|
|
7209
|
+
const CHART_PADDING = 10;
|
|
7210
|
+
const BarLabel = _ref => {
|
|
7211
|
+
let {
|
|
7319
7212
|
x,
|
|
7320
7213
|
y,
|
|
7321
7214
|
width,
|
|
@@ -7333,8 +7226,8 @@ var BarLabel = _ref => {
|
|
|
7333
7226
|
children: value
|
|
7334
7227
|
});
|
|
7335
7228
|
};
|
|
7336
|
-
|
|
7337
|
-
|
|
7229
|
+
const ComparisonStatBox = _ref2 => {
|
|
7230
|
+
let {
|
|
7338
7231
|
title,
|
|
7339
7232
|
data,
|
|
7340
7233
|
prevText,
|
|
@@ -7343,19 +7236,19 @@ var ComparisonStatBox = _ref2 => {
|
|
|
7343
7236
|
borderless,
|
|
7344
7237
|
hideTotal
|
|
7345
7238
|
} = _ref2;
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7239
|
+
const total = data.reduce((sum, d) => sum + (d.value || 0), 0);
|
|
7240
|
+
const chartHeight = data.length * BAR_HEIGHT + CHART_PADDING;
|
|
7241
|
+
const maxLabelLength = data.reduce((max, d) => Math.max(max, d.name.length), 0);
|
|
7242
|
+
const yAxisWidth = Math.min(Math.max(maxLabelLength * 7, 80), 160);
|
|
7243
|
+
const opacity = isLoading ? 0.3 : 1;
|
|
7244
|
+
const wrapperStyle = borderless ? {
|
|
7352
7245
|
opacity,
|
|
7353
7246
|
padding: "12px 0"
|
|
7354
7247
|
} : {
|
|
7355
7248
|
opacity,
|
|
7356
7249
|
padding: 20
|
|
7357
7250
|
};
|
|
7358
|
-
|
|
7251
|
+
const wrapperClass = borderless ? "" : "dashboardBox";
|
|
7359
7252
|
return /*#__PURE__*/jsxs("div", {
|
|
7360
7253
|
className: wrapperClass,
|
|
7361
7254
|
style: wrapperStyle,
|
|
@@ -7454,8 +7347,8 @@ var ComparisonStatBox = _ref2 => {
|
|
|
7454
7347
|
});
|
|
7455
7348
|
};
|
|
7456
7349
|
|
|
7457
|
-
|
|
7458
|
-
|
|
7350
|
+
const StatBox = _ref => {
|
|
7351
|
+
let {
|
|
7459
7352
|
title,
|
|
7460
7353
|
icon,
|
|
7461
7354
|
value,
|
|
@@ -7464,7 +7357,7 @@ var StatBox = _ref => {
|
|
|
7464
7357
|
viewGraphLink,
|
|
7465
7358
|
isLoading
|
|
7466
7359
|
} = _ref;
|
|
7467
|
-
|
|
7360
|
+
let change = (value / previousValue - 1) * 100;
|
|
7468
7361
|
if (isNaN(change)) {
|
|
7469
7362
|
change = 0;
|
|
7470
7363
|
}
|
|
@@ -7472,7 +7365,7 @@ var StatBox = _ref => {
|
|
|
7472
7365
|
change = 100;
|
|
7473
7366
|
}
|
|
7474
7367
|
change = parseInt(change);
|
|
7475
|
-
|
|
7368
|
+
const opacity = isLoading ? 0 : 1;
|
|
7476
7369
|
return /*#__PURE__*/jsxs("div", {
|
|
7477
7370
|
className: "dashboardBox dashboardBox-stats dashboardBox-inline".concat(change > 0 ? " dashboardBox-stats-positive" : "").concat(change < 0 ? " dashboardBox-stats-negative" : ""),
|
|
7478
7371
|
children: [/*#__PURE__*/jsx("div", {
|