@cocreate/organizations 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 CHANGED
@@ -1,3 +1,22 @@
1
+ # [1.27.0](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.26.1...v1.27.0) (2024-01-08)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * applied host to define environment/branch ([09cdf83](https://github.com/CoCreate-app/CoCreate-organizations/commit/09cdf8347f6a753d796eb5f9e6d6288c506106b2))
7
+
8
+
9
+ ### Features
10
+
11
+ * bumped CoCreate dependencies to their latest versions ([dff105b](https://github.com/CoCreate-app/CoCreate-organizations/commit/dff105b71b36e3fe98f3ed9fcf823f5e461654cb))
12
+
13
+ ## [1.26.1](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.26.0...v1.26.1) (2023-12-22)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * postMessage undefined ([ae5a9e2](https://github.com/CoCreate-app/CoCreate-organizations/commit/ae5a9e25ad1c771559f6cd08323aa6307a51a645))
19
+
1
20
  # [1.26.0](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.25.0...v1.26.0) (2023-11-25)
2
21
 
3
22
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/organizations",
3
- "version": "1.26.0",
3
+ "version": "1.27.0",
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.14.0",
62
- "@cocreate/config": "^1.8.0",
63
- "@cocreate/crud-client": "^1.31.0",
64
- "@cocreate/elements": "^1.28.0"
61
+ "@cocreate/actions": "^1.15.1",
62
+ "@cocreate/config": "^1.10.0",
63
+ "@cocreate/crud-client": "^1.32.2",
64
+ "@cocreate/elements": "^1.32.0"
65
65
  }
66
66
  }
package/src/client.js CHANGED
@@ -138,11 +138,22 @@ async function getOrganizationFromServiceWorker() {
138
138
 
139
139
  // Send message to Service Worker
140
140
  const msg = new MessageChannel();
141
- navigator.serviceWorker.ready
142
- .then(() => {
141
+
142
+ navigator.serviceWorker.ready.then(registration => {
143
+ if (navigator.serviceWorker.controller) {
144
+ // If there's an active controller, send the message
143
145
  navigator.serviceWorker.controller.postMessage({ action: 'getOrganization' }, [msg.port1]);
144
- })
145
- .catch(reject);
146
+ } else {
147
+ // Listen for a new service worker to start controlling the page
148
+ navigator.serviceWorker.addEventListener('controllerchange', () => {
149
+ if (navigator.serviceWorker.controller) {
150
+ navigator.serviceWorker.controller.postMessage({ action: 'getOrganization' }, [msg.port1]);
151
+ }
152
+ });
153
+ }
154
+ }).catch(error => {
155
+ console.error(reject);
156
+ });
146
157
  });
147
158
  }
148
159
 
package/src/server.js CHANGED
@@ -52,6 +52,7 @@ class CoCreateOrganization {
52
52
 
53
53
  const Data = {}
54
54
  Data.method = 'object.create'
55
+ Data.host = data.host
55
56
  Data.database = process.env.organization_id
56
57
  Data.organization_id = process.env.organization_id
57
58