cluedin-widget
Version:
567 lines (455 loc) • 18.7 kB
JavaScript
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[10],{
/***/ 1929:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXTERNAL MODULE: ./node_modules/react/index.js
var react = __webpack_require__(0);
var react_default = /*#__PURE__*/__webpack_require__.n(react);
// EXTERNAL MODULE: ./node_modules/react-redux/es/index.js + 18 modules
var es = __webpack_require__(8);
// EXTERNAL MODULE: ./node_modules/recompose/es/Recompose.js
var Recompose = __webpack_require__(6);
// EXTERNAL MODULE: ./node_modules/uxi/Alert/index.js
var Alert = __webpack_require__(24);
var Alert_default = /*#__PURE__*/__webpack_require__.n(Alert);
// EXTERNAL MODULE: ./node_modules/uxi/Button/index.js
var Button = __webpack_require__(18);
var Button_default = /*#__PURE__*/__webpack_require__.n(Button);
// EXTERNAL MODULE: ./node_modules/uxi/Icons/index.js
var Icons = __webpack_require__(9);
// EXTERNAL MODULE: ./node_modules/react-intl/lib/index.es.js
var index_es = __webpack_require__(4);
// EXTERNAL MODULE: ./core/modules/entity/entityTypes/generic/Card/index.js
var Card = __webpack_require__(287);
// EXTERNAL MODULE: ./core/modules/wms/helpers/widgetHelper.js
var widgetHelper = __webpack_require__(85);
// EXTERNAL MODULE: ./core/config/index.js + 4 modules
var config = __webpack_require__(11);
// EXTERNAL MODULE: ./core/modules/entityMerge/components/Hocs/withEntitySelectable.js
var withEntitySelectable = __webpack_require__(222);
// CONCATENATED MODULE: ./core/modules/search/components/composites/EntityDefaultSearchResult.js
var DefaultSelectable = Object(withEntitySelectable["a" /* withEntitySelectable */])(Card["a" /* Default */]);
var EntityDefaultSearchResult_EntityDefaultSearchResult = function EntityDefaultSearchResult(_ref) {
var searchResult = _ref.searchResult,
q = _ref.q;
var entityContent = searchResult.Hits.map(function (entity, index) {
var highlight;
if (searchResult && searchResult.Highlights && searchResult.Highlights[entity.id]) {
highlight = searchResult.Highlights[entity.id];
}
var entityConfig = Object(widgetHelper["b" /* getEntityConfiguration */])(entity.data.entityType);
var entityUrl = config["g" /* location */].goToEntity(entity);
return react_default.a.createElement(DefaultSelectable, {
key: "DefaultSelectable-".concat(entity.name, "-").concat(index),
entityUrl: entityUrl,
entityConfig: entityConfig,
q: q,
entity: entity,
highlight: highlight
});
});
return react_default.a.createElement("div", null, entityContent);
};
EntityDefaultSearchResult_EntityDefaultSearchResult.displayName = 'EntityDefaultSearchResult';
/* harmony default export */ var composites_EntityDefaultSearchResult = (EntityDefaultSearchResult_EntityDefaultSearchResult);
// CONCATENATED MODULE: ./core/modules/search/components/composites/QuickSearchResult.js
var QuickSearchResult_QuickSearchResult = function QuickSearchResult(_ref) {
var searchResult = _ref.searchResult,
query = _ref.query,
onInitMerge = _ref.onInitMerge;
var hasResult = searchResult && searchResult.Hits && searchResult.Hits.length > 0;
var hasOnlyOneResult = searchResult && searchResult.Hits && searchResult.Hits.length === 1;
if (!hasResult) {
return react_default.a.createElement(Alert_default.a, null, "No result found");
}
return react_default.a.createElement("div", null, !hasOnlyOneResult && react_default.a.createElement("div", {
style: {
padding: '15px',
borderBottom: '1px solid #ccc'
}
}, react_default.a.createElement(Button_default.a, {
icon: react_default.a.createElement(Icons["Merge"], null),
onClick: onInitMerge,
type: "primary",
text: react_default.a.createElement(index_es["FormattedMessage"], {
id: "module-dataModeling-merge",
defaultMessage: "Merge"
})
})), react_default.a.createElement(composites_EntityDefaultSearchResult, {
searchResult: searchResult,
q: query
}));
};
/* harmony default export */ var composites_QuickSearchResult = (QuickSearchResult_QuickSearchResult);
// EXTERNAL MODULE: ./core/modules/search/actions.js + 2 modules
var actions = __webpack_require__(70);
// EXTERNAL MODULE: ./core/modules/core/components/composites/QuickViewWithErrorAndLoading.js
var QuickViewWithErrorAndLoading = __webpack_require__(338);
// EXTERNAL MODULE: ./core/modules/entityMerge/actions.js + 1 modules
var entityMerge_actions = __webpack_require__(89);
// CONCATENATED MODULE: ./core/modules/search/components/containers/quickViews/EntitySearchQuickViewContainer.js
// import { FormattedMessage } from 'react-intl';
var EntitySearchQuickViewContainer_EntitySearchQuickViewContainer = function EntitySearchQuickViewContainer(_ref) {
var title = _ref.title,
open = _ref.open,
onClose = _ref.onClose,
searchResult = _ref.searchResult,
invalid = _ref.invalid,
isFetching = _ref.isFetching,
onInitMerge = _ref.onInitMerge,
query = _ref.query;
return react_default.a.createElement(QuickViewWithErrorAndLoading["a" /* default */], {
open: open,
onClose: onClose,
style: {
width: '968px'
},
title: title,
invalid: invalid,
isFetching: isFetching
}, react_default.a.createElement("div", {
style: {
overflowY: 'scroll'
}
}, react_default.a.createElement(composites_QuickSearchResult, {
onInitMerge: onInitMerge,
searchResult: searchResult,
query: query,
title: title
})));
};
var EnhancedEntitySearchQuickViewContainer = Object(Recompose["b" /* compose */])(Object(Recompose["c" /* lifecycle */])({
componentWillMount: function componentWillMount() {
var _this$props = this.props,
query = _this$props.query,
search = _this$props.search;
if (query) {
search(query);
}
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
var _this$props2 = this.props,
query = _this$props2.query,
search = _this$props2.search;
if (query !== nextProps.query) {
if (nextProps.query) {
search(nextProps.query);
}
}
}
}))(EntitySearchQuickViewContainer_EntitySearchQuickViewContainer);
var mapToStateProps = function mapToStateProps(_ref2, _ref3) {
var quickSearch = _ref2.searchModule.quickSearch;
var query = _ref3.query,
open = _ref3.open;
var isFetching = quickSearch[query] ? quickSearch[query].isFetching : true;
var result = quickSearch[query] ? quickSearch[query].result : [];
var invalid = quickSearch[query] ? quickSearch[query].invalid : false;
return {
isFetching: isFetching,
searchResult: result,
invalid: invalid,
open: open
};
};
var EntitySearchQuickViewContainer_mapDispatchToProps = function mapDispatchToProps(dispatch, _ref4) {
var withUntokenized = _ref4.withUntokenized;
return {
search: function search(query) {
dispatch(Object(actions["j" /* shouldQuickSearchResult */])({
query: query,
withUntokenized: withUntokenized
}));
},
onInitMerge: function onInitMerge() {
var mergeConfig = {
min: 2,
max: Infinity,
sameEntityType: true
};
dispatch(Object(entityMerge_actions["d" /* initMerge */])(mergeConfig));
}
};
};
/* harmony default export */ var quickViews_EntitySearchQuickViewContainer = __webpack_exports__["a"] = (Object(es["connect"])(mapToStateProps, EntitySearchQuickViewContainer_mapDispatchToProps)(EnhancedEntitySearchQuickViewContainer));
/***/ }),
/***/ 2326:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
// EXTERNAL MODULE: ./node_modules/react/index.js
var react = __webpack_require__(0);
var react_default = /*#__PURE__*/__webpack_require__.n(react);
// EXTERNAL MODULE: ./node_modules/uxi/Widget/index.js
var Widget = __webpack_require__(40);
var Widget_default = /*#__PURE__*/__webpack_require__.n(Widget);
// EXTERNAL MODULE: ./node_modules/react-intl/lib/index.es.js
var index_es = __webpack_require__(4);
// EXTERNAL MODULE: ./node_modules/react-redux/es/index.js + 18 modules
var es = __webpack_require__(8);
// EXTERNAL MODULE: ./core/modules/consent/actions.js + 1 modules
var actions = __webpack_require__(42);
// EXTERNAL MODULE: ./node_modules/recompose/es/Recompose.js
var Recompose = __webpack_require__(6);
// EXTERNAL MODULE: ./node_modules/uxi/DataGrid/index.js
var DataGrid = __webpack_require__(144);
var DataGrid_default = /*#__PURE__*/__webpack_require__.n(DataGrid);
// EXTERNAL MODULE: ./node_modules/uxi/Button/index.js
var Button = __webpack_require__(18);
// EXTERNAL MODULE: ./node_modules/uxi/Alert/index.js
var Alert = __webpack_require__(24);
var Alert_default = /*#__PURE__*/__webpack_require__.n(Alert);
// CONCATENATED MODULE: ./core/modules/consent/components/composites/lists/ConsentResultList.js
/*
const DateComponent = ({ value }) => (
<span>{moment(value).fromNow()}</span>
);
const IdentifiersComponent = ({
value,
}) => {
if (!value || value.length === 0) {
return (
<Text type="caption">
No identifiers
</Text>
);
}
return (
<div>
{value.map(v => (
<div style={{ margin: '0 0 5px 0' }}>
<Text type="caption">
{v.key}
</Text>
<div>
{v.value}
</div>
</div>
))}
</div>
);
};
const UniqueIdentifiersComponent = ({ value }) => {
if (!value || value.length === 0) {
return (
<div>
No unique identifiers
</div>
);
}
return (
<div>
{value.map(v => (
<div style={{ display: 'flex', alignItems: 'center' }}>
<div>
{v.consent && <Checkmark size={24} style={{ fill: 'green' }} />}
{!v.consent && <Forbidden size={24} style={{ fill: 'red' }} />}
</div>
<div style={{ marginLeft: '15px' }}>
{v.key}
</div>
</div>
))}
</div>
);
};
const DataProcessorComponent = ({ value }) => {
if (!value || value.length === 0) {
return (
<div>
<FormattedMessage id="module-consent-noUniqueIdentifier" />
</div>
);
}
return (
<div>
{value.map(v => (
<div style={{ display: 'flex', alignItems: 'center', margin: '5px 0' }}>
<div>
{v.consent && <Checkmark size={24} style={{ fill: 'green' }} />}
{!v.consent && <Forbidden size={24} style={{ fill: 'red' }} />}
</div>
<div style={{ marginLeft: '15px' }}>
{v.id}
</div>
</div>
))}
</div>
);
}; */
var ConsentResultList_SearchTermComponent = function SearchTermComponent(onSelectConsentEntry) {
return function (_ref) {
var entity = _ref.entity;
return react_default.a.createElement(Button["ButtonLink"], {
onClick: function onClick() {
onSelectConsentEntry(entity);
},
text: entity.Id
});
};
};
var ConsentResultList_ConsentResultList = function ConsentResultList(_ref2) {
var data = _ref2.data,
onSelectConsentEntry = _ref2.onSelectConsentEntry;
if (!data || data.length === 0) {
return react_default.a.createElement(Alert_default.a, {
style: {
margin: '15px'
}
}, react_default.a.createElement(index_es["FormattedMessage"], {
id: "module-consent-noConsentYet",
defaultMessage: "No consent has been given yet."
}));
} // selectConsentEntry
return react_default.a.createElement(DataGrid_default.a, {
data: data,
propertyKey: "id",
properties: [{
isComputed: true,
property: 'Id',
displayName: react_default.a.createElement(index_es["FormattedMessage"], {
id: "module-consent-consentEntryId",
defaultMessage: "Consent Entry ID"
}),
Component: ConsentResultList_SearchTermComponent(onSelectConsentEntry)
}, {
property: 'KnownIdentifier',
displayName: react_default.a.createElement(index_es["FormattedMessage"], {
id: "module-consent-knownIdentifier",
defaultMessage: "Known Personal Identifier"
})
}, {
property: 'LookupId',
Component: function Component(_ref3) {
var value = _ref3.value;
return decodeURIComponent(value);
},
displayName: react_default.a.createElement(index_es["FormattedMessage"], {
id: "module-consent-lookupId",
defaultMessage: "Internal Lookup Id"
})
}]
});
};
/* harmony default export */ var lists_ConsentResultList = (ConsentResultList_ConsentResultList);
// EXTERNAL MODULE: ./core/modules/core/components/Hocs/WithErrorAndLoading.js
var WithErrorAndLoading = __webpack_require__(220);
// EXTERNAL MODULE: ./core/modules/core/components/Hocs/ListWithPaging.js
var ListWithPaging = __webpack_require__(557);
// CONCATENATED MODULE: ./core/modules/consent/components/containers/ConsentEntriesForConsentContainer.js
var ConsentEntriesForConsentContainer_ConsentEntriesForConsentContainer = function ConsentEntriesForConsentContainer(_ref) {
var items = _ref.items,
onSelectConsentEntry = _ref.onSelectConsentEntry;
return react_default.a.createElement(lists_ConsentResultList, {
data: items,
onSelectConsentEntry: onSelectConsentEntry
});
};
var EnhancedConsentEntriesForConsentContainer = Object(WithErrorAndLoading["a" /* WithErrorAndLoading */])(Object(ListWithPaging["a" /* default */])(ConsentEntriesForConsentContainer_ConsentEntriesForConsentContainer));
var EnhancedConsentEntriesForConsentContainerWithLifeCycle = Object(Recompose["b" /* compose */])(Object(Recompose["c" /* lifecycle */])({
componentWillMount: function componentWillMount() {
var fetchConsentResult = this.props.fetchConsentResult;
fetchConsentResult();
}
}))(EnhancedConsentEntriesForConsentContainer);
var mapToStateProps = function mapToStateProps(_ref2, _ref3) {
var consentEntriesForConsent = _ref2.consent.consentEntriesForConsent;
var id = _ref3.id;
var result = consentEntriesForConsent[id];
return {
isFetching: result ? result.isFetching : true,
items: result ? result.consentEntries : [],
invalid: result ? result.invalid : false,
isFetchingMore: result ? result.isFetchingMore : false,
pageNumber: result && result.filterOptions ? result.filterOptions.pageNumber || 0 : 0
};
};
var ConsentEntriesForConsentContainer_mapDispatchToProps = function mapDispatchToProps(dispatch, _ref4) {
var id = _ref4.id;
return {
fetchConsentResult: function fetchConsentResult() {
dispatch(Object(actions["l" /* shouldFetchConsentEntriesForConsent */])({
consentEntryId: id
}));
},
onLoadMore: function onLoadMore(pageNumber) {
dispatch(Object(actions["v" /* shouldFetchMoreConsentEntriesForConsent */])({
consentEntryId: id,
pageNumber: pageNumber
}));
}
};
};
/* harmony default export */ var containers_ConsentEntriesForConsentContainer = (Object(es["connect"])(mapToStateProps, ConsentEntriesForConsentContainer_mapDispatchToProps)(EnhancedConsentEntriesForConsentContainerWithLifeCycle));
// EXTERNAL MODULE: ./core/modules/search/components/containers/quickViews/EntitySearchQuickViewContainer.js + 2 modules
var EntitySearchQuickViewContainer = __webpack_require__(1929);
// EXTERNAL MODULE: ./core/modules/core/components/composites/QuickViewWithErrorAndLoading.js
var QuickViewWithErrorAndLoading = __webpack_require__(338);
// CONCATENATED MODULE: ./core/modules/consent/components/composites/NoIdentifierFound.js
var NoIdentifierFound_NoIdentifierFound = function NoIdentifierFound(_ref) {
var open = _ref.open,
onClose = _ref.onClose,
title = _ref.title;
return react_default.a.createElement(QuickViewWithErrorAndLoading["a" /* default */], {
open: open,
onClose: onClose,
title: title
}, react_default.a.createElement("div", {
style: {
padding: '15px'
}
}, react_default.a.createElement(index_es["FormattedHTMLMessage"], {
id: "module-consent-anonymousUserSoFar"
})));
};
/* harmony default export */ var composites_NoIdentifierFound = (NoIdentifierFound_NoIdentifierFound);
// CONCATENATED MODULE: ./core/modules/consent/components/pages/ConsentResultPage.js
var ConsentResultPage_ConsentResultPage = function ConsentResultPage(_ref) {
var id = _ref.match.params.id,
selectedConsentIdentifier = _ref.selectedConsentIdentifier,
onClose = _ref.onClose,
select = _ref.select;
var isEntitySearchOpen = selectedConsentIdentifier && selectedConsentIdentifier.KnownIdentifier;
var isNotFoundEntityOpen = selectedConsentIdentifier && !selectedConsentIdentifier.KnownIdentifier;
return react_default.a.createElement(Widget_default.a, null, react_default.a.createElement(containers_ConsentEntriesForConsentContainer, {
id: id,
onSelectConsentEntry: select
}), isEntitySearchOpen && react_default.a.createElement(EntitySearchQuickViewContainer["a" /* default */], {
query: selectedConsentIdentifier ? selectedConsentIdentifier.KnownIdentifier : '',
open: isEntitySearchOpen,
onClose: onClose,
title: react_default.a.createElement(index_es["FormattedMessage"], {
id: "module-dataModeling-quickViewRelatedEntitiesConsentEntry",
defaultMessage: "Related Entities for {query}",
values: {
query: selectedConsentIdentifier ? selectedConsentIdentifier.KnownIdentifier : ''
}
})
}), isNotFoundEntityOpen && react_default.a.createElement(composites_NoIdentifierFound, {
open: isNotFoundEntityOpen,
onClose: onClose,
title: react_default.a.createElement(index_es["FormattedMessage"], {
id: "module-dataModeling-quickViewNoEntityFound",
defaultMessage: "No person found for this query"
})
}));
};
var mapToStateToProps = function mapToStateToProps(_ref2) {
var selectedConsentIdentifier = _ref2.consent.selectedConsentIdentifier;
return {
selectedConsentIdentifier: selectedConsentIdentifier
};
};
var ConsentResultPage_mapDispatchToProps = function mapDispatchToProps(dispatch) {
return {
onClose: function onClose() {
dispatch(Object(actions["e" /* clearConsentSearch */])());
},
select: function select(identifier) {
dispatch(Object(actions["K" /* shouldSelectConsentSearch */])(identifier));
}
};
};
/* harmony default export */ var pages_ConsentResultPage = __webpack_exports__["default"] = (Object(es["connect"])(mapToStateToProps, ConsentResultPage_mapDispatchToProps)(ConsentResultPage_ConsentResultPage));
/***/ })
}]);