@digipair/skill-web 0.5.15 → 0.6.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/index.cjs.js CHANGED
@@ -23510,14 +23510,14 @@ function indent(str, spaces) {
23510
23510
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
23511
23511
  // match is required
23512
23512
  if (!match) {
23513
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, {
23513
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
23514
23514
  v: nextMatch1
23515
23515
  };
23516
23516
  }
23517
23517
  var token = match.token, offset = match.offset;
23518
23518
  i1 += offset;
23519
23519
  if (token === " ") {
23520
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23520
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
23521
23521
  }
23522
23522
  tokens1 = _to_consumable_array$1(tokens1).concat([
23523
23523
  token
@@ -23536,7 +23536,7 @@ function indent(str, spaces) {
23536
23536
  if (contextKeys.some(function(el) {
23537
23537
  return el.startsWith(name);
23538
23538
  })) {
23539
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23539
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
23540
23540
  }
23541
23541
  if (dateTimeIdentifiers.some(function(el) {
23542
23542
  return el === name;
@@ -23555,9 +23555,9 @@ function indent(str, spaces) {
23555
23555
  if (dateTimeIdentifiers.some(function(el) {
23556
23556
  return el.startsWith(name);
23557
23557
  })) {
23558
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23558
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
23559
23559
  }
23560
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, {
23560
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
23561
23561
  v: nextMatch1
23562
23562
  };
23563
23563
  };
@@ -27495,16 +27495,14 @@ let WebService = class WebService {
27495
27495
  }
27496
27496
  async page(params, _pinsSettingsList, context) {
27497
27497
  var _context_request_body;
27498
- const { body, data = [], title = 'Digipair', favicon = 'https://www.digipair.ai/assets/images/favicon.ico', styleHtml = '', styleBody = '', baseUrl = 'https://cdn.jsdelivr.net/npm', libraries = {} } = params;
27498
+ const { body, title = 'Digipair', favicon = 'https://www.digipair.ai/assets/images/favicon.ico', styleHtml = '', styleBody = '', baseUrl = 'https://cdn.jsdelivr.net/npm', libraries = {}, factoryInitialize = [], browserInitialize = [] } = params;
27499
27499
  const engineVersion = libraries['@digipair/engine'] || 'latest';
27500
27500
  const preparedData = {};
27501
27501
  if (context.request.method === 'POST' && ((_context_request_body = context.request.body) == null ? void 0 : _context_request_body.type) === 'DIGIPAIR_EXECUTE_FACTORY') {
27502
27502
  const pinsSettingsList = this.findFactoryPinsSettings(context.request.body.params.path, body);
27503
27503
  return await executePinsList(pinsSettingsList, _extends({}, context.request.body.context, context));
27504
27504
  }
27505
- for (const item of data){
27506
- preparedData[item.name] = await executePinsList(item.value, context);
27507
- }
27505
+ await executePinsList(factoryInitialize, context);
27508
27506
  const preparedBody = body.map((item, index)=>this.filteredWebPinsSettings(item, `body[${index}]`));
27509
27507
  const html = `
27510
27508
  <!DOCTYPE html>
@@ -27516,7 +27514,7 @@ let WebService = class WebService {
27516
27514
  </head>
27517
27515
  <body style="${styleBody}">
27518
27516
  <script type="module">
27519
- import { config, generateElementFromPins } from '${baseUrl}/@digipair/engine@${engineVersion}/index.esm.js';
27517
+ import { config, executePinsList, generateElementFromPins } from '${baseUrl}/@digipair/engine@${engineVersion}/index.esm.js';
27520
27518
 
27521
27519
  const skillWeb = {
27522
27520
  executeFactory: async (params, pinsSettingsList, context) => {
@@ -27529,7 +27527,18 @@ let WebService = class WebService {
27529
27527
  });
27530
27528
 
27531
27529
  return await result.json();
27532
- }
27530
+ },
27531
+ requestUpdate: async (params, pinsSettingsList, context) => {
27532
+ const { selector } = params;
27533
+
27534
+ const elements = document.querySelectorAll(selector);
27535
+ for (let i = 0; i < elements.length; i++) {
27536
+ const element = elements[i];
27537
+ element.requestUpdate();
27538
+ }
27539
+
27540
+ return null;
27541
+ },
27533
27542
  };
27534
27543
 
27535
27544
  config.set('LIBRARIES', { '@digipair/skill-web': skillWeb, ...${JSON.stringify(libraries)} });
@@ -27542,6 +27551,9 @@ let WebService = class WebService {
27542
27551
  const options = {
27543
27552
  libraries: {},
27544
27553
  };
27554
+
27555
+ await executePinsList(${JSON.stringify(browserInitialize)}, context);
27556
+
27545
27557
  const pinsList = ${JSON.stringify(preparedBody)};
27546
27558
  for (let i = 0; i < pinsList.length; i++) {
27547
27559
  const item = pinsList[i];
package/index.esm.js CHANGED
@@ -23488,14 +23488,14 @@ function indent(str, spaces) {
23488
23488
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
23489
23489
  // match is required
23490
23490
  if (!match) {
23491
- return nextMatch = nextMatch1, i = i1, tokens = tokens1, {
23491
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, {
23492
23492
  v: nextMatch1
23493
23493
  };
23494
23494
  }
23495
23495
  var token = match.token, offset = match.offset;
23496
23496
  i1 += offset;
23497
23497
  if (token === " ") {
23498
- return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
23498
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
23499
23499
  }
23500
23500
  tokens1 = _to_consumable_array$1(tokens1).concat([
23501
23501
  token
@@ -23514,7 +23514,7 @@ function indent(str, spaces) {
23514
23514
  if (contextKeys.some(function(el) {
23515
23515
  return el.startsWith(name);
23516
23516
  })) {
23517
- return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
23517
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
23518
23518
  }
23519
23519
  if (dateTimeIdentifiers.some(function(el) {
23520
23520
  return el === name;
@@ -23533,9 +23533,9 @@ function indent(str, spaces) {
23533
23533
  if (dateTimeIdentifiers.some(function(el) {
23534
23534
  return el.startsWith(name);
23535
23535
  })) {
23536
- return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
23536
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
23537
23537
  }
23538
- return nextMatch = nextMatch1, i = i1, tokens = tokens1, {
23538
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, {
23539
23539
  v: nextMatch1
23540
23540
  };
23541
23541
  };
@@ -27473,16 +27473,14 @@ let WebService = class WebService {
27473
27473
  }
27474
27474
  async page(params, _pinsSettingsList, context) {
27475
27475
  var _context_request_body;
27476
- const { body, data = [], title = 'Digipair', favicon = 'https://www.digipair.ai/assets/images/favicon.ico', styleHtml = '', styleBody = '', baseUrl = 'https://cdn.jsdelivr.net/npm', libraries = {} } = params;
27476
+ const { body, title = 'Digipair', favicon = 'https://www.digipair.ai/assets/images/favicon.ico', styleHtml = '', styleBody = '', baseUrl = 'https://cdn.jsdelivr.net/npm', libraries = {}, factoryInitialize = [], browserInitialize = [] } = params;
27477
27477
  const engineVersion = libraries['@digipair/engine'] || 'latest';
27478
27478
  const preparedData = {};
27479
27479
  if (context.request.method === 'POST' && ((_context_request_body = context.request.body) == null ? void 0 : _context_request_body.type) === 'DIGIPAIR_EXECUTE_FACTORY') {
27480
27480
  const pinsSettingsList = this.findFactoryPinsSettings(context.request.body.params.path, body);
27481
27481
  return await executePinsList(pinsSettingsList, _extends({}, context.request.body.context, context));
27482
27482
  }
27483
- for (const item of data){
27484
- preparedData[item.name] = await executePinsList(item.value, context);
27485
- }
27483
+ await executePinsList(factoryInitialize, context);
27486
27484
  const preparedBody = body.map((item, index)=>this.filteredWebPinsSettings(item, `body[${index}]`));
27487
27485
  const html = `
27488
27486
  <!DOCTYPE html>
@@ -27494,7 +27492,7 @@ let WebService = class WebService {
27494
27492
  </head>
27495
27493
  <body style="${styleBody}">
27496
27494
  <script type="module">
27497
- import { config, generateElementFromPins } from '${baseUrl}/@digipair/engine@${engineVersion}/index.esm.js';
27495
+ import { config, executePinsList, generateElementFromPins } from '${baseUrl}/@digipair/engine@${engineVersion}/index.esm.js';
27498
27496
 
27499
27497
  const skillWeb = {
27500
27498
  executeFactory: async (params, pinsSettingsList, context) => {
@@ -27507,7 +27505,18 @@ let WebService = class WebService {
27507
27505
  });
27508
27506
 
27509
27507
  return await result.json();
27510
- }
27508
+ },
27509
+ requestUpdate: async (params, pinsSettingsList, context) => {
27510
+ const { selector } = params;
27511
+
27512
+ const elements = document.querySelectorAll(selector);
27513
+ for (let i = 0; i < elements.length; i++) {
27514
+ const element = elements[i];
27515
+ element.requestUpdate();
27516
+ }
27517
+
27518
+ return null;
27519
+ },
27511
27520
  };
27512
27521
 
27513
27522
  config.set('LIBRARIES', { '@digipair/skill-web': skillWeb, ...${JSON.stringify(libraries)} });
@@ -27520,6 +27529,9 @@ let WebService = class WebService {
27520
27529
  const options = {
27521
27530
  libraries: {},
27522
27531
  };
27532
+
27533
+ await executePinsList(${JSON.stringify(browserInitialize)}, context);
27534
+
27523
27535
  const pinsList = ${JSON.stringify(preparedBody)};
27524
27536
  for (let i = 0; i < pinsList.length; i++) {
27525
27537
  const item = pinsList[i];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-web",
3
- "version": "0.5.15",
3
+ "version": "0.6.0",
4
4
  "dependencies": {},
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./index.esm.js"
package/schema.json CHANGED
@@ -29,6 +29,25 @@
29
29
  }
30
30
  ]
31
31
  }
32
+ },
33
+ "/requestUpdate": {
34
+ "post": {
35
+ "summary": "Mettre à jour les composants web",
36
+ "description": "Mettre à jour un composant web",
37
+ "tags": ["web"],
38
+ "metadata": [],
39
+ "parameters": [
40
+ {
41
+ "name": "selector",
42
+ "summary": "Sélecteur CSS",
43
+ "required": true,
44
+ "description": "Sélecteur CSS permettant de sélectionner les composants à mettre à jour",
45
+ "schema": {
46
+ "type": "string"
47
+ }
48
+ }
49
+ ]
50
+ }
32
51
  }
33
52
  },
34
53
  "components": {
@@ -73,18 +92,6 @@
73
92
  }
74
93
  }
75
94
  },
76
- {
77
- "name": "data",
78
- "summary": "Préparation des données depuis la factory",
79
- "required": false,
80
- "description": "Préparation des données backend à envoyer à la page",
81
- "schema": {
82
- "type": "array",
83
- "items": {
84
- "$ref": "#/components/schemas/dataAttribute"
85
- }
86
- }
87
- },
88
95
  {
89
96
  "name": "title",
90
97
  "summary": "Titre",
@@ -120,6 +127,30 @@
120
127
  "schema": {
121
128
  "type": "string"
122
129
  }
130
+ },
131
+ {
132
+ "name": "factoryInitialize",
133
+ "summary": "Lors de la l'initialisation coté factory",
134
+ "required": false,
135
+ "description": "Action déclenchée lors de l'initialisation coté factory",
136
+ "schema": {
137
+ "type": "array",
138
+ "items": {
139
+ "$ref": "https://www.pinser.world/schemas/pinsSettings"
140
+ }
141
+ }
142
+ },
143
+ {
144
+ "name": "browserInitialize",
145
+ "summary": "Lors de la l'initialisation coté navigateur",
146
+ "required": false,
147
+ "description": "Action déclenchée lors de l'initialisation coté navigateur",
148
+ "schema": {
149
+ "type": "array",
150
+ "items": {
151
+ "$ref": "https://www.pinser.world/schemas/pinsSettings"
152
+ }
153
+ }
123
154
  }
124
155
  ]
125
156
  }