@digipair/skill-web-interact 0.8.44 → 0.8.46

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
@@ -30,6 +30,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
30
30
  detail
31
31
  }));
32
32
  }
33
+ async execute(params, _pinsSettingsList, _context) {
34
+ const { selector, name, args = [] } = params;
35
+ const element = document.querySelector(selector);
36
+ element[name](...args);
37
+ }
33
38
  async goTo(params, _pinsSettingsList, _context) {
34
39
  const { url } = params;
35
40
  window.location.href = url;
@@ -38,9 +43,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
38
43
  const setAttribute = (params, pinsSettingsList, context)=>new DomService().setAttribute(params, pinsSettingsList, context);
39
44
  const getAttribute = (params, pinsSettingsList, context)=>new DomService().getAttribute(params, pinsSettingsList, context);
40
45
  const dispatchEvent = (params, pinsSettingsList, context)=>new DomService().dispatchEvent(params, pinsSettingsList, context);
46
+ const execute = (params, pinsSettingsList, context)=>new DomService().execute(params, pinsSettingsList, context);
41
47
  const goTo = (params, pinsSettingsList, context)=>new DomService().goTo(params, pinsSettingsList, context);
42
48
 
43
49
  exports.dispatchEvent = dispatchEvent;
50
+ exports.execute = execute;
44
51
  exports.getAttribute = getAttribute;
45
52
  exports.goTo = goTo;
46
53
  exports.setAttribute = setAttribute;
package/index.esm.js CHANGED
@@ -26,6 +26,11 @@
26
26
  detail
27
27
  }));
28
28
  }
29
+ async execute(params, _pinsSettingsList, _context) {
30
+ const { selector, name, args = [] } = params;
31
+ const element = document.querySelector(selector);
32
+ element[name](...args);
33
+ }
29
34
  async goTo(params, _pinsSettingsList, _context) {
30
35
  const { url } = params;
31
36
  window.location.href = url;
@@ -34,6 +39,7 @@
34
39
  const setAttribute = (params, pinsSettingsList, context)=>new DomService().setAttribute(params, pinsSettingsList, context);
35
40
  const getAttribute = (params, pinsSettingsList, context)=>new DomService().getAttribute(params, pinsSettingsList, context);
36
41
  const dispatchEvent = (params, pinsSettingsList, context)=>new DomService().dispatchEvent(params, pinsSettingsList, context);
42
+ const execute = (params, pinsSettingsList, context)=>new DomService().execute(params, pinsSettingsList, context);
37
43
  const goTo = (params, pinsSettingsList, context)=>new DomService().goTo(params, pinsSettingsList, context);
38
44
 
39
- export { dispatchEvent, getAttribute, goTo, setAttribute };
45
+ export { dispatchEvent, execute, getAttribute, goTo, setAttribute };
@@ -2,4 +2,5 @@ import { PinsSettings } from '@digipair/engine';
2
2
  export declare const setAttribute: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
3
3
  export declare const getAttribute: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
4
4
  export declare const dispatchEvent: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
5
+ export declare const execute: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
5
6
  export declare const goTo: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-web-interact",
3
- "version": "0.8.44",
3
+ "version": "0.8.46",
4
4
  "dependencies": {},
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./index.esm.js"
package/schema.json CHANGED
@@ -110,6 +110,46 @@
110
110
  "x-events": []
111
111
  }
112
112
  },
113
+ "/execute": {
114
+ "post": {
115
+ "tags": ["web", "boost"],
116
+ "summary": "Execute une méthode",
117
+ "description": "Execute une méthode sur un élément du DOM",
118
+ "parameters": [
119
+ {
120
+ "name": "name",
121
+ "summary": "Nom de la méthode",
122
+ "required": true,
123
+ "description": "Nom de l'évènement",
124
+ "schema": {
125
+ "type": "string"
126
+ }
127
+ },
128
+ {
129
+ "name": "selector",
130
+ "summary": "Sélecteur CSS de l'élément",
131
+ "required": true,
132
+ "description": "Sélecteur CSS de l'élément qui va exécuter la méthode",
133
+ "schema": {
134
+ "type": "string"
135
+ }
136
+ },
137
+ {
138
+ "name": "args",
139
+ "summary": "Arguments",
140
+ "required": false,
141
+ "description": "Liste des arguments de la méthode",
142
+ "schema": {
143
+ "type": "array",
144
+ "items": {
145
+ "type": "object"
146
+ }
147
+ }
148
+ }
149
+ ],
150
+ "x-events": []
151
+ }
152
+ },
113
153
  "/goTo": {
114
154
  "post": {
115
155
  "tags": ["web", "boost"],