@educabot/educablocks-cosmos 0.1.0 → 0.1.2

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.
@@ -0,0 +1,28 @@
1
+ name: Publish
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - '*'
7
+
8
+ jobs:
9
+ build:
10
+ name: Install and build
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: 🏗 Setup repo
14
+ uses: actions/checkout@v3
15
+
16
+ - name: 📦 Setup Node.js
17
+ uses: actions/setup-node@v2
18
+ with:
19
+ node-version: '21'
20
+ registry-url: 'https://registry.npmjs.org'
21
+
22
+ - name: 📦 Install dependencies
23
+ run: npm ci
24
+
25
+ - name: 🚀 Publish
26
+ run: npm publish --access public
27
+ env:
28
+ NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/README.md CHANGED
@@ -1,2 +1,17 @@
1
1
  # educablocks-cosmos
2
- Educabot's cosmos settings
2
+ Educabot's cosmos settings. Import this in your Robots-adjacent project to have cosmos configuration (login options, URLs, etc) for different domains.
3
+
4
+ # How to publish
5
+ 1. Update the "version" field in package.json
6
+ 2. Add a tag and push it to origin
7
+ 3. Done! GH Actions will take care of publishing and you will be able to import it in other repos.
8
+
9
+ Example:
10
+ 1. in package.json:
11
+ ```json
12
+ "version": "0.1.2"
13
+ ```
14
+ 2. in the terminal:
15
+ ```shell
16
+ git tag v0.1.2 && git push --tags
17
+ ```
package/dist/index.js CHANGED
@@ -1,21 +1,21 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.getCosmos = void 0;
18
- var cosmos_1 = require("./src/cosmos");
19
- Object.defineProperty(exports, "getCosmos", { enumerable: true, get: function () { return cosmos_1.getCosmos; } });
20
- __exportStar(require("./src/routes"), exports);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.getCosmos = void 0;
18
+ var cosmos_1 = require("./src/cosmos");
19
+ Object.defineProperty(exports, "getCosmos", { enumerable: true, get: function () { return cosmos_1.getCosmos; } });
20
+ __exportStar(require("./src/routes"), exports);
21
21
  //# sourceMappingURL=index.js.map
@@ -1,95 +1,95 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCosmos = void 0;
4
- const customers_1 = require("./customers");
5
- const env = process.env.NODE_ENV;
6
- const getCosmos = (key, domain = '', newEnv = '') => {
7
- const environment = (newEnv) ? newEnv : ((env) ? env : 'production');
8
- const hostname = (domain) ? domain : ((typeof window !== 'undefined') ? window.location.hostname : '');
9
- ///////// EDUCABOT /////////
10
- if (customers_1.customers.EDUCABOT[environment]
11
- && typeof customers_1.customers.EDUCABOT[environment][key] !== 'undefined'
12
- && (hostname === 'localhost'
13
- || hostname === customers_1.customers.EDUCABOT[environment].cosmosFrontUrl
14
- || hostname === customers_1.customers.EDUCABOT[environment].cosmosBackUrl
15
- || hostname === customers_1.customers.EDUCABOT[environment].cosmosFrontAnimationsUrl
16
- || hostname === customers_1.customers.EDUCABOT[environment].cosmosFrontGamesUrl
17
- // hostname.includes(customers.EDUCABOT[environment].cosmosFrontUrl || hostname === 'localhost')
18
- // || hostname.includes(customers.EDUCABOT[environment].cosmosBackUrl || hostname === 'localhost')
19
- )) {
20
- return customers_1.customers.EDUCABOT[environment][key];
21
- ///////// CODIT /////////
22
- }
23
- else if (customers_1.customers.CODIT[environment]
24
- && typeof customers_1.customers.CODIT[environment][key] !== 'undefined'
25
- && (hostname === customers_1.customers.CODIT[environment].cosmosFrontUrl
26
- || hostname === customers_1.customers.CODIT[environment].cosmosBackUrl
27
- || hostname === customers_1.customers.CODIT[environment].cosmosFrontAnimationsUrl)) {
28
- return customers_1.customers.CODIT[environment][key];
29
- ///////// COPA_ROBOTICA /////////
30
- }
31
- else if (customers_1.customers.COPA_ROBOTICA[environment]
32
- && typeof customers_1.customers.COPA_ROBOTICA[environment][key] !== 'undefined'
33
- && (hostname === customers_1.customers.COPA_ROBOTICA[environment].cosmosFrontUrl
34
- || hostname === customers_1.customers.COPA_ROBOTICA[environment].cosmosBackUrl
35
- || hostname === customers_1.customers.COPA_ROBOTICA[environment].cosmosFrontAnimationsUrl)) {
36
- return customers_1.customers.COPA_ROBOTICA[environment][key];
37
- ///////// REV_ROBOTICS /////////
38
- }
39
- else if (customers_1.customers.REV_ROBOTICS[environment]
40
- && typeof customers_1.customers.REV_ROBOTICS[environment][key] !== 'undefined'
41
- && (hostname === customers_1.customers.REV_ROBOTICS[environment].cosmosFrontUrl
42
- || hostname === customers_1.customers.REV_ROBOTICS[environment].cosmosBackUrl
43
- || hostname === customers_1.customers.REV_ROBOTICS[environment].cosmosFrontAnimationsUrl)) {
44
- return customers_1.customers.REV_ROBOTICS[environment][key];
45
- ///////// CREATEC /////////
46
- }
47
- else if (customers_1.customers.CREATEC[environment]
48
- && typeof customers_1.customers.CREATEC[environment][key] !== 'undefined'
49
- && (hostname === customers_1.customers.CREATEC[environment].cosmosFrontUrl
50
- || hostname === customers_1.customers.CREATEC[environment].cosmosBackUrl
51
- || hostname === customers_1.customers.CREATEC[environment].cosmosFrontAnimationsUrl)) {
52
- return customers_1.customers.CREATEC[environment][key];
53
- ///////// FIFA /////////
54
- }
55
- else if (customers_1.customers.FIFA[environment]
56
- && typeof customers_1.customers.FIFA[environment][key] !== 'undefined'
57
- && (hostname === customers_1.customers.FIFA[environment].cosmosFrontUrl
58
- || hostname === customers_1.customers.FIFA[environment].cosmosBackUrl
59
- || hostname === customers_1.customers.FIFA[environment].cosmosFrontAnimationsUrl)) {
60
- return customers_1.customers.FIFA[environment][key];
61
- ///////// FIFA FOUNDATION /////////
62
- }
63
- else if (customers_1.customers.FIFA_FOUNDATION[environment]
64
- && typeof customers_1.customers.FIFA_FOUNDATION[environment][key] !== 'undefined'
65
- && (hostname === customers_1.customers.FIFA_FOUNDATION[environment].cosmosFrontUrl
66
- || hostname === customers_1.customers.FIFA_FOUNDATION[environment].cosmosBackUrl
67
- || hostname === customers_1.customers.FIFA_FOUNDATION[environment].cosmosFrontAnimationsUrl)) {
68
- return customers_1.customers.FIFA_FOUNDATION[environment][key];
69
- ///////// CREABOTS /////////
70
- }
71
- else if (customers_1.customers.CREABOTS[environment]
72
- && typeof customers_1.customers.CREABOTS[environment][key] !== 'undefined'
73
- && (hostname === customers_1.customers.CREABOTS[environment].cosmosFrontUrl
74
- || hostname === customers_1.customers.CREABOTS[environment].cosmosBackUrl
75
- || hostname === customers_1.customers.CREABOTS[environment].cosmosFrontAnimationsUrl)) {
76
- return customers_1.customers.CREABOTS[environment][key];
77
- ///////// CREABOTS_LANDING /////////
78
- }
79
- else if (customers_1.customers.CREABOTS_LANDING[environment]
80
- && typeof customers_1.customers.CREABOTS_LANDING[environment][key] !== 'undefined'
81
- && (hostname === customers_1.customers.CREABOTS_LANDING[environment].cosmosFrontUrl
82
- || hostname === customers_1.customers.CREABOTS_LANDING[environment].cosmosBackUrl
83
- || hostname === customers_1.customers.CREABOTS_LANDING[environment].cosmosFrontAnimationsUrl)) {
84
- return customers_1.customers.CREABOTS_LANDING[environment][key];
85
- ///////// DEFAULT /////////
86
- }
87
- else if (customers_1.customers.DEFAULT.development && typeof customers_1.customers.DEFAULT.development[key] !== 'undefined') {
88
- return customers_1.customers.DEFAULT.development[key];
89
- }
90
- else {
91
- return '';
92
- }
93
- };
94
- exports.getCosmos = getCosmos;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCosmos = void 0;
4
+ const customers_1 = require("./customers");
5
+ const env = process.env.NODE_ENV;
6
+ const getCosmos = (key, domain = '', newEnv = '') => {
7
+ const environment = (newEnv) ? newEnv : ((env) ? env : 'production');
8
+ const hostname = (domain) ? domain : ((typeof window !== 'undefined') ? window.location.hostname : '');
9
+ ///////// EDUCABOT /////////
10
+ if (customers_1.customers.EDUCABOT[environment]
11
+ && typeof customers_1.customers.EDUCABOT[environment][key] !== 'undefined'
12
+ && (hostname === 'localhost'
13
+ || hostname === customers_1.customers.EDUCABOT[environment].cosmosFrontUrl
14
+ || hostname === customers_1.customers.EDUCABOT[environment].cosmosBackUrl
15
+ || hostname === customers_1.customers.EDUCABOT[environment].cosmosFrontAnimationsUrl
16
+ || hostname === customers_1.customers.EDUCABOT[environment].cosmosFrontGamesUrl
17
+ // hostname.includes(customers.EDUCABOT[environment].cosmosFrontUrl || hostname === 'localhost')
18
+ // || hostname.includes(customers.EDUCABOT[environment].cosmosBackUrl || hostname === 'localhost')
19
+ )) {
20
+ return customers_1.customers.EDUCABOT[environment][key];
21
+ ///////// CODIT /////////
22
+ }
23
+ else if (customers_1.customers.CODIT[environment]
24
+ && typeof customers_1.customers.CODIT[environment][key] !== 'undefined'
25
+ && (hostname === customers_1.customers.CODIT[environment].cosmosFrontUrl
26
+ || hostname === customers_1.customers.CODIT[environment].cosmosBackUrl
27
+ || hostname === customers_1.customers.CODIT[environment].cosmosFrontAnimationsUrl)) {
28
+ return customers_1.customers.CODIT[environment][key];
29
+ ///////// COPA_ROBOTICA /////////
30
+ }
31
+ else if (customers_1.customers.COPA_ROBOTICA[environment]
32
+ && typeof customers_1.customers.COPA_ROBOTICA[environment][key] !== 'undefined'
33
+ && (hostname === customers_1.customers.COPA_ROBOTICA[environment].cosmosFrontUrl
34
+ || hostname === customers_1.customers.COPA_ROBOTICA[environment].cosmosBackUrl
35
+ || hostname === customers_1.customers.COPA_ROBOTICA[environment].cosmosFrontAnimationsUrl)) {
36
+ return customers_1.customers.COPA_ROBOTICA[environment][key];
37
+ ///////// REV_ROBOTICS /////////
38
+ }
39
+ else if (customers_1.customers.REV_ROBOTICS[environment]
40
+ && typeof customers_1.customers.REV_ROBOTICS[environment][key] !== 'undefined'
41
+ && (hostname === customers_1.customers.REV_ROBOTICS[environment].cosmosFrontUrl
42
+ || hostname === customers_1.customers.REV_ROBOTICS[environment].cosmosBackUrl
43
+ || hostname === customers_1.customers.REV_ROBOTICS[environment].cosmosFrontAnimationsUrl)) {
44
+ return customers_1.customers.REV_ROBOTICS[environment][key];
45
+ ///////// CREATEC /////////
46
+ }
47
+ else if (customers_1.customers.CREATEC[environment]
48
+ && typeof customers_1.customers.CREATEC[environment][key] !== 'undefined'
49
+ && (hostname === customers_1.customers.CREATEC[environment].cosmosFrontUrl
50
+ || hostname === customers_1.customers.CREATEC[environment].cosmosBackUrl
51
+ || hostname === customers_1.customers.CREATEC[environment].cosmosFrontAnimationsUrl)) {
52
+ return customers_1.customers.CREATEC[environment][key];
53
+ ///////// FIFA /////////
54
+ }
55
+ else if (customers_1.customers.FIFA[environment]
56
+ && typeof customers_1.customers.FIFA[environment][key] !== 'undefined'
57
+ && (hostname === customers_1.customers.FIFA[environment].cosmosFrontUrl
58
+ || hostname === customers_1.customers.FIFA[environment].cosmosBackUrl
59
+ || hostname === customers_1.customers.FIFA[environment].cosmosFrontAnimationsUrl)) {
60
+ return customers_1.customers.FIFA[environment][key];
61
+ ///////// FIFA FOUNDATION /////////
62
+ }
63
+ else if (customers_1.customers.FIFA_FOUNDATION[environment]
64
+ && typeof customers_1.customers.FIFA_FOUNDATION[environment][key] !== 'undefined'
65
+ && (hostname === customers_1.customers.FIFA_FOUNDATION[environment].cosmosFrontUrl
66
+ || hostname === customers_1.customers.FIFA_FOUNDATION[environment].cosmosBackUrl
67
+ || hostname === customers_1.customers.FIFA_FOUNDATION[environment].cosmosFrontAnimationsUrl)) {
68
+ return customers_1.customers.FIFA_FOUNDATION[environment][key];
69
+ ///////// CREABOTS /////////
70
+ }
71
+ else if (customers_1.customers.CREABOTS[environment]
72
+ && typeof customers_1.customers.CREABOTS[environment][key] !== 'undefined'
73
+ && (hostname === customers_1.customers.CREABOTS[environment].cosmosFrontUrl
74
+ || hostname === customers_1.customers.CREABOTS[environment].cosmosBackUrl
75
+ || hostname === customers_1.customers.CREABOTS[environment].cosmosFrontAnimationsUrl)) {
76
+ return customers_1.customers.CREABOTS[environment][key];
77
+ ///////// CREABOTS_LANDING /////////
78
+ }
79
+ else if (customers_1.customers.CREABOTS_LANDING[environment]
80
+ && typeof customers_1.customers.CREABOTS_LANDING[environment][key] !== 'undefined'
81
+ && (hostname === customers_1.customers.CREABOTS_LANDING[environment].cosmosFrontUrl
82
+ || hostname === customers_1.customers.CREABOTS_LANDING[environment].cosmosBackUrl
83
+ || hostname === customers_1.customers.CREABOTS_LANDING[environment].cosmosFrontAnimationsUrl)) {
84
+ return customers_1.customers.CREABOTS_LANDING[environment][key];
85
+ ///////// DEFAULT /////////
86
+ }
87
+ else if (customers_1.customers.DEFAULT.development && typeof customers_1.customers.DEFAULT.development[key] !== 'undefined') {
88
+ return customers_1.customers.DEFAULT.development[key];
89
+ }
90
+ else {
91
+ return '';
92
+ }
93
+ };
94
+ exports.getCosmos = getCosmos;
95
95
  //# sourceMappingURL=cosmos.js.map