@plusscommunities/pluss-core-web 1.8.6-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 +697 -746
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
2
1
|
import _ from 'lodash';
|
|
3
2
|
import axios from 'axios';
|
|
4
3
|
import { Auth, Storage } from 'aws-amplify';
|
|
@@ -22,7 +21,7 @@ import tinycolor from 'tinycolor2';
|
|
|
22
21
|
import { Link } from 'react-router-dom';
|
|
23
22
|
import { ResponsiveContainer, BarChart, XAxis, YAxis, Tooltip, Bar, Cell } from 'recharts';
|
|
24
23
|
|
|
25
|
-
|
|
24
|
+
const CoreConfig = {
|
|
26
25
|
env: {
|
|
27
26
|
baseStage: "",
|
|
28
27
|
baseAPIUrl: "",
|
|
@@ -46,74 +45,54 @@ var CoreConfig = {
|
|
|
46
45
|
}
|
|
47
46
|
};
|
|
48
47
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
});
|
|
56
|
-
return function getSessionTokenAWS(_x) {
|
|
57
|
-
return _ref.apply(this, arguments);
|
|
58
|
-
};
|
|
59
|
-
}();
|
|
48
|
+
const getSessionTokenAWS = async prefix => {
|
|
49
|
+
const data = await Auth.currentSession();
|
|
50
|
+
const token = data.getAccessToken().getJwtToken();
|
|
51
|
+
if (_.isUndefined(prefix)) return token;
|
|
52
|
+
return "".concat(prefix, " ").concat(token);
|
|
53
|
+
};
|
|
60
54
|
|
|
61
55
|
// export const getRefreshTokenAWS = async () => {
|
|
62
56
|
// const data = await Auth.currentSession();
|
|
63
57
|
// return data.getRefreshToken().token;
|
|
64
58
|
// };
|
|
65
59
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return function authedFunction(_x2) {
|
|
79
|
-
return _ref2.apply(this, arguments);
|
|
80
|
-
};
|
|
81
|
-
}();
|
|
82
|
-
var unauthedFunction = request => {
|
|
60
|
+
const authedFunction = async request => {
|
|
61
|
+
try {
|
|
62
|
+
const authkey = await getSessionTokenAWS();
|
|
63
|
+
if (!request.headers) request.headers = {};
|
|
64
|
+
request.headers.authkey = authkey;
|
|
65
|
+
return await axios(request);
|
|
66
|
+
} catch (error) {
|
|
67
|
+
console.error("authedFunction error", error, request);
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const unauthedFunction = request => {
|
|
83
72
|
return axios(request);
|
|
84
73
|
};
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
74
|
+
const getCurrentUserSub = async () => {
|
|
75
|
+
try {
|
|
76
|
+
const user = await Auth.currentUserInfo();
|
|
77
|
+
return user.id;
|
|
78
|
+
} catch (error) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
const checkLoggedIn = async self => {
|
|
83
|
+
try {
|
|
84
|
+
const user = await Auth.currentAuthenticatedUser();
|
|
85
|
+
if (_.isUndefined(user) || user == null || user.username == null) {
|
|
86
|
+
console.log("redirecting to login");
|
|
87
|
+
self.props.history.push("/login");
|
|
92
88
|
}
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}();
|
|
98
|
-
var checkLoggedIn = /*#__PURE__*/function () {
|
|
99
|
-
var _ref4 = _asyncToGenerator(function* (self) {
|
|
100
|
-
try {
|
|
101
|
-
var user = yield Auth.currentAuthenticatedUser();
|
|
102
|
-
if (_.isUndefined(user) || user == null || user.username == null) {
|
|
103
|
-
console.log("redirecting to login");
|
|
104
|
-
self.props.history.push("/login");
|
|
105
|
-
}
|
|
106
|
-
} catch (error) {
|
|
107
|
-
if (error === "not authenticated") {
|
|
108
|
-
console.log("redirecting to logout");
|
|
109
|
-
self.props.history.push("/logout");
|
|
110
|
-
}
|
|
89
|
+
} catch (error) {
|
|
90
|
+
if (error === "not authenticated") {
|
|
91
|
+
console.log("redirecting to logout");
|
|
92
|
+
self.props.history.push("/logout");
|
|
111
93
|
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return _ref4.apply(this, arguments);
|
|
115
|
-
};
|
|
116
|
-
}();
|
|
94
|
+
}
|
|
95
|
+
};
|
|
117
96
|
|
|
118
97
|
// export const checkLogInScreen = (self, auth) => {
|
|
119
98
|
// if (auth.auth) {
|
|
@@ -148,7 +127,7 @@ var checkLoggedIn = /*#__PURE__*/function () {
|
|
|
148
127
|
// });
|
|
149
128
|
// };
|
|
150
129
|
|
|
151
|
-
|
|
130
|
+
const isTheBest = (auth, isPlussSpaceMaster) => {
|
|
152
131
|
if (auth && auth.user) {
|
|
153
132
|
if (isPlussSpaceMaster) {
|
|
154
133
|
// only plussSpace master
|
|
@@ -203,22 +182,22 @@ var isTheBest = (auth, isPlussSpaceMaster) => {
|
|
|
203
182
|
// return userType;
|
|
204
183
|
// };
|
|
205
184
|
|
|
206
|
-
|
|
207
|
-
|
|
185
|
+
const validateAccess = (site, type, auth, noRole) => {
|
|
186
|
+
const roles = auth && auth.user ? auth.user.Roles : [];
|
|
208
187
|
if (_.isEmpty(roles)) return noRole;
|
|
209
188
|
if (site === "plussSpace" && type === "master") {
|
|
210
189
|
return _.some(roles, r => r.site === "plussSpace" && r.type === "master");
|
|
211
190
|
}
|
|
212
191
|
if (_.some(roles, r => r.type === "master")) return true;
|
|
213
|
-
|
|
192
|
+
const role = _.find(roles, r => r.site === site);
|
|
214
193
|
if (!role) return false;
|
|
215
194
|
if (type === "any") return true;
|
|
216
195
|
return !_.isEmpty(role.Permissions) && _.includes(role.Permissions, type);
|
|
217
196
|
};
|
|
218
|
-
|
|
197
|
+
const getApiError = error => {
|
|
219
198
|
try {
|
|
220
|
-
|
|
221
|
-
|
|
199
|
+
const errorData = error.response.data;
|
|
200
|
+
const errorMessage = errorData && errorData.error;
|
|
222
201
|
return errorMessage || errorData || error;
|
|
223
202
|
} catch (e) {
|
|
224
203
|
return error;
|
|
@@ -334,7 +313,7 @@ var getApiError = error => {
|
|
|
334
313
|
// }
|
|
335
314
|
// };
|
|
336
315
|
|
|
337
|
-
|
|
316
|
+
const isTVEnabled = (interfaces, feature) => {
|
|
338
317
|
return _.some(interfaces, t => {
|
|
339
318
|
return t.Type === "TV" && (!feature || _.some(t.Settings.widgets, f => {
|
|
340
319
|
return f.key === feature;
|
|
@@ -363,7 +342,7 @@ var session = /*#__PURE__*/Object.freeze({
|
|
|
363
342
|
// 3. A curated palette guarantees contrast and visual distinctiveness.
|
|
364
343
|
// Future enhancement: use site branding colours with collision fallback to this palette.
|
|
365
344
|
// Wraps around via modulo for 10+ sites (unlikely in practice).
|
|
366
|
-
|
|
345
|
+
const SITE_COLOURS = ["#5e9efc",
|
|
367
346
|
// Blue
|
|
368
347
|
"#49bdbb",
|
|
369
348
|
// Teal
|
|
@@ -383,35 +362,25 @@ var SITE_COLOURS = ["#5e9efc",
|
|
|
383
362
|
// Grapefruit
|
|
384
363
|
"#536280" // Dusk
|
|
385
364
|
];
|
|
386
|
-
|
|
365
|
+
const getSiteColour = index => {
|
|
387
366
|
return SITE_COLOURS[index % SITE_COLOURS.length];
|
|
388
367
|
};
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
results[site] = null;
|
|
400
|
-
}
|
|
401
|
-
});
|
|
402
|
-
return function (_x3) {
|
|
403
|
-
return _ref2.apply(this, arguments);
|
|
404
|
-
};
|
|
405
|
-
}());
|
|
406
|
-
yield Promise.all(promises);
|
|
407
|
-
return results;
|
|
368
|
+
const fetchMultiSiteData = async (sites, fetchFn) => {
|
|
369
|
+
const results = {};
|
|
370
|
+
const promises = sites.map(async site => {
|
|
371
|
+
try {
|
|
372
|
+
const data = await fetchFn(site);
|
|
373
|
+
results[site] = data;
|
|
374
|
+
} catch (error) {
|
|
375
|
+
console.log("fetchMultiSiteData failed for site ".concat(site, ":"), error);
|
|
376
|
+
results[site] = null;
|
|
377
|
+
}
|
|
408
378
|
});
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
var totalStats = {};
|
|
379
|
+
await Promise.all(promises);
|
|
380
|
+
return results;
|
|
381
|
+
};
|
|
382
|
+
const compileStats = stats => {
|
|
383
|
+
const totalStats = {};
|
|
415
384
|
Object.keys(stats).forEach(id => {
|
|
416
385
|
Object.keys(stats[id]).forEach(activityId => {
|
|
417
386
|
if (Array.isArray(stats[id][activityId])) {
|
|
@@ -430,15 +399,15 @@ var compileStats = stats => {
|
|
|
430
399
|
});
|
|
431
400
|
return totalStats;
|
|
432
401
|
};
|
|
433
|
-
|
|
434
|
-
|
|
402
|
+
const getInsight = (stats, previousStats, source, key, activity) => {
|
|
403
|
+
let top = {
|
|
435
404
|
Stats: {
|
|
436
405
|
[activity]: 0
|
|
437
406
|
}
|
|
438
407
|
};
|
|
439
408
|
Object.keys(stats).forEach(entityId => {
|
|
440
409
|
if (stats[entityId][activity] && stats[entityId][activity] > top.Stats[activity]) {
|
|
441
|
-
|
|
410
|
+
const entity = _.find(source, s => {
|
|
442
411
|
return s[key] === entityId;
|
|
443
412
|
});
|
|
444
413
|
if (entity) {
|
|
@@ -457,7 +426,7 @@ var getInsight = (stats, previousStats, source, key, activity) => {
|
|
|
457
426
|
}
|
|
458
427
|
return top;
|
|
459
428
|
};
|
|
460
|
-
|
|
429
|
+
const getAnalyticsFilterOptions = () => {
|
|
461
430
|
return [{
|
|
462
431
|
text: "Yesterday",
|
|
463
432
|
dayCount: 1,
|
|
@@ -488,13 +457,13 @@ var getAnalyticsFilterOptions = () => {
|
|
|
488
457
|
prevText: "previous * days"
|
|
489
458
|
}];
|
|
490
459
|
};
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
460
|
+
const countActivities = (data, activityKey, countType) => {
|
|
461
|
+
let count = 0;
|
|
462
|
+
let set = new Set();
|
|
494
463
|
data.forEach(entry => {
|
|
495
|
-
|
|
496
|
-
for (
|
|
497
|
-
|
|
464
|
+
const stats = entry.Stats;
|
|
465
|
+
for (const entity in stats) {
|
|
466
|
+
const entityStats = stats[entity];
|
|
498
467
|
switch (countType) {
|
|
499
468
|
case "unique":
|
|
500
469
|
if (entityStats[activityKey]) {
|
|
@@ -526,13 +495,13 @@ var countActivities = (data, activityKey, countType) => {
|
|
|
526
495
|
return 0;
|
|
527
496
|
}
|
|
528
497
|
};
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
498
|
+
const generateDateRangeObjects = function (startTime, endTime) {
|
|
499
|
+
let groupBy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "day";
|
|
500
|
+
const startDate = moment(startTime);
|
|
501
|
+
const endDate = moment(endTime);
|
|
502
|
+
const dates = {};
|
|
534
503
|
while (startDate.isSameOrBefore(endDate)) {
|
|
535
|
-
|
|
504
|
+
const dateString = startDate.format("DD-MM-YYYY");
|
|
536
505
|
dates[dateString] = {
|
|
537
506
|
Date: dateString,
|
|
538
507
|
Timestamp: startDate.valueOf(),
|
|
@@ -542,12 +511,12 @@ var generateDateRangeObjects = function generateDateRangeObjects(startTime, endT
|
|
|
542
511
|
}
|
|
543
512
|
return dates;
|
|
544
513
|
};
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
514
|
+
const generateDateActivities = function (data, activityKey, countType, startTime, endTime) {
|
|
515
|
+
let groupBy = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : "day";
|
|
516
|
+
const dates = generateDateRangeObjects(startTime, endTime, groupBy);
|
|
517
|
+
const result = [];
|
|
518
|
+
let formatToUse = "DD-MM-YYYY";
|
|
519
|
+
let labelFormat = "D MMM";
|
|
551
520
|
switch (groupBy) {
|
|
552
521
|
case "month":
|
|
553
522
|
formatToUse = "MM-YYYY";
|
|
@@ -559,10 +528,10 @@ var generateDateActivities = function generateDateActivities(data, activityKey,
|
|
|
559
528
|
break;
|
|
560
529
|
}
|
|
561
530
|
Object.keys(dates).forEach(d => {
|
|
562
|
-
|
|
531
|
+
const datesToUse = _.filter(data, date => {
|
|
563
532
|
return moment(date.Date, "DD-MM-YYYY").format(formatToUse) === moment(d, "DD-MM-YYYY").format(formatToUse);
|
|
564
533
|
}) || [dates[d]];
|
|
565
|
-
|
|
534
|
+
const compiledValue = {
|
|
566
535
|
date: d,
|
|
567
536
|
label: moment(d, "DD-MM-YYYY").format(labelFormat),
|
|
568
537
|
value: countActivities(datesToUse, activityKey, countType)
|
|
@@ -584,19 +553,19 @@ var analytics = /*#__PURE__*/Object.freeze({
|
|
|
584
553
|
generateDateActivities: generateDateActivities
|
|
585
554
|
});
|
|
586
555
|
|
|
587
|
-
|
|
588
|
-
|
|
556
|
+
const getUrl = function (baseAction, action, query) {
|
|
557
|
+
let {
|
|
589
558
|
url,
|
|
590
559
|
stage
|
|
591
560
|
} = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {
|
|
592
561
|
url: null,
|
|
593
562
|
stage: null
|
|
594
563
|
};
|
|
595
|
-
|
|
564
|
+
const {
|
|
596
565
|
baseAPIUrl,
|
|
597
566
|
baseStage
|
|
598
567
|
} = CoreConfig.env;
|
|
599
|
-
|
|
568
|
+
let queryPart = "";
|
|
600
569
|
if (query) {
|
|
601
570
|
_.keys(query).forEach((key, index) => {
|
|
602
571
|
queryPart += "".concat(index === 0 ? "?" : "&").concat(key, "=").concat(encodeURIComponent(query[key]));
|
|
@@ -605,7 +574,7 @@ var getUrl = function getUrl(baseAction, action, query) {
|
|
|
605
574
|
return "".concat(url || baseAPIUrl, "/").concat(baseAction, "-").concat(stage || baseStage, "/").concat(action).concat(queryPart);
|
|
606
575
|
};
|
|
607
576
|
|
|
608
|
-
|
|
577
|
+
const getUrlParams = () => {
|
|
609
578
|
var vars = {};
|
|
610
579
|
window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, key, value) {
|
|
611
580
|
vars[key] = value;
|
|
@@ -613,39 +582,39 @@ var getUrlParams = () => {
|
|
|
613
582
|
return vars;
|
|
614
583
|
};
|
|
615
584
|
|
|
616
|
-
|
|
585
|
+
const safeReadParams = (props, key) => {
|
|
617
586
|
if (props && props.match && props.match.params) return props.match.params[key];
|
|
618
587
|
return null;
|
|
619
588
|
};
|
|
620
589
|
|
|
621
|
-
|
|
590
|
+
const getUserFromState = state => {
|
|
622
591
|
if (!state || !state.auth || !state.auth.user) {
|
|
623
592
|
return {};
|
|
624
593
|
}
|
|
625
594
|
return state.auth.user;
|
|
626
595
|
};
|
|
627
596
|
|
|
628
|
-
|
|
597
|
+
const getAppColourFromState = state => {
|
|
629
598
|
if (!state || !state.auth || !state.auth.siteBranding || !state.auth.siteBranding.MainBrandingColour) {
|
|
630
599
|
return CoreConfig.env.colourBrandingApp;
|
|
631
600
|
}
|
|
632
601
|
return state.auth.siteBranding.MainBrandingColour;
|
|
633
602
|
};
|
|
634
603
|
|
|
635
|
-
|
|
604
|
+
const getExtension = url => {
|
|
636
605
|
if (!url) {
|
|
637
606
|
return null;
|
|
638
607
|
}
|
|
639
|
-
|
|
608
|
+
const fileSplit = url.split(".");
|
|
640
609
|
return fileSplit[fileSplit.length - 1].toLowerCase();
|
|
641
610
|
};
|
|
642
611
|
|
|
643
|
-
|
|
644
|
-
|
|
612
|
+
const isVideo = url => {
|
|
613
|
+
const extension = getExtension(url);
|
|
645
614
|
return ["mov", "mp4"].includes(extension);
|
|
646
615
|
};
|
|
647
616
|
|
|
648
|
-
|
|
617
|
+
const get1400 = url => {
|
|
649
618
|
if (!url) {
|
|
650
619
|
return url;
|
|
651
620
|
}
|
|
@@ -658,13 +627,13 @@ var get1400 = url => {
|
|
|
658
627
|
if (url.indexOf("https://plusscdn.azureedge.net/") !== -1) {
|
|
659
628
|
return url.replace("/uploads/", "/uploads1400/").replace("/general/", "/general1400/");
|
|
660
629
|
}
|
|
661
|
-
|
|
630
|
+
const {
|
|
662
631
|
baseUploadsUrl,
|
|
663
632
|
baseLibraryUrl
|
|
664
633
|
} = CoreConfig.env;
|
|
665
634
|
if (url.indexOf(baseUploadsUrl) !== -1 || url.indexOf(baseLibraryUrl) !== -1) {
|
|
666
|
-
|
|
667
|
-
|
|
635
|
+
const extension = getExtension(url);
|
|
636
|
+
let urlToUse = url;
|
|
668
637
|
if (extension !== "jpg") {
|
|
669
638
|
urlToUse = "".concat(url.substring(0, url.length - (extension.length + 1)), ".jpg");
|
|
670
639
|
}
|
|
@@ -673,7 +642,7 @@ var get1400 = url => {
|
|
|
673
642
|
return url;
|
|
674
643
|
};
|
|
675
644
|
|
|
676
|
-
|
|
645
|
+
const generateImageName = name => {
|
|
677
646
|
return "xxxxxxxx4xxxyxxxxxxxxxxxxx".concat(name).replace(/[xy]/g, c => {
|
|
678
647
|
// eslint-disable-next-line
|
|
679
648
|
var r = Math.random() * 16 | 0,
|
|
@@ -682,19 +651,19 @@ var generateImageName = name => {
|
|
|
682
651
|
});
|
|
683
652
|
};
|
|
684
653
|
|
|
685
|
-
|
|
654
|
+
const getFileName = (url, noExtension) => {
|
|
686
655
|
if (!url) {
|
|
687
656
|
return null;
|
|
688
657
|
}
|
|
689
|
-
|
|
690
|
-
|
|
658
|
+
const fileSplit = url.split("/");
|
|
659
|
+
const name = fileSplit[fileSplit.length - 1].toLowerCase();
|
|
691
660
|
if (!noExtension) {
|
|
692
661
|
return name;
|
|
693
662
|
}
|
|
694
663
|
return name.split(".")[0];
|
|
695
664
|
};
|
|
696
665
|
|
|
697
|
-
|
|
666
|
+
const getThumb300 = url => {
|
|
698
667
|
if (!url) {
|
|
699
668
|
return url;
|
|
700
669
|
}
|
|
@@ -707,13 +676,13 @@ var getThumb300 = url => {
|
|
|
707
676
|
if (url.indexOf("https://plusscdn.azureedge.net/") !== -1) {
|
|
708
677
|
return url.replace("/uploads/", "/uploads-thumb/").replace("/general/", "/general300/").replace("/uploads1400/", "/uploads-thumb/").replace("/general1400/", "/general300/");
|
|
709
678
|
}
|
|
710
|
-
|
|
679
|
+
const {
|
|
711
680
|
baseUploadsUrl,
|
|
712
681
|
baseLibraryUrl
|
|
713
682
|
} = CoreConfig.env;
|
|
714
683
|
if (url.indexOf(baseUploadsUrl) !== -1 || url.indexOf(baseLibraryUrl) !== -1) {
|
|
715
|
-
|
|
716
|
-
|
|
684
|
+
const extension = getExtension(url);
|
|
685
|
+
let urlToUse = url;
|
|
717
686
|
if (extension !== "jpg") {
|
|
718
687
|
urlToUse = "".concat(url.substring(0, url.length - (extension.length + 1)), ".jpg");
|
|
719
688
|
}
|
|
@@ -722,31 +691,31 @@ var getThumb300 = url => {
|
|
|
722
691
|
return url;
|
|
723
692
|
};
|
|
724
693
|
|
|
725
|
-
|
|
694
|
+
const getFirstName = string => {
|
|
726
695
|
if (_.isEmpty(string)) {
|
|
727
696
|
return "";
|
|
728
697
|
}
|
|
729
698
|
return string.split(" ")[0];
|
|
730
699
|
};
|
|
731
700
|
|
|
732
|
-
|
|
701
|
+
const isEmail = email => {
|
|
733
702
|
if (_.isEmpty(email)) return false;
|
|
734
|
-
|
|
735
|
-
|
|
703
|
+
const atpos = email.indexOf("@");
|
|
704
|
+
const dotpos = email.lastIndexOf(".");
|
|
736
705
|
if (atpos < 1 || dotpos < atpos + 2 || dotpos + 2 >= email.length) return false;
|
|
737
706
|
return true;
|
|
738
707
|
};
|
|
739
708
|
|
|
740
|
-
|
|
709
|
+
const isUrl = url => {
|
|
741
710
|
if (_.isEmpty(url)) return false;
|
|
742
|
-
|
|
711
|
+
const dotpos = url.lastIndexOf(".");
|
|
743
712
|
if (dotpos < 2 || dotpos + 2 >= url.length) {
|
|
744
713
|
return false;
|
|
745
714
|
}
|
|
746
715
|
return true;
|
|
747
716
|
};
|
|
748
717
|
|
|
749
|
-
|
|
718
|
+
const randomString = () => {
|
|
750
719
|
return "xxxxxxxx4xxxyxxxxxxxxxxxxx".replace(/[xy]/g, c => {
|
|
751
720
|
// eslint-disable-next-line
|
|
752
721
|
var r = Math.random() * 16 | 0,
|
|
@@ -757,10 +726,10 @@ var randomString = () => {
|
|
|
757
726
|
|
|
758
727
|
function ownKeys$p(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; }
|
|
759
728
|
function _objectSpread$p(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$p(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$p(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
760
|
-
|
|
729
|
+
const toParagraphed = (text, style) => {
|
|
761
730
|
if (!text) return text;
|
|
762
731
|
text = text.replace(/\t/g, "\u00a0\u00a0\u00a0\u00a0");
|
|
763
|
-
|
|
732
|
+
const textSplit = text.split("\n");
|
|
764
733
|
return _.map(textSplit, (t, i) => {
|
|
765
734
|
return /*#__PURE__*/jsx("span", {
|
|
766
735
|
iconStyle: _objectSpread$p({
|
|
@@ -771,22 +740,22 @@ var toParagraphed = (text, style) => {
|
|
|
771
740
|
});
|
|
772
741
|
};
|
|
773
742
|
|
|
774
|
-
|
|
743
|
+
const onlyAlphanumeric = input => {
|
|
775
744
|
if (!input) {
|
|
776
745
|
return input;
|
|
777
746
|
}
|
|
778
747
|
return input.replace(/[^a-z0-9]/gi, "");
|
|
779
748
|
};
|
|
780
749
|
|
|
781
|
-
|
|
750
|
+
const htmlDecode = value => $("<textare/>").html(value).text();
|
|
782
751
|
|
|
783
|
-
|
|
752
|
+
const htmlEncode = value => $("<textare/>").text(value).html();
|
|
784
753
|
|
|
785
|
-
|
|
754
|
+
const getSiteName = (site, sites) => {
|
|
786
755
|
if (site === "hq") {
|
|
787
756
|
return "HQ";
|
|
788
757
|
}
|
|
789
|
-
|
|
758
|
+
const siteObject = _.find(sites, t => {
|
|
790
759
|
return t.Id === site;
|
|
791
760
|
});
|
|
792
761
|
if (siteObject) {
|
|
@@ -795,25 +764,25 @@ var getSiteName = (site, sites) => {
|
|
|
795
764
|
return site;
|
|
796
765
|
};
|
|
797
766
|
|
|
798
|
-
|
|
767
|
+
const getSiteNameFromRoles = (site, roles) => {
|
|
799
768
|
return getSiteName(site, roles.map(r => {
|
|
800
769
|
return r.siteInfo;
|
|
801
770
|
}));
|
|
802
771
|
};
|
|
803
772
|
|
|
804
|
-
|
|
773
|
+
const getSiteSettingFromState = (state, key, defaultValue) => {
|
|
805
774
|
if (state && state.auth && state.auth.siteSettings && !_.isUndefined(state.auth.siteSettings[key])) {
|
|
806
775
|
return state.auth.siteSettings[key];
|
|
807
776
|
}
|
|
808
777
|
return defaultValue || null;
|
|
809
778
|
};
|
|
810
779
|
|
|
811
|
-
|
|
812
|
-
|
|
780
|
+
const getSiteLevelFromState = state => {
|
|
781
|
+
let siteType = "legacy";
|
|
813
782
|
if (state && state.auth && state.auth.siteType) {
|
|
814
783
|
siteType = state.auth.siteType;
|
|
815
784
|
}
|
|
816
|
-
|
|
785
|
+
const siteConfig = {
|
|
817
786
|
type: siteType,
|
|
818
787
|
featurePickerUrl: "/featurepicker",
|
|
819
788
|
hasTV: true,
|
|
@@ -838,26 +807,26 @@ var getSiteLevelFromState = state => {
|
|
|
838
807
|
return siteConfig;
|
|
839
808
|
};
|
|
840
809
|
|
|
841
|
-
|
|
810
|
+
const getMerchantsFromState = state => {
|
|
842
811
|
if (!state || !state.auth || !state.auth.user) return [];
|
|
843
|
-
|
|
812
|
+
const currentSite = state.auth.user.Roles.find(r => r.site === state.auth.site);
|
|
844
813
|
return currentSite && !_.isEmpty(currentSite.siteInfo.Accounts) ? currentSite.siteInfo.Accounts : [];
|
|
845
814
|
};
|
|
846
815
|
|
|
847
|
-
|
|
848
|
-
|
|
816
|
+
const readJSONFromStorage = (storage, key, fallback) => {
|
|
817
|
+
const value = storage.getItem(key);
|
|
849
818
|
if (value) {
|
|
850
819
|
return JSON.parse(value);
|
|
851
820
|
}
|
|
852
821
|
return fallback;
|
|
853
822
|
};
|
|
854
823
|
|
|
855
|
-
|
|
824
|
+
const setLocalStorage = (key, value, isJson) => {
|
|
856
825
|
window.localStorage.setItem(key, isJson ? JSON.stringify(value) : value);
|
|
857
826
|
};
|
|
858
827
|
|
|
859
|
-
|
|
860
|
-
|
|
828
|
+
const readStorageWithCookie = (key, isJson) => {
|
|
829
|
+
const value = window.localStorage.getItem(key);
|
|
861
830
|
if (value) {
|
|
862
831
|
if (isJson) {
|
|
863
832
|
try {
|
|
@@ -875,7 +844,7 @@ var readStorageWithCookie = (key, isJson) => {
|
|
|
875
844
|
return Cookies.get(key);
|
|
876
845
|
};
|
|
877
846
|
|
|
878
|
-
|
|
847
|
+
const getTimepickerTime = input => {
|
|
879
848
|
var timeSplit = input.split(":");
|
|
880
849
|
if (timeSplit[1].indexOf("pm") > -1) {
|
|
881
850
|
if (timeSplit[0] !== "12") {
|
|
@@ -894,42 +863,42 @@ var getTimepickerTime = input => {
|
|
|
894
863
|
};
|
|
895
864
|
|
|
896
865
|
//converts the result of getTimePickerTime into a number representing minutes since midnight
|
|
897
|
-
|
|
866
|
+
const timeToMinutes = time => {
|
|
898
867
|
return parseInt(time.hours, 10) * 60 + parseInt(time.minutes, 10);
|
|
899
868
|
};
|
|
900
869
|
|
|
901
870
|
// checks whether there is an overlap between two time frames given time and end times in minutes since midnight
|
|
902
|
-
|
|
871
|
+
const hasTimeframeOverlap = (aStart, aEnd, bStart, bEnd) => {
|
|
903
872
|
return aStart < bEnd && bStart < aEnd || bStart < aEnd && aStart < bEnd;
|
|
904
873
|
};
|
|
905
874
|
|
|
906
875
|
// converts a time picker input into midnights since midnight
|
|
907
|
-
|
|
876
|
+
const timepickerToMinutes = input => {
|
|
908
877
|
return timeToMinutes(getTimepickerTime(input));
|
|
909
878
|
};
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
879
|
+
const getDateFromTimeDatePickers = (dateInput, timeInput) => {
|
|
880
|
+
const dateObject = new Date(dateInput);
|
|
881
|
+
const time = getTimepickerTime(timeInput);
|
|
913
882
|
dateObject.setHours(time.hours);
|
|
914
883
|
dateObject.setMinutes(time.minutes);
|
|
915
884
|
return dateObject;
|
|
916
885
|
};
|
|
917
|
-
|
|
918
|
-
|
|
886
|
+
const formatTime = (hours, minutes) => {
|
|
887
|
+
const period = hours >= 12 ? "pm" : "am"; // Convert 24-hour format to 12-hour format
|
|
919
888
|
|
|
920
|
-
|
|
889
|
+
const adjustedHours = hours > 12 ? hours - 12 : hours === 0 ? 12 : hours; // Ensure minutes are two digits
|
|
921
890
|
|
|
922
|
-
|
|
891
|
+
const adjustedMinutes = String(minutes).padStart(2, "0");
|
|
923
892
|
return "".concat(adjustedHours, ":").concat(adjustedMinutes).concat(period);
|
|
924
893
|
};
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
894
|
+
const minutesToString = (minutes, isTimeOfDay) => {
|
|
895
|
+
const hours = Math.floor(minutes / 60);
|
|
896
|
+
const remainingMinutes = minutes % 60;
|
|
928
897
|
if (isTimeOfDay) {
|
|
929
898
|
return formatTime(hours, remainingMinutes);
|
|
930
899
|
}
|
|
931
|
-
|
|
932
|
-
|
|
900
|
+
const hoursString = hours > 1 ? "".concat(hours, " hours") : "".concat(hours, " hour");
|
|
901
|
+
const minutesString = remainingMinutes > 1 ? "".concat(remainingMinutes, " minutes") : "".concat(remainingMinutes, " minute");
|
|
933
902
|
if (hours && remainingMinutes) {
|
|
934
903
|
return "".concat(hoursString, " ").concat(minutesString);
|
|
935
904
|
}
|
|
@@ -941,17 +910,17 @@ var minutesToString = (minutes, isTimeOfDay) => {
|
|
|
941
910
|
}
|
|
942
911
|
return "0 minutes";
|
|
943
912
|
};
|
|
944
|
-
|
|
945
|
-
|
|
913
|
+
const getUTCFromTimeDatePickers = (dateInput, timeInput) => {
|
|
914
|
+
const dateObject = getDateFromTimeDatePickers(dateInput, timeInput);
|
|
946
915
|
return moment.utc(dateObject);
|
|
947
916
|
};
|
|
948
|
-
|
|
917
|
+
const getPluralS = count => {
|
|
949
918
|
if (count === 1) {
|
|
950
919
|
return "";
|
|
951
920
|
}
|
|
952
921
|
return "s";
|
|
953
922
|
};
|
|
954
|
-
|
|
923
|
+
const getPluralOptions = (count, singular, plural) => {
|
|
955
924
|
if (count === 1) {
|
|
956
925
|
return singular;
|
|
957
926
|
}
|
|
@@ -959,17 +928,17 @@ var getPluralOptions = (count, singular, plural) => {
|
|
|
959
928
|
};
|
|
960
929
|
|
|
961
930
|
// deprecated
|
|
962
|
-
|
|
931
|
+
const setChatUser = auth => {
|
|
963
932
|
return;
|
|
964
933
|
};
|
|
965
934
|
|
|
966
935
|
// deprecated
|
|
967
|
-
|
|
936
|
+
const openChat = () => {
|
|
968
937
|
return;
|
|
969
938
|
};
|
|
970
939
|
|
|
971
940
|
// deprecated
|
|
972
|
-
|
|
941
|
+
const hideChat = () => {
|
|
973
942
|
return;
|
|
974
943
|
};
|
|
975
944
|
|
|
@@ -1023,12 +992,12 @@ var index$3 = /*#__PURE__*/Object.freeze({
|
|
|
1023
992
|
// const COLOUR_2 = '#3179cb';
|
|
1024
993
|
// const COLOUR_3 = '#1bb7ee';
|
|
1025
994
|
|
|
1026
|
-
|
|
995
|
+
const COLOUR_BRANDING_MAIN = "#4a57b7";
|
|
1027
996
|
// const COLOUR_BRANDING_DARK = '#364196';
|
|
1028
997
|
// const COLOUR_BRANDING_LIGHT = '#597db4';
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
998
|
+
const COLOUR_BRANDING_OFF = "#597db4";
|
|
999
|
+
const COLOUR_BRANDING_ACTION = "#5c90df";
|
|
1000
|
+
const COLOUR_BRANDING_INACTIVE = "#dbddf1";
|
|
1032
1001
|
|
|
1033
1002
|
// const TEXT_DARKEST = '#262a2d';
|
|
1034
1003
|
// const TEXT_DARK = '#262a2d';
|
|
@@ -1037,12 +1006,12 @@ var COLOUR_BRANDING_INACTIVE = "#dbddf1";
|
|
|
1037
1006
|
// const TEXT_DARK_ALPHA10 = 'rgba(60, 60, 80, .1)';
|
|
1038
1007
|
// const TEXT_MID = '#5a5a6e';
|
|
1039
1008
|
// const TEXT_MID_ALPHA50 = 'rgba(90, 90, 110, .5)';
|
|
1040
|
-
|
|
1009
|
+
const TEXT_LIGHT = "#717b81";
|
|
1041
1010
|
// const TEXT_SUPER_LIGHT = '#d2d9e5';
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1011
|
+
const COLOUR_DUSK = "#536280";
|
|
1012
|
+
const COLOUR_DUSK_LIGHT = "#67758f";
|
|
1013
|
+
const COLOUR_DUSK_LIGHTER = "#a1afcc";
|
|
1014
|
+
const LINEGREY = COLOUR_BRANDING_INACTIVE;
|
|
1046
1015
|
// const BORDER_LINE_GREY = COLOUR_BRANDING_INACTIVE;
|
|
1047
1016
|
|
|
1048
1017
|
// const COLOUR_TEAL = '#49bdbb';
|
|
@@ -1051,8 +1020,8 @@ var LINEGREY = COLOUR_BRANDING_INACTIVE;
|
|
|
1051
1020
|
// const COLOUR_BLUE_ALPHA10 = 'rgba(0, 131, 238, 0.1)';
|
|
1052
1021
|
// const COLOUR_DARKBLUE = '#191e78';
|
|
1053
1022
|
// const COLOUR_PURPLE = '#6e79c5';
|
|
1054
|
-
|
|
1055
|
-
|
|
1023
|
+
const COLOUR_RED = "#c02743";
|
|
1024
|
+
const COLOUR_GREEN = "#00cc9c";
|
|
1056
1025
|
// const COLOUR_TANGERINE = '#ff8c75';
|
|
1057
1026
|
// const COLOUR_CITRON = '#bdbd27';
|
|
1058
1027
|
// const COLOUR_GRAPEFRUIT = '#ff6363';
|
|
@@ -1062,29 +1031,29 @@ var COLOUR_GREEN = "#00cc9c";
|
|
|
1062
1031
|
// const COLOUR_NAV_GREY = '#f6f6f6';
|
|
1063
1032
|
// const COLOUR_TRANSPARENT = 'rgba(0,0,0,0)';
|
|
1064
1033
|
// const COLOUR_SIDEBAR = '#303030';
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1034
|
+
const COLOUR_LIGHTGREY = "#8695b2";
|
|
1035
|
+
const INACTIVE_TEXT = COLOUR_LIGHTGREY;
|
|
1036
|
+
const COLOUR_BRANDING_APP = "#4a57b7";
|
|
1037
|
+
const hexToRGB = hex => {
|
|
1069
1038
|
// Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
|
|
1070
|
-
|
|
1039
|
+
const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
|
|
1071
1040
|
hex = hex.replace(shorthandRegex, (m, r, g, b) => {
|
|
1072
1041
|
return r + r + g + g + b + b;
|
|
1073
1042
|
});
|
|
1074
|
-
|
|
1043
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
1075
1044
|
return result ? {
|
|
1076
1045
|
r: parseInt(result[1], 16),
|
|
1077
1046
|
g: parseInt(result[2], 16),
|
|
1078
1047
|
b: parseInt(result[3], 16)
|
|
1079
1048
|
} : null;
|
|
1080
1049
|
};
|
|
1081
|
-
|
|
1050
|
+
const hexToRGBAstring = (hex, opacity) => {
|
|
1082
1051
|
// Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
|
|
1083
|
-
|
|
1052
|
+
const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
|
|
1084
1053
|
hex = hex.replace(shorthandRegex, (m, r, g, b) => {
|
|
1085
1054
|
return r + r + g + g + b + b;
|
|
1086
1055
|
});
|
|
1087
|
-
|
|
1056
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
1088
1057
|
return result ? "rgba(".concat(parseInt(result[1], 16), ", ").concat(parseInt(result[2], 16), ", ").concat(parseInt(result[3], 16), ", ").concat(opacity, ")") : null;
|
|
1089
1058
|
};
|
|
1090
1059
|
|
|
@@ -1108,23 +1077,23 @@ var colours = /*#__PURE__*/Object.freeze({
|
|
|
1108
1077
|
COLOUR_BRANDING_INACTIVE: COLOUR_BRANDING_INACTIVE
|
|
1109
1078
|
});
|
|
1110
1079
|
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1080
|
+
const SET_AUTH = "set_auth";
|
|
1081
|
+
const LOGOUT = "LOGOUT";
|
|
1082
|
+
const CHANGE_SITE = "CHANGE_SITE";
|
|
1083
|
+
const UPDATE_PROFILE = "UPDATE_PROFILE";
|
|
1084
|
+
const ADD_RECENTLY_CREATED = "ADD_RECENTLY_CREATED";
|
|
1085
|
+
const USERS_LOADED = "USERS_LOADED";
|
|
1086
|
+
const USER_REMOVED = "USER_REMOVED";
|
|
1087
|
+
const USERS_PURGE = "USERS_PURGE";
|
|
1088
|
+
const USERS_LOADING = "USERS_LOADING";
|
|
1089
|
+
const USERS_RESIDENT_COUNT_SET = "USERS_RESIDENT_COUNT_SET";
|
|
1090
|
+
const INVITE_CODES_LOADED = "INVITE_CODES_LOADED";
|
|
1091
|
+
const INVITE_CODE_UPDATED = "INVITE_CODE_UPDATED";
|
|
1092
|
+
const INVITE_CODE_REMOVED = "INVITE_CODE_REMOVED";
|
|
1093
|
+
const SET_NAV_DATA = "SET_NAV_DATA";
|
|
1094
|
+
const TEMPLATES_LOADED = "TEMPLATES_LOADED";
|
|
1095
|
+
const TEMPLATE_REMOVED = "TEMPLATE_REMOVED";
|
|
1096
|
+
const SCHEDULED_ACTIONS_LOADED = "SCHEDULED_ACTIONS_LOADED";
|
|
1128
1097
|
|
|
1129
1098
|
// import { getEnabledFeatures } from '../session';
|
|
1130
1099
|
// import { authActions, typeActions } from '../apis';
|
|
@@ -1155,13 +1124,13 @@ var SCHEDULED_ACTIONS_LOADED = "SCHEDULED_ACTIONS_LOADED";
|
|
|
1155
1124
|
// };
|
|
1156
1125
|
// };
|
|
1157
1126
|
|
|
1158
|
-
|
|
1127
|
+
const setAuth = stuff => {
|
|
1159
1128
|
return {
|
|
1160
1129
|
type: SET_AUTH,
|
|
1161
1130
|
payload: stuff
|
|
1162
1131
|
};
|
|
1163
1132
|
};
|
|
1164
|
-
|
|
1133
|
+
const setAuthUser = (auth, user, site) => {
|
|
1165
1134
|
return dispatch => {
|
|
1166
1135
|
if (!auth && !user && !site) {
|
|
1167
1136
|
dispatch({
|
|
@@ -1180,7 +1149,7 @@ var setAuthUser = (auth, user, site) => {
|
|
|
1180
1149
|
});
|
|
1181
1150
|
};
|
|
1182
1151
|
};
|
|
1183
|
-
|
|
1152
|
+
const setRemember = chooken => {
|
|
1184
1153
|
return {
|
|
1185
1154
|
type: SET_AUTH,
|
|
1186
1155
|
payload: {
|
|
@@ -1188,7 +1157,7 @@ var setRemember = chooken => {
|
|
|
1188
1157
|
}
|
|
1189
1158
|
};
|
|
1190
1159
|
};
|
|
1191
|
-
|
|
1160
|
+
const setAuthLocation = site => {
|
|
1192
1161
|
console.log("setting auth location");
|
|
1193
1162
|
console.log(site);
|
|
1194
1163
|
return {
|
|
@@ -1198,21 +1167,21 @@ var setAuthLocation = site => {
|
|
|
1198
1167
|
}
|
|
1199
1168
|
};
|
|
1200
1169
|
};
|
|
1201
|
-
|
|
1170
|
+
const updateProfile = changes => {
|
|
1202
1171
|
return {
|
|
1203
1172
|
type: UPDATE_PROFILE,
|
|
1204
1173
|
payload: changes
|
|
1205
1174
|
};
|
|
1206
1175
|
};
|
|
1207
1176
|
|
|
1208
|
-
|
|
1177
|
+
const addRecentlyCreated = feature => {
|
|
1209
1178
|
return {
|
|
1210
1179
|
type: ADD_RECENTLY_CREATED,
|
|
1211
1180
|
payload: feature
|
|
1212
1181
|
};
|
|
1213
1182
|
};
|
|
1214
1183
|
|
|
1215
|
-
|
|
1184
|
+
const analyticsActions = {
|
|
1216
1185
|
log: (site, actionType, entityType, entityId, data) => {
|
|
1217
1186
|
return authedFunction({
|
|
1218
1187
|
method: "POST",
|
|
@@ -1235,12 +1204,12 @@ var analyticsActions = {
|
|
|
1235
1204
|
})
|
|
1236
1205
|
});
|
|
1237
1206
|
},
|
|
1238
|
-
getActivityLog: function
|
|
1239
|
-
|
|
1207
|
+
getActivityLog: function (entityId, entityType, actionType, minTime, maxTime) {
|
|
1208
|
+
let {
|
|
1240
1209
|
userType,
|
|
1241
1210
|
userCategory
|
|
1242
1211
|
} = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
|
|
1243
|
-
|
|
1212
|
+
const query = {
|
|
1244
1213
|
entityId,
|
|
1245
1214
|
entityType,
|
|
1246
1215
|
actionType
|
|
@@ -1266,12 +1235,12 @@ var analyticsActions = {
|
|
|
1266
1235
|
})
|
|
1267
1236
|
});
|
|
1268
1237
|
},
|
|
1269
|
-
getAggregateEntityStats: function
|
|
1270
|
-
|
|
1238
|
+
getAggregateEntityStats: function (site, type, minTime, maxTime, raw) {
|
|
1239
|
+
let {
|
|
1271
1240
|
userType,
|
|
1272
1241
|
userCategory
|
|
1273
1242
|
} = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
|
|
1274
|
-
|
|
1243
|
+
const query = {
|
|
1275
1244
|
site,
|
|
1276
1245
|
type,
|
|
1277
1246
|
minTime,
|
|
@@ -1285,12 +1254,12 @@ var analyticsActions = {
|
|
|
1285
1254
|
url: getUrl("analytics", "aggregate", query)
|
|
1286
1255
|
});
|
|
1287
1256
|
},
|
|
1288
|
-
getUserRetention: function
|
|
1289
|
-
|
|
1257
|
+
getUserRetention: function (site) {
|
|
1258
|
+
let {
|
|
1290
1259
|
userType,
|
|
1291
1260
|
userCategory
|
|
1292
1261
|
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1293
|
-
|
|
1262
|
+
const query = {
|
|
1294
1263
|
site
|
|
1295
1264
|
};
|
|
1296
1265
|
if (userType) query.userType = userType;
|
|
@@ -1302,9 +1271,9 @@ var analyticsActions = {
|
|
|
1302
1271
|
}
|
|
1303
1272
|
};
|
|
1304
1273
|
|
|
1305
|
-
|
|
1274
|
+
const authActions = {
|
|
1306
1275
|
checkUserAuth: userId => {
|
|
1307
|
-
|
|
1276
|
+
let url = getUrl("auth", "checkUserAuth");
|
|
1308
1277
|
return authedFunction({
|
|
1309
1278
|
method: "POST",
|
|
1310
1279
|
url,
|
|
@@ -1329,8 +1298,8 @@ var authActions = {
|
|
|
1329
1298
|
});
|
|
1330
1299
|
},
|
|
1331
1300
|
disableUser: (username, site) => {
|
|
1332
|
-
|
|
1333
|
-
|
|
1301
|
+
let url = getUrl("users", "testUserDisbale");
|
|
1302
|
+
const request = {
|
|
1334
1303
|
method: "POST",
|
|
1335
1304
|
url,
|
|
1336
1305
|
data: {
|
|
@@ -1340,21 +1309,15 @@ var authActions = {
|
|
|
1340
1309
|
};
|
|
1341
1310
|
return authedFunction(request);
|
|
1342
1311
|
},
|
|
1343
|
-
getUserSignin:
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
url: getUrl("auth", "getUserSignin")
|
|
1348
|
-
});
|
|
1312
|
+
getUserSignin: async () => {
|
|
1313
|
+
return authedFunction({
|
|
1314
|
+
method: "POST",
|
|
1315
|
+
url: getUrl("auth", "getUserSignin")
|
|
1349
1316
|
});
|
|
1350
|
-
|
|
1351
|
-
return _getUserSignin.apply(this, arguments);
|
|
1352
|
-
}
|
|
1353
|
-
return getUserSignin;
|
|
1354
|
-
}(),
|
|
1317
|
+
},
|
|
1355
1318
|
copyDummy: site => {
|
|
1356
|
-
|
|
1357
|
-
|
|
1319
|
+
let url = getUrl("auth", "copyDummy");
|
|
1320
|
+
const request = {
|
|
1358
1321
|
method: "POST",
|
|
1359
1322
|
url,
|
|
1360
1323
|
data: {
|
|
@@ -1449,7 +1412,7 @@ function CanvasImageUploader(options) {
|
|
|
1449
1412
|
/**
|
|
1450
1413
|
* Run to initialize CanvasImageUploader.
|
|
1451
1414
|
*/
|
|
1452
|
-
newImage: function
|
|
1415
|
+
newImage: function () {
|
|
1453
1416
|
imageData = null;
|
|
1454
1417
|
image = new Image();
|
|
1455
1418
|
},
|
|
@@ -1457,7 +1420,7 @@ function CanvasImageUploader(options) {
|
|
|
1457
1420
|
* Returns the image data if any file has been read.
|
|
1458
1421
|
* @returns {Blob|null}
|
|
1459
1422
|
*/
|
|
1460
|
-
getImageData: function
|
|
1423
|
+
getImageData: function () {
|
|
1461
1424
|
return imageData;
|
|
1462
1425
|
},
|
|
1463
1426
|
/**
|
|
@@ -1467,7 +1430,7 @@ function CanvasImageUploader(options) {
|
|
|
1467
1430
|
* @param $destination The destination canvas to draw onto.
|
|
1468
1431
|
* @param maxSize Maximum width or height of the destination canvas.
|
|
1469
1432
|
*/
|
|
1470
|
-
copyToCanvas: function
|
|
1433
|
+
copyToCanvas: function (source, $destination, maxSize) {
|
|
1471
1434
|
var size = calculateSize(source, maxSize);
|
|
1472
1435
|
setDimensions($destination, size);
|
|
1473
1436
|
var destCtx = $destination[0].getContext("2d");
|
|
@@ -1479,7 +1442,7 @@ function CanvasImageUploader(options) {
|
|
|
1479
1442
|
* @param $canvas The canvas (jQuery) object to draw on.
|
|
1480
1443
|
* @param callback Function that is called when the operation has finished.
|
|
1481
1444
|
*/
|
|
1482
|
-
readImageToCanvas: function
|
|
1445
|
+
readImageToCanvas: function (file, $canvas, callback) {
|
|
1483
1446
|
this.newImage();
|
|
1484
1447
|
if (!file) return;
|
|
1485
1448
|
var reader = new FileReader();
|
|
@@ -1496,35 +1459,29 @@ function CanvasImageUploader(options) {
|
|
|
1496
1459
|
* Get this data using the method getImageData().
|
|
1497
1460
|
* @param canvas
|
|
1498
1461
|
*/
|
|
1499
|
-
saveCanvasToImageData: function
|
|
1462
|
+
saveCanvasToImageData: function (canvas) {
|
|
1500
1463
|
var base64 = canvas.toDataURL("image/jpeg", options.jpegQuality).replace(/^data:image\/(png|jpeg|jpg|gif);base64,/, "");
|
|
1501
1464
|
imageData = base64toBlob(base64, "image/jpeg"); // Byte array
|
|
1502
1465
|
}
|
|
1503
1466
|
};
|
|
1504
1467
|
}
|
|
1505
1468
|
|
|
1506
|
-
|
|
1507
|
-
uploadMediaAsync:
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
});
|
|
1523
|
-
function uploadMediaAsync(_x, _x2) {
|
|
1524
|
-
return _uploadMediaAsync.apply(this, arguments);
|
|
1525
|
-
}
|
|
1526
|
-
return uploadMediaAsync;
|
|
1527
|
-
}(),
|
|
1469
|
+
const fileActions = {
|
|
1470
|
+
uploadMediaAsync: async (file, filename) => {
|
|
1471
|
+
const newFilename = filename.replace(/[^a-z0-9+.]+/gi, "").toLowerCase();
|
|
1472
|
+
const userId = await getCurrentUserSub();
|
|
1473
|
+
const url = "uploads/users/".concat(userId, "/public/").concat(randomString(), "/").concat(newFilename);
|
|
1474
|
+
const {
|
|
1475
|
+
baseUploadsUrl,
|
|
1476
|
+
uploadBucket
|
|
1477
|
+
} = CoreConfig.env;
|
|
1478
|
+
await Storage.put(url, file, {
|
|
1479
|
+
level: "public",
|
|
1480
|
+
bucket: uploadBucket
|
|
1481
|
+
});
|
|
1482
|
+
console.log("uploaded file", "".concat(baseUploadsUrl).concat(url));
|
|
1483
|
+
return "".concat(baseUploadsUrl).concat(url);
|
|
1484
|
+
},
|
|
1528
1485
|
// readBase64: async (file) => {
|
|
1529
1486
|
// return new Promise((resolve, reject) => {
|
|
1530
1487
|
// var reader = new FileReader();
|
|
@@ -1559,7 +1516,7 @@ var fileActions = {
|
|
|
1559
1516
|
});
|
|
1560
1517
|
},
|
|
1561
1518
|
blobToFile: (theBlob, fileName) => {
|
|
1562
|
-
|
|
1519
|
+
const file = new File([theBlob], fileName, {
|
|
1563
1520
|
lastModified: new Date()
|
|
1564
1521
|
});
|
|
1565
1522
|
console.log(file);
|
|
@@ -1567,10 +1524,10 @@ var fileActions = {
|
|
|
1567
1524
|
},
|
|
1568
1525
|
putCanvas: (canvas, filename) => {
|
|
1569
1526
|
return new Promise((resolve, reject) => {
|
|
1570
|
-
|
|
1571
|
-
|
|
1527
|
+
const img = canvas.getTrimmedCanvas().toDataURL("image/png");
|
|
1528
|
+
const imageData = Buffer.from(img.replace(/^data:image\/\w+;base64,/, ""), "base64");
|
|
1572
1529
|
canvas.off();
|
|
1573
|
-
|
|
1530
|
+
const imgName = generateImageName(filename);
|
|
1574
1531
|
Storage.put("images/".concat(imgName, ".png"), imageData, {
|
|
1575
1532
|
contentType: "image/png",
|
|
1576
1533
|
level: "public"
|
|
@@ -1584,7 +1541,7 @@ var fileActions = {
|
|
|
1584
1541
|
},
|
|
1585
1542
|
getMediaFolders: site => {
|
|
1586
1543
|
// console.log('getMediaFolders', 'site', site);
|
|
1587
|
-
|
|
1544
|
+
const query = {
|
|
1588
1545
|
site
|
|
1589
1546
|
};
|
|
1590
1547
|
return authedFunction({
|
|
@@ -1658,7 +1615,7 @@ var fileActions = {
|
|
|
1658
1615
|
|
|
1659
1616
|
function ownKeys$o(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; }
|
|
1660
1617
|
function _objectSpread$o(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$o(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$o(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1661
|
-
|
|
1618
|
+
const typeActions = {
|
|
1662
1619
|
getSubdomains: () => {
|
|
1663
1620
|
return authedFunction({
|
|
1664
1621
|
method: "GET",
|
|
@@ -1682,29 +1639,23 @@ var typeActions = {
|
|
|
1682
1639
|
});
|
|
1683
1640
|
},
|
|
1684
1641
|
getSites: () => {
|
|
1685
|
-
|
|
1642
|
+
let url = getUrl("types", "getsites");
|
|
1686
1643
|
return authedFunction({
|
|
1687
1644
|
method: "POST",
|
|
1688
1645
|
url
|
|
1689
1646
|
});
|
|
1690
1647
|
},
|
|
1691
|
-
getSite:
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
site: id
|
|
1695
|
-
});
|
|
1696
|
-
return authedFunction({
|
|
1697
|
-
method: "GET",
|
|
1698
|
-
url
|
|
1699
|
-
});
|
|
1648
|
+
getSite: async id => {
|
|
1649
|
+
let url = getUrl("types", "getsite", {
|
|
1650
|
+
site: id
|
|
1700
1651
|
});
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
}
|
|
1652
|
+
return authedFunction({
|
|
1653
|
+
method: "GET",
|
|
1654
|
+
url
|
|
1655
|
+
});
|
|
1656
|
+
},
|
|
1706
1657
|
getUserTypes: site => {
|
|
1707
|
-
|
|
1658
|
+
let url = getUrl("types", "getusertypes");
|
|
1708
1659
|
return authedFunction({
|
|
1709
1660
|
method: "POST",
|
|
1710
1661
|
url,
|
|
@@ -1714,7 +1665,7 @@ var typeActions = {
|
|
|
1714
1665
|
});
|
|
1715
1666
|
},
|
|
1716
1667
|
setTypePermissions: (type, adminId) => {
|
|
1717
|
-
|
|
1668
|
+
let url = getUrl("types", "setusertypepermissions");
|
|
1718
1669
|
return authedFunction({
|
|
1719
1670
|
method: "POST",
|
|
1720
1671
|
url,
|
|
@@ -1724,7 +1675,7 @@ var typeActions = {
|
|
|
1724
1675
|
});
|
|
1725
1676
|
},
|
|
1726
1677
|
deleteUserType: (site, type) => {
|
|
1727
|
-
|
|
1678
|
+
let url = getUrl("types", "usertype/delete");
|
|
1728
1679
|
return authedFunction({
|
|
1729
1680
|
method: "POST",
|
|
1730
1681
|
url,
|
|
@@ -1735,8 +1686,8 @@ var typeActions = {
|
|
|
1735
1686
|
});
|
|
1736
1687
|
},
|
|
1737
1688
|
createNewSite: (siteName, options) => {
|
|
1738
|
-
|
|
1739
|
-
|
|
1689
|
+
let url = getUrl("types", "setNewSite");
|
|
1690
|
+
const request = {
|
|
1740
1691
|
method: "POST",
|
|
1741
1692
|
url,
|
|
1742
1693
|
data: _objectSpread$o({
|
|
@@ -1746,8 +1697,8 @@ var typeActions = {
|
|
|
1746
1697
|
return authedFunction(request);
|
|
1747
1698
|
},
|
|
1748
1699
|
signUpNewSite: (site, user) => {
|
|
1749
|
-
|
|
1750
|
-
|
|
1700
|
+
let url = getUrl("types", "site/signup");
|
|
1701
|
+
const request = {
|
|
1751
1702
|
method: "POST",
|
|
1752
1703
|
url,
|
|
1753
1704
|
data: {
|
|
@@ -1764,7 +1715,7 @@ var typeActions = {
|
|
|
1764
1715
|
});
|
|
1765
1716
|
},
|
|
1766
1717
|
getInterfaces: (site, type) => {
|
|
1767
|
-
|
|
1718
|
+
const q = {
|
|
1768
1719
|
site
|
|
1769
1720
|
};
|
|
1770
1721
|
if (type) {
|
|
@@ -1776,7 +1727,7 @@ var typeActions = {
|
|
|
1776
1727
|
});
|
|
1777
1728
|
},
|
|
1778
1729
|
deleteInterface: id => {
|
|
1779
|
-
|
|
1730
|
+
const request = {
|
|
1780
1731
|
method: "POST",
|
|
1781
1732
|
url: getUrl("types", "interfaces/remove"),
|
|
1782
1733
|
data: {
|
|
@@ -1786,7 +1737,7 @@ var typeActions = {
|
|
|
1786
1737
|
return authedFunction(request);
|
|
1787
1738
|
},
|
|
1788
1739
|
saveInterface: (site, type, title, settings, id) => {
|
|
1789
|
-
|
|
1740
|
+
const request = {
|
|
1790
1741
|
method: "POST",
|
|
1791
1742
|
url: getUrl("types", "interfaces/save"),
|
|
1792
1743
|
data: {
|
|
@@ -1800,7 +1751,7 @@ var typeActions = {
|
|
|
1800
1751
|
return authedFunction(request);
|
|
1801
1752
|
},
|
|
1802
1753
|
attachInterface: (site, typeName, interfaceId) => {
|
|
1803
|
-
|
|
1754
|
+
const request = {
|
|
1804
1755
|
method: "POST",
|
|
1805
1756
|
url: getUrl("types", "interfaces/attach"),
|
|
1806
1757
|
data: {
|
|
@@ -1812,7 +1763,7 @@ var typeActions = {
|
|
|
1812
1763
|
return authedFunction(request);
|
|
1813
1764
|
},
|
|
1814
1765
|
getSiteBranding: site => {
|
|
1815
|
-
|
|
1766
|
+
const request = {
|
|
1816
1767
|
method: "GET",
|
|
1817
1768
|
url: getUrl("types", "branding/get", {
|
|
1818
1769
|
site
|
|
@@ -1821,7 +1772,7 @@ var typeActions = {
|
|
|
1821
1772
|
return unauthedFunction(request);
|
|
1822
1773
|
},
|
|
1823
1774
|
generateSiteBranding: url => {
|
|
1824
|
-
|
|
1775
|
+
const request = {
|
|
1825
1776
|
method: "GET",
|
|
1826
1777
|
url: getUrl("types", "branding/generate", {
|
|
1827
1778
|
url
|
|
@@ -1830,8 +1781,8 @@ var typeActions = {
|
|
|
1830
1781
|
return unauthedFunction(request);
|
|
1831
1782
|
},
|
|
1832
1783
|
editSiteBranding: (siteName, branding) => {
|
|
1833
|
-
|
|
1834
|
-
|
|
1784
|
+
let url = getUrl("types", "editsitebranding");
|
|
1785
|
+
const request = {
|
|
1835
1786
|
method: "POST",
|
|
1836
1787
|
url,
|
|
1837
1788
|
data: {
|
|
@@ -1867,9 +1818,9 @@ var typeActions = {
|
|
|
1867
1818
|
}
|
|
1868
1819
|
};
|
|
1869
1820
|
|
|
1870
|
-
|
|
1821
|
+
const stringActions = {
|
|
1871
1822
|
getString: (site, id, useDefault) => {
|
|
1872
|
-
|
|
1823
|
+
let url = getUrl("strings", "get/".concat(site, "_").concat(id), useDefault ? {
|
|
1873
1824
|
useDefault
|
|
1874
1825
|
} : undefined);
|
|
1875
1826
|
return axios({
|
|
@@ -1878,7 +1829,7 @@ var stringActions = {
|
|
|
1878
1829
|
});
|
|
1879
1830
|
},
|
|
1880
1831
|
setString: (site, key, value) => {
|
|
1881
|
-
|
|
1832
|
+
let url = getUrl("strings", "set");
|
|
1882
1833
|
return authedFunction({
|
|
1883
1834
|
method: "POST",
|
|
1884
1835
|
url,
|
|
@@ -1891,7 +1842,7 @@ var stringActions = {
|
|
|
1891
1842
|
}
|
|
1892
1843
|
};
|
|
1893
1844
|
|
|
1894
|
-
|
|
1845
|
+
const userActions = {
|
|
1895
1846
|
createNewUser: (user, userExtra) => {
|
|
1896
1847
|
return authedFunction({
|
|
1897
1848
|
method: "POST",
|
|
@@ -1991,7 +1942,7 @@ var userActions = {
|
|
|
1991
1942
|
});
|
|
1992
1943
|
},
|
|
1993
1944
|
getInviteCode: (userId, type, site) => {
|
|
1994
|
-
|
|
1945
|
+
const query = {};
|
|
1995
1946
|
if (!_.isEmpty(userId)) {
|
|
1996
1947
|
query.userId = userId;
|
|
1997
1948
|
}
|
|
@@ -2007,7 +1958,7 @@ var userActions = {
|
|
|
2007
1958
|
});
|
|
2008
1959
|
},
|
|
2009
1960
|
generateInviteCode: (userId, type, site) => {
|
|
2010
|
-
|
|
1961
|
+
const data = {};
|
|
2011
1962
|
if (!_.isEmpty(userId)) {
|
|
2012
1963
|
data.userId = userId;
|
|
2013
1964
|
}
|
|
@@ -2055,9 +2006,9 @@ var userActions = {
|
|
|
2055
2006
|
}
|
|
2056
2007
|
});
|
|
2057
2008
|
},
|
|
2058
|
-
getInviteCodes: function
|
|
2059
|
-
|
|
2060
|
-
|
|
2009
|
+
getInviteCodes: function (site) {
|
|
2010
|
+
let excludeFamily = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2011
|
+
const action = excludeFamily ? "excludeFamily" : "all";
|
|
2061
2012
|
return authedFunction({
|
|
2062
2013
|
method: "GET",
|
|
2063
2014
|
url: getUrl("users", "invite/get/".concat(action), {
|
|
@@ -2084,7 +2035,7 @@ var userActions = {
|
|
|
2084
2035
|
}
|
|
2085
2036
|
};
|
|
2086
2037
|
|
|
2087
|
-
|
|
2038
|
+
const profileActions = {
|
|
2088
2039
|
addEC: (userId, name, phone, email, relationship) => {
|
|
2089
2040
|
return authedFunction({
|
|
2090
2041
|
method: "POST",
|
|
@@ -2279,7 +2230,7 @@ var profileActions = {
|
|
|
2279
2230
|
}
|
|
2280
2231
|
};
|
|
2281
2232
|
|
|
2282
|
-
|
|
2233
|
+
const utilityActions = {
|
|
2283
2234
|
getUpvotyToken: () => {
|
|
2284
2235
|
return authedFunction({
|
|
2285
2236
|
method: "GET",
|
|
@@ -2311,9 +2262,9 @@ var utilityActions = {
|
|
|
2311
2262
|
}
|
|
2312
2263
|
};
|
|
2313
2264
|
|
|
2314
|
-
|
|
2265
|
+
const templateActions = {
|
|
2315
2266
|
getTemplates: (site, featureKey) => {
|
|
2316
|
-
|
|
2267
|
+
const query = {
|
|
2317
2268
|
site,
|
|
2318
2269
|
featureKey
|
|
2319
2270
|
};
|
|
@@ -2360,9 +2311,9 @@ var templateActions = {
|
|
|
2360
2311
|
}
|
|
2361
2312
|
};
|
|
2362
2313
|
|
|
2363
|
-
|
|
2314
|
+
const scheduledActionsActions = {
|
|
2364
2315
|
getActions: (site, entityKey) => {
|
|
2365
|
-
|
|
2316
|
+
const query = {
|
|
2366
2317
|
site,
|
|
2367
2318
|
entityKey
|
|
2368
2319
|
};
|
|
@@ -2389,14 +2340,14 @@ var index$2 = /*#__PURE__*/Object.freeze({
|
|
|
2389
2340
|
|
|
2390
2341
|
function ownKeys$n(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; }
|
|
2391
2342
|
function _objectSpread$n(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$n(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$n(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2392
|
-
|
|
2343
|
+
const usersUpdate = site => {
|
|
2393
2344
|
return dispatch => {
|
|
2394
2345
|
userActions.fetchUsers(site).then(res => {
|
|
2395
2346
|
if (res.userFetchFail) ; else {
|
|
2396
|
-
|
|
2347
|
+
const currentSite = readStorageWithCookie("site");
|
|
2397
2348
|
if (res.data != null && !_.isEmpty(res.data.results.Items) && res.data.results.Items[0].site === currentSite) {
|
|
2398
|
-
|
|
2399
|
-
|
|
2349
|
+
const users = res.data.results.Items;
|
|
2350
|
+
const allList = [];
|
|
2400
2351
|
Object.keys(users).forEach(userId => {
|
|
2401
2352
|
allList.push(_objectSpread$n(_objectSpread$n({}, users[userId]), {}, {
|
|
2402
2353
|
id: userId
|
|
@@ -2416,7 +2367,7 @@ var usersUpdate = site => {
|
|
|
2416
2367
|
});
|
|
2417
2368
|
};
|
|
2418
2369
|
};
|
|
2419
|
-
|
|
2370
|
+
const getUserCount = site => {
|
|
2420
2371
|
return dispatch => {
|
|
2421
2372
|
dispatch({
|
|
2422
2373
|
type: USERS_LOADING
|
|
@@ -2429,63 +2380,63 @@ var getUserCount = site => {
|
|
|
2429
2380
|
});
|
|
2430
2381
|
};
|
|
2431
2382
|
};
|
|
2432
|
-
|
|
2383
|
+
const usersLoaded = events => {
|
|
2433
2384
|
return {
|
|
2434
2385
|
type: USERS_LOADED,
|
|
2435
2386
|
payload: events
|
|
2436
2387
|
};
|
|
2437
2388
|
};
|
|
2438
|
-
|
|
2389
|
+
const userKey = id => {
|
|
2439
2390
|
return {
|
|
2440
2391
|
type: USER_REMOVED,
|
|
2441
2392
|
payload: id
|
|
2442
2393
|
};
|
|
2443
2394
|
};
|
|
2444
|
-
|
|
2395
|
+
const inviteCodesLoaded = inviteCodes => {
|
|
2445
2396
|
return {
|
|
2446
2397
|
type: INVITE_CODES_LOADED,
|
|
2447
2398
|
payload: inviteCodes
|
|
2448
2399
|
};
|
|
2449
2400
|
};
|
|
2450
|
-
|
|
2401
|
+
const inviteCodeUpdated = inviteCode => {
|
|
2451
2402
|
return {
|
|
2452
2403
|
type: INVITE_CODE_UPDATED,
|
|
2453
2404
|
payload: inviteCode
|
|
2454
2405
|
};
|
|
2455
2406
|
};
|
|
2456
|
-
|
|
2407
|
+
const inviteCodeRemoved = inviteCode => {
|
|
2457
2408
|
return {
|
|
2458
2409
|
type: INVITE_CODE_REMOVED,
|
|
2459
2410
|
payload: inviteCode
|
|
2460
2411
|
};
|
|
2461
2412
|
};
|
|
2462
|
-
|
|
2413
|
+
const clearUsers = () => {
|
|
2463
2414
|
return {
|
|
2464
2415
|
type: USERS_PURGE
|
|
2465
2416
|
};
|
|
2466
2417
|
};
|
|
2467
2418
|
|
|
2468
|
-
|
|
2419
|
+
const setNavData = data => {
|
|
2469
2420
|
return {
|
|
2470
2421
|
type: SET_NAV_DATA,
|
|
2471
2422
|
payload: data
|
|
2472
2423
|
};
|
|
2473
2424
|
};
|
|
2474
2425
|
|
|
2475
|
-
|
|
2426
|
+
const templatesLoaded = template => {
|
|
2476
2427
|
return {
|
|
2477
2428
|
type: TEMPLATES_LOADED,
|
|
2478
2429
|
payload: template
|
|
2479
2430
|
};
|
|
2480
2431
|
};
|
|
2481
|
-
|
|
2432
|
+
const removeTemplate = id => {
|
|
2482
2433
|
return {
|
|
2483
2434
|
type: TEMPLATE_REMOVED,
|
|
2484
2435
|
payload: id
|
|
2485
2436
|
};
|
|
2486
2437
|
};
|
|
2487
2438
|
|
|
2488
|
-
|
|
2439
|
+
const scheduledActionsLoaded = scheduledActions => {
|
|
2489
2440
|
return {
|
|
2490
2441
|
type: SCHEDULED_ACTIONS_LOADED,
|
|
2491
2442
|
payload: scheduledActions
|
|
@@ -2516,7 +2467,7 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
2516
2467
|
|
|
2517
2468
|
class AddButton extends Component {
|
|
2518
2469
|
getClasses() {
|
|
2519
|
-
|
|
2470
|
+
let classes = "addButton";
|
|
2520
2471
|
if (this.props.inactive) {
|
|
2521
2472
|
classes += " addButton--inactive";
|
|
2522
2473
|
}
|
|
@@ -2575,7 +2526,7 @@ function ownKeys$m(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymb
|
|
|
2575
2526
|
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; }
|
|
2576
2527
|
class Button extends Component {
|
|
2577
2528
|
getClasses() {
|
|
2578
|
-
|
|
2529
|
+
let string = "";
|
|
2579
2530
|
if (this.props.inline) string = string + "buttonWrapper--inline ";
|
|
2580
2531
|
if (this.props.isActive) string = string + "button--active ";
|
|
2581
2532
|
if (this.props.buttonType) string = string + "button--".concat(this.props.buttonType);
|
|
@@ -2592,7 +2543,7 @@ class Button extends Component {
|
|
|
2592
2543
|
return "button";
|
|
2593
2544
|
}
|
|
2594
2545
|
getButtonTextClasses() {
|
|
2595
|
-
|
|
2546
|
+
let result = "buttonText";
|
|
2596
2547
|
if (this.props.leftIcon) {
|
|
2597
2548
|
result = result + " buttonTextWithIcon";
|
|
2598
2549
|
}
|
|
@@ -2646,7 +2597,7 @@ class CheckBox extends PureComponent {
|
|
|
2646
2597
|
});
|
|
2647
2598
|
}
|
|
2648
2599
|
generateClassNames() {
|
|
2649
|
-
|
|
2600
|
+
let result = "checkBox";
|
|
2650
2601
|
if (this.props.isActive) {
|
|
2651
2602
|
result = result + " checkBox--active";
|
|
2652
2603
|
}
|
|
@@ -2659,14 +2610,14 @@ class CheckBox extends PureComponent {
|
|
|
2659
2610
|
return result;
|
|
2660
2611
|
}
|
|
2661
2612
|
getLabelClasses() {
|
|
2662
|
-
|
|
2613
|
+
let result = "actionText pointer";
|
|
2663
2614
|
if (this.props.disabled) {
|
|
2664
2615
|
result = result + " actionText--disabled";
|
|
2665
2616
|
}
|
|
2666
2617
|
return result;
|
|
2667
2618
|
}
|
|
2668
2619
|
getBoxStyle() {
|
|
2669
|
-
|
|
2620
|
+
const result = {};
|
|
2670
2621
|
if (this.props.highlightColour && this.props.isActive) {
|
|
2671
2622
|
result.borderColor = this.props.highlightColour;
|
|
2672
2623
|
result.backgroundColor = this.props.highlightColour;
|
|
@@ -2704,7 +2655,7 @@ class CheckBox extends PureComponent {
|
|
|
2704
2655
|
});
|
|
2705
2656
|
}
|
|
2706
2657
|
}
|
|
2707
|
-
|
|
2658
|
+
const styles$9 = {
|
|
2708
2659
|
row: {
|
|
2709
2660
|
display: "flex",
|
|
2710
2661
|
flexDirection: "row",
|
|
@@ -2762,12 +2713,12 @@ class ProfilePicComponent extends Component {
|
|
|
2762
2713
|
return this.renderPic();
|
|
2763
2714
|
}
|
|
2764
2715
|
}
|
|
2765
|
-
|
|
2716
|
+
const mapStateToProps$6 = state => {
|
|
2766
2717
|
return {
|
|
2767
2718
|
colourBrandingApp: getAppColourFromState(state)
|
|
2768
2719
|
};
|
|
2769
2720
|
};
|
|
2770
|
-
|
|
2721
|
+
const ProfilePic = connect(mapStateToProps$6, {})(ProfilePicComponent);
|
|
2771
2722
|
|
|
2772
2723
|
class Comment extends Component {
|
|
2773
2724
|
renderImage(image) {
|
|
@@ -2790,7 +2741,7 @@ class Comment extends Component {
|
|
|
2790
2741
|
});
|
|
2791
2742
|
}
|
|
2792
2743
|
renderComment() {
|
|
2793
|
-
|
|
2744
|
+
const {
|
|
2794
2745
|
comment
|
|
2795
2746
|
} = this.props;
|
|
2796
2747
|
return /*#__PURE__*/jsxs("div", {
|
|
@@ -2823,23 +2774,21 @@ class Comment extends Component {
|
|
|
2823
2774
|
|
|
2824
2775
|
class CommentSection extends Component {
|
|
2825
2776
|
constructor(props) {
|
|
2826
|
-
var _this;
|
|
2827
2777
|
super(props);
|
|
2828
|
-
_this = this;
|
|
2829
2778
|
_defineProperty(this, "onHandleChange", event => {
|
|
2830
2779
|
var stateChange = {};
|
|
2831
2780
|
stateChange[event.target.getAttribute("id")] = event.target.value;
|
|
2832
2781
|
this.setState(stateChange);
|
|
2833
2782
|
});
|
|
2834
|
-
_defineProperty(this, "onAddComment",
|
|
2835
|
-
|
|
2783
|
+
_defineProperty(this, "onAddComment", async () => {
|
|
2784
|
+
const {
|
|
2836
2785
|
commentInput
|
|
2837
|
-
} =
|
|
2838
|
-
|
|
2786
|
+
} = this.state;
|
|
2787
|
+
this.setState({
|
|
2839
2788
|
commentInput: ""
|
|
2840
2789
|
});
|
|
2841
|
-
|
|
2842
|
-
})
|
|
2790
|
+
this.props.onAddComment(commentInput);
|
|
2791
|
+
});
|
|
2843
2792
|
_defineProperty(this, "getComments", () => {
|
|
2844
2793
|
if (!this.props.onlyParents) {
|
|
2845
2794
|
return this.props.comments;
|
|
@@ -2852,7 +2801,7 @@ class CommentSection extends Component {
|
|
|
2852
2801
|
if (!this.props.onOpenThread) {
|
|
2853
2802
|
return null;
|
|
2854
2803
|
}
|
|
2855
|
-
|
|
2804
|
+
const threadComments = _.filter(this.props.comments, innerC => {
|
|
2856
2805
|
return innerC.ParentId === c.Id;
|
|
2857
2806
|
});
|
|
2858
2807
|
if (_.isEmpty(threadComments)) {
|
|
@@ -2868,7 +2817,7 @@ class CommentSection extends Component {
|
|
|
2868
2817
|
})
|
|
2869
2818
|
});
|
|
2870
2819
|
}
|
|
2871
|
-
|
|
2820
|
+
const profilePics = _.take(_.uniqBy(threadComments, c => c.UserId), 3);
|
|
2872
2821
|
return /*#__PURE__*/jsxs("div", {
|
|
2873
2822
|
className: "comment_reply comment_reply-hasReplies",
|
|
2874
2823
|
children: [profilePics.map(c => {
|
|
@@ -2941,7 +2890,7 @@ class DatePicker extends Component {
|
|
|
2941
2890
|
}
|
|
2942
2891
|
onNewProps(nextProps, forceUpdate) {
|
|
2943
2892
|
if (!!nextProps.shownMonth && nextProps.shownMonth !== this.props.shownMonth) {
|
|
2944
|
-
|
|
2893
|
+
const shownMonth = new Date(nextProps.shownMonth.getFullYear(), nextProps.shownMonth.getMonth() + 1, 0);
|
|
2945
2894
|
this.setState({
|
|
2946
2895
|
shownMonth
|
|
2947
2896
|
});
|
|
@@ -2949,19 +2898,19 @@ class DatePicker extends Component {
|
|
|
2949
2898
|
} else if (this.props.multiple && nextProps.selectedDates !== this.props.selectedDates) {
|
|
2950
2899
|
this.generateGrid(this.state.shownMonth, nextProps.selectedDates);
|
|
2951
2900
|
} else if (forceUpdate || nextProps.selectedDate !== this.props.selectedDate) {
|
|
2952
|
-
|
|
2901
|
+
let dateToUse = nextProps.selectedDate;
|
|
2953
2902
|
if (!(dateToUse instanceof Date)) {
|
|
2954
2903
|
dateToUse = new Date(dateToUse);
|
|
2955
2904
|
}
|
|
2956
2905
|
if (isNaN(dateToUse)) {
|
|
2957
2906
|
dateToUse = new Date();
|
|
2958
2907
|
}
|
|
2959
|
-
|
|
2908
|
+
const shownMonth = this.props.shownMonth ? this.state.shownMonth : dateToUse;
|
|
2960
2909
|
this.setState({
|
|
2961
|
-
shownMonth:
|
|
2910
|
+
shownMonth: shownMonth,
|
|
2962
2911
|
selectedDate: dateToUse
|
|
2963
2912
|
});
|
|
2964
|
-
this.generateGrid(
|
|
2913
|
+
this.generateGrid(shownMonth, dateToUse);
|
|
2965
2914
|
}
|
|
2966
2915
|
}
|
|
2967
2916
|
getDate() {
|
|
@@ -2987,13 +2936,13 @@ class DatePicker extends Component {
|
|
|
2987
2936
|
}
|
|
2988
2937
|
isDateEnabled(date) {
|
|
2989
2938
|
if (this.props.enabledDates) {
|
|
2990
|
-
|
|
2939
|
+
const found = this.props.enabledDates.find(d => moment(d.day).format("YYYYMMDD") === date.format("YYYYMMDD"));
|
|
2991
2940
|
if (found) return found.enabled;
|
|
2992
2941
|
}
|
|
2993
2942
|
return null;
|
|
2994
2943
|
}
|
|
2995
2944
|
changeMonth(change) {
|
|
2996
|
-
|
|
2945
|
+
const newShownDate = new Date(this.state.shownMonth.getFullYear(), this.state.shownMonth.getMonth() + 1 + change, 0);
|
|
2997
2946
|
this.setState({
|
|
2998
2947
|
shownMonth: newShownDate
|
|
2999
2948
|
}, () => {
|
|
@@ -3002,9 +2951,9 @@ class DatePicker extends Component {
|
|
|
3002
2951
|
this.generateGrid(newShownDate);
|
|
3003
2952
|
}
|
|
3004
2953
|
selectRange(date) {
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
2954
|
+
const d1 = moment(this.state.lastSelected, "DD-MM-YYYY");
|
|
2955
|
+
const d2 = moment(date, "DD-MM-YYYY");
|
|
2956
|
+
let startDate, endDate;
|
|
3008
2957
|
if (d1.valueOf() > d2.valueOf()) {
|
|
3009
2958
|
// clicked an earlier day
|
|
3010
2959
|
startDate = moment(d2);
|
|
@@ -3014,7 +2963,7 @@ class DatePicker extends Component {
|
|
|
3014
2963
|
startDate = moment(d1);
|
|
3015
2964
|
endDate = moment(d2);
|
|
3016
2965
|
}
|
|
3017
|
-
|
|
2966
|
+
const dateRange = [startDate.format("DD-MM-YYYY")];
|
|
3018
2967
|
while (startDate.format("DD-MM-YYYY") !== endDate.format("DD-MM-YYYY")) {
|
|
3019
2968
|
startDate.add(1, "d");
|
|
3020
2969
|
dateRange.push(startDate.format("DD-MM-YYYY"));
|
|
@@ -3030,13 +2979,13 @@ class DatePicker extends Component {
|
|
|
3030
2979
|
}));
|
|
3031
2980
|
} else {
|
|
3032
2981
|
// select the range
|
|
3033
|
-
|
|
2982
|
+
const newSelection = [...this.props.selectedDates, ...dateRange];
|
|
3034
2983
|
this.props.selectDate(_.uniq(newSelection));
|
|
3035
2984
|
}
|
|
3036
2985
|
}
|
|
3037
2986
|
selectDate(date, e) {
|
|
3038
|
-
|
|
3039
|
-
|
|
2987
|
+
const enabled = this.isDateEnabled(date);
|
|
2988
|
+
const isBeforeMinDate = this.props.minDate && moment(date).isBefore(this.props.minDate);
|
|
3040
2989
|
console.log("selected a date", {
|
|
3041
2990
|
date,
|
|
3042
2991
|
enabled,
|
|
@@ -3044,14 +2993,14 @@ class DatePicker extends Component {
|
|
|
3044
2993
|
});
|
|
3045
2994
|
if (enabled === false || isBeforeMinDate) return;
|
|
3046
2995
|
if (this.props.multiple) {
|
|
3047
|
-
|
|
2996
|
+
const dateKey = moment(date).format("DD-MM-YYYY");
|
|
3048
2997
|
if (e.shiftKey && this.state.lastSelected && this.state.lastSelected !== dateKey) {
|
|
3049
2998
|
// shift-click to select range
|
|
3050
2999
|
this.selectRange(dateKey);
|
|
3051
3000
|
} else {
|
|
3052
3001
|
// toggle single date
|
|
3053
|
-
|
|
3054
|
-
|
|
3002
|
+
const index = this.props.selectedDates.indexOf(dateKey);
|
|
3003
|
+
const newSelection = [...this.props.selectedDates];
|
|
3055
3004
|
if (index > -1) {
|
|
3056
3005
|
newSelection.splice(index, 1);
|
|
3057
3006
|
} else {
|
|
@@ -3067,16 +3016,16 @@ class DatePicker extends Component {
|
|
|
3067
3016
|
}
|
|
3068
3017
|
}
|
|
3069
3018
|
generateGrid(date, selectedDate) {
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3019
|
+
const month = moment(date);
|
|
3020
|
+
let dateToTarget = moment(date).endOf("month");
|
|
3021
|
+
let dateToModify = moment(date).startOf("month");
|
|
3022
|
+
const selectedDateToUse = this.props.multiple ? selectedDate || this.props.selectedDates || [] : moment(selectedDate || this.state.selectedDate);
|
|
3074
3023
|
|
|
3075
3024
|
// set dateToModify to be Sunday of that week
|
|
3076
3025
|
while (dateToModify.day() !== 0) {
|
|
3077
3026
|
dateToModify = dateToModify.add(-1, "day");
|
|
3078
3027
|
}
|
|
3079
|
-
|
|
3028
|
+
const rows = [[]];
|
|
3080
3029
|
while (dateToTarget.day() !== 6) {
|
|
3081
3030
|
dateToTarget = dateToTarget.add(1, "day");
|
|
3082
3031
|
}
|
|
@@ -3087,7 +3036,7 @@ class DatePicker extends Component {
|
|
|
3087
3036
|
// week has filled - add new row
|
|
3088
3037
|
rows.push([]);
|
|
3089
3038
|
}
|
|
3090
|
-
|
|
3039
|
+
const thisDate = moment(dateToModify);
|
|
3091
3040
|
rows[rows.length - 1].push({
|
|
3092
3041
|
date: thisDate,
|
|
3093
3042
|
dateKey: thisDate.format("DD-MM-YYYY"),
|
|
@@ -3110,7 +3059,7 @@ class DatePicker extends Component {
|
|
|
3110
3059
|
return /*#__PURE__*/jsx("div", {
|
|
3111
3060
|
className: "datepicker__row marginTop-8",
|
|
3112
3061
|
children: row.map(date => {
|
|
3113
|
-
|
|
3062
|
+
let classes = "datepicker__date";
|
|
3114
3063
|
if (date.isFaded) {
|
|
3115
3064
|
classes += " datepicker__date--faded";
|
|
3116
3065
|
}
|
|
@@ -3210,21 +3159,21 @@ class DatePicker extends Component {
|
|
|
3210
3159
|
}
|
|
3211
3160
|
|
|
3212
3161
|
function DurationInput(_ref) {
|
|
3213
|
-
|
|
3162
|
+
let {
|
|
3214
3163
|
handleChange,
|
|
3215
3164
|
label,
|
|
3216
3165
|
value,
|
|
3217
3166
|
className,
|
|
3218
3167
|
labelWidth
|
|
3219
3168
|
} = _ref;
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3169
|
+
const hours = Math.floor(value / 60);
|
|
3170
|
+
const minutes = value % 60;
|
|
3171
|
+
const handleHourChange = event => {
|
|
3172
|
+
const newHours = Math.max(0, Math.min(+event.target.value, 24));
|
|
3224
3173
|
handleChange(newHours * 60 + minutes);
|
|
3225
3174
|
};
|
|
3226
|
-
|
|
3227
|
-
|
|
3175
|
+
const handleMinuteChange = event => {
|
|
3176
|
+
const newMinutes = Math.max(0, Math.min(+event.target.value, 59));
|
|
3228
3177
|
handleChange(hours * 60 + newMinutes);
|
|
3229
3178
|
};
|
|
3230
3179
|
return /*#__PURE__*/jsxs("div", {
|
|
@@ -3273,15 +3222,13 @@ function DurationInput(_ref) {
|
|
|
3273
3222
|
|
|
3274
3223
|
function ownKeys$i(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; }
|
|
3275
3224
|
function _objectSpread$i(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$i(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$i(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3276
|
-
|
|
3225
|
+
const DEFAULT_INPUT$1 = {
|
|
3277
3226
|
uploadingFile: false,
|
|
3278
3227
|
value: ""
|
|
3279
3228
|
};
|
|
3280
3229
|
class FileInputComponent extends Component {
|
|
3281
3230
|
constructor() {
|
|
3282
|
-
var _this;
|
|
3283
3231
|
super(...arguments);
|
|
3284
|
-
_this = this;
|
|
3285
3232
|
_defineProperty(this, "state", {
|
|
3286
3233
|
inputs: [{
|
|
3287
3234
|
uploadingFile: false,
|
|
@@ -3293,7 +3240,7 @@ class FileInputComponent extends Component {
|
|
|
3293
3240
|
return this.props.accept;
|
|
3294
3241
|
}
|
|
3295
3242
|
if (typeof this.props.accept === "string") {
|
|
3296
|
-
|
|
3243
|
+
const accept = {
|
|
3297
3244
|
[this.props.accept]: [".".concat(_.last(this.props.accept.split("/")))]
|
|
3298
3245
|
};
|
|
3299
3246
|
return accept;
|
|
@@ -3305,12 +3252,12 @@ class FileInputComponent extends Component {
|
|
|
3305
3252
|
return;
|
|
3306
3253
|
}
|
|
3307
3254
|
if (!this.props.multiple) {
|
|
3308
|
-
|
|
3255
|
+
const file = _.find(inputs, i => {
|
|
3309
3256
|
return !i.uploadingFile && !_.isEmpty(i.value);
|
|
3310
3257
|
});
|
|
3311
3258
|
this.props.refreshCallback(file ? file.value : undefined);
|
|
3312
3259
|
} else {
|
|
3313
|
-
|
|
3260
|
+
const files = _.filter(inputs, i => {
|
|
3314
3261
|
return !i.uploadingFile && !_.isEmpty(i.value);
|
|
3315
3262
|
}).map(i => {
|
|
3316
3263
|
return i.value;
|
|
@@ -3320,18 +3267,18 @@ class FileInputComponent extends Component {
|
|
|
3320
3267
|
});
|
|
3321
3268
|
_defineProperty(this, "onDrop", files => {
|
|
3322
3269
|
if (this.props.multiple) {
|
|
3323
|
-
|
|
3270
|
+
const newInputs = _.clone(this.state.inputs);
|
|
3324
3271
|
files.forEach(file => {
|
|
3325
3272
|
if (this.props.limit && newInputs.length === this.props.limit) {
|
|
3326
3273
|
// hit limit - replace last input if it's empty
|
|
3327
3274
|
if (_.isEmpty(newInputs[newInputs.length - 1].value)) {
|
|
3328
|
-
|
|
3275
|
+
const newInput = newInputs[newInputs.length - 1];
|
|
3329
3276
|
this.handleFile(newInput, file);
|
|
3330
3277
|
}
|
|
3331
3278
|
} else {
|
|
3332
|
-
|
|
3333
|
-
newInputs.splice(newInputs.length - 1, 0,
|
|
3334
|
-
this.handleFile(
|
|
3279
|
+
const newInput = _objectSpread$i({}, DEFAULT_INPUT$1);
|
|
3280
|
+
newInputs.splice(newInputs.length - 1, 0, newInput);
|
|
3281
|
+
this.handleFile(newInput, file);
|
|
3335
3282
|
}
|
|
3336
3283
|
});
|
|
3337
3284
|
this.setState({
|
|
@@ -3342,37 +3289,32 @@ class FileInputComponent extends Component {
|
|
|
3342
3289
|
this.handleFile(this.state.inputs[0], files[0]);
|
|
3343
3290
|
}
|
|
3344
3291
|
});
|
|
3345
|
-
_defineProperty(this, "handleFile",
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
inputs: newInputs
|
|
3354
|
-
});
|
|
3355
|
-
_this.checkRefreshCallback(newInputs);
|
|
3356
|
-
if (_this.props.handleFile) {
|
|
3357
|
-
yield _this.props.handleFile(file, newInputs);
|
|
3358
|
-
_this.checkSetDisplayValue(input, "");
|
|
3359
|
-
} else {
|
|
3360
|
-
try {
|
|
3361
|
-
var uploadFile = file;
|
|
3362
|
-
var url = yield fileActions.uploadMediaAsync(uploadFile, uploadFile.name);
|
|
3363
|
-
_this.checkSetDisplayValue(input, url);
|
|
3364
|
-
} catch (error) {
|
|
3365
|
-
console.log("handleFile error", error);
|
|
3366
|
-
_this.setState({
|
|
3367
|
-
uploadingFile: false
|
|
3368
|
-
});
|
|
3369
|
-
}
|
|
3370
|
-
}
|
|
3292
|
+
_defineProperty(this, "handleFile", async (input, file) => {
|
|
3293
|
+
if (!file || input.uploadingFile) {
|
|
3294
|
+
return;
|
|
3295
|
+
}
|
|
3296
|
+
input.uploadingFile = true;
|
|
3297
|
+
const newInputs = _.clone(this.state.inputs);
|
|
3298
|
+
this.setState({
|
|
3299
|
+
inputs: newInputs
|
|
3371
3300
|
});
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3301
|
+
this.checkRefreshCallback(newInputs);
|
|
3302
|
+
if (this.props.handleFile) {
|
|
3303
|
+
await this.props.handleFile(file, newInputs);
|
|
3304
|
+
this.checkSetDisplayValue(input, "");
|
|
3305
|
+
} else {
|
|
3306
|
+
try {
|
|
3307
|
+
let uploadFile = file;
|
|
3308
|
+
const url = await fileActions.uploadMediaAsync(uploadFile, uploadFile.name);
|
|
3309
|
+
this.checkSetDisplayValue(input, url);
|
|
3310
|
+
} catch (error) {
|
|
3311
|
+
console.log("handleFile error", error);
|
|
3312
|
+
this.setState({
|
|
3313
|
+
uploadingFile: false
|
|
3314
|
+
});
|
|
3315
|
+
}
|
|
3316
|
+
}
|
|
3317
|
+
});
|
|
3376
3318
|
}
|
|
3377
3319
|
componentDidMount() {
|
|
3378
3320
|
setTimeout(() => {
|
|
@@ -3398,7 +3340,7 @@ class FileInputComponent extends Component {
|
|
|
3398
3340
|
}]
|
|
3399
3341
|
});
|
|
3400
3342
|
} else {
|
|
3401
|
-
|
|
3343
|
+
const inputs = [];
|
|
3402
3344
|
_.forEach(val, str => {
|
|
3403
3345
|
inputs.push({
|
|
3404
3346
|
uploadingImage: false,
|
|
@@ -3412,7 +3354,7 @@ class FileInputComponent extends Component {
|
|
|
3412
3354
|
}
|
|
3413
3355
|
}
|
|
3414
3356
|
getClassNames(input, inputsLength) {
|
|
3415
|
-
|
|
3357
|
+
let classes = "clearfix imageInput";
|
|
3416
3358
|
if (input.uploadingFile) {
|
|
3417
3359
|
classes += " imageInput-uploading";
|
|
3418
3360
|
} else if (!_.isEmpty(input.value) && !this.props.onlyAllowUpload) {
|
|
@@ -3435,16 +3377,16 @@ class FileInputComponent extends Component {
|
|
|
3435
3377
|
checkSetDisplayValue(input, value) {
|
|
3436
3378
|
input.value = value;
|
|
3437
3379
|
input.uploadingFile = false;
|
|
3438
|
-
|
|
3380
|
+
const newInputs = _.clone(this.state.inputs);
|
|
3439
3381
|
this.setState({
|
|
3440
3382
|
inputs: newInputs
|
|
3441
3383
|
});
|
|
3442
3384
|
this.checkRefreshCallback(newInputs);
|
|
3443
3385
|
}
|
|
3444
3386
|
removeFile(input) {
|
|
3445
|
-
|
|
3387
|
+
const newState = {};
|
|
3446
3388
|
input.value = "";
|
|
3447
|
-
|
|
3389
|
+
const newInputs = _.clone(this.state.inputs);
|
|
3448
3390
|
if (newInputs.length > 1) {
|
|
3449
3391
|
newInputs.splice(newInputs.indexOf(input), 1);
|
|
3450
3392
|
if (newInputs.length === this.props.limit - 1 && !_.isEmpty(newInputs[newInputs.length - 1].value)) {
|
|
@@ -3460,7 +3402,7 @@ class FileInputComponent extends Component {
|
|
|
3460
3402
|
}
|
|
3461
3403
|
}
|
|
3462
3404
|
renderInput(input, index, inputsLength) {
|
|
3463
|
-
|
|
3405
|
+
const renderContent = () => {
|
|
3464
3406
|
if (this.props.onlyAllowUpload) {
|
|
3465
3407
|
return null;
|
|
3466
3408
|
}
|
|
@@ -3484,7 +3426,7 @@ class FileInputComponent extends Component {
|
|
|
3484
3426
|
accept: this.getAccept(),
|
|
3485
3427
|
onDrop: files => this.onDrop(files, true),
|
|
3486
3428
|
children: state => {
|
|
3487
|
-
|
|
3429
|
+
const {
|
|
3488
3430
|
getRootProps,
|
|
3489
3431
|
getInputProps
|
|
3490
3432
|
} = state;
|
|
@@ -3509,7 +3451,7 @@ class FileInputComponent extends Component {
|
|
|
3509
3451
|
iconStyle: _objectSpread$i({}, this.props.style)
|
|
3510
3452
|
});
|
|
3511
3453
|
};
|
|
3512
|
-
|
|
3454
|
+
const renderRemove = () => {
|
|
3513
3455
|
return !this.props.disableRemove && !this.props.disabled && (this.props.simpleStyle ? /*#__PURE__*/jsx(Icon$1, {
|
|
3514
3456
|
icon: "xmark",
|
|
3515
3457
|
className: "imageInput_removeIcon",
|
|
@@ -3520,7 +3462,7 @@ class FileInputComponent extends Component {
|
|
|
3520
3462
|
children: "remove"
|
|
3521
3463
|
}));
|
|
3522
3464
|
};
|
|
3523
|
-
|
|
3465
|
+
const renderDownload = () => {
|
|
3524
3466
|
if (this.props.noDownload) return null;
|
|
3525
3467
|
return /*#__PURE__*/jsx("a", {
|
|
3526
3468
|
href: input.value,
|
|
@@ -3540,7 +3482,7 @@ class FileInputComponent extends Component {
|
|
|
3540
3482
|
accept: this.getAccept(),
|
|
3541
3483
|
onDrop: this.onDrop,
|
|
3542
3484
|
children: state => {
|
|
3543
|
-
|
|
3485
|
+
const {
|
|
3544
3486
|
getRootProps,
|
|
3545
3487
|
getInputProps,
|
|
3546
3488
|
isDragActive
|
|
@@ -3598,10 +3540,10 @@ class FileInputComponent extends Component {
|
|
|
3598
3540
|
});
|
|
3599
3541
|
}
|
|
3600
3542
|
}
|
|
3601
|
-
|
|
3543
|
+
const mapStateToProps$5 = () => {
|
|
3602
3544
|
return {};
|
|
3603
3545
|
};
|
|
3604
|
-
|
|
3546
|
+
const FileInput = connect(mapStateToProps$5, {}, null, {
|
|
3605
3547
|
forwardRef: true
|
|
3606
3548
|
})(FileInputComponent);
|
|
3607
3549
|
|
|
@@ -3629,7 +3571,7 @@ class GenericInput extends Component {
|
|
|
3629
3571
|
return !_.isUndefined(this.props.showError) && (typeof this.props.showError === "function" && this.props.showError() || typeof this.props.showError === "boolean" && this.props.showError);
|
|
3630
3572
|
}
|
|
3631
3573
|
getClassNames() {
|
|
3632
|
-
|
|
3574
|
+
let string = "".concat(this.props.className, " genericInputContainer");
|
|
3633
3575
|
if (!_.isUndefined(this.props.disabled) && this.props.disabled) {
|
|
3634
3576
|
string += " genericInput-disabled";
|
|
3635
3577
|
}
|
|
@@ -3648,7 +3590,7 @@ class GenericInput extends Component {
|
|
|
3648
3590
|
return string;
|
|
3649
3591
|
}
|
|
3650
3592
|
getLabelStyle() {
|
|
3651
|
-
|
|
3593
|
+
const style = {};
|
|
3652
3594
|
if (_.isEmpty(this.props.value) && !this.props.alwaysShowLabel) {
|
|
3653
3595
|
style.opacity = 0;
|
|
3654
3596
|
}
|
|
@@ -3755,7 +3697,7 @@ class GenericInput extends Component {
|
|
|
3755
3697
|
});
|
|
3756
3698
|
}
|
|
3757
3699
|
}
|
|
3758
|
-
|
|
3700
|
+
const styles$8 = {
|
|
3759
3701
|
row: {
|
|
3760
3702
|
display: "flex",
|
|
3761
3703
|
flexDirection: "row",
|
|
@@ -3846,13 +3788,13 @@ class Header extends Component {
|
|
|
3846
3788
|
return this.renderHeader();
|
|
3847
3789
|
}
|
|
3848
3790
|
}
|
|
3849
|
-
|
|
3791
|
+
const mapStateToProps$4 = state => {
|
|
3850
3792
|
return {
|
|
3851
3793
|
auth: state.auth,
|
|
3852
3794
|
isSideMenuOpen: state.nav.isSideMenuOpen
|
|
3853
3795
|
};
|
|
3854
3796
|
};
|
|
3855
|
-
|
|
3797
|
+
let exportObj$4 = connect(mapStateToProps$4, {
|
|
3856
3798
|
setNavData
|
|
3857
3799
|
})(withRouter(Header));
|
|
3858
3800
|
|
|
@@ -3882,7 +3824,7 @@ class SideNavItem extends Component {
|
|
|
3882
3824
|
}
|
|
3883
3825
|
}
|
|
3884
3826
|
getClassNames() {
|
|
3885
|
-
|
|
3827
|
+
let result = "";
|
|
3886
3828
|
if (this.props.className) {
|
|
3887
3829
|
result += " ".concat(this.props.className);
|
|
3888
3830
|
}
|
|
@@ -3937,7 +3879,7 @@ class SideNavItem extends Component {
|
|
|
3937
3879
|
});
|
|
3938
3880
|
}
|
|
3939
3881
|
}
|
|
3940
|
-
|
|
3882
|
+
const styles$7 = {
|
|
3941
3883
|
section: {
|
|
3942
3884
|
display: "flex",
|
|
3943
3885
|
alignItems: "center",
|
|
@@ -3949,7 +3891,7 @@ var styles$7 = {
|
|
|
3949
3891
|
borderRadius: 5
|
|
3950
3892
|
}
|
|
3951
3893
|
};
|
|
3952
|
-
|
|
3894
|
+
let exportObj$3 = connect(null, {})(withRouter(SideNavItem));
|
|
3953
3895
|
|
|
3954
3896
|
function ownKeys$f(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; }
|
|
3955
3897
|
function _objectSpread$f(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$f(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$f(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -3958,11 +3900,11 @@ class HubSidebar extends PureComponent {
|
|
|
3958
3900
|
super(props);
|
|
3959
3901
|
_defineProperty(this, "renderHelpGuide", () => {
|
|
3960
3902
|
if (!this.props.helpGuide) return null;
|
|
3961
|
-
|
|
3903
|
+
const {
|
|
3962
3904
|
text,
|
|
3963
3905
|
url
|
|
3964
3906
|
} = this.props.helpGuide;
|
|
3965
|
-
|
|
3907
|
+
const onHelpGuidePress = () => {
|
|
3966
3908
|
if (!url) return;
|
|
3967
3909
|
window.open(url, "_blank");
|
|
3968
3910
|
};
|
|
@@ -4063,13 +4005,13 @@ class HubSidebar extends PureComponent {
|
|
|
4063
4005
|
});
|
|
4064
4006
|
}
|
|
4065
4007
|
}
|
|
4066
|
-
|
|
4008
|
+
const mapStateToProps$3 = state => {
|
|
4067
4009
|
return {
|
|
4068
4010
|
auth: state.auth,
|
|
4069
4011
|
isSideMenuOpen: state.nav.isSideMenuOpen
|
|
4070
4012
|
};
|
|
4071
4013
|
};
|
|
4072
|
-
|
|
4014
|
+
let exportObj$2 = connect(mapStateToProps$3, {
|
|
4073
4015
|
setNavData
|
|
4074
4016
|
})(HubSidebar);
|
|
4075
4017
|
|
|
@@ -4177,7 +4119,7 @@ class Popup extends Component {
|
|
|
4177
4119
|
|
|
4178
4120
|
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; }
|
|
4179
4121
|
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; }
|
|
4180
|
-
|
|
4122
|
+
const DEFAULT_INPUT = {
|
|
4181
4123
|
uploadingImage: false,
|
|
4182
4124
|
value: "",
|
|
4183
4125
|
displayValue: ""
|
|
@@ -4208,7 +4150,7 @@ class ImageInputComponent extends Component {
|
|
|
4208
4150
|
saveErrorMessage: ""
|
|
4209
4151
|
});
|
|
4210
4152
|
_defineProperty(this, "getAccept", () => {
|
|
4211
|
-
|
|
4153
|
+
const accept = {
|
|
4212
4154
|
"image/*": [".jpeg", ".png"]
|
|
4213
4155
|
};
|
|
4214
4156
|
if (this.props.allowVideo) {
|
|
@@ -4216,21 +4158,21 @@ class ImageInputComponent extends Component {
|
|
|
4216
4158
|
}
|
|
4217
4159
|
return accept;
|
|
4218
4160
|
});
|
|
4219
|
-
_defineProperty(this, "refreshFolders",
|
|
4220
|
-
|
|
4161
|
+
_defineProperty(this, "refreshFolders", async () => {
|
|
4162
|
+
const res = await fileActions.getMediaFolders(this.props.auth.site);
|
|
4221
4163
|
return res.data;
|
|
4222
|
-
})
|
|
4164
|
+
});
|
|
4223
4165
|
_defineProperty(this, "checkRefreshCallback", inputs => {
|
|
4224
4166
|
if (_.isUndefined(this.props.refreshCallback)) {
|
|
4225
4167
|
return;
|
|
4226
4168
|
}
|
|
4227
4169
|
if (!this.props.multiple) {
|
|
4228
|
-
|
|
4170
|
+
const image = _.find(inputs, i => {
|
|
4229
4171
|
return !i.uploadingImage && !_.isEmpty(i.value);
|
|
4230
4172
|
});
|
|
4231
4173
|
this.props.refreshCallback(image ? image.value : undefined);
|
|
4232
4174
|
} else {
|
|
4233
|
-
|
|
4175
|
+
const images = _.filter(inputs, i => {
|
|
4234
4176
|
return !i.uploadingImage && !_.isEmpty(i.value);
|
|
4235
4177
|
}).map(i => {
|
|
4236
4178
|
return i.value;
|
|
@@ -4240,8 +4182,8 @@ class ImageInputComponent extends Component {
|
|
|
4240
4182
|
});
|
|
4241
4183
|
_defineProperty(this, "parseImagesArray", images => {
|
|
4242
4184
|
return _.map(images, f => {
|
|
4243
|
-
|
|
4244
|
-
|
|
4185
|
+
const uri = typeof f === "string" ? f : f.uri;
|
|
4186
|
+
const image1400 = get1400(uri);
|
|
4245
4187
|
return {
|
|
4246
4188
|
Value: uri,
|
|
4247
4189
|
Thumb: getThumb300(uri),
|
|
@@ -4254,7 +4196,7 @@ class ImageInputComponent extends Component {
|
|
|
4254
4196
|
this.setState({
|
|
4255
4197
|
addFolderOpen: true
|
|
4256
4198
|
}, () => {
|
|
4257
|
-
|
|
4199
|
+
const input = document.getElementById("addFolderInput");
|
|
4258
4200
|
if (input) input.focus();
|
|
4259
4201
|
});
|
|
4260
4202
|
});
|
|
@@ -4269,22 +4211,22 @@ class ImageInputComponent extends Component {
|
|
|
4269
4211
|
_defineProperty(this, "saveFolder", () => {
|
|
4270
4212
|
this.setState({
|
|
4271
4213
|
addingFolder: true
|
|
4272
|
-
},
|
|
4214
|
+
}, async () => {
|
|
4273
4215
|
try {
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4216
|
+
await fileActions.addMediaFolder(this.props.auth.site, this.state.addFolderInput);
|
|
4217
|
+
const folders = await this.refreshFolders();
|
|
4218
|
+
this.setState(_objectSpread$d({
|
|
4277
4219
|
addingFolder: false,
|
|
4278
4220
|
folders
|
|
4279
|
-
},
|
|
4221
|
+
}, this.cancelAddStates));
|
|
4280
4222
|
} catch (error) {
|
|
4281
4223
|
console.log("addFolder - error", error);
|
|
4282
|
-
|
|
4224
|
+
this.setState({
|
|
4283
4225
|
addingFolder: false,
|
|
4284
4226
|
saveErrorMessage: getApiError(error).message
|
|
4285
4227
|
});
|
|
4286
4228
|
}
|
|
4287
|
-
})
|
|
4229
|
+
});
|
|
4288
4230
|
});
|
|
4289
4231
|
_defineProperty(this, "isStockFolder", folder => {
|
|
4290
4232
|
if (!folder) folder = this.state.selectedFolder;
|
|
@@ -4305,22 +4247,22 @@ class ImageInputComponent extends Component {
|
|
|
4305
4247
|
});
|
|
4306
4248
|
});
|
|
4307
4249
|
_defineProperty(this, "onDrop", function (files) {
|
|
4308
|
-
|
|
4250
|
+
let fromLibrary = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
4309
4251
|
if (_this.props.multiple) {
|
|
4310
|
-
|
|
4252
|
+
const newInputs = _.clone(_this.state.inputs);
|
|
4311
4253
|
files.forEach(file => {
|
|
4312
4254
|
if (_this.props.limit && newInputs.length === _this.props.limit) {
|
|
4313
4255
|
// hit limit - replace last input if it's empty
|
|
4314
4256
|
if (_.isEmpty(newInputs[newInputs.length - 1].value)) {
|
|
4315
|
-
|
|
4257
|
+
const newInput = newInputs[newInputs.length - 1];
|
|
4316
4258
|
_this.handleFile(newInput, file);
|
|
4317
4259
|
}
|
|
4318
4260
|
} else {
|
|
4319
|
-
|
|
4261
|
+
const newInput = _objectSpread$d(_objectSpread$d({}, DEFAULT_INPUT), {}, {
|
|
4320
4262
|
fromLibrary
|
|
4321
4263
|
});
|
|
4322
|
-
newInputs.splice(newInputs.length - 1, 0,
|
|
4323
|
-
_this.handleFile(
|
|
4264
|
+
newInputs.splice(newInputs.length - 1, 0, newInput);
|
|
4265
|
+
_this.handleFile(newInput, file);
|
|
4324
4266
|
}
|
|
4325
4267
|
});
|
|
4326
4268
|
_this.setState({
|
|
@@ -4331,35 +4273,30 @@ class ImageInputComponent extends Component {
|
|
|
4331
4273
|
_this.handleFile(_this.state.inputs[0], files[0]);
|
|
4332
4274
|
}
|
|
4333
4275
|
});
|
|
4334
|
-
_defineProperty(this, "handleFile",
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4276
|
+
_defineProperty(this, "handleFile", async (input, file) => {
|
|
4277
|
+
if (!file || input.uploadingImage) {
|
|
4278
|
+
return;
|
|
4279
|
+
}
|
|
4280
|
+
input.uploadingImage = true;
|
|
4281
|
+
const newInputs = _.clone(this.state.inputs);
|
|
4282
|
+
this.setState({
|
|
4283
|
+
inputs: newInputs
|
|
4284
|
+
});
|
|
4285
|
+
this.checkRefreshCallback(newInputs);
|
|
4286
|
+
try {
|
|
4287
|
+
let uploadFile = file;
|
|
4288
|
+
if (!isVideo(file.name)) {
|
|
4289
|
+
uploadFile = await fileActions.compressImage(file, this.props.maxSize || 1400, this.props.quality || 0.8, this.props.noCompress || false);
|
|
4338
4290
|
}
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4291
|
+
const url = await fileActions.uploadMediaAsync(uploadFile, uploadFile.name);
|
|
4292
|
+
this.checkSetDisplayValue(input, url);
|
|
4293
|
+
} catch (error) {
|
|
4294
|
+
console.log("handleFile error", error);
|
|
4295
|
+
this.setState({
|
|
4296
|
+
uploadingImage: false
|
|
4343
4297
|
});
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
var uploadFile = file;
|
|
4347
|
-
if (!isVideo(file.name)) {
|
|
4348
|
-
uploadFile = yield fileActions.compressImage(file, _this.props.maxSize || 1400, _this.props.quality || 0.8, _this.props.noCompress || false);
|
|
4349
|
-
}
|
|
4350
|
-
var url = yield fileActions.uploadMediaAsync(uploadFile, uploadFile.name);
|
|
4351
|
-
_this.checkSetDisplayValue(input, url);
|
|
4352
|
-
} catch (error) {
|
|
4353
|
-
console.log("handleFile error", error);
|
|
4354
|
-
_this.setState({
|
|
4355
|
-
uploadingImage: false
|
|
4356
|
-
});
|
|
4357
|
-
}
|
|
4358
|
-
});
|
|
4359
|
-
return function (_x, _x2) {
|
|
4360
|
-
return _ref3.apply(this, arguments);
|
|
4361
|
-
};
|
|
4362
|
-
}());
|
|
4298
|
+
}
|
|
4299
|
+
});
|
|
4363
4300
|
_defineProperty(this, "handleChange", event => {
|
|
4364
4301
|
var stateChange = {};
|
|
4365
4302
|
stateChange[event.target.getAttribute("id")] = event.target.value;
|
|
@@ -4368,63 +4305,63 @@ class ImageInputComponent extends Component {
|
|
|
4368
4305
|
_defineProperty(this, "deleteFolder", (event, folder) => {
|
|
4369
4306
|
event.stopPropagation();
|
|
4370
4307
|
if (window.confirm("Are you sure you want to delete ".concat(folder.Name, "?"))) {
|
|
4371
|
-
|
|
4308
|
+
const deletingFolder = _objectSpread$d({}, this.state.deletingFolder);
|
|
4372
4309
|
deletingFolder[folder.RowId] = true;
|
|
4373
4310
|
this.setState(_objectSpread$d({
|
|
4374
4311
|
deletingFolder: _.clone(deletingFolder)
|
|
4375
|
-
}, this.cancelAddStates),
|
|
4312
|
+
}, this.cancelAddStates), async () => {
|
|
4376
4313
|
try {
|
|
4377
|
-
|
|
4378
|
-
|
|
4314
|
+
await fileActions.deleteMediaFolder(folder.RowId, this.props.auth.site);
|
|
4315
|
+
const folders = await this.refreshFolders();
|
|
4379
4316
|
deletingFolder[folder.RowId] = false;
|
|
4380
|
-
|
|
4317
|
+
this.setState({
|
|
4381
4318
|
deletingFolder: _.clone(deletingFolder),
|
|
4382
4319
|
folders
|
|
4383
4320
|
});
|
|
4384
4321
|
} catch (error) {
|
|
4385
4322
|
console.log("addFolder - error", getApiError(error));
|
|
4386
4323
|
deletingFolder[folder.RowId] = false;
|
|
4387
|
-
|
|
4324
|
+
this.setState({
|
|
4388
4325
|
deletingFolder: _.clone(deletingFolder)
|
|
4389
4326
|
});
|
|
4390
4327
|
}
|
|
4391
|
-
})
|
|
4328
|
+
});
|
|
4392
4329
|
}
|
|
4393
4330
|
});
|
|
4394
4331
|
_defineProperty(this, "deleteImage", (event, image) => {
|
|
4395
4332
|
if (window.confirm("Are you sure you want to delete the image?")) {
|
|
4396
4333
|
// Unselect the image first if selected
|
|
4397
4334
|
if (image.Selected) this.toggleLibraryItem(image);
|
|
4398
|
-
|
|
4335
|
+
const deletingImage = _objectSpread$d({}, this.state.deletingImage);
|
|
4399
4336
|
deletingImage[image.Value] = true;
|
|
4400
4337
|
this.setState({
|
|
4401
4338
|
deletingImage: _.clone(deletingImage)
|
|
4402
|
-
},
|
|
4339
|
+
}, async () => {
|
|
4403
4340
|
try {
|
|
4404
|
-
|
|
4341
|
+
const {
|
|
4405
4342
|
selectedFolder
|
|
4406
|
-
} =
|
|
4407
|
-
|
|
4343
|
+
} = this.state;
|
|
4344
|
+
const {
|
|
4408
4345
|
RowId,
|
|
4409
4346
|
Images
|
|
4410
4347
|
} = selectedFolder;
|
|
4411
|
-
|
|
4412
|
-
|
|
4348
|
+
await fileActions.deleteImagesFromFolder(RowId, this.props.auth.site, [image.Value]);
|
|
4349
|
+
const images = Images.filter(i => i.uri !== image.Value);
|
|
4413
4350
|
selectedFolder.Images = images;
|
|
4414
|
-
selectedFolder.parsedImages =
|
|
4351
|
+
selectedFolder.parsedImages = this.parseImagesArray(images);
|
|
4415
4352
|
deletingImage[image.Value] = false;
|
|
4416
|
-
|
|
4353
|
+
this.setState({
|
|
4417
4354
|
deletingImage: _.clone(deletingImage),
|
|
4418
4355
|
selectedFolder: _.clone(selectedFolder)
|
|
4419
4356
|
});
|
|
4420
4357
|
} catch (error) {
|
|
4421
4358
|
console.log("deleteImage - error", getApiError(error));
|
|
4422
4359
|
deletingImage[image.Value] = false;
|
|
4423
|
-
|
|
4360
|
+
this.setState({
|
|
4424
4361
|
deletingImage: _.clone(deletingImage)
|
|
4425
4362
|
});
|
|
4426
4363
|
}
|
|
4427
|
-
})
|
|
4364
|
+
});
|
|
4428
4365
|
}
|
|
4429
4366
|
});
|
|
4430
4367
|
_defineProperty(this, "canManageLibrary", () => {
|
|
@@ -4477,7 +4414,7 @@ class ImageInputComponent extends Component {
|
|
|
4477
4414
|
}]
|
|
4478
4415
|
});
|
|
4479
4416
|
} else {
|
|
4480
|
-
|
|
4417
|
+
const inputs = [];
|
|
4481
4418
|
_.forEach(val, str => {
|
|
4482
4419
|
inputs.push({
|
|
4483
4420
|
uploadingImage: false,
|
|
@@ -4495,7 +4432,7 @@ class ImageInputComponent extends Component {
|
|
|
4495
4432
|
if (_.isEmpty(displayValue)) {
|
|
4496
4433
|
return null;
|
|
4497
4434
|
}
|
|
4498
|
-
|
|
4435
|
+
const image = isVideo(displayValue) ? get1400(displayValue) : displayValue;
|
|
4499
4436
|
if (this.props.noCompress) {
|
|
4500
4437
|
return {
|
|
4501
4438
|
backgroundImage: "url(".concat(image, ")"),
|
|
@@ -4507,7 +4444,7 @@ class ImageInputComponent extends Component {
|
|
|
4507
4444
|
};
|
|
4508
4445
|
}
|
|
4509
4446
|
getContainerClasses() {
|
|
4510
|
-
|
|
4447
|
+
let result = this.props.className || "";
|
|
4511
4448
|
if (this.props.noMenu) {
|
|
4512
4449
|
result += " imageInputOuter-noMenu";
|
|
4513
4450
|
}
|
|
@@ -4520,7 +4457,7 @@ class ImageInputComponent extends Component {
|
|
|
4520
4457
|
return result;
|
|
4521
4458
|
}
|
|
4522
4459
|
getClassNames(input, inputsLength) {
|
|
4523
|
-
|
|
4460
|
+
let classes = "imageInput";
|
|
4524
4461
|
if (input.uploadingImage) {
|
|
4525
4462
|
classes += " imageInput-uploading";
|
|
4526
4463
|
} else if (!_.isEmpty(input.value) && !this.props.onlyAllowUpload) {
|
|
@@ -4538,47 +4475,45 @@ class ImageInputComponent extends Component {
|
|
|
4538
4475
|
return "";
|
|
4539
4476
|
}
|
|
4540
4477
|
getFolders() {
|
|
4541
|
-
var _this2 = this;
|
|
4542
4478
|
this.setState({
|
|
4543
4479
|
loadingFolders: true
|
|
4544
|
-
},
|
|
4480
|
+
}, async () => {
|
|
4545
4481
|
try {
|
|
4546
|
-
|
|
4547
|
-
|
|
4482
|
+
const folders = await this.refreshFolders();
|
|
4483
|
+
this.setState({
|
|
4548
4484
|
loadingFolders: false,
|
|
4549
4485
|
folders
|
|
4550
4486
|
});
|
|
4551
4487
|
} catch (error) {
|
|
4552
4488
|
console.log("getFolders - error", error);
|
|
4553
|
-
|
|
4489
|
+
this.setState({
|
|
4554
4490
|
loadingFolders: false
|
|
4555
4491
|
});
|
|
4556
4492
|
}
|
|
4557
|
-
})
|
|
4493
|
+
});
|
|
4558
4494
|
}
|
|
4559
4495
|
getLibrary() {
|
|
4560
|
-
var _this3 = this;
|
|
4561
4496
|
if (this.state.libraryLoadTriggered) return;
|
|
4562
4497
|
this.setState({
|
|
4563
4498
|
libraryLoadTriggered: true
|
|
4564
|
-
},
|
|
4499
|
+
}, async () => {
|
|
4565
4500
|
try {
|
|
4566
|
-
|
|
4501
|
+
const res = await fileActions.getMediaLibrary();
|
|
4567
4502
|
// console.log('getLibrary', res.data);
|
|
4568
|
-
|
|
4503
|
+
this.setState({
|
|
4569
4504
|
libraryLoaded: true,
|
|
4570
|
-
imageLibrary:
|
|
4505
|
+
imageLibrary: this.parseImagesArray(res.data)
|
|
4571
4506
|
});
|
|
4572
4507
|
} catch (error) {
|
|
4573
4508
|
console.log("getLibrary - error", error);
|
|
4574
4509
|
}
|
|
4575
|
-
})
|
|
4510
|
+
});
|
|
4576
4511
|
}
|
|
4577
4512
|
toggleLibraryItem(image) {
|
|
4578
|
-
|
|
4513
|
+
const newInputs = _.clone(this.state.inputs);
|
|
4579
4514
|
if (image.Selected) {
|
|
4580
4515
|
// Unselelct selected image
|
|
4581
|
-
|
|
4516
|
+
const index = _.findIndex(newInputs, input => {
|
|
4582
4517
|
return input.value === image.Value || input.value === image[1400];
|
|
4583
4518
|
});
|
|
4584
4519
|
if (index !== -1) {
|
|
@@ -4587,7 +4522,7 @@ class ImageInputComponent extends Component {
|
|
|
4587
4522
|
image.Selected = false;
|
|
4588
4523
|
} else {
|
|
4589
4524
|
// Select unselected image
|
|
4590
|
-
|
|
4525
|
+
const newFile = {
|
|
4591
4526
|
uploadingImage: false,
|
|
4592
4527
|
value: image.Value,
|
|
4593
4528
|
displayValue: image[1400],
|
|
@@ -4613,28 +4548,28 @@ class ImageInputComponent extends Component {
|
|
|
4613
4548
|
this.checkRefreshCallback(newInputs);
|
|
4614
4549
|
}
|
|
4615
4550
|
checkSetDisplayValue(input, value) {
|
|
4616
|
-
|
|
4617
|
-
|
|
4551
|
+
const displayValue = get1400(value);
|
|
4552
|
+
const storeValue = isVideo(value) || this.props.noCompress ? value : get1400(value);
|
|
4618
4553
|
$("<img/>").attr("src", "".concat(displayValue, "?t=").concat(moment().valueOf())).on("load", () => {
|
|
4619
4554
|
$(this).remove();
|
|
4620
4555
|
input.value = storeValue;
|
|
4621
4556
|
input.displayValue = storeValue;
|
|
4622
4557
|
input.uploadingImage = false;
|
|
4623
|
-
|
|
4558
|
+
const newInputs = _.clone(this.state.inputs);
|
|
4624
4559
|
this.setState({
|
|
4625
4560
|
inputs: newInputs
|
|
4626
4561
|
}, () => {
|
|
4627
|
-
|
|
4562
|
+
const {
|
|
4628
4563
|
selectedTab,
|
|
4629
4564
|
selectedFolder
|
|
4630
4565
|
} = this.state;
|
|
4631
4566
|
if (selectedTab === "library" && selectedFolder) {
|
|
4632
4567
|
// Uploading to a user folder
|
|
4633
|
-
|
|
4568
|
+
const {
|
|
4634
4569
|
RowId,
|
|
4635
4570
|
Images
|
|
4636
4571
|
} = selectedFolder;
|
|
4637
|
-
|
|
4572
|
+
const images = [...Images, value];
|
|
4638
4573
|
fileActions.addImagesToFolder(RowId, this.props.auth.site, [value]).catch(error => {
|
|
4639
4574
|
console.log("addImagesToFolder error", error);
|
|
4640
4575
|
});
|
|
@@ -4654,12 +4589,12 @@ class ImageInputComponent extends Component {
|
|
|
4654
4589
|
});
|
|
4655
4590
|
}
|
|
4656
4591
|
removeImage(input) {
|
|
4657
|
-
|
|
4592
|
+
const newState = {};
|
|
4658
4593
|
if (input.fromLibrary) {
|
|
4659
4594
|
input.fromLibrary = undefined;
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4595
|
+
const selectedFolderImages = this.state.selectedFolder ? this.state.selectedFolder.parsedImages : [];
|
|
4596
|
+
const imageList = this.isStockFolder() ? this.state.imageLibrary : selectedFolderImages;
|
|
4597
|
+
const libraryFile = _.find(imageList, f => {
|
|
4663
4598
|
return f.Value === input.value || f[1400] === input.value;
|
|
4664
4599
|
});
|
|
4665
4600
|
if (libraryFile) {
|
|
@@ -4673,7 +4608,7 @@ class ImageInputComponent extends Component {
|
|
|
4673
4608
|
}
|
|
4674
4609
|
input.value = "";
|
|
4675
4610
|
input.displayValue = "";
|
|
4676
|
-
|
|
4611
|
+
const newInputs = _.clone(this.state.inputs);
|
|
4677
4612
|
if (newInputs.length > 1) {
|
|
4678
4613
|
newInputs.splice(newInputs.indexOf(input), 1);
|
|
4679
4614
|
if (newInputs.length === this.props.limit - 1 && !_.isEmpty(newInputs[newInputs.length - 1].value)) {
|
|
@@ -4691,7 +4626,7 @@ class ImageInputComponent extends Component {
|
|
|
4691
4626
|
});
|
|
4692
4627
|
}
|
|
4693
4628
|
renderInput(input, index, inputsLength) {
|
|
4694
|
-
|
|
4629
|
+
const renderContent = () => {
|
|
4695
4630
|
if (this.props.onlyAllowUpload) {
|
|
4696
4631
|
return null;
|
|
4697
4632
|
}
|
|
@@ -4714,7 +4649,7 @@ class ImageInputComponent extends Component {
|
|
|
4714
4649
|
accept: this.getAccept(),
|
|
4715
4650
|
onDrop: files => this.onDrop(files, true),
|
|
4716
4651
|
children: state => {
|
|
4717
|
-
|
|
4652
|
+
const {
|
|
4718
4653
|
getRootProps,
|
|
4719
4654
|
getInputProps
|
|
4720
4655
|
} = state;
|
|
@@ -4738,7 +4673,7 @@ class ImageInputComponent extends Component {
|
|
|
4738
4673
|
style: _objectSpread$d(_objectSpread$d({}, this.getImageStyle(input.displayValue)), this.props.style)
|
|
4739
4674
|
});
|
|
4740
4675
|
};
|
|
4741
|
-
|
|
4676
|
+
const renderRemove = () => {
|
|
4742
4677
|
return !this.props.disableRemove && !this.props.disabled && (this.props.simpleStyle ? /*#__PURE__*/jsx(Icon$1, {
|
|
4743
4678
|
icon: "xmark",
|
|
4744
4679
|
className: "imageInput_removeIcon",
|
|
@@ -4749,7 +4684,7 @@ class ImageInputComponent extends Component {
|
|
|
4749
4684
|
children: "remove"
|
|
4750
4685
|
}));
|
|
4751
4686
|
};
|
|
4752
|
-
|
|
4687
|
+
const renderDownload = () => {
|
|
4753
4688
|
if (isVideo(input.displayValue)) return null;
|
|
4754
4689
|
if (this.props.noDownload) return null;
|
|
4755
4690
|
return /*#__PURE__*/jsx("a", {
|
|
@@ -4763,7 +4698,7 @@ class ImageInputComponent extends Component {
|
|
|
4763
4698
|
})
|
|
4764
4699
|
});
|
|
4765
4700
|
};
|
|
4766
|
-
|
|
4701
|
+
const mediaText = this.props.allowVideo ? "media" : "image".concat(this.props.multiple ? "s" : "");
|
|
4767
4702
|
return /*#__PURE__*/jsxs("div", {
|
|
4768
4703
|
className: this.getClassNames(input, inputsLength),
|
|
4769
4704
|
style: _objectSpread$d({}, this.props.style),
|
|
@@ -4772,7 +4707,7 @@ class ImageInputComponent extends Component {
|
|
|
4772
4707
|
accept: this.getAccept(),
|
|
4773
4708
|
onDrop: this.onDrop,
|
|
4774
4709
|
children: state => {
|
|
4775
|
-
|
|
4710
|
+
const {
|
|
4776
4711
|
getRootProps,
|
|
4777
4712
|
getInputProps,
|
|
4778
4713
|
isDragActive
|
|
@@ -4813,7 +4748,7 @@ class ImageInputComponent extends Component {
|
|
|
4813
4748
|
}
|
|
4814
4749
|
renderLibraryImage(image, index, allowDelete) {
|
|
4815
4750
|
// console.log(image);
|
|
4816
|
-
|
|
4751
|
+
let classes = "imageInput imageInput-hasImage imageInput-libraryImage";
|
|
4817
4752
|
if (image.Selected) {
|
|
4818
4753
|
classes += " imageInput-librarySelected";
|
|
4819
4754
|
}
|
|
@@ -4878,7 +4813,7 @@ class ImageInputComponent extends Component {
|
|
|
4878
4813
|
});
|
|
4879
4814
|
}
|
|
4880
4815
|
renderAddFolder() {
|
|
4881
|
-
|
|
4816
|
+
const isSaving = this.state.addingFolder;
|
|
4882
4817
|
if (this.state.addFolderOpen) {
|
|
4883
4818
|
return /*#__PURE__*/jsxs("div", {
|
|
4884
4819
|
className: "imageFolderContainer",
|
|
@@ -4936,8 +4871,8 @@ class ImageInputComponent extends Component {
|
|
|
4936
4871
|
});
|
|
4937
4872
|
}
|
|
4938
4873
|
renderFolder(folder, index) {
|
|
4939
|
-
|
|
4940
|
-
|
|
4874
|
+
const timeStamp = moment(folder.Timestamp).format("DD MMM, YYYY, h:mma");
|
|
4875
|
+
const countText = "".concat(folder.Images ? folder.Images.length : 0, " images");
|
|
4941
4876
|
return /*#__PURE__*/jsxs("div", {
|
|
4942
4877
|
className: "imageFolderContainer",
|
|
4943
4878
|
onClick: this.selectFolder.bind(this, folder),
|
|
@@ -5005,10 +4940,10 @@ class ImageInputComponent extends Component {
|
|
|
5005
4940
|
});
|
|
5006
4941
|
}
|
|
5007
4942
|
renderFolderImages() {
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
4943
|
+
const stockFolder = this.isStockFolder();
|
|
4944
|
+
const canDelete = !stockFolder && this.canManageLibrary();
|
|
4945
|
+
const uploadingImages = this.state.inputs.filter(i => i.uploadingImage);
|
|
4946
|
+
const mediaText = this.props.allowVideo ? "media" : "image".concat(this.props.multiple ? "s" : "");
|
|
5012
4947
|
return /*#__PURE__*/jsxs("div", {
|
|
5013
4948
|
className: "imageInputContainer imageInputContainer-library",
|
|
5014
4949
|
style: _objectSpread$d({}, this.props.style),
|
|
@@ -5020,7 +4955,7 @@ class ImageInputComponent extends Component {
|
|
|
5020
4955
|
accept: this.getAccept(),
|
|
5021
4956
|
onDrop: files => this.onDrop(files, true),
|
|
5022
4957
|
children: state => {
|
|
5023
|
-
|
|
4958
|
+
const {
|
|
5024
4959
|
getRootProps,
|
|
5025
4960
|
getInputProps,
|
|
5026
4961
|
isDragActive
|
|
@@ -5084,7 +5019,7 @@ class ImageInputComponent extends Component {
|
|
|
5084
5019
|
if (this.state.selectedTab === "upload") {
|
|
5085
5020
|
return null;
|
|
5086
5021
|
}
|
|
5087
|
-
|
|
5022
|
+
let content = null;
|
|
5088
5023
|
if (this.state.selectedFolder) {
|
|
5089
5024
|
content = this.renderFolderImages();
|
|
5090
5025
|
} else {
|
|
@@ -5118,7 +5053,7 @@ class ImageInputComponent extends Component {
|
|
|
5118
5053
|
accept: this.getAccept(),
|
|
5119
5054
|
onDrop: files => this.onDrop(files, true),
|
|
5120
5055
|
children: state => {
|
|
5121
|
-
|
|
5056
|
+
const {
|
|
5122
5057
|
getRootProps,
|
|
5123
5058
|
getInputProps
|
|
5124
5059
|
} = state;
|
|
@@ -5156,7 +5091,7 @@ class ImageInputComponent extends Component {
|
|
|
5156
5091
|
});
|
|
5157
5092
|
}
|
|
5158
5093
|
}
|
|
5159
|
-
|
|
5094
|
+
const styles$6 = {
|
|
5160
5095
|
addFolderInputContainer: {
|
|
5161
5096
|
marginBottom: "0px",
|
|
5162
5097
|
paddingRight: "100px",
|
|
@@ -5190,12 +5125,12 @@ var styles$6 = {
|
|
|
5190
5125
|
cursor: "pointer"
|
|
5191
5126
|
}
|
|
5192
5127
|
};
|
|
5193
|
-
|
|
5128
|
+
const mapStateToProps$2 = state => {
|
|
5194
5129
|
return {
|
|
5195
5130
|
auth: state.auth
|
|
5196
5131
|
};
|
|
5197
5132
|
};
|
|
5198
|
-
|
|
5133
|
+
const ImageInput = connect(mapStateToProps$2, {}, null, {
|
|
5199
5134
|
forwardRef: true
|
|
5200
5135
|
})(ImageInputComponent);
|
|
5201
5136
|
|
|
@@ -5263,7 +5198,7 @@ class OverlayPage extends Component {
|
|
|
5263
5198
|
});
|
|
5264
5199
|
}
|
|
5265
5200
|
}
|
|
5266
|
-
|
|
5201
|
+
const styles$5 = {
|
|
5267
5202
|
pageWrapper: {
|
|
5268
5203
|
position: "fixed",
|
|
5269
5204
|
zIndex: 100,
|
|
@@ -5310,7 +5245,7 @@ class OverlayPageContents extends Component {
|
|
|
5310
5245
|
});
|
|
5311
5246
|
}
|
|
5312
5247
|
}
|
|
5313
|
-
|
|
5248
|
+
const styles$4 = {
|
|
5314
5249
|
wrapper: {
|
|
5315
5250
|
clear: "both",
|
|
5316
5251
|
whiteSpace: "nowrap",
|
|
@@ -5340,7 +5275,7 @@ class OverlayPageSection extends Component {
|
|
|
5340
5275
|
}));
|
|
5341
5276
|
}
|
|
5342
5277
|
}
|
|
5343
|
-
|
|
5278
|
+
const styles$3 = {
|
|
5344
5279
|
wrapper: {
|
|
5345
5280
|
/* height: '100%',
|
|
5346
5281
|
overflowY: 'auto',
|
|
@@ -5377,7 +5312,7 @@ class OverlayPageBottomButtons extends Component {
|
|
|
5377
5312
|
});
|
|
5378
5313
|
}
|
|
5379
5314
|
}
|
|
5380
|
-
|
|
5315
|
+
const styles$2 = {
|
|
5381
5316
|
wrapper: {
|
|
5382
5317
|
padding: 12,
|
|
5383
5318
|
paddingRight: 24,
|
|
@@ -5407,7 +5342,7 @@ function ownKeys$7(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymb
|
|
|
5407
5342
|
function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$7(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$7(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5408
5343
|
class RadioButton extends Component {
|
|
5409
5344
|
generateClassNames(e) {
|
|
5410
|
-
|
|
5345
|
+
let string = "radioButton";
|
|
5411
5346
|
if (this.props.isActive === e) {
|
|
5412
5347
|
string = string + " radioButton--active";
|
|
5413
5348
|
}
|
|
@@ -5417,7 +5352,7 @@ class RadioButton extends Component {
|
|
|
5417
5352
|
return string;
|
|
5418
5353
|
}
|
|
5419
5354
|
generateWrapperClassNames() {
|
|
5420
|
-
|
|
5355
|
+
let string = "radioButtonWrapper";
|
|
5421
5356
|
if (this.props.disabled) {
|
|
5422
5357
|
string = string + " radioButton--disabled";
|
|
5423
5358
|
}
|
|
@@ -5430,7 +5365,7 @@ class RadioButton extends Component {
|
|
|
5430
5365
|
return string;
|
|
5431
5366
|
}
|
|
5432
5367
|
getButtonStyle(e) {
|
|
5433
|
-
|
|
5368
|
+
const result = {};
|
|
5434
5369
|
if (this.props.highlightColour && this.props.isActive === e) {
|
|
5435
5370
|
result.borderColor = this.props.highlightColour;
|
|
5436
5371
|
}
|
|
@@ -5527,7 +5462,7 @@ class RadioButton extends Component {
|
|
|
5527
5462
|
});
|
|
5528
5463
|
}
|
|
5529
5464
|
}
|
|
5530
|
-
|
|
5465
|
+
const styles$1 = {
|
|
5531
5466
|
row: {
|
|
5532
5467
|
display: "flex",
|
|
5533
5468
|
flexDirection: "row"
|
|
@@ -5670,7 +5605,7 @@ class SuccessPopup extends Component {
|
|
|
5670
5605
|
}
|
|
5671
5606
|
}
|
|
5672
5607
|
|
|
5673
|
-
|
|
5608
|
+
const getReactions = () => {
|
|
5674
5609
|
return [{
|
|
5675
5610
|
key: "heart",
|
|
5676
5611
|
icon: "https://pluss60-demo-media.s3-ap-southeast-2.amazonaws.com/assets/emojis/heart.png"
|
|
@@ -5764,7 +5699,7 @@ class AnalyticsFilter extends PureComponent {
|
|
|
5764
5699
|
});
|
|
5765
5700
|
});
|
|
5766
5701
|
_defineProperty(this, "selectFilter", key => {
|
|
5767
|
-
|
|
5702
|
+
const selectedFilter = _.find(this.state.filterOptions, o => {
|
|
5768
5703
|
return o.dayCount === key;
|
|
5769
5704
|
});
|
|
5770
5705
|
this.setState({
|
|
@@ -5805,8 +5740,8 @@ class AnalyticsFilter extends PureComponent {
|
|
|
5805
5740
|
});
|
|
5806
5741
|
}
|
|
5807
5742
|
});
|
|
5808
|
-
|
|
5809
|
-
|
|
5743
|
+
const filterOptions = getAnalyticsFilterOptions();
|
|
5744
|
+
const _selectedFilter = this.props.defaultFilter || filterOptions[1];
|
|
5810
5745
|
this.state = {
|
|
5811
5746
|
filterOptions,
|
|
5812
5747
|
selectedFilter: _selectedFilter,
|
|
@@ -5977,7 +5912,7 @@ class TimePicker extends Component {
|
|
|
5977
5912
|
}
|
|
5978
5913
|
onNewProps(nextProps, forceUpdate) {
|
|
5979
5914
|
if (forceUpdate || nextProps.selectedTime !== this.props.selectedTime) {
|
|
5980
|
-
|
|
5915
|
+
let mDate = moment(nextProps.selectedTime, "h:mma");
|
|
5981
5916
|
if (!mDate.isValid()) {
|
|
5982
5917
|
this.setState({
|
|
5983
5918
|
selectedTime: null,
|
|
@@ -5986,7 +5921,7 @@ class TimePicker extends Component {
|
|
|
5986
5921
|
mInput: ""
|
|
5987
5922
|
});
|
|
5988
5923
|
} else {
|
|
5989
|
-
|
|
5924
|
+
const minutesFocused = document.getElementById("time_minute_".concat(this.state.id)) === document.activeElement;
|
|
5990
5925
|
this.setState({
|
|
5991
5926
|
selectedTime: mDate,
|
|
5992
5927
|
hourInput: mDate.format("h"),
|
|
@@ -5997,14 +5932,14 @@ class TimePicker extends Component {
|
|
|
5997
5932
|
}
|
|
5998
5933
|
}
|
|
5999
5934
|
getDefaultTime() {
|
|
6000
|
-
|
|
5935
|
+
const result = moment();
|
|
6001
5936
|
result.hour(12);
|
|
6002
5937
|
result.minute(0);
|
|
6003
5938
|
result.second(0);
|
|
6004
5939
|
return result;
|
|
6005
5940
|
}
|
|
6006
5941
|
onChangeHour(event) {
|
|
6007
|
-
|
|
5942
|
+
let hour = 0;
|
|
6008
5943
|
if (!_.isEmpty(event.target.value)) {
|
|
6009
5944
|
hour = parseInt(event.target.value, 10);
|
|
6010
5945
|
} else {
|
|
@@ -6017,8 +5952,8 @@ class TimePicker extends Component {
|
|
|
6017
5952
|
return;
|
|
6018
5953
|
}
|
|
6019
5954
|
hour = Math.max(Math.min(12, hour), 0);
|
|
6020
|
-
|
|
6021
|
-
|
|
5955
|
+
const dateToUse = this.state.selectedTime || this.getDefaultTime();
|
|
5956
|
+
const selectNext = hour > 1; // if hour is > 1, assume user is done typing and select minutes input
|
|
6022
5957
|
if (dateToUse.format("a") === "pm") {
|
|
6023
5958
|
hour += 12;
|
|
6024
5959
|
}
|
|
@@ -6032,7 +5967,7 @@ class TimePicker extends Component {
|
|
|
6032
5967
|
}
|
|
6033
5968
|
}
|
|
6034
5969
|
onChangeMinute(event) {
|
|
6035
|
-
|
|
5970
|
+
let minute = 0;
|
|
6036
5971
|
if (!_.isEmpty(event.target.value)) {
|
|
6037
5972
|
minute = parseInt(event.target.value, 10);
|
|
6038
5973
|
} else {
|
|
@@ -6045,7 +5980,7 @@ class TimePicker extends Component {
|
|
|
6045
5980
|
return;
|
|
6046
5981
|
}
|
|
6047
5982
|
minute = Math.max(Math.min(59, minute), 0);
|
|
6048
|
-
|
|
5983
|
+
const dateToUse = this.state.selectedTime || this.getDefaultTime();
|
|
6049
5984
|
dateToUse.minute(minute);
|
|
6050
5985
|
this.setState({
|
|
6051
5986
|
selectedTime: moment(dateToUse)
|
|
@@ -6063,7 +5998,7 @@ class TimePicker extends Component {
|
|
|
6063
5998
|
}
|
|
6064
5999
|
}
|
|
6065
6000
|
onChangeM(event) {
|
|
6066
|
-
|
|
6001
|
+
const dateToUse = this.state.selectedTime || this.getDefaultTime();
|
|
6067
6002
|
if (event.target.value.toLowerCase().indexOf("a") > -1) {
|
|
6068
6003
|
// am
|
|
6069
6004
|
if (dateToUse.format("a") === "pm") {
|
|
@@ -6096,7 +6031,7 @@ class TimePicker extends Component {
|
|
|
6096
6031
|
});
|
|
6097
6032
|
}
|
|
6098
6033
|
render() {
|
|
6099
|
-
|
|
6034
|
+
const {
|
|
6100
6035
|
disabled
|
|
6101
6036
|
} = this.props;
|
|
6102
6037
|
if (disabled) {
|
|
@@ -6318,12 +6253,12 @@ class AudienceIncluder extends Component {
|
|
|
6318
6253
|
});
|
|
6319
6254
|
}
|
|
6320
6255
|
}
|
|
6321
|
-
|
|
6256
|
+
const mapStateToProps$1 = state => {
|
|
6322
6257
|
return {
|
|
6323
6258
|
auth: state.auth
|
|
6324
6259
|
};
|
|
6325
6260
|
};
|
|
6326
|
-
|
|
6261
|
+
let exportObj$1 = connect(mapStateToProps$1, {})(withRouter(AudienceIncluder));
|
|
6327
6262
|
|
|
6328
6263
|
function ownKeys$5(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; }
|
|
6329
6264
|
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; }
|
|
@@ -6361,7 +6296,7 @@ class DropdownInput extends Component {
|
|
|
6361
6296
|
return "off";
|
|
6362
6297
|
}
|
|
6363
6298
|
getClassNames() {
|
|
6364
|
-
|
|
6299
|
+
let string = "";
|
|
6365
6300
|
if (this.props.className) {
|
|
6366
6301
|
string += "".concat(this.props.className, " ");
|
|
6367
6302
|
}
|
|
@@ -6380,7 +6315,7 @@ class DropdownInput extends Component {
|
|
|
6380
6315
|
return string;
|
|
6381
6316
|
}
|
|
6382
6317
|
getLabelStyle() {
|
|
6383
|
-
|
|
6318
|
+
const style = {};
|
|
6384
6319
|
if (_.isEmpty(this.props.value) && !this.props.alwaysShowLabel) {
|
|
6385
6320
|
style.opacity = 0;
|
|
6386
6321
|
}
|
|
@@ -6498,7 +6433,7 @@ class DropdownInput extends Component {
|
|
|
6498
6433
|
});
|
|
6499
6434
|
}
|
|
6500
6435
|
}
|
|
6501
|
-
|
|
6436
|
+
const styles = {
|
|
6502
6437
|
row: {
|
|
6503
6438
|
display: "flex",
|
|
6504
6439
|
flexDirection: "row",
|
|
@@ -6537,11 +6472,11 @@ class AudienceSelector extends Component {
|
|
|
6537
6472
|
super(props);
|
|
6538
6473
|
_this = this;
|
|
6539
6474
|
_defineProperty(this, "onChangeSelection", () => {
|
|
6540
|
-
|
|
6475
|
+
const {
|
|
6541
6476
|
updateValidation,
|
|
6542
6477
|
onChange
|
|
6543
6478
|
} = this.props;
|
|
6544
|
-
|
|
6479
|
+
const isValid = this.validateAudienceSelection();
|
|
6545
6480
|
if (updateValidation) updateValidation(isValid);
|
|
6546
6481
|
if (onChange) onChange(this.getAudienceType(), this.getAudienceTypeSelection(), isValid);
|
|
6547
6482
|
});
|
|
@@ -6557,14 +6492,14 @@ class AudienceSelector extends Component {
|
|
|
6557
6492
|
return !_.isEmpty(this.state.AudienceTagList);
|
|
6558
6493
|
});
|
|
6559
6494
|
_defineProperty(this, "getAvailableAudienceTags", function () {
|
|
6560
|
-
|
|
6561
|
-
|
|
6495
|
+
let includeSelected = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6496
|
+
const {
|
|
6562
6497
|
categories,
|
|
6563
6498
|
types,
|
|
6564
6499
|
tagList,
|
|
6565
6500
|
AudienceTagList
|
|
6566
6501
|
} = _this.state;
|
|
6567
|
-
|
|
6502
|
+
const categoryTags = categories.map(c => {
|
|
6568
6503
|
return {
|
|
6569
6504
|
AudienceType: "Category",
|
|
6570
6505
|
AudienceTypeSelection: c.Key,
|
|
@@ -6572,7 +6507,7 @@ class AudienceSelector extends Component {
|
|
|
6572
6507
|
Title: c.Title
|
|
6573
6508
|
};
|
|
6574
6509
|
});
|
|
6575
|
-
|
|
6510
|
+
const userTypeTags = types.map(t => {
|
|
6576
6511
|
return {
|
|
6577
6512
|
AudienceType: "UserType",
|
|
6578
6513
|
AudienceTypeSelection: t.typeName,
|
|
@@ -6580,7 +6515,7 @@ class AudienceSelector extends Component {
|
|
|
6580
6515
|
Title: "User Type: ".concat(t.displayName)
|
|
6581
6516
|
};
|
|
6582
6517
|
});
|
|
6583
|
-
|
|
6518
|
+
const userTagTags = tagList.map(t => {
|
|
6584
6519
|
return {
|
|
6585
6520
|
AudienceType: "UserTags",
|
|
6586
6521
|
AudienceTypeSelection: t.Id,
|
|
@@ -6588,17 +6523,17 @@ class AudienceSelector extends Component {
|
|
|
6588
6523
|
Title: "User Tag: ".concat(t.Title)
|
|
6589
6524
|
};
|
|
6590
6525
|
});
|
|
6591
|
-
|
|
6526
|
+
const result = [...categoryTags, ...userTypeTags, ...userTagTags];
|
|
6592
6527
|
return includeSelected ? result : result.filter(t => !_.some(AudienceTagList, at => at.Id === t.Id));
|
|
6593
6528
|
});
|
|
6594
6529
|
_defineProperty(this, "onAttachAudienceTag", tag => {
|
|
6595
|
-
|
|
6530
|
+
const AudienceTagList = [...this.state.AudienceTagList, tag];
|
|
6596
6531
|
this.setState({
|
|
6597
6532
|
AudienceTagList
|
|
6598
6533
|
}, this.onChangeSelection);
|
|
6599
6534
|
});
|
|
6600
6535
|
_defineProperty(this, "onDetachAudienceTag", tag => {
|
|
6601
|
-
|
|
6536
|
+
const AudienceTagList = _.filter(this.state.AudienceTagList, at => at.Id !== tag.Id);
|
|
6602
6537
|
this.setState({
|
|
6603
6538
|
AudienceTagList
|
|
6604
6539
|
}, this.onChangeSelection);
|
|
@@ -6631,7 +6566,7 @@ class AudienceSelector extends Component {
|
|
|
6631
6566
|
};
|
|
6632
6567
|
}
|
|
6633
6568
|
componentDidMount() {
|
|
6634
|
-
|
|
6569
|
+
const {
|
|
6635
6570
|
custom,
|
|
6636
6571
|
disallowSingleUsers,
|
|
6637
6572
|
allowTags
|
|
@@ -6641,7 +6576,7 @@ class AudienceSelector extends Component {
|
|
|
6641
6576
|
if (allowTags || custom) this.getUserTags();
|
|
6642
6577
|
}
|
|
6643
6578
|
componentDidUpdate(prevProps) {
|
|
6644
|
-
|
|
6579
|
+
const newState = {};
|
|
6645
6580
|
if (prevProps.audienceType !== this.props.audienceType) newState.AudienceType = this.props.audienceType;
|
|
6646
6581
|
if (!_.isEqual(prevProps.audienceTypeSelection, this.props.audienceTypeSelection)) newState.AudienceTagList = this.props.audienceTypeSelection;
|
|
6647
6582
|
if (!_.isEmpty(newState)) this.setState(newState);
|
|
@@ -6657,7 +6592,7 @@ class AudienceSelector extends Component {
|
|
|
6657
6592
|
return this.state.AudienceType;
|
|
6658
6593
|
}
|
|
6659
6594
|
getAudienceTypeSelection() {
|
|
6660
|
-
|
|
6595
|
+
const {
|
|
6661
6596
|
AudienceType,
|
|
6662
6597
|
AudienceTagList,
|
|
6663
6598
|
Category,
|
|
@@ -6694,7 +6629,7 @@ class AudienceSelector extends Component {
|
|
|
6694
6629
|
}).catch(error => {});
|
|
6695
6630
|
}
|
|
6696
6631
|
setType(type, selection) {
|
|
6697
|
-
|
|
6632
|
+
const newState = {
|
|
6698
6633
|
AudienceType: type
|
|
6699
6634
|
};
|
|
6700
6635
|
if (type === "Custom") newState.AudienceTagList = selection;
|
|
@@ -6714,7 +6649,7 @@ class AudienceSelector extends Component {
|
|
|
6714
6649
|
setTimeout(this.onChangeSelection, 50);
|
|
6715
6650
|
}
|
|
6716
6651
|
getOptions() {
|
|
6717
|
-
|
|
6652
|
+
const options = [{
|
|
6718
6653
|
Label: "All users",
|
|
6719
6654
|
Value: "All",
|
|
6720
6655
|
onChange: () => this.onChangeOption("All")
|
|
@@ -6756,7 +6691,7 @@ class AudienceSelector extends Component {
|
|
|
6756
6691
|
return options;
|
|
6757
6692
|
}
|
|
6758
6693
|
validateAudienceSelection() {
|
|
6759
|
-
|
|
6694
|
+
const {
|
|
6760
6695
|
AudienceType,
|
|
6761
6696
|
includeList
|
|
6762
6697
|
} = this.state;
|
|
@@ -6776,7 +6711,7 @@ class AudienceSelector extends Component {
|
|
|
6776
6711
|
setTimeout(this.onChangeSelection, 50);
|
|
6777
6712
|
}
|
|
6778
6713
|
getTypeTitle() {
|
|
6779
|
-
|
|
6714
|
+
const typeObject = _.find(this.state.types, t => {
|
|
6780
6715
|
return t.typeName === this.state.Type;
|
|
6781
6716
|
});
|
|
6782
6717
|
if (typeObject) {
|
|
@@ -6785,7 +6720,7 @@ class AudienceSelector extends Component {
|
|
|
6785
6720
|
return "";
|
|
6786
6721
|
}
|
|
6787
6722
|
getTagTitle() {
|
|
6788
|
-
|
|
6723
|
+
const tag = _.find(this.state.tagList, t => {
|
|
6789
6724
|
return t.Id === this.state.Tag;
|
|
6790
6725
|
});
|
|
6791
6726
|
if (tag) {
|
|
@@ -6802,14 +6737,14 @@ class AudienceSelector extends Component {
|
|
|
6802
6737
|
e.Title = e.displayName;
|
|
6803
6738
|
e.Key = e.typeName;
|
|
6804
6739
|
if (e.category) {
|
|
6805
|
-
|
|
6740
|
+
const category = _.find(this.state.categories, c => {
|
|
6806
6741
|
return c.Key === e.category;
|
|
6807
6742
|
});
|
|
6808
|
-
|
|
6743
|
+
const shortName = category ? "(".concat(category.ShortName, ") ") : "";
|
|
6809
6744
|
e.Title = "".concat(shortName, " ").concat(e.Title);
|
|
6810
6745
|
}
|
|
6811
6746
|
});
|
|
6812
|
-
|
|
6747
|
+
const newState = {
|
|
6813
6748
|
types: res.data
|
|
6814
6749
|
};
|
|
6815
6750
|
if (!_.some(res.data, t => t.category === "family")) {
|
|
@@ -6820,25 +6755,25 @@ class AudienceSelector extends Component {
|
|
|
6820
6755
|
}
|
|
6821
6756
|
getUserList() {
|
|
6822
6757
|
if (this.state.AudienceType === "UserType" && !_.isEmpty(this.state.Type)) {
|
|
6823
|
-
|
|
6758
|
+
let users = [];
|
|
6824
6759
|
this.state.userList.forEach(element => {
|
|
6825
6760
|
if (element.type !== this.state.Type) users.push(element);
|
|
6826
6761
|
});
|
|
6827
6762
|
return _.sortBy(users, "displayName");
|
|
6828
6763
|
}
|
|
6829
6764
|
if (this.state.AudienceType === "Category" && !_.isEmpty(this.state.Category)) {
|
|
6830
|
-
|
|
6831
|
-
|
|
6765
|
+
let users = [];
|
|
6766
|
+
let types = _.filter(this.state.types, type => {
|
|
6832
6767
|
return type.category === this.state.Category;
|
|
6833
6768
|
}).map(type => {
|
|
6834
6769
|
return type.typeName;
|
|
6835
6770
|
});
|
|
6836
6771
|
this.state.userList.forEach(element => {
|
|
6837
6772
|
if (types.indexOf(element.type) === -1) {
|
|
6838
|
-
|
|
6773
|
+
users.push(element);
|
|
6839
6774
|
}
|
|
6840
6775
|
});
|
|
6841
|
-
return _.sortBy(
|
|
6776
|
+
return _.sortBy(users, "displayName");
|
|
6842
6777
|
}
|
|
6843
6778
|
return _.sortBy(this.state.userList, "displayName");
|
|
6844
6779
|
}
|
|
@@ -6851,7 +6786,7 @@ class AudienceSelector extends Component {
|
|
|
6851
6786
|
setTimeout(this.onChangeSelection, 50);
|
|
6852
6787
|
}
|
|
6853
6788
|
getCatTitle() {
|
|
6854
|
-
|
|
6789
|
+
const typeObject = _.find(this.state.categories, t => {
|
|
6855
6790
|
return t.Key === this.state.Category;
|
|
6856
6791
|
});
|
|
6857
6792
|
if (typeObject) {
|
|
@@ -6891,30 +6826,30 @@ class AudienceSelector extends Component {
|
|
|
6891
6826
|
}
|
|
6892
6827
|
getUserExcludeList() {
|
|
6893
6828
|
if (this.state.AudienceType === "UserType" && !_.isEmpty(this.state.Type)) {
|
|
6894
|
-
|
|
6829
|
+
let users = [];
|
|
6895
6830
|
this.state.userList.forEach(element => {
|
|
6896
6831
|
if (element.type === this.state.Type) users.push(element);
|
|
6897
6832
|
});
|
|
6898
6833
|
return _.sortBy(users, "displayName");
|
|
6899
6834
|
}
|
|
6900
6835
|
if (this.state.AudienceType === "Category" && !_.isEmpty(this.state.Category)) {
|
|
6901
|
-
|
|
6902
|
-
|
|
6836
|
+
let users = [];
|
|
6837
|
+
let types = _.filter(this.state.types, type => {
|
|
6903
6838
|
return type.category === this.state.Category;
|
|
6904
6839
|
}).map(type => {
|
|
6905
6840
|
return type.typeName;
|
|
6906
6841
|
});
|
|
6907
6842
|
this.state.userList.forEach(element => {
|
|
6908
6843
|
if (types.indexOf(element.type) > -1) {
|
|
6909
|
-
|
|
6844
|
+
users.push(element);
|
|
6910
6845
|
}
|
|
6911
6846
|
});
|
|
6912
|
-
return _.sortBy(
|
|
6847
|
+
return _.sortBy(users, "displayName");
|
|
6913
6848
|
}
|
|
6914
6849
|
return _.sortBy(this.state.userList, "displayName");
|
|
6915
6850
|
}
|
|
6916
6851
|
addToInc(user) {
|
|
6917
|
-
|
|
6852
|
+
let list = [...this.state.includeList];
|
|
6918
6853
|
list.push({
|
|
6919
6854
|
Id: user.Id,
|
|
6920
6855
|
displayName: user.displayName,
|
|
@@ -6934,7 +6869,7 @@ class AudienceSelector extends Component {
|
|
|
6934
6869
|
setTimeout(this.onChangeSelection, 50);
|
|
6935
6870
|
}
|
|
6936
6871
|
addToEx(user) {
|
|
6937
|
-
|
|
6872
|
+
let list = [...this.state.excludeList];
|
|
6938
6873
|
list.push({
|
|
6939
6874
|
Id: user.Id,
|
|
6940
6875
|
displayName: user.displayName,
|
|
@@ -7022,10 +6957,10 @@ class AudienceSelector extends Component {
|
|
|
7022
6957
|
}, "includes");
|
|
7023
6958
|
}
|
|
7024
6959
|
renderAssignedAudiences() {
|
|
7025
|
-
|
|
6960
|
+
const {
|
|
7026
6961
|
AudienceTagList
|
|
7027
6962
|
} = this.state;
|
|
7028
|
-
|
|
6963
|
+
const {
|
|
7029
6964
|
maxWidth
|
|
7030
6965
|
} = this.props;
|
|
7031
6966
|
return /*#__PURE__*/jsxs("div", {
|
|
@@ -7048,10 +6983,10 @@ class AudienceSelector extends Component {
|
|
|
7048
6983
|
});
|
|
7049
6984
|
}
|
|
7050
6985
|
renderAvailableAudiences() {
|
|
7051
|
-
|
|
6986
|
+
const {
|
|
7052
6987
|
maxWidth
|
|
7053
6988
|
} = this.props;
|
|
7054
|
-
|
|
6989
|
+
const tags = this.getAvailableAudienceTags();
|
|
7055
6990
|
return /*#__PURE__*/jsx("div", {
|
|
7056
6991
|
className: "availableAudienceTags",
|
|
7057
6992
|
iconStyle: {
|
|
@@ -7161,7 +7096,7 @@ class AudienceSelector extends Component {
|
|
|
7161
7096
|
});
|
|
7162
7097
|
}
|
|
7163
7098
|
}
|
|
7164
|
-
|
|
7099
|
+
const toExport = connect(null, {
|
|
7165
7100
|
setAuth
|
|
7166
7101
|
}, null, {
|
|
7167
7102
|
forwardRef: true
|
|
@@ -7286,14 +7221,14 @@ class OptionsSection extends Component {
|
|
|
7286
7221
|
return _.find(this.props.options, o => this.props.selected === o.key);
|
|
7287
7222
|
}
|
|
7288
7223
|
getTitle() {
|
|
7289
|
-
|
|
7224
|
+
const selectedOption = this.getSelectedOption();
|
|
7290
7225
|
if (!selectedOption) {
|
|
7291
7226
|
return "";
|
|
7292
7227
|
}
|
|
7293
7228
|
return selectedOption.text;
|
|
7294
7229
|
}
|
|
7295
7230
|
renderOptionButton(o) {
|
|
7296
|
-
|
|
7231
|
+
const isSelected = this.props.selected === o.key;
|
|
7297
7232
|
return /*#__PURE__*/jsxs("div", {
|
|
7298
7233
|
className: "optionsButton".concat(isSelected ? " optionsButton-selected" : ""),
|
|
7299
7234
|
onClick: () => {
|
|
@@ -7313,7 +7248,7 @@ class OptionsSection extends Component {
|
|
|
7313
7248
|
}, o.key);
|
|
7314
7249
|
}
|
|
7315
7250
|
renderContent() {
|
|
7316
|
-
|
|
7251
|
+
const selectedOption = this.getSelectedOption();
|
|
7317
7252
|
if (selectedOption && selectedOption.content) {
|
|
7318
7253
|
return selectedOption.content;
|
|
7319
7254
|
}
|
|
@@ -7380,7 +7315,7 @@ class MakerPopup extends Component {
|
|
|
7380
7315
|
}).Title;
|
|
7381
7316
|
});
|
|
7382
7317
|
_defineProperty(this, "compileData", () => {
|
|
7383
|
-
|
|
7318
|
+
const result = {};
|
|
7384
7319
|
this.props.inputs.forEach(input => {
|
|
7385
7320
|
result[input.key] = this.state[input.key];
|
|
7386
7321
|
});
|
|
@@ -7390,7 +7325,7 @@ class MakerPopup extends Component {
|
|
|
7390
7325
|
return _objectSpread$3(_objectSpread$3({}, result), this.props.requestData);
|
|
7391
7326
|
});
|
|
7392
7327
|
_defineProperty(this, "compileRequestData", () => {
|
|
7393
|
-
|
|
7328
|
+
const result = {};
|
|
7394
7329
|
if (!this.props.hideFormat) {
|
|
7395
7330
|
result.format = this.state.selectedFormat;
|
|
7396
7331
|
}
|
|
@@ -7414,7 +7349,7 @@ class MakerPopup extends Component {
|
|
|
7414
7349
|
if (!this.isReadyToSubmit()) {
|
|
7415
7350
|
return;
|
|
7416
7351
|
}
|
|
7417
|
-
|
|
7352
|
+
const data = this.compileRequestData();
|
|
7418
7353
|
this.setState({
|
|
7419
7354
|
submitting: true
|
|
7420
7355
|
});
|
|
@@ -7616,12 +7551,12 @@ class MakerPopup extends Component {
|
|
|
7616
7551
|
});
|
|
7617
7552
|
}
|
|
7618
7553
|
}
|
|
7619
|
-
|
|
7554
|
+
const mapStateToProps = state => {
|
|
7620
7555
|
return {
|
|
7621
7556
|
auth: state.auth
|
|
7622
7557
|
};
|
|
7623
7558
|
};
|
|
7624
|
-
|
|
7559
|
+
let exportObj = connect(mapStateToProps, {})(MakerPopup);
|
|
7625
7560
|
|
|
7626
7561
|
class ExportCsvPopup extends Component {
|
|
7627
7562
|
constructor(props) {
|
|
@@ -7636,12 +7571,12 @@ class ExportCsvPopup extends Component {
|
|
|
7636
7571
|
if (this.props.onClose) this.props.onClose();
|
|
7637
7572
|
});
|
|
7638
7573
|
_defineProperty(this, "onToggleColumn", key => {
|
|
7639
|
-
|
|
7640
|
-
|
|
7574
|
+
const columns = _.cloneDeep(this.state.columns);
|
|
7575
|
+
const column = columns.find(c => c.key === key);
|
|
7641
7576
|
if (column) {
|
|
7642
7577
|
column.selected = !column.selected;
|
|
7643
7578
|
if (!column.key) columns.map(c => c.selected = column.selected); // Toggle all
|
|
7644
|
-
|
|
7579
|
+
const selectedHeaders = columns.filter(c => c.key && c.selected);
|
|
7645
7580
|
this.setState({
|
|
7646
7581
|
columns,
|
|
7647
7582
|
selectedHeaders
|
|
@@ -7649,7 +7584,7 @@ class ExportCsvPopup extends Component {
|
|
|
7649
7584
|
}
|
|
7650
7585
|
});
|
|
7651
7586
|
_defineProperty(this, "onToggleStartDateFilter", () => {
|
|
7652
|
-
|
|
7587
|
+
const {
|
|
7653
7588
|
filterDateStartVisible
|
|
7654
7589
|
} = this.state;
|
|
7655
7590
|
if (filterDateStartVisible) {
|
|
@@ -7663,7 +7598,7 @@ class ExportCsvPopup extends Component {
|
|
|
7663
7598
|
}
|
|
7664
7599
|
});
|
|
7665
7600
|
_defineProperty(this, "onToggleEndDateFilter", () => {
|
|
7666
|
-
|
|
7601
|
+
const {
|
|
7667
7602
|
filterDateEndVisible
|
|
7668
7603
|
} = this.state;
|
|
7669
7604
|
if (filterDateEndVisible) {
|
|
@@ -7677,10 +7612,10 @@ class ExportCsvPopup extends Component {
|
|
|
7677
7612
|
}
|
|
7678
7613
|
});
|
|
7679
7614
|
_defineProperty(this, "onDateFilterStartChanged", date => {
|
|
7680
|
-
|
|
7615
|
+
const {
|
|
7681
7616
|
filterDateEnd
|
|
7682
7617
|
} = this.state;
|
|
7683
|
-
|
|
7618
|
+
const start = moment(date);
|
|
7684
7619
|
if (start.isSameOrBefore(filterDateEnd)) {
|
|
7685
7620
|
this.setState({
|
|
7686
7621
|
filterDateStart: start.startOf("day"),
|
|
@@ -7689,10 +7624,10 @@ class ExportCsvPopup extends Component {
|
|
|
7689
7624
|
}
|
|
7690
7625
|
});
|
|
7691
7626
|
_defineProperty(this, "onDateFilterEndChanged", date => {
|
|
7692
|
-
|
|
7627
|
+
const {
|
|
7693
7628
|
filterDateStart
|
|
7694
7629
|
} = this.state;
|
|
7695
|
-
|
|
7630
|
+
const end = moment(date);
|
|
7696
7631
|
if (end.isSameOrAfter(filterDateStart)) {
|
|
7697
7632
|
this.setState({
|
|
7698
7633
|
filterDateEnd: end.endOf("day"),
|
|
@@ -7701,32 +7636,32 @@ class ExportCsvPopup extends Component {
|
|
|
7701
7636
|
}
|
|
7702
7637
|
});
|
|
7703
7638
|
_defineProperty(this, "getSelectedSource", () => {
|
|
7704
|
-
|
|
7639
|
+
const {
|
|
7705
7640
|
source
|
|
7706
7641
|
} = this.props;
|
|
7707
|
-
|
|
7642
|
+
const {
|
|
7708
7643
|
selectedHeaders
|
|
7709
7644
|
} = this.state;
|
|
7710
|
-
|
|
7645
|
+
let result = source;
|
|
7711
7646
|
|
|
7712
7647
|
// apply timestamp filter
|
|
7713
7648
|
if (this.props.timestampFilter) {
|
|
7714
|
-
|
|
7649
|
+
const {
|
|
7715
7650
|
filterDateStart,
|
|
7716
7651
|
filterDateEnd
|
|
7717
7652
|
} = this.state;
|
|
7718
|
-
|
|
7653
|
+
const {
|
|
7719
7654
|
filterKey
|
|
7720
7655
|
} = this.props.timestampFilter;
|
|
7721
|
-
|
|
7722
|
-
|
|
7656
|
+
const minDate = filterDateStart.valueOf();
|
|
7657
|
+
const maxDate = filterDateEnd.valueOf();
|
|
7723
7658
|
result = _.filter(source, item => {
|
|
7724
7659
|
return item[filterKey] >= minDate && item[filterKey] <= maxDate;
|
|
7725
7660
|
});
|
|
7726
7661
|
}
|
|
7727
7662
|
|
|
7728
7663
|
// map result to columns
|
|
7729
|
-
|
|
7664
|
+
const selectedheaderKeys = selectedHeaders.map(h => h.key);
|
|
7730
7665
|
return result.map(i => _.pick(i, selectedheaderKeys));
|
|
7731
7666
|
});
|
|
7732
7667
|
_defineProperty(this, "renderTimestampFilter", () => {
|
|
@@ -7762,7 +7697,7 @@ class ExportCsvPopup extends Component {
|
|
|
7762
7697
|
});
|
|
7763
7698
|
});
|
|
7764
7699
|
_defineProperty(this, "renderContent", () => {
|
|
7765
|
-
|
|
7700
|
+
const {
|
|
7766
7701
|
saving,
|
|
7767
7702
|
columns
|
|
7768
7703
|
} = this.state;
|
|
@@ -7798,7 +7733,7 @@ class ExportCsvPopup extends Component {
|
|
|
7798
7733
|
})
|
|
7799
7734
|
});
|
|
7800
7735
|
});
|
|
7801
|
-
|
|
7736
|
+
const state = {
|
|
7802
7737
|
columns: props.columns,
|
|
7803
7738
|
selectedHeaders: props.columns.filter(c => c.key && c.selected),
|
|
7804
7739
|
selectedSource: [],
|
|
@@ -7811,13 +7746,13 @@ class ExportCsvPopup extends Component {
|
|
|
7811
7746
|
this.state = state;
|
|
7812
7747
|
}
|
|
7813
7748
|
render() {
|
|
7814
|
-
|
|
7749
|
+
const {
|
|
7815
7750
|
selectedHeaders
|
|
7816
7751
|
} = this.state;
|
|
7817
|
-
|
|
7752
|
+
const {
|
|
7818
7753
|
filename
|
|
7819
7754
|
} = this.props;
|
|
7820
|
-
|
|
7755
|
+
const buttons = [{
|
|
7821
7756
|
type: "primary",
|
|
7822
7757
|
isActive: this.canSave(),
|
|
7823
7758
|
text: /*#__PURE__*/jsx(CSVLink, {
|
|
@@ -7856,11 +7791,11 @@ class ExportCsvPopup extends Component {
|
|
|
7856
7791
|
}
|
|
7857
7792
|
}
|
|
7858
7793
|
|
|
7859
|
-
|
|
7794
|
+
const _excluded = ["id", "label", "help", "showError", "required"];
|
|
7860
7795
|
function ownKeys$2(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; }
|
|
7861
7796
|
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7862
7797
|
function InputGroup(_ref) {
|
|
7863
|
-
|
|
7798
|
+
let {
|
|
7864
7799
|
id,
|
|
7865
7800
|
label,
|
|
7866
7801
|
help,
|
|
@@ -7895,7 +7830,7 @@ class Tabs extends Component {
|
|
|
7895
7830
|
};
|
|
7896
7831
|
}
|
|
7897
7832
|
getTabClass(tab) {
|
|
7898
|
-
|
|
7833
|
+
let classes = "tab";
|
|
7899
7834
|
if (this.props.selectedTab === tab.value) {
|
|
7900
7835
|
classes += " tab-selected";
|
|
7901
7836
|
}
|
|
@@ -7937,7 +7872,7 @@ class ColourOptions extends Component {
|
|
|
7937
7872
|
constructor(props) {
|
|
7938
7873
|
super(props);
|
|
7939
7874
|
_defineProperty(this, "setColourCircle", () => {
|
|
7940
|
-
|
|
7875
|
+
const tc = tinycolor(this.state.colour);
|
|
7941
7876
|
this.setState({
|
|
7942
7877
|
colourCircleTop: 100 - 100 * tc.getBrightness() / 255,
|
|
7943
7878
|
colourCircleLeft: 100 * tc.toHsv().h / 360
|
|
@@ -7945,13 +7880,13 @@ class ColourOptions extends Component {
|
|
|
7945
7880
|
});
|
|
7946
7881
|
_defineProperty(this, "onColourChange", color => {
|
|
7947
7882
|
// console.log('onColourChange', color);
|
|
7948
|
-
|
|
7883
|
+
const colour = (typeof color === "object" ? color.hex : color).toUpperCase();
|
|
7949
7884
|
this.setState({
|
|
7950
7885
|
selectedColour: colour,
|
|
7951
7886
|
colour
|
|
7952
7887
|
}, () => {
|
|
7953
7888
|
this.setColourCircle();
|
|
7954
|
-
|
|
7889
|
+
const {
|
|
7955
7890
|
onColourSelected
|
|
7956
7891
|
} = this.props;
|
|
7957
7892
|
if (onColourSelected) onColourSelected(this.state.colour);
|
|
@@ -7975,7 +7910,7 @@ class ColourOptions extends Component {
|
|
|
7975
7910
|
}
|
|
7976
7911
|
componentDidUpdate(prevProps) {
|
|
7977
7912
|
if (this.props.value !== prevProps.value) {
|
|
7978
|
-
|
|
7913
|
+
const {
|
|
7979
7914
|
value
|
|
7980
7915
|
} = this.props;
|
|
7981
7916
|
this.setState({
|
|
@@ -7985,11 +7920,11 @@ class ColourOptions extends Component {
|
|
|
7985
7920
|
}
|
|
7986
7921
|
}
|
|
7987
7922
|
getQuickChoiceTabs() {
|
|
7988
|
-
|
|
7923
|
+
const {
|
|
7989
7924
|
options
|
|
7990
7925
|
} = this.props;
|
|
7991
|
-
|
|
7992
|
-
|
|
7926
|
+
const optionsArray = typeof options === "string" ? options.split(",").map(o => o.trim()) : options;
|
|
7927
|
+
const available = [{
|
|
7993
7928
|
value: "vibrant",
|
|
7994
7929
|
text: "Vibrant"
|
|
7995
7930
|
}, {
|
|
@@ -8002,7 +7937,7 @@ class ColourOptions extends Component {
|
|
|
8002
7937
|
return !optionsArray || optionsArray.length === 0 ? available : available.filter(o => optionsArray.includes(o.value));
|
|
8003
7938
|
}
|
|
8004
7939
|
renderColourQuickChoicesCircle(colour, selectedColour) {
|
|
8005
|
-
|
|
7940
|
+
const isSelected = selectedColour.toLowerCase() === colour.toLowerCase();
|
|
8006
7941
|
return /*#__PURE__*/jsx("div", {
|
|
8007
7942
|
className: "colourQuickChoices_circle".concat(isSelected ? " colourQuickChoices_circle-selected" : ""),
|
|
8008
7943
|
style: {
|
|
@@ -8016,11 +7951,11 @@ class ColourOptions extends Component {
|
|
|
8016
7951
|
});
|
|
8017
7952
|
}
|
|
8018
7953
|
renderColourOptions() {
|
|
8019
|
-
|
|
7954
|
+
const {
|
|
8020
7955
|
selectedColour,
|
|
8021
7956
|
selectedOption
|
|
8022
7957
|
} = this.state;
|
|
8023
|
-
|
|
7958
|
+
let content;
|
|
8024
7959
|
switch (selectedOption) {
|
|
8025
7960
|
case "picker":
|
|
8026
7961
|
content = /*#__PURE__*/jsx("div", {
|
|
@@ -8088,7 +8023,7 @@ class ColourOptions extends Component {
|
|
|
8088
8023
|
content = null;
|
|
8089
8024
|
break;
|
|
8090
8025
|
}
|
|
8091
|
-
|
|
8026
|
+
const tabs = this.getQuickChoiceTabs();
|
|
8092
8027
|
return /*#__PURE__*/jsxs("div", {
|
|
8093
8028
|
children: [tabs && tabs.length > 1 ? /*#__PURE__*/jsx(Tabs, {
|
|
8094
8029
|
onSelectTab: this.onSelectOption,
|
|
@@ -8115,7 +8050,7 @@ class ColourPicker extends Component {
|
|
|
8115
8050
|
constructor(props) {
|
|
8116
8051
|
super(props);
|
|
8117
8052
|
_defineProperty(this, "setColourCircle", () => {
|
|
8118
|
-
|
|
8053
|
+
const tc = tinycolor(this.state.colour);
|
|
8119
8054
|
this.setState({
|
|
8120
8055
|
colourCircleTop: 100 - 100 * tc.getBrightness() / 255,
|
|
8121
8056
|
colourCircleLeft: 100 * tc.toHsv().h / 360
|
|
@@ -8129,7 +8064,7 @@ class ColourPicker extends Component {
|
|
|
8129
8064
|
});
|
|
8130
8065
|
_defineProperty(this, "onColourChange", color => {
|
|
8131
8066
|
// console.log('onColourChange', color);
|
|
8132
|
-
|
|
8067
|
+
let colour = color;
|
|
8133
8068
|
if (typeof color === "object") {
|
|
8134
8069
|
colour = color.hex;
|
|
8135
8070
|
}
|
|
@@ -8143,7 +8078,7 @@ class ColourPicker extends Component {
|
|
|
8143
8078
|
});
|
|
8144
8079
|
});
|
|
8145
8080
|
_defineProperty(this, "onDone", () => {
|
|
8146
|
-
|
|
8081
|
+
const {
|
|
8147
8082
|
colourPickerOpen,
|
|
8148
8083
|
selectedColour
|
|
8149
8084
|
} = this.state;
|
|
@@ -8152,14 +8087,14 @@ class ColourPicker extends Component {
|
|
|
8152
8087
|
colour: selectedColour
|
|
8153
8088
|
}, () => {
|
|
8154
8089
|
this.setColourCircle();
|
|
8155
|
-
|
|
8090
|
+
const {
|
|
8156
8091
|
onColourSelected
|
|
8157
8092
|
} = this.props;
|
|
8158
8093
|
if (onColourSelected) onColourSelected(this.state.colour);
|
|
8159
8094
|
});
|
|
8160
8095
|
});
|
|
8161
8096
|
_defineProperty(this, "onCancel", () => {
|
|
8162
|
-
|
|
8097
|
+
const {
|
|
8163
8098
|
colourPickerOpen,
|
|
8164
8099
|
colour
|
|
8165
8100
|
} = this.state;
|
|
@@ -8182,7 +8117,7 @@ class ColourPicker extends Component {
|
|
|
8182
8117
|
}
|
|
8183
8118
|
componentDidUpdate(prevProps) {
|
|
8184
8119
|
if (this.props.value !== prevProps.value) {
|
|
8185
|
-
|
|
8120
|
+
const {
|
|
8186
8121
|
value
|
|
8187
8122
|
} = this.props;
|
|
8188
8123
|
this.setState({
|
|
@@ -8192,11 +8127,11 @@ class ColourPicker extends Component {
|
|
|
8192
8127
|
}
|
|
8193
8128
|
}
|
|
8194
8129
|
getQuickChoiceTabs() {
|
|
8195
|
-
|
|
8130
|
+
const {
|
|
8196
8131
|
options
|
|
8197
8132
|
} = this.props;
|
|
8198
|
-
|
|
8199
|
-
|
|
8133
|
+
const optionsArray = typeof options === "string" ? options.split(",").map(o => o.trim()) : options;
|
|
8134
|
+
const available = [{
|
|
8200
8135
|
value: "vibrant",
|
|
8201
8136
|
text: "Vibrant"
|
|
8202
8137
|
}, {
|
|
@@ -8209,7 +8144,7 @@ class ColourPicker extends Component {
|
|
|
8209
8144
|
return !optionsArray || optionsArray.length === 0 ? available : available.filter(o => optionsArray.includes(o.value));
|
|
8210
8145
|
}
|
|
8211
8146
|
renderColourQuickChoicesCircle(colour, selectedColour) {
|
|
8212
|
-
|
|
8147
|
+
const isSelected = selectedColour.toLowerCase() === colour.toLowerCase();
|
|
8213
8148
|
return /*#__PURE__*/jsx("div", {
|
|
8214
8149
|
className: "colourQuickChoices_circle".concat(isSelected ? " colourQuickChoices_circle-selected" : ""),
|
|
8215
8150
|
style: {
|
|
@@ -8223,11 +8158,11 @@ class ColourPicker extends Component {
|
|
|
8223
8158
|
});
|
|
8224
8159
|
}
|
|
8225
8160
|
renderColourOptions() {
|
|
8226
|
-
|
|
8161
|
+
const {
|
|
8227
8162
|
selectedColour,
|
|
8228
8163
|
selectedOption
|
|
8229
8164
|
} = this.state;
|
|
8230
|
-
|
|
8165
|
+
let content;
|
|
8231
8166
|
switch (selectedOption) {
|
|
8232
8167
|
case "picker":
|
|
8233
8168
|
content = /*#__PURE__*/jsx("div", {
|
|
@@ -8295,7 +8230,7 @@ class ColourPicker extends Component {
|
|
|
8295
8230
|
content = null;
|
|
8296
8231
|
break;
|
|
8297
8232
|
}
|
|
8298
|
-
|
|
8233
|
+
const tabs = this.getQuickChoiceTabs();
|
|
8299
8234
|
return /*#__PURE__*/jsxs("div", {
|
|
8300
8235
|
children: [tabs && tabs.length > 1 ? /*#__PURE__*/jsx(Tabs, {
|
|
8301
8236
|
onSelectTab: this.onSelectOption,
|
|
@@ -8308,11 +8243,11 @@ class ColourPicker extends Component {
|
|
|
8308
8243
|
});
|
|
8309
8244
|
}
|
|
8310
8245
|
renderColourPopup() {
|
|
8311
|
-
|
|
8246
|
+
const {
|
|
8312
8247
|
colourPickerOpen
|
|
8313
8248
|
} = this.state;
|
|
8314
8249
|
if (!colourPickerOpen) return null;
|
|
8315
|
-
|
|
8250
|
+
const {
|
|
8316
8251
|
title
|
|
8317
8252
|
} = this.props;
|
|
8318
8253
|
return /*#__PURE__*/jsx(Popup, {
|
|
@@ -8340,12 +8275,12 @@ class ColourPicker extends Component {
|
|
|
8340
8275
|
});
|
|
8341
8276
|
}
|
|
8342
8277
|
render() {
|
|
8343
|
-
|
|
8278
|
+
const {
|
|
8344
8279
|
colourCircleTop,
|
|
8345
8280
|
colourCircleLeft,
|
|
8346
8281
|
colour
|
|
8347
8282
|
} = this.state;
|
|
8348
|
-
|
|
8283
|
+
const {
|
|
8349
8284
|
children,
|
|
8350
8285
|
showHex
|
|
8351
8286
|
} = this.props;
|
|
@@ -8381,10 +8316,10 @@ class ColourPicker extends Component {
|
|
|
8381
8316
|
}
|
|
8382
8317
|
}
|
|
8383
8318
|
|
|
8384
|
-
|
|
8385
|
-
|
|
8386
|
-
|
|
8387
|
-
|
|
8319
|
+
const BAR_HEIGHT = 48;
|
|
8320
|
+
const CHART_PADDING = 10;
|
|
8321
|
+
const BarLabel = _ref => {
|
|
8322
|
+
let {
|
|
8388
8323
|
x,
|
|
8389
8324
|
y,
|
|
8390
8325
|
width,
|
|
@@ -8402,8 +8337,8 @@ var BarLabel = _ref => {
|
|
|
8402
8337
|
children: value
|
|
8403
8338
|
});
|
|
8404
8339
|
};
|
|
8405
|
-
|
|
8406
|
-
|
|
8340
|
+
const ComparisonStatBox = _ref2 => {
|
|
8341
|
+
let {
|
|
8407
8342
|
title,
|
|
8408
8343
|
data,
|
|
8409
8344
|
prevText,
|
|
@@ -8412,19 +8347,19 @@ var ComparisonStatBox = _ref2 => {
|
|
|
8412
8347
|
borderless,
|
|
8413
8348
|
hideTotal
|
|
8414
8349
|
} = _ref2;
|
|
8415
|
-
|
|
8416
|
-
|
|
8417
|
-
|
|
8418
|
-
|
|
8419
|
-
|
|
8420
|
-
|
|
8350
|
+
const total = data.reduce((sum, d) => sum + (d.value || 0), 0);
|
|
8351
|
+
const chartHeight = data.length * BAR_HEIGHT + CHART_PADDING;
|
|
8352
|
+
const maxLabelLength = data.reduce((max, d) => Math.max(max, d.name.length), 0);
|
|
8353
|
+
const yAxisWidth = Math.min(Math.max(maxLabelLength * 7, 80), 160);
|
|
8354
|
+
const opacity = isLoading ? 0.3 : 1;
|
|
8355
|
+
const wrapperStyle = borderless ? {
|
|
8421
8356
|
opacity,
|
|
8422
8357
|
padding: "12px 0"
|
|
8423
8358
|
} : {
|
|
8424
8359
|
opacity,
|
|
8425
8360
|
padding: 20
|
|
8426
8361
|
};
|
|
8427
|
-
|
|
8362
|
+
const wrapperClass = borderless ? "" : "dashboardBox";
|
|
8428
8363
|
return /*#__PURE__*/jsxs("div", {
|
|
8429
8364
|
className: wrapperClass,
|
|
8430
8365
|
style: wrapperStyle,
|
|
@@ -8523,8 +8458,8 @@ var ComparisonStatBox = _ref2 => {
|
|
|
8523
8458
|
});
|
|
8524
8459
|
};
|
|
8525
8460
|
|
|
8526
|
-
|
|
8527
|
-
|
|
8461
|
+
const StatBox = _ref => {
|
|
8462
|
+
let {
|
|
8528
8463
|
title,
|
|
8529
8464
|
icon,
|
|
8530
8465
|
value,
|
|
@@ -8533,7 +8468,7 @@ var StatBox = _ref => {
|
|
|
8533
8468
|
viewGraphLink,
|
|
8534
8469
|
isLoading
|
|
8535
8470
|
} = _ref;
|
|
8536
|
-
|
|
8471
|
+
let change = (value / previousValue - 1) * 100;
|
|
8537
8472
|
if (isNaN(change)) {
|
|
8538
8473
|
change = 0;
|
|
8539
8474
|
}
|
|
@@ -8541,7 +8476,7 @@ var StatBox = _ref => {
|
|
|
8541
8476
|
change = 100;
|
|
8542
8477
|
}
|
|
8543
8478
|
change = parseInt(change);
|
|
8544
|
-
|
|
8479
|
+
const opacity = isLoading ? 0 : 1;
|
|
8545
8480
|
return /*#__PURE__*/jsxs("div", {
|
|
8546
8481
|
className: "dashboardBox dashboardBox-stats dashboardBox-inline".concat(change > 0 ? " dashboardBox-stats-positive" : "").concat(change < 0 ? " dashboardBox-stats-negative" : ""),
|
|
8547
8482
|
children: [/*#__PURE__*/jsx("div", {
|
|
@@ -8636,7 +8571,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
8636
8571
|
Tabs: Tabs
|
|
8637
8572
|
});
|
|
8638
8573
|
|
|
8639
|
-
|
|
8574
|
+
const HelpGuide = {
|
|
8640
8575
|
Dashboard: "https://www.plusscommunities.com/user-guide",
|
|
8641
8576
|
FeaturePicker: "https://www.plusscommunities.com/getting-started-on-community-manager",
|
|
8642
8577
|
News: "https://www.plusscommunities.com/news-feature",
|
|
@@ -8653,32 +8588,32 @@ var HelpGuide = {
|
|
|
8653
8588
|
Users: "https://www.plusscommunities.com/managing-your-users",
|
|
8654
8589
|
Payment: "https://www.plusscommunities.com/setting-up-your-payment-gateway"
|
|
8655
8590
|
};
|
|
8656
|
-
|
|
8591
|
+
const Urls = {
|
|
8657
8592
|
HelpGuide
|
|
8658
8593
|
};
|
|
8659
8594
|
|
|
8660
8595
|
function ownKeys$1(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; }
|
|
8661
8596
|
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8662
|
-
|
|
8597
|
+
const INITIAL_STATE$1 = {
|
|
8663
8598
|
list: []
|
|
8664
8599
|
};
|
|
8665
8600
|
var TemplatesReducer = (function () {
|
|
8666
|
-
|
|
8667
|
-
|
|
8601
|
+
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INITIAL_STATE$1;
|
|
8602
|
+
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
8668
8603
|
switch (action.type) {
|
|
8669
8604
|
case TEMPLATES_LOADED:
|
|
8670
|
-
|
|
8605
|
+
const result = _.unionWith(action.payload, state.list, (v1, v2) => {
|
|
8671
8606
|
return v1 != null && v2 != null && v1.RowId === v2.RowId;
|
|
8672
8607
|
});
|
|
8673
8608
|
return _objectSpread$1(_objectSpread$1({}, state), {}, {
|
|
8674
8609
|
list: result
|
|
8675
8610
|
});
|
|
8676
8611
|
case TEMPLATE_REMOVED:
|
|
8677
|
-
|
|
8612
|
+
const index = _.findIndex(state.list, app => {
|
|
8678
8613
|
return app != null && app.RowId === action.payload;
|
|
8679
8614
|
});
|
|
8680
8615
|
if (index > -1) {
|
|
8681
|
-
|
|
8616
|
+
const newTemplates = [...state.list];
|
|
8682
8617
|
newTemplates.splice(index, 1);
|
|
8683
8618
|
return _objectSpread$1(_objectSpread$1({}, state), {}, {
|
|
8684
8619
|
list: newTemplates
|
|
@@ -8692,12 +8627,12 @@ var TemplatesReducer = (function () {
|
|
|
8692
8627
|
|
|
8693
8628
|
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; }
|
|
8694
8629
|
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; }
|
|
8695
|
-
|
|
8630
|
+
const INITIAL_STATE = {
|
|
8696
8631
|
list: []
|
|
8697
8632
|
};
|
|
8698
8633
|
var ScheduledActionsReducer = (function () {
|
|
8699
|
-
|
|
8700
|
-
|
|
8634
|
+
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INITIAL_STATE;
|
|
8635
|
+
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
8701
8636
|
switch (action.type) {
|
|
8702
8637
|
case SCHEDULED_ACTIONS_LOADED:
|
|
8703
8638
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
@@ -8708,10 +8643,26 @@ var ScheduledActionsReducer = (function () {
|
|
|
8708
8643
|
}
|
|
8709
8644
|
});
|
|
8710
8645
|
|
|
8711
|
-
|
|
8646
|
+
const Reducers = {
|
|
8712
8647
|
templates: TemplatesReducer,
|
|
8713
8648
|
scheduledActions: ScheduledActionsReducer
|
|
8714
8649
|
};
|
|
8715
8650
|
|
|
8716
|
-
|
|
8651
|
+
const PERMISSION_CATEGORIES = {
|
|
8652
|
+
USER_MANAGEMENT: "User Management",
|
|
8653
|
+
EVENTS: "Events",
|
|
8654
|
+
COMMUNICATION: "Communication",
|
|
8655
|
+
FACILITIES_BOOKINGS: "Facilities & Bookings",
|
|
8656
|
+
SITE_ADMINISTRATION: "Site Administration",
|
|
8657
|
+
CONTENT: "Content",
|
|
8658
|
+
PAYMENTS: "Payments",
|
|
8659
|
+
PROFILE_SETTINGS: "Profile Settings"
|
|
8660
|
+
};
|
|
8661
|
+
const IMPORTANCE_LEVELS = {
|
|
8662
|
+
CRITICAL: "critical",
|
|
8663
|
+
IMPORTANT: "important",
|
|
8664
|
+
OPTIONAL: "optional"
|
|
8665
|
+
};
|
|
8666
|
+
|
|
8667
|
+
export { index$1 as Actions, analytics as Analytics, index$2 as Apis, colours as Colours, index as Components, CoreConfig as Config, index$3 as Helper, IMPORTANCE_LEVELS, PERMISSION_CATEGORIES, Reducers, session as Session, Urls };
|
|
8717
8668
|
//# sourceMappingURL=index.js.map
|