@cocreate/config 1.5.2 → 1.6.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.
@@ -41,30 +41,4 @@ jobs:
41
41
  outputs:
42
42
  new_release_published: "${{ steps.semantic.outputs.new_release_published }}"
43
43
  new_release_version: "${{ steps.semantic.outputs.new_release_version }}"
44
- upload:
45
- runs-on: ubuntu-latest
46
- needs: release
47
- if: needs.release.outputs.new_release_published == 'true'
48
- env:
49
- VERSION: "${{ needs.release.outputs.new_release_version }}"
50
- steps:
51
- - name: Checkout
52
- uses: actions/checkout@v3
53
- - name: Setup Node.js
54
- uses: actions/setup-node@v3
55
- with:
56
- node-version: 16
57
- - name: Set npm registry auth
58
- run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
59
- - name: Install dependencies
60
- run: yarn install
61
- - name: Build
62
- run: yarn build
63
- - name: Set Environment Variables
64
- run: |
65
- echo "organization_id=${{ secrets.COCREATE_ORGANIZATION_ID }}" >> $GITHUB_ENV
66
- echo "key=${{ secrets.COCREATE_KEY }}" >> $GITHUB_ENV
67
- echo "host=${{ secrets.COCREATE_HOST }}" >> $GITHUB_ENV
68
- - name: CoCreate Upload
69
- run: coc upload
70
44
 
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [1.6.1](https://github.com/CoCreate-app/CoCreate-config/compare/v1.6.0...v1.6.1) (2023-10-09)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * bump cocreate dependency versions ([44f3154](https://github.com/CoCreate-app/CoCreate-config/commit/44f31540249d75c046354c226af9d10776c07ef5))
7
+
8
+ # [1.6.0](https://github.com/CoCreate-app/CoCreate-config/compare/v1.5.2...v1.6.0) (2023-10-09)
9
+
10
+
11
+ ### Features
12
+
13
+ * Persists config data in the client ([3904abd](https://github.com/CoCreate-app/CoCreate-config/commit/3904abdedd997ae1b47cd6613cdae2405680f96a))
14
+
1
15
  ## [1.5.2](https://github.com/CoCreate-app/CoCreate-config/compare/v1.5.1...v1.5.2) (2023-09-18)
2
16
 
3
17
 
@@ -1,24 +1,24 @@
1
- module.exports = {
2
- "organization_id": "",
3
- "key": "",
4
- "host": "",
5
- "sources": [
6
- {
7
- "array": "files",
8
- "object": {
9
- "_id": "61a12db2a8b6b4001a9f5a2e",
10
- "name": "index.html",
11
- "path": "/docs/config",
12
- "pathname": "/docs/config/index.html",
13
- "src": "{{./docs/index.html}}",
14
- "host": [
15
- "*",
16
- "general.cocreate.app"
17
- ],
18
- "directory": "config",
19
- "content-type": "{{content-type}}",
20
- "public": "true"
21
- }
22
- }
23
- ]
1
+ module.exports = {
2
+ "organization_id": "",
3
+ "key": "",
4
+ "host": "",
5
+ "sources": [
6
+ {
7
+ "array": "files",
8
+ "object": {
9
+ "_id": "61a12db2a8b6b4001a9f5a2e",
10
+ "name": "index.html",
11
+ "path": "/docs/config",
12
+ "pathname": "/docs/config/index.html",
13
+ "src": "{{./docs/index.html}}",
14
+ "host": [
15
+ "*",
16
+ "general.cocreate.app"
17
+ ],
18
+ "directory": "config",
19
+ "content-type": "{{content-type}}",
20
+ "public": "true"
21
+ }
22
+ }
23
+ ]
24
24
  };
package/docs/index.html CHANGED
@@ -377,7 +377,6 @@
377
377
  src="/assets/svg/pencil-alt.svg"></i>
378
378
  </button>
379
379
  </main>
380
- <script src="/apikey.js"></script>
381
380
  <script src="https://CoCreate.app/dist/CoCreate.js"></script>
382
381
  </body>
383
382
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/config",
3
- "version": "1.5.2",
3
+ "version": "1.6.1",
4
4
  "description": "A convenient chain handler allows user to chain multiple CoCreate components together. When one action is complete next one will start. The sequence goes untill all config completed. Grounded on Vanilla javascript, easily configured using HTML5 attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "config",
@@ -59,6 +59,6 @@
59
59
  "webpack-log": "^3.0.1"
60
60
  },
61
61
  "dependencies": {
62
- "@cocreate/utils": "^1.24.1"
62
+ "@cocreate/utils": "^1.25.0"
63
63
  }
64
64
  }
package/src/client.js CHANGED
@@ -0,0 +1,41 @@
1
+ import localStorage from '@cocreate/local-storage'
2
+
3
+ // Function to get a value by key from localStorage or cookies
4
+ function get(key) {
5
+ let value
6
+ value = localStorage.getItem(key)
7
+
8
+ if (window.CoCreateConfig && window.CoCreateConfig[key])
9
+ return window.CoCreateConfig[key]
10
+ else if (value = localStorage.getItem(key)) {
11
+ return value
12
+ } else {
13
+ const cookies = document.cookie.split("; ");
14
+ for (const cookie of cookies) {
15
+ const [cookieName, cookieValue] = cookie.split("=");
16
+ if (cookieName === key) {
17
+ return decodeURIComponent(cookieValue);
18
+ }
19
+ }
20
+ }
21
+ }
22
+
23
+ // Function to set a key-value pair in localStorage or cookies
24
+ function set(key, value) {
25
+ if (!window.CoCreateConfig)
26
+ window.CoCreateConfig = { [key]: value }
27
+ else
28
+ window.CoCreateConfig[key] = value
29
+ localStorage.setItem(key, value)
30
+ document.cookie = `${key}=${encodeURIComponent(value)}`;
31
+ }
32
+
33
+ // Function to delete a key-value pair from localStorage or cookies
34
+ function remove(key) {
35
+ if (!window.CoCreateConfig)
36
+ delete window.CoCreateConfig[key]
37
+ localStorage.removeItem(key)
38
+ document.cookie = `${key}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`;
39
+ }
40
+
41
+ export default { get, set, remove }