Skip to content
This repository has been archived by the owner on Jul 25, 2023. It is now read-only.

Commit

Permalink
Merge pull request #17 from eea/develop
Browse files Browse the repository at this point in the history
Add getURL helper function
  • Loading branch information
razvanMiu authored Apr 26, 2023
2 parents 4596250 + c6f1b2b commit 3c213ae
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 3 deletions.
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,22 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

### [4.2.0](https://github.com/eea/volto-widgets-view/compare/4.1.0...4.2.0) - 25 April 2023

#### :rocket: New Features

- feat(Url.js): add getURL helper function to extract URL from data object [Miu Razvan - [`9be4800`](https://github.com/eea/volto-widgets-view/commit/9be48008da2f0be69c38488130734912034dbf76)]

#### :house: Internal changes

- chore(package.json): increase version from 4.1.0 to 4.2.0 [Miu Razvan - [`c4d986d`](https://github.com/eea/volto-widgets-view/commit/c4d986db6264e0e96f8d5d3360ce68835e79863f)]

#### :hammer_and_wrench: Others

### [4.1.0](https://github.com/eea/volto-widgets-view/compare/4.0.1...4.1.0) - 27 March 2023

#### :hammer_and_wrench: Others

- Release 4.1.0 [Alin Voinea - [`d58f7f8`](https://github.com/eea/volto-widgets-view/commit/d58f7f8c64a0935173c21dbf9da927b25ebf7680)]
- test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`3771315`](https://github.com/eea/volto-widgets-view/commit/377131511ec4621834562fcba79e33b5cd237eb9)]
### [4.0.1](https://github.com/eea/volto-widgets-view/compare/4.0.0...4.0.1) - 16 November 2022

Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pipeline {
environment {
GIT_NAME = "volto-widgets-view"
NAMESPACE = "@eeacms"
SONARQUBE_TAGS = "volto.eea.europa.eu,forest.eea.europa.eu,biodiversity.europa.eu,www.eea.europa.eu-ims,climate-energy.eea.europa.eu,sustainability.eionet.europa.eu,clms.land.copernicus.eu,industry.eea.europa.eu,water.europa.eu-freshwater,demo-www.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,circularity.eea.europa.eu,prod-www.eea.europa.eu,water.europa.eu-marine,demo-kitkat.dev2aws.eea.europa.eu,climate-adapt.eea.europa.eu,climate-advisory-board.devel4cph.eea.europa.eu,climate-advisory-board.europa.eu,www.eea.europa.eu-en"
SONARQUBE_TAGS = "volto.eea.europa.eu,forest.eea.europa.eu,biodiversity.europa.eu,www.eea.europa.eu-ims,climate-energy.eea.europa.eu,sustainability.eionet.europa.eu,clms.land.copernicus.eu,industry.eea.europa.eu,water.europa.eu-freshwater,demo-www.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,circularity.eea.europa.eu,water.europa.eu-marine,climate-adapt.eea.europa.eu,climate-advisory-board.devel4cph.eea.europa.eu,climate-advisory-board.europa.eu,www.eea.europa.eu-en"
DEPENDENCIES = ""
VOLTO = ""
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-widgets-view",
"version": "4.1.0",
"version": "4.2.0",
"description": "Volto Widgets in View mode",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
20 changes: 20 additions & 0 deletions src/helpers/Url.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { flattenToAppURL, isInternalURL } from '@plone/volto/helpers';

import isString from 'lodash/isString';
import isObject from 'lodash/isObject';
import isArray from 'lodash/isArray';

/**
* Get url
* @method getURL
* @param {object} data
* @returns {string} URL string value.
*/
export const getURL = (data) => {
let url = data;
if (isObject(data) && !isArray(data) && data['@type'] === 'URL') {
url = data['value'] || data['url'] || data['href'] || '';
}
if (isString(url) && isInternalURL(url)) return flattenToAppURL(url);
return url;
};
1 change: 1 addition & 0 deletions src/helpers/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './Url';
export * from './Widget';

0 comments on commit 3c213ae

Please sign in to comment.