@arc-fusion/content-integrations
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -33,21 +33,13 @@ "use strict"; | ||
_useState4 = _slicedToArray(_useState3, 2), | ||
Authors = _useState4[0], | ||
setAuthors = _useState4[1]; | ||
Websites = _useState4[0], | ||
setWebsites = _useState4[1]; | ||
var _useState5 = (0, _react.useState)(), | ||
_useState6 = _slicedToArray(_useState5, 2), | ||
Websites = _useState6[0], | ||
setWebsites = _useState6[1]; | ||
var _useState7 = (0, _react.useState)(), | ||
errorMessage = _useState6[0], | ||
setErrorMessage = _useState6[1]; | ||
var _useState7 = (0, _react.useState)(''), | ||
_useState8 = _slicedToArray(_useState7, 2), | ||
filterAuthor = _useState8[0], | ||
setFilterAuthor = _useState8[1]; | ||
var _useState9 = (0, _react.useState)(), | ||
_useState10 = _slicedToArray(_useState9, 2), | ||
errorMessage = _useState10[0], | ||
setErrorMessage = _useState10[1]; | ||
var _useState11 = (0, _react.useState)(''), | ||
_useState12 = _slicedToArray(_useState11, 2), | ||
searchInput = _useState12[0], | ||
setSearchInput = _useState12[1]; | ||
var _useState13 = (0, _react.useState)({ | ||
searchInput = _useState8[0], | ||
setSearchInput = _useState8[1]; | ||
var _useState9 = (0, _react.useState)({ | ||
dates: { | ||
@@ -59,9 +51,9 @@ start: null, | ||
}), | ||
_useState14 = _slicedToArray(_useState13, 2), | ||
filterByDate = _useState14[0], | ||
setFilterByDate = _useState14[1]; | ||
var _useState15 = (0, _react.useState)(0), | ||
_useState16 = _slicedToArray(_useState15, 2), | ||
from = _useState16[0], | ||
setFrom = _useState16[1]; | ||
_useState10 = _slicedToArray(_useState9, 2), | ||
filterByDate = _useState10[0], | ||
setFilterByDate = _useState10[1]; | ||
var _useState11 = (0, _react.useState)(0), | ||
_useState12 = _slicedToArray(_useState11, 2), | ||
from = _useState12[0], | ||
setFrom = _useState12[1]; | ||
(0, _react.useEffect)(function () { | ||
@@ -83,10 +75,3 @@ var initializeVideoContext = /*#__PURE__*/function () { | ||
} | ||
// load authors | ||
try { | ||
loadAuthors(); | ||
} catch (error) { | ||
setErrorMessage(error.message); | ||
} | ||
case 3: | ||
case 2: | ||
case "end": | ||
@@ -102,3 +87,3 @@ return _context.stop(); | ||
initializeVideoContext(); | ||
}, [filterAuthor, filterByDate, searchInput]); | ||
}, [filterByDate, searchInput]); | ||
var loadContent = /*#__PURE__*/function () { | ||
@@ -113,3 +98,2 @@ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { | ||
query = "website=".concat(website, "&size=").concat(initialAmount, "&size=").concat(pageBy, "&from=").concat(from, "&q=type:video"); | ||
if (filterAuthor) query += "+AND+credits.by._id:".concat(filterAuthor); | ||
if (searchInput) query += "+AND+headlines.basic:*".concat(searchInput, "*"); | ||
@@ -122,5 +106,5 @@ | ||
} | ||
_context2.next = 9; | ||
_context2.next = 8; | ||
return (0, _api.apiPromise)("/content-api/api/v4/search/published?".concat(query), 'GET'); | ||
case 9: | ||
case 8: | ||
videoData = _context2.sent; | ||
@@ -130,3 +114,3 @@ if (videoData !== null && videoData !== void 0 && videoData.content_elements) { | ||
} | ||
case 11: | ||
case 10: | ||
case "end": | ||
@@ -195,10 +179,7 @@ return _context2.stop(); | ||
Content: Content, | ||
Authors: Authors, | ||
searchInput: searchInput, | ||
errorMessage: errorMessage, | ||
filterAuthor: filterAuthor, | ||
filterByDate: filterByDate, | ||
loadContent: loadContent, | ||
loadAuthors: loadAuthors, | ||
setFilterAuthor: setFilterAuthor, | ||
setFrom: setFrom, | ||
@@ -205,0 +186,0 @@ setFilterByDate: setFilterByDate, |
@@ -9,3 +9,2 @@ "use strict"; | ||
var _reactIntl = require("react-intl"); | ||
var _Divider = _interopRequireDefault(require("../../shared/components/Divider")); | ||
var _context = require("../context"); | ||
@@ -16,24 +15,5 @@ var _filters = require("../../shared/components/filters"); | ||
var IntegrationContext = (0, _context.useIntegrationContext)(); | ||
var Authors = IntegrationContext.Authors, | ||
setFilterAuthor = IntegrationContext.setFilterAuthor, | ||
filterByDate = IntegrationContext.filterByDate, | ||
var filterByDate = IntegrationContext.filterByDate, | ||
setFilterByDate = IntegrationContext.setFilterByDate; | ||
// Authors - meta data for select component | ||
var authorsMeta = { | ||
fieldName: 'int_select_author', | ||
fieldId: 'int_select_author', | ||
labelText: /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, { | ||
id: "integrations.shared.filters.author" | ||
}, function (txt) { | ||
return txt; | ||
}) | ||
}; | ||
// Authors - json property keys to get data from | ||
var authorsDataMeta = { | ||
nameField: 'byline', | ||
idField: '_id' | ||
}; | ||
// Date Range - meta data for date range component | ||
@@ -50,11 +30,3 @@ var dateRangeMeta = { | ||
}; | ||
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_filters.IntSharedSearchText, { | ||
meta: authorsMeta, | ||
dataMeta: authorsDataMeta, | ||
dataArray: Authors === null || Authors === void 0 ? void 0 : Authors.authors, | ||
dataObjectSetter: setFilterAuthor, | ||
enableDropChoices: true | ||
}), /*#__PURE__*/_react.default.createElement(_Divider.default, { | ||
isDarkMode: true | ||
}), /*#__PURE__*/_react.default.createElement(_filters.DateRangeContext, { | ||
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_filters.DateRangeContext, { | ||
meta: dateRangeMeta, | ||
@@ -61,0 +33,0 @@ dataObject: filterByDate, |
{ | ||
"name": "@arc-fusion/content-integrations", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -9,5 +9,3 @@ import React, { useEffect, useState, createContext, useContext } from 'react' | ||
const [Content, setContent] = useState() | ||
const [Authors, setAuthors] = useState() | ||
const [Websites, setWebsites] = useState() | ||
const [filterAuthor, setFilterAuthor] = useState() | ||
const [errorMessage, setErrorMessage] = useState() | ||
@@ -34,12 +32,5 @@ const [searchInput, setSearchInput] = useState('') | ||
} | ||
// load authors | ||
try { | ||
loadAuthors() | ||
} catch (error) { | ||
setErrorMessage(error.message) | ||
} | ||
} | ||
initializeVideoContext() | ||
}, [filterAuthor, filterByDate, searchInput]) | ||
}, [filterByDate, searchInput]) | ||
@@ -53,4 +44,2 @@ const loadContent = async () => { | ||
if (filterAuthor) query += `+AND+credits.by._id:${filterAuthor}` | ||
if (searchInput) query += `+AND+headlines.basic:*${searchInput}*` | ||
@@ -99,10 +88,7 @@ | ||
Content, | ||
Authors, | ||
searchInput, | ||
errorMessage, | ||
filterAuthor, | ||
filterByDate, | ||
loadContent, | ||
loadAuthors, | ||
setFilterAuthor, | ||
setFrom, | ||
@@ -109,0 +95,0 @@ setFilterByDate, |
import React from 'react' | ||
import { FormattedMessage } from 'react-intl' | ||
import Divider from '../../shared/components/Divider' | ||
import { useIntegrationContext } from '../context' | ||
import { DateRangeContext, IntSharedSearchText } from '../../shared/components/filters' | ||
import { DateRangeContext } from '../../shared/components/filters' | ||
export function Filter() { | ||
const IntegrationContext = useIntegrationContext() | ||
const { Authors, setFilterAuthor, filterByDate, setFilterByDate } = IntegrationContext | ||
const { filterByDate, setFilterByDate } = IntegrationContext | ||
// Authors - meta data for select component | ||
const authorsMeta = { | ||
fieldName: 'int_select_author', | ||
fieldId: 'int_select_author', | ||
labelText: ( | ||
<FormattedMessage id="integrations.shared.filters.author">{txt => txt}</FormattedMessage> | ||
) | ||
} | ||
// Authors - json property keys to get data from | ||
const authorsDataMeta = { | ||
nameField: 'byline', | ||
idField: '_id' | ||
} | ||
// Date Range - meta data for date range component | ||
@@ -42,12 +26,2 @@ const dateRangeMeta = { | ||
<> | ||
<IntSharedSearchText | ||
meta={authorsMeta} | ||
dataMeta={authorsDataMeta} | ||
dataArray={Authors?.authors} | ||
dataObjectSetter={setFilterAuthor} | ||
enableDropChoices={true} | ||
/> | ||
<Divider isDarkMode /> | ||
<DateRangeContext | ||
@@ -54,0 +28,0 @@ meta={dateRangeMeta} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
621298
12166