releasebird-javascript-sdk 1.0.4 → 1.0.6

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.
@@ -122,7 +122,6 @@ export default class RbirdSessionManager {
122
122
  state.identify.hash = hash;
123
123
  }
124
124
  window.localStorage.setItem("rbird_state", JSON.stringify(state));
125
- console.log(`${CONTENT_URL}/widget?apiKey=${RbirdSessionManager.getInstance().apiKey}&tab=HOME&people=${response.peopleId}&hash=${hash}&ai=${self.anonymousIdentifier}`);
126
125
  RbirdWebsiteWidget.getInstance().updateIframe(`${CONTENT_URL}/widget?apiKey=${RbirdSessionManager.getInstance().apiKey}&tab=HOME&people=${response.peopleId}&hash=${hash}&ai=${self.anonymousIdentifier}`);
127
126
  }
128
127
  } catch (exp) {
@@ -86,7 +86,9 @@ export default class RbirdWebsiteWidget {
86
86
  }
87
87
 
88
88
  if (this.isMobileDevice()) {
89
- this.hideWidgetButton.style.display = 'none';
89
+ if (this.hideWidgetButton) {
90
+ this.hideWidgetButton.style.display = 'none';
91
+ }
90
92
  this.websiteWidget.style.display = 'none';
91
93
  }
92
94
 
@@ -260,7 +262,18 @@ export default class RbirdWebsiteWidget {
260
262
  this.initButton();
261
263
  this.widgetContent = document.createElement("div");
262
264
  this.widgetContent.className = "cta__modal";
263
- this.updateIframe(`${CONTENT_URL}/widget?apiKey=${RbirdSessionManager.getInstance().apiKey}&tab=HOME&ai=${RbirdSessionManager.getInstance().anonymousIdentifier}`);
265
+
266
+ let state = window.localStorage.getItem('rbird_state');
267
+ if (state) {
268
+ const jsonState = JSON.parse(state);
269
+ if (jsonState.people) {
270
+ this.updateIframe(`${CONTENT_URL}/widget?apiKey=${RbirdSessionManager.getInstance().apiKey}&tab=HOME&people=${jsonState.people}&hash=${hash}&ai=${self.anonymousIdentifier}`);
271
+ } else {
272
+ this.updateIframe(`${CONTENT_URL}/widget?apiKey=${RbirdSessionManager.getInstance().apiKey}&tab=HOME&ai=${RbirdSessionManager.getInstance().anonymousIdentifier}`);
273
+ }
274
+ } else {
275
+ this.updateIframe(`${CONTENT_URL}/widget?apiKey=${RbirdSessionManager.getInstance().apiKey}&tab=HOME&ai=${RbirdSessionManager.getInstance().anonymousIdentifier}`);
276
+ }
264
277
  document.body.appendChild(this.widgetContent);
265
278
  window.onmessage = (e) => this.handleEvent(e, this);
266
279