reneco-hierarchized-picker 0.4.2-beta.16 → 0.4.2-beta.17

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.
@@ -19141,6 +19141,7 @@ const HierarchizedPickerComponent = class {
19141
19141
  return this.optionsManager.getOptions().url.substring(0, this.optionsManager.getOptions().url.lastIndexOf('/')) + '/GetTreeFromSearch';
19142
19142
  }
19143
19143
  }
19144
+ // TODO > Celine would rather like the context (thesaurus or position) to be extracted another way
19144
19145
  getContextualApiURL() {
19145
19146
  const { options, url } = this.optionsManager.getOptions();
19146
19147
  if (options.Reach) {
@@ -19148,7 +19149,9 @@ const HierarchizedPickerComponent = class {
19148
19149
  const base = window.location.origin; // fallback for relative URLs
19149
19150
  const parsedUrl = new URL(url, base);
19150
19151
  const pathSegments = parsedUrl.pathname.split('/');
19151
- const dynamicType = pathSegments[pathSegments.length - 2];
19152
+ let dynamicType = pathSegments[pathSegments.length - 2];
19153
+ if (['thesaurus', 'position'].indexOf(dynamicType) == -1)
19154
+ dynamicType = pathSegments[pathSegments.length - 1];
19152
19155
  const newPathname = `/api/v1/classification/reach/${dynamicType}/${options.Reach}`;
19153
19156
  this.optionsManager.dropReach();
19154
19157
  return `${parsedUrl.origin}${newPathname}`;
@@ -456,6 +456,7 @@ export class HierarchizedPickerComponent {
456
456
  return this.optionsManager.getOptions().url.substring(0, this.optionsManager.getOptions().url.lastIndexOf('/')) + '/GetTreeFromSearch';
457
457
  }
458
458
  }
459
+ // TODO > Celine would rather like the context (thesaurus or position) to be extracted another way
459
460
  getContextualApiURL() {
460
461
  const { options, url } = this.optionsManager.getOptions();
461
462
  if (options.Reach) {
@@ -463,7 +464,9 @@ export class HierarchizedPickerComponent {
463
464
  const base = window.location.origin; // fallback for relative URLs
464
465
  const parsedUrl = new URL(url, base);
465
466
  const pathSegments = parsedUrl.pathname.split('/');
466
- const dynamicType = pathSegments[pathSegments.length - 2];
467
+ let dynamicType = pathSegments[pathSegments.length - 2];
468
+ if (['thesaurus', 'position'].indexOf(dynamicType) == -1)
469
+ dynamicType = pathSegments[pathSegments.length - 1];
467
470
  const newPathname = `/api/v1/classification/reach/${dynamicType}/${options.Reach}`;
468
471
  this.optionsManager.dropReach();
469
472
  return `${parsedUrl.origin}${newPathname}`;
@@ -19139,6 +19139,7 @@ const HierarchizedPickerComponent = class extends HTMLElement {
19139
19139
  return this.optionsManager.getOptions().url.substring(0, this.optionsManager.getOptions().url.lastIndexOf('/')) + '/GetTreeFromSearch';
19140
19140
  }
19141
19141
  }
19142
+ // TODO > Celine would rather like the context (thesaurus or position) to be extracted another way
19142
19143
  getContextualApiURL() {
19143
19144
  const { options, url } = this.optionsManager.getOptions();
19144
19145
  if (options.Reach) {
@@ -19146,7 +19147,9 @@ const HierarchizedPickerComponent = class extends HTMLElement {
19146
19147
  const base = window.location.origin; // fallback for relative URLs
19147
19148
  const parsedUrl = new URL(url, base);
19148
19149
  const pathSegments = parsedUrl.pathname.split('/');
19149
- const dynamicType = pathSegments[pathSegments.length - 2];
19150
+ let dynamicType = pathSegments[pathSegments.length - 2];
19151
+ if (['thesaurus', 'position'].indexOf(dynamicType) == -1)
19152
+ dynamicType = pathSegments[pathSegments.length - 1];
19150
19153
  const newPathname = `/api/v1/classification/reach/${dynamicType}/${options.Reach}`;
19151
19154
  this.optionsManager.dropReach();
19152
19155
  return `${parsedUrl.origin}${newPathname}`;
@@ -19137,6 +19137,7 @@ const HierarchizedPickerComponent = class {
19137
19137
  return this.optionsManager.getOptions().url.substring(0, this.optionsManager.getOptions().url.lastIndexOf('/')) + '/GetTreeFromSearch';
19138
19138
  }
19139
19139
  }
19140
+ // TODO > Celine would rather like the context (thesaurus or position) to be extracted another way
19140
19141
  getContextualApiURL() {
19141
19142
  const { options, url } = this.optionsManager.getOptions();
19142
19143
  if (options.Reach) {
@@ -19144,7 +19145,9 @@ const HierarchizedPickerComponent = class {
19144
19145
  const base = window.location.origin; // fallback for relative URLs
19145
19146
  const parsedUrl = new URL(url, base);
19146
19147
  const pathSegments = parsedUrl.pathname.split('/');
19147
- const dynamicType = pathSegments[pathSegments.length - 2];
19148
+ let dynamicType = pathSegments[pathSegments.length - 2];
19149
+ if (['thesaurus', 'position'].indexOf(dynamicType) == -1)
19150
+ dynamicType = pathSegments[pathSegments.length - 1];
19148
19151
  const newPathname = `/api/v1/classification/reach/${dynamicType}/${options.Reach}`;
19149
19152
  this.optionsManager.dropReach();
19150
19153
  return `${parsedUrl.origin}${newPathname}`;