@digipair/skill-web 0.65.11 → 0.66.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
@@ -10956,7 +10956,7 @@ let WebService = class WebService {
10956
10956
  }
10957
10957
  async page(params, _pinsSettingsList, context) {
10958
10958
  var _context_request_body;
10959
- const { body, head, ssr = true, styleHtml = '', styleBody = '', factoryInitialize = [], browserInitialize = [], browserLoad = [] } = params;
10959
+ const { body, head, ssr = true, styleHtml = '', styleBody = '', factoryInitialize = [], browserInitialize = [], browserLoad = [], confirmBeforeUnload = [] } = params;
10960
10960
  const engineVersion = context.config.VERSIONS['@digipair/engine'] || 'latest';
10961
10961
  const preparedData = {};
10962
10962
  if (context.request.params[0] === '__digipair_www__') {
@@ -11068,6 +11068,15 @@ let WebService = class WebService {
11068
11068
  setTimeout(async () => {
11069
11069
  await executePinsList(${JSON.stringify(this.prepareBrowserPinsSettings('browserLoad', browserLoad))}, context);
11070
11070
  }, 1);
11071
+
11072
+ window.addEventListener('beforeunload', function (event) {
11073
+ const showConfirmationMessage = await executePinsList(${JSON.stringify(this.prepareBrowserPinsSettings('confirmBeforeUnload', confirmBeforeUnload))}, context);
11074
+
11075
+ if (showConfirmationMessage) {
11076
+ event.preventDefault();
11077
+ event.returnValue = '';
11078
+ }
11079
+ });
11071
11080
  </script>
11072
11081
 
11073
11082
  ${ssr ? await this.pins2html(body, context) : ''}
package/index.esm.js CHANGED
@@ -23903,14 +23903,14 @@ function indent(str, spaces) {
23903
23903
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
23904
23904
  // match is required
23905
23905
  if (!match) {
23906
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
23906
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, {
23907
23907
  v: nextMatch1
23908
23908
  };
23909
23909
  }
23910
23910
  var token = match.token, offset = match.offset;
23911
23911
  i1 += offset;
23912
23912
  if (token === " ") {
23913
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
23913
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
23914
23914
  }
23915
23915
  tokens1 = _to_consumable_array$1(tokens1).concat([
23916
23916
  token
@@ -23929,7 +23929,7 @@ function indent(str, spaces) {
23929
23929
  if (contextKeys.some(function(el) {
23930
23930
  return el.startsWith(name);
23931
23931
  })) {
23932
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
23932
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
23933
23933
  }
23934
23934
  if (dateTimeIdentifiers.some(function(el) {
23935
23935
  return el === name;
@@ -23948,9 +23948,9 @@ function indent(str, spaces) {
23948
23948
  if (dateTimeIdentifiers.some(function(el) {
23949
23949
  return el.startsWith(name);
23950
23950
  })) {
23951
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
23951
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
23952
23952
  }
23953
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
23953
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, {
23954
23954
  v: nextMatch1
23955
23955
  };
23956
23956
  };
@@ -38988,7 +38988,7 @@ let WebService = class WebService {
38988
38988
  }
38989
38989
  async page(params, _pinsSettingsList, context) {
38990
38990
  var _context_request_body;
38991
- const { body, head, ssr = true, styleHtml = '', styleBody = '', factoryInitialize = [], browserInitialize = [], browserLoad = [] } = params;
38991
+ const { body, head, ssr = true, styleHtml = '', styleBody = '', factoryInitialize = [], browserInitialize = [], browserLoad = [], confirmBeforeUnload = [] } = params;
38992
38992
  const engineVersion = context.config.VERSIONS['@digipair/engine'] || 'latest';
38993
38993
  const preparedData = {};
38994
38994
  if (context.request.params[0] === '__digipair_www__') {
@@ -39100,6 +39100,15 @@ let WebService = class WebService {
39100
39100
  setTimeout(async () => {
39101
39101
  await executePinsList(${JSON.stringify(this.prepareBrowserPinsSettings('browserLoad', browserLoad))}, context);
39102
39102
  }, 1);
39103
+
39104
+ window.addEventListener('beforeunload', function (event) {
39105
+ const showConfirmationMessage = await executePinsList(${JSON.stringify(this.prepareBrowserPinsSettings('confirmBeforeUnload', confirmBeforeUnload))}, context);
39106
+
39107
+ if (showConfirmationMessage) {
39108
+ event.preventDefault();
39109
+ event.returnValue = '';
39110
+ }
39111
+ });
39103
39112
  </script>
39104
39113
 
39105
39114
  ${ssr ? await this.pins2html(body, context) : ''}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-web",
3
- "version": "0.65.11",
3
+ "version": "0.66.0",
4
4
  "dependencies": {
5
5
  "jsdom": "^25.0.1"
6
6
  },
package/schema.fr.json CHANGED
@@ -127,6 +127,18 @@
127
127
  "$ref": "https://schemas.digipair.ai/pinsSettings"
128
128
  }
129
129
  }
130
+ },
131
+ {
132
+ "name": "confirmBeforeUnload",
133
+ "summary": "Confirmation avant de quitter",
134
+ "required": false,
135
+ "description": "Message de confirmation avant de quitter la page",
136
+ "schema": {
137
+ "type": "array",
138
+ "items": {
139
+ "$ref": "https://schemas.digipair.ai/pinsSettings"
140
+ }
141
+ }
130
142
  }
131
143
  ]
132
144
  }
package/schema.json CHANGED
@@ -127,6 +127,18 @@
127
127
  "$ref": "https://schemas.digipair.ai/pinsSettings"
128
128
  }
129
129
  }
130
+ },
131
+ {
132
+ "name": "confirmBeforeUnload",
133
+ "summary": "Confirmation before leaving the page",
134
+ "required": false,
135
+ "description": "Confirmation message before leaving the page",
136
+ "schema": {
137
+ "type": "array",
138
+ "items": {
139
+ "$ref": "https://schemas.digipair.ai/pinsSettings"
140
+ }
141
+ }
130
142
  }
131
143
  ]
132
144
  }