diff --git a/README.md b/README.md
index e9ec2da..87405d2 100644
--- a/README.md
+++ b/README.md
@@ -1,12 +1,21 @@
### This is a __pre-release__: you can help us make it better.
+### Current version 0.0.5
+- refactored: user, view, records, facets, ui
+- added user.email
+- added view.interfaceLanguage
+- user, view, records, facets returns a promise
+- removed Primo.explore.session.id
+
+
+
Watch my [EPUG-UKI AGM 2017](https://youtu.be/0IV4e94qroo?t=27m6s) presentation to get an idea of what it is and what it can do.
# Why do we need a Domain Object Model?
A domain object model according to [Tim Howard](https://www.amazon.com/Smalltalk-Developers-Guide-VisualWorks-diskette/dp/013442526X) is a logical container of domain information. You might assume that a model is present in every component and that is kind of true. When you examine a component you get a long list of context(component) specific information and there is no obvious way to access the most common(session, user, record, facet) information from within this component. And if you use an newUI service Ex Libris does not garentee that this service will still be present in the next newUI release.
-I'm not saying that we need an [SDK](https://en.wikipedia.org/wiki/Software_development_kit) but we definitely need something that will withstand the test of time and maybe even is AngularJS agnostic. Currently the newUI is written using AngularJS 1 but plans are in place to upgrade to a future AngularJS and when this happens everybody who has written custom newUI code has to rewrite it for that AngularJS version.
+I'm not saying that we need an [SDK](https://en.wikipedia.org/wiki/Software_development_kit) but we definitely need something that will withstand the test of time and maybe even is AngularJS agnostic. Currently the newUI is written using AngularJS 1 but plans are in place to upgrade to a future AngularJS and when this happens everybody who has written custom newUI code has to rewrite it for that AngularJS version.
TODO:write more documentation
@@ -42,7 +51,7 @@ angular.reloadWithDebugInfo();
//When screen is reloaded
//Get a pointer to AngularJs and angularLoad
var appInjector = angular.injector(['ng','angularLoad'])
-//Get a reference to angularLoad
+//Get a reference to angularLoad
var angularLoad = appInjector.get('angularLoad');
//Load the script;
angularLoad.loadScript('https://npmcdn.com/primo-explore-dom/js/primo-explore-dom.js').then(function(){
@@ -50,15 +59,15 @@ angularLoad.loadScript('https://npmcdn.com/primo-explore-dom/js/primo-explore-do
});
//activate explorer ui
-Primo.ui.toggle();
+Primo.explore.ui.toggle();
//Print the VID
-Primo.explore.session.view.code
+Primo.view.then(v => console.log(v.code));
```
# Quick links
- [General](#general)
-- [Session](#session)
+- [User](#user)
- [Components](#components)
- [Records](#records)
- [Facets](#facets)
@@ -81,36 +90,40 @@ For now it is not possible to access the $scope and $ctrl without the debug info
```js
Primo.isPrimoAvailable()
```
-# Session
-## Getting the session id (only available when logged in)
+## Get the library version
```js
- Primo.explore.session.id
-```
+ Primo.version
+```
+
+# User
+```Primo.user``` returns a promise
+
## user
### Get user ID
```js
- Primo.explore.session.user.id
+ Primo.user.then(user => console.log(user.id));
```
### Get user name
```js
- Primo.explore.session.user.name
+ Primo.user.then(user => console.log(user.name));
```
### Get user email
```js
- Primo.explore.session.user.email
+ Primo.user.then(user => console.log(user.email));
```
### Is user logged in
```js
- Primo.explore.session.user.isLoggedIn()
+ Primo.user.then(user => console.log(user.isLoggedIn()));
```
### is user on campus
```js
- Primo.explore.session.user.isOnCampus()
+ Primo.user.then(user => console.log(user.isOnCampus()));
```
## view
+```Primo.view``` returns a promise
### Get VID
```js
- Primo.explore.session.view.code
+ Primo.view.then(view => console.log(view.code));
```
### Get institution code
```js
@@ -118,17 +131,53 @@ For now it is not possible to access the $scope and $ctrl without the debug info
```
### Get institution name
```js
- Primo.explore.session.view.institution.name
+ Primo.view.then(view => console.log(view.institution.name));
```
### Get interface language
```js
- Primo.explore.session.view.interfaceLanguage
+ Primo.view.then(view => console.log(view.interfaceLanguage));
```
## ip
### Get IP address of your Primo session
```js
- Primo.explore.session.ip.address
+ Primo.view.then(view => console.log(view.ip.address));
+```
+
+# Records
+```Primo.records``` returns a promise
+This is a pointer to the new UI result set
+## Getting access to all records
+```js
+ Primo.records.then(records => console.log(records));
+```
+### Mapping all recordid's into a list
+```js
+ Primo.records.then(records => console.log(records.map((m) => m.pnx.control.recordid[0])));
+```
+### This is just a glimpse of what can be done.
+
+# Facets
+```Primo.facets``` returns a promise
+This is a pointer to the new UI facet set
+## Getting access to all facets
+```js
+ Primo.facets.then(facets => console.log(facets));
+```
+## Examining a facet
+### Getting the facet name
+```js
+ Primo.facets.then(facets => console.log(facets[0].name));
+```
+### Getting facet count
+```js
+ Primo.facets.then(facets => console.log(facets[0].count));
```
+### Getting facet values
+```js
+ Primo.facets.then(facets => console.log(facets[0].values));
+```
+### This is just a glimpse of what can be done.
+
# Components
## Getting available components
The components list changes over time. Some components are only available in certain situations
@@ -170,39 +219,14 @@ The components list changes over time. Some components are only available in cer
primIcons[0].blink()
```
-# Records
-## Getting access to all records
-```js
- Primo.explore.records
-```
-### Mapping all recordid's into a list
-```js
- Primo.explore.records.map((m) => m.pnx.control.recordid[0])
-```
+# Helper
+__TODO:__ write documentation
-# Facets
-## Getting access to all facets
-```js
- Primo.explore.facets
-```
-## Examining a facet
-### Getting the facet name
-```js
- Primo.explore.facets[0].name
-```
-### Getting facet count
-```js
- Primo.explore.facets[0].count
-```
-### Getting facet values
-```js
- Primo.explore.facets[0].values
-```
# UI
-TODO: Should this go into its own repo?
+
### Activate the UI
```js
- Primo.ui.toggle()
+ Primo.expose.ui.toggle()
```
![PRIMO Domain Object Model UI](./img/primo-explore-dom_ui.gif "PRIMO Domain Object Model UI")
diff --git a/js/custom.js b/js/custom.js
index 5e62b2f..1b7257b 100644
--- a/js/custom.js
+++ b/js/custom.js
@@ -7157,15 +7157,6 @@ var Primo = function () {
});
});
}
-
- //Do not use will be removed. Here just for testing.
- //TODO: remove
-
- }, {
- key: 'helper',
- get: function get() {
- return _helper2.default;
- }
}]);
return Primo;
@@ -7226,6 +7217,11 @@ var Explore = function () {
}
return this._ui;
}
+ }, {
+ key: 'helper',
+ get: function get() {
+ return _helper2.default;
+ }
}]);
return Explore;
diff --git a/js/primo.js b/js/primo.js
index 14cd895..337cefa 100644
--- a/js/primo.js
+++ b/js/primo.js
@@ -85,11 +85,4 @@ export default class Primo {
});
});
}
-
- //Do not use will be removed. Here just for testing.
- //TODO: remove
- static get helper(){
- return Helper;
- }
-
}
diff --git a/js/primo/explore.js b/js/primo/explore.js
index 24df099..5df3b8a 100644
--- a/js/primo/explore.js
+++ b/js/primo/explore.js
@@ -4,7 +4,7 @@ import Ui from './explore/ui'
//this is proxy class
export default class Explore {
- static get components(){
+ static get components() {
let c = new Components();
Helper.componentNames.forEach((selector) => {
c.add(selector);
@@ -21,4 +21,8 @@ export default class Explore {
}
return this._ui;
}
+
+ static get helper() {
+ return Helper;
+ }
}