@bigbinary/neeto-team-members-frontend 2.5.18 → 2.5.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -10564,6 +10564,18 @@ const DEFAULT_SELECTED_ROWS = {
10564
10564
  keys: []
10565
10565
  };
10566
10566
  const DEFAULT_NEETO_FILTERS_COLUMNS = [{
10567
+ key: "email",
10568
+ node: "email",
10569
+ label: instance.t("common.email", SINGULAR),
10570
+ type: "multi_option",
10571
+ values: []
10572
+ }, {
10573
+ key: "name",
10574
+ node: "first_name,last_name",
10575
+ label: instance.t("common.name"),
10576
+ type: "text",
10577
+ values: ""
10578
+ }, {
10567
10579
  key: "role",
10568
10580
  node: "organization_role.name",
10569
10581
  model: "OrganizationRole",
@@ -11397,9 +11409,28 @@ const getMetaName = ramda.curry((metaName, count) => {
11397
11409
  });
11398
11410
  const clearSelectedMembers = (previousCategory, currentCategory) => pure.notEquals(previousCategory, currentCategory) && pure.notEquals(currentCategory, "ALL");
11399
11411
  const buildFilterColumns = _ref10 => {
11400
- let _ref10$organizationRo = _ref10.organizationRoles,
11401
- organizationRoles = _ref10$organizationRo === void 0 ? [] : _ref10$organizationRo;
11402
- return ramda.assocPath([0, "values"], organizationRoles.map(pure.toLabelAndValue), DEFAULT_NEETO_FILTERS_COLUMNS);
11412
+ let _ref10$options = _ref10.options,
11413
+ _ref10$options$emails = _ref10$options.emails,
11414
+ emails = _ref10$options$emails === void 0 ? [] : _ref10$options$emails,
11415
+ _ref10$options$organi = _ref10$options.organizationRoles,
11416
+ organizationRoles = _ref10$options$organi === void 0 ? [] : _ref10$options$organi,
11417
+ _ref10$emailConfig = _ref10.emailConfig,
11418
+ setSearchTerm = _ref10$emailConfig.setSearchTerm,
11419
+ isLoading = _ref10$emailConfig.isLoading;
11420
+ const columnValues = {
11421
+ email: emails.map(pure.toLabelAndValue),
11422
+ role: organizationRoles.map(pure.toLabelAndValue)
11423
+ };
11424
+ return DEFAULT_NEETO_FILTERS_COLUMNS.map(column => {
11425
+ const values = columnValues[column.key];
11426
+ if (column.key === "role") return ramda.assoc("values", values, column);
11427
+ const emailConfig = {
11428
+ values,
11429
+ isLoading,
11430
+ onInputChange: setSearchTerm
11431
+ };
11432
+ return ramda.mergeLeft(emailConfig, column);
11433
+ });
11403
11434
  };
11404
11435
  const getValidCategory = function (category) {
11405
11436
  let defaultCategory = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : MEMBER_FILTER.ACTIVE.value;
@@ -12072,25 +12103,40 @@ function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) {
12072
12103
  const useFilters = _ref => {
12073
12104
  var _config$filterColumns, _config$defaultFilter;
12074
12105
  let config = _ref.config;
12106
+ const _useState = React.useState(""),
12107
+ _useState2 = _slicedToArray(_useState, 2),
12108
+ emailSearchTerm = _useState2[0],
12109
+ setEmailSearchTerm = _useState2[1];
12075
12110
  const metaName = getMetaName((config === null || config === void 0 ? void 0 : config.metaName) || "member");
12076
12111
  const defaultNeetoFilters = Ze((_config$filterColumns = config === null || config === void 0 ? void 0 : config.filterColumns) !== null && _config$filterColumns !== void 0 ? _config$filterColumns : DEFAULT_NEETO_FILTERS_COLUMNS);
12077
- const _useState = React.useState(_objectSpread$2(_objectSpread$2(_objectSpread$2({}, DEFAULT_FILTER_VALUES), config === null || config === void 0 ? void 0 : config.defaultFilterValues), {}, {
12112
+ const _useState3 = React.useState(_objectSpread$2(_objectSpread$2(_objectSpread$2({}, DEFAULT_FILTER_VALUES), config === null || config === void 0 ? void 0 : config.defaultFilterValues), {}, {
12078
12113
  neetoFilters: defaultNeetoFilters,
12079
12114
  category: getValidCategory(URL_CATEGORY_FILTER_VALUE, config === null || config === void 0 ? void 0 : (_config$defaultFilter = config.defaultFilterValues) === null || _config$defaultFilter === void 0 ? void 0 : _config$defaultFilter.category)
12080
12115
  })),
12081
- _useState2 = _slicedToArray(_useState, 2),
12082
- filters = _useState2[0],
12083
- setFilters = _useState2[1];
12116
+ _useState4 = _slicedToArray(_useState3, 2),
12117
+ filters = _useState4[0],
12118
+ setFilters = _useState4[1];
12084
12119
  const debouncedSearch = reactUtils.useDebounce(filters.search, 750);
12120
+ const debouncedEmailSearchTerm = reactUtils.useDebounce(emailSearchTerm, 750);
12085
12121
  const shouldFetchFilterOptions = ramda.isNil(config === null || config === void 0 ? void 0 : config.filterColumns);
12086
12122
  const _useFetchFilterOption = useFetchFilterOptions({
12123
+ params: {
12124
+ emailSearchTerm: debouncedEmailSearchTerm
12125
+ },
12087
12126
  options: {
12088
12127
  enabled: shouldFetchFilterOptions
12089
12128
  }
12090
12129
  }),
12091
12130
  _useFetchFilterOption2 = _useFetchFilterOption.data,
12092
- filterOptions = _useFetchFilterOption2 === void 0 ? {} : _useFetchFilterOption2;
12093
- const filterColumns = shouldFetchFilterOptions ? buildFilterColumns(filterOptions) : config === null || config === void 0 ? void 0 : config.filterColumns;
12131
+ filterOptions = _useFetchFilterOption2 === void 0 ? {} : _useFetchFilterOption2,
12132
+ isFilterOptionsLoading = _useFetchFilterOption.isLoading;
12133
+ const filterColumns = shouldFetchFilterOptions ? buildFilterColumns({
12134
+ options: filterOptions,
12135
+ emailConfig: {
12136
+ setSearchTerm: setEmailSearchTerm,
12137
+ isLoading: isFilterOptionsLoading
12138
+ }
12139
+ }) : config === null || config === void 0 ? void 0 : config.filterColumns;
12094
12140
  const searchProps = {
12095
12141
  "data-cy": "ntm-search-members-input",
12096
12142
  onChange: _ref2 => {