@cocreate/organizations 1.21.4 → 1.21.6
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 +16 -0
- package/package.json +5 -5
- package/src/client.js +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## [1.21.6](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.21.5...v1.21.6) (2023-10-14)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* typo ([c88342b](https://github.com/CoCreate-app/CoCreate-organizations/commit/c88342b5128fc472dbe0a39dc3d7ea98141c8236))
|
|
7
|
+
* database.database.name ([88fde84](https://github.com/CoCreate-app/CoCreate-organizations/commit/88fde8463c1d6d5160528065b951da0c38664d2b))
|
|
8
|
+
|
|
9
|
+
## [1.21.5](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.21.4...v1.21.5) (2023-10-09)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* bump dependencies ([4224b61](https://github.com/CoCreate-app/CoCreate-organizations/commit/4224b61e8191de791280144b61335023613fc149))
|
|
15
|
+
* post.message action ([12411d6](https://github.com/CoCreate-app/CoCreate-organizations/commit/12411d610bcaaeecd735992f22384111d4f06eaf))
|
|
16
|
+
|
|
1
17
|
## [1.21.4](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.21.3...v1.21.4) (2023-10-09)
|
|
2
18
|
|
|
3
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/organizations",
|
|
3
|
-
"version": "1.21.
|
|
3
|
+
"version": "1.21.6",
|
|
4
4
|
"description": "A simple organizations component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"organizations",
|
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
"webpack-log": "^3.0.1"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@cocreate/actions": "^1.11.
|
|
62
|
-
"@cocreate/config": "^1.6.
|
|
63
|
-
"@cocreate/crud-client": "^1.28.
|
|
64
|
-
"@cocreate/elements": "^1.23.
|
|
61
|
+
"@cocreate/actions": "^1.11.6",
|
|
62
|
+
"@cocreate/config": "^1.6.4",
|
|
63
|
+
"@cocreate/crud-client": "^1.28.4",
|
|
64
|
+
"@cocreate/elements": "^1.23.4"
|
|
65
65
|
}
|
|
66
66
|
}
|
package/src/client.js
CHANGED
|
@@ -2,6 +2,8 @@ import Crud from '@cocreate/crud-client';
|
|
|
2
2
|
import Action from '@cocreate/actions';
|
|
3
3
|
import Elements from '@cocreate/elements';
|
|
4
4
|
import Config from '@cocreate/config';
|
|
5
|
+
import Indexeddb from '@cocreate/indexeddb';
|
|
6
|
+
import uuid from '@cocreate/uuid';
|
|
5
7
|
|
|
6
8
|
async function generateDB(organization = { object: {} }, user = { object: {} }) {
|
|
7
9
|
const organization_id = organization.object._id || Crud.ObjectId();
|
|
@@ -100,9 +102,9 @@ async function generateDB(organization = { object: {} }, user = { object: {} })
|
|
|
100
102
|
async function get() {
|
|
101
103
|
let organization_id = await getOrganizationFromServiceWorker()
|
|
102
104
|
if (!organization_id) {
|
|
103
|
-
let data = await
|
|
105
|
+
let data = await Indexeddb.send({ method: 'read.database' })
|
|
104
106
|
for (let database of data.database) {
|
|
105
|
-
let name = database.
|
|
107
|
+
let name = database.name
|
|
106
108
|
if (name.match(/^[0-9a-fA-F]{24}$/)) {
|
|
107
109
|
organization_id = name
|
|
108
110
|
}
|
|
@@ -136,7 +138,7 @@ async function getOrganizationFromServiceWorker() {
|
|
|
136
138
|
const msg = new MessageChannel();
|
|
137
139
|
navigator.serviceWorker.ready
|
|
138
140
|
.then(() => {
|
|
139
|
-
navigator.serviceWorker.controller.postMessage('getOrganization', [msg.port1]);
|
|
141
|
+
navigator.serviceWorker.controller.postMessage({ action: 'getOrganization' }, [msg.port1]);
|
|
140
142
|
})
|
|
141
143
|
.catch(reject);
|
|
142
144
|
});
|
|
@@ -149,10 +151,8 @@ async function createOrganization() {
|
|
|
149
151
|
|
|
150
152
|
if (!createOrganization && confirm("An organization_id could not be found, if you already have an organization_id add it to this html and refresh the page.\n\nOr click 'OK' create a new organization") == true) {
|
|
151
153
|
Crud.socket.organization = 'pending'
|
|
152
|
-
if (
|
|
154
|
+
if (Indexeddb) {
|
|
153
155
|
try {
|
|
154
|
-
// const Organization = await import('@cocreate/organizations')
|
|
155
|
-
|
|
156
156
|
let org = { object: {} }
|
|
157
157
|
let { organization, apikey, user } = await generateDB(org)
|
|
158
158
|
if (organization && apikey && user) {
|
|
@@ -222,7 +222,7 @@ Action.init({
|
|
|
222
222
|
name: "createOrganization",
|
|
223
223
|
endEvent: "createdOrganization",
|
|
224
224
|
callback: (action) => {
|
|
225
|
-
|
|
225
|
+
create(action.element);
|
|
226
226
|
}
|
|
227
227
|
});
|
|
228
228
|
|