1.1.0-alpha3 • Published 5 years ago

@genesys-pgr/ui-embedded v1.1.0-alpha3

Weekly downloads
16
License
Apache-2.0
Repository
gitlab
Last release
5 years ago

Enhance your website with data from Genesys

This package allows for embedding Genesys into your website.

Explore the demo at https://genesys-pgr.p.gitlab.croptrust.org/ui-embedded/

Quickstart

Add Javascript dependencies to your page:

<script src="https://cdn.jsdelivr.net/npm/@genesys-pgr/ui-embedded@1.1.0-alpha3/dist/genesys-deps.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@genesys-pgr/ui-embedded@1.1.0-alpha3/dist/genesys-ui.js"></script>

<!-- Recommended: Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" />
<!-- Genesys UI CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@genesys-pgr/ui-embedded@1.1.0-alpha3/dist/genesys-deps.css" />

Add a container <div> to your HTML page and initialize the Genesys UI with the <script>:

<div class="container-fluid mb-5" id="genesys-container"></div>

<script type="text/javascript">
  // Embedded Genesys configuration
  const genesysConfig = {
    apiUrl: 'https://api.sandbox.genesys-pgr.org', // Genesys API server
    clientId: 'clientid@genesys', // Client ID
    clientKey: 'changeme', // Client key
    title: 'Genesys:', // HTML title prefix
    filter: { 
      institute: {  code: [ 'ETH013' ] }, // Genesys data filter
    },
    accession: {
      pdci: true, // Show PDCI
      subsets: true, // Show list of subsets
      datasets: true, // Show list of datasets
    },
    shoppingCart: {
      enabled: true, // Enable shopping cart
    },
    captchaSiteKey: '<public key for your site>', // Your hCaptcha site key
    map: {
      enabled: true, // Enable map
      baseMap: {
        url: 'https://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}/', // tile server url for the base layer
        attribution: 'Tiles &copy; Esri &mdash; Esri, DeLorme, NAVTEQ' // attribution data
      },
    }
  };

  // Show UI
  genesys.showGenesysUI(document.getElementById('genesys-container'), genesysConfig);

  // Or, to display ONLY "Collection Overview" use:
  // genesys.showOverview(document.getElementById('genesys-container'), genesysConfig);
</script>

Note: Please contact helpdesk@genesys-pgr.org to obtain API keys for use in your environment.

Configuration options

The genesysConfig argument to showGenesysUI() is a simple map of various settings you can pass to @geneesys-pgr/ui-embedded:

PropertyDefaultDescription
apiUrlhttps://api.sandbox.genesys-pgr.orgProduction Genesys API is at https://api.genesys-pgr.orgSandbox API is at https://api.sandbox.genesys-pgr.org
clientIdRequiredPlease contact helpdesk@genesys-pgr.org to obtain API keys for use in your environment.The API keys are limited to your website and will not work on a different domain.
clientSecretRequiredDitto.
filterundefinedAllows for narrowing the scope of requested accession data from Genesys API. To filter for accessions from your genebank, use: { institute: { code: ['XXX000'] } } with the FAO WIEWS Code of your genebank. Default undefined value will return all accessions.
languageenSpecify the language of the user interface.Fully supported: enPartially supported: es
titleGenesys:HTML page title prefix
accession{ ... }See Accession configuration options
shoppingCart{ ... }See Shopping cart configuration options
map{ ... }See Map configuration

Additional configuration options are described below.

Accession options

Features can be toggled by setting corresponding property on (set to true) or off (false):

PropertyDefaultDescription
subsetstrueDisplay the list of subsets on accession details page
datasetstrueDisplay the list of C&E datasets on accession details page
pdcitrueDisplay passport data completeness index (PDCI) information on accession details page

Shopping cart options

The shopping cart is disabled by default. To allow users to add accessions to the cart, access the cart and submit requests for material you must explicity enable it in your configuration:

const genesysConfig = {
  // Shopping cart enabled
  shoppingCart: {
    enabled: true,
  },
};

Note: The form to request for material includes a reCaptcha check. Valid public and private reCaptcha keys must be registered with Genesys.

PropertyDefaultDescription
enabledfalseToggle Shopping cart functionality

Map configuration

The map is disabled by default. To allow users to see map of accession collecting site on accession details page and access the map page you must explicity enable it in your configuration and provide a tile server URL and an attribution data for the base map layer:

PropertyDefaultDescription
enabledfalseToggle map functionality
height'400px'Height of the map of accessions (use a CSS expression)
baseMap{ url: ..., attribution: ... }See url and attribution below.
baseMap.urlWorld_Light_Gray_BaseTile server url for the map base layer.
baseMap.attributionTiles © ...Base layer attribution.
1.7.0-gamma

11 months ago

1.7.1

9 months ago

1.7.0

9 months ago

1.7.0-alpha3

1 year ago

1.7.0-alpha4

1 year ago

1.7.0-beta

12 months ago

1.7.0-alpha5

1 year ago

1.7.0-alpha6

10 months ago

1.7.0-alpha2

1 year ago

1.6.3

1 year ago

1.7.0-alpha1

1 year ago

1.6.2

2 years ago

1.6.1

2 years ago

1.6.1-alpha3

2 years ago

1.6.1-alpha4

2 years ago

1.6.3-alpha1

2 years ago

1.6.3-alpha2

2 years ago

1.6.1-alpha2

2 years ago

1.6.1-alpha1

2 years ago

1.6.0

2 years ago

1.5.1

2 years ago

1.5.0

3 years ago

1.5.1-alpha2

2 years ago

1.6.0-beta2

2 years ago

1.6.0-beta

2 years ago

1.5.0-alpha2

3 years ago

1.4.3

3 years ago

1.5.0-alpha1

3 years ago

1.5.0-alpha

3 years ago

1.4.2

3 years ago

1.4.1

3 years ago

1.4.1-alpha1

3 years ago

1.4.0

3 years ago

1.4.0-alpha1

3 years ago

1.4.0-alpha4

3 years ago

1.4.0-alpha2

3 years ago

1.4.0-alpha3

3 years ago

1.4.0-edge

3 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.2.0-alpha2

4 years ago

1.1.0

4 years ago

1.2.0-alpha1

4 years ago

1.1.0-alpha5

4 years ago

1.1.0-alpha4

4 years ago

1.1.0-alpha3

5 years ago

1.1.0-alpha2

5 years ago

1.1.0-alpha1

5 years ago

1.0.0

5 years ago

1.0.0-alpha13

5 years ago

1.0.0-alpha12

5 years ago

1.0.0-alpha11

5 years ago

1.0.0-alpha10

5 years ago

1.0.0-alpha9

5 years ago

1.0.0-alpha7

5 years ago

1.0.0-alpha8

5 years ago

1.0.0-alpha6

5 years ago

1.0.0-alpha5

5 years ago

1.0.0-alpha4

5 years ago

1.0.0-alpha3

5 years ago

1.0.0-alpha2

5 years ago

1.0.0-alpha1

5 years ago