@cocreate/users 1.37.2 → 1.37.4

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/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ ## [1.37.4](https://github.com/CoCreate-app/CoCreate-users/compare/v1.37.3...v1.37.4) (2024-07-05)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * checkSession send ([2b3810f](https://github.com/CoCreate-app/CoCreate-users/commit/2b3810fd31bbd1e4fbd8f7072f5e36c8b13abac4))
7
+
8
+ ## [1.37.3](https://github.com/CoCreate-app/CoCreate-users/compare/v1.37.2...v1.37.3) (2024-06-30)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * checkSession debounce function ([6229d80](https://github.com/CoCreate-app/CoCreate-users/commit/6229d8089e0a509d0c171f6e329cd3fcce495356))
14
+ * debounce check session ([2a31537](https://github.com/CoCreate-app/CoCreate-users/commit/2a315373bbebae765d91392118aee92216b6456a))
15
+
1
16
  ## [1.37.2](https://github.com/CoCreate-app/CoCreate-users/compare/v1.37.1...v1.37.2) (2024-06-23)
2
17
 
3
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/users",
3
- "version": "1.37.2",
3
+ "version": "1.37.4",
4
4
  "description": "A simple users component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "users",
package/src/client.js CHANGED
@@ -458,16 +458,24 @@ Actions.init([
458
458
  }
459
459
  ]);
460
460
 
461
- Observer.init({
462
- name: 'CoCreateElementsRemovedNodes',
463
- observe: ['addedNodes'],
464
- target: '[session]',
465
- callback: () => {
461
+ let checkSessionTimeout
462
+ function checkSession() {
463
+ clearTimeout(checkSessionTimeout);
464
+ checkSessionTimeout = setTimeout(function () {
466
465
  Crud.socket.send({
467
466
  method: 'checkSession',
468
467
  broadcast: false,
469
468
  broadcastBrowser: false
470
469
  });
470
+ }, 500);
471
+ }
472
+
473
+ Observer.init({
474
+ name: 'CoCreateUserSessionAddedNodes',
475
+ observe: ['addedNodes'],
476
+ target: '[session]',
477
+ callback: () => {
478
+ checkSession();
471
479
  }
472
480
  });
473
481
 
package/src/server.js CHANGED
@@ -147,12 +147,14 @@ class CoCreateUser {
147
147
 
148
148
  async checkSession(data) {
149
149
  try {
150
- if (!data.socket.user_id) {
151
- data.method = 'updateUserStatus'
150
+ data.method = 'updateUserStatus'
151
+
152
+ if (!data.socket.user_id)
152
153
  data.userStatus = 'off'
154
+ else
155
+ data.userStatus = 'on'
153
156
 
154
- this.wsManager.send(data)
155
- }
157
+ this.wsManager.send(data)
156
158
  } catch (error) {
157
159
  console.log('checkSession error')
158
160
  }