@hellotext/hellotext 1.0.10 → 1.1.0

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.
Files changed (2) hide show
  1. package/lib/hellotext.js +5 -5
  2. package/package.json +1 -1
package/lib/hellotext.js CHANGED
@@ -14,9 +14,9 @@ class Hellotext {
14
14
  const urlSearchParams = new URLSearchParams(window.location.search)
15
15
  const session = urlSearchParams.get('hello_session') || getCookieValue('hello_session')
16
16
 
17
- if (session) {
17
+ if (session && session !== "undefined" && session !== "null") {
18
18
  this.#_session = session
19
- this.setSessionCookie(session)
19
+ this.#setSessionCookie()
20
20
  }
21
21
  }
22
22
 
@@ -58,7 +58,7 @@ class Hellotext {
58
58
  return this.mintAnonymousSession()
59
59
  .then(response => {
60
60
  this.#_session = response.id
61
- this.setSessionCookie(response.id)
61
+ this.#setSessionCookie()
62
62
  })
63
63
  .then(() => this.#_session)
64
64
  }
@@ -88,10 +88,10 @@ class Hellotext {
88
88
  }
89
89
  }
90
90
 
91
- static setSessionCookie(session) {
91
+ static #setSessionCookie() {
92
92
  if (this.notInitialized) { throw new NotInitializedError() }
93
93
 
94
- document.cookie = `hello_session=${session}`
94
+ document.cookie = `hello_session=${this.#_session}`
95
95
  }
96
96
 
97
97
  static get notInitialized() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hellotext/hellotext",
3
- "version": "1.0.10",
3
+ "version": "1.1.0",
4
4
  "description": "Hellotext javascript client",
5
5
  "main": "index.js",
6
6
  "author": "Hellotext",