@digipair/skill-web 0.66.2 → 0.66.4

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 = [], confirmBeforeUnload = [] } = params;
10959
+ const { body, head, ssr = true, styleHtml = '', styleBody = '', factoryInitialize = [], browserInitialize = [], browserLoad = [], confirmBeforeUnload = 'false' } = 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', (event) => {
11073
+ const showConfirmationMessage = applyTemplate('EVALUATE:' + ${JSON.stringify(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
@@ -27880,12 +27880,12 @@ const applyTemplate = (value, context)=>{
27880
27880
  };
27881
27881
  const executePins = async (settingsOrigin, context = {})=>{
27882
27882
  var _settings_conditions, _settings_conditions1;
27883
- let settings = await preparePinsSettings(settingsOrigin, context);
27883
+ let settings = preparePinsSettings(settingsOrigin, context);
27884
27884
  const alias = _config.ALIAS.find((alias)=>settings.library.split(':')[0] === alias.name);
27885
27885
  const config = context.config || {};
27886
27886
  let version = (config.VERSIONS || {})[settings.library] || 'latest';
27887
27887
  if (alias) {
27888
- settings = await preparePinsSettings(_extends({}, settings, alias), {
27888
+ settings = preparePinsSettings(_extends({}, settings, alias), {
27889
27889
  settings: _extends({}, settings, {
27890
27890
  version,
27891
27891
  library: settings.library.substring(alias.name.length + 1)
@@ -27912,7 +27912,7 @@ const executePins = async (settingsOrigin, context = {})=>{
27912
27912
  parent: context.parent
27913
27913
  }
27914
27914
  });
27915
- const itemSettings = await preparePinsSettings(itemSettingsOrigin, itemContext);
27915
+ const itemSettings = preparePinsSettings(itemSettingsOrigin, itemContext);
27916
27916
  if (typeof ((_itemSettings_conditions = itemSettings.conditions) == null ? void 0 : _itemSettings_conditions.if) !== 'undefined' && !itemSettings.conditions.if) {
27917
27917
  continue;
27918
27918
  }
@@ -27941,7 +27941,6 @@ const executePins = async (settingsOrigin, context = {})=>{
27941
27941
  };
27942
27942
  const executePinsList = async (pinsSettingsList, context)=>{
27943
27943
  let previous = {};
27944
- // parcourir tous les pins
27945
27944
  for(let i = 0; i < pinsSettingsList.length; i++){
27946
27945
  const settings = pinsSettingsList[i];
27947
27946
  try {
@@ -27965,10 +27964,10 @@ const generateElementFromPins = async (pinsSettings, parent, context, document =
27965
27964
  import: true
27966
27965
  })=>{
27967
27966
  var _settings_conditions, _settings_conditions1;
27968
- let settings = await preparePinsSettings(pinsSettings, context);
27967
+ let settings = preparePinsSettings(pinsSettings, context);
27969
27968
  const alias = _config.ALIAS.find((alias)=>settings.library.split(':')[0] === alias.name);
27970
27969
  if (alias) {
27971
- settings = await preparePinsSettings(_extends({}, settings, alias), {
27970
+ settings = preparePinsSettings(_extends({}, settings, alias), {
27972
27971
  settings
27973
27972
  });
27974
27973
  }
@@ -28035,14 +28034,14 @@ const generateElementFromPins = async (pinsSettings, parent, context, document =
28035
28034
  }
28036
28035
  return element;
28037
28036
  };
28038
- const preparePinsSettings = async (settings, context)=>{
28037
+ const preparePinsSettings = (settings, context)=>{
28039
28038
  const localContext = _extends({}, context, {
28040
28039
  variables: context.variables || {},
28041
28040
  conditions: context.conditions || {}
28042
28041
  });
28043
28042
  const conditions = {};
28044
28043
  for (const [key, value] of Object.entries(settings.conditions || {})){
28045
- conditions[key] = await applyTemplate(value, localContext);
28044
+ conditions[key] = applyTemplate(value, localContext);
28046
28045
  }
28047
28046
  const properties = {};
28048
28047
  for (const [key, value] of Object.entries(settings.properties || {})){
@@ -38988,7 +38987,7 @@ let WebService = class WebService {
38988
38987
  }
38989
38988
  async page(params, _pinsSettingsList, context) {
38990
38989
  var _context_request_body;
38991
- const { body, head, ssr = true, styleHtml = '', styleBody = '', factoryInitialize = [], browserInitialize = [], browserLoad = [], confirmBeforeUnload = [] } = params;
38990
+ const { body, head, ssr = true, styleHtml = '', styleBody = '', factoryInitialize = [], browserInitialize = [], browserLoad = [], confirmBeforeUnload = 'false' } = params;
38992
38991
  const engineVersion = context.config.VERSIONS['@digipair/engine'] || 'latest';
38993
38992
  const preparedData = {};
38994
38993
  if (context.request.params[0] === '__digipair_www__') {
@@ -39100,6 +39099,15 @@ let WebService = class WebService {
39100
39099
  setTimeout(async () => {
39101
39100
  await executePinsList(${JSON.stringify(this.prepareBrowserPinsSettings('browserLoad', browserLoad))}, context);
39102
39101
  }, 1);
39102
+
39103
+ window.addEventListener('beforeunload', (event) => {
39104
+ const showConfirmationMessage = applyTemplate('EVALUATE:' + ${JSON.stringify(confirmBeforeUnload)}, context);
39105
+
39106
+ if (showConfirmationMessage) {
39107
+ event.preventDefault();
39108
+ event.returnValue = '';
39109
+ }
39110
+ });
39103
39111
  </script>
39104
39112
 
39105
39113
  ${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.66.2",
3
+ "version": "0.66.4",
4
4
  "dependencies": {
5
5
  "jsdom": "^25.0.1"
6
6
  },
package/schema.fr.json CHANGED
@@ -134,10 +134,7 @@
134
134
  "required": false,
135
135
  "description": "Message de confirmation avant de quitter la page",
136
136
  "schema": {
137
- "type": "array",
138
- "items": {
139
- "$ref": "https://schemas.digipair.ai/pinsSettings"
140
- }
137
+ "type": "string"
141
138
  }
142
139
  }
143
140
  ]
package/schema.json CHANGED
@@ -134,10 +134,7 @@
134
134
  "required": false,
135
135
  "description": "Confirmation message before leaving the page",
136
136
  "schema": {
137
- "type": "array",
138
- "items": {
139
- "$ref": "https://schemas.digipair.ai/pinsSettings"
140
- }
137
+ "type": "string"
141
138
  }
142
139
  }
143
140
  ]