@cocreate/organizations 1.21.5 → 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 CHANGED
@@ -1,3 +1,11 @@
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
+
1
9
  ## [1.21.5](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.21.4...v1.21.5) (2023-10-09)
2
10
 
3
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/organizations",
3
- "version": "1.21.5",
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",
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 indexeddb.send({ method: 'read.database' })
105
+ let data = await Indexeddb.send({ method: 'read.database' })
104
106
  for (let database of data.database) {
105
- let name = database.database.name
107
+ let name = database.name
106
108
  if (name.match(/^[0-9a-fA-F]{24}$/)) {
107
109
  organization_id = name
108
110
  }
@@ -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 (indexeddb) {
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
- CoCreateOrganization.create(action.element);
225
+ create(action.element);
226
226
  }
227
227
  });
228
228