@plusscommunities/pluss-core-web 1.6.9-auth.0 → 1.6.10-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -2,12 +2,12 @@ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
2
2
  import _regeneratorRuntime from '@babel/runtime/regenerator';
3
3
  import _ from 'lodash';
4
4
  import axios from 'axios';
5
+ import { Auth, Storage } from 'aws-amplify';
5
6
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
6
7
  import moment from 'moment';
7
8
  import React, { Component, PureComponent } from 'react';
8
9
  import $ from 'jquery';
9
10
  import Cookies from 'js-cookie';
10
- import { Storage } from 'aws-amplify';
11
11
  import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
12
12
  import _createClass from '@babel/runtime/helpers/createClass';
13
13
  import _inherits from '@babel/runtime/helpers/inherits';
@@ -49,75 +49,7 @@ var CoreConfig = {
49
49
  defaultAllowComments: true,
50
50
  makeApiKey: '',
51
51
  logo: '',
52
- clientName: '',
53
- AuthStrategy: {
54
- getAccessToken: function () {
55
- var _getAccessToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
56
- return _regeneratorRuntime.wrap(function _callee$(_context) {
57
- while (1) {
58
- switch (_context.prev = _context.next) {
59
- case 0:
60
- return _context.abrupt("return", null);
61
-
62
- case 1:
63
- case "end":
64
- return _context.stop();
65
- }
66
- }
67
- }, _callee);
68
- }));
69
-
70
- function getAccessToken() {
71
- return _getAccessToken.apply(this, arguments);
72
- }
73
-
74
- return getAccessToken;
75
- }(),
76
- getCurrentUserId: function () {
77
- var _getCurrentUserId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
78
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
79
- while (1) {
80
- switch (_context2.prev = _context2.next) {
81
- case 0:
82
- return _context2.abrupt("return", null);
83
-
84
- case 1:
85
- case "end":
86
- return _context2.stop();
87
- }
88
- }
89
- }, _callee2);
90
- }));
91
-
92
- function getCurrentUserId() {
93
- return _getCurrentUserId.apply(this, arguments);
94
- }
95
-
96
- return getCurrentUserId;
97
- }(),
98
- hasActiveSession: function () {
99
- var _hasActiveSession = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
100
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
101
- while (1) {
102
- switch (_context3.prev = _context3.next) {
103
- case 0:
104
- return _context3.abrupt("return", false);
105
-
106
- case 1:
107
- case "end":
108
- return _context3.stop();
109
- }
110
- }
111
- }, _callee3);
112
- }));
113
-
114
- function hasActiveSession() {
115
- return _hasActiveSession.apply(this, arguments);
116
- }
117
-
118
- return hasActiveSession;
119
- }()
120
- }
52
+ clientName: ''
121
53
  },
122
54
  init: function init(environment) {
123
55
  CoreConfig.env = environment;
@@ -126,28 +58,29 @@ var CoreConfig = {
126
58
 
127
59
  var getSessionTokenAWS = /*#__PURE__*/function () {
128
60
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(prefix) {
129
- var token;
61
+ var data, token;
130
62
  return _regeneratorRuntime.wrap(function _callee$(_context) {
131
63
  while (1) {
132
64
  switch (_context.prev = _context.next) {
133
65
  case 0:
134
66
  _context.next = 2;
135
- return CoreConfig.env.AuthStrategy.getAccessToken();
67
+ return Auth.currentSession();
136
68
 
137
69
  case 2:
138
- token = _context.sent;
70
+ data = _context.sent;
71
+ token = data.getAccessToken().getJwtToken();
139
72
 
140
73
  if (!_.isUndefined(prefix)) {
141
- _context.next = 5;
74
+ _context.next = 6;
142
75
  break;
143
76
  }
144
77
 
145
78
  return _context.abrupt("return", token);
146
79
 
147
- case 5:
80
+ case 6:
148
81
  return _context.abrupt("return", "".concat(prefix, " ").concat(token));
149
82
 
150
- case 6:
83
+ case 7:
151
84
  case "end":
152
85
  return _context.stop();
153
86
  }
@@ -207,28 +140,30 @@ var unauthedFunction = function unauthedFunction(request) {
207
140
  };
208
141
  var getCurrentUserSub = /*#__PURE__*/function () {
209
142
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
143
+ var user;
210
144
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
211
145
  while (1) {
212
146
  switch (_context3.prev = _context3.next) {
213
147
  case 0:
214
148
  _context3.prev = 0;
215
149
  _context3.next = 3;
216
- return CoreConfig.env.AuthStrategy.getCurrentUserId();
150
+ return Auth.currentUserInfo();
217
151
 
218
152
  case 3:
219
- return _context3.abrupt("return", _context3.sent);
153
+ user = _context3.sent;
154
+ return _context3.abrupt("return", user.id);
220
155
 
221
- case 6:
222
- _context3.prev = 6;
156
+ case 7:
157
+ _context3.prev = 7;
223
158
  _context3.t0 = _context3["catch"](0);
224
159
  return _context3.abrupt("return", null);
225
160
 
226
- case 9:
161
+ case 10:
227
162
  case "end":
228
163
  return _context3.stop();
229
164
  }
230
165
  }
231
- }, _callee3, null, [[0, 6]]);
166
+ }, _callee3, null, [[0, 7]]);
232
167
  }));
233
168
 
234
169
  return function getCurrentUserSub() {
@@ -237,19 +172,19 @@ var getCurrentUserSub = /*#__PURE__*/function () {
237
172
  }();
238
173
  var checkLoggedIn = /*#__PURE__*/function () {
239
174
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(self) {
240
- var isLoggedIn;
175
+ var user;
241
176
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
242
177
  while (1) {
243
178
  switch (_context4.prev = _context4.next) {
244
179
  case 0:
245
180
  _context4.prev = 0;
246
181
  _context4.next = 3;
247
- return CoreConfig.env.AuthStrategy.hasActiveSession();
182
+ return Auth.currentAuthenticatedUser();
248
183
 
249
184
  case 3:
250
- isLoggedIn = _context4.sent;
185
+ user = _context4.sent;
251
186
 
252
- if (!isLoggedIn) {
187
+ if (_.isUndefined(user) || user == null || user.username == null) {
253
188
  console.log('redirecting to login');
254
189
  self.props.history.push('/login');
255
190
  }
@@ -1690,35 +1625,31 @@ function CanvasImageUploader(options) {
1690
1625
  var fileActions = {
1691
1626
  uploadMediaAsync: function () {
1692
1627
  var _uploadMediaAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(file, filename) {
1693
- var newFilename, signedUrlRes, baseUploadsUrl;
1628
+ var newFilename, userId, url, _Config$env, baseUploadsUrl, uploadBucket;
1629
+
1694
1630
  return _regeneratorRuntime.wrap(function _callee$(_context) {
1695
1631
  while (1) {
1696
1632
  switch (_context.prev = _context.next) {
1697
1633
  case 0:
1698
1634
  newFilename = filename.replace(/[^a-z0-9+.]+/gi, '').toLowerCase();
1699
1635
  _context.next = 3;
1700
- return authedFunction({
1701
- method: 'GET',
1702
- url: getUrl('media', 'get/presignedurl', {
1703
- filename: newFilename,
1704
- contentType: file.type
1705
- })
1706
- });
1636
+ return getCurrentUserSub();
1707
1637
 
1708
1638
  case 3:
1709
- signedUrlRes = _context.sent;
1710
- _context.next = 6;
1711
- return axios.put(signedUrlRes.data.url, file, {
1712
- headers: {
1713
- 'Content-Type': file.type
1714
- }
1639
+ userId = _context.sent;
1640
+ url = "uploads/users/".concat(userId, "/public/").concat(randomString(), "/").concat(newFilename);
1641
+ _Config$env = CoreConfig.env, baseUploadsUrl = _Config$env.baseUploadsUrl, uploadBucket = _Config$env.uploadBucket;
1642
+ _context.next = 8;
1643
+ return Storage.put(url, file, {
1644
+ level: 'public',
1645
+ bucket: uploadBucket
1715
1646
  });
1716
1647
 
1717
- case 6:
1718
- baseUploadsUrl = CoreConfig.env.baseUploadsUrl;
1719
- return _context.abrupt("return", "".concat(baseUploadsUrl).concat(signedUrlRes.data.key));
1720
-
1721
1648
  case 8:
1649
+ console.log('uploaded file', "".concat(baseUploadsUrl).concat(url));
1650
+ return _context.abrupt("return", "".concat(baseUploadsUrl).concat(url));
1651
+
1652
+ case 10:
1722
1653
  case "end":
1723
1654
  return _context.stop();
1724
1655
  }
@@ -1732,15 +1663,6 @@ var fileActions = {
1732
1663
 
1733
1664
  return uploadMediaAsync;
1734
1665
  }(),
1735
- // uploadMediaAsync: async (file, filename) => {
1736
- // const newFilename = filename.replace(/[^a-z0-9+.]+/gi, '').toLowerCase();
1737
- // const userId = await getCurrentUserSub();
1738
- // const url = `uploads/users/${userId}/public/${randomString()}/${newFilename}`;
1739
- // const { baseUploadsUrl, uploadBucket } = Config.env;
1740
- // await Storage.put(url, file, { level: 'public', bucket: uploadBucket });
1741
- // console.log('uploaded file', `${baseUploadsUrl}${url}`);
1742
- // return `${baseUploadsUrl}${url}`;
1743
- // },
1744
1666
  // readBase64: async (file) => {
1745
1667
  // return new Promise((resolve, reject) => {
1746
1668
  // var reader = new FileReader();
@@ -1754,14 +1676,6 @@ var fileActions = {
1754
1676
  // };
1755
1677
  // });
1756
1678
  // },
1757
- getPresignedUrl: function getPresignedUrl(filename) {
1758
- return authedFunction({
1759
- method: 'GET',
1760
- url: getUrl('media', 'get/presignedurl', {
1761
- filename: filename
1762
- })
1763
- });
1764
- },
1765
1679
  compressImage: function compressImage(file, maxSize, quality, noCompress) {
1766
1680
  return new Promise(function (resolve, reject) {
1767
1681
  if (noCompress) {
@@ -4896,7 +4810,7 @@ function _createSuper$u(Derived) { var hasNativeReflectConstruct = _isNativeRefl
4896
4810
  function _isNativeReflectConstruct$u() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
4897
4811
  var DEFAULT_INPUT$1 = {
4898
4812
  uploadingFile: false,
4899
- value: ''
4813
+ value: ""
4900
4814
  };
4901
4815
 
4902
4816
  var FileInputComponent = /*#__PURE__*/function (_Component) {
@@ -4918,17 +4832,17 @@ var FileInputComponent = /*#__PURE__*/function (_Component) {
4918
4832
  _defineProperty(_assertThisInitialized(_this), "state", {
4919
4833
  inputs: [{
4920
4834
  uploadingFile: false,
4921
- value: ''
4835
+ value: ""
4922
4836
  }]
4923
4837
  });
4924
4838
 
4925
4839
  _defineProperty(_assertThisInitialized(_this), "getAccept", function () {
4926
- if (_typeof(_this.props.accept) === 'object') {
4840
+ if (_typeof(_this.props.accept) === "object") {
4927
4841
  return _this.props.accept;
4928
4842
  }
4929
4843
 
4930
- if (typeof _this.props.accept === 'string') {
4931
- var accept = _defineProperty({}, _this.props.accept, [".".concat(_.last(_this.props.accept.split('/')))]);
4844
+ if (typeof _this.props.accept === "string") {
4845
+ var accept = _defineProperty({}, _this.props.accept, [".".concat(_.last(_this.props.accept.split("/")))]);
4932
4846
 
4933
4847
  return accept;
4934
4848
  }
@@ -5022,7 +4936,7 @@ var FileInputComponent = /*#__PURE__*/function (_Component) {
5022
4936
  return _this.props.handleFile(file, newInputs);
5023
4937
 
5024
4938
  case 9:
5025
- _this.checkSetDisplayValue(input, '');
4939
+ _this.checkSetDisplayValue(input, "");
5026
4940
 
5027
4941
  _context.next = 24;
5028
4942
  break;
@@ -5044,7 +4958,7 @@ var FileInputComponent = /*#__PURE__*/function (_Component) {
5044
4958
  case 20:
5045
4959
  _context.prev = 20;
5046
4960
  _context.t0 = _context["catch"](12);
5047
- console.log('handleFile error', _context.t0);
4961
+ console.log("handleFile error", _context.t0);
5048
4962
 
5049
4963
  _this.setState({
5050
4964
  uploadingFile: false
@@ -5089,7 +5003,7 @@ var FileInputComponent = /*#__PURE__*/function (_Component) {
5089
5003
  }, {
5090
5004
  key: "setValue",
5091
5005
  value: function setValue(val) {
5092
- if (typeof val === 'string') {
5006
+ if (typeof val === "string") {
5093
5007
  this.setState({
5094
5008
  inputs: [{
5095
5009
  uploadingImage: false,
@@ -5115,20 +5029,20 @@ var FileInputComponent = /*#__PURE__*/function (_Component) {
5115
5029
  }, {
5116
5030
  key: "getClassNames",
5117
5031
  value: function getClassNames(input, inputsLength) {
5118
- var classes = 'clearfix imageInput';
5032
+ var classes = "clearfix imageInput";
5119
5033
 
5120
5034
  if (input.uploadingFile) {
5121
- classes += ' imageInput-uploading';
5035
+ classes += " imageInput-uploading";
5122
5036
  } else if (!_.isEmpty(input.value) && !this.props.onlyAllowUpload) {
5123
- classes += ' imageInput-hasImage';
5037
+ classes += " imageInput-hasImage";
5124
5038
  }
5125
5039
 
5126
5040
  if (inputsLength === 1) {
5127
- classes += ' imageInput-only';
5041
+ classes += " imageInput-only";
5128
5042
  }
5129
5043
 
5130
5044
  if (this.props.style && this.props.style.height && this.props.style.height < 150) {
5131
- classes += ' imageInput-condensed';
5045
+ classes += " imageInput-condensed";
5132
5046
  }
5133
5047
 
5134
5048
  return classes;
@@ -5137,10 +5051,10 @@ var FileInputComponent = /*#__PURE__*/function (_Component) {
5137
5051
  key: "getErrorState",
5138
5052
  value: function getErrorState() {
5139
5053
  if (!_.isUndefined(this.props.showError) && this.props.showError()) {
5140
- return ' imageInput_upload--error';
5054
+ return " imageInput_upload--error";
5141
5055
  }
5142
5056
 
5143
- return '';
5057
+ return "";
5144
5058
  }
5145
5059
  }, {
5146
5060
  key: "checkSetDisplayValue",
@@ -5159,7 +5073,7 @@ var FileInputComponent = /*#__PURE__*/function (_Component) {
5159
5073
  key: "removeFile",
5160
5074
  value: function removeFile(input) {
5161
5075
  var newState = {};
5162
- input.value = '';
5076
+ input.value = "";
5163
5077
 
5164
5078
  var newInputs = _.clone(this.state.inputs);
5165
5079
 
@@ -5268,7 +5182,7 @@ var FileInputComponent = /*#__PURE__*/function (_Component) {
5268
5182
  className: "imageInput_upload ".concat(_this3.getErrorState()),
5269
5183
  style: _objectSpread$f({}, _this3.props.style)
5270
5184
  }, getRootProps()), /*#__PURE__*/React.createElement("input", getInputProps()), /*#__PURE__*/React.createElement("div", {
5271
- className: "".concat(isDragActive ? 'imageInput_dropZoneActive' : '')
5185
+ className: "".concat(isDragActive ? "imageInput_dropZoneActive" : "")
5272
5186
  }, !_this3.props.simpleStyle && /*#__PURE__*/React.createElement("img", {
5273
5187
  src: "https://s3-ap-southeast-2.amazonaws.com/pluss60-dev-media/pluss/document.svg",
5274
5188
  className: "imageInput_icon",
@@ -5294,7 +5208,7 @@ var FileInputComponent = /*#__PURE__*/function (_Component) {
5294
5208
  var _this4 = this;
5295
5209
 
5296
5210
  return /*#__PURE__*/React.createElement("div", {
5297
- className: "imageInputContainer clearfix ".concat(inputs.length === 1 ? 'imageInputContainer-noPadding' : '', " ").concat(this.props.simpleStyle ? 'imageInputContainer-simple' : ''),
5211
+ className: "imageInputContainer clearfix ".concat(inputs.length === 1 ? "imageInputContainer-noPadding" : "", " ").concat(this.props.simpleStyle ? "imageInputContainer-simple" : ""),
5298
5212
  style: _objectSpread$f({}, this.props.style)
5299
5213
  }, inputs.map(function (input, index) {
5300
5214
  return _this4.renderInput(input, index, inputs.length);
@@ -9316,7 +9230,7 @@ var AudienceSelector = /*#__PURE__*/function (_Component) {
9316
9230
  AudienceTagList = _this$state.AudienceTagList;
9317
9231
  var categoryTags = categories.map(function (c) {
9318
9232
  return {
9319
- AudienceType: 'Category',
9233
+ AudienceType: "Category",
9320
9234
  AudienceTypeSelection: c.Key,
9321
9235
  Id: "category_".concat(c.Key),
9322
9236
  Title: c.Title
@@ -9324,7 +9238,7 @@ var AudienceSelector = /*#__PURE__*/function (_Component) {
9324
9238
  });
9325
9239
  var userTypeTags = types.map(function (t) {
9326
9240
  return {
9327
- AudienceType: 'UserType',
9241
+ AudienceType: "UserType",
9328
9242
  AudienceTypeSelection: t.typeName,
9329
9243
  Id: "userType_".concat(t.typeName),
9330
9244
  Title: "User Type: ".concat(t.displayName)
@@ -9332,7 +9246,7 @@ var AudienceSelector = /*#__PURE__*/function (_Component) {
9332
9246
  });
9333
9247
  var userTagTags = tagList.map(function (t) {
9334
9248
  return {
9335
- AudienceType: 'UserTags',
9249
+ AudienceType: "UserTags",
9336
9250
  AudienceTypeSelection: t.Id,
9337
9251
  Id: "userTag_".concat(t.Id),
9338
9252
  Title: "User Tag: ".concat(t.Title)
@@ -9366,26 +9280,26 @@ var AudienceSelector = /*#__PURE__*/function (_Component) {
9366
9280
 
9367
9281
  _this.state = {
9368
9282
  categories: [{
9369
- Title: 'All Primary Users',
9370
- Key: 'resident',
9371
- ShortName: 'Primary'
9283
+ Title: "All Primary Users",
9284
+ Key: "resident",
9285
+ ShortName: "Primary"
9372
9286
  }, {
9373
- Title: 'All Staff Users',
9374
- Key: 'staff',
9375
- ShortName: 'Staff'
9287
+ Title: "All Staff Users",
9288
+ Key: "staff",
9289
+ ShortName: "Staff"
9376
9290
  }, {
9377
- Title: 'All Linked Users',
9378
- Key: 'family',
9379
- ShortName: 'Linked'
9291
+ Title: "All Linked Users",
9292
+ Key: "family",
9293
+ ShortName: "Linked"
9380
9294
  }],
9381
9295
  types: [],
9382
- AudienceType: props.audienceType || 'All',
9296
+ AudienceType: props.audienceType || "All",
9383
9297
  showInclude: false,
9384
9298
  includeList: [],
9385
9299
  showExclude: false,
9386
9300
  excludeList: [],
9387
- Type: '',
9388
- Category: '',
9301
+ Type: "",
9302
+ Category: "",
9389
9303
  userList: [],
9390
9304
  tagList: [],
9391
9305
  AudienceTagList: props.audienceTypeSelection || []
@@ -9415,7 +9329,7 @@ var AudienceSelector = /*#__PURE__*/function (_Component) {
9415
9329
  }, {
9416
9330
  key: "onSubmit",
9417
9331
  value: function onSubmit() {
9418
- if (this.state.AudienceType === 'User' && _.isEmpty(this.state.includeList)) {
9332
+ if (this.state.AudienceType === "User" && _.isEmpty(this.state.includeList)) {
9419
9333
  this.setState({
9420
9334
  showInclude: true
9421
9335
  });
@@ -9435,9 +9349,9 @@ var AudienceSelector = /*#__PURE__*/function (_Component) {
9435
9349
  Category = _this$state2.Category,
9436
9350
  Tag = _this$state2.Tag,
9437
9351
  Type = _this$state2.Type;
9438
- if (AudienceType === 'Custom') return AudienceTagList || [];
9439
- if (AudienceType === 'Category') return Category;
9440
- if (AudienceType === 'UserTags') return Tag;
9352
+ if (AudienceType === "Custom") return AudienceTagList || [];
9353
+ if (AudienceType === "Category") return Category;
9354
+ if (AudienceType === "UserTags") return Tag;
9441
9355
  return Type;
9442
9356
  }
9443
9357
  }, {
@@ -9482,9 +9396,9 @@ var AudienceSelector = /*#__PURE__*/function (_Component) {
9482
9396
  var newState = {
9483
9397
  AudienceType: type
9484
9398
  };
9485
- if (type === 'Custom') newState.AudienceTagList = selection;
9486
- if (type === 'UserType') newState.Type = selection;
9487
- if (type === 'Category') newState.Category = selection;
9399
+ if (type === "Custom") newState.AudienceTagList = selection;
9400
+ if (type === "UserType") newState.Type = selection;
9401
+ if (type === "Category") newState.Category = selection;
9488
9402
  this.setState(newState);
9489
9403
  }
9490
9404
  }, {
@@ -9492,8 +9406,8 @@ var AudienceSelector = /*#__PURE__*/function (_Component) {
9492
9406
  value: function onChangeOption(type) {
9493
9407
  this.setState({
9494
9408
  AudienceType: type,
9495
- Type: '',
9496
- Category: '',
9409
+ Type: "",
9410
+ Category: "",
9497
9411
  includeList: [],
9498
9412
  excludeList: [],
9499
9413
  AudienceTagList: []
@@ -9506,57 +9420,57 @@ var AudienceSelector = /*#__PURE__*/function (_Component) {
9506
9420
  var _this4 = this;
9507
9421
 
9508
9422
  var options = [{
9509
- Label: 'All users',
9510
- Value: 'All',
9423
+ Label: "All users",
9424
+ Value: "All",
9511
9425
  onChange: function onChange() {
9512
- return _this4.onChangeOption('All');
9426
+ return _this4.onChangeOption("All");
9513
9427
  }
9514
9428
  }];
9515
9429
 
9516
9430
  if (this.props.custom) {
9517
9431
  options.push({
9518
- Label: 'Custom',
9519
- Value: 'Custom',
9432
+ Label: "Custom",
9433
+ Value: "Custom",
9520
9434
  onChange: function onChange() {
9521
- return _this4.onChangeOption('Custom');
9435
+ return _this4.onChangeOption("Custom");
9522
9436
  }
9523
9437
  });
9524
9438
  } else {
9525
9439
  options.push({
9526
- Label: 'By user category',
9527
- Value: 'Category',
9440
+ Label: "By user category",
9441
+ Value: "Category",
9528
9442
  onChange: function onChange() {
9529
- return _this4.onChangeOption('Category');
9443
+ return _this4.onChangeOption("Category");
9530
9444
  }
9531
9445
  });
9532
9446
  }
9533
9447
 
9534
9448
  if (!this.props.disallowUserType) {
9535
9449
  options.push({
9536
- Label: 'By user type',
9537
- Value: 'UserType',
9450
+ Label: "By user type",
9451
+ Value: "UserType",
9538
9452
  onChange: function onChange() {
9539
- return _this4.onChangeOption('UserType');
9453
+ return _this4.onChangeOption("UserType");
9540
9454
  }
9541
9455
  });
9542
9456
  }
9543
9457
 
9544
9458
  if (this.props.allowTags) {
9545
9459
  options.push({
9546
- Label: 'By user tag',
9547
- Value: 'UserTags',
9460
+ Label: "By user tag",
9461
+ Value: "UserTags",
9548
9462
  onChange: function onChange() {
9549
- return _this4.onChangeOption('UserTags');
9463
+ return _this4.onChangeOption("UserTags");
9550
9464
  }
9551
9465
  });
9552
9466
  }
9553
9467
 
9554
9468
  if (!this.props.disallowSingleUsers) {
9555
9469
  options.push({
9556
- Label: 'To single users',
9557
- Value: 'User',
9470
+ Label: "To single users",
9471
+ Value: "User",
9558
9472
  onChange: function onChange() {
9559
- return _this4.onChangeOption('User');
9473
+ return _this4.onChangeOption("User");
9560
9474
  }
9561
9475
  });
9562
9476
  }
@@ -9569,11 +9483,11 @@ var AudienceSelector = /*#__PURE__*/function (_Component) {
9569
9483
  var _this$state3 = this.state,
9570
9484
  AudienceType = _this$state3.AudienceType,
9571
9485
  includeList = _this$state3.includeList;
9572
- if (AudienceType === 'Custom' && !this.validateCustom()) return false;
9573
- if (AudienceType === 'Category' && !this.validateCategory()) return false;
9574
- if (AudienceType === 'UserType' && !this.validateType()) return false;
9575
- if (AudienceType === 'User' && _.isEmpty(includeList)) return false;
9576
- if (AudienceType === 'UserTags' && !this.validateTag()) return false;
9486
+ if (AudienceType === "Custom" && !this.validateCustom()) return false;
9487
+ if (AudienceType === "Category" && !this.validateCategory()) return false;
9488
+ if (AudienceType === "UserType" && !this.validateType()) return false;
9489
+ if (AudienceType === "User" && _.isEmpty(includeList)) return false;
9490
+ if (AudienceType === "UserTags" && !this.validateTag()) return false;
9577
9491
  return true;
9578
9492
  }
9579
9493
  }, {
@@ -9599,7 +9513,7 @@ var AudienceSelector = /*#__PURE__*/function (_Component) {
9599
9513
  return typeObject.displayName;
9600
9514
  }
9601
9515
 
9602
- return '';
9516
+ return "";
9603
9517
  }
9604
9518
  }, {
9605
9519
  key: "getTagTitle",
@@ -9614,7 +9528,7 @@ var AudienceSelector = /*#__PURE__*/function (_Component) {
9614
9528
  return tag.Title;
9615
9529
  }
9616
9530
 
9617
- return '';
9531
+ return "";
9618
9532
  }
9619
9533
  }, {
9620
9534
  key: "getUserTypes",
@@ -9635,7 +9549,7 @@ var AudienceSelector = /*#__PURE__*/function (_Component) {
9635
9549
  return c.Key === e.category;
9636
9550
  });
9637
9551
 
9638
- var shortName = category ? "(".concat(category.ShortName, ") ") : '';
9552
+ var shortName = category ? "(".concat(category.ShortName, ") ") : "";
9639
9553
  e.Title = "".concat(shortName, " ").concat(e.Title);
9640
9554
  }
9641
9555
  });
@@ -9644,10 +9558,10 @@ var AudienceSelector = /*#__PURE__*/function (_Component) {
9644
9558
  };
9645
9559
 
9646
9560
  if (!_.some(res.data, function (t) {
9647
- return t.category === 'family';
9561
+ return t.category === "family";
9648
9562
  })) {
9649
9563
  newState.categories = _.filter(_this7.state.categories, function (c) {
9650
- return c.Key !== 'family';
9564
+ return c.Key !== "family";
9651
9565
  });
9652
9566
  }
9653
9567
 
@@ -9659,15 +9573,15 @@ var AudienceSelector = /*#__PURE__*/function (_Component) {
9659
9573
  value: function getUserList() {
9660
9574
  var _this8 = this;
9661
9575
 
9662
- if (this.state.AudienceType === 'UserType' && !_.isEmpty(this.state.Type)) {
9576
+ if (this.state.AudienceType === "UserType" && !_.isEmpty(this.state.Type)) {
9663
9577
  var users = [];
9664
9578
  this.state.userList.forEach(function (element) {
9665
9579
  if (element.type !== _this8.state.Type) users.push(element);
9666
9580
  });
9667
- return _.sortBy(users, 'displayName');
9581
+ return _.sortBy(users, "displayName");
9668
9582
  }
9669
9583
 
9670
- if (this.state.AudienceType === 'Category' && !_.isEmpty(this.state.Category)) {
9584
+ if (this.state.AudienceType === "Category" && !_.isEmpty(this.state.Category)) {
9671
9585
  var _users = [];
9672
9586
 
9673
9587
  var types = _.filter(this.state.types, function (type) {
@@ -9681,10 +9595,10 @@ var AudienceSelector = /*#__PURE__*/function (_Component) {
9681
9595
  _users.push(element);
9682
9596
  }
9683
9597
  });
9684
- return _.sortBy(_users, 'displayName');
9598
+ return _.sortBy(_users, "displayName");
9685
9599
  }
9686
9600
 
9687
- return _.sortBy(this.state.userList, 'displayName');
9601
+ return _.sortBy(this.state.userList, "displayName");
9688
9602
  }
9689
9603
  }, {
9690
9604
  key: "selectCat",
@@ -9709,7 +9623,7 @@ var AudienceSelector = /*#__PURE__*/function (_Component) {
9709
9623
  return typeObject.Title;
9710
9624
  }
9711
9625
 
9712
- return '';
9626
+ return "";
9713
9627
  }
9714
9628
  }, {
9715
9629
  key: "validateCategory",
@@ -9729,7 +9643,7 @@ var AudienceSelector = /*#__PURE__*/function (_Component) {
9729
9643
  }, {
9730
9644
  key: "showUserPickers",
9731
9645
  value: function showUserPickers(isInclude) {
9732
- if (isInclude && this.state.AudienceType === 'User') {
9646
+ if (isInclude && this.state.AudienceType === "User") {
9733
9647
  return true;
9734
9648
  }
9735
9649
 
@@ -9741,15 +9655,15 @@ var AudienceSelector = /*#__PURE__*/function (_Component) {
9741
9655
  return false;
9742
9656
  }
9743
9657
 
9744
- if (isInclude && this.state.AudienceType === 'All') {
9658
+ if (isInclude && this.state.AudienceType === "All") {
9745
9659
  return false;
9746
9660
  }
9747
9661
 
9748
- if (!isInclude && this.state.AudienceType === 'User') {
9662
+ if (!isInclude && this.state.AudienceType === "User") {
9749
9663
  return false;
9750
9664
  }
9751
9665
 
9752
- if (this.state.AudienceType === 'Category' && _.isEmpty(this.state.Category) || this.state.AudienceType === 'UserType' && _.isEmpty(this.state.Type)) {
9666
+ if (this.state.AudienceType === "Category" && _.isEmpty(this.state.Category) || this.state.AudienceType === "UserType" && _.isEmpty(this.state.Type)) {
9753
9667
  return false;
9754
9668
  }
9755
9669
 
@@ -9760,15 +9674,15 @@ var AudienceSelector = /*#__PURE__*/function (_Component) {
9760
9674
  value: function getUserExcludeList() {
9761
9675
  var _this10 = this;
9762
9676
 
9763
- if (this.state.AudienceType === 'UserType' && !_.isEmpty(this.state.Type)) {
9677
+ if (this.state.AudienceType === "UserType" && !_.isEmpty(this.state.Type)) {
9764
9678
  var users = [];
9765
9679
  this.state.userList.forEach(function (element) {
9766
9680
  if (element.type === _this10.state.Type) users.push(element);
9767
9681
  });
9768
- return _.sortBy(users, 'displayName');
9682
+ return _.sortBy(users, "displayName");
9769
9683
  }
9770
9684
 
9771
- if (this.state.AudienceType === 'Category' && !_.isEmpty(this.state.Category)) {
9685
+ if (this.state.AudienceType === "Category" && !_.isEmpty(this.state.Category)) {
9772
9686
  var _users2 = [];
9773
9687
 
9774
9688
  var types = _.filter(this.state.types, function (type) {
@@ -9782,10 +9696,10 @@ var AudienceSelector = /*#__PURE__*/function (_Component) {
9782
9696
  _users2.push(element);
9783
9697
  }
9784
9698
  });
9785
- return _.sortBy(_users2, 'displayName');
9699
+ return _.sortBy(_users2, "displayName");
9786
9700
  }
9787
9701
 
9788
- return _.sortBy(this.state.userList, 'displayName');
9702
+ return _.sortBy(this.state.userList, "displayName");
9789
9703
  }
9790
9704
  }, {
9791
9705
  key: "addToInc",
@@ -9859,12 +9773,12 @@ var AudienceSelector = /*#__PURE__*/function (_Component) {
9859
9773
  }, /*#__PURE__*/React.createElement(Text, {
9860
9774
  type: "formTitleSmall",
9861
9775
  className: "marginBottom-16"
9862
- }, "Exclude Users From Selection ", "(".concat(this.state.excludeList.length, ")"))), /*#__PURE__*/React.createElement(FontAwesome, {
9776
+ }, "Exclude Users From Selection", " ", "(".concat(this.state.excludeList.length, ")"))), /*#__PURE__*/React.createElement(FontAwesome, {
9863
9777
  style: {
9864
9778
  color: COLOUR_DUSK,
9865
9779
  fontSize: 12
9866
9780
  },
9867
- name: this.state.showExclude ? 'chevron-up' : 'chevron-down'
9781
+ name: this.state.showExclude ? "chevron-up" : "chevron-down"
9868
9782
  })), this.state.showExclude && /*#__PURE__*/React.createElement(exportObj$1, {
9869
9783
  add: this.addToEx.bind(this),
9870
9784
  remove: this.removeUserEx.bind(this),
@@ -9896,12 +9810,12 @@ var AudienceSelector = /*#__PURE__*/function (_Component) {
9896
9810
  }, /*#__PURE__*/React.createElement(Text, {
9897
9811
  type: "formTitleSmall",
9898
9812
  className: "marginBottom-16"
9899
- }, this.state.AudienceType !== 'User' ? 'Add Other' : 'Select', " Users ", "(".concat(this.state.includeList.length, ")"))), /*#__PURE__*/React.createElement(FontAwesome, {
9813
+ }, this.state.AudienceType !== "User" ? "Add Other" : "Select", " ", "Users ", "(".concat(this.state.includeList.length, ")"))), /*#__PURE__*/React.createElement(FontAwesome, {
9900
9814
  style: {
9901
9815
  color: COLOUR_DUSK,
9902
9816
  fontSize: 12
9903
9817
  },
9904
- name: this.state.showInclude ? 'chevron-up' : 'chevron-down'
9818
+ name: this.state.showInclude ? "chevron-up" : "chevron-down"
9905
9819
  })), this.state.showInclude && /*#__PURE__*/React.createElement(exportObj$1, {
9906
9820
  add: this.addToInc.bind(this),
9907
9821
  remove: this.removeUserInc.bind(this),
@@ -9962,7 +9876,7 @@ var AudienceSelector = /*#__PURE__*/function (_Component) {
9962
9876
  }, {
9963
9877
  key: "renderCustom",
9964
9878
  value: function renderCustom() {
9965
- if (this.state.AudienceType !== 'Custom') return null;
9879
+ if (this.state.AudienceType !== "Custom") return null;
9966
9880
  return /*#__PURE__*/React.createElement("div", {
9967
9881
  className: "optionsContent_bottom"
9968
9882
  }, /*#__PURE__*/React.createElement(Text, {
@@ -9980,17 +9894,17 @@ var AudienceSelector = /*#__PURE__*/function (_Component) {
9980
9894
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Text, {
9981
9895
  type: "formTitleSmall",
9982
9896
  className: "marginBottom-16"
9983
- }, this.props.title || 'Target Audience'), /*#__PURE__*/React.createElement(RadioButton, {
9897
+ }, this.props.title || "Target Audience"), /*#__PURE__*/React.createElement(RadioButton, {
9984
9898
  isActive: this.state.AudienceType,
9985
9899
  rowStyle: {
9986
- flexDirection: 'column'
9900
+ flexDirection: "column"
9987
9901
  },
9988
9902
  buttonStyle: {
9989
9903
  marginBottom: 8
9990
9904
  },
9991
9905
  options: this.getOptions(),
9992
9906
  disabled: this.props.disabled
9993
- }), this.state.AudienceType === 'Category' && /*#__PURE__*/React.createElement(DropdownInput, {
9907
+ }), this.state.AudienceType === "Category" && /*#__PURE__*/React.createElement(DropdownInput, {
9994
9908
  id: "typeSelect" // label='User Category'
9995
9909
  ,
9996
9910
  alwaysShowLabel: true,
@@ -10010,7 +9924,7 @@ var AudienceSelector = /*#__PURE__*/function (_Component) {
10010
9924
  },
10011
9925
  isRequired: true,
10012
9926
  disabled: this.props.disabled
10013
- }), this.state.AudienceType === 'UserType' && /*#__PURE__*/React.createElement(DropdownInput, {
9927
+ }), this.state.AudienceType === "UserType" && /*#__PURE__*/React.createElement(DropdownInput, {
10014
9928
  id: "typeSelect" // label='User Type'
10015
9929
  ,
10016
9930
  alwaysShowLabel: true,
@@ -10030,7 +9944,7 @@ var AudienceSelector = /*#__PURE__*/function (_Component) {
10030
9944
  },
10031
9945
  isRequired: true,
10032
9946
  disabled: this.props.disabled
10033
- }), this.state.AudienceType === 'UserTags' && /*#__PURE__*/React.createElement(DropdownInput, {
9947
+ }), this.state.AudienceType === "UserTags" && /*#__PURE__*/React.createElement(DropdownInput, {
10034
9948
  id: "tagSelect",
10035
9949
  alwaysShowLabel: true,
10036
9950
  placeholder: "User Tag",