@hellotext/hellotext 1.1.1 → 1.1.2

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.
@@ -129,6 +129,18 @@ describe(".on", () => {
129
129
  });
130
130
  });
131
131
 
132
+ describe("when session is stored in the cookie", function () {
133
+ beforeAll(() => {
134
+ document.cookie = `hello_session=12345`
135
+ Hellotext.initialize(123)
136
+ })
137
+
138
+ it("Assigns session from cookie", function () {
139
+ expect(Hellotext.session).toEqual("12345")
140
+ });
141
+ });
142
+
143
+
132
144
  describe(".disconnect", () => {
133
145
  const business_id = "xy76ks"
134
146
 
package/lib/hellotext.js CHANGED
@@ -137,7 +137,7 @@ class Hellotext {
137
137
  document.cookie = `hello_session=${this.#session}`
138
138
  }
139
139
 
140
- static #cookie() {
140
+ static get #cookie() {
141
141
  return document.cookie.match('(^|;)\\s*' + 'hello_session' + '\\s*=\\s*([^;]+)')?.pop()
142
142
  }
143
143
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hellotext/hellotext",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Hellotext JavaScript Client",
5
5
  "main": "index.js",
6
6
  "author": "Hellotext",