@knowlearning/agents 0.9.11 → 0.9.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,18 @@
1
1
  const AUTH_HOST = 'https://auth.knowlearning.systems'
2
2
 
3
+ if (window.location.pathname.startsWith('/auth/')) {
4
+ const [state, token] = window.location.pathname.slice(6).split('/')
5
+ const origin = localStorage.getItem(state)
6
+ if (origin) {
7
+ localStorage.setItem('token', token)
8
+ window.location.href = origin
9
+ }
10
+ }
11
+
3
12
  function login() {
4
13
  const provider = 'google'
5
14
  const state = Math.random().toString(36).substring(2)
6
- console.log('SETTING localStorage "state"', state, window.location)
7
- localStorage.setItem('state', state)
15
+ localStorage.setItem(state, window.location.href)
8
16
 
9
17
  window.location.href = `${AUTH_HOST}/${provider}/${state}/${encodeURIComponent(window.location.href)}`
10
18
  }
@@ -16,7 +24,6 @@ function logout() {
16
24
  }
17
25
 
18
26
  async function getToken() {
19
- // Browser tokens are 1 time use
20
27
  const token = localStorage.getItem('token')
21
28
  localStorage.removeItem('token')
22
29
  return token
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowlearning/agents",
3
- "version": "0.9.11",
3
+ "version": "0.9.13",
4
4
  "description": "API for embedding applications in KnowLearning systems.",
5
5
  "main": "node.js",
6
6
  "browser": "browser.js",
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <span v-if="state">{{value}}</span>
2
+ <span v-if="state">{{value ? value : placeholder }}</span>
3
3
  <span v-else>loading...</span>
4
4
  </template>
5
5
 
@@ -11,6 +11,10 @@
11
11
  path: {
12
12
  type: Array,
13
13
  default: []
14
+ },
15
+ placeholder: {
16
+ type: String,
17
+ default: ''
14
18
  }
15
19
  },
16
20
  data() {