@digipair/skill-web 0.4.2 → 0.4.5

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/index.cjs.js CHANGED
@@ -4,8 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  /* eslint-disable @typescript-eslint/no-unused-vars */ let WebService = class WebService {
6
6
  async page(params, _pinsSettingsList, context) {
7
- const { body, title = 'Digipair' } = params;
8
- const BASE_URL = 'https://cdn.jsdelivr.net/npm';
7
+ const { body, title = 'Digipair', baseUrl = 'https://cdn.jsdelivr.net/npm', libraries = {} } = params;
9
8
  const html = `
10
9
  <!DOCTYPE html>
11
10
  <html>
@@ -15,8 +14,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
15
14
  </head>
16
15
  <body>
17
16
  <script type="module">
18
- // import { generateElementFromPins } from '${BASE_URL}/@digipair/engine/index.esm.js';
19
- import { generateElementFromPins } from 'http://localhost:4000/engine/index.esm.js';
17
+ import { config, generateElementFromPins } from '${baseUrl}/@digipair/engine/index.esm.js';
18
+
19
+ config.set('LIBRARIES', ${JSON.stringify(libraries)});
20
+ config.set('BASE_URL', '${baseUrl}');
20
21
 
21
22
  const context = {
22
23
  variables: ${JSON.stringify(context.variables || {})},
package/index.esm.js CHANGED
@@ -1,7 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-unused-vars */ let WebService = class WebService {
2
2
  async page(params, _pinsSettingsList, context) {
3
- const { body, title = 'Digipair' } = params;
4
- const BASE_URL = 'https://cdn.jsdelivr.net/npm';
3
+ const { body, title = 'Digipair', baseUrl = 'https://cdn.jsdelivr.net/npm', libraries = {} } = params;
5
4
  const html = `
6
5
  <!DOCTYPE html>
7
6
  <html>
@@ -11,8 +10,10 @@
11
10
  </head>
12
11
  <body>
13
12
  <script type="module">
14
- // import { generateElementFromPins } from '${BASE_URL}/@digipair/engine/index.esm.js';
15
- import { generateElementFromPins } from 'http://localhost:4000/engine/index.esm.js';
13
+ import { config, generateElementFromPins } from '${baseUrl}/@digipair/engine/index.esm.js';
14
+
15
+ config.set('LIBRARIES', ${JSON.stringify(libraries)});
16
+ config.set('BASE_URL', '${baseUrl}');
16
17
 
17
18
  const context = {
18
19
  variables: ${JSON.stringify(context.variables || {})},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-web",
3
- "version": "0.4.2",
3
+ "version": "0.4.5",
4
4
  "dependencies": {},
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./index.esm.js"
package/schema.json CHANGED
@@ -37,6 +37,24 @@
37
37
  "schema": {
38
38
  "type": "string"
39
39
  }
40
+ },
41
+ {
42
+ "name": "baseUrl",
43
+ "summary": "Adresse des librairies",
44
+ "required": false,
45
+ "description": "Adresse de base des librairies front",
46
+ "schema": {
47
+ "type": "string"
48
+ }
49
+ },
50
+ {
51
+ "name": "libraries",
52
+ "summary": "Librairies",
53
+ "required": false,
54
+ "description": "Liste des libraries front à charger",
55
+ "schema": {
56
+ "type": "object"
57
+ }
40
58
  }
41
59
  ]
42
60
  }