From ea2964ff46c4d0916d09376da12d0ce2e6778eaa Mon Sep 17 00:00:00 2001 From: Sabrina Baggett Date: Thu, 23 Oct 2025 00:19:11 -0700 Subject: [PATCH 1/6] temporary function for transfer --- ucdlib-assets/src/editor/package-lock.json | 12 +-- ucdlib-assets/src/public/package-lock.json | 16 +-- ucdlib-directory/includes/api-people.php | 79 +++++++++++++++ .../includes/block-transformations.php | 1 + ucdlib-directory/includes/blocks.php | 3 + ucdlib-directory/includes/main.php | 6 +- ucdlib-directory/includes/people.php | 23 +++++ .../includes/research-highlights.php | 84 ++++++++++++++++ .../src/editor/lib/blocks/index.js | 2 + .../edit.js | 97 +++++++++++++++++++ .../index.js | 22 +++++ .../src/editor/lib/plugins/profile.js | 8 +- ucdlib-directory/src/editor/package-lock.json | 4 +- .../blocks/person-research-highlights.twig | 11 +++ ucdlib-locations/src/editor/package-lock.json | 4 +- ucdlib-migration/src/editor/package-lock.json | 4 +- 16 files changed, 354 insertions(+), 22 deletions(-) create mode 100644 ucdlib-directory/includes/research-highlights.php create mode 100644 ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/edit.js create mode 100644 ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/index.js create mode 100644 ucdlib-directory/views/blocks/person-research-highlights.twig diff --git a/ucdlib-assets/src/editor/package-lock.json b/ucdlib-assets/src/editor/package-lock.json index 48d63c3..b8f9d3a 100644 --- a/ucdlib-assets/src/editor/package-lock.json +++ b/ucdlib-assets/src/editor/package-lock.json @@ -44,7 +44,7 @@ "integrity": "sha512-SoRmbGStwNYHgKfjOrX2L0mUvp9bUVv0uPppZSOMAntEbcFtoC3MKF5b3T6HQPXKIV+QGY3xPO3JK5it5lVkuw==", "license": "ISC", "dependencies": { - "@ucd-lib/theme-elements": "^3.0.5", + "@ucd-lib/theme-elements": "^3.3.0", "@ucd-lib/theme-sass": "^6.0.1", "@wordpress/api-fetch": "^6.0.1", "@wordpress/block-editor": "^7.0.2", @@ -26492,7 +26492,7 @@ "@ucd-lib/brand-theme-editor": { "version": "file:../../../../ucdlib-theme-wp/src/editor", "requires": { - "@ucd-lib/theme-elements": "^3.0.5", + "@ucd-lib/theme-elements": "^3.3.0", "@ucd-lib/theme-sass": "^6.0.1", "@wordpress/api-fetch": "^6.0.1", "@wordpress/block-editor": "^7.0.2", @@ -26748,7 +26748,7 @@ "@ucd-lib/brand-theme-editor": { "version": "file:../../../../ucdlib-theme-wp/src/editor", "requires": { - "@ucd-lib/theme-elements": "^3.0.5", + "@ucd-lib/theme-elements": "^3.3.0", "@ucd-lib/theme-sass": "^6.0.1", "@wordpress/api-fetch": "^6.0.1", "@wordpress/block-editor": "^7.0.2", @@ -27007,7 +27007,7 @@ "@ucd-lib/brand-theme-editor": { "version": "file:../../../../ucdlib-theme-wp/src/editor", "requires": { - "@ucd-lib/theme-elements": "^3.0.5", + "@ucd-lib/theme-elements": "^3.3.0", "@ucd-lib/theme-sass": "^6.0.1", "@wordpress/api-fetch": "^6.0.1", "@wordpress/block-editor": "^7.0.2", @@ -27270,7 +27270,7 @@ "@ucd-lib/brand-theme-editor": { "version": "file:../../../../ucdlib-theme-wp/src/editor", "requires": { - "@ucd-lib/theme-elements": "^3.0.5", + "@ucd-lib/theme-elements": "^3.3.0", "@ucd-lib/theme-sass": "^6.0.1", "@wordpress/api-fetch": "^6.0.1", "@wordpress/block-editor": "^7.0.2", @@ -27556,7 +27556,7 @@ "@ucd-lib/brand-theme-editor": { "version": "file:../../../../ucdlib-theme-wp/src/editor", "requires": { - "@ucd-lib/theme-elements": "^3.0.5", + "@ucd-lib/theme-elements": "^3.3.0", "@ucd-lib/theme-sass": "^6.0.1", "@wordpress/api-fetch": "^6.0.1", "@wordpress/block-editor": "^7.0.2", diff --git a/ucdlib-assets/src/public/package-lock.json b/ucdlib-assets/src/public/package-lock.json index bc81671..09c93a6 100644 --- a/ucdlib-assets/src/public/package-lock.json +++ b/ucdlib-assets/src/public/package-lock.json @@ -12055,7 +12055,7 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "@ucd-lib/theme-elements": "^3.1.4", + "@ucd-lib/theme-elements": "^3.3.0", "lit": "^2.3.1" } }, @@ -12200,7 +12200,7 @@ "dependencies": { "@lit-labs/task": "^1.1.3", "@material/switch": "^14.0.0", - "@ucd-lib/theme-elements": "^3.1.4", + "@ucd-lib/theme-elements": "^3.3.0", "@ucd-lib/theme-sass": "^6.0.1" } }, @@ -12343,7 +12343,7 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "@ucd-lib/theme-elements": "^3.1.4", + "@ucd-lib/theme-elements": "^3.3.0", "@ucd-lib/theme-sass": "^6.0.1", "lit": "^2.3.1" } @@ -12489,7 +12489,7 @@ "dependencies": { "@lit-labs/task": "^1.1.3", "@ucd-lib/cork-app-build": "^0.3.0", - "@ucd-lib/theme-elements": "^3.1.4", + "@ucd-lib/theme-elements": "^3.3.0", "@ucd-lib/theme-sass": "^6.0.1", "lit": "^2.3.1" } @@ -40274,7 +40274,7 @@ "@ucd-lib/plugin-directory-public": { "version": "file:../../../ucdlib-directory/src/public", "requires": { - "@ucd-lib/theme-elements": "^3.1.4", + "@ucd-lib/theme-elements": "^3.3.0", "lit": "^2.3.1" }, "dependencies": { @@ -40400,7 +40400,7 @@ "requires": { "@lit-labs/task": "^1.1.3", "@material/switch": "^14.0.0", - "@ucd-lib/theme-elements": "^3.1.4", + "@ucd-lib/theme-elements": "^3.3.0", "@ucd-lib/theme-sass": "^6.0.1" }, "dependencies": { @@ -40524,7 +40524,7 @@ "@ucd-lib/plugin-search-public": { "version": "file:../../../ucdlib-search/src/public", "requires": { - "@ucd-lib/theme-elements": "^3.1.4", + "@ucd-lib/theme-elements": "^3.3.0", "@ucd-lib/theme-sass": "^6.0.1", "lit": "^2.3.1" }, @@ -40651,7 +40651,7 @@ "requires": { "@lit-labs/task": "^1.1.3", "@ucd-lib/cork-app-build": "^0.3.0", - "@ucd-lib/theme-elements": "^3.1.4", + "@ucd-lib/theme-elements": "^3.3.0", "@ucd-lib/theme-sass": "^6.0.1", "lit": "^2.3.1" }, diff --git a/ucdlib-directory/includes/api-people.php b/ucdlib-directory/includes/api-people.php index 41cc9e1..05b1867 100644 --- a/ucdlib-directory/includes/api-people.php +++ b/ucdlib-directory/includes/api-people.php @@ -31,8 +31,87 @@ public function register_endpoints(){ ] ] ) ); + + register_rest_route($this->config['slug'], 'research-highlights/(?P[^/]+)', array( + 'methods' => 'GET', + 'callback' => array($this, 'epcb_research_highlights'), + 'permission_callback' => function (){return true;} + ) ); } + public function epcb_research_highlights($request){ + $expertId = $request['id']; + $out = []; + + $url = 'https://experts.ucdavis.edu/api/expert/' . rawurlencode($expertId); + $response = wp_remote_get($url, ['timeout' => 20]); + + if ( is_wp_error( $response ) ) { + return new WP_Error( 'rest_not_found', 'This research highlights does not exist.', array( 'status' => 404 ) ); + } + + $resp = json_decode(wp_remote_retrieve_body( $response ), true); + + $graph = is_array($resp) && isset($resp['@graph']) + ? $resp['@graph'] + : (isset($resp->{'@graph'}) ? $resp->{'@graph'} : []); + + + + $favourites = array_filter($graph, function($item) { + if (!is_array($item)) { + return false; + } + + if (array_key_exists('ucdlib:favourite', $item) && $item['ucdlib:favourite'] === true) { + return true; + } + + if (!isset($item['relatedBy']) || !is_array($item['relatedBy'])) { + return false; + } + + $related = $item['relatedBy']; + + if (is_array($related) && array_key_exists('ucdlib:favourite', $related)) { + return $related['ucdlib:favourite'] === true; + } + + if (is_array($related) && array_is_list($related)) { + foreach ($related as $rel) { + if (is_array($rel) && array_key_exists('ucdlib:favourite', $rel)) { + if ($rel['ucdlib:favourite'] === true) { + return true; + } + } + } + } + return false; + }); + + + $out = array_values(array_map(function($item) { + return [ + 'id' => $item['@id'] ?? '', + 'type' => $item['@type'] ?? [], + 'volume' => $item['volume'] ?? '', + 'author' => $item['author'] ?? [], + 'issn' => $item['ISSN'] ?? '', + 'eissn' => $item['eissn'] ?? '', + 'abstract' => $item['abstract'] ?? '', + 'title' => $item['title'] ?? '', + 'url' => $item['url'] ?? '', + 'issuedDate' => $item['issued'] ?? '', + 'status' => $item['status'] ?? '', + 'containerTitle' => $item['container-title'] ?? '', + 'publisher' => $item['publisher'] ?? '', + 'page' => $item['page'] ?? '', + ]; + }, $favourites)); + + return rest_ensure_response( $out ); + } + // endpoint for looking up a single person public function epcb_person( $request ) { $term = $request['term']; diff --git a/ucdlib-directory/includes/block-transformations.php b/ucdlib-directory/includes/block-transformations.php index cbfb817..8de8fd7 100644 --- a/ucdlib-directory/includes/block-transformations.php +++ b/ucdlib-directory/includes/block-transformations.php @@ -224,6 +224,7 @@ public static function getDirectoryResults( $attrs=[] ){ ]; $tax_query = []; $expertiseAreas = []; + $researchHighlights = []; $hideDepartments = array_key_exists('hideDepartments', $attrs) && $attrs['hideDepartments'] != 'false'; $meta_query = [ [ diff --git a/ucdlib-directory/includes/blocks.php b/ucdlib-directory/includes/blocks.php index 8dc60e9..9845d30 100644 --- a/ucdlib-directory/includes/blocks.php +++ b/ucdlib-directory/includes/blocks.php @@ -72,6 +72,9 @@ public function __construct($config){ ], 'ucdlib-directory/expertise-areas' => [ 'twig' => '@ucdlib-directory/blocks/person-expertise-areas.twig' + ], + 'ucdlib-directory/research-highlights' => [ + 'twig' => '@ucdlib-directory/blocks/person-research-highlights.twig' ] ]; diff --git a/ucdlib-directory/includes/main.php b/ucdlib-directory/includes/main.php index b8aeecc..47f5cf6 100644 --- a/ucdlib-directory/includes/main.php +++ b/ucdlib-directory/includes/main.php @@ -4,6 +4,7 @@ require_once( __DIR__ . '/additional-authors.php'); require_once( __DIR__ . '/api-filters.php' ); require_once( __DIR__ . '/areas-of-expertise.php' ); +require_once( __DIR__ . '/research-highlights.php' ); require_once( __DIR__ . '/blocks.php' ); require_once( __DIR__ . '/departments.php' ); require_once( __DIR__ . '/directory-tags.php' ); @@ -27,6 +28,7 @@ class UCDLibPluginDirectory { public $serviceTypes; public $services; public $areasOfExpertise; + public $researchHighlights; public function __construct(){ $this->slug = "ucdlib-directory"; @@ -43,6 +45,7 @@ public function __construct(){ $this->serviceTypes = new UCDLibPluginDirectoryServiceTypes( $this->config ); $this->services = new UCDLibPluginDirectoryServices( $this->config ); $this->areasOfExpertise = new UCDLibPluginDirectoryAreasOfExpertise( $this->config ); + $this->researchHighlights = new UCDDirectoryResearchHighlights( $this->config ); add_action( 'admin_menu', array($this, 'add_admin_menu')); add_action( 'admin_head', array($this, 'admin_head') ); @@ -86,7 +89,8 @@ public function getBaseConfig(){ 'service-type' => 'service-type', 'library' => 'library', 'directory' => 'directory-tag', - 'expertise' => 'expertise-areas' + 'expertise' => 'expertise-areas', + 'research-highlights' => 'research-highlights' ], 'postSlugs' => [ 'service' => $service, diff --git a/ucdlib-directory/includes/people.php b/ucdlib-directory/includes/people.php index f0a6ff6..e7874e5 100644 --- a/ucdlib-directory/includes/people.php +++ b/ucdlib-directory/includes/people.php @@ -70,6 +70,10 @@ public function register(){ 'ucdlib-directory/expertise-areas', ["lock" => ["move" => true, "remove" => true]] ], + [ + 'ucdlib-directory/research-highlights', + ["lock" => ["move" => true, "remove" => true]] + ], [ 'ucdlib-directory/tags', ["lock" => ["move" => true, "remove" => true]] @@ -271,6 +275,12 @@ public function register_post_meta(){ 'default' => false, 'type' => 'boolean', ) ); + register_post_meta( $slug, 'hide_research_highlights', array( + 'show_in_rest' => true, + 'single' => true, + 'default' => false, + 'type' => 'boolean', + ) ); register_post_meta( $slug, 'hide_bio', array( 'show_in_rest' => true, 'single' => true, @@ -645,6 +655,19 @@ public function expertiseAreas(){ return $this->expertiseAreas; } + protected $researchHighlights; + public function researchHighlights(){ + if( ! empty( $this->researchHighlights ) ) { + return $this->researchHighlights; + } + if( $this->meta('hide_research_highlights')) { + $this->researchHighlights = []; + } else { + $this->researchHighlights = $this->terms(['taxonomy' => 'research-highlights', 'orderby' => 'name', 'order' => 'ASC']); + } + return $this->researchHighlights; + } + protected $departmentIds; public function departmentIds(){ if ( ! empty( $this->departmentIds ) ) { diff --git a/ucdlib-directory/includes/research-highlights.php b/ucdlib-directory/includes/research-highlights.php new file mode 100644 index 0000000..e2483d9 --- /dev/null +++ b/ucdlib-directory/includes/research-highlights.php @@ -0,0 +1,84 @@ +config = $config; + $this->slug = $this->config['taxSlugs']['research-highlights']; + $this->postType = $this->config['postSlugs']['person']; + + // run regiser function on init hook + // add_action( 'init', array($this, 'register') ); + + // run add_to_menu on admin_menu hook + // add_action( 'admin_menu', array($this, 'add_to_menu')); + + // run expand_parent_menu on parent_file hook + // add_action( 'parent_file', array($this, 'expand_parent_menu') ); + } + + // register taxonomy + public function register(){ + $people = $this->config['postSlugs']['personPlural']; + $labels = [ + 'name' => _x( 'Research Highlights', 'taxonomy general name' ), + 'singular_name' => _x( 'Research Highlight', 'taxonomy singular name' ), + 'search_items' => __( 'Search Research Highlights' ), + 'all_items' => __( 'All Research Highlights' ), + 'edit_item' => __( 'Edit Research Highlight' ), + 'update_item' => __( 'Update Research Highlight' ), + 'add_new_item' => __( 'Add New Research Highlight' ), + 'new_item_name' => __( 'New Research Highlight' ), + 'menu_name' => __( 'Research Highlights' ), + ]; + $args = [ + 'labels' => $labels, + 'description' => 'Uncontrolled list of research highlights assigned to people', + 'public' => false, + 'publicly_queryable' => false, + 'hierarchical' => false, + 'show_ui' => true, + 'show_in_nav_menus' => false, + 'show_in_rest' => true, + 'capabilities' => [ + 'manage_terms' => $this->config['capabilities']['manage_directory'], + 'edit_terms' => "edit_$people", + 'delete_terms' => $this->config['capabilities']['manage_directory'], + 'assign_terms' => "edit_$people" + ], + // 'show_admin_column' => true + ]; + + register_taxonomy( + $this->slug, + [$this->postType], + $args + ); + + } + + // add to plugin admin menu + public function add_to_menu(){ + $label = 'Research Highlights'; + add_submenu_page( + $this->config['slug'], + $label, + $label, + $this->config['capabilities']['manage_directory'], + 'edit-tags.php?taxonomy=' . $this->slug . '&post_type=' . $this->postType, + false + ); + } + + // expand plugin menu when on taxonomy admin page + public function expand_parent_menu($parent_file){ + if(get_current_screen()->taxonomy === $this->slug){ + $parent_file = $this->config['slug']; + } + return $parent_file; + } +} \ No newline at end of file diff --git a/ucdlib-directory/src/editor/lib/blocks/index.js b/ucdlib-directory/src/editor/lib/blocks/index.js index 5ba19a3..b00aa02 100644 --- a/ucdlib-directory/src/editor/lib/blocks/index.js +++ b/ucdlib-directory/src/editor/lib/blocks/index.js @@ -13,6 +13,7 @@ import personPronouns from "./ucdlib-directory-pronouns"; import personLibraryLocations from "./ucdlib-directory-library-locations" import personTags from "./ucdlib-directory-tags"; import personExpertiseAreas from "./ucdlib-directory-expertise-areas"; +import personResearchHighlights from "./ucdlib-directory-research-highlights"; import serviceFilters from "./ucdlib-directory-service-filters"; import serviceResults from "./ucdlib-directory-service-results"; @@ -32,6 +33,7 @@ export default [ personLibraryLocations, personTags, personExpertiseAreas, + personResearchHighlights, serviceFilters, serviceResults ] \ No newline at end of file diff --git a/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/edit.js b/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/edit.js new file mode 100644 index 0000000..1baf951 --- /dev/null +++ b/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/edit.js @@ -0,0 +1,97 @@ +import { html, SelectUtils } from "@ucd-lib/brand-theme-editor/lib/utils"; +import { useBlockProps } from '@wordpress/block-editor'; +import { PluginDocumentSettingPanel } from '@wordpress/editor'; +import { PanelBody, TextControl, Button, Spinner, Notice } from '@wordpress/components'; +import { Fragment } from "@wordpress/element"; +import { Modal } from '@wordpress/components'; +import { useState, useCallback } from '@wordpress/element'; +import apiFetch from '@wordpress/api-fetch'; + +export default ( props ) => { + const blockProps = useBlockProps(); + + const [ isOpen, setOpen ] = useState( false ); + const openModal = () => setOpen( true ); + const closeModal = () => setOpen( false ); + + const [query, setQuery] = useState(''); + const [loading, setLoading] = useState(true); + const [error, setError] = useState(''); + const [results, setResults] = useState([]); + + +const fetchHighlights = useCallback( async () => { + setLoading(true); + setError(''); + try { + const path = `/ucdlib-directory/research-highlights/${encodeURIComponent(query)}`; + const r = await apiFetch({ path }); + console.log('rh', r); + setResults(r || []); + } catch (error) { + setResults([]); + setError('Error fetching research highlights' + (error.message ? ': ' + error.message : '.')); + setLoading(false); + console.warn(error); + } finally { + setLoading(false); + } +}, [query] ); + +// get metadata +// const taxSlug = 'research-highlights'; + const meta = SelectUtils.editedPostAttribute('meta'); + const res = Array.isArray(results) ? results : []; + const hideTags = meta.hide_research_highlights ? meta.hide_research_highlights : false; + return html` + <${Fragment}> + <${PluginDocumentSettingPanel} + name="ucdlib-directory-research-highlights" + className="ucdlib-directory-research-highlights" + icon=${html``} + title="Research Highlights"> + <${PanelBody} initialOpen=${ true }> + <${TextControl} + value=${ query } + label="Alma Record ID" + onChange=${ ( value ) => setQuery( value ) } + placeholder="Search Expert ID..." + /> + + <${Button} + variant="primary" + onClick=${ fetchHighlights } + style=${{ marginBottom: '.5em', marginTop: '.5em' }} + >Search Expert ID + + + ${ error && html`<${Notice} status="error" isDismissible=${ false }>${ error }` } + ${ !loading && results.length === 0 && query !== '' && html`

No Research Highlights found.

` } + + +
+ ${!hideTags && html` +
+
+

Research Highlights

+
+

Research Highlights content is managed outside of this block. Click to learn more.

+ ${res.length ? html` +
    + ${res.map((r, i) => html` +
  • ${r?.title || r?.label || '(untitled)'}
  • + `)} +
+ ` : null} +
+
+ ${isOpen && html` + <${Modal} title="Editing Your Research Highlights" onRequestClose=${ closeModal }> +
To add or edit your Research Highlights, use the "Research Highlights" area in the "Person" right-hand sidebar
+ + `} +
+ `} +
+ ` +} \ No newline at end of file diff --git a/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/index.js b/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/index.js new file mode 100644 index 0000000..4b78bda --- /dev/null +++ b/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/index.js @@ -0,0 +1,22 @@ +import { UCDIcons } from "@ucd-lib/brand-theme-editor/lib/utils"; +import Edit from './edit'; + +const name = 'ucdlib-directory/research-highlights'; +const settings = { + api_version: 2, + title: "Research Highlights", + parent: [], + description: "Highlight your research works", + icon: UCDIcons.renderPublic('fa-flask'), + category: 'ucdlib-directory-person', + keywords: [ 'research', 'highlights', 'works' ], + supports: { + "html": false, + "customClassName": false + }, + attributes: { + }, + edit: Edit +}; + +export default { name, settings }; \ No newline at end of file diff --git a/ucdlib-directory/src/editor/lib/plugins/profile.js b/ucdlib-directory/src/editor/lib/plugins/profile.js index 6761d12..32dde84 100644 --- a/ucdlib-directory/src/editor/lib/plugins/profile.js +++ b/ucdlib-directory/src/editor/lib/plugins/profile.js @@ -18,9 +18,10 @@ const Edit = () => { const hideLibraries = meta.hide_libraries ? true : false; const hideDirectoryTags = meta.hide_tags ? true : false; const hideExpertiseAreas = meta.hide_expertise_areas ? true : false; + const hideResearchHiglights = meta.hide_research_highlights ? true : false; const hideBio = meta.hide_bio ? true : false; const pastEmployee = meta.pastEmployee | false; - const { editPost } = useDispatch( 'core/editor', [ hidePronouns, hideLibraries, hideDirectoryTags, hideExpertiseAreas, hideBio, pastEmployee ] ); + const { editPost } = useDispatch( 'core/editor', [ hidePronouns, hideLibraries, hideDirectoryTags, hideExpertiseAreas, hideResearchHiglights, hideBio, pastEmployee ] ); return html` @@ -60,6 +61,11 @@ const Edit = () => { checked=${hideExpertiseAreas} onChange=${() => editPost({meta: { hide_expertise_areas: !hideExpertiseAreas}})} /> + <${ToggleControl} + label="Hide Research Highlights" + checked=${hideResearchHiglights} + onChange=${() => editPost({meta: { hide_research_highlights: !hideResearchHiglights}})} + /> diff --git a/ucdlib-directory/src/editor/package-lock.json b/ucdlib-directory/src/editor/package-lock.json index d2d341b..0857203 100644 --- a/ucdlib-directory/src/editor/package-lock.json +++ b/ucdlib-directory/src/editor/package-lock.json @@ -17,7 +17,7 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "@ucd-lib/theme-elements": "^3.0.5", + "@ucd-lib/theme-elements": "^3.3.0", "@ucd-lib/theme-sass": "^6.0.1", "@wordpress/api-fetch": "^6.0.1", "@wordpress/block-editor": "^7.0.2", @@ -285,7 +285,7 @@ "@ucd-lib/brand-theme-editor": { "version": "file:../../../../ucdlib-theme-wp/src/editor", "requires": { - "@ucd-lib/theme-elements": "^3.0.5", + "@ucd-lib/theme-elements": "^3.3.0", "@ucd-lib/theme-sass": "^6.0.1", "@wordpress/api-fetch": "^6.0.1", "@wordpress/block-editor": "^7.0.2", diff --git a/ucdlib-directory/views/blocks/person-research-highlights.twig b/ucdlib-directory/views/blocks/person-research-highlights.twig new file mode 100644 index 0000000..ec09b02 --- /dev/null +++ b/ucdlib-directory/views/blocks/person-research-highlights.twig @@ -0,0 +1,11 @@ +{%set p = siteContext.post %} +{% if p.researchHighlights %} +
+

Research Highlights

+

+ {% apply spaceless %} +

This individual's research highlights

+ {% endapply %} +

+
+{% endif %} \ No newline at end of file diff --git a/ucdlib-locations/src/editor/package-lock.json b/ucdlib-locations/src/editor/package-lock.json index 15a9997..c21b5c6 100644 --- a/ucdlib-locations/src/editor/package-lock.json +++ b/ucdlib-locations/src/editor/package-lock.json @@ -18,7 +18,7 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "@ucd-lib/theme-elements": "^3.0.5", + "@ucd-lib/theme-elements": "^3.3.0", "@ucd-lib/theme-sass": "^6.0.1", "@wordpress/api-fetch": "^6.0.1", "@wordpress/block-editor": "^7.0.2", @@ -291,7 +291,7 @@ "@ucd-lib/brand-theme-editor": { "version": "file:../../../../ucdlib-theme-wp/src/editor", "requires": { - "@ucd-lib/theme-elements": "^3.0.5", + "@ucd-lib/theme-elements": "^3.3.0", "@ucd-lib/theme-sass": "^6.0.1", "@wordpress/api-fetch": "^6.0.1", "@wordpress/block-editor": "^7.0.2", diff --git a/ucdlib-migration/src/editor/package-lock.json b/ucdlib-migration/src/editor/package-lock.json index fa477c9..a607ca3 100644 --- a/ucdlib-migration/src/editor/package-lock.json +++ b/ucdlib-migration/src/editor/package-lock.json @@ -17,7 +17,7 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "@ucd-lib/theme-elements": "^3.0.5", + "@ucd-lib/theme-elements": "^3.3.0", "@ucd-lib/theme-sass": "^6.0.1", "@wordpress/api-fetch": "^6.0.1", "@wordpress/block-editor": "^7.0.2", @@ -285,7 +285,7 @@ "@ucd-lib/brand-theme-editor": { "version": "file:../../../../ucdlib-theme-wp/src/editor", "requires": { - "@ucd-lib/theme-elements": "^3.0.5", + "@ucd-lib/theme-elements": "^3.3.0", "@ucd-lib/theme-sass": "^6.0.1", "@wordpress/api-fetch": "^6.0.1", "@wordpress/block-editor": "^7.0.2", From 26cbdcc1bf4be9dec45aac557be6025a61bc7cf3 Mon Sep 17 00:00:00 2001 From: Sabrina Baggett Date: Sun, 2 Nov 2025 14:45:58 -0800 Subject: [PATCH 2/6] initial research-highlights --- ucdlib-assets/src/public/index.js | 2 +- ucdlib-assets/src/public/package-lock.json | 1190 ----------------- ucdlib-directory/includes/api-people.php | 22 +- .../includes/block-transformations.php | 41 + ucdlib-directory/includes/blocks.php | 1 + ucdlib-directory/includes/people.php | 7 + .../includes/research-highlights.php | 55 +- .../edit.js | 134 +- .../index.js | 11 +- ucdlib-directory/src/public/index.js | 3 +- .../ucdlib-directory-research-highlights.js | 166 +++ ...cdlib-directory-research-highlights.tpl.js | 58 + .../blocks/person-research-highlights.twig | 18 +- ucdlib-special/src/public/package-lock.json | 711 ---------- 14 files changed, 437 insertions(+), 1982 deletions(-) create mode 100644 ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.js create mode 100644 ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.tpl.js diff --git a/ucdlib-assets/src/public/index.js b/ucdlib-assets/src/public/index.js index d508a16..aa129b8 100644 --- a/ucdlib-assets/src/public/index.js +++ b/ucdlib-assets/src/public/index.js @@ -22,7 +22,7 @@ class DynamicScriptLoader { }, { name: 'directory', - cssQuery: ['ucdlib-directory-filters', 'ucdlib-directory-sort', 'ucdlib-directory-service-filters'] + cssQuery: ['ucdlib-directory-filters', 'ucdlib-directory-sort', 'ucdlib-directory-service-filters', 'ucdlib-directory-research-highlights'] }, { name: 'special', diff --git a/ucdlib-assets/src/public/package-lock.json b/ucdlib-assets/src/public/package-lock.json index 09c93a6..ea7c70d 100644 --- a/ucdlib-assets/src/public/package-lock.json +++ b/ucdlib-assets/src/public/package-lock.json @@ -3153,14 +3153,6 @@ "node": ">= 0.8" } }, - "../../../../ucdlib-theme-wp/src/public/node_modules/async-each": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz", - "integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ==", - "dev": true, - "optional": true, - "peer": true - }, "../../../../ucdlib-theme-wp/src/public/node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -3479,17 +3471,6 @@ "node": ">=8" } }, - "../../../../ucdlib-theme-wp/src/public/node_modules/bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "file-uri-to-path": "1.0.0" - } - }, "../../../../ucdlib-theme-wp/src/public/node_modules/bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -5288,14 +5269,6 @@ "dev": true, "peer": true }, - "../../../../ucdlib-theme-wp/src/public/node_modules/file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "dev": true, - "optional": true, - "peer": true - }, "../../../../ucdlib-theme-wp/src/public/node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -6894,14 +6867,6 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, - "../../../../ucdlib-theme-wp/src/public/node_modules/nan": { - "version": "2.15.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz", - "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==", - "dev": true, - "optional": true, - "peer": true - }, "../../../../ucdlib-theme-wp/src/public/node_modules/nanoid": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.2.tgz", @@ -7343,14 +7308,6 @@ "dev": true, "peer": true }, - "../../../../ucdlib-theme-wp/src/public/node_modules/path-dirname": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", - "integrity": "sha512-ALzNPpyNq9AqXMBjeymIjFDAkAFH06mHJH/cSBHAgU0s4vfpBn6b2nf8tiRLvagKD8RbTpq2FKTBg7cl9l3c7Q==", - "dev": true, - "optional": true, - "peer": true - }, "../../../../ucdlib-theme-wp/src/public/node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -10052,14 +10009,6 @@ "node": ">= 0.10" } }, - "../../../../ucdlib-theme-wp/src/public/node_modules/remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha512-/hS+Y0u3aOfIETiaiirUFwDBDzmXPvO+jAfKTitUngIPzdKc6Z0LoFjM/CK5PL4C+eKwHohlHAb6H0VFfmmUsw==", - "dev": true, - "optional": true, - "peer": true - }, "../../../../ucdlib-theme-wp/src/public/node_modules/repeat-element": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.4.tgz", @@ -11448,18 +11397,6 @@ "node": ">=0.10.0" } }, - "../../../../ucdlib-theme-wp/src/public/node_modules/upath": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz", - "integrity": "sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg==", - "dev": true, - "optional": true, - "peer": true, - "engines": { - "node": ">=4", - "yarn": "*" - } - }, "../../../../ucdlib-theme-wp/src/public/node_modules/upper-case": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/upper-case/-/upper-case-1.1.3.tgz", @@ -11564,263 +11501,6 @@ "node": ">=10.13.0" } }, - "../../../../ucdlib-theme-wp/src/public/node_modules/watchpack-chokidar2": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/watchpack-chokidar2/-/watchpack-chokidar2-2.0.1.tgz", - "integrity": "sha512-nCFfBIPKr5Sh61s4LPpy1Wtfi0HE8isJ3d2Yb5/Ppw2P2B/3eVSEBjKfN0fmHJSK14+31KwMKmcrzs2GM4P0Ww==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "chokidar": "^2.1.8" - } - }, - "../../../../ucdlib-theme-wp/src/public/node_modules/watchpack-chokidar2/node_modules/anymatch": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", - "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "micromatch": "^3.1.4", - "normalize-path": "^2.1.1" - } - }, - "../../../../ucdlib-theme-wp/src/public/node_modules/watchpack-chokidar2/node_modules/anymatch/node_modules/normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha512-3pKJwH184Xo/lnH6oyP1q2pMd7HcypqqmRs91/6/i2CGtWwIKGCkOOMTm/zXbgTEWHw1uNpNi/igc3ePOYHb6w==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "remove-trailing-separator": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "../../../../ucdlib-theme-wp/src/public/node_modules/watchpack-chokidar2/node_modules/binary-extensions": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz", - "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==", - "dev": true, - "optional": true, - "peer": true, - "engines": { - "node": ">=0.10.0" - } - }, - "../../../../ucdlib-theme-wp/src/public/node_modules/watchpack-chokidar2/node_modules/braces": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", - "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "../../../../ucdlib-theme-wp/src/public/node_modules/watchpack-chokidar2/node_modules/chokidar": { - "version": "2.1.8", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", - "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==", - "deprecated": "Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "anymatch": "^2.0.0", - "async-each": "^1.0.1", - "braces": "^2.3.2", - "glob-parent": "^3.1.0", - "inherits": "^2.0.3", - "is-binary-path": "^1.0.0", - "is-glob": "^4.0.0", - "normalize-path": "^3.0.0", - "path-is-absolute": "^1.0.0", - "readdirp": "^2.2.1", - "upath": "^1.1.1" - }, - "optionalDependencies": { - "fsevents": "^1.2.7" - } - }, - "../../../../ucdlib-theme-wp/src/public/node_modules/watchpack-chokidar2/node_modules/extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "is-extendable": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "../../../../ucdlib-theme-wp/src/public/node_modules/watchpack-chokidar2/node_modules/fill-range": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", - "integrity": "sha512-VcpLTWqWDiTerugjj8e3+esbg+skS3M9e54UuR3iCeIDMXCLTsAH8hTSzDQU/X6/6t3eYkOKoZSef2PlU6U1XQ==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "../../../../ucdlib-theme-wp/src/public/node_modules/watchpack-chokidar2/node_modules/fsevents": { - "version": "1.2.13", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", - "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", - "deprecated": "fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "peer": true, - "dependencies": { - "bindings": "^1.5.0", - "nan": "^2.12.1" - }, - "engines": { - "node": ">= 4.0" - } - }, - "../../../../ucdlib-theme-wp/src/public/node_modules/watchpack-chokidar2/node_modules/glob-parent": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", - "integrity": "sha512-E8Ak/2+dZY6fnzlR7+ueWvhsH1SjHr4jjss4YS/h4py44jY9MhK/VFdaZJAWDz6BbL21KeteKxFSFpq8OS5gVA==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" - } - }, - "../../../../ucdlib-theme-wp/src/public/node_modules/watchpack-chokidar2/node_modules/glob-parent/node_modules/is-glob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", - "integrity": "sha512-UFpDDrPgM6qpnFNI+rh/p3bUaq9hKLZN8bMUWzxmcnZVS3omf4IPK+BrewlnWjO1WmUsMYuSjKh4UJuV4+Lqmw==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "is-extglob": "^2.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "../../../../ucdlib-theme-wp/src/public/node_modules/watchpack-chokidar2/node_modules/is-binary-path": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", - "integrity": "sha512-9fRVlXc0uCxEDj1nQzaWONSpbTfx0FmJfzHF7pwlI8DkWGoHBBea4Pg5Ky0ojwwxQmnSifgbKkI06Qv0Ljgj+Q==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "binary-extensions": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "../../../../ucdlib-theme-wp/src/public/node_modules/watchpack-chokidar2/node_modules/is-extendable": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", - "integrity": "sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==", - "dev": true, - "optional": true, - "peer": true, - "engines": { - "node": ">=0.10.0" - } - }, - "../../../../ucdlib-theme-wp/src/public/node_modules/watchpack-chokidar2/node_modules/is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha512-4cboCqIpliH+mAvFNegjZQ4kgKc3ZUhQVr3HvWbSh5q3WH2v82ct+T2Y1hdU5Gdtorx/cLifQjqCbL7bpznLTg==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "kind-of": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "../../../../ucdlib-theme-wp/src/public/node_modules/watchpack-chokidar2/node_modules/kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha512-NOW9QQXMoZGg/oqnVNoNTTIFEIid1627WCffUBJEdMxYApq7mNE7CpzucIPc+ZQg25Phej7IJSmX3hO+oblOtQ==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "is-buffer": "^1.1.5" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "../../../../ucdlib-theme-wp/src/public/node_modules/watchpack-chokidar2/node_modules/readdirp": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz", - "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "graceful-fs": "^4.1.11", - "micromatch": "^3.1.10", - "readable-stream": "^2.0.2" - }, - "engines": { - "node": ">=0.10" - } - }, - "../../../../ucdlib-theme-wp/src/public/node_modules/watchpack-chokidar2/node_modules/to-regex-range": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", - "integrity": "sha512-ZZWNfCjUokXXDGXFpZehJIkZqq91BcULFq/Pi7M5i4JnxXdhMKAK682z8bCW3o8Hj1wuuzoKcW3DfVzaP6VuNg==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "is-number": "^3.0.0", - "repeat-string": "^1.6.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, "../../../../ucdlib-theme-wp/src/public/node_modules/webpack": { "version": "5.71.0", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.71.0.tgz", @@ -19687,14 +19367,6 @@ "node": ">= 0.8" } }, - "node_modules/async-each": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz", - "integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ==", - "dev": true, - "optional": true, - "peer": true - }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -20031,17 +19703,6 @@ "node": ">=8" } }, - "node_modules/bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "file-uri-to-path": "1.0.0" - } - }, "node_modules/bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -21844,14 +21505,6 @@ "dev": true, "peer": true }, - "node_modules/file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "dev": true, - "optional": true, - "peer": true - }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -23386,14 +23039,6 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, - "node_modules/nan": { - "version": "2.17.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz", - "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==", - "dev": true, - "optional": true, - "peer": true - }, "node_modules/nanoid": { "version": "3.3.4", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", @@ -23790,14 +23435,6 @@ "dev": true, "peer": true }, - "node_modules/path-dirname": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", - "integrity": "sha512-ALzNPpyNq9AqXMBjeymIjFDAkAFH06mHJH/cSBHAgU0s4vfpBn6b2nf8tiRLvagKD8RbTpq2FKTBg7cl9l3c7Q==", - "dev": true, - "optional": true, - "peer": true - }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -26726,14 +26363,6 @@ "node": ">= 0.10" } }, - "node_modules/remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha512-/hS+Y0u3aOfIETiaiirUFwDBDzmXPvO+jAfKTitUngIPzdKc6Z0LoFjM/CK5PL4C+eKwHohlHAb6H0VFfmmUsw==", - "dev": true, - "optional": true, - "peer": true - }, "node_modules/repeat-element": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.4.tgz", @@ -28047,18 +27676,6 @@ "node": ">=0.10.0" } }, - "node_modules/upath": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz", - "integrity": "sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg==", - "dev": true, - "optional": true, - "peer": true, - "engines": { - "node": ">=4", - "yarn": "*" - } - }, "node_modules/update-browserslist-db": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.9.tgz", @@ -28189,263 +27806,6 @@ "node": ">=10.13.0" } }, - "node_modules/watchpack-chokidar2": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/watchpack-chokidar2/-/watchpack-chokidar2-2.0.1.tgz", - "integrity": "sha512-nCFfBIPKr5Sh61s4LPpy1Wtfi0HE8isJ3d2Yb5/Ppw2P2B/3eVSEBjKfN0fmHJSK14+31KwMKmcrzs2GM4P0Ww==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "chokidar": "^2.1.8" - } - }, - "node_modules/watchpack-chokidar2/node_modules/anymatch": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", - "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "micromatch": "^3.1.4", - "normalize-path": "^2.1.1" - } - }, - "node_modules/watchpack-chokidar2/node_modules/anymatch/node_modules/normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha512-3pKJwH184Xo/lnH6oyP1q2pMd7HcypqqmRs91/6/i2CGtWwIKGCkOOMTm/zXbgTEWHw1uNpNi/igc3ePOYHb6w==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "remove-trailing-separator": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/watchpack-chokidar2/node_modules/binary-extensions": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz", - "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==", - "dev": true, - "optional": true, - "peer": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/watchpack-chokidar2/node_modules/braces": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", - "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/watchpack-chokidar2/node_modules/chokidar": { - "version": "2.1.8", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", - "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==", - "deprecated": "Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "anymatch": "^2.0.0", - "async-each": "^1.0.1", - "braces": "^2.3.2", - "glob-parent": "^3.1.0", - "inherits": "^2.0.3", - "is-binary-path": "^1.0.0", - "is-glob": "^4.0.0", - "normalize-path": "^3.0.0", - "path-is-absolute": "^1.0.0", - "readdirp": "^2.2.1", - "upath": "^1.1.1" - }, - "optionalDependencies": { - "fsevents": "^1.2.7" - } - }, - "node_modules/watchpack-chokidar2/node_modules/extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "is-extendable": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/watchpack-chokidar2/node_modules/fill-range": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", - "integrity": "sha512-VcpLTWqWDiTerugjj8e3+esbg+skS3M9e54UuR3iCeIDMXCLTsAH8hTSzDQU/X6/6t3eYkOKoZSef2PlU6U1XQ==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/watchpack-chokidar2/node_modules/fsevents": { - "version": "1.2.13", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", - "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", - "deprecated": "fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "peer": true, - "dependencies": { - "bindings": "^1.5.0", - "nan": "^2.12.1" - }, - "engines": { - "node": ">= 4.0" - } - }, - "node_modules/watchpack-chokidar2/node_modules/glob-parent": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", - "integrity": "sha512-E8Ak/2+dZY6fnzlR7+ueWvhsH1SjHr4jjss4YS/h4py44jY9MhK/VFdaZJAWDz6BbL21KeteKxFSFpq8OS5gVA==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" - } - }, - "node_modules/watchpack-chokidar2/node_modules/glob-parent/node_modules/is-glob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", - "integrity": "sha512-UFpDDrPgM6qpnFNI+rh/p3bUaq9hKLZN8bMUWzxmcnZVS3omf4IPK+BrewlnWjO1WmUsMYuSjKh4UJuV4+Lqmw==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "is-extglob": "^2.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/watchpack-chokidar2/node_modules/is-binary-path": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", - "integrity": "sha512-9fRVlXc0uCxEDj1nQzaWONSpbTfx0FmJfzHF7pwlI8DkWGoHBBea4Pg5Ky0ojwwxQmnSifgbKkI06Qv0Ljgj+Q==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "binary-extensions": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/watchpack-chokidar2/node_modules/is-extendable": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", - "integrity": "sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==", - "dev": true, - "optional": true, - "peer": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/watchpack-chokidar2/node_modules/is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha512-4cboCqIpliH+mAvFNegjZQ4kgKc3ZUhQVr3HvWbSh5q3WH2v82ct+T2Y1hdU5Gdtorx/cLifQjqCbL7bpznLTg==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "kind-of": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/watchpack-chokidar2/node_modules/kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha512-NOW9QQXMoZGg/oqnVNoNTTIFEIid1627WCffUBJEdMxYApq7mNE7CpzucIPc+ZQg25Phej7IJSmX3hO+oblOtQ==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "is-buffer": "^1.1.5" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/watchpack-chokidar2/node_modules/readdirp": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz", - "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "graceful-fs": "^4.1.11", - "micromatch": "^3.1.10", - "readable-stream": "^2.0.2" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/watchpack-chokidar2/node_modules/to-regex-range": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", - "integrity": "sha512-ZZWNfCjUokXXDGXFpZehJIkZqq91BcULFq/Pi7M5i4JnxXdhMKAK682z8bCW3o8Hj1wuuzoKcW3DfVzaP6VuNg==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "is-number": "^3.0.0", - "repeat-string": "^1.6.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/webpack": { "version": "5.74.0", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.74.0.tgz", @@ -32306,14 +31666,6 @@ "integrity": "sha512-qEdtR2UH78yyHX/AUNfXmJTlM48XoFZKBdwi1nzkI1mJL21cmbu0cvjxjpkXJ5NENMq42H+hNs8VLJcqXLerBQ==", "dev": true }, - "async-each": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz", - "integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ==", - "dev": true, - "optional": true, - "peer": true - }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -32561,17 +31913,6 @@ "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "dev": true }, - "bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "file-uri-to-path": "1.0.0" - } - }, "bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -34075,14 +33416,6 @@ "dev": true, "peer": true }, - "file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "dev": true, - "optional": true, - "peer": true - }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -35335,14 +34668,6 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, - "nan": { - "version": "2.15.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz", - "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==", - "dev": true, - "optional": true, - "peer": true - }, "nanoid": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.2.tgz", @@ -35706,14 +35031,6 @@ "dev": true, "peer": true }, - "path-dirname": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", - "integrity": "sha512-ALzNPpyNq9AqXMBjeymIjFDAkAFH06mHJH/cSBHAgU0s4vfpBn6b2nf8tiRLvagKD8RbTpq2FKTBg7cl9l3c7Q==", - "dev": true, - "optional": true, - "peer": true - }, "path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -37941,14 +37258,6 @@ "integrity": "sha512-G08Dxvm4iDN3MLM0EsP62EDV9IuhXPR6blNz6Utcp7zyV3tr4HVNINt6MpaRWbxoOHT3Q7YN2P+jaHX8vUbgog==", "dev": true }, - "remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha512-/hS+Y0u3aOfIETiaiirUFwDBDzmXPvO+jAfKTitUngIPzdKc6Z0LoFjM/CK5PL4C+eKwHohlHAb6H0VFfmmUsw==", - "dev": true, - "optional": true, - "peer": true - }, "repeat-element": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.4.tgz", @@ -39060,14 +38369,6 @@ } } }, - "upath": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz", - "integrity": "sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg==", - "dev": true, - "optional": true, - "peer": true - }, "upper-case": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/upper-case/-/upper-case-1.1.3.tgz", @@ -39165,222 +38466,6 @@ "graceful-fs": "^4.1.2" } }, - "watchpack-chokidar2": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/watchpack-chokidar2/-/watchpack-chokidar2-2.0.1.tgz", - "integrity": "sha512-nCFfBIPKr5Sh61s4LPpy1Wtfi0HE8isJ3d2Yb5/Ppw2P2B/3eVSEBjKfN0fmHJSK14+31KwMKmcrzs2GM4P0Ww==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "chokidar": "^2.1.8" - }, - "dependencies": { - "anymatch": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", - "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "micromatch": "^3.1.4", - "normalize-path": "^2.1.1" - }, - "dependencies": { - "normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha512-3pKJwH184Xo/lnH6oyP1q2pMd7HcypqqmRs91/6/i2CGtWwIKGCkOOMTm/zXbgTEWHw1uNpNi/igc3ePOYHb6w==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "remove-trailing-separator": "^1.0.1" - } - } - } - }, - "binary-extensions": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz", - "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==", - "dev": true, - "optional": true, - "peer": true - }, - "braces": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", - "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - } - }, - "chokidar": { - "version": "2.1.8", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", - "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "anymatch": "^2.0.0", - "async-each": "^1.0.1", - "braces": "^2.3.2", - "fsevents": "^1.2.7", - "glob-parent": "^3.1.0", - "inherits": "^2.0.3", - "is-binary-path": "^1.0.0", - "is-glob": "^4.0.0", - "normalize-path": "^3.0.0", - "path-is-absolute": "^1.0.0", - "readdirp": "^2.2.1", - "upath": "^1.1.1" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "fill-range": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", - "integrity": "sha512-VcpLTWqWDiTerugjj8e3+esbg+skS3M9e54UuR3iCeIDMXCLTsAH8hTSzDQU/X6/6t3eYkOKoZSef2PlU6U1XQ==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - } - }, - "fsevents": { - "version": "1.2.13", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", - "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "bindings": "^1.5.0", - "nan": "^2.12.1" - } - }, - "glob-parent": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", - "integrity": "sha512-E8Ak/2+dZY6fnzlR7+ueWvhsH1SjHr4jjss4YS/h4py44jY9MhK/VFdaZJAWDz6BbL21KeteKxFSFpq8OS5gVA==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" - }, - "dependencies": { - "is-glob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", - "integrity": "sha512-UFpDDrPgM6qpnFNI+rh/p3bUaq9hKLZN8bMUWzxmcnZVS3omf4IPK+BrewlnWjO1WmUsMYuSjKh4UJuV4+Lqmw==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "is-extglob": "^2.1.0" - } - } - } - }, - "is-binary-path": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", - "integrity": "sha512-9fRVlXc0uCxEDj1nQzaWONSpbTfx0FmJfzHF7pwlI8DkWGoHBBea4Pg5Ky0ojwwxQmnSifgbKkI06Qv0Ljgj+Q==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "binary-extensions": "^1.0.0" - } - }, - "is-extendable": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", - "integrity": "sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==", - "dev": true, - "optional": true, - "peer": true - }, - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha512-4cboCqIpliH+mAvFNegjZQ4kgKc3ZUhQVr3HvWbSh5q3WH2v82ct+T2Y1hdU5Gdtorx/cLifQjqCbL7bpznLTg==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha512-NOW9QQXMoZGg/oqnVNoNTTIFEIid1627WCffUBJEdMxYApq7mNE7CpzucIPc+ZQg25Phej7IJSmX3hO+oblOtQ==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "is-buffer": "^1.1.5" - } - }, - "readdirp": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz", - "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "graceful-fs": "^4.1.11", - "micromatch": "^3.1.10", - "readable-stream": "^2.0.2" - } - }, - "to-regex-range": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", - "integrity": "sha512-ZZWNfCjUokXXDGXFpZehJIkZqq91BcULFq/Pi7M5i4JnxXdhMKAK682z8bCW3o8Hj1wuuzoKcW3DfVzaP6VuNg==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "is-number": "^3.0.0", - "repeat-string": "^1.6.1" - } - } - } - }, "webpack": { "version": "5.71.0", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.71.0.tgz", @@ -44184,14 +43269,6 @@ "integrity": "sha512-qEdtR2UH78yyHX/AUNfXmJTlM48XoFZKBdwi1nzkI1mJL21cmbu0cvjxjpkXJ5NENMq42H+hNs8VLJcqXLerBQ==", "dev": true }, - "async-each": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz", - "integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ==", - "dev": true, - "optional": true, - "peer": true - }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -44449,17 +43526,6 @@ "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "dev": true }, - "bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "file-uri-to-path": "1.0.0" - } - }, "bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -45958,14 +45024,6 @@ "dev": true, "peer": true }, - "file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "dev": true, - "optional": true, - "peer": true - }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -47183,14 +46241,6 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, - "nan": { - "version": "2.17.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz", - "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==", - "dev": true, - "optional": true, - "peer": true - }, "nanoid": { "version": "3.3.4", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", @@ -47524,14 +46574,6 @@ "dev": true, "peer": true }, - "path-dirname": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", - "integrity": "sha512-ALzNPpyNq9AqXMBjeymIjFDAkAFH06mHJH/cSBHAgU0s4vfpBn6b2nf8tiRLvagKD8RbTpq2FKTBg7cl9l3c7Q==", - "dev": true, - "optional": true, - "peer": true - }, "path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -49912,14 +48954,6 @@ "integrity": "sha512-G08Dxvm4iDN3MLM0EsP62EDV9IuhXPR6blNz6Utcp7zyV3tr4HVNINt6MpaRWbxoOHT3Q7YN2P+jaHX8vUbgog==", "dev": true }, - "remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha512-/hS+Y0u3aOfIETiaiirUFwDBDzmXPvO+jAfKTitUngIPzdKc6Z0LoFjM/CK5PL4C+eKwHohlHAb6H0VFfmmUsw==", - "dev": true, - "optional": true, - "peer": true - }, "repeat-element": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.4.tgz", @@ -50969,14 +50003,6 @@ } } }, - "upath": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz", - "integrity": "sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg==", - "dev": true, - "optional": true, - "peer": true - }, "update-browserslist-db": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.9.tgz", @@ -51084,222 +50110,6 @@ "graceful-fs": "^4.1.2" } }, - "watchpack-chokidar2": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/watchpack-chokidar2/-/watchpack-chokidar2-2.0.1.tgz", - "integrity": "sha512-nCFfBIPKr5Sh61s4LPpy1Wtfi0HE8isJ3d2Yb5/Ppw2P2B/3eVSEBjKfN0fmHJSK14+31KwMKmcrzs2GM4P0Ww==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "chokidar": "^2.1.8" - }, - "dependencies": { - "anymatch": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", - "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "micromatch": "^3.1.4", - "normalize-path": "^2.1.1" - }, - "dependencies": { - "normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha512-3pKJwH184Xo/lnH6oyP1q2pMd7HcypqqmRs91/6/i2CGtWwIKGCkOOMTm/zXbgTEWHw1uNpNi/igc3ePOYHb6w==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "remove-trailing-separator": "^1.0.1" - } - } - } - }, - "binary-extensions": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz", - "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==", - "dev": true, - "optional": true, - "peer": true - }, - "braces": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", - "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - } - }, - "chokidar": { - "version": "2.1.8", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", - "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "anymatch": "^2.0.0", - "async-each": "^1.0.1", - "braces": "^2.3.2", - "fsevents": "^1.2.7", - "glob-parent": "^3.1.0", - "inherits": "^2.0.3", - "is-binary-path": "^1.0.0", - "is-glob": "^4.0.0", - "normalize-path": "^3.0.0", - "path-is-absolute": "^1.0.0", - "readdirp": "^2.2.1", - "upath": "^1.1.1" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "fill-range": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", - "integrity": "sha512-VcpLTWqWDiTerugjj8e3+esbg+skS3M9e54UuR3iCeIDMXCLTsAH8hTSzDQU/X6/6t3eYkOKoZSef2PlU6U1XQ==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - } - }, - "fsevents": { - "version": "1.2.13", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", - "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "bindings": "^1.5.0", - "nan": "^2.12.1" - } - }, - "glob-parent": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", - "integrity": "sha512-E8Ak/2+dZY6fnzlR7+ueWvhsH1SjHr4jjss4YS/h4py44jY9MhK/VFdaZJAWDz6BbL21KeteKxFSFpq8OS5gVA==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" - }, - "dependencies": { - "is-glob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", - "integrity": "sha512-UFpDDrPgM6qpnFNI+rh/p3bUaq9hKLZN8bMUWzxmcnZVS3omf4IPK+BrewlnWjO1WmUsMYuSjKh4UJuV4+Lqmw==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "is-extglob": "^2.1.0" - } - } - } - }, - "is-binary-path": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", - "integrity": "sha512-9fRVlXc0uCxEDj1nQzaWONSpbTfx0FmJfzHF7pwlI8DkWGoHBBea4Pg5Ky0ojwwxQmnSifgbKkI06Qv0Ljgj+Q==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "binary-extensions": "^1.0.0" - } - }, - "is-extendable": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", - "integrity": "sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==", - "dev": true, - "optional": true, - "peer": true - }, - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha512-4cboCqIpliH+mAvFNegjZQ4kgKc3ZUhQVr3HvWbSh5q3WH2v82ct+T2Y1hdU5Gdtorx/cLifQjqCbL7bpznLTg==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha512-NOW9QQXMoZGg/oqnVNoNTTIFEIid1627WCffUBJEdMxYApq7mNE7CpzucIPc+ZQg25Phej7IJSmX3hO+oblOtQ==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "is-buffer": "^1.1.5" - } - }, - "readdirp": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz", - "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "graceful-fs": "^4.1.11", - "micromatch": "^3.1.10", - "readable-stream": "^2.0.2" - } - }, - "to-regex-range": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", - "integrity": "sha512-ZZWNfCjUokXXDGXFpZehJIkZqq91BcULFq/Pi7M5i4JnxXdhMKAK682z8bCW3o8Hj1wuuzoKcW3DfVzaP6VuNg==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "is-number": "^3.0.0", - "repeat-string": "^1.6.1" - } - } - } - }, "webpack": { "version": "5.74.0", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.74.0.tgz", diff --git a/ucdlib-directory/includes/api-people.php b/ucdlib-directory/includes/api-people.php index 05b1867..010fe5f 100644 --- a/ucdlib-directory/includes/api-people.php +++ b/ucdlib-directory/includes/api-people.php @@ -52,11 +52,18 @@ public function epcb_research_highlights($request){ $resp = json_decode(wp_remote_retrieve_body( $response ), true); - $graph = is_array($resp) && isset($resp['@graph']) + $graph_unfiltered = is_array($resp) && isset($resp['@graph']) ? $resp['@graph'] : (isset($resp->{'@graph'}) ? $resp->{'@graph'} : []); - + $graph = array_values(array_filter($graph_unfiltered , function ($item) { + $types = is_array($item['@type']) ? $item['@type'] : [$item['@type']]; + foreach ($types as $t) { + if (is_string($t) && strcasecmp($t, 'Work') === 0) { + return true; + } + } + })); $favourites = array_filter($graph, function($item) { if (!is_array($item)) { @@ -88,12 +95,18 @@ public function epcb_research_highlights($request){ } return false; }); + + if(count($favourites) === 0){ + $favourites = array_slice($graph, 0, 3); + } else { + $favourites = array_slice($favourites, 0, 3); + } $out = array_values(array_map(function($item) { return [ 'id' => $item['@id'] ?? '', - 'type' => $item['@type'] ?? [], + 'type' => $item['type'] ?? [], 'volume' => $item['volume'] ?? '', 'author' => $item['author'] ?? [], 'issn' => $item['ISSN'] ?? '', @@ -104,12 +117,13 @@ public function epcb_research_highlights($request){ 'issuedDate' => $item['issued'] ?? '', 'status' => $item['status'] ?? '', 'containerTitle' => $item['container-title'] ?? '', + 'publication' => $item['hasPublicationVenue']['name'] ?? '', 'publisher' => $item['publisher'] ?? '', 'page' => $item['page'] ?? '', ]; }, $favourites)); - return rest_ensure_response( $out ); + return rest_ensure_response( $favourites ); } // endpoint for looking up a single person diff --git a/ucdlib-directory/includes/block-transformations.php b/ucdlib-directory/includes/block-transformations.php index 8de8fd7..93c65db 100644 --- a/ucdlib-directory/includes/block-transformations.php +++ b/ucdlib-directory/includes/block-transformations.php @@ -22,6 +22,7 @@ public static function getDirectoryUrl( $attrs ){ return $attrs; } + public static function getServiceResults( $attrs=[] ){ $serviceQuery = [ 'post_type' => 'service', @@ -97,6 +98,46 @@ public static function setElasticSearch($attrs){ return $attrs; } +// public static function setResearchHighlights( $context ) { +// // Always return a clean array +// if ( !is_array($context) ) { +// $context = is_object($context) ? (array) $context : []; +// } + +// // Ensure siteContext exists +// if ( !isset($context['siteContext']) || !is_array($context['siteContext']) ) { +// $context['siteContext'] = []; +// } + +// // Get the current post ID +// $post_id = null; +// if ( isset($context['siteContext']['post']) && is_object($context['siteContext']['post']) ) { +// $post_id = $context['siteContext']['post']->ID ?? null; +// } +// if ( !$post_id ) $post_id = get_the_ID(); + +// // --- Read meta --- +// $raw_json = get_post_meta($post_id, 'research_highlights_formatted', true); +// $decoded = []; + +// if ( is_string($raw_json) && $raw_json !== '' ) { +// $tmp = json_decode($raw_json, true); +// if ( json_last_error() === JSON_ERROR_NONE && is_array($tmp) ) { +// $decoded = $tmp; +// } else { +// error_log("RH decode error (" . json_last_error_msg() . ") for post {$post_id}"); +// } +// } + +// // Add to siteContext +// $context['siteContext']['items'] = $decoded; +// $context['siteContext']['hide_research_highlights'] = +// (bool) get_post_meta($post_id, 'hide_research_highlights', true); + +// return $context; +// } + + public static function getEsResults($attrs){ if ( !array_key_exists('elasticSearch', $attrs) || !$attrs['elasticSearch'] ) return $attrs; diff --git a/ucdlib-directory/includes/blocks.php b/ucdlib-directory/includes/blocks.php index 9845d30..1c85c01 100644 --- a/ucdlib-directory/includes/blocks.php +++ b/ucdlib-directory/includes/blocks.php @@ -75,6 +75,7 @@ public function __construct($config){ ], 'ucdlib-directory/research-highlights' => [ 'twig' => '@ucdlib-directory/blocks/person-research-highlights.twig' + // 'transform' => ['setResearchHighlights'] ] ]; diff --git a/ucdlib-directory/includes/people.php b/ucdlib-directory/includes/people.php index e7874e5..d51fe15 100644 --- a/ucdlib-directory/includes/people.php +++ b/ucdlib-directory/includes/people.php @@ -36,6 +36,7 @@ public function __construct($config){ add_filter( 'ucd-theme/context/single', array($this, 'set_context') ); add_filter( 'ucd-theme/templates/single', array($this, 'set_template'), 10, 2 ); + } // register 'person' post type @@ -293,6 +294,12 @@ public function register_post_meta(){ 'default' => false, 'type' => 'boolean', ) ); + register_post_meta( $slug, 'has_research_highlights', array( + 'show_in_rest' => true, + 'single' => true, + 'default' => false, + 'type' => 'boolean', + ) ); } diff --git a/ucdlib-directory/includes/research-highlights.php b/ucdlib-directory/includes/research-highlights.php index e2483d9..93a95fc 100644 --- a/ucdlib-directory/includes/research-highlights.php +++ b/ucdlib-directory/includes/research-highlights.php @@ -5,20 +5,36 @@ class UCDDirectoryResearchHighlights { public $config; public $slug; public $postType; + public function __construct($config) { $this->config = $config; $this->slug = $this->config['taxSlugs']['research-highlights']; $this->postType = $this->config['postSlugs']['person']; - // run regiser function on init hook - // add_action( 'init', array($this, 'register') ); + add_action( 'init', [$this, 'register_post_meta']); - // run add_to_menu on admin_menu hook - // add_action( 'admin_menu', array($this, 'add_to_menu')); - - // run expand_parent_menu on parent_file hook - // add_action( 'parent_file', array($this, 'expand_parent_menu') ); + add_filter('ucdlib_directory_people_post_type', function($default){ + return $this->config['postSlugs']['person']; + }); + add_filter('ucdlib_directory_research_highlights_block_name', function($default){ + return 'ucdlib-directory/research-highlights'; + }); + add_filter('ucdlib_directory_research_highlights_meta_map', function($map){ + return [ + 'hideResearchHighlights'=> 'hide_research_highlights' + ]; + }); + add_filter('ucdlib_directory_research_highlights_insert_after', function($default){ + return 'ucdlib-directory/expertise-areas'; + }); + add_filter('ucdlib_directory_research_highlights_insert_position', function($default){ + return 'end'; + }); + add_filter('ucdlib/directory/research_highlights_default_attrs', function($attrs, $post_id){ + if (empty($attrs['expertId'])) $attrs['expertId'] = ''; + return $attrs; + }, 10, 2); } // register taxonomy @@ -61,6 +77,31 @@ public function register(){ } + + // register custom metadata for this post type + public function register_post_meta() { + // IMPORTANT: use the post type, not the taxonomy slug + $post_type = $this->postType; // e.g. 'person' + + register_post_meta( $post_type, 'research_highlights_formatted', [ + 'show_in_rest' => true, + 'single' => true, + 'type' => 'string', // we'll save JSON.stringify([...]) from edit.js + 'default' => '[]', // make default consistent with sanitize + 'auth_callback'=> function() { // adjust if you need to restrict + return current_user_can('edit_posts'); + }, + 'sanitize_callback' => function($v){ + $s = (string)$v; + if ($s === '') return '[]'; + json_decode($s, true); + return json_last_error() === JSON_ERROR_NONE ? $s : '[]'; + } + ] ); + + UCDLibPluginDirectoryUtils::registerContactMeta( $post_type ); + } + // add to plugin admin menu public function add_to_menu(){ $label = 'Research Highlights'; diff --git a/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/edit.js b/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/edit.js index 1baf951..902c33c 100644 --- a/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/edit.js +++ b/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/edit.js @@ -1,48 +1,74 @@ import { html, SelectUtils } from "@ucd-lib/brand-theme-editor/lib/utils"; -import { useBlockProps } from '@wordpress/block-editor'; +import { useBlockProps} from '@wordpress/block-editor'; import { PluginDocumentSettingPanel } from '@wordpress/editor'; -import { PanelBody, TextControl, Button, Spinner, Notice } from '@wordpress/components'; -import { Fragment } from "@wordpress/element"; -import { Modal } from '@wordpress/components'; -import { useState, useCallback } from '@wordpress/element'; +import { PanelBody, TextControl, Button, Notice, Modal } from '@wordpress/components'; +import { Fragment, useState, useCallback, useEffect } from '@wordpress/element'; import apiFetch from '@wordpress/api-fetch'; export default ( props ) => { - const blockProps = useBlockProps(); + const { attributes, setAttributes } = props; + const blockProps = useBlockProps(); const [ isOpen, setOpen ] = useState( false ); const openModal = () => setOpen( true ); const closeModal = () => setOpen( false ); - const [query, setQuery] = useState(''); - const [loading, setLoading] = useState(true); const [error, setError] = useState(''); - const [results, setResults] = useState([]); + const [searchedId, setSearchedId] = useState(''); + const meta = SelectUtils.editedPostAttribute('meta'); + const hideResearchHighlights = meta.hide_research_highlights ? meta.hide_research_highlights : false; + + useEffect(() => { + setAttributes({ hideResearchHighlights }); + }, [hideResearchHighlights, setAttributes]); + + + + useEffect(() => { + if (query.trim() === '') { + setAttributes({ expertId: '' }); + setSearchedId(''); + setError(''); + } + }, [query, setAttributes]); + + const fetchHighlights = useCallback(async () => { + const q = query.trim(); + + if (!q) { + setAttributes({ expertId: '' }); + setSearchedId(''); + setError(''); + return; + } -const fetchHighlights = useCallback( async () => { - setLoading(true); - setError(''); try { - const path = `/ucdlib-directory/research-highlights/${encodeURIComponent(query)}`; - const r = await apiFetch({ path }); - console.log('rh', r); - setResults(r || []); - } catch (error) { - setResults([]); - setError('Error fetching research highlights' + (error.message ? ': ' + error.message : '.')); - setLoading(false); - console.warn(error); - } finally { - setLoading(false); + setError(''); + const path = `ucdlib-directory/research-highlights/${encodeURIComponent(query)}`; + const data = await apiFetch({ path }); + if (Array.isArray(data) && data.length > 0) { + setAttributes({ expertId: q }); + setSearchedId(q); + } else { + setAttributes({ expertId: '' }); + setSearchedId(''); + setError(`No results found for Expert ID: ${q}`); + } + } catch (err) { + setAttributes({ expertId: '' }); + setSearchedId(''); + setError(`API request failed${err?.message ? `: ${err.message}` : ''}`); } -}, [query] ); + }, [query, setAttributes]); + + const clearAll = useCallback(() => { + setQuery(''); + setAttributes({ expertId: '' }); + setSearchedId(''); + setError(''); + }, [setAttributes]); -// get metadata -// const taxSlug = 'research-highlights'; - const meta = SelectUtils.editedPostAttribute('meta'); - const res = Array.isArray(results) ? results : []; - const hideTags = meta.hide_research_highlights ? meta.hide_research_highlights : false; return html` <${Fragment}> <${PluginDocumentSettingPanel} @@ -53,7 +79,7 @@ const fetchHighlights = useCallback( async () => { <${PanelBody} initialOpen=${ true }> <${TextControl} value=${ query } - label="Alma Record ID" + label="Expert Record ID" onChange=${ ( value ) => setQuery( value ) } placeholder="Search Expert ID..." /> @@ -64,34 +90,30 @@ const fetchHighlights = useCallback( async () => { style=${{ marginBottom: '.5em', marginTop: '.5em' }} >Search Expert ID - - ${ error && html`<${Notice} status="error" isDismissible=${ false }>${ error }` } - ${ !loading && results.length === 0 && query !== '' && html`

No Research Highlights found.

` } + <${Button} variant="secondary" onClick=${clearAll} isDestructive=${false}> + Clear + + + ${ searchedId !== '' && html`

Showing results for Expert ID: ${ searchedId }

`} + ${ error && html`

No Research Highlights found.

` } -
- ${!hideTags && html` -
-
-

Research Highlights

-
-

Research Highlights content is managed outside of this block. Click to learn more.

- ${res.length ? html` -
    - ${res.map((r, i) => html` -
  • ${r?.title || r?.label || '(untitled)'}
  • - `)} -
- ` : null} -
-
- ${isOpen && html` - <${Modal} title="Editing Your Research Highlights" onRequestClose=${ closeModal }> -
To add or edit your Research Highlights, use the "Research Highlights" area in the "Person" right-hand sidebar
- - `} -
- `} +
+ ${!hideResearchHighlights && html` +

Research Highlights

+
+
+
+ ${searchedId? html`Aggie Experts Research Highlights for ${searchedId}`:html`Please enter an Expert ID to load Research Highlights.`} +
+
+ ${isOpen && html` + <${Modal} title="Editing Your Research Highlights" onRequestClose=${ closeModal }> +
To add or edit your Research Highlights, please update your Expert Record in the Aggie Experts system.
+ + `}
+ `} +
` } \ No newline at end of file diff --git a/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/index.js b/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/index.js index 4b78bda..98ea4f4 100644 --- a/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/index.js +++ b/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/index.js @@ -5,16 +5,23 @@ const name = 'ucdlib-directory/research-highlights'; const settings = { api_version: 2, title: "Research Highlights", - parent: [], description: "Highlight your research works", icon: UCDIcons.renderPublic('fa-flask'), - category: 'ucdlib-directory-person', + category: 'ucdlib-directory', keywords: [ 'research', 'highlights', 'works' ], supports: { "html": false, "customClassName": false }, attributes: { + expertId: { + "type": "string", + "default": "" + }, + hideResearchHighlights: { + "type": "boolean", + "default": false + } }, edit: Edit }; diff --git a/ucdlib-directory/src/public/index.js b/ucdlib-directory/src/public/index.js index 8680ab8..3c02657 100644 --- a/ucdlib-directory/src/public/index.js +++ b/ucdlib-directory/src/public/index.js @@ -1,3 +1,4 @@ import "./src/elements/ucdlib-directory-filters"; import "./src/elements/ucdlib-directory-sort"; -import "./src/elements/ucdlib-directory-service-filters"; \ No newline at end of file +import "./src/elements/ucdlib-directory-service-filters"; +import "./src/elements/ucdlib-directory-research-highlights"; \ No newline at end of file diff --git a/ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.js b/ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.js new file mode 100644 index 0000000..d5f58e8 --- /dev/null +++ b/ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.js @@ -0,0 +1,166 @@ +import { LitElement } from 'lit'; +import { render, styles } from './ucdlib-directory-research-highlights.tpl.js'; + +/* + @classdesc Element to display research highlights for a + directory profile +*/ +export default class UcdlibDirectoryResearchHighlights extends LitElement { + static get properties() { + return { + expertId: { type: String, attribute: 'expert-id' }, + res: { type: Array }, + dataLazy: { type: Boolean, attribute: 'data-lazy', reflect: true } + }; + } + + static get styles() { return styles(); } + + constructor() { + super(); + this.render = render.bind(this); + this.res = []; + this._loadedOnce = false; + } + + /* + * @description LitElement lifecycle called when element is added to DOM + * @returns {void} + */ + connectedCallback() { + super.connectedCallback(); + if (this.hasAttribute('data-lazy')) { + this.observeVisibility(); + } + } + + /* + * @description Fetch research highlights data from API + * @returns {void} + */ + async fetchHighlights() { + if (this._loadedOnce) return; + if (!this.expertId) return; + + this._loadedOnce = true; + + try { + const response = await fetch( + `/wp-json/ucdlib-directory/research-highlights/${encodeURIComponent(this.expertId)}` + ); + + if (response.ok) { + const data = await response.json(); + this.res = this.formatResults(data); + } else { + console.warn('Error fetching research highlights:', response.statusText); + } + } catch (error) { + console.warn('Error fetching research highlights:', error); + this._loadedOnce = false; + } + } + + /* + * @description Set up IntersectionObserver to lazy load data when element is visible + * @returns {void} + */ + observeVisibility() { + // Fallback for browsers that do not support IntersectionObserver + if (!('IntersectionObserver' in window)) { + console.warn('IntersectionObserver not supported, loading research highlights immediately'); + this.fetchHighlights(); + return; + } + + // Set up IntersectionObserver to load data when element is visible + const observer = new IntersectionObserver(entries => { + entries.forEach(entry => { + if (entry.isIntersecting) { + observer.unobserve(this); + this.fetchHighlights(); + } + }); + }, { threshold: 0.25 }); + + observer.observe(this); +} + + /* + * @description Format raw data from API into display-friendly format + * @param {Array} data - Raw research highlights data from API + * @returns {Array} Formatted research highlights + */ + formatResults(data) { + if (!data) return []; + return data.map(item => ({ + id: item.id || '', + title: item.title || '(untitled)', + url: item.url || '', + status: item.status || '', + publication: item['publication'] || item['container-title'] || '', + volume: item.volume || '', + page: item.page || '', + type: this.formatType(item.type), + issuedDate: this.formatDate(item.issuedDate ? item.issuedDate : ''), + author: this.formatAuthors(item.author), + abstract: item.abstract || '' + })); + } + + /* + * @description Helper to format type into human-readable string + * @param {String} type - Raw type string from API + * @returns {String} Formatted type string + */ + formatType(type) { + let readableType = type; + switch (type) { + case 'article-journal': readableType = 'Journal Article'; break; + case 'paper-conference': readableType = 'Conference Paper'; break; + case 'article-magazine': readableType = 'Magazine Article'; break; + case 'article-newspaper': readableType = 'Newspaper Article'; break; + case 'entry-dictionary': readableType = 'Dictionary Entry'; break; + case 'entry-encyclopedia': readableType = 'Encyclopedia Entry'; break; + case 'post-weblog': readableType = 'Weblog Post'; break; + case 'review-book': readableType = 'Book Review'; break; + case 'motion_picture': readableType = 'Motion Picture'; break; + case 'musical_score': readableType = 'Musical Score'; break; + default: break; + } + return (readableType || '') + (readableType ? ' • ' : ''); + } + + /* + * @description Helper to format date string into year + * @param {String} dateStr - Raw date string from API + * @returns {String} Formatted date string + */ + formatDate(dateStr) { + if (!dateStr) return ''; + return dateStr.split('-')[0] + ' • '; + } + + /* + * @description Helper to format authors array into string + * @param {Array|Object} authors - Raw authors data from API + * @returns {String} Formatted authors string + */ + formatAuthors(authors) { + if (!authors) return ''; + if (!Array.isArray(authors)) authors = [authors]; + + const formatted = authors.map(author => { + const last = author?.family || ''; + const given = author?.given || ''; + const parts = given.split(' ').filter(Boolean); + const first = parts[0]?.charAt(0) || ''; + const middle = parts[1]?.charAt(0) || ''; + return `${last}, ${first}.${middle ? ` ${middle}.` : '.'} `; + }); + + return formatted.join(', '); + } +} + +customElements.define('ucdlib-directory-research-highlights', UcdlibDirectoryResearchHighlights); diff --git a/ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.tpl.js b/ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.tpl.js new file mode 100644 index 0000000..4b55b43 --- /dev/null +++ b/ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.tpl.js @@ -0,0 +1,58 @@ +import { html, css } from 'lit'; +import classStyles from "@ucd-lib/theme-sass/2_base_class/_index.css.js"; +import baseStyles from "@ucd-lib/theme-sass/1_base_html/_index.css.js"; +import objectsStyles from "@ucd-lib/theme-sass/3_objects/_index.css.js"; +import componentClassesStyles from "@ucd-lib/theme-sass/4_component/_index.css.js"; +import layoutStyles from "@ucd-lib/theme-sass/5_layout/_index.css.js"; +import utilityStyles from "@ucd-lib/theme-sass/6_utility/_index.css.js"; + +export function styles() { + const elementStyles = css` + :host { display: block; } + .title { + font-weight: bold; + font-size: 1.188rem; + text-decoration: none; + } + .info { + font-size: 1rem; + } + + `; + return [ + classStyles, + baseStyles, + objectsStyles, + componentClassesStyles, + layoutStyles, + utilityStyles, + elementStyles + ]; +} + +export function render() { + return html` +

Research Highlights

+ ${this.res?.length ? html` +
    + ${this.res.map((r, i) => html` +
  • + ${r?.url + ? html`${r.title || '(untitled)'}` + : html`${r.title || '(untitled)'}`} +
    + + ${r?.type ?? ''} + ${r?.issuedDate ?? ''} + ${r?.author ?? ''} + ${r?.publication ? html`${r.publication}, ` : ''} + ${r?.volume ? `${r.volume}.` : ''} + ${r?.page ? ` ${r.page}.` : ''} + +
  • + `)} +
+ More research + ` : html`

No Research Highlights added.

`} + `; +} diff --git a/ucdlib-directory/views/blocks/person-research-highlights.twig b/ucdlib-directory/views/blocks/person-research-highlights.twig index ec09b02..ce1189a 100644 --- a/ucdlib-directory/views/blocks/person-research-highlights.twig +++ b/ucdlib-directory/views/blocks/person-research-highlights.twig @@ -1,11 +1,9 @@ -{%set p = siteContext.post %} -{% if p.researchHighlights %} -
-

Research Highlights

-

- {% apply spaceless %} -

This individual's research highlights

- {% endapply %} -

-
+{% set hide = attributes.hideResearchHighlights == 1 or attributes.hideResearchHighlights is same as(true) %} + +{% if not hide %} + + {% endif %} \ No newline at end of file diff --git a/ucdlib-special/src/public/package-lock.json b/ucdlib-special/src/public/package-lock.json index 2134963..de96734 100644 --- a/ucdlib-special/src/public/package-lock.json +++ b/ucdlib-special/src/public/package-lock.json @@ -1936,20 +1936,6 @@ "node": ">=4" } }, - "node_modules/anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "optional": true, - "peer": true, - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, "node_modules/aproba": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", @@ -2065,19 +2051,6 @@ "node": ">= 0.8" } }, - "node_modules/async-each": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.6.tgz", - "integrity": "sha512-c646jH1avxr+aVpndVMeAfYw7wAa6idufrlN3LPA4PmKS0QEGp6PIC9nwz0WQkkvBGAMEki3pFdtxaF39J9vvg==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], - "optional": true, - "peer": true - }, "node_modules/atob": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", @@ -2287,26 +2260,6 @@ "node": "*" } }, - "node_modules/binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "optional": true, - "peer": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "optional": true, - "peer": true, - "dependencies": { - "file-uri-to-path": "1.0.0" - } - }, "node_modules/bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -2675,80 +2628,6 @@ "node": ">=4" } }, - "node_modules/chokidar": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", - "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", - "optional": true, - "peer": true, - "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, - "engines": { - "node": ">= 8.10.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/chokidar/node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "optional": true, - "peer": true, - "dependencies": { - "fill-range": "^7.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/chokidar/node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "optional": true, - "peer": true, - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/chokidar/node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "optional": true, - "peer": true, - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/chokidar/node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "optional": true, - "peer": true, - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, "node_modules/chownr": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", @@ -3817,13 +3696,6 @@ "node": ">= 4" } }, - "node_modules/file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "optional": true, - "peer": true - }, "node_modules/fill-range": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", @@ -3953,20 +3825,6 @@ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "peer": true }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "peer": true, - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", @@ -4030,19 +3888,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "optional": true, - "peer": true, - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/globals": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", @@ -4465,19 +4310,6 @@ "node": ">= 0.10" } }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "optional": true, - "peer": true, - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/is-buffer": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", @@ -4532,29 +4364,6 @@ "node": ">=0.10.0" } }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "optional": true, - "peer": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "optional": true, - "peer": true, - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/is-number": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", @@ -5031,13 +4840,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, - "node_modules/nan": { - "version": "2.18.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.18.0.tgz", - "integrity": "sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w==", - "optional": true, - "peer": true - }, "node_modules/nanomatch": { "version": "1.2.13", "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", @@ -5116,16 +4918,6 @@ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.5.tgz", "integrity": "sha512-U9h1NLROZTq9uE1SNffn6WuPDg8icmi3ns4rEl/oTfIle4iLjTliCzgTsbaIFMq/Xn078/lfY/BL0GWZ+psK4Q==" }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "optional": true, - "peer": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/normalize-range": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz", @@ -5371,13 +5163,6 @@ "integrity": "sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ==", "peer": true }, - "node_modules/path-dirname": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", - "integrity": "sha512-ALzNPpyNq9AqXMBjeymIjFDAkAFH06mHJH/cSBHAgU0s4vfpBn6b2nf8tiRLvagKD8RbTpq2FKTBg7cl9l3c7Q==", - "optional": true, - "peer": true - }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -5429,19 +5214,6 @@ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "optional": true, - "peer": true, - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, "node_modules/pify": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", @@ -6112,19 +5884,6 @@ "safe-buffer": "~5.1.0" } }, - "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "optional": true, - "peer": true, - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, "node_modules/recast": { "version": "0.11.23", "resolved": "https://registry.npmjs.org/recast/-/recast-0.11.23.tgz", @@ -6264,13 +6023,6 @@ "node": ">= 0.10" } }, - "node_modules/remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha512-/hS+Y0u3aOfIETiaiirUFwDBDzmXPvO+jAfKTitUngIPzdKc6Z0LoFjM/CK5PL4C+eKwHohlHAb6H0VFfmmUsw==", - "optional": true, - "peer": true - }, "node_modules/repeat-element": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.4.tgz", @@ -7378,17 +7130,6 @@ "node": ">=0.10.0" } }, - "node_modules/upath": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz", - "integrity": "sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg==", - "optional": true, - "peer": true, - "engines": { - "node": ">=4", - "yarn": "*" - } - }, "node_modules/update-browserslist-db": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.3.tgz", @@ -7562,145 +7303,6 @@ "watchpack-chokidar2": "^2.0.1" } }, - "node_modules/watchpack-chokidar2": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/watchpack-chokidar2/-/watchpack-chokidar2-2.0.1.tgz", - "integrity": "sha512-nCFfBIPKr5Sh61s4LPpy1Wtfi0HE8isJ3d2Yb5/Ppw2P2B/3eVSEBjKfN0fmHJSK14+31KwMKmcrzs2GM4P0Ww==", - "optional": true, - "peer": true, - "dependencies": { - "chokidar": "^2.1.8" - } - }, - "node_modules/watchpack-chokidar2/node_modules/anymatch": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", - "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", - "optional": true, - "peer": true, - "dependencies": { - "micromatch": "^3.1.4", - "normalize-path": "^2.1.1" - } - }, - "node_modules/watchpack-chokidar2/node_modules/anymatch/node_modules/normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha512-3pKJwH184Xo/lnH6oyP1q2pMd7HcypqqmRs91/6/i2CGtWwIKGCkOOMTm/zXbgTEWHw1uNpNi/igc3ePOYHb6w==", - "optional": true, - "peer": true, - "dependencies": { - "remove-trailing-separator": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/watchpack-chokidar2/node_modules/binary-extensions": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz", - "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==", - "optional": true, - "peer": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/watchpack-chokidar2/node_modules/chokidar": { - "version": "2.1.8", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", - "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==", - "deprecated": "Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies", - "optional": true, - "peer": true, - "dependencies": { - "anymatch": "^2.0.0", - "async-each": "^1.0.1", - "braces": "^2.3.2", - "glob-parent": "^3.1.0", - "inherits": "^2.0.3", - "is-binary-path": "^1.0.0", - "is-glob": "^4.0.0", - "normalize-path": "^3.0.0", - "path-is-absolute": "^1.0.0", - "readdirp": "^2.2.1", - "upath": "^1.1.1" - }, - "optionalDependencies": { - "fsevents": "^1.2.7" - } - }, - "node_modules/watchpack-chokidar2/node_modules/fsevents": { - "version": "1.2.13", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", - "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", - "deprecated": "The v1 package contains DANGEROUS / INSECURE binaries. Upgrade to safe fsevents v2", - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "peer": true, - "dependencies": { - "bindings": "^1.5.0", - "nan": "^2.12.1" - }, - "engines": { - "node": ">= 4.0" - } - }, - "node_modules/watchpack-chokidar2/node_modules/glob-parent": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", - "integrity": "sha512-E8Ak/2+dZY6fnzlR7+ueWvhsH1SjHr4jjss4YS/h4py44jY9MhK/VFdaZJAWDz6BbL21KeteKxFSFpq8OS5gVA==", - "optional": true, - "peer": true, - "dependencies": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" - } - }, - "node_modules/watchpack-chokidar2/node_modules/glob-parent/node_modules/is-glob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", - "integrity": "sha512-UFpDDrPgM6qpnFNI+rh/p3bUaq9hKLZN8bMUWzxmcnZVS3omf4IPK+BrewlnWjO1WmUsMYuSjKh4UJuV4+Lqmw==", - "optional": true, - "peer": true, - "dependencies": { - "is-extglob": "^2.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/watchpack-chokidar2/node_modules/is-binary-path": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", - "integrity": "sha512-9fRVlXc0uCxEDj1nQzaWONSpbTfx0FmJfzHF7pwlI8DkWGoHBBea4Pg5Ky0ojwwxQmnSifgbKkI06Qv0Ljgj+Q==", - "optional": true, - "peer": true, - "dependencies": { - "binary-extensions": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/watchpack-chokidar2/node_modules/readdirp": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz", - "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", - "optional": true, - "peer": true, - "dependencies": { - "graceful-fs": "^4.1.11", - "micromatch": "^3.1.10", - "readable-stream": "^2.0.2" - }, - "engines": { - "node": ">=0.10" - } - }, "node_modules/webpack": { "version": "4.47.0", "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.47.0.tgz", @@ -9266,17 +8868,6 @@ "color-convert": "^1.9.0" } }, - "anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "optional": true, - "peer": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, "aproba": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", @@ -9380,13 +8971,6 @@ "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.9.6.tgz", "integrity": "sha512-qEdtR2UH78yyHX/AUNfXmJTlM48XoFZKBdwi1nzkI1mJL21cmbu0cvjxjpkXJ5NENMq42H+hNs8VLJcqXLerBQ==" }, - "async-each": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.6.tgz", - "integrity": "sha512-c646jH1avxr+aVpndVMeAfYw7wAa6idufrlN3LPA4PmKS0QEGp6PIC9nwz0WQkkvBGAMEki3pFdtxaF39J9vvg==", - "optional": true, - "peer": true - }, "atob": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", @@ -9544,23 +9128,6 @@ "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==" }, - "binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "optional": true, - "peer": true - }, - "bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "optional": true, - "peer": true, - "requires": { - "file-uri-to-path": "1.0.0" - } - }, "bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -9866,62 +9433,6 @@ "supports-color": "^5.3.0" } }, - "chokidar": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", - "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", - "optional": true, - "peer": true, - "requires": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "fsevents": "~2.3.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, - "dependencies": { - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "optional": true, - "peer": true, - "requires": { - "fill-range": "^7.0.1" - } - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "optional": true, - "peer": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "optional": true, - "peer": true - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "optional": true, - "peer": true, - "requires": { - "is-number": "^7.0.0" - } - } - } - }, "chownr": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", @@ -10809,13 +10320,6 @@ } } }, - "file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "optional": true, - "peer": true - }, "fill-range": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", @@ -10922,13 +10426,6 @@ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "peer": true }, - "fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "optional": true, - "peer": true - }, "function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", @@ -10971,16 +10468,6 @@ "path-is-absolute": "^1.0.0" } }, - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "optional": true, - "peer": true, - "requires": { - "is-glob": "^4.0.1" - } - }, "globals": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", @@ -11299,16 +10786,6 @@ "hasown": "^2.0.0" } }, - "is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "optional": true, - "peer": true, - "requires": { - "binary-extensions": "^2.0.0" - } - }, "is-buffer": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", @@ -11351,23 +10828,6 @@ "is-plain-object": "^2.0.4" } }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "optional": true, - "peer": true - }, - "is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "optional": true, - "peer": true, - "requires": { - "is-extglob": "^2.1.1" - } - }, "is-number": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", @@ -11756,13 +11216,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, - "nan": { - "version": "2.18.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.18.0.tgz", - "integrity": "sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w==", - "optional": true, - "peer": true - }, "nanomatch": { "version": "1.2.13", "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", @@ -11840,13 +11293,6 @@ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.5.tgz", "integrity": "sha512-U9h1NLROZTq9uE1SNffn6WuPDg8icmi3ns4rEl/oTfIle4iLjTliCzgTsbaIFMq/Xn078/lfY/BL0GWZ+psK4Q==" }, - "normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "optional": true, - "peer": true - }, "normalize-range": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz", @@ -12040,13 +11486,6 @@ "integrity": "sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ==", "peer": true }, - "path-dirname": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", - "integrity": "sha512-ALzNPpyNq9AqXMBjeymIjFDAkAFH06mHJH/cSBHAgU0s4vfpBn6b2nf8tiRLvagKD8RbTpq2FKTBg7cl9l3c7Q==", - "optional": true, - "peer": true - }, "path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -12086,13 +11525,6 @@ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" }, - "picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "optional": true, - "peer": true - }, "pify": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", @@ -12700,16 +12132,6 @@ } } }, - "readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "optional": true, - "peer": true, - "requires": { - "picomatch": "^2.2.1" - } - }, "recast": { "version": "0.11.23", "resolved": "https://registry.npmjs.org/recast/-/recast-0.11.23.tgz", @@ -12827,13 +12249,6 @@ "resolved": "https://registry.npmjs.org/relateurl/-/relateurl-0.2.7.tgz", "integrity": "sha512-G08Dxvm4iDN3MLM0EsP62EDV9IuhXPR6blNz6Utcp7zyV3tr4HVNINt6MpaRWbxoOHT3Q7YN2P+jaHX8vUbgog==" }, - "remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha512-/hS+Y0u3aOfIETiaiirUFwDBDzmXPvO+jAfKTitUngIPzdKc6Z0LoFjM/CK5PL4C+eKwHohlHAb6H0VFfmmUsw==", - "optional": true, - "peer": true - }, "repeat-element": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.4.tgz", @@ -13721,13 +13136,6 @@ } } }, - "upath": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz", - "integrity": "sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg==", - "optional": true, - "peer": true - }, "update-browserslist-db": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.3.tgz", @@ -13866,125 +13274,6 @@ "watchpack-chokidar2": "^2.0.1" } }, - "watchpack-chokidar2": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/watchpack-chokidar2/-/watchpack-chokidar2-2.0.1.tgz", - "integrity": "sha512-nCFfBIPKr5Sh61s4LPpy1Wtfi0HE8isJ3d2Yb5/Ppw2P2B/3eVSEBjKfN0fmHJSK14+31KwMKmcrzs2GM4P0Ww==", - "optional": true, - "peer": true, - "requires": { - "chokidar": "^2.1.8" - }, - "dependencies": { - "anymatch": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", - "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", - "optional": true, - "peer": true, - "requires": { - "micromatch": "^3.1.4", - "normalize-path": "^2.1.1" - }, - "dependencies": { - "normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha512-3pKJwH184Xo/lnH6oyP1q2pMd7HcypqqmRs91/6/i2CGtWwIKGCkOOMTm/zXbgTEWHw1uNpNi/igc3ePOYHb6w==", - "optional": true, - "peer": true, - "requires": { - "remove-trailing-separator": "^1.0.1" - } - } - } - }, - "binary-extensions": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz", - "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==", - "optional": true, - "peer": true - }, - "chokidar": { - "version": "2.1.8", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", - "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==", - "optional": true, - "peer": true, - "requires": { - "anymatch": "^2.0.0", - "async-each": "^1.0.1", - "braces": "^2.3.2", - "fsevents": "^1.2.7", - "glob-parent": "^3.1.0", - "inherits": "^2.0.3", - "is-binary-path": "^1.0.0", - "is-glob": "^4.0.0", - "normalize-path": "^3.0.0", - "path-is-absolute": "^1.0.0", - "readdirp": "^2.2.1", - "upath": "^1.1.1" - } - }, - "fsevents": { - "version": "1.2.13", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", - "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", - "optional": true, - "peer": true, - "requires": { - "bindings": "^1.5.0", - "nan": "^2.12.1" - } - }, - "glob-parent": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", - "integrity": "sha512-E8Ak/2+dZY6fnzlR7+ueWvhsH1SjHr4jjss4YS/h4py44jY9MhK/VFdaZJAWDz6BbL21KeteKxFSFpq8OS5gVA==", - "optional": true, - "peer": true, - "requires": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" - }, - "dependencies": { - "is-glob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", - "integrity": "sha512-UFpDDrPgM6qpnFNI+rh/p3bUaq9hKLZN8bMUWzxmcnZVS3omf4IPK+BrewlnWjO1WmUsMYuSjKh4UJuV4+Lqmw==", - "optional": true, - "peer": true, - "requires": { - "is-extglob": "^2.1.0" - } - } - } - }, - "is-binary-path": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", - "integrity": "sha512-9fRVlXc0uCxEDj1nQzaWONSpbTfx0FmJfzHF7pwlI8DkWGoHBBea4Pg5Ky0ojwwxQmnSifgbKkI06Qv0Ljgj+Q==", - "optional": true, - "peer": true, - "requires": { - "binary-extensions": "^1.0.0" - } - }, - "readdirp": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz", - "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", - "optional": true, - "peer": true, - "requires": { - "graceful-fs": "^4.1.11", - "micromatch": "^3.1.10", - "readable-stream": "^2.0.2" - } - } - } - }, "webpack": { "version": "4.47.0", "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.47.0.tgz", From e82424f3d4ea1b2b0fb8700b6363dfa203a4ea26 Mon Sep 17 00:00:00 2001 From: Sabrina Baggett Date: Tue, 4 Nov 2025 17:06:18 -0800 Subject: [PATCH 3/6] requested changes --- ucdlib-directory/includes/api-people.php | 93 -------- .../includes/block-transformations.php | 40 ---- ucdlib-directory/includes/blocks.php | 1 - ucdlib-directory/includes/main.php | 3 - ucdlib-directory/includes/people.php | 207 ++++++++++++++++-- .../includes/research-highlights.php | 125 ----------- .../edit.js | 158 +++++-------- .../index.js | 11 +- .../src/editor/lib/plugins/profile.js | 8 +- .../ucdlib-directory-research-highlights.js | 127 ++++++++--- ...cdlib-directory-research-highlights.tpl.js | 46 +--- .../blocks/person-research-highlights.twig | 18 +- 12 files changed, 361 insertions(+), 476 deletions(-) delete mode 100644 ucdlib-directory/includes/research-highlights.php diff --git a/ucdlib-directory/includes/api-people.php b/ucdlib-directory/includes/api-people.php index 010fe5f..444b2fb 100644 --- a/ucdlib-directory/includes/api-people.php +++ b/ucdlib-directory/includes/api-people.php @@ -31,99 +31,6 @@ public function register_endpoints(){ ] ] ) ); - - register_rest_route($this->config['slug'], 'research-highlights/(?P[^/]+)', array( - 'methods' => 'GET', - 'callback' => array($this, 'epcb_research_highlights'), - 'permission_callback' => function (){return true;} - ) ); - } - - public function epcb_research_highlights($request){ - $expertId = $request['id']; - $out = []; - - $url = 'https://experts.ucdavis.edu/api/expert/' . rawurlencode($expertId); - $response = wp_remote_get($url, ['timeout' => 20]); - - if ( is_wp_error( $response ) ) { - return new WP_Error( 'rest_not_found', 'This research highlights does not exist.', array( 'status' => 404 ) ); - } - - $resp = json_decode(wp_remote_retrieve_body( $response ), true); - - $graph_unfiltered = is_array($resp) && isset($resp['@graph']) - ? $resp['@graph'] - : (isset($resp->{'@graph'}) ? $resp->{'@graph'} : []); - - $graph = array_values(array_filter($graph_unfiltered , function ($item) { - $types = is_array($item['@type']) ? $item['@type'] : [$item['@type']]; - foreach ($types as $t) { - if (is_string($t) && strcasecmp($t, 'Work') === 0) { - return true; - } - } - })); - - $favourites = array_filter($graph, function($item) { - if (!is_array($item)) { - return false; - } - - if (array_key_exists('ucdlib:favourite', $item) && $item['ucdlib:favourite'] === true) { - return true; - } - - if (!isset($item['relatedBy']) || !is_array($item['relatedBy'])) { - return false; - } - - $related = $item['relatedBy']; - - if (is_array($related) && array_key_exists('ucdlib:favourite', $related)) { - return $related['ucdlib:favourite'] === true; - } - - if (is_array($related) && array_is_list($related)) { - foreach ($related as $rel) { - if (is_array($rel) && array_key_exists('ucdlib:favourite', $rel)) { - if ($rel['ucdlib:favourite'] === true) { - return true; - } - } - } - } - return false; - }); - - if(count($favourites) === 0){ - $favourites = array_slice($graph, 0, 3); - } else { - $favourites = array_slice($favourites, 0, 3); - } - - - $out = array_values(array_map(function($item) { - return [ - 'id' => $item['@id'] ?? '', - 'type' => $item['type'] ?? [], - 'volume' => $item['volume'] ?? '', - 'author' => $item['author'] ?? [], - 'issn' => $item['ISSN'] ?? '', - 'eissn' => $item['eissn'] ?? '', - 'abstract' => $item['abstract'] ?? '', - 'title' => $item['title'] ?? '', - 'url' => $item['url'] ?? '', - 'issuedDate' => $item['issued'] ?? '', - 'status' => $item['status'] ?? '', - 'containerTitle' => $item['container-title'] ?? '', - 'publication' => $item['hasPublicationVenue']['name'] ?? '', - 'publisher' => $item['publisher'] ?? '', - 'page' => $item['page'] ?? '', - ]; - }, $favourites)); - - return rest_ensure_response( $favourites ); } // endpoint for looking up a single person diff --git a/ucdlib-directory/includes/block-transformations.php b/ucdlib-directory/includes/block-transformations.php index 93c65db..1e794f0 100644 --- a/ucdlib-directory/includes/block-transformations.php +++ b/ucdlib-directory/includes/block-transformations.php @@ -98,45 +98,6 @@ public static function setElasticSearch($attrs){ return $attrs; } -// public static function setResearchHighlights( $context ) { -// // Always return a clean array -// if ( !is_array($context) ) { -// $context = is_object($context) ? (array) $context : []; -// } - -// // Ensure siteContext exists -// if ( !isset($context['siteContext']) || !is_array($context['siteContext']) ) { -// $context['siteContext'] = []; -// } - -// // Get the current post ID -// $post_id = null; -// if ( isset($context['siteContext']['post']) && is_object($context['siteContext']['post']) ) { -// $post_id = $context['siteContext']['post']->ID ?? null; -// } -// if ( !$post_id ) $post_id = get_the_ID(); - -// // --- Read meta --- -// $raw_json = get_post_meta($post_id, 'research_highlights_formatted', true); -// $decoded = []; - -// if ( is_string($raw_json) && $raw_json !== '' ) { -// $tmp = json_decode($raw_json, true); -// if ( json_last_error() === JSON_ERROR_NONE && is_array($tmp) ) { -// $decoded = $tmp; -// } else { -// error_log("RH decode error (" . json_last_error_msg() . ") for post {$post_id}"); -// } -// } - -// // Add to siteContext -// $context['siteContext']['items'] = $decoded; -// $context['siteContext']['hide_research_highlights'] = -// (bool) get_post_meta($post_id, 'hide_research_highlights', true); - -// return $context; -// } - public static function getEsResults($attrs){ if ( !array_key_exists('elasticSearch', $attrs) || !$attrs['elasticSearch'] ) return $attrs; @@ -265,7 +226,6 @@ public static function getDirectoryResults( $attrs=[] ){ ]; $tax_query = []; $expertiseAreas = []; - $researchHighlights = []; $hideDepartments = array_key_exists('hideDepartments', $attrs) && $attrs['hideDepartments'] != 'false'; $meta_query = [ [ diff --git a/ucdlib-directory/includes/blocks.php b/ucdlib-directory/includes/blocks.php index 1c85c01..9845d30 100644 --- a/ucdlib-directory/includes/blocks.php +++ b/ucdlib-directory/includes/blocks.php @@ -75,7 +75,6 @@ public function __construct($config){ ], 'ucdlib-directory/research-highlights' => [ 'twig' => '@ucdlib-directory/blocks/person-research-highlights.twig' - // 'transform' => ['setResearchHighlights'] ] ]; diff --git a/ucdlib-directory/includes/main.php b/ucdlib-directory/includes/main.php index 47f5cf6..454dc5a 100644 --- a/ucdlib-directory/includes/main.php +++ b/ucdlib-directory/includes/main.php @@ -4,7 +4,6 @@ require_once( __DIR__ . '/additional-authors.php'); require_once( __DIR__ . '/api-filters.php' ); require_once( __DIR__ . '/areas-of-expertise.php' ); -require_once( __DIR__ . '/research-highlights.php' ); require_once( __DIR__ . '/blocks.php' ); require_once( __DIR__ . '/departments.php' ); require_once( __DIR__ . '/directory-tags.php' ); @@ -45,7 +44,6 @@ public function __construct(){ $this->serviceTypes = new UCDLibPluginDirectoryServiceTypes( $this->config ); $this->services = new UCDLibPluginDirectoryServices( $this->config ); $this->areasOfExpertise = new UCDLibPluginDirectoryAreasOfExpertise( $this->config ); - $this->researchHighlights = new UCDDirectoryResearchHighlights( $this->config ); add_action( 'admin_menu', array($this, 'add_admin_menu')); add_action( 'admin_head', array($this, 'admin_head') ); @@ -90,7 +88,6 @@ public function getBaseConfig(){ 'library' => 'library', 'directory' => 'directory-tag', 'expertise' => 'expertise-areas', - 'research-highlights' => 'research-highlights' ], 'postSlugs' => [ 'service' => $service, diff --git a/ucdlib-directory/includes/people.php b/ucdlib-directory/includes/people.php index d51fe15..5a6f66c 100644 --- a/ucdlib-directory/includes/people.php +++ b/ucdlib-directory/includes/people.php @@ -245,6 +245,12 @@ public function register_post_meta(){ 'default' => '', 'type' => 'string', ) ); + register_post_meta( $slug, 'aggie_experts_id', array( + 'show_in_rest' => true, + 'single' => true, + 'default' => '', + 'type' => 'string', + ) ); UCDLibPluginDirectoryUtils::registerContactMeta($slug); register_post_meta( $slug, 'contactAppointmentUrl', array( 'show_in_rest' => true, @@ -294,13 +300,186 @@ public function register_post_meta(){ 'default' => false, 'type' => 'boolean', ) ); - register_post_meta( $slug, 'has_research_highlights', array( - 'show_in_rest' => true, - 'single' => true, - 'default' => false, - 'type' => 'boolean', - ) ); + } + + // ensure that highlights exists + public function ensureResearchHighlightBlockExists() { + $post_type = $this->slug; + echo "\n== Directory People: Ensure Research Highlights block =="; + + if (empty($post_type)) { + echo "\n ERROR: people post type slug is empty.\n"; + exit(1); + } + + $q = new WP_Query([ + 'post_type' => $post_type, + 'post_status' => 'any', + 'posts_per_page' => -1, + 'fields' => 'ids', + 'no_found_rows' => true, + ]); + echo "\n Found {$q->post_count} {$post_type} posts."; + + // Filter out any invalid/empty IDs so we only process real posts + $valid_ids = array_filter($q->posts, function($id) { + // remove empty/zero values and ensure the post exists + return !empty($id) && get_post_status($id); + }); + + $q->posts = array_values($valid_ids); + $q->post_count = count($q->posts); + + echo "\n Processing {$q->post_count} valid {$post_type} posts."; + + if ($q->post_count === 0) { + echo "\n No valid posts found. Nothing to do.\n"; + exit(0); + } + + return $q; + + } + + // convert various truthy values to boolean true + public function rh_bool($val){ + return ($val === true || $val === 1 || $val === '1' || $val === 'true' || $val === 'on'); + } + + // build minimal block structure + public function rh_build_block($block_name, $attrs = []) { + $attrs_json = wp_json_encode((object)$attrs); + $block_comment = ''; + + return [ + 'blockName' => $block_name, + 'attrs' => $attrs, + 'innerBlocks' => [], + 'innerHTML' => $block_comment, + 'innerContent'=> [ $block_comment ], + ]; + } + + // return index of block in array, or -1 if not found + public function rh_find_block_index(array $blocks, $block_name){ + foreach ($blocks as $i => $blk) { + if (!empty($blk['blockName']) && $blk['blockName'] === $block_name) return $i; + } + return -1; + } + + // Helper function to extract attributes from post meta + public function rh_attr_from_meta($post_id, $meta_map){ + $attrs = []; + + // expertId (string) stored in attribute + if (!empty($meta_map['expertId'])) { + $eid = get_post_meta($post_id, $meta_map['expertId'], true); + if (is_string($eid) && $eid !== '') $attrs['expertId'] = $eid; + } + + // hideResearchHighlights stored in meta (boolean) + if (!empty($meta_map['hideResearchHighlights'])) { + $hide = get_post_meta($post_id, $meta_map['hideResearchHighlights'], true); + $attrs['hideResearchHighlights'] = $this->rh_bool($hide); + } + + // allow filtering of default attributes + $attrs = apply_filters('ucdlib_directory_research_highlights_default_attrs', $attrs, $post_id); + + return $attrs; + } + + public function run_add_block($q, $block_name, $insert_position, $insert_after_block, $meta_map, $dry_run){ + $added = 0; $skipped = 0; $errors = 0; + + if($q->have_posts()) { + echo "\n Scanning for missing '{$block_name}' blocks..."; + $target = $insert_after_block ? "after '{$insert_after_block}'" : $insert_position; + echo " Insertion preference: {$target}\n"; + echo " Scanning for missing '{$block_name}' blocks...\n"; + + + foreach($q->posts as $post_id){ + $title = get_the_title($post_id); + // load post + $post = get_post($post_id); + if(!$post){ + echo "\n ERROR: could not load post ID {$post_id}."; + $errors++; + continue; + } + + // parse blocks + $blocks = parse_blocks( $post->post_content ); + if (!is_array($blocks)) $blocks = []; + + + // check if research highlights block exists + $idx = $this->rh_find_block_index($blocks, $block_name); + if ( $idx >= 0 ) { + // block exists + echo "\n Block already exists for post ID {$post_id} titled '{$title}'"; + $skipped++; + continue; + } + + // build attributes from post meta + $attrs = $this->rh_attr_from_meta($post_id, $meta_map); + + // find insert position + $new_block = $this->rh_build_block( $block_name, $attrs ); + + $inserted = false; + // insert after specified block + if ( !empty($insert_after_block) ) { + // try to insert after specified block + foreach($blocks as $i => $blk) { + // look for insert after block + if ( !empty($blk['blockName']) && $blk['blockName'] === $insert_after_block ) { + array_splice( $blocks, $i + 1, 0, [ $new_block ] ); // insert after + $inserted = true; // mark as inserted + break; + } + } + } + // Fallback: insert at beginning or end + if (!$inserted) { + if ($insert_position === 'beginning') { + array_unshift($blocks, $new_block); + } else { + $blocks[] = $new_block; + } + } + + if($dry_run){ + echo "\n DRY RUN: would insert block into post ID {$post_id} titled '{$title}'."; + continue; + } + + $new_content = serialize_blocks($blocks); // serialize back to content + + $res = wp_update_post([ + 'ID' => $post_id, + 'post_content' => $new_content + ], true); // true = return WP_Error on failure + + if (is_wp_error($res)) {// error + $errors++; + echo " ERROR updating #{$post_id}: " . $res->get_error_message() . "\n"; + } else { // success + echo " Added block to post ID {$post_id} titled '{$title}'.\n"; + $added++; + } // end is_wp_error + + } // end foreach posts + } // end if have posts + + echo " Done.\n"; + echo " Added: {$added}\n"; + echo " Skipped: {$skipped}\n"; + echo " Errors: {$errors}\n"; } // get link to current user's editor profile @@ -662,17 +841,13 @@ public function expertiseAreas(){ return $this->expertiseAreas; } - protected $researchHighlights; - public function researchHighlights(){ - if( ! empty( $this->researchHighlights ) ) { - return $this->researchHighlights; - } - if( $this->meta('hide_research_highlights')) { - $this->researchHighlights = []; - } else { - $this->researchHighlights = $this->terms(['taxonomy' => 'research-highlights', 'orderby' => 'name', 'order' => 'ASC']); + // protected $aggieExpertsId; + public function aggieExpertsId(){ + if ( ! empty( $this->aggieExpertsId ) ) { + return $this->aggieExpertsId; } - return $this->researchHighlights; + $this->aggieExpertsId = get_post_meta($this->ID, 'aggie_experts_id', true); + return $this->aggieExpertsId; } protected $departmentIds; diff --git a/ucdlib-directory/includes/research-highlights.php b/ucdlib-directory/includes/research-highlights.php deleted file mode 100644 index 93a95fc..0000000 --- a/ucdlib-directory/includes/research-highlights.php +++ /dev/null @@ -1,125 +0,0 @@ -config = $config; - $this->slug = $this->config['taxSlugs']['research-highlights']; - $this->postType = $this->config['postSlugs']['person']; - - add_action( 'init', [$this, 'register_post_meta']); - - add_filter('ucdlib_directory_people_post_type', function($default){ - return $this->config['postSlugs']['person']; - }); - add_filter('ucdlib_directory_research_highlights_block_name', function($default){ - return 'ucdlib-directory/research-highlights'; - }); - add_filter('ucdlib_directory_research_highlights_meta_map', function($map){ - return [ - 'hideResearchHighlights'=> 'hide_research_highlights' - ]; - }); - add_filter('ucdlib_directory_research_highlights_insert_after', function($default){ - return 'ucdlib-directory/expertise-areas'; - }); - add_filter('ucdlib_directory_research_highlights_insert_position', function($default){ - return 'end'; - }); - add_filter('ucdlib/directory/research_highlights_default_attrs', function($attrs, $post_id){ - if (empty($attrs['expertId'])) $attrs['expertId'] = ''; - return $attrs; - }, 10, 2); - } - - // register taxonomy - public function register(){ - $people = $this->config['postSlugs']['personPlural']; - $labels = [ - 'name' => _x( 'Research Highlights', 'taxonomy general name' ), - 'singular_name' => _x( 'Research Highlight', 'taxonomy singular name' ), - 'search_items' => __( 'Search Research Highlights' ), - 'all_items' => __( 'All Research Highlights' ), - 'edit_item' => __( 'Edit Research Highlight' ), - 'update_item' => __( 'Update Research Highlight' ), - 'add_new_item' => __( 'Add New Research Highlight' ), - 'new_item_name' => __( 'New Research Highlight' ), - 'menu_name' => __( 'Research Highlights' ), - ]; - $args = [ - 'labels' => $labels, - 'description' => 'Uncontrolled list of research highlights assigned to people', - 'public' => false, - 'publicly_queryable' => false, - 'hierarchical' => false, - 'show_ui' => true, - 'show_in_nav_menus' => false, - 'show_in_rest' => true, - 'capabilities' => [ - 'manage_terms' => $this->config['capabilities']['manage_directory'], - 'edit_terms' => "edit_$people", - 'delete_terms' => $this->config['capabilities']['manage_directory'], - 'assign_terms' => "edit_$people" - ], - // 'show_admin_column' => true - ]; - - register_taxonomy( - $this->slug, - [$this->postType], - $args - ); - - } - - - // register custom metadata for this post type - public function register_post_meta() { - // IMPORTANT: use the post type, not the taxonomy slug - $post_type = $this->postType; // e.g. 'person' - - register_post_meta( $post_type, 'research_highlights_formatted', [ - 'show_in_rest' => true, - 'single' => true, - 'type' => 'string', // we'll save JSON.stringify([...]) from edit.js - 'default' => '[]', // make default consistent with sanitize - 'auth_callback'=> function() { // adjust if you need to restrict - return current_user_can('edit_posts'); - }, - 'sanitize_callback' => function($v){ - $s = (string)$v; - if ($s === '') return '[]'; - json_decode($s, true); - return json_last_error() === JSON_ERROR_NONE ? $s : '[]'; - } - ] ); - - UCDLibPluginDirectoryUtils::registerContactMeta( $post_type ); - } - - // add to plugin admin menu - public function add_to_menu(){ - $label = 'Research Highlights'; - add_submenu_page( - $this->config['slug'], - $label, - $label, - $this->config['capabilities']['manage_directory'], - 'edit-tags.php?taxonomy=' . $this->slug . '&post_type=' . $this->postType, - false - ); - } - - // expand plugin menu when on taxonomy admin page - public function expand_parent_menu($parent_file){ - if(get_current_screen()->taxonomy === $this->slug){ - $parent_file = $this->config['slug']; - } - return $parent_file; - } -} \ No newline at end of file diff --git a/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/edit.js b/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/edit.js index 902c33c..07941f6 100644 --- a/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/edit.js +++ b/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/edit.js @@ -1,119 +1,65 @@ import { html, SelectUtils } from "@ucd-lib/brand-theme-editor/lib/utils"; -import { useBlockProps} from '@wordpress/block-editor'; -import { PluginDocumentSettingPanel } from '@wordpress/editor'; -import { PanelBody, TextControl, Button, Notice, Modal } from '@wordpress/components'; -import { Fragment, useState, useCallback, useEffect } from '@wordpress/element'; -import apiFetch from '@wordpress/api-fetch'; - -export default ( props ) => { - const { attributes, setAttributes } = props; +import { useBlockProps, InspectorControls } from '@wordpress/block-editor'; +import { PanelBody, TextControl, Button } from '@wordpress/components'; +import { Fragment, useState } from '@wordpress/element'; +import { useDispatch } from '@wordpress/data'; +export default () => { const blockProps = useBlockProps(); - const [ isOpen, setOpen ] = useState( false ); - const openModal = () => setOpen( true ); - const closeModal = () => setOpen( false ); - const [query, setQuery] = useState(''); - const [error, setError] = useState(''); - const [searchedId, setSearchedId] = useState(''); - - const meta = SelectUtils.editedPostAttribute('meta'); - const hideResearchHighlights = meta.hide_research_highlights ? meta.hide_research_highlights : false; + const { editPost } = useDispatch('core/editor'); - useEffect(() => { - setAttributes({ hideResearchHighlights }); - }, [hideResearchHighlights, setAttributes]); + const rawMeta = SelectUtils.editedPostAttribute('meta') || {}; + const expertId = rawMeta.aggie_experts_id || ''; + const hideResearchHighlights = !!rawMeta.hide_research_highlights; + + const [query, setQuery] = useState(expertId); + const saveExpertId = async () => { + const q = (query || '').trim(); + await editPost({ meta: { ...rawMeta, aggie_experts_id: q } }); + }; - useEffect(() => { - if (query.trim() === '') { - setAttributes({ expertId: '' }); - setSearchedId(''); - setError(''); - } - }, [query, setAttributes]); - - const fetchHighlights = useCallback(async () => { - const q = query.trim(); + const clearExpertId = async () => { + setQuery(''); + await editPost({ meta: { ...rawMeta, aggie_experts_id: '' } }); + }; - if (!q) { - setAttributes({ expertId: '' }); - setSearchedId(''); - setError(''); - return; - } - try { - setError(''); - const path = `ucdlib-directory/research-highlights/${encodeURIComponent(query)}`; - const data = await apiFetch({ path }); - if (Array.isArray(data) && data.length > 0) { - setAttributes({ expertId: q }); - setSearchedId(q); - } else { - setAttributes({ expertId: '' }); - setSearchedId(''); - setError(`No results found for Expert ID: ${q}`); - } - } catch (err) { - setAttributes({ expertId: '' }); - setSearchedId(''); - setError(`API request failed${err?.message ? `: ${err.message}` : ''}`); - } - }, [query, setAttributes]); + return html` + <${Fragment}> + <${InspectorControls}> + <${PanelBody} title="Research Highlights" initialOpen=${true}> + <${TextControl} + value=${query} + label="Expert Record ID" + onChange=${setQuery} + placeholder="Enter Expert ID..." + /> - const clearAll = useCallback(() => { - setQuery(''); - setAttributes({ expertId: '' }); - setSearchedId(''); - setError(''); - }, [setAttributes]); +
+ <${Button} variant="primary" onClick=${saveExpertId}>Save Expert ID + <${Button} variant="secondary" onClick=${clearExpertId}>Clear +
- return html` - <${Fragment}> - <${PluginDocumentSettingPanel} - name="ucdlib-directory-research-highlights" - className="ucdlib-directory-research-highlights" - icon=${html``} - title="Research Highlights"> - <${PanelBody} initialOpen=${ true }> - <${TextControl} - value=${ query } - label="Expert Record ID" - onChange=${ ( value ) => setQuery( value ) } - placeholder="Search Expert ID..." - /> - - <${Button} - variant="primary" - onClick=${ fetchHighlights } - style=${{ marginBottom: '.5em', marginTop: '.5em' }} - >Search Expert ID - - <${Button} variant="secondary" onClick=${clearAll} isDestructive=${false}> - Clear - + ${ expertId && html`

Saved Expert ID (meta): ${expertId}

` } + + - ${ searchedId !== '' && html`

Showing results for Expert ID: ${ searchedId }

`} - ${ error && html`

No Research Highlights found.

` } - - -
- ${!hideResearchHighlights && html` -

Research Highlights

-
-
-
- ${searchedId? html`Aggie Experts Research Highlights for ${searchedId}`:html`Please enter an Expert ID to load Research Highlights.`} -
+
+ ${ !hideResearchHighlights && html` +

Research Highlights

+
+
+
+ ${ expertId + ? html`Aggie Experts Research Highlights for ${expertId}` + : html`Please enter an Expert ID to load Research Highlights.` } +
+
+
+ `}
- ${isOpen && html` - <${Modal} title="Editing Your Research Highlights" onRequestClose=${ closeModal }> -
To add or edit your Research Highlights, please update your Expert Record in the Aggie Experts system.
- - `} -
- `} -
- ` -} \ No newline at end of file + + `; +}; diff --git a/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/index.js b/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/index.js index 98ea4f4..64b976f 100644 --- a/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/index.js +++ b/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/index.js @@ -13,16 +13,7 @@ const settings = { "html": false, "customClassName": false }, - attributes: { - expertId: { - "type": "string", - "default": "" - }, - hideResearchHighlights: { - "type": "boolean", - "default": false - } - }, + attributes: {}, edit: Edit }; diff --git a/ucdlib-directory/src/editor/lib/plugins/profile.js b/ucdlib-directory/src/editor/lib/plugins/profile.js index 32dde84..6f7794e 100644 --- a/ucdlib-directory/src/editor/lib/plugins/profile.js +++ b/ucdlib-directory/src/editor/lib/plugins/profile.js @@ -18,10 +18,10 @@ const Edit = () => { const hideLibraries = meta.hide_libraries ? true : false; const hideDirectoryTags = meta.hide_tags ? true : false; const hideExpertiseAreas = meta.hide_expertise_areas ? true : false; - const hideResearchHiglights = meta.hide_research_highlights ? true : false; + const hideResearchHighlights = meta.hide_research_highlights ? true : false; const hideBio = meta.hide_bio ? true : false; const pastEmployee = meta.pastEmployee | false; - const { editPost } = useDispatch( 'core/editor', [ hidePronouns, hideLibraries, hideDirectoryTags, hideExpertiseAreas, hideResearchHiglights, hideBio, pastEmployee ] ); + const { editPost } = useDispatch( 'core/editor', [ hidePronouns, hideLibraries, hideDirectoryTags, hideExpertiseAreas, hideResearchHighlights, hideBio, pastEmployee ] ); return html` @@ -63,8 +63,8 @@ const Edit = () => { /> <${ToggleControl} label="Hide Research Highlights" - checked=${hideResearchHiglights} - onChange=${() => editPost({meta: { hide_research_highlights: !hideResearchHiglights}})} + checked=${hideResearchHighlights} + onChange=${() => editPost({meta: { hide_research_highlights: !hideResearchHighlights}})} /> diff --git a/ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.js b/ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.js index d5f58e8..9ca324f 100644 --- a/ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.js +++ b/ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.js @@ -1,7 +1,7 @@ import { LitElement } from 'lit'; -import { render, styles } from './ucdlib-directory-research-highlights.tpl.js'; +import { render } from './ucdlib-directory-research-highlights.tpl.js'; -/* +/** @classdesc Element to display research highlights for a directory profile */ @@ -10,20 +10,27 @@ export default class UcdlibDirectoryResearchHighlights extends LitElement { return { expertId: { type: String, attribute: 'expert-id' }, res: { type: Array }, - dataLazy: { type: Boolean, attribute: 'data-lazy', reflect: true } + dataLazy: { type: Boolean, attribute: 'data-lazy', reflect: true }, + loading: { type: Boolean, state: true }, + error: { type: String, state: true } }; } - - static get styles() { return styles(); } - + constructor() { super(); this.render = render.bind(this); this.res = []; + this.loading = false; + this.error = ''; this._loadedOnce = false; } - /* + createRenderRoot() { + return this; + } + + + /** * @description LitElement lifecycle called when element is added to DOM * @returns {void} */ @@ -34,7 +41,7 @@ export default class UcdlibDirectoryResearchHighlights extends LitElement { } } - /* + /** * @description Fetch research highlights data from API * @returns {void} */ @@ -43,27 +50,35 @@ export default class UcdlibDirectoryResearchHighlights extends LitElement { if (!this.expertId) return; this._loadedOnce = true; + this.loading = true; + this.error = ''; + this.res = []; try { - const response = await fetch( - `/wp-json/ucdlib-directory/research-highlights/${encodeURIComponent(this.expertId)}` - ); + let url = 'https://experts.ucdavis.edu/api/expert/' + this.expertId; + const response = await fetch(url, { headers: { Accept: 'application/json' }}); if (response.ok) { - const data = await response.json(); + const raw = await response.text(); + const data = JSON.parse(raw); this.res = this.formatResults(data); } else { - console.warn('Error fetching research highlights:', response.statusText); + console.warn('Research highlight requested does not exist:', response.statusText); } } catch (error) { - console.warn('Error fetching research highlights:', error); + this.error = 'Network error while fetching research highlights. Please try again later.'; this._loadedOnce = false; + console.warn(this.error); + } finally { + this.loading = false; } + + this.requestUpdate(); } - /* - * @description Set up IntersectionObserver to lazy load data when element is visible - * @returns {void} + /** + * @description Set up IntersectionObserver to lazy load data when element is visible + * @returns {void} */ observeVisibility() { // Fallback for browsers that do not support IntersectionObserver @@ -86,29 +101,75 @@ export default class UcdlibDirectoryResearchHighlights extends LitElement { observer.observe(this); } - /* + /** * @description Format raw data from API into display-friendly format * @param {Array} data - Raw research highlights data from API * @returns {Array} Formatted research highlights */ formatResults(data) { if (!data) return []; - return data.map(item => ({ - id: item.id || '', - title: item.title || '(untitled)', - url: item.url || '', - status: item.status || '', - publication: item['publication'] || item['container-title'] || '', - volume: item.volume || '', - page: item.page || '', - type: this.formatType(item.type), - issuedDate: this.formatDate(item.issuedDate ? item.issuedDate : ''), - author: this.formatAuthors(item.author), - abstract: item.abstract || '' + + let resp = data; + + // assumes resp is a JS object (from JSON.parse) + const graphUnfiltered = Array.isArray(resp?.['@graph']) + ? resp['@graph'] + : (Array.isArray(resp?.['@graph']) ? resp['@graph'] : (resp?.['@graph'] || [])); + + // Filter: keep only items whose @type includes "Work" + const graph = (graphUnfiltered || []).filter(item => { + const types = Array.isArray(item?.['@type']) ? item['@type'] : [item?.['@type']]; + return types.some(t => typeof t === 'string' && t.toLowerCase() === 'work'); + }); + + // Filter: keep only "favourite" works + let favourites = graph.filter(item => { + if (!item || typeof item !== 'object') return false; + + // direct favourite + if (item['ucdlib:favourite'] === true) return true; + + const related = item.relatedBy; + if (!Array.isArray(related) && typeof related !== 'object') return false; + + // single object with ucdlib:favourite + if (related && related['ucdlib:favourite'] === true) return true; + + // array of relations + if (Array.isArray(related)) { + for (const rel of related) { + if (rel && rel['ucdlib:favourite'] === true) return true; + } + } + + return false; + }); + + // default to first 3 works if no favourites + if (favourites.length === 0) { + favourites = graph.slice(0, 3); + } else { + favourites = favourites.slice(0, 3); + } + + const out = (favourites || []).map(i => ({ + id: i?.['@id'] || '', + title: i?.title || '(untitled)', + url: i?.url || '', + status: i?.status || '', + publication: i?.hasPublicationVenue?.name || i?.publication || i?.['container-title'] || '', + volume: i?.volume || '', + page: i?.page || '', + type: this.formatType(i?.type), + issuedDate: this.formatDate(i?.issued || i?.issuedDate || ''), + author: this.formatAuthors(i?.author), + abstract: i?.abstract || '' })); + + return out; } - /* + /** * @description Helper to format type into human-readable string * @param {String} type - Raw type string from API * @returns {String} Formatted type string @@ -131,7 +192,7 @@ export default class UcdlibDirectoryResearchHighlights extends LitElement { return (readableType || '') + (readableType ? ' • ' : ''); } - /* + /** * @description Helper to format date string into year * @param {String} dateStr - Raw date string from API * @returns {String} Formatted date string @@ -141,7 +202,7 @@ export default class UcdlibDirectoryResearchHighlights extends LitElement { return dateStr.split('-')[0] + ' • '; } - /* + /** * @description Helper to format authors array into string * @param {Array|Object} authors - Raw authors data from API * @returns {String} Formatted authors string diff --git a/ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.tpl.js b/ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.tpl.js index 4b55b43..93f18b0 100644 --- a/ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.tpl.js +++ b/ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.tpl.js @@ -1,47 +1,21 @@ -import { html, css } from 'lit'; -import classStyles from "@ucd-lib/theme-sass/2_base_class/_index.css.js"; -import baseStyles from "@ucd-lib/theme-sass/1_base_html/_index.css.js"; -import objectsStyles from "@ucd-lib/theme-sass/3_objects/_index.css.js"; -import componentClassesStyles from "@ucd-lib/theme-sass/4_component/_index.css.js"; -import layoutStyles from "@ucd-lib/theme-sass/5_layout/_index.css.js"; -import utilityStyles from "@ucd-lib/theme-sass/6_utility/_index.css.js"; - -export function styles() { - const elementStyles = css` - :host { display: block; } - .title { - font-weight: bold; - font-size: 1.188rem; - text-decoration: none; - } - .info { - font-size: 1rem; - } - - `; - return [ - classStyles, - baseStyles, - objectsStyles, - componentClassesStyles, - layoutStyles, - utilityStyles, - elementStyles - ]; -} +import { html } from 'lit'; export function render() { return html`

Research Highlights

- ${this.res?.length ? html` + + ${this.loading + ? html`

Loading research highlights...

` + : this.error ? html`

${this.error}

` + : this.res?.length ? html`
    ${this.res.map((r, i) => html`
  • ${r?.url - ? html`${r.title || '(untitled)'}` + ? html`${r.title || '(untitled)'}` : html`${r.title || '(untitled)'}`}
    - + ${r?.type ?? ''} ${r?.issuedDate ?? ''} ${r?.author ?? ''} @@ -53,6 +27,6 @@ export function render() { `)}
More research - ` : html`

No Research Highlights added.

`} - `; + ` : html`

No Research Highlights added.

` + }` } diff --git a/ucdlib-directory/views/blocks/person-research-highlights.twig b/ucdlib-directory/views/blocks/person-research-highlights.twig index ce1189a..5aca95b 100644 --- a/ucdlib-directory/views/blocks/person-research-highlights.twig +++ b/ucdlib-directory/views/blocks/person-research-highlights.twig @@ -1,9 +1,9 @@ -{% set hide = attributes.hideResearchHighlights == 1 or attributes.hideResearchHighlights is same as(true) %} - -{% if not hide %} - - -{% endif %} \ No newline at end of file +{% set post_id = fn('get_the_ID') %} +{% if post_id and fn('get_post_type') == 'person' %} + {% set expert_id = fn('get_post_meta', post_id, 'aggie_experts_id', true) %} + + +{% endif %} From a3392efa942eefeab493a2d33cd6637e388a1b34 Mon Sep 17 00:00:00 2001 From: Sabrina Baggett Date: Wed, 5 Nov 2025 21:58:04 -0800 Subject: [PATCH 4/6] requested changes #2 --- ucdlib-assets/src/public/package-lock.json | 99 ++++++++++- ucdlib-assets/src/public/package.json | 1 + ucdlib-directory/includes/main.php | 2 +- ucdlib-directory/includes/people.php | 154 +++++++++--------- .../edit.js | 12 +- ucdlib-directory/src/public/package-lock.json | 100 ++++++++++++ ucdlib-directory/src/public/package.json | 1 + .../ucdlib-directory-research-highlights.js | 10 +- .../blocks/person-research-highlights.twig | 12 +- 9 files changed, 289 insertions(+), 102 deletions(-) diff --git a/ucdlib-assets/src/public/package-lock.json b/ucdlib-assets/src/public/package-lock.json index ea7c70d..ed2a290 100644 --- a/ucdlib-assets/src/public/package-lock.json +++ b/ucdlib-assets/src/public/package-lock.json @@ -10,6 +10,7 @@ "license": "ISC", "dependencies": { "@ucd-lib/brand-theme": "file:../../../../ucdlib-theme-wp/src/public", + "@ucd-lib/cork-app-utils": "^6.4.1", "@ucd-lib/plugin-directory-public": "file:../../../ucdlib-directory/src/public", "@ucd-lib/plugin-locations-public": "file:../../../ucdlib-locations/src/public", "@ucd-lib/plugin-search-public": "file:../../../ucdlib-search/src/public", @@ -11735,6 +11736,7 @@ "version": "1.0.0", "license": "ISC", "dependencies": { + "@ucd-lib/cork-app-utils": "^6.4.1", "@ucd-lib/theme-elements": "^3.3.0", "lit": "^2.3.1" } @@ -18796,6 +18798,57 @@ } } }, + "node_modules/@ucd-lib/cork-app-utils": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/@ucd-lib/cork-app-utils/-/cork-app-utils-6.4.1.tgz", + "integrity": "sha512-NLS7zI0BnsX9UnAuyv7NIdN8A1rzmb81AnLf0NsZbXuIqz+uU+j5hiHjqcU8Zs6cxm6R2f+VTI/ZbKQfDUqvLQ==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^2.0.1", + "fs-extra": "^7.0.1" + }, + "bin": { + "cork-app-utils": "bin/cli.js" + } + }, + "node_modules/@ucd-lib/cork-app-utils/node_modules/fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha512-bCK/2Z4zLidyB4ReuIsvALH6w31YfAQDmXMqMx6FyfHqvBxtjC0eRumeSu4Bs3XtXwpyIywtSTrVT99BxY1f9w==", + "license": "MIT" + }, + "node_modules/@ucd-lib/cork-app-utils/node_modules/fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/@ucd-lib/cork-app-utils/node_modules/jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "license": "MIT", + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/@ucd-lib/cork-app-utils/node_modules/universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "license": "MIT", + "engines": { + "node": ">= 4.0.0" + } + }, "node_modules/@ucd-lib/plugin-directory-public": { "resolved": "../../../ucdlib-directory/src/public", "link": true @@ -21776,8 +21829,7 @@ "node_modules/graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==" }, "node_modules/has": { "version": "1.0.3", @@ -39356,9 +39408,49 @@ } } }, + "@ucd-lib/cork-app-utils": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/@ucd-lib/cork-app-utils/-/cork-app-utils-6.4.1.tgz", + "integrity": "sha512-NLS7zI0BnsX9UnAuyv7NIdN8A1rzmb81AnLf0NsZbXuIqz+uU+j5hiHjqcU8Zs6cxm6R2f+VTI/ZbKQfDUqvLQ==", + "requires": { + "fast-deep-equal": "^2.0.1", + "fs-extra": "^7.0.1" + }, + "dependencies": { + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha512-bCK/2Z4zLidyB4ReuIsvALH6w31YfAQDmXMqMx6FyfHqvBxtjC0eRumeSu4Bs3XtXwpyIywtSTrVT99BxY1f9w==" + }, + "fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" + } + } + }, "@ucd-lib/plugin-directory-public": { "version": "file:../../../ucdlib-directory/src/public", "requires": { + "@ucd-lib/cork-app-utils": "^6.4.1", "@ucd-lib/theme-elements": "^3.3.0", "lit": "^2.3.1" }, @@ -45232,8 +45324,7 @@ "graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==" }, "has": { "version": "1.0.3", diff --git a/ucdlib-assets/src/public/package.json b/ucdlib-assets/src/public/package.json index 83f68e6..9ea0bdb 100644 --- a/ucdlib-assets/src/public/package.json +++ b/ucdlib-assets/src/public/package.json @@ -13,6 +13,7 @@ "private": true, "dependencies": { "@ucd-lib/brand-theme": "file:../../../../ucdlib-theme-wp/src/public", + "@ucd-lib/cork-app-utils": "^6.4.1", "@ucd-lib/plugin-directory-public": "file:../../../ucdlib-directory/src/public", "@ucd-lib/plugin-locations-public": "file:../../../ucdlib-locations/src/public", "@ucd-lib/plugin-search-public": "file:../../../ucdlib-search/src/public", diff --git a/ucdlib-directory/includes/main.php b/ucdlib-directory/includes/main.php index 454dc5a..3e7a43a 100644 --- a/ucdlib-directory/includes/main.php +++ b/ucdlib-directory/includes/main.php @@ -27,7 +27,6 @@ class UCDLibPluginDirectory { public $serviceTypes; public $services; public $areasOfExpertise; - public $researchHighlights; public function __construct(){ $this->slug = "ucdlib-directory"; @@ -45,6 +44,7 @@ public function __construct(){ $this->services = new UCDLibPluginDirectoryServices( $this->config ); $this->areasOfExpertise = new UCDLibPluginDirectoryAreasOfExpertise( $this->config ); + $GLOBALS['UCDLibPluginDirectory'] = $this; add_action( 'admin_menu', array($this, 'add_admin_menu')); add_action( 'admin_head', array($this, 'admin_head') ); add_filter( 'timber/locations', array($this, 'add_timber_locations') ); diff --git a/ucdlib-directory/includes/people.php b/ucdlib-directory/includes/people.php index 5a6f66c..e863a87 100644 --- a/ucdlib-directory/includes/people.php +++ b/ucdlib-directory/includes/people.php @@ -302,14 +302,29 @@ public function register_post_meta(){ ) ); } - // ensure that highlights exists - public function ensureResearchHighlightBlockExists() { + // ensure block exists + public function ensureBlockExists($block_name, $dry_run=false, $inCLI=false, $insert_after_block='') { $post_type = $this->slug; - echo "\n== Directory People: Ensure Research Highlights block =="; + if($inCLI) echo "\n== Directory People: Ensure {$block_name} block =="; + + if (empty($block_name)) { + if($inCLI) echo "\n Block Name is empty, please give a valid blockname'."; + else { + $blockNameMessage = wp_json_encode("Block Name is empty, please give a valid blockname"); + echo ""; + } + return; + } if (empty($post_type)) { - echo "\n ERROR: people post type slug is empty.\n"; - exit(1); + if($inCLI) { + echo "\n ERROR: people post type slug is empty.\n"; + } + else { + $postWarnMessage = wp_json_encode("{$post_type} slug is empty."); + echo ""; + } + return; } $q = new WP_Query([ @@ -320,7 +335,7 @@ public function ensureResearchHighlightBlockExists() { 'no_found_rows' => true, ]); - echo "\n Found {$q->post_count} {$post_type} posts."; + if($inCLI) echo "\n Found {$q->post_count} {$post_type} posts."; // Filter out any invalid/empty IDs so we only process real posts $valid_ids = array_filter($q->posts, function($id) { @@ -331,74 +346,32 @@ public function ensureResearchHighlightBlockExists() { $q->posts = array_values($valid_ids); $q->post_count = count($q->posts); - echo "\n Processing {$q->post_count} valid {$post_type} posts."; + if($inCLI) echo "\n Processing {$q->post_count} valid {$post_type} posts."; if ($q->post_count === 0) { - echo "\n No valid posts found. Nothing to do.\n"; - exit(0); - } - - return $q; - - } - - // convert various truthy values to boolean true - public function rh_bool($val){ - return ($val === true || $val === 1 || $val === '1' || $val === 'true' || $val === 'on'); - } - - // build minimal block structure - public function rh_build_block($block_name, $attrs = []) { - $attrs_json = wp_json_encode((object)$attrs); - $block_comment = ''; - - return [ - 'blockName' => $block_name, - 'attrs' => $attrs, - 'innerBlocks' => [], - 'innerHTML' => $block_comment, - 'innerContent'=> [ $block_comment ], - ]; - } - - // return index of block in array, or -1 if not found - public function rh_find_block_index(array $blocks, $block_name){ - foreach ($blocks as $i => $blk) { - if (!empty($blk['blockName']) && $blk['blockName'] === $block_name) return $i; - } - return -1; - } - - // Helper function to extract attributes from post meta - public function rh_attr_from_meta($post_id, $meta_map){ - $attrs = []; - - // expertId (string) stored in attribute - if (!empty($meta_map['expertId'])) { - $eid = get_post_meta($post_id, $meta_map['expertId'], true); - if (is_string($eid) && $eid !== '') $attrs['expertId'] = $eid; - } - - // hideResearchHighlights stored in meta (boolean) - if (!empty($meta_map['hideResearchHighlights'])) { - $hide = get_post_meta($post_id, $meta_map['hideResearchHighlights'], true); - $attrs['hideResearchHighlights'] = $this->rh_bool($hide); + if($inCLI) { + echo "\n No valid posts found. Nothing to do.\n"; + } else { + $invalidPostMessage = wp_json_encode("{$post_type} has no valid posts found. Nothing to do."); + echo ""; + } + return; } - // allow filtering of default attributes - $attrs = apply_filters('ucdlib_directory_research_highlights_default_attrs', $attrs, $post_id); - - return $attrs; + $this->run_add_block($q, $block_name, $dry_run, $inCLI, $insert_after_block); + } - public function run_add_block($q, $block_name, $insert_position, $insert_after_block, $meta_map, $dry_run){ + public function run_add_block($q, $block_name, $dry_run=true, $inCLI=false, $insert_after_block=''){ + + $insert_position = 'end'; $added = 0; $skipped = 0; $errors = 0; - if($q->have_posts()) { - echo "\n Scanning for missing '{$block_name}' blocks..."; + if(!empty($q->posts)) { + if($inCLI) echo "\n Scanning for missing '{$block_name}' blocks..."; $target = $insert_after_block ? "after '{$insert_after_block}'" : $insert_position; - echo " Insertion preference: {$target}\n"; - echo " Scanning for missing '{$block_name}' blocks...\n"; + if($inCLI) echo " Insertion preference: {$target}\n"; + if($inCLI) echo " Scanning for missing '{$block_name}' blocks...\n"; foreach($q->posts as $post_id){ @@ -406,7 +379,7 @@ public function run_add_block($q, $block_name, $insert_position, $insert_after_b // load post $post = get_post($post_id); if(!$post){ - echo "\n ERROR: could not load post ID {$post_id}."; + if($inCLI) echo "\n ERROR: could not load post ID {$post_id}."; $errors++; continue; } @@ -417,19 +390,35 @@ public function run_add_block($q, $block_name, $insert_position, $insert_after_b // check if research highlights block exists - $idx = $this->rh_find_block_index($blocks, $block_name); + $idx = -1; + + foreach ($blocks as $i => $blk) { + if (!empty($blk['blockName']) && $blk['blockName'] === $block_name){ + $idx = $i; + } + } + if ( $idx >= 0 ) { // block exists - echo "\n Block already exists for post ID {$post_id} titled '{$title}'"; + if($inCLI) echo "\n Block already exists for post ID {$post_id} titled '{$title}'"; $skipped++; continue; } - // build attributes from post meta - $attrs = $this->rh_attr_from_meta($post_id, $meta_map); + $attrs = []; + + // Creating new Block + $attrs_json = wp_json_encode((object)$attrs); - // find insert position - $new_block = $this->rh_build_block( $block_name, $attrs ); + $block_comment = ''; + + $new_block = [ + 'blockName' => $block_name, + 'attrs' => $attrs, + 'innerBlocks' => [], + 'innerHTML' => $block_comment, + 'innerContent'=> [ $block_comment ], + ]; $inserted = false; // insert after specified block @@ -454,7 +443,7 @@ public function run_add_block($q, $block_name, $insert_position, $insert_after_b } if($dry_run){ - echo "\n DRY RUN: would insert block into post ID {$post_id} titled '{$title}'."; + if($inCLI) echo "\n DRY RUN: would insert block into post ID {$post_id} titled '{$title}'."; continue; } @@ -467,19 +456,24 @@ public function run_add_block($q, $block_name, $insert_position, $insert_after_b if (is_wp_error($res)) {// error $errors++; - echo " ERROR updating #{$post_id}: " . $res->get_error_message() . "\n"; + if($inCLI) echo " ERROR updating #{$post_id}: " . $res->get_error_message() . "\n"; } else { // success - echo " Added block to post ID {$post_id} titled '{$title}'.\n"; + if($inCLI) echo " Added block to post ID {$post_id} titled '{$title}'.\n"; $added++; } // end is_wp_error } // end foreach posts } // end if have posts - echo " Done.\n"; - echo " Added: {$added}\n"; - echo " Skipped: {$skipped}\n"; - echo " Errors: {$errors}\n"; + if($inCLI) { + echo " Done.\n"; + echo " Added: {$added}\n"; + echo " Skipped: {$skipped}\n"; + echo " Errors: {$errors}\n"; + }else if (!$inCLI && $errors) { + $errorMessage = wp_json_encode("Errors: {$errors} posts had trouble adding {$block_name}."); + echo ""; + } } // get link to current user's editor profile @@ -841,7 +835,7 @@ public function expertiseAreas(){ return $this->expertiseAreas; } - // protected $aggieExpertsId; + protected $aggieExpertsId; public function aggieExpertsId(){ if ( ! empty( $this->aggieExpertsId ) ) { return $this->aggieExpertsId; diff --git a/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/edit.js b/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/edit.js index 07941f6..9fbe1a7 100644 --- a/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/edit.js +++ b/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/edit.js @@ -1,7 +1,7 @@ import { html, SelectUtils } from "@ucd-lib/brand-theme-editor/lib/utils"; import { useBlockProps, InspectorControls } from '@wordpress/block-editor'; import { PanelBody, TextControl, Button } from '@wordpress/components'; -import { Fragment, useState } from '@wordpress/element'; +import { Fragment } from '@wordpress/element'; import { useDispatch } from '@wordpress/data'; export default () => { @@ -13,15 +13,12 @@ export default () => { const expertId = rawMeta.aggie_experts_id || ''; const hideResearchHighlights = !!rawMeta.hide_research_highlights; - const [query, setQuery] = useState(expertId); - - const saveExpertId = async () => { + const saveExpertId = async (query) => { const q = (query || '').trim(); await editPost({ meta: { ...rawMeta, aggie_experts_id: q } }); }; const clearExpertId = async () => { - setQuery(''); await editPost({ meta: { ...rawMeta, aggie_experts_id: '' } }); }; @@ -31,14 +28,13 @@ export default () => { <${InspectorControls}> <${PanelBody} title="Research Highlights" initialOpen=${true}> <${TextControl} - value=${query} + value=${rawMeta.aggie_experts_id || ''} label="Expert Record ID" - onChange=${setQuery} + onChange=${(value) => saveExpertId(value)} placeholder="Enter Expert ID..." />
- <${Button} variant="primary" onClick=${saveExpertId}>Save Expert ID <${Button} variant="secondary" onClick=${clearExpertId}>Clear
diff --git a/ucdlib-directory/src/public/package-lock.json b/ucdlib-directory/src/public/package-lock.json index 8f87040..468bf9e 100644 --- a/ucdlib-directory/src/public/package-lock.json +++ b/ucdlib-directory/src/public/package-lock.json @@ -9,6 +9,7 @@ "version": "1.0.0", "license": "ISC", "dependencies": { + "@ucd-lib/cork-app-utils": "^6.4.1", "@ucd-lib/theme-elements": "^3.3.0", "lit": "^2.3.1" } @@ -36,6 +37,19 @@ "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.2.tgz", "integrity": "sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg==" }, + "node_modules/@ucd-lib/cork-app-utils": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/@ucd-lib/cork-app-utils/-/cork-app-utils-6.4.1.tgz", + "integrity": "sha512-NLS7zI0BnsX9UnAuyv7NIdN8A1rzmb81AnLf0NsZbXuIqz+uU+j5hiHjqcU8Zs6cxm6R2f+VTI/ZbKQfDUqvLQ==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^2.0.1", + "fs-extra": "^7.0.1" + }, + "bin": { + "cork-app-utils": "bin/cli.js" + } + }, "node_modules/@ucd-lib/theme-elements": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/@ucd-lib/theme-elements/-/theme-elements-3.3.0.tgz", @@ -137,6 +151,32 @@ "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-2.4.0.tgz", "integrity": "sha512-Be9tbQMZds4a3C6xTmz68NlMfeONA//4dOavl/1rNw50E+/QO0KVpbcU0PcaW0nsQxurXls9ZocqFxk8R2mWEA==" }, + "node_modules/fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha512-bCK/2Z4zLidyB4ReuIsvALH6w31YfAQDmXMqMx6FyfHqvBxtjC0eRumeSu4Bs3XtXwpyIywtSTrVT99BxY1f9w==", + "license": "MIT" + }, + "node_modules/fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "license": "ISC" + }, "node_modules/ip-address": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-7.1.0.tgz", @@ -166,6 +206,15 @@ "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz", "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==" }, + "node_modules/jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "license": "MIT", + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, "node_modules/lit": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/lit/-/lit-2.3.1.tgz", @@ -225,6 +274,15 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz", "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==" + }, + "node_modules/universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "license": "MIT", + "engines": { + "node": ">= 4.0.0" + } } }, "dependencies": { @@ -251,6 +309,15 @@ "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.2.tgz", "integrity": "sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg==" }, + "@ucd-lib/cork-app-utils": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/@ucd-lib/cork-app-utils/-/cork-app-utils-6.4.1.tgz", + "integrity": "sha512-NLS7zI0BnsX9UnAuyv7NIdN8A1rzmb81AnLf0NsZbXuIqz+uU+j5hiHjqcU8Zs6cxm6R2f+VTI/ZbKQfDUqvLQ==", + "requires": { + "fast-deep-equal": "^2.0.1", + "fs-extra": "^7.0.1" + } + }, "@ucd-lib/theme-elements": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/@ucd-lib/theme-elements/-/theme-elements-3.3.0.tgz", @@ -355,6 +422,26 @@ "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-2.4.0.tgz", "integrity": "sha512-Be9tbQMZds4a3C6xTmz68NlMfeONA//4dOavl/1rNw50E+/QO0KVpbcU0PcaW0nsQxurXls9ZocqFxk8R2mWEA==" }, + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha512-bCK/2Z4zLidyB4ReuIsvALH6w31YfAQDmXMqMx6FyfHqvBxtjC0eRumeSu4Bs3XtXwpyIywtSTrVT99BxY1f9w==" + }, + "fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, "ip-address": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-7.1.0.tgz", @@ -378,6 +465,14 @@ "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz", "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==" }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "requires": { + "graceful-fs": "^4.1.6" + } + }, "lit": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/lit/-/lit-2.3.1.tgz", @@ -424,6 +519,11 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz", "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==" + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" } } } diff --git a/ucdlib-directory/src/public/package.json b/ucdlib-directory/src/public/package.json index 72accc6..f87581d 100644 --- a/ucdlib-directory/src/public/package.json +++ b/ucdlib-directory/src/public/package.json @@ -7,6 +7,7 @@ "author": "", "license": "ISC", "dependencies": { + "@ucd-lib/cork-app-utils": "^6.4.1", "@ucd-lib/theme-elements": "^3.3.0", "lit": "^2.3.1" } diff --git a/ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.js b/ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.js index 9ca324f..e128fdd 100644 --- a/ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.js +++ b/ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.js @@ -1,11 +1,14 @@ import { LitElement } from 'lit'; import { render } from './ucdlib-directory-research-highlights.tpl.js'; +import { Mixin, LitCorkUtils } from '@ucd-lib/cork-app-utils'; +import { MainDomElement } from "@ucd-lib/theme-elements/utils/mixins/main-dom-element.js"; /** @classdesc Element to display research highlights for a directory profile */ -export default class UcdlibDirectoryResearchHighlights extends LitElement { +export default class UcdlibDirectoryResearchHighlights extends Mixin(LitElement) + .with(LitCorkUtils, MainDomElement) { static get properties() { return { expertId: { type: String, attribute: 'expert-id' }, @@ -63,10 +66,11 @@ export default class UcdlibDirectoryResearchHighlights extends LitElement { const data = JSON.parse(raw); this.res = this.formatResults(data); } else { - console.warn('Research highlight requested does not exist:', response.statusText); + this.error = `Research highlight ${this.expertId} requested does not exist`; + console.warn(this.error); } } catch (error) { - this.error = 'Network error while fetching research highlights. Please try again later.'; + this.error = 'Error while fetching results for Research Highlights.'; this._loadedOnce = false; console.warn(this.error); } finally { diff --git a/ucdlib-directory/views/blocks/person-research-highlights.twig b/ucdlib-directory/views/blocks/person-research-highlights.twig index 5aca95b..7b69ac3 100644 --- a/ucdlib-directory/views/blocks/person-research-highlights.twig +++ b/ucdlib-directory/views/blocks/person-research-highlights.twig @@ -1,9 +1,9 @@ -{% set post_id = fn('get_the_ID') %} -{% if post_id and fn('get_post_type') == 'person' %} - {% set expert_id = fn('get_post_meta', post_id, 'aggie_experts_id', true) %} - - + {% endif %} From 9148dd0a5ebf9e85bb3f4dbe2cb425b0e89c4e35 Mon Sep 17 00:00:00 2001 From: Sabrina Baggett Date: Fri, 7 Nov 2025 12:21:47 -0800 Subject: [PATCH 5/6] requested changes #3 --- ucdlib-directory/includes/main.php | 2 +- ucdlib-directory/includes/people.php | 40 ++++----- .../edit.js | 5 +- .../index.js | 1 + .../ucdlib-directory-research-highlights.js | 81 +++++++++---------- ...cdlib-directory-research-highlights.tpl.js | 11 +-- ucdlib-directory/ucdlib-directory.php | 3 +- 7 files changed, 66 insertions(+), 77 deletions(-) diff --git a/ucdlib-directory/includes/main.php b/ucdlib-directory/includes/main.php index 3e7a43a..68fa6cc 100644 --- a/ucdlib-directory/includes/main.php +++ b/ucdlib-directory/includes/main.php @@ -44,7 +44,7 @@ public function __construct(){ $this->services = new UCDLibPluginDirectoryServices( $this->config ); $this->areasOfExpertise = new UCDLibPluginDirectoryAreasOfExpertise( $this->config ); - $GLOBALS['UCDLibPluginDirectory'] = $this; + add_action( 'admin_menu', array($this, 'add_admin_menu')); add_action( 'admin_head', array($this, 'admin_head') ); add_filter( 'timber/locations', array($this, 'add_timber_locations') ); diff --git a/ucdlib-directory/includes/people.php b/ucdlib-directory/includes/people.php index e863a87..c52042e 100644 --- a/ucdlib-directory/includes/people.php +++ b/ucdlib-directory/includes/people.php @@ -301,18 +301,25 @@ public function register_post_meta(){ 'type' => 'boolean', ) ); } + + public function getResearchHighlightDefaults() { + return [ + 'block_name' => 'ucdlib-directory/research-highlights', + 'insert_after_block' => 'ucdlib-directory/expertise-areas' + ]; + } // ensure block exists - public function ensureBlockExists($block_name, $dry_run=false, $inCLI=false, $insert_after_block='') { + public function ensureBlockExists($dry_run=false, $inCLI=false, $insert_after_block='', $block_name='') { + $defaults = $this->getResearchHighlightDefaults(); + $block_name = $block_name ? $block_name : $defaults['block_name']; + $insert_after_block = $insert_after_block ? $insert_after_block : $defaults['insert_after_block']; + $post_type = $this->slug; if($inCLI) echo "\n== Directory People: Ensure {$block_name} block =="; if (empty($block_name)) { if($inCLI) echo "\n Block Name is empty, please give a valid blockname'."; - else { - $blockNameMessage = wp_json_encode("Block Name is empty, please give a valid blockname"); - echo ""; - } return; } @@ -320,16 +327,12 @@ public function ensureBlockExists($block_name, $dry_run=false, $inCLI=false, $in if($inCLI) { echo "\n ERROR: people post type slug is empty.\n"; } - else { - $postWarnMessage = wp_json_encode("{$post_type} slug is empty."); - echo ""; - } return; } $q = new WP_Query([ 'post_type' => $post_type, - 'post_status' => 'any', + 'post_status' => 'publish', 'posts_per_page' => -1, 'fields' => 'ids', 'no_found_rows' => true, @@ -337,13 +340,6 @@ public function ensureBlockExists($block_name, $dry_run=false, $inCLI=false, $in if($inCLI) echo "\n Found {$q->post_count} {$post_type} posts."; - // Filter out any invalid/empty IDs so we only process real posts - $valid_ids = array_filter($q->posts, function($id) { - // remove empty/zero values and ensure the post exists - return !empty($id) && get_post_status($id); - }); - - $q->posts = array_values($valid_ids); $q->post_count = count($q->posts); if($inCLI) echo "\n Processing {$q->post_count} valid {$post_type} posts."; @@ -351,9 +347,6 @@ public function ensureBlockExists($block_name, $dry_run=false, $inCLI=false, $in if ($q->post_count === 0) { if($inCLI) { echo "\n No valid posts found. Nothing to do.\n"; - } else { - $invalidPostMessage = wp_json_encode("{$post_type} has no valid posts found. Nothing to do."); - echo ""; } return; } @@ -375,7 +368,7 @@ public function run_add_block($q, $block_name, $dry_run=true, $inCLI=false, $ins foreach($q->posts as $post_id){ - $title = get_the_title($post_id); + // load post $post = get_post($post_id); if(!$post){ @@ -384,6 +377,8 @@ public function run_add_block($q, $block_name, $dry_run=true, $inCLI=false, $ins continue; } + $title = $post->post_title; + // parse blocks $blocks = parse_blocks( $post->post_content ); if (!is_array($blocks)) $blocks = []; @@ -470,9 +465,6 @@ public function run_add_block($q, $block_name, $dry_run=true, $inCLI=false, $ins echo " Added: {$added}\n"; echo " Skipped: {$skipped}\n"; echo " Errors: {$errors}\n"; - }else if (!$inCLI && $errors) { - $errorMessage = wp_json_encode("Errors: {$errors} posts had trouble adding {$block_name}."); - echo ""; } } diff --git a/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/edit.js b/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/edit.js index 9fbe1a7..589a0c1 100644 --- a/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/edit.js +++ b/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/edit.js @@ -15,11 +15,11 @@ export default () => { const saveExpertId = async (query) => { const q = (query || '').trim(); - await editPost({ meta: { ...rawMeta, aggie_experts_id: q } }); + await editPost({ meta: { aggie_experts_id: q } }); }; const clearExpertId = async () => { - await editPost({ meta: { ...rawMeta, aggie_experts_id: '' } }); + await editPost({ meta: { aggie_experts_id: '' } }); }; @@ -38,7 +38,6 @@ export default () => { <${Button} variant="secondary" onClick=${clearExpertId}>Clear
- ${ expertId && html`

Saved Expert ID (meta): ${expertId}

` } diff --git a/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/index.js b/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/index.js index 64b976f..c625dbc 100644 --- a/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/index.js +++ b/ucdlib-directory/src/editor/lib/blocks/ucdlib-directory-research-highlights/index.js @@ -5,6 +5,7 @@ const name = 'ucdlib-directory/research-highlights'; const settings = { api_version: 2, title: "Research Highlights", + parent: [], description: "Highlight your research works", icon: UCDIcons.renderPublic('fa-flask'), category: 'ucdlib-directory', diff --git a/ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.js b/ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.js index e128fdd..7013ebc 100644 --- a/ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.js +++ b/ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.js @@ -1,6 +1,6 @@ import { LitElement } from 'lit'; import { render } from './ucdlib-directory-research-highlights.tpl.js'; -import { Mixin, LitCorkUtils } from '@ucd-lib/cork-app-utils'; +import { Mixin } from '@ucd-lib/cork-app-utils'; import { MainDomElement } from "@ucd-lib/theme-elements/utils/mixins/main-dom-element.js"; /** @@ -8,7 +8,7 @@ import { MainDomElement } from "@ucd-lib/theme-elements/utils/mixins/main-dom-el directory profile */ export default class UcdlibDirectoryResearchHighlights extends Mixin(LitElement) - .with(LitCorkUtils, MainDomElement) { + .with(MainDomElement) { static get properties() { return { expertId: { type: String, attribute: 'expert-id' }, @@ -28,10 +28,6 @@ export default class UcdlibDirectoryResearchHighlights extends Mixin(LitElement) this._loadedOnce = false; } - createRenderRoot() { - return this; - } - /** * @description LitElement lifecycle called when element is added to DOM @@ -57,18 +53,47 @@ export default class UcdlibDirectoryResearchHighlights extends Mixin(LitElement) this.error = ''; this.res = []; + + try { - let url = 'https://experts.ucdavis.edu/api/expert/' + this.expertId; - const response = await fetch(url, { headers: { Accept: 'application/json' }}); + const url = `https://experts.ucdavis.edu/api/expert/${this.expertId}`; + + const body = { + "is-visible": true, + "expert": { "include": false }, + "grants": { "include": false }, + "works": { + "include": true, + "page": 1, + "size": 3, + "includeMisformatted": false, + "favouriteWorksFirst": true + } + }; + const response = await fetch(url, { + method: 'POST', // POST is used only to send filter data — not to add/modify anything + headers: { + 'Accept': 'application/json', + 'Content-Type': 'application/json' + }, + body: JSON.stringify(body) + }); if (response.ok) { const raw = await response.text(); const data = JSON.parse(raw); this.res = this.formatResults(data); } else { - this.error = `Research highlight ${this.expertId} requested does not exist`; + if (response.status === 404) { + this.error = `Expert ${this.expertId} not found (404).`; + } else if (response.status === 500) { + this.error = `Server error while fetching expert ${this.expertId}.`; + } else { + this.error = `Failed with status ${response.status}: ${response.statusText}`; + } console.warn(this.error); } + } catch (error) { this.error = 'Error while fetching results for Research Highlights.'; this._loadedOnce = false; @@ -126,47 +151,17 @@ export default class UcdlibDirectoryResearchHighlights extends Mixin(LitElement) return types.some(t => typeof t === 'string' && t.toLowerCase() === 'work'); }); - // Filter: keep only "favourite" works - let favourites = graph.filter(item => { - if (!item || typeof item !== 'object') return false; - - // direct favourite - if (item['ucdlib:favourite'] === true) return true; - - const related = item.relatedBy; - if (!Array.isArray(related) && typeof related !== 'object') return false; - - // single object with ucdlib:favourite - if (related && related['ucdlib:favourite'] === true) return true; - - // array of relations - if (Array.isArray(related)) { - for (const rel of related) { - if (rel && rel['ucdlib:favourite'] === true) return true; - } - } - - return false; - }); - - // default to first 3 works if no favourites - if (favourites.length === 0) { - favourites = graph.slice(0, 3); - } else { - favourites = favourites.slice(0, 3); - } - - const out = (favourites || []).map(i => ({ + const out = (graph || []).map(i => ({ id: i?.['@id'] || '', title: i?.title || '(untitled)', - url: i?.url || '', + url: i?.url || `https://experts.ucdavis.edu/work/${i?.['@id']}`, status: i?.status || '', publication: i?.hasPublicationVenue?.name || i?.publication || i?.['container-title'] || '', volume: i?.volume || '', page: i?.page || '', type: this.formatType(i?.type), issuedDate: this.formatDate(i?.issued || i?.issuedDate || ''), - author: this.formatAuthors(i?.author), + author: i?.author ? this.formatAuthors(i?.author): '', abstract: i?.abstract || '' })); @@ -202,7 +197,7 @@ export default class UcdlibDirectoryResearchHighlights extends Mixin(LitElement) * @returns {String} Formatted date string */ formatDate(dateStr) { - if (!dateStr) return ''; + if (!dateStr || dateStr == '') return ''; return dateStr.split('-')[0] + ' • '; } diff --git a/ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.tpl.js b/ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.tpl.js index 93f18b0..8ef4bfa 100644 --- a/ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.tpl.js +++ b/ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.tpl.js @@ -6,16 +6,16 @@ export function render() { ${this.loading ? html`

Loading research highlights...

` - : this.error ? html`

${this.error}

` + : this.error ? html`

${this.error}

` : this.res?.length ? html` -
    +
      ${this.res.map((r, i) => html`
    • ${r?.url - ? html`${r.title || '(untitled)'}` + ? html`${r.title || '(untitled)'}` : html`${r.title || '(untitled)'}`}
      - + ${r?.type ?? ''} ${r?.issuedDate ?? ''} ${r?.author ?? ''} @@ -26,7 +26,8 @@ export function render() {
    • `)}
    - More research +
    + More research ` : html`

    No Research Highlights added.

    ` }` } diff --git a/ucdlib-directory/ucdlib-directory.php b/ucdlib-directory/ucdlib-directory.php index b5517b0..9d1c4dd 100644 --- a/ucdlib-directory/ucdlib-directory.php +++ b/ucdlib-directory/ucdlib-directory.php @@ -21,5 +21,6 @@ function() { require_once $composer_autoload; } require_once( __DIR__ . '/includes/main.php' ); - new UCDLibPluginDirectory(); + $UCDLibPluginDirectory = new UCDLibPluginDirectory(); + $GLOBALS['UCDLibPluginDirectory'] = $UCDLibPluginDirectory; } From c0cb4903b4d5e755d59b5f8ec245089e4c7bba67 Mon Sep 17 00:00:00 2001 From: Sabrina Baggett Date: Wed, 12 Nov 2025 14:26:16 -0800 Subject: [PATCH 6/6] requested changes #4 --- ucdlib-assets/includes/forminator.php | 6 +++++ ucdlib-directory/includes/people.php | 16 +++++------- ...cdlib-directory-research-highlights.tpl.js | 25 +++++++++++++++++++ 3 files changed, 37 insertions(+), 10 deletions(-) diff --git a/ucdlib-assets/includes/forminator.php b/ucdlib-assets/includes/forminator.php index ba66129..c3b8201 100644 --- a/ucdlib-assets/includes/forminator.php +++ b/ucdlib-assets/includes/forminator.php @@ -6,10 +6,16 @@ public function __construct(){ add_filter('forminator_field_markup', [$this, 'styleRadioAndCheck'], 10, 3); add_filter('forminator_field_markup', [$this, 'styleConsentBox'], 10, 3); add_filter('forminator_render_button_markup', [$this, 'styleSubmitButton'], 10, 2); + add_filter('forminator_custom_form_before_render', [$this, 'removeOAFundForm']); add_action( 'admin_init', [$this, 'forceNoStyling']); add_action( 'admin_footer', [$this, 'removeStyleOptions']); } + // public removeOAFundForm(){ + // $TARGET_FORM_ID="27502"; + + // } + public function removeStyleOptions(){ if( isset( $_GET['page'] ) ){ if( $_GET['page'] == 'forminator-cform-wizard' ){ diff --git a/ucdlib-directory/includes/people.php b/ucdlib-directory/includes/people.php index c52042e..c169006 100644 --- a/ucdlib-directory/includes/people.php +++ b/ucdlib-directory/includes/people.php @@ -302,19 +302,15 @@ public function register_post_meta(){ ) ); } - public function getResearchHighlightDefaults() { - return [ - 'block_name' => 'ucdlib-directory/research-highlights', - 'insert_after_block' => 'ucdlib-directory/expertise-areas' - ]; + public function ensureResearchHighlightBlockExists($dry_run, $inCLI) { + $block_name='ucdlib-directory/research-highlights'; + $insert_after_block='ucdlib-directory/expertise-areas'; + + $this->ensureBlockExists($dry_run, $inCLI, $insert_after_block, $block_name); } // ensure block exists public function ensureBlockExists($dry_run=false, $inCLI=false, $insert_after_block='', $block_name='') { - $defaults = $this->getResearchHighlightDefaults(); - $block_name = $block_name ? $block_name : $defaults['block_name']; - $insert_after_block = $insert_after_block ? $insert_after_block : $defaults['insert_after_block']; - $post_type = $this->slug; if($inCLI) echo "\n== Directory People: Ensure {$block_name} block =="; @@ -355,7 +351,7 @@ public function ensureBlockExists($dry_run=false, $inCLI=false, $insert_after_bl } - public function run_add_block($q, $block_name, $dry_run=true, $inCLI=false, $insert_after_block=''){ + public function run_add_block($q, $block_name, $dry_run=false, $inCLI=false, $insert_after_block=''){ $insert_position = 'end'; $added = 0; $skipped = 0; $errors = 0; diff --git a/ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.tpl.js b/ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.tpl.js index 8ef4bfa..d1d1e55 100644 --- a/ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.tpl.js +++ b/ucdlib-directory/src/public/src/elements/ucdlib-directory-research-highlights.tpl.js @@ -2,6 +2,31 @@ import { html } from 'lit'; export function render() { return html` +

    Research Highlights

    ${this.loading