@digipair/skill-keycloak 0.103.0 → 0.103.2

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,9 +16544,10 @@ 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 = 'false', 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', keycloakJsUrl = context.privates.KEYCLOAK_JS_URL || process.env['KEYCLOAK_JS_URL'] } = params;
16548
16548
  const engineVersion = context.config.VERSIONS['@digipair/engine'] || 'latest';
16549
16549
  const preparedData = {};
16550
+ const keycloakJs = keycloakJsUrl != null ? keycloakJsUrl : `${url}/js/keycloak.js`;
16550
16551
  if (context.request.params[0] === '__digipair_www__') {
16551
16552
  let result;
16552
16553
  try {
@@ -16634,11 +16635,11 @@ let KeycloakService = class KeycloakService {
16634
16635
  </head>
16635
16636
  <body style="${styleBody}">
16636
16637
  <script type="module">
16637
- import '${url}/js/keycloak.js';
16638
+ import '${keycloakJs}';
16638
16639
  import { config, executePinsList, generateElementFromPins, applyTemplate } from '${baseUrl}/@digipair/engine@${engineVersion}/index.esm.js';
16639
16640
 
16640
16641
  const serverUrl = '${factoryUrl}';
16641
- const keycloakService = ${this.skillKeycloak};
16642
+ const keycloakService = ${this.skillKeycloak(keycloakJs)};
16642
16643
 
16643
16644
  const originalFetch = window.fetch;
16644
16645
  window.fetch = async (url, options) => {
@@ -16785,7 +16786,7 @@ let KeycloakService = class KeycloakService {
16785
16786
  return result;
16786
16787
  }
16787
16788
  constructor(){
16788
- this.skillKeycloak = `(() => {
16789
+ this.skillKeycloak = (keycloakJsUrl)=>`(() => {
16789
16790
  class KeycloakService {
16790
16791
  async authentification() {
16791
16792
  const keycloak = await this._keycloakPromise;
@@ -16799,7 +16800,9 @@ let KeycloakService = class KeycloakService {
16799
16800
 
16800
16801
  async initialize(url, realm, clientId) {
16801
16802
  this._keycloakPromise = (async () => {
16802
- const keycloak = new Keycloak({
16803
+ let KeycloakConstructor = window.Keycloak ?? (await import('${keycloakJsUrl}')).default;
16804
+
16805
+ const keycloak = new KeycloakConstructor({
16803
16806
  url,
16804
16807
  realm,
16805
16808
  clientId,
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 i = i1, nextMatch = nextMatch1, 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 i = i1, nextMatch = nextMatch1, 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 i = i1, nextMatch = nextMatch1, 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 i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23955
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
23956
23956
  }
23957
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, {
23957
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
23958
23958
  v: nextMatch1
23959
23959
  };
23960
23960
  };
@@ -44578,9 +44578,10 @@ let KeycloakService = class KeycloakService {
44578
44578
  }
44579
44579
  async page(params, _pinsSettingsList, context) {
44580
44580
  var _context_request_body;
44581
- 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;
44581
+ 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', keycloakJsUrl = context.privates.KEYCLOAK_JS_URL || process.env['KEYCLOAK_JS_URL'] } = params;
44582
44582
  const engineVersion = context.config.VERSIONS['@digipair/engine'] || 'latest';
44583
44583
  const preparedData = {};
44584
+ const keycloakJs = keycloakJsUrl != null ? keycloakJsUrl : `${url}/js/keycloak.js`;
44584
44585
  if (context.request.params[0] === '__digipair_www__') {
44585
44586
  let result;
44586
44587
  try {
@@ -44668,11 +44669,11 @@ let KeycloakService = class KeycloakService {
44668
44669
  </head>
44669
44670
  <body style="${styleBody}">
44670
44671
  <script type="module">
44671
- import '${url}/js/keycloak.js';
44672
+ import '${keycloakJs}';
44672
44673
  import { config, executePinsList, generateElementFromPins, applyTemplate } from '${baseUrl}/@digipair/engine@${engineVersion}/index.esm.js';
44673
44674
 
44674
44675
  const serverUrl = '${factoryUrl}';
44675
- const keycloakService = ${this.skillKeycloak};
44676
+ const keycloakService = ${this.skillKeycloak(keycloakJs)};
44676
44677
 
44677
44678
  const originalFetch = window.fetch;
44678
44679
  window.fetch = async (url, options) => {
@@ -44819,7 +44820,7 @@ let KeycloakService = class KeycloakService {
44819
44820
  return result;
44820
44821
  }
44821
44822
  constructor(){
44822
- this.skillKeycloak = `(() => {
44823
+ this.skillKeycloak = (keycloakJsUrl)=>`(() => {
44823
44824
  class KeycloakService {
44824
44825
  async authentification() {
44825
44826
  const keycloak = await this._keycloakPromise;
@@ -44833,7 +44834,9 @@ let KeycloakService = class KeycloakService {
44833
44834
 
44834
44835
  async initialize(url, realm, clientId) {
44835
44836
  this._keycloakPromise = (async () => {
44836
- const keycloak = new Keycloak({
44837
+ let KeycloakConstructor = window.Keycloak ?? (await import('${keycloakJsUrl}')).default;
44838
+
44839
+ const keycloak = new KeycloakConstructor({
44837
44840
  url,
44838
44841
  realm,
44839
44842
  clientId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-keycloak",
3
- "version": "0.103.0",
3
+ "version": "0.103.2",
4
4
  "keywords": [
5
5
  "digipair",
6
6
  "service",
package/schema.fr.json CHANGED
@@ -289,6 +289,15 @@
289
289
  "type": "string"
290
290
  }
291
291
  },
292
+ {
293
+ "name": "keycloakJsUrl",
294
+ "summary": "URL du Keycloak JS",
295
+ "required": false,
296
+ "description": "URL du script Keycloak JS à inclure dans la page (par défaut pris depuis le paramètre 'url')",
297
+ "schema": {
298
+ "type": "string"
299
+ }
300
+ },
292
301
  {
293
302
  "name": "factoryInitialize",
294
303
  "summary": "Lors de l'initialisation coté factory",
package/schema.json CHANGED
@@ -289,6 +289,15 @@
289
289
  "type": "string"
290
290
  }
291
291
  },
292
+ {
293
+ "name": "keycloakJsUrl",
294
+ "summary": "Keycloak JS URL",
295
+ "required": false,
296
+ "description": "URL of the Keycloak JS script to include in the page (defaults to taken from the 'url' parameter)",
297
+ "schema": {
298
+ "type": "string"
299
+ }
300
+ },
292
301
  {
293
302
  "name": "factoryInitialize",
294
303
  "summary": "During factory initialization",
File without changes