@cocreate/users 1.2.32 → 1.3.1

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,31 @@
1
+ ## [1.3.1](https://github.com/CoCreate-app/CoCreate-users/compare/v1.3.0...v1.3.1) (2021-10-14)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * dispatch login endEvent ([5385212](https://github.com/CoCreate-app/CoCreate-users/commit/5385212be9eb2e31d9c4cbe48424231d111489ad))
7
+
8
+ # [1.3.0](https://github.com/CoCreate-app/CoCreate-users/compare/v1.2.34...v1.3.0) (2021-10-14)
9
+
10
+
11
+ ### Features
12
+
13
+ * render log for success ([24480a0](https://github.com/CoCreate-app/CoCreate-users/commit/24480a036390608b9ad1cf79dd68c995df1991ac))
14
+
15
+ ## [1.2.34](https://github.com/CoCreate-app/CoCreate-users/compare/v1.2.33...v1.2.34) (2021-10-13)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * update descriptions ([b2095b7](https://github.com/CoCreate-app/CoCreate-users/commit/b2095b7f9e09b25b46b1523a06dfe2b59857da6e))
21
+
22
+ ## [1.2.33](https://github.com/CoCreate-app/CoCreate-users/compare/v1.2.32...v1.2.33) (2021-10-13)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * update dependencies ([06dd77d](https://github.com/CoCreate-app/CoCreate-users/commit/06dd77d89b2dcbdf806ee3971ec7caa6cd1c59af))
28
+
1
29
  ## [1.2.32](https://github.com/CoCreate-app/CoCreate-users/compare/v1.2.31...v1.2.32) (2021-10-12)
2
30
 
3
31
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # CoCreate-users
2
2
 
3
- A simple users component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API. Take it for a spin in our [playground!](https://cocreate.app/docs/users)
3
+ A simple users component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API. Take it for a spin in our [playground!](https://cocreate.app/docs/users)
4
4
 
5
5
  ![minified](https://img.badgesize.io/https://cdn.cocreate.app/users/latest/CoCreate-users.min.js?style=flat-square&label=minified&color=orange)
6
6
  ![gzip](https://img.badgesize.io/https://cdn.cocreate.app/users/latest/CoCreate-users.min.js?compression=gzip&style=flat-square&label=gzip&color=yellow)
package/docs/index.html CHANGED
@@ -6,14 +6,14 @@
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1">
7
7
  <title>CoCreate-users Documentation | CoCreateJS </title>
8
8
  <link rel="icon" type="image/png" sizes="32x32" href="https://cocreate.app/images/favicon.ico">
9
- <meta name="description" content="A simple HTML5 and pure javascript component. Easy configuration using data-attributes and highly styleable." />
9
+ <meta name="description" content="A simple HTML5 and pure javascript component. Easy configuration using HTML5 attributes or Javscript api and highly styleable." />
10
10
  <meta name="keywords" content="helper classes, utility classes, css framework, css library, inline style classes" />
11
11
  <meta name="robots" content="index,follow" />
12
12
  <meta property="og:image" content="https://cdn.cocreate.app/docs/users.png">
13
13
 
14
14
  <!-- CoCreate CSS -->
15
15
  <link rel="stylesheet" href="https://cdn.cocreate.app/latest/CoCreate.min.css" type="text/css"/>
16
- <link rel="stylesheet" href="/docs/index.css" collection="files" document_id="60888216117c640e7596303f" name="src" type="text/css" data-save="true"/>
16
+ <link rel="stylesheet" href="/docs/index.css" collection="files" document_id="60888216117c640e7596303f" name="src" type="text/css" save="true"/>
17
17
  </head>
18
18
 
19
19
  <body>
@@ -40,7 +40,7 @@
40
40
  <a href="https://github.com/CoCreate-app/CoCreate-users" target="_blank" class="margin-right:15px"><i class="fab fa-github"></i></a>
41
41
  </div>
42
42
  </div>
43
- <h1 class="max-width:500px margin:20px_10px line-height:1.5 font-size:16px font-weight:100">A simple HTML5, CSS and pure javascript component. Easy configuration using data-attributes and highly styleable.</h1>
43
+ <h1 class="max-width:500px margin:20px_10px line-height:1.5 font-size:16px font-weight:100">A headless vinilla javascript micro component. Easy configuration using HTML5 attributes or Javscript api.</h1>
44
44
  <div id="users-section" class="display:flex flex-wrap:wrap">
45
45
  <div class="flex-grow:1 width:400px width:300px@xs padding:0px_10px margin-top:60px">
46
46
  <div id="users-install" class="border-bottom:1px_solid_lightgrey" scroll scroll-intersect="color:dodgerblue" scroll-target="#users-install-section">
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cocreate/users",
3
- "version": "1.2.32",
4
- "description": "A simple users component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.",
3
+ "version": "1.3.1",
4
+ "description": "A simple users component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "users",
7
7
  "cocreate",
@@ -61,11 +61,11 @@
61
61
  "webpack-log": "^3.0.1"
62
62
  },
63
63
  "dependencies": {
64
- "@cocreate/action": "^1.2.25",
65
- "@cocreate/crud-client": "^1.2.32",
66
- "@cocreate/docs": "^1.2.29",
67
- "@cocreate/form": "^1.2.24",
68
- "@cocreate/input": "^1.2.29",
69
- "@cocreate/render": "^1.1.24"
64
+ "@cocreate/action": "^1.2.29",
65
+ "@cocreate/crud-client": "^1.4.2",
66
+ "@cocreate/docs": "^1.2.32",
67
+ "@cocreate/form": "^1.2.30",
68
+ "@cocreate/input": "^1.2.35",
69
+ "@cocreate/render": "^1.3.0"
70
70
  }
71
71
  }
package/src/index.js CHANGED
@@ -19,12 +19,12 @@ const CoCreateUser = {
19
19
  const self = this;
20
20
  crud.listen('createUser', function(data) {
21
21
  self.setDocumentId('users', data.document_id);
22
- document.dispatchEvent(new CustomEvent('createdUser', {
22
+ document.dispatchEvent(new CustomEvent('createUser', {
23
23
  detail: data
24
24
  }));
25
25
  });
26
26
  crud.listen('createUserNew', function(data) {
27
- document.dispatchEvent(new CustomEvent('createdUser', {
27
+ document.dispatchEvent(new CustomEvent('createUserNew', {
28
28
  detail: data
29
29
  }));
30
30
  });
@@ -64,24 +64,31 @@ const CoCreateUser = {
64
64
  },
65
65
 
66
66
  loginResult: function(data) {
67
- const { success, status, message, token } = data;
67
+ let { success, status, message, token } = data;
68
68
 
69
69
  if(success) {
70
70
  window.localStorage.setItem('user_id', data['id']);
71
71
  window.localStorage.setItem("token", token);
72
72
  document.cookie = `token=${token};path=/`;
73
73
  this.getCurrentOrg(data['id'], data['collection']);
74
+ message = "Succesful Login";
74
75
  }
76
+ else
77
+ message = "The email or password you entered is incorrect";
75
78
 
76
79
  render.data({
77
80
  selector: "[template_id='login']",
78
81
  data: {
79
82
  type: 'login',
80
- status: 'failed',
81
- message: 'Email or password is incorrect'
83
+ status,
84
+ message,
85
+ success
82
86
  }
83
87
  });
84
-
88
+
89
+ document.dispatchEvent(new CustomEvent('login', {
90
+ detail: {}
91
+ }));
85
92
  },
86
93
 
87
94
  getCurrentOrg: function(user_id, collection) {
@@ -102,7 +109,7 @@ const CoCreateUser = {
102
109
  window.localStorage.setItem('adminUI_id', data['adminUI_id']);
103
110
  window.localStorage.setItem('builderUI_id', data['builderUI_id']);
104
111
 
105
- document.dispatchEvent(new CustomEvent('loggedIn'));
112
+ document.dispatchEvent(new CustomEvent('logIn'));
106
113
  },
107
114
 
108
115
  logout: (btn) => {
@@ -116,7 +123,7 @@ const CoCreateUser = {
116
123
  new Date(0).toUTCString();
117
124
 
118
125
  // Todo: replace with Custom event system
119
- document.dispatchEvent(new CustomEvent('loggedOut'));
126
+ document.dispatchEvent(new CustomEvent('logout'));
120
127
  },
121
128
 
122
129
  initChangeOrg: () => {
@@ -300,7 +307,7 @@ export default CoCreateUser;
300
307
 
301
308
  action.init({
302
309
  action: "createUserNew",
303
- endEvent: "createdUser",
310
+ endEvent: "createUserNew",
304
311
  callback: (btn, data) => {
305
312
  CoCreateUser.createUser(btn);
306
313
  },
@@ -308,7 +315,7 @@ action.init({
308
315
 
309
316
  action.init({
310
317
  action: "createUser",
311
- endEvent: "createdUser",
318
+ endEvent: "createUser",
312
319
  callback: (btn, data) => {
313
320
  CoCreateUser.createUser(btn);
314
321
  },
@@ -316,7 +323,7 @@ action.init({
316
323
 
317
324
  action.init({
318
325
  action: "login",
319
- endEvent: "loggedIn",
326
+ endEvent: "login",
320
327
  callback: (btn, data) => {
321
328
  CoCreateUser.requestLogin(btn, data);
322
329
  },
@@ -324,7 +331,7 @@ action.init({
324
331
 
325
332
  action.init({
326
333
  action: "logout",
327
- endEvent: "loggedOut",
334
+ endEvent: "logout",
328
335
  callback: (btn, data) => {
329
336
  CoCreateUser.logout(btn, data);
330
337
  },