@cocreate/users 1.26.0 → 1.27.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.
- package/CHANGELOG.md +13 -0
- package/CoCreate.config.js +24 -24
- package/package.json +4 -4
- package/src/client.js +8 -6
- package/src/server.js +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
# [1.27.0](https://github.com/CoCreate-app/CoCreate-users/compare/v1.26.0...v1.27.0) (2023-10-09)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* socket.config items moved to socket ([2e09599](https://github.com/CoCreate-app/CoCreate-users/commit/2e0959976f83dae168d88533a71628a0d1edea76))
|
|
7
|
+
* update wsManager.broadcast to wsManager.send() ([1f0132b](https://github.com/CoCreate-app/CoCreate-users/commit/1f0132b9ef0710831bd354332f35334fe4fbf29a))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* sawait ocket.organization_id() ([177a173](https://github.com/CoCreate-app/CoCreate-users/commit/177a173f27e8e4bf09c1c1aa72c015b73622b733))
|
|
13
|
+
|
|
1
14
|
# [1.26.0](https://github.com/CoCreate-app/CoCreate-users/compare/v1.25.3...v1.26.0) (2023-09-19)
|
|
2
15
|
|
|
3
16
|
|
package/CoCreate.config.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
"organization_id": "",
|
|
3
|
-
"key": "",
|
|
4
|
-
"host": "",
|
|
5
|
-
"sources": [
|
|
6
|
-
{
|
|
7
|
-
"array": "files",
|
|
8
|
-
"object": {
|
|
9
|
-
"_id": "6012f7af86c0ba24512cca2e",
|
|
10
|
-
"name": "index.html",
|
|
11
|
-
"path": "/docs/users",
|
|
12
|
-
"pathname": "/docs/users/index.html",
|
|
13
|
-
"src": "{{./docs/index.html}}",
|
|
14
|
-
"host": [
|
|
15
|
-
"*",
|
|
16
|
-
"general.cocreate.app"
|
|
17
|
-
],
|
|
18
|
-
"directory": "users",
|
|
19
|
-
"content-type": "{{content-type}}",
|
|
20
|
-
"public": "true"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
]
|
|
24
|
-
}
|
|
1
|
+
module.exports = {
|
|
2
|
+
"organization_id": "",
|
|
3
|
+
"key": "",
|
|
4
|
+
"host": "",
|
|
5
|
+
"sources": [
|
|
6
|
+
{
|
|
7
|
+
"array": "files",
|
|
8
|
+
"object": {
|
|
9
|
+
"_id": "6012f7af86c0ba24512cca2e",
|
|
10
|
+
"name": "index.html",
|
|
11
|
+
"path": "/docs/users",
|
|
12
|
+
"pathname": "/docs/users/index.html",
|
|
13
|
+
"src": "{{./docs/index.html}}",
|
|
14
|
+
"host": [
|
|
15
|
+
"*",
|
|
16
|
+
"general.cocreate.app"
|
|
17
|
+
],
|
|
18
|
+
"directory": "users",
|
|
19
|
+
"content-type": "{{content-type}}",
|
|
20
|
+
"public": "true"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/users",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.27.0",
|
|
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",
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@cocreate/actions": "^1.11.2",
|
|
62
|
-
"@cocreate/crud-client": "^1.
|
|
62
|
+
"@cocreate/crud-client": "^1.27.0",
|
|
63
63
|
"@cocreate/element-prototype": "^1.11.2",
|
|
64
|
-
"@cocreate/elements": "^1.
|
|
64
|
+
"@cocreate/elements": "^1.22.0",
|
|
65
65
|
"@cocreate/local-storage": "^1.10.2",
|
|
66
|
-
"@cocreate/render": "^1.
|
|
66
|
+
"@cocreate/render": "^1.28.0"
|
|
67
67
|
}
|
|
68
68
|
}
|
package/src/client.js
CHANGED
|
@@ -8,6 +8,10 @@ import './index.css';
|
|
|
8
8
|
import localStorage from '@cocreate/local-storage';
|
|
9
9
|
|
|
10
10
|
const CoCreateUser = {
|
|
11
|
+
organization_id: async () => {
|
|
12
|
+
return await Crud.socket.organization_id()
|
|
13
|
+
},
|
|
14
|
+
|
|
11
15
|
init: function () {
|
|
12
16
|
this.initSocket();
|
|
13
17
|
this.initSession();
|
|
@@ -22,7 +26,6 @@ const CoCreateUser = {
|
|
|
22
26
|
let formEl = btn.closest("form");
|
|
23
27
|
if (!formEl) return;
|
|
24
28
|
|
|
25
|
-
let organization_id = Crud.socket.config.organization_id;
|
|
26
29
|
let array = formEl.getAttribute('array')
|
|
27
30
|
if (!array) {
|
|
28
31
|
for (let el of formEl) {
|
|
@@ -128,11 +131,10 @@ const CoCreateUser = {
|
|
|
128
131
|
|
|
129
132
|
signInResponse: function (data) {
|
|
130
133
|
let { success, status, message, user_id, token } = data;
|
|
131
|
-
|
|
132
134
|
if (success) {
|
|
133
|
-
localStorage.setItem('organization_id',
|
|
134
|
-
localStorage.setItem("key", Crud.socket.
|
|
135
|
-
localStorage.setItem("host", Crud.socket.
|
|
135
|
+
localStorage.setItem('organization_id', organization_id);
|
|
136
|
+
localStorage.setItem("key", Crud.socket.key);
|
|
137
|
+
localStorage.setItem("host", Crud.socket.host);
|
|
136
138
|
localStorage.setItem('user_id', user_id);
|
|
137
139
|
localStorage.setItem("token", token);
|
|
138
140
|
// document.cookie = `token=${token};path=/`;
|
|
@@ -192,7 +194,7 @@ const CoCreateUser = {
|
|
|
192
194
|
},
|
|
193
195
|
|
|
194
196
|
redirect: (data) => {
|
|
195
|
-
if (data.user_id && data.user_id !== Crud.socket.
|
|
197
|
+
if (data.user_id && data.user_id !== Crud.socket.user_id)
|
|
196
198
|
return
|
|
197
199
|
if (!data.user_id && data.clientId !== Crud.socket.clientId)
|
|
198
200
|
return
|
package/src/server.js
CHANGED
|
@@ -20,13 +20,13 @@ class CoCreateUser {
|
|
|
20
20
|
if (data.user) {
|
|
21
21
|
data.user.method = 'create.object'
|
|
22
22
|
const response = await this.crud.send(data.user)
|
|
23
|
-
this.wsManager.
|
|
23
|
+
this.wsManager.send(response);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
if (data.userKey) {
|
|
27
27
|
data.userKey.method = 'create.object'
|
|
28
28
|
const response = await this.crud.send(data.userKey)
|
|
29
|
-
this.wsManager.
|
|
29
|
+
this.wsManager.send(response);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
self.wsManager.send(data);
|
|
@@ -86,7 +86,7 @@ class CoCreateUser {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
self.wsManager.send(response)
|
|
89
|
-
self.wsManager.
|
|
89
|
+
self.wsManager.send({
|
|
90
90
|
method: 'updateUserStatus',
|
|
91
91
|
user_id: response.user_id,
|
|
92
92
|
userStatus: response.userStatus,
|
|
@@ -116,11 +116,11 @@ class CoCreateUser {
|
|
|
116
116
|
|
|
117
117
|
data.method = 'update.object'
|
|
118
118
|
this.crud.send(data).then((data) => {
|
|
119
|
-
self.wsManager.
|
|
119
|
+
self.wsManager.send({
|
|
120
120
|
method: 'updateUserStatus',
|
|
121
121
|
user_id: data.user_id,
|
|
122
122
|
userStatus: data.userStatus,
|
|
123
|
-
organization_id: data.organization_id || socket.
|
|
123
|
+
organization_id: data.organization_id || socket.organization_id
|
|
124
124
|
})
|
|
125
125
|
|
|
126
126
|
})
|