@cocreate/users 1.22.8 → 1.22.10
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/.github/FUNDING.yml +3 -3
- package/.github/workflows/automated.yml +95 -95
- package/.github/workflows/manual.yml +44 -44
- package/CHANGELOG.md +1796 -1781
- package/CONTRIBUTING.md +96 -96
- package/CoCreate.config.js +26 -26
- package/LICENSE +21 -21
- package/README.md +85 -85
- package/demo/signin.html +132 -83
- package/demo/signout.html +61 -39
- package/demo/signup.html +161 -103
- package/docs/index.html +371 -134
- package/package.json +70 -70
- package/release.config.js +21 -21
- package/src/client.js +268 -268
- package/src/index.css +9 -9
- package/src/index.js +13 -13
- package/src/server.js +127 -127
- package/webpack.config.js +84 -84
package/src/client.js
CHANGED
|
@@ -1,268 +1,268 @@
|
|
|
1
|
-
/*globals CustomEvent, btoa*/
|
|
2
|
-
import crud from '@cocreate/crud-client';
|
|
3
|
-
import action from '@cocreate/actions';
|
|
4
|
-
import form from '@cocreate/form';
|
|
5
|
-
import render from '@cocreate/render';
|
|
6
|
-
import '@cocreate/element-prototype';
|
|
7
|
-
import './index.css';
|
|
8
|
-
import localStorage from '@cocreate/local-storage';
|
|
9
|
-
|
|
10
|
-
const CoCreateUser = {
|
|
11
|
-
init: function () {
|
|
12
|
-
this.initSocket();
|
|
13
|
-
this.initSession();
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
initSocket: function () {
|
|
17
|
-
const self = this;
|
|
18
|
-
crud.listen('updateUserStatus', (data) => self.updateUserStatus(data));
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
signUp: async function (btn) {
|
|
22
|
-
let formEl = btn.closest("form");
|
|
23
|
-
if (!formEl) return;
|
|
24
|
-
|
|
25
|
-
let organization_id = crud.socket.config.organization_id;
|
|
26
|
-
let collection = form.getAttribute('collection')
|
|
27
|
-
if (!collection) {
|
|
28
|
-
for (let el of formEl) {
|
|
29
|
-
collection = el.getAttribute('collection');
|
|
30
|
-
if (collection)
|
|
31
|
-
break;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
let data = form.getData(formEl, collection)
|
|
36
|
-
data['collection'] = collection
|
|
37
|
-
data.organization_id = organization_id;
|
|
38
|
-
|
|
39
|
-
if (!data.document[0]._id)
|
|
40
|
-
data.document[0]._id = crud.ObjectId();
|
|
41
|
-
|
|
42
|
-
let user = await crud.createDocument(data)
|
|
43
|
-
form.setDocumentId(formEl, user)
|
|
44
|
-
|
|
45
|
-
// const socket = crud.socket.getSockets()
|
|
46
|
-
// if (!socket[0] || !socket[0].connected || window && !window.navigator.onLine) {
|
|
47
|
-
let key = {
|
|
48
|
-
collection: 'keys',
|
|
49
|
-
document: {
|
|
50
|
-
type: "user",
|
|
51
|
-
key: user.document[0]._id,
|
|
52
|
-
roles: ['user'],
|
|
53
|
-
email: user.document.email,
|
|
54
|
-
password: user.document.password || btoa('0000'),
|
|
55
|
-
collection
|
|
56
|
-
},
|
|
57
|
-
organization_id
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
let response = await crud.createDocument(key)
|
|
61
|
-
if (response && response.document && response.document[0]) {
|
|
62
|
-
crud.socket.send('signUp', { user, userKey })
|
|
63
|
-
|
|
64
|
-
render.data({
|
|
65
|
-
selector: "[template='signUp']",
|
|
66
|
-
data: {
|
|
67
|
-
type: 'signUp',
|
|
68
|
-
message: 'Succesfully Signed Up',
|
|
69
|
-
success: true
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
document.dispatchEvent(new CustomEvent('signUp', {
|
|
74
|
-
detail: response
|
|
75
|
-
}));
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
signIn: function (btn) {
|
|
81
|
-
let form = btn.closest('form');
|
|
82
|
-
let collection = form.getAttribute('collection');
|
|
83
|
-
let query = [];
|
|
84
|
-
|
|
85
|
-
const inputs = form.querySelectorAll('input[name="email"], input[name="password"], input[name="username"]');
|
|
86
|
-
|
|
87
|
-
inputs.forEach((input) => {
|
|
88
|
-
const name = input.getAttribute('name');
|
|
89
|
-
const value = input.getValue();
|
|
90
|
-
collection = 'keys';
|
|
91
|
-
query.push({ name, value, operator: '$eq' })
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
let request = {
|
|
95
|
-
db: 'indexeddb',
|
|
96
|
-
collection,
|
|
97
|
-
filter: {
|
|
98
|
-
query
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const socket = crud.socket.getSockets()
|
|
103
|
-
if (!socket[0] || !socket[0].connected || window && !window.navigator.onLine || crud.socket.serverOrganization == false) {
|
|
104
|
-
crud.readDocument(request).then((response) => {
|
|
105
|
-
response['success'] = false
|
|
106
|
-
response['status'] = "signIn failed"
|
|
107
|
-
if (response.document && response.document[0]) {
|
|
108
|
-
response['success'] = true
|
|
109
|
-
response['status'] = "success"
|
|
110
|
-
response['user_id'] = response.document[0].key
|
|
111
|
-
this.signInResponse(response)
|
|
112
|
-
} else {
|
|
113
|
-
this.signInResponse(response)
|
|
114
|
-
}
|
|
115
|
-
})
|
|
116
|
-
} else {
|
|
117
|
-
request.broadcastBrowser = false
|
|
118
|
-
delete request.db
|
|
119
|
-
crud.socket.send('signIn', request).then((response) => {
|
|
120
|
-
this.signInResponse(response)
|
|
121
|
-
})
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
|
|
125
|
-
signInResponse: function (data) {
|
|
126
|
-
let { success, status, message, user_id, token } = data;
|
|
127
|
-
|
|
128
|
-
if (success) {
|
|
129
|
-
localStorage.setItem('organization_id', crud.socket.config.organization_id);
|
|
130
|
-
localStorage.setItem("key", crud.socket.config.key);
|
|
131
|
-
localStorage.setItem("host", crud.socket.config.host);
|
|
132
|
-
localStorage.setItem('user_id', user_id);
|
|
133
|
-
localStorage.setItem("token", token);
|
|
134
|
-
// document.cookie = `token=${token};path=/`;
|
|
135
|
-
message = "Succesful signIn";
|
|
136
|
-
document.dispatchEvent(new CustomEvent('signIn', {
|
|
137
|
-
detail: {}
|
|
138
|
-
}));
|
|
139
|
-
}
|
|
140
|
-
else
|
|
141
|
-
message = "The email or password you entered is incorrect";
|
|
142
|
-
|
|
143
|
-
render.data({
|
|
144
|
-
selector: "[template='signIn']",
|
|
145
|
-
data: {
|
|
146
|
-
type: 'signIn',
|
|
147
|
-
status,
|
|
148
|
-
message,
|
|
149
|
-
success
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
},
|
|
153
|
-
|
|
154
|
-
signOut: (btn) => {
|
|
155
|
-
self = this;
|
|
156
|
-
localStorage.removeItem("user_id");
|
|
157
|
-
localStorage.removeItem("token");
|
|
158
|
-
|
|
159
|
-
// let allCookies = document.cookie.split(';');
|
|
160
|
-
|
|
161
|
-
// for (var i = 0; i < allCookies.length; i++)
|
|
162
|
-
// document.cookie = allCookies[i] + "=;expires=" +
|
|
163
|
-
// new Date(0).toUTCString();
|
|
164
|
-
|
|
165
|
-
render.data({
|
|
166
|
-
selector: "[template='signOut']",
|
|
167
|
-
data: {
|
|
168
|
-
type: 'signOut',
|
|
169
|
-
message: 'Succesfully logged out',
|
|
170
|
-
success: true
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
// TODO: replace with Custom event system
|
|
175
|
-
document.dispatchEvent(new CustomEvent('signOut'));
|
|
176
|
-
},
|
|
177
|
-
|
|
178
|
-
updateUserStatus: function (data) {
|
|
179
|
-
this.redirect(data)
|
|
180
|
-
if (data.user_id) {
|
|
181
|
-
let statusEls = document.querySelectorAll(`[user-status][document_id='${data['user_id']}']`);
|
|
182
|
-
|
|
183
|
-
statusEls.forEach((el) => {
|
|
184
|
-
el.setAttribute('user-status', data['userStatus']);
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
},
|
|
189
|
-
|
|
190
|
-
redirect: (data) => {
|
|
191
|
-
if (data.user_id && data.user_id !== crud.socket.config.user_id)
|
|
192
|
-
return
|
|
193
|
-
if (!data.user_id && data.clientId !== crud.socket.clientId)
|
|
194
|
-
return
|
|
195
|
-
if (data.userStatus == 'on' || data.userStatus == 'idle') {
|
|
196
|
-
let redirectTag = document.querySelector('[session="true"]');
|
|
197
|
-
|
|
198
|
-
if (redirectTag) {
|
|
199
|
-
let redirectLink = redirectTag.getAttribute('href');
|
|
200
|
-
if (redirectLink) {
|
|
201
|
-
document.location.href = redirectLink;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
} else if (data.userStatus == 'off') {
|
|
205
|
-
let redirectTag = document.querySelector('[session="false"]');
|
|
206
|
-
|
|
207
|
-
if (redirectTag) {
|
|
208
|
-
let redirectLink = redirectTag.getAttribute('href');
|
|
209
|
-
if (redirectLink) {
|
|
210
|
-
localStorage.removeItem("user_id");
|
|
211
|
-
localStorage.removeItem("token");
|
|
212
|
-
|
|
213
|
-
// this.deleteCookie();
|
|
214
|
-
document.location.href = redirectLink;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
},
|
|
220
|
-
|
|
221
|
-
initSession: () => {
|
|
222
|
-
let redirectTag = document.querySelector('[session]');
|
|
223
|
-
|
|
224
|
-
if (redirectTag) {
|
|
225
|
-
crud.socket.send('sendMessage', {
|
|
226
|
-
message: 'checkSession',
|
|
227
|
-
broadcast: false,
|
|
228
|
-
broadcastSender: false,
|
|
229
|
-
broadcastBrowser: false
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
},
|
|
234
|
-
|
|
235
|
-
// TODO: updatePassword()
|
|
236
|
-
updatePassword: function (btn) {
|
|
237
|
-
this.signIn(btn);
|
|
238
|
-
}
|
|
239
|
-
};
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
action.init({
|
|
243
|
-
name: "signUp",
|
|
244
|
-
endEvent: "signUp",
|
|
245
|
-
callback: (btn, data) => {
|
|
246
|
-
CoCreateUser.signUp(btn);
|
|
247
|
-
},
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
action.init({
|
|
251
|
-
name: "signIn",
|
|
252
|
-
endEvent: "signIn",
|
|
253
|
-
callback: (btn, data) => {
|
|
254
|
-
CoCreateUser.signIn(btn, data);
|
|
255
|
-
},
|
|
256
|
-
});
|
|
257
|
-
|
|
258
|
-
action.init({
|
|
259
|
-
name: "signOut",
|
|
260
|
-
endEvent: "signOut",
|
|
261
|
-
callback: (btn, data) => {
|
|
262
|
-
CoCreateUser.signOut(btn, data);
|
|
263
|
-
},
|
|
264
|
-
});
|
|
265
|
-
|
|
266
|
-
CoCreateUser.init();
|
|
267
|
-
|
|
268
|
-
export default CoCreateUser;
|
|
1
|
+
/*globals CustomEvent, btoa*/
|
|
2
|
+
import crud from '@cocreate/crud-client';
|
|
3
|
+
import action from '@cocreate/actions';
|
|
4
|
+
import form from '@cocreate/form';
|
|
5
|
+
import render from '@cocreate/render';
|
|
6
|
+
import '@cocreate/element-prototype';
|
|
7
|
+
import './index.css';
|
|
8
|
+
import localStorage from '@cocreate/local-storage';
|
|
9
|
+
|
|
10
|
+
const CoCreateUser = {
|
|
11
|
+
init: function () {
|
|
12
|
+
this.initSocket();
|
|
13
|
+
this.initSession();
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
initSocket: function () {
|
|
17
|
+
const self = this;
|
|
18
|
+
crud.listen('updateUserStatus', (data) => self.updateUserStatus(data));
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
signUp: async function (btn) {
|
|
22
|
+
let formEl = btn.closest("form");
|
|
23
|
+
if (!formEl) return;
|
|
24
|
+
|
|
25
|
+
let organization_id = crud.socket.config.organization_id;
|
|
26
|
+
let collection = form.getAttribute('collection')
|
|
27
|
+
if (!collection) {
|
|
28
|
+
for (let el of formEl) {
|
|
29
|
+
collection = el.getAttribute('collection');
|
|
30
|
+
if (collection)
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
let data = form.getData(formEl, collection)
|
|
36
|
+
data['collection'] = collection
|
|
37
|
+
data.organization_id = organization_id;
|
|
38
|
+
|
|
39
|
+
if (!data.document[0]._id)
|
|
40
|
+
data.document[0]._id = crud.ObjectId();
|
|
41
|
+
|
|
42
|
+
let user = await crud.createDocument(data)
|
|
43
|
+
form.setDocumentId(formEl, user)
|
|
44
|
+
|
|
45
|
+
// const socket = crud.socket.getSockets()
|
|
46
|
+
// if (!socket[0] || !socket[0].connected || window && !window.navigator.onLine) {
|
|
47
|
+
let key = {
|
|
48
|
+
collection: 'keys',
|
|
49
|
+
document: {
|
|
50
|
+
type: "user",
|
|
51
|
+
key: user.document[0]._id,
|
|
52
|
+
roles: ['user'],
|
|
53
|
+
email: user.document.email,
|
|
54
|
+
password: user.document.password || btoa('0000'),
|
|
55
|
+
collection
|
|
56
|
+
},
|
|
57
|
+
organization_id
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
let response = await crud.createDocument(key)
|
|
61
|
+
if (response && response.document && response.document[0]) {
|
|
62
|
+
crud.socket.send('signUp', { user, userKey })
|
|
63
|
+
|
|
64
|
+
render.data({
|
|
65
|
+
selector: "[template='signUp']",
|
|
66
|
+
data: {
|
|
67
|
+
type: 'signUp',
|
|
68
|
+
message: 'Succesfully Signed Up',
|
|
69
|
+
success: true
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
document.dispatchEvent(new CustomEvent('signUp', {
|
|
74
|
+
detail: response
|
|
75
|
+
}));
|
|
76
|
+
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
signIn: function (btn) {
|
|
81
|
+
let form = btn.closest('form');
|
|
82
|
+
let collection = form.getAttribute('collection');
|
|
83
|
+
let query = [];
|
|
84
|
+
|
|
85
|
+
const inputs = form.querySelectorAll('input[name="email"], input[name="password"], input[name="username"]');
|
|
86
|
+
|
|
87
|
+
inputs.forEach((input) => {
|
|
88
|
+
const name = input.getAttribute('name');
|
|
89
|
+
const value = input.getValue();
|
|
90
|
+
collection = 'keys';
|
|
91
|
+
query.push({ name, value, operator: '$eq' })
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
let request = {
|
|
95
|
+
db: 'indexeddb',
|
|
96
|
+
collection,
|
|
97
|
+
filter: {
|
|
98
|
+
query
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const socket = crud.socket.getSockets()
|
|
103
|
+
if (!socket[0] || !socket[0].connected || window && !window.navigator.onLine || crud.socket.serverOrganization == false) {
|
|
104
|
+
crud.readDocument(request).then((response) => {
|
|
105
|
+
response['success'] = false
|
|
106
|
+
response['status'] = "signIn failed"
|
|
107
|
+
if (response.document && response.document[0]) {
|
|
108
|
+
response['success'] = true
|
|
109
|
+
response['status'] = "success"
|
|
110
|
+
response['user_id'] = response.document[0].key
|
|
111
|
+
this.signInResponse(response)
|
|
112
|
+
} else {
|
|
113
|
+
this.signInResponse(response)
|
|
114
|
+
}
|
|
115
|
+
})
|
|
116
|
+
} else {
|
|
117
|
+
request.broadcastBrowser = false
|
|
118
|
+
delete request.db
|
|
119
|
+
crud.socket.send('signIn', request).then((response) => {
|
|
120
|
+
this.signInResponse(response)
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
signInResponse: function (data) {
|
|
126
|
+
let { success, status, message, user_id, token } = data;
|
|
127
|
+
|
|
128
|
+
if (success) {
|
|
129
|
+
localStorage.setItem('organization_id', crud.socket.config.organization_id);
|
|
130
|
+
localStorage.setItem("key", crud.socket.config.key);
|
|
131
|
+
localStorage.setItem("host", crud.socket.config.host);
|
|
132
|
+
localStorage.setItem('user_id', user_id);
|
|
133
|
+
localStorage.setItem("token", token);
|
|
134
|
+
// document.cookie = `token=${token};path=/`;
|
|
135
|
+
message = "Succesful signIn";
|
|
136
|
+
document.dispatchEvent(new CustomEvent('signIn', {
|
|
137
|
+
detail: {}
|
|
138
|
+
}));
|
|
139
|
+
}
|
|
140
|
+
else
|
|
141
|
+
message = "The email or password you entered is incorrect";
|
|
142
|
+
|
|
143
|
+
render.data({
|
|
144
|
+
selector: "[template='signIn']",
|
|
145
|
+
data: {
|
|
146
|
+
type: 'signIn',
|
|
147
|
+
status,
|
|
148
|
+
message,
|
|
149
|
+
success
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
signOut: (btn) => {
|
|
155
|
+
self = this;
|
|
156
|
+
localStorage.removeItem("user_id");
|
|
157
|
+
localStorage.removeItem("token");
|
|
158
|
+
|
|
159
|
+
// let allCookies = document.cookie.split(';');
|
|
160
|
+
|
|
161
|
+
// for (var i = 0; i < allCookies.length; i++)
|
|
162
|
+
// document.cookie = allCookies[i] + "=;expires=" +
|
|
163
|
+
// new Date(0).toUTCString();
|
|
164
|
+
|
|
165
|
+
render.data({
|
|
166
|
+
selector: "[template='signOut']",
|
|
167
|
+
data: {
|
|
168
|
+
type: 'signOut',
|
|
169
|
+
message: 'Succesfully logged out',
|
|
170
|
+
success: true
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
// TODO: replace with Custom event system
|
|
175
|
+
document.dispatchEvent(new CustomEvent('signOut'));
|
|
176
|
+
},
|
|
177
|
+
|
|
178
|
+
updateUserStatus: function (data) {
|
|
179
|
+
this.redirect(data)
|
|
180
|
+
if (data.user_id) {
|
|
181
|
+
let statusEls = document.querySelectorAll(`[user-status][document_id='${data['user_id']}']`);
|
|
182
|
+
|
|
183
|
+
statusEls.forEach((el) => {
|
|
184
|
+
el.setAttribute('user-status', data['userStatus']);
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
},
|
|
189
|
+
|
|
190
|
+
redirect: (data) => {
|
|
191
|
+
if (data.user_id && data.user_id !== crud.socket.config.user_id)
|
|
192
|
+
return
|
|
193
|
+
if (!data.user_id && data.clientId !== crud.socket.clientId)
|
|
194
|
+
return
|
|
195
|
+
if (data.userStatus == 'on' || data.userStatus == 'idle') {
|
|
196
|
+
let redirectTag = document.querySelector('[session="true"]');
|
|
197
|
+
|
|
198
|
+
if (redirectTag) {
|
|
199
|
+
let redirectLink = redirectTag.getAttribute('href');
|
|
200
|
+
if (redirectLink) {
|
|
201
|
+
document.location.href = redirectLink;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
} else if (data.userStatus == 'off') {
|
|
205
|
+
let redirectTag = document.querySelector('[session="false"]');
|
|
206
|
+
|
|
207
|
+
if (redirectTag) {
|
|
208
|
+
let redirectLink = redirectTag.getAttribute('href');
|
|
209
|
+
if (redirectLink) {
|
|
210
|
+
localStorage.removeItem("user_id");
|
|
211
|
+
localStorage.removeItem("token");
|
|
212
|
+
|
|
213
|
+
// this.deleteCookie();
|
|
214
|
+
document.location.href = redirectLink;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
initSession: () => {
|
|
222
|
+
let redirectTag = document.querySelector('[session]');
|
|
223
|
+
|
|
224
|
+
if (redirectTag) {
|
|
225
|
+
crud.socket.send('sendMessage', {
|
|
226
|
+
message: 'checkSession',
|
|
227
|
+
broadcast: false,
|
|
228
|
+
broadcastSender: false,
|
|
229
|
+
broadcastBrowser: false
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
},
|
|
234
|
+
|
|
235
|
+
// TODO: updatePassword()
|
|
236
|
+
updatePassword: function (btn) {
|
|
237
|
+
this.signIn(btn);
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
action.init({
|
|
243
|
+
name: "signUp",
|
|
244
|
+
endEvent: "signUp",
|
|
245
|
+
callback: (btn, data) => {
|
|
246
|
+
CoCreateUser.signUp(btn);
|
|
247
|
+
},
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
action.init({
|
|
251
|
+
name: "signIn",
|
|
252
|
+
endEvent: "signIn",
|
|
253
|
+
callback: (btn, data) => {
|
|
254
|
+
CoCreateUser.signIn(btn, data);
|
|
255
|
+
},
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
action.init({
|
|
259
|
+
name: "signOut",
|
|
260
|
+
endEvent: "signOut",
|
|
261
|
+
callback: (btn, data) => {
|
|
262
|
+
CoCreateUser.signOut(btn, data);
|
|
263
|
+
},
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
CoCreateUser.init();
|
|
267
|
+
|
|
268
|
+
export default CoCreateUser;
|
package/src/index.css
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
[user-status="on"] {
|
|
2
|
-
background-color:yellowgreen;
|
|
3
|
-
}
|
|
4
|
-
[user-status="off"] {
|
|
5
|
-
background-color:red;
|
|
6
|
-
}
|
|
7
|
-
[user-status="idle"] {
|
|
8
|
-
background-color:orange;
|
|
9
|
-
}
|
|
1
|
+
[user-status="on"] {
|
|
2
|
+
background-color:yellowgreen;
|
|
3
|
+
}
|
|
4
|
+
[user-status="off"] {
|
|
5
|
+
background-color:red;
|
|
6
|
+
}
|
|
7
|
+
[user-status="idle"] {
|
|
8
|
+
background-color:orange;
|
|
9
|
+
}
|
package/src/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
(function (root, factory) {
|
|
2
|
-
if (typeof define === 'function' && define.amd) {
|
|
3
|
-
define(["./client"], function(CoCreateUsers) {
|
|
4
|
-
return factory(CoCreateUsers)
|
|
5
|
-
});
|
|
6
|
-
} else if (typeof module === 'object' && module.exports) {
|
|
7
|
-
const CoCreateUsers = require("./server.js")
|
|
8
|
-
module.exports = factory(CoCreateUsers);
|
|
9
|
-
} else {
|
|
10
|
-
root.returnExports = factory(root["./client.js"]);
|
|
11
|
-
}
|
|
12
|
-
}(typeof self !== 'undefined' ? self : this, function (CoCreateUsers) {
|
|
13
|
-
return CoCreateUsers;
|
|
1
|
+
(function (root, factory) {
|
|
2
|
+
if (typeof define === 'function' && define.amd) {
|
|
3
|
+
define(["./client"], function(CoCreateUsers) {
|
|
4
|
+
return factory(CoCreateUsers)
|
|
5
|
+
});
|
|
6
|
+
} else if (typeof module === 'object' && module.exports) {
|
|
7
|
+
const CoCreateUsers = require("./server.js")
|
|
8
|
+
module.exports = factory(CoCreateUsers);
|
|
9
|
+
} else {
|
|
10
|
+
root.returnExports = factory(root["./client.js"]);
|
|
11
|
+
}
|
|
12
|
+
}(typeof self !== 'undefined' ? self : this, function (CoCreateUsers) {
|
|
13
|
+
return CoCreateUsers;
|
|
14
14
|
}));
|