@digipair/skill-keycloak 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
@@ -16544,7 +16544,7 @@ let KeycloakService = class KeycloakService {
16544
16544
  }
16545
16545
  async page(params, _pinsSettingsList, context) {
16546
16546
  var _context_request_body;
16547
- const { body, head, ssr = false, styleHtml = '', styleBody = '', url = context.privates.KEYCLOAK_URL, realm = context.privates.KEYCLOAK_REALM, clientId = context.privates.KEYCLOAK_CLIENTID, factoryInitialize = [], browserInitialize = [], browserLoad = [], confirmBeforeUnload = [], logged = [], unlogged = [], factoryUrl = context.privates.FACTORY_URL || process.env['FACTORY_URL'] || 'https://factory.digipair.ai' } = params;
16547
+ const { body, head, ssr = false, styleHtml = '', styleBody = '', url = context.privates.KEYCLOAK_URL, realm = context.privates.KEYCLOAK_REALM, clientId = context.privates.KEYCLOAK_CLIENTID, factoryInitialize = [], browserInitialize = [], browserLoad = [], confirmBeforeUnload = 'false', logged = [], unlogged = [], factoryUrl = context.privates.FACTORY_URL || process.env['FACTORY_URL'] || 'https://factory.digipair.ai' } = params;
16548
16548
  const engineVersion = context.config.VERSIONS['@digipair/engine'] || 'latest';
16549
16549
  const preparedData = {};
16550
16550
  if (context.request.params[0] === '__digipair_www__') {
@@ -16714,6 +16714,15 @@ let KeycloakService = class KeycloakService {
16714
16714
  setTimeout(async () => {
16715
16715
  await executePinsList(${JSON.stringify(this.prepareBrowserPinsSettings('browserLoad', browserLoad))}, context);
16716
16716
  }, 1);
16717
+
16718
+ window.addEventListener('beforeunload', (event) => {
16719
+ const showConfirmationMessage = applyTemplate('EVALUATE:' + ${JSON.stringify(confirmBeforeUnload)}, context);
16720
+
16721
+ if (showConfirmationMessage) {
16722
+ event.preventDefault();
16723
+ event.returnValue = '';
16724
+ }
16725
+ });
16717
16726
  </script>
16718
16727
 
16719
16728
  ${ssr ? await this.pins2html(body, context) : ''}
package/index.esm.js CHANGED
@@ -23907,14 +23907,14 @@ function indent(str, spaces) {
23907
23907
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
23908
23908
  // match is required
23909
23909
  if (!match) {
23910
- return nextMatch = nextMatch1, i = i1, tokens = tokens1, {
23910
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
23911
23911
  v: nextMatch1
23912
23912
  };
23913
23913
  }
23914
23914
  var token = match.token, offset = match.offset;
23915
23915
  i1 += offset;
23916
23916
  if (token === " ") {
23917
- return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
23917
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
23918
23918
  }
23919
23919
  tokens1 = _to_consumable_array$3(tokens1).concat([
23920
23920
  token
@@ -23933,7 +23933,7 @@ function indent(str, spaces) {
23933
23933
  if (contextKeys.some(function(el) {
23934
23934
  return el.startsWith(name);
23935
23935
  })) {
23936
- return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
23936
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
23937
23937
  }
23938
23938
  if (dateTimeIdentifiers.some(function(el) {
23939
23939
  return el === name;
@@ -23952,9 +23952,9 @@ function indent(str, spaces) {
23952
23952
  if (dateTimeIdentifiers.some(function(el) {
23953
23953
  return el.startsWith(name);
23954
23954
  })) {
23955
- return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
23955
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
23956
23956
  }
23957
- return nextMatch = nextMatch1, i = i1, tokens = tokens1, {
23957
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
23958
23958
  v: nextMatch1
23959
23959
  };
23960
23960
  };
@@ -27884,12 +27884,12 @@ const applyTemplate = (value, context)=>{
27884
27884
  };
27885
27885
  const executePins = async (settingsOrigin, context = {})=>{
27886
27886
  var _settings_conditions, _settings_conditions1;
27887
- let settings = await preparePinsSettings(settingsOrigin, context);
27887
+ let settings = preparePinsSettings(settingsOrigin, context);
27888
27888
  const alias = _config.ALIAS.find((alias)=>settings.library.split(':')[0] === alias.name);
27889
27889
  const config = context.config || {};
27890
27890
  let version = (config.VERSIONS || {})[settings.library] || 'latest';
27891
27891
  if (alias) {
27892
- settings = await preparePinsSettings(_extends({}, settings, alias), {
27892
+ settings = preparePinsSettings(_extends({}, settings, alias), {
27893
27893
  settings: _extends({}, settings, {
27894
27894
  version,
27895
27895
  library: settings.library.substring(alias.name.length + 1)
@@ -27916,7 +27916,7 @@ const executePins = async (settingsOrigin, context = {})=>{
27916
27916
  parent: context.parent
27917
27917
  }
27918
27918
  });
27919
- const itemSettings = await preparePinsSettings(itemSettingsOrigin, itemContext);
27919
+ const itemSettings = preparePinsSettings(itemSettingsOrigin, itemContext);
27920
27920
  if (typeof ((_itemSettings_conditions = itemSettings.conditions) == null ? void 0 : _itemSettings_conditions.if) !== 'undefined' && !itemSettings.conditions.if) {
27921
27921
  continue;
27922
27922
  }
@@ -27945,7 +27945,6 @@ const executePins = async (settingsOrigin, context = {})=>{
27945
27945
  };
27946
27946
  const executePinsList = async (pinsSettingsList, context)=>{
27947
27947
  let previous = {};
27948
- // parcourir tous les pins
27949
27948
  for(let i = 0; i < pinsSettingsList.length; i++){
27950
27949
  const settings = pinsSettingsList[i];
27951
27950
  try {
@@ -27969,10 +27968,10 @@ const generateElementFromPins = async (pinsSettings, parent, context, document =
27969
27968
  import: true
27970
27969
  })=>{
27971
27970
  var _settings_conditions, _settings_conditions1;
27972
- let settings = await preparePinsSettings(pinsSettings, context);
27971
+ let settings = preparePinsSettings(pinsSettings, context);
27973
27972
  const alias = _config.ALIAS.find((alias)=>settings.library.split(':')[0] === alias.name);
27974
27973
  if (alias) {
27975
- settings = await preparePinsSettings(_extends({}, settings, alias), {
27974
+ settings = preparePinsSettings(_extends({}, settings, alias), {
27976
27975
  settings
27977
27976
  });
27978
27977
  }
@@ -28039,14 +28038,14 @@ const generateElementFromPins = async (pinsSettings, parent, context, document =
28039
28038
  }
28040
28039
  return element;
28041
28040
  };
28042
- const preparePinsSettings = async (settings, context)=>{
28041
+ const preparePinsSettings = (settings, context)=>{
28043
28042
  const localContext = _extends({}, context, {
28044
28043
  variables: context.variables || {},
28045
28044
  conditions: context.conditions || {}
28046
28045
  });
28047
28046
  const conditions = {};
28048
28047
  for (const [key, value] of Object.entries(settings.conditions || {})){
28049
- conditions[key] = await applyTemplate(value, localContext);
28048
+ conditions[key] = applyTemplate(value, localContext);
28050
28049
  }
28051
28050
  const properties = {};
28052
28051
  for (const [key, value] of Object.entries(settings.properties || {})){
@@ -44572,7 +44571,7 @@ let KeycloakService = class KeycloakService {
44572
44571
  }
44573
44572
  async page(params, _pinsSettingsList, context) {
44574
44573
  var _context_request_body;
44575
- const { body, head, ssr = false, styleHtml = '', styleBody = '', url = context.privates.KEYCLOAK_URL, realm = context.privates.KEYCLOAK_REALM, clientId = context.privates.KEYCLOAK_CLIENTID, factoryInitialize = [], browserInitialize = [], browserLoad = [], confirmBeforeUnload = [], logged = [], unlogged = [], factoryUrl = context.privates.FACTORY_URL || process.env['FACTORY_URL'] || 'https://factory.digipair.ai' } = params;
44574
+ const { body, head, ssr = false, styleHtml = '', styleBody = '', url = context.privates.KEYCLOAK_URL, realm = context.privates.KEYCLOAK_REALM, clientId = context.privates.KEYCLOAK_CLIENTID, factoryInitialize = [], browserInitialize = [], browserLoad = [], confirmBeforeUnload = 'false', logged = [], unlogged = [], factoryUrl = context.privates.FACTORY_URL || process.env['FACTORY_URL'] || 'https://factory.digipair.ai' } = params;
44576
44575
  const engineVersion = context.config.VERSIONS['@digipair/engine'] || 'latest';
44577
44576
  const preparedData = {};
44578
44577
  if (context.request.params[0] === '__digipair_www__') {
@@ -44742,6 +44741,15 @@ let KeycloakService = class KeycloakService {
44742
44741
  setTimeout(async () => {
44743
44742
  await executePinsList(${JSON.stringify(this.prepareBrowserPinsSettings('browserLoad', browserLoad))}, context);
44744
44743
  }, 1);
44744
+
44745
+ window.addEventListener('beforeunload', (event) => {
44746
+ const showConfirmationMessage = applyTemplate('EVALUATE:' + ${JSON.stringify(confirmBeforeUnload)}, context);
44747
+
44748
+ if (showConfirmationMessage) {
44749
+ event.preventDefault();
44750
+ event.returnValue = '';
44751
+ }
44752
+ });
44745
44753
  </script>
44746
44754
 
44747
44755
  ${ssr ? await this.pins2html(body, context) : ''}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-keycloak",
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
@@ -267,10 +267,7 @@
267
267
  "required": false,
268
268
  "description": "Message de confirmation avant de quitter la page",
269
269
  "schema": {
270
- "type": "array",
271
- "items": {
272
- "$ref": "https://schemas.digipair.ai/pinsSettings"
273
- }
270
+ "type": "string"
274
271
  }
275
272
  }
276
273
  ]
package/schema.json CHANGED
@@ -267,10 +267,7 @@
267
267
  "required": false,
268
268
  "description": "Confirmation message before leaving the page",
269
269
  "schema": {
270
- "type": "array",
271
- "items": {
272
- "$ref": "https://schemas.digipair.ai/pinsSettings"
273
- }
270
+ "type": "string"
274
271
  }
275
272
  }
276
273
  ]