web-manager 3.1.11 → 3.1.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.
package/README.md CHANGED
@@ -212,6 +212,8 @@ The Web Manager .utilities() API wraps some useful functions such as getting and
212
212
  ```html
213
213
  <script type="text/javascript">
214
214
  console.log('--- Exploring the .utilities() API ---');
215
+
216
+ // .get() and .set()
215
217
  Manager.ready(function() {
216
218
  var object = {
217
219
  key1: 'val1',
@@ -234,6 +236,12 @@ The Web Manager .utilities() API wraps some useful functions such as getting and
234
236
  console.log('Root object (final)', Manager.utilities().get(object)); // Get whole object a final time
235
237
 
236
238
  });
239
+
240
+ // .clipboardCopy()
241
+ Manager.utilities().clipboardCopy('I am copied to the clipboard!')
242
+
243
+ // .escapeHTML()
244
+ Manager.utilities().escapeHTML('<strong>This will will NOT render as bold!</strong>')
237
245
  </script>
238
246
  ```
239
247
 
package/index.js CHANGED
@@ -164,14 +164,12 @@ function Manager() {
164
164
  }
165
165
 
166
166
  Manager.prototype.setEventListeners = function() {
167
- // console.log('--------setEventListeners');
167
+ var This = this;
168
+
168
169
  if (!utilities.get(this, 'properties.page.status.eventHandlersSet', false)) {
169
170
  this.properties.page.status.eventHandlersSet = true;
170
- var This = this;
171
- // document.addEventListener('click', function (event) {
171
+
172
172
  document.addEventListener('click', function (event) {
173
- // console.log('Clicked.... NEW');
174
- // This.log('Clicked', event.target);
175
173
  // auth events
176
174
  if (event.target.matches('.auth-signin-email-btn')) {
177
175
  This.auth().signIn('email');
@@ -187,16 +185,18 @@ function Manager() {
187
185
  This.auth().forgot();
188
186
  } else if (event.target.matches('#prechat-btn')) {
189
187
  load_tawk(This, This.properties.options);
190
- }
191
-
192
- // push notification events
193
- if (event.target.matches('.auth-subscribe-notifications-btn')) {
194
- //@@@NOTIFICATIONS
188
+ } else if (event.target.matches('.auth-subscribe-notifications-btn')) {
195
189
  This.notifications().subscribe()
196
- .catch(function (e) {
197
- console.error(e);
198
- });
199
190
  }
191
+
192
+ // Autorequest
193
+ if (!This._notificationRequested && This.properties.options.pushNotifications.autoRequest) {
194
+ This._notificationRequested = true;
195
+
196
+ setTimeout(function () {
197
+ This.notifications().subscribe()
198
+ }, This.properties.options.pushNotifications.autoRequest * 1000);
199
+ }
200
200
 
201
201
  }, false);
202
202
  }
@@ -1221,16 +1221,6 @@ function Manager() {
1221
1221
  //@@@NOTIFICATIONS
1222
1222
  // _setupTokenRefreshHandler(This);
1223
1223
 
1224
- if (options_user.pushNotifications.autoRequest) {
1225
- setTimeout(function () {
1226
- //@@@NOTIFICATIONS
1227
- This.notifications().subscribe()
1228
- .catch(function (e) {
1229
- console.error(e);
1230
- });
1231
- }, options_user.pushNotifications.autoRequest * 1000);
1232
- }
1233
-
1234
1224
  try {
1235
1225
  // Normally, notifications are not displayed when user is ON PAGE but we will display it here anyway
1236
1226
  firebase.messaging().onMessage(function (payload) {
package/lib/utilities.js CHANGED
@@ -75,7 +75,7 @@ Utilities.clipboardCopy = function (input) {
75
75
 
76
76
  // Escape HTML
77
77
  Utilities.escapeHTML = function (string) {
78
- return string.replace(/[&<>"'`=\/]/g, function (s) {
78
+ return (string || '').replace(/[&<>"'`=\/]/g, function (s) {
79
79
  return htmlEscapeMap[s];
80
80
  });
81
81
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-manager",
3
- "version": "3.1.11",
3
+ "version": "3.1.13",
4
4
  "description": "Easily access important variables such as the query string, current domain, and current page in a single object.",
5
5
  "main": "index.js",
6
6
  "scripts": {