@instructure/quiz-core 17.54.2-rc.7 → 17.55.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/CHANGELOG.md +17 -0
- package/es/banks/api/banks.js +6 -3
- package/es/banks/components/BanksList/presenter.js +17 -0
- package/es/banks/components/SharingModal/ShareList/index.js +23 -12
- package/es/banks/components/SharingModal/asyncSearch.js +17 -10
- package/es/banks/components/SharingModal/index.js +4 -1
- package/es/banks/components/SharingModal/presenter.js +211 -106
- package/lib/banks/api/banks.js +6 -3
- package/lib/banks/components/BanksList/presenter.js +17 -0
- package/lib/banks/components/SharingModal/ShareList/index.js +23 -12
- package/lib/banks/components/SharingModal/asyncSearch.js +17 -10
- package/lib/banks/components/SharingModal/index.js +5 -1
- package/lib/banks/components/SharingModal/presenter.js +214 -106
- package/package.json +10 -10
|
@@ -17,6 +17,8 @@ var _banks = require("../../api/banks.js");
|
|
|
17
17
|
|
|
18
18
|
var _sharedBanks = require("../../../common/actions/sharedBanks.js");
|
|
19
19
|
|
|
20
|
+
var _modal = require("../../../common/actions/modal.js");
|
|
21
|
+
|
|
20
22
|
var _featureCheck = require("../../../common/util/featureCheck.js");
|
|
21
23
|
|
|
22
24
|
var _presenter = _interopRequireDefault(require("./presenter.js"));
|
|
@@ -27,6 +29,7 @@ function mapStateToProps(state, ownProps) {
|
|
|
27
29
|
}).toList();
|
|
28
30
|
return {
|
|
29
31
|
improvedBankSharingEnabled: (0, _featureCheck.featureOn)('improved_bank_sharing'),
|
|
32
|
+
subAccountBankSharingEnabled: (0, _featureCheck.featureOn)('sub_account_bank_sharing'),
|
|
30
33
|
sharedBanks: sharedBanks
|
|
31
34
|
};
|
|
32
35
|
}
|
|
@@ -37,7 +40,8 @@ var mapDispatchToProps = {
|
|
|
37
40
|
updateSharedBankPermission: _banks.updateSharedBankPermission,
|
|
38
41
|
getBank: _banks.getBank,
|
|
39
42
|
removeSharedBank: _sharedBanks.removeSharedBank,
|
|
40
|
-
updateBank: _banks.updateBank
|
|
43
|
+
updateBank: _banks.updateBank,
|
|
44
|
+
withConfirm: _modal.withConfirm
|
|
41
45
|
};
|
|
42
46
|
|
|
43
47
|
var _default = (0, _redux.compose)((0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps))(_presenter.default);
|
|
@@ -9,6 +9,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports.default = exports.SharingModalPresenter = void 0;
|
|
11
11
|
|
|
12
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
13
|
+
|
|
14
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
|
+
|
|
12
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
17
|
|
|
14
18
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
@@ -31,6 +35,8 @@ var _immutable = require("immutable");
|
|
|
31
35
|
|
|
32
36
|
var _reactImmutableProptypes = _interopRequireDefault(require("react-immutable-proptypes"));
|
|
33
37
|
|
|
38
|
+
var _partial = _interopRequireDefault(require("lodash/partial"));
|
|
39
|
+
|
|
34
40
|
var _quizCommon = require("@instructure/quiz-common");
|
|
35
41
|
|
|
36
42
|
var _uiHeading = require("@instructure/ui-heading");
|
|
@@ -77,13 +83,13 @@ var styles = {
|
|
|
77
83
|
|
|
78
84
|
var noop = function noop() {};
|
|
79
85
|
|
|
80
|
-
var
|
|
86
|
+
var _ref6 = /*#__PURE__*/_react.default.createElement(_uiGrid.Grid.Col, {
|
|
81
87
|
width: "auto"
|
|
82
88
|
}, /*#__PURE__*/_react.default.createElement(_uiIcons.IconAdminLine, {
|
|
83
89
|
size: "medium"
|
|
84
90
|
}));
|
|
85
91
|
|
|
86
|
-
var
|
|
92
|
+
var _ref7 = /*#__PURE__*/_react.default.createElement(_Spinner.default, null);
|
|
87
93
|
|
|
88
94
|
var SharingModalPresenter = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
89
95
|
(0, _inherits2.default)(SharingModalPresenter, _Component);
|
|
@@ -196,14 +202,7 @@ var SharingModalPresenter = (_dec = (0, _uiThemeable.themeable)(_theme.default,
|
|
|
196
202
|
_this.newEntitiesToSubmit().forEach(function (entity) {
|
|
197
203
|
_this.props.onShare(entity.toJS());
|
|
198
204
|
|
|
199
|
-
|
|
200
|
-
entityType: entity.get('entityType'),
|
|
201
|
-
entityId: entity.get('entityId'),
|
|
202
|
-
title: entity.get('title'),
|
|
203
|
-
bankId: _this.props.bank.id,
|
|
204
|
-
permission: entity.get('permission')
|
|
205
|
-
};
|
|
206
|
-
promises.push(_this.props.shareBank(sharedBank, _this.props.getUserInfo));
|
|
205
|
+
promises.push(_this.props.shareBank(_this.sharedBankForEntity(entity), _this.props.getUserInfo));
|
|
207
206
|
}); // call the update api if any shared bank permission was updated
|
|
208
207
|
|
|
209
208
|
|
|
@@ -244,34 +243,42 @@ var SharingModalPresenter = (_dec = (0, _uiThemeable.themeable)(_theme.default,
|
|
|
244
243
|
_this.props.updateSharedCount(_this.state.shares.size - _this.numEntitiesToRemove());
|
|
245
244
|
};
|
|
246
245
|
|
|
247
|
-
_this.
|
|
246
|
+
_this.originalPermissionForEntity = function (entity) {
|
|
248
247
|
var originalEntity = _this.props.sharedBanks.find(function (sb) {
|
|
249
|
-
return sb.get('id') == id;
|
|
248
|
+
return sb.get('id') == entity.get('id');
|
|
250
249
|
}) || (0, _immutable.Map)();
|
|
251
|
-
|
|
252
|
-
|
|
250
|
+
return originalEntity.get('permission', _quizCommon.CAN_EDIT);
|
|
251
|
+
};
|
|
253
252
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
var
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
253
|
+
_this.handleEntityRemove = function (entity, undoRemove) {
|
|
254
|
+
if (_this.props.subAccountBankSharingEnabled) {
|
|
255
|
+
_this.confirmPermissionChange(entity, _quizCommon.REMOVED_ACCESS);
|
|
256
|
+
} else {
|
|
257
|
+
var permission = undoRemove ? _this.originalPermissionForEntity(entity) : _quizCommon.REMOVED_ACCESS;
|
|
258
|
+
|
|
259
|
+
_this.setState(function (prevState) {
|
|
260
|
+
var sharesIndex = prevState.shares.findIndex(function (e) {
|
|
261
|
+
return e.get('id') == entity.get('id');
|
|
262
|
+
});
|
|
263
|
+
var newEntitiesIndex = prevState.newEntities.findIndex(function (e) {
|
|
264
|
+
return e.get('id') == entity.get('id');
|
|
265
|
+
});
|
|
266
|
+
var removedNewEntity = newEntitiesIndex > -1;
|
|
267
|
+
var newShares = removedNewEntity ? prevState.shares.delete(sharesIndex) : prevState.shares.setIn([sharesIndex, 'permission'], permission);
|
|
268
|
+
var newEntities = removedNewEntity ? prevState.newEntities.delete(newEntitiesIndex) : prevState.newEntities;
|
|
269
|
+
return {
|
|
270
|
+
shares: newShares,
|
|
271
|
+
newEntities: newEntities,
|
|
272
|
+
entitiesWithChangedPermission: Object.assign({}, prevState.entitiesWithChangedPermission, (0, _defineProperty2.default)({}, entity.get('id'), permission))
|
|
273
|
+
};
|
|
274
|
+
}, _this.updateEntitiesCount);
|
|
275
|
+
}
|
|
270
276
|
};
|
|
271
277
|
|
|
272
278
|
_this.handleSearchPermissionChange = function (e, _ref3) {
|
|
273
279
|
var value = _ref3.value;
|
|
274
|
-
|
|
280
|
+
|
|
281
|
+
_this.setState({
|
|
275
282
|
searchPermission: value
|
|
276
283
|
});
|
|
277
284
|
};
|
|
@@ -297,23 +304,90 @@ var SharingModalPresenter = (_dec = (0, _uiThemeable.themeable)(_theme.default,
|
|
|
297
304
|
});
|
|
298
305
|
}));
|
|
299
306
|
|
|
300
|
-
_this.
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
307
|
+
if (_this.props.subAccountBankSharingEnabled) {
|
|
308
|
+
newEntities.forEach(function (entity) {
|
|
309
|
+
_this.props.onShare(entity.toJS());
|
|
310
|
+
|
|
311
|
+
_this.props.shareBank(_this.sharedBankForEntity(entity), _this.props.getUserInfo);
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
_this.setState({
|
|
315
|
+
searchSelection: []
|
|
316
|
+
});
|
|
317
|
+
} else {
|
|
318
|
+
_this.setState({
|
|
319
|
+
searchSelection: [],
|
|
320
|
+
shares: newEntities.concat(_this.state.shares),
|
|
321
|
+
newEntities: newEntities.concat(_this.state.newEntities)
|
|
322
|
+
}, _this.updateEntitiesCount);
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
_this.updatePermission = /*#__PURE__*/function () {
|
|
327
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(entity, permission) {
|
|
328
|
+
var _this$props, updateSharedBankPermission, getBank, bank;
|
|
329
|
+
|
|
330
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
331
|
+
while (1) {
|
|
332
|
+
switch (_context.prev = _context.next) {
|
|
333
|
+
case 0:
|
|
334
|
+
_this$props = _this.props, updateSharedBankPermission = _this$props.updateSharedBankPermission, getBank = _this$props.getBank, bank = _this$props.bank;
|
|
335
|
+
_context.next = 3;
|
|
336
|
+
return updateSharedBankPermission(bank.id, entity.get('id'), permission);
|
|
337
|
+
|
|
338
|
+
case 3:
|
|
339
|
+
getBank(bank.id); // make sure the user still has access to the bank
|
|
340
|
+
|
|
341
|
+
case 4:
|
|
342
|
+
case "end":
|
|
343
|
+
return _context.stop();
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}, _callee);
|
|
347
|
+
}));
|
|
348
|
+
|
|
349
|
+
return function (_x, _x2) {
|
|
350
|
+
return _ref4.apply(this, arguments);
|
|
351
|
+
};
|
|
352
|
+
}();
|
|
353
|
+
|
|
354
|
+
_this.translatedPermissionLevel = function (permission) {
|
|
355
|
+
var _CAN_EDIT$READ_ONLY$p;
|
|
356
|
+
|
|
357
|
+
return (_CAN_EDIT$READ_ONLY$p = {}, (0, _defineProperty2.default)(_CAN_EDIT$READ_ONLY$p, _quizCommon.CAN_EDIT, (0, _formatMessage.default)('edit')), (0, _defineProperty2.default)(_CAN_EDIT$READ_ONLY$p, _quizCommon.READ_ONLY, (0, _formatMessage.default)('view')), _CAN_EDIT$READ_ONLY$p)[permission];
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
_this.confirmPermissionChange = function (entity, permission) {
|
|
361
|
+
var confirmText = permission === _quizCommon.REMOVED_ACCESS ? (0, _formatMessage.default)('You are about to remove { accessLevel } access for { entityTitle } to this bank.', {
|
|
362
|
+
accessLevel: _this.translatedPermissionLevel(_this.originalPermissionForEntity(entity)),
|
|
363
|
+
entityTitle: entity.get('title')
|
|
364
|
+
}) : (0, _formatMessage.default)('You are about to change access level for { entityTitle } from { originalAccessLevel } to { permission }.', {
|
|
365
|
+
entityTitle: entity.get('title'),
|
|
366
|
+
originalAccessLevel: _this.translatedPermissionLevel(_this.originalPermissionForEntity(entity)),
|
|
367
|
+
permission: _this.translatedPermissionLevel(permission)
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
_this.props.withConfirm((0, _partial.default)(_this.updatePermission, entity, permission), {
|
|
371
|
+
title: (0, _formatMessage.default)('Change Permission'),
|
|
372
|
+
text: confirmText,
|
|
373
|
+
continueText: (0, _formatMessage.default)('Confirm')
|
|
374
|
+
});
|
|
305
375
|
};
|
|
306
376
|
|
|
307
377
|
_this.handleEntityPermissionChange = function (entity, permission) {
|
|
308
|
-
_this.
|
|
309
|
-
|
|
310
|
-
|
|
378
|
+
if (_this.props.subAccountBankSharingEnabled) {
|
|
379
|
+
_this.confirmPermissionChange(entity, permission);
|
|
380
|
+
} else {
|
|
381
|
+
_this.setState(function (prevState) {
|
|
382
|
+
var index = prevState.shares.findIndex(function (share) {
|
|
383
|
+
return share.get('id') === entity.get('id');
|
|
384
|
+
});
|
|
385
|
+
return {
|
|
386
|
+
shares: prevState.shares.setIn([index, 'permission'], permission),
|
|
387
|
+
entitiesWithChangedPermission: Object.assign({}, prevState.entitiesWithChangedPermission, (0, _defineProperty2.default)({}, entity.get('id'), permission))
|
|
388
|
+
};
|
|
311
389
|
});
|
|
312
|
-
|
|
313
|
-
shares: prevState.shares.setIn([index, 'permission'], permission),
|
|
314
|
-
entitiesWithChangedPermission: Object.assign({}, prevState.entitiesWithChangedPermission, (0, _defineProperty2.default)({}, entity.get('id'), permission))
|
|
315
|
-
};
|
|
316
|
-
});
|
|
390
|
+
}
|
|
317
391
|
};
|
|
318
392
|
|
|
319
393
|
_this.toggleAccountShare = function (event) {
|
|
@@ -324,8 +398,8 @@ var SharingModalPresenter = (_dec = (0, _uiThemeable.themeable)(_theme.default,
|
|
|
324
398
|
});
|
|
325
399
|
};
|
|
326
400
|
|
|
327
|
-
_this.handleAccountPermissionChange = function (e,
|
|
328
|
-
var value =
|
|
401
|
+
_this.handleAccountPermissionChange = function (e, _ref5) {
|
|
402
|
+
var value = _ref5.value;
|
|
329
403
|
return _this.setState({
|
|
330
404
|
accountPermission: value
|
|
331
405
|
});
|
|
@@ -339,6 +413,45 @@ var SharingModalPresenter = (_dec = (0, _uiThemeable.themeable)(_theme.default,
|
|
|
339
413
|
_this.shareButtonRef = node;
|
|
340
414
|
};
|
|
341
415
|
|
|
416
|
+
_this.renderSearchSection = function (searchType) {
|
|
417
|
+
if (_this.props.bank.canEdit()) {
|
|
418
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_uiGrid.Grid, {
|
|
419
|
+
vAlign: "bottom",
|
|
420
|
+
colSpacing: "small"
|
|
421
|
+
}, /*#__PURE__*/_react.default.createElement(_uiGrid.Grid.Row, null, /*#__PURE__*/_react.default.createElement(_uiGrid.Grid.Col, null, /*#__PURE__*/_react.default.createElement(_asyncSearch.default, {
|
|
422
|
+
getShareableCourses: _this.props.getShareableCourses,
|
|
423
|
+
getShareableUsers: _this.props.getShareableUsers,
|
|
424
|
+
improvedBankSharingEnabled: _this.props.improvedBankSharingEnabled,
|
|
425
|
+
minChars: _this.props.minChars,
|
|
426
|
+
onSelectionChange: _this.handleSearchSelectionChange,
|
|
427
|
+
searchType: searchType,
|
|
428
|
+
selectedOption: _this.state.searchSelection,
|
|
429
|
+
selectionFilter: _this.handleSearchFilter
|
|
430
|
+
})), _this.props.improvedBankSharingEnabled && /*#__PURE__*/_react.default.createElement(_uiGrid.Grid.Col, {
|
|
431
|
+
width: "auto"
|
|
432
|
+
}, /*#__PURE__*/_react.default.createElement(_uiSimpleSelect.SimpleSelect, {
|
|
433
|
+
onChange: _this.handleSearchPermissionChange,
|
|
434
|
+
value: _this.state.searchPermission,
|
|
435
|
+
renderLabel: (0, _formatMessage.default)('Access')
|
|
436
|
+
}, /*#__PURE__*/_react.default.createElement(_uiSimpleSelect.SimpleSelect.Option, {
|
|
437
|
+
id: "sharing-modal-search-section-select-option-can-view",
|
|
438
|
+
value: _quizCommon.READ_ONLY
|
|
439
|
+
}, (0, _formatMessage.default)('Can view')), /*#__PURE__*/_react.default.createElement(_uiSimpleSelect.SimpleSelect.Option, {
|
|
440
|
+
id: "sharing-modal-search-section-select-option-can-edit",
|
|
441
|
+
value: _quizCommon.CAN_EDIT
|
|
442
|
+
}, (0, _formatMessage.default)('Can edit')))), /*#__PURE__*/_react.default.createElement(_uiGrid.Grid.Col, {
|
|
443
|
+
width: "auto"
|
|
444
|
+
}, /*#__PURE__*/_react.default.createElement(_uiButtons.Button, {
|
|
445
|
+
"data-automation": "sdk-shared-bank-add-user-button",
|
|
446
|
+
ref: _this.handleShareButtonRef,
|
|
447
|
+
onClick: _this.handleShare,
|
|
448
|
+
variant: _this.state.searchSelection.length ? 'success' : 'default'
|
|
449
|
+
}, (0, _formatMessage.default)('Add'))))), /*#__PURE__*/_react.default.createElement("div", {
|
|
450
|
+
className: styles.separator
|
|
451
|
+
}));
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
|
|
342
455
|
return _this;
|
|
343
456
|
}
|
|
344
457
|
|
|
@@ -361,15 +474,26 @@ var SharingModalPresenter = (_dec = (0, _uiThemeable.themeable)(_theme.default,
|
|
|
361
474
|
// HELPERS
|
|
362
475
|
// =============
|
|
363
476
|
|
|
477
|
+
}, {
|
|
478
|
+
key: "sharedBankForEntity",
|
|
479
|
+
value: function sharedBankForEntity(entity) {
|
|
480
|
+
return {
|
|
481
|
+
entityType: entity.get('entityType'),
|
|
482
|
+
entityId: entity.get('entityId'),
|
|
483
|
+
title: entity.get('title'),
|
|
484
|
+
bankId: this.props.bank.id,
|
|
485
|
+
permission: entity.get('permission')
|
|
486
|
+
};
|
|
487
|
+
}
|
|
364
488
|
}, {
|
|
365
489
|
key: "renderAccountPermissions",
|
|
366
490
|
// =============
|
|
367
491
|
// RENDERING
|
|
368
492
|
// =============
|
|
369
493
|
value: function renderAccountPermissions() {
|
|
370
|
-
var _this$
|
|
371
|
-
currentUser = _this$
|
|
372
|
-
improvedBankSharingEnabled = _this$
|
|
494
|
+
var _this$props2 = this.props,
|
|
495
|
+
currentUser = _this$props2.currentUser,
|
|
496
|
+
improvedBankSharingEnabled = _this$props2.improvedBankSharingEnabled;
|
|
373
497
|
var roles = currentUser && currentUser.enrollment_names || [];
|
|
374
498
|
|
|
375
499
|
if (improvedBankSharingEnabled && roles.includes('admin')) {
|
|
@@ -378,7 +502,7 @@ var SharingModalPresenter = (_dec = (0, _uiThemeable.themeable)(_theme.default,
|
|
|
378
502
|
margin: "0 0 medium 0"
|
|
379
503
|
}, /*#__PURE__*/_react.default.createElement(_uiGrid.Grid, {
|
|
380
504
|
colSpacing: "small"
|
|
381
|
-
}, /*#__PURE__*/_react.default.createElement(_uiGrid.Grid.Row, null,
|
|
505
|
+
}, /*#__PURE__*/_react.default.createElement(_uiGrid.Grid.Row, null, _ref6, /*#__PURE__*/_react.default.createElement(_uiGrid.Grid.Col, null, /*#__PURE__*/_react.default.createElement(_uiView.View, {
|
|
382
506
|
as: "div",
|
|
383
507
|
padding: "0 0 x-small 0"
|
|
384
508
|
}, currentUser && currentUser.account_name || (0, _formatMessage.default)('Account')), /*#__PURE__*/_react.default.createElement(_uiCheckbox.Checkbox, {
|
|
@@ -402,59 +526,54 @@ var SharingModalPresenter = (_dec = (0, _uiThemeable.themeable)(_theme.default,
|
|
|
402
526
|
}, (0, _formatMessage.default)('Can edit')))))));
|
|
403
527
|
}
|
|
404
528
|
}
|
|
405
|
-
}, {
|
|
406
|
-
key: "renderSearchSection",
|
|
407
|
-
value: function renderSearchSection() {
|
|
408
|
-
return /*#__PURE__*/_react.default.createElement(_uiGrid.Grid, {
|
|
409
|
-
vAlign: "bottom",
|
|
410
|
-
colSpacing: "small"
|
|
411
|
-
}, /*#__PURE__*/_react.default.createElement(_uiGrid.Grid.Row, null, /*#__PURE__*/_react.default.createElement(_uiGrid.Grid.Col, null, /*#__PURE__*/_react.default.createElement(_asyncSearch.default, {
|
|
412
|
-
getShareableCourses: this.props.getShareableCourses,
|
|
413
|
-
getShareableUsers: this.props.getShareableUsers,
|
|
414
|
-
improvedBankSharingEnabled: this.props.improvedBankSharingEnabled,
|
|
415
|
-
minChars: this.props.minChars,
|
|
416
|
-
onSelectionChange: this.handleSearchSelectionChange,
|
|
417
|
-
selectedOption: this.state.searchSelection,
|
|
418
|
-
selectionFilter: this.handleSearchFilter
|
|
419
|
-
})), this.props.improvedBankSharingEnabled && /*#__PURE__*/_react.default.createElement(_uiGrid.Grid.Col, {
|
|
420
|
-
width: "auto"
|
|
421
|
-
}, /*#__PURE__*/_react.default.createElement(_uiSimpleSelect.SimpleSelect, {
|
|
422
|
-
onChange: this.handleSearchPermissionChange,
|
|
423
|
-
value: this.state.searchPermission,
|
|
424
|
-
renderLabel: (0, _formatMessage.default)('Access')
|
|
425
|
-
}, /*#__PURE__*/_react.default.createElement(_uiSimpleSelect.SimpleSelect.Option, {
|
|
426
|
-
id: "sharing-modal-search-section-select-option-can-view",
|
|
427
|
-
value: _quizCommon.READ_ONLY
|
|
428
|
-
}, (0, _formatMessage.default)('Can view')), /*#__PURE__*/_react.default.createElement(_uiSimpleSelect.SimpleSelect.Option, {
|
|
429
|
-
id: "sharing-modal-search-section-select-option-can-edit",
|
|
430
|
-
value: _quizCommon.CAN_EDIT
|
|
431
|
-
}, (0, _formatMessage.default)('Can edit')))), /*#__PURE__*/_react.default.createElement(_uiGrid.Grid.Col, {
|
|
432
|
-
width: "auto"
|
|
433
|
-
}, /*#__PURE__*/_react.default.createElement(_uiButtons.Button, {
|
|
434
|
-
"data-automation": "sdk-shared-bank-add-user-button",
|
|
435
|
-
ref: this.handleShareButtonRef,
|
|
436
|
-
onClick: this.handleShare,
|
|
437
|
-
variant: this.state.searchSelection.length ? 'success' : 'default'
|
|
438
|
-
}, (0, _formatMessage.default)('Add')))));
|
|
439
|
-
}
|
|
440
529
|
}, {
|
|
441
530
|
key: "renderEntitiesSection",
|
|
442
531
|
value: function renderEntitiesSection() {
|
|
443
532
|
return /*#__PURE__*/_react.default.createElement(_index.default, {
|
|
444
|
-
ref: this.handleShareListRef,
|
|
445
|
-
improvedBankSharingEnabled: this.props.improvedBankSharingEnabled,
|
|
446
533
|
canEdit: this.props.bank.canEdit(),
|
|
534
|
+
entitiesWithChangedPermission: this.state.entitiesWithChangedPermission,
|
|
535
|
+
improvedBankSharingEnabled: this.props.improvedBankSharingEnabled,
|
|
447
536
|
newEntities: this.state.newEntities,
|
|
537
|
+
onEntityRemove: this.handleEntityRemove,
|
|
538
|
+
onPermissionChange: this.handleEntityPermissionChange,
|
|
539
|
+
ref: this.handleShareListRef,
|
|
540
|
+
renderSearchSection: this.renderSearchSection // searchPermission and searchSelection are not used directly by ShareList,
|
|
541
|
+
// but are needed as props so that AsyncSearch/Select rerenders when those values change
|
|
542
|
+
,
|
|
543
|
+
searchPermission: this.state.searchPermission,
|
|
544
|
+
searchSelection: this.state.searchSelection,
|
|
448
545
|
sharedBanks: this.props.sharedBanks,
|
|
449
546
|
shares: this.state.shares,
|
|
450
|
-
|
|
451
|
-
onEntityRemove: this.handleEntityRemove,
|
|
452
|
-
entitiesWithChangedPermission: this.state.entitiesWithChangedPermission
|
|
547
|
+
subAccountBankSharingEnabled: this.props.subAccountBankSharingEnabled
|
|
453
548
|
});
|
|
454
549
|
}
|
|
550
|
+
}, {
|
|
551
|
+
key: "renderFooter",
|
|
552
|
+
value: function renderFooter() {
|
|
553
|
+
if (this.props.subAccountBankSharingEnabled) {
|
|
554
|
+
return /*#__PURE__*/_react.default.createElement(_uiButtons.Button, {
|
|
555
|
+
variant: "primary",
|
|
556
|
+
margin: "0 x-small 0 0",
|
|
557
|
+
onClick: this.handleDismiss
|
|
558
|
+
}, (0, _formatMessage.default)('Close'));
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_uiButtons.Button, {
|
|
562
|
+
"data-automation": "sdk-shared-bank-cancel-button",
|
|
563
|
+
variant: "light",
|
|
564
|
+
onClick: this.handleDismiss,
|
|
565
|
+
margin: "0 x-small 0 0"
|
|
566
|
+
}, (0, _formatMessage.default)('Cancel')), /*#__PURE__*/_react.default.createElement(_uiButtons.Button, {
|
|
567
|
+
"data-automation": "sdk-shared-bank-done-button",
|
|
568
|
+
variant: "primary",
|
|
569
|
+
onClick: this.handleSubmit,
|
|
570
|
+
margin: "0 x-small 0 0"
|
|
571
|
+
}, (0, _formatMessage.default)('Done')));
|
|
572
|
+
}
|
|
455
573
|
}, {
|
|
456
574
|
key: "render",
|
|
457
575
|
value: function render() {
|
|
576
|
+
var subAccountBankSharingEnabled = this.props.subAccountBankSharingEnabled;
|
|
458
577
|
return /*#__PURE__*/_react.default.createElement(_quizCommon.Modal, {
|
|
459
578
|
open: this.props.isOpen,
|
|
460
579
|
onDismiss: this.handleDismiss,
|
|
@@ -467,21 +586,7 @@ var SharingModalPresenter = (_dec = (0, _uiThemeable.themeable)(_theme.default,
|
|
|
467
586
|
placement: "end",
|
|
468
587
|
offset: "medium",
|
|
469
588
|
screenReaderLabel: (0, _formatMessage.default)('Close')
|
|
470
|
-
})), /*#__PURE__*/_react.default.createElement(_quizCommon.ModalBody, null, this.renderAccountPermissions(), this.
|
|
471
|
-
className: "fs-mask"
|
|
472
|
-
}, this.renderSearchSection()), /*#__PURE__*/_react.default.createElement("div", {
|
|
473
|
-
className: styles.separator
|
|
474
|
-
})), this.state.shares.size > 0 ? this.renderEntitiesSection() : _ref6), /*#__PURE__*/_react.default.createElement(_quizCommon.ModalFooter, null, /*#__PURE__*/_react.default.createElement(_uiButtons.Button, {
|
|
475
|
-
"data-automation": "sdk-shared-bank-cancel-button",
|
|
476
|
-
variant: "light",
|
|
477
|
-
onClick: this.handleDismiss,
|
|
478
|
-
margin: "0 x-small 0 0"
|
|
479
|
-
}, (0, _formatMessage.default)('Cancel')), /*#__PURE__*/_react.default.createElement(_uiButtons.Button, {
|
|
480
|
-
"data-automation": "sdk-shared-bank-done-button",
|
|
481
|
-
variant: "primary",
|
|
482
|
-
onClick: this.handleSubmit,
|
|
483
|
-
margin: "0 x-small 0 0"
|
|
484
|
-
}, (0, _formatMessage.default)('Done'))));
|
|
589
|
+
})), /*#__PURE__*/_react.default.createElement(_quizCommon.ModalBody, null, !subAccountBankSharingEnabled && this.renderAccountPermissions(), !subAccountBankSharingEnabled && this.renderSearchSection(), this.state.shares.size > 0 ? this.renderEntitiesSection() : _ref7), /*#__PURE__*/_react.default.createElement(_quizCommon.ModalFooter, null, this.renderFooter()));
|
|
485
590
|
}
|
|
486
591
|
}]);
|
|
487
592
|
SharingModalPresenter.displayName = "SharingModalPresenter";
|
|
@@ -513,9 +618,11 @@ var SharingModalPresenter = (_dec = (0, _uiThemeable.themeable)(_theme.default,
|
|
|
513
618
|
removeSharedBank: _propTypes.default.func.isRequired,
|
|
514
619
|
shareBank: _propTypes.default.func.isRequired,
|
|
515
620
|
sharedBanks: _reactImmutableProptypes.default.list,
|
|
621
|
+
subAccountBankSharingEnabled: _propTypes.default.bool,
|
|
516
622
|
updateBank: _propTypes.default.func.isRequired,
|
|
517
623
|
updateSharedBankPermission: _propTypes.default.func.isRequired,
|
|
518
|
-
updateSharedCount: _propTypes.default.func
|
|
624
|
+
updateSharedCount: _propTypes.default.func,
|
|
625
|
+
withConfirm: _propTypes.default.func.isRequired
|
|
519
626
|
}, _class2.defaultProps = {
|
|
520
627
|
bank: null,
|
|
521
628
|
currentUser: null,
|
|
@@ -526,6 +633,7 @@ var SharingModalPresenter = (_dec = (0, _uiThemeable.themeable)(_theme.default,
|
|
|
526
633
|
onDismiss: noop,
|
|
527
634
|
onShare: function onShare() {},
|
|
528
635
|
sharedBanks: (0, _immutable.List)(),
|
|
636
|
+
subAccountBankSharingEnabled: false,
|
|
529
637
|
updateSharedCount: Function.prototype
|
|
530
638
|
}, _temp)) || _class);
|
|
531
639
|
exports.SharingModalPresenter = SharingModalPresenter;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/quiz-core",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.55.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "The Quiz React SDK by Instructure Inc.",
|
|
6
6
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@instructure/outcomes-ui": "^2.1.8",
|
|
44
|
-
"@instructure/quiz-common": "17.
|
|
45
|
-
"@instructure/quiz-i18n": "17.
|
|
46
|
-
"@instructure/quiz-interactions": "17.
|
|
47
|
-
"@instructure/quiz-number-input": "17.
|
|
48
|
-
"@instructure/quiz-rce": "17.
|
|
44
|
+
"@instructure/quiz-common": "^17.55.0",
|
|
45
|
+
"@instructure/quiz-i18n": "^17.55.0",
|
|
46
|
+
"@instructure/quiz-interactions": "^17.55.0",
|
|
47
|
+
"@instructure/quiz-number-input": "^17.55.0",
|
|
48
|
+
"@instructure/quiz-rce": "^17.55.0",
|
|
49
49
|
"@instructure/ui-a11y-content": "^7.20.0",
|
|
50
50
|
"@instructure/ui-alerts": "^7.20.0",
|
|
51
51
|
"@instructure/ui-avatar": "^7.20.0",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"eventemitter3": "^3.1.0",
|
|
107
107
|
"humps": "^2.0.0",
|
|
108
108
|
"immutable": "^3.8.1",
|
|
109
|
-
"instructure-validations": "17.
|
|
109
|
+
"instructure-validations": "^17.55.0",
|
|
110
110
|
"ipaddr.js": "^1.5.4",
|
|
111
111
|
"isomorphic-fetch": "^2.2.0",
|
|
112
112
|
"isuuid": "^0.1.0",
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
"uuid": "^3.2.1"
|
|
138
138
|
},
|
|
139
139
|
"devDependencies": {
|
|
140
|
-
"@instructure/quiz-scripts": "17.
|
|
140
|
+
"@instructure/quiz-scripts": "^17.55.0",
|
|
141
141
|
"@instructure/ui-axe-check": "^7.20.0",
|
|
142
142
|
"@instructure/ui-babel-preset": "^7.20.0",
|
|
143
143
|
"@instructure/ui-karma-config": "^7.20.0",
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
"intl": "^1.2.4",
|
|
157
157
|
"jquery": "^2.2.3",
|
|
158
158
|
"most-subject": "^5.3.0",
|
|
159
|
-
"quiz-presets": "17.
|
|
159
|
+
"quiz-presets": "^17.55.0",
|
|
160
160
|
"react": "^16.8.6",
|
|
161
161
|
"react-addons-test-utils": "^15.6.2",
|
|
162
162
|
"react-dom": "^16.8.6",
|
|
@@ -172,5 +172,5 @@
|
|
|
172
172
|
"publishConfig": {
|
|
173
173
|
"access": "public"
|
|
174
174
|
},
|
|
175
|
-
"gitHead": "
|
|
175
|
+
"gitHead": "7dec40aac3f3f01559d44afe2925bbc6108e94c0"
|
|
176
176
|
}
|