@valtimo/process-link 13.48.0 → 13.49.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.
@@ -1014,6 +1014,8 @@ const formSizeToCarbonModalSizeMap = {
1014
1014
  large: 'lg',
1015
1015
  };
1016
1016
  const UNSUPPORTED_PROCESS_LINK_TYPES_IN_BUILDING_BLOCK = ['ui-component'];
1017
+ /** Reached through the "Plugins & Apps" tile — these never render a tile of their own. */
1018
+ const EXTERNAL_PLUGIN_PROCESS_LINK_TYPES = ['external_plugin', 'external_plugin_task_form'];
1017
1019
  /** The `activityListenerType` the BPMN editor reports for a user task. */
1018
1020
  const USER_TASK_ACTIVITY = 'bpmn:UserTask:create';
1019
1021
 
@@ -1863,32 +1865,13 @@ class ProcessLinkStateService {
1863
1865
  }
1864
1866
  get availableProcessLinkTypes$() {
1865
1867
  return combineLatest([this._availableProcessLinkTypes$, this._context$]).pipe(map(([types, context]) => {
1866
- // The external plugin types get no tile of their own (see the filter below) — they are
1867
- // reached through the "Plugins & Apps" (plugin) tile, whose backend enablement only counts
1868
- // embedded plugin configurations. An enabled external type must therefore enable that tile
1869
- // itself, or add it when the activity type has no embedded plugin actions at all.
1870
- const externalPluginEnabled = types.some(type => (type.processLinkType === 'external_plugin' ||
1871
- type.processLinkType === 'external_plugin_task_form') &&
1872
- type.enabled);
1873
- let mergedTypes = types;
1874
- if (externalPluginEnabled && !types.some(type => type.processLinkType === 'plugin')) {
1875
- mergedTypes = [...types];
1876
- // The external types sit where the plugin tile belongs in the backend's order, so the
1877
- // added tile takes the first one's place (the filter below removes them anyway).
1878
- mergedTypes.splice(types.findIndex(type => type.processLinkType === 'external_plugin' ||
1879
- type.processLinkType === 'external_plugin_task_form'), 0, { processLinkType: 'plugin', enabled: true });
1880
- }
1868
+ const externalPluginEnabled = this.isExternalPluginEnabled(types);
1881
1869
  return (!this.formCustomComponentConfig
1882
- ? mergedTypes.map(type => ({
1870
+ ? this.chooserProcessLinkTypes(types).map(type => ({
1883
1871
  ...type,
1884
1872
  enabled: type.processLinkType === 'ui-component' ? false : type.enabled,
1885
1873
  }))
1886
- : mergedTypes)
1887
- .filter(type => type.processLinkType !== 'url' &&
1888
- type.processLinkType !== 'external_plugin' &&
1889
- // No separate tile: an external plugin's task-form is offered inside the "Plugin" flow
1890
- // (pick the plugin on a user task → its task-form appears as the selectable option).
1891
- type.processLinkType !== 'external_plugin_task_form')
1874
+ : this.chooserProcessLinkTypes(types))
1892
1875
  .map(type => type.processLinkType === 'plugin' && externalPluginEnabled
1893
1876
  ? { ...type, enabled: true }
1894
1877
  : type)
@@ -1899,12 +1882,12 @@ class ProcessLinkStateService {
1899
1882
  }));
1900
1883
  }
1901
1884
  get hideProgressIndicator$() {
1902
- return this._availableProcessLinkTypes$
1903
- .asObservable()
1904
- .pipe(map(availableTypes => Array.isArray(availableTypes) &&
1905
- availableTypes.length === 1 &&
1906
- (availableTypes[0]?.processLinkType === 'form' ||
1907
- availableTypes[0]?.processLinkType === 'form-flow')));
1885
+ return this._availableProcessLinkTypes$.asObservable().pipe(
1886
+ // Count the tiles, matching `setAvailableProcessLinkTypes` — on the raw list an untiled
1887
+ // type such as `url` kept the indicator up for the single-form flow it must suppress.
1888
+ map(availableTypes => this.chooserProcessLinkTypes(Array.isArray(availableTypes) ? availableTypes : [])), map(chooserTypes => chooserTypes.length === 1 &&
1889
+ (chooserTypes[0]?.processLinkType === 'form' ||
1890
+ chooserTypes[0]?.processLinkType === 'form-flow')));
1908
1891
  }
1909
1892
  get selectedProcessLinkTypeId$() {
1910
1893
  return this._selectedProcessLinkTypeId$.asObservable();
@@ -1963,11 +1946,12 @@ class ProcessLinkStateService {
1963
1946
  this._nextButtonSubscription?.unsubscribe();
1964
1947
  }
1965
1948
  setAvailableProcessLinkTypes(processLinkTypes) {
1966
- const hasOneOption = processLinkTypes.length === 1;
1949
+ const chooserTypes = this.chooserProcessLinkTypes(processLinkTypes);
1950
+ const hasOneOption = chooserTypes.length === 1;
1967
1951
  this._availableProcessLinkTypes$.next(processLinkTypes);
1968
1952
  this.processLinkStepService.setHasOneProcessLinkType(hasOneOption);
1969
1953
  if (hasOneOption) {
1970
- this.selectProcessLinkType(processLinkTypes[0].processLinkType, hasOneOption);
1954
+ this.selectProcessLinkType(chooserTypes[0].processLinkType, hasOneOption);
1971
1955
  }
1972
1956
  }
1973
1957
  setElementName(name) {
@@ -2006,7 +1990,7 @@ class ProcessLinkStateService {
2006
1990
  setInitial() {
2007
1991
  const availableTypes = this._availableProcessLinkTypes$.getValue();
2008
1992
  this.buttonService.resetButtons();
2009
- this.processLinkStepService.setInitialSteps(availableTypes);
1993
+ this.processLinkStepService.setInitialSteps(this.chooserProcessLinkTypes(availableTypes));
2010
1994
  }
2011
1995
  setModalParams(params) {
2012
1996
  this._modalParams$.next(params);
@@ -2043,9 +2027,25 @@ class ProcessLinkStateService {
2043
2027
  sendProcessLinkDeleteEvent(event) {
2044
2028
  this._processLinkDeleteEvents$.next(event);
2045
2029
  }
2030
+ isExternalPluginEnabled(types) {
2031
+ return types.some(type => EXTERNAL_PLUGIN_PROCESS_LINK_TYPES.includes(type.processLinkType) && type.enabled);
2032
+ }
2033
+ // Tiles the chooser actually renders — count these, not the raw list, to decide if there is a choice
2034
+ chooserProcessLinkTypes(types) {
2035
+ let mergedTypes = types;
2036
+ if (this.isExternalPluginEnabled(types) &&
2037
+ !types.some(type => type.processLinkType === 'plugin')) {
2038
+ mergedTypes = [...types];
2039
+ // The added tile takes the first external type's place; the filter below drops those
2040
+ mergedTypes.splice(types.findIndex(type => EXTERNAL_PLUGIN_PROCESS_LINK_TYPES.includes(type.processLinkType)), 0, { processLinkType: 'plugin', enabled: true });
2041
+ }
2042
+ return mergedTypes.filter(type => type.processLinkType !== 'url' &&
2043
+ // No separate tile — a task-form is offered inside the "Plugin" flow
2044
+ !EXTERNAL_PLUGIN_PROCESS_LINK_TYPES.includes(type.processLinkType));
2045
+ }
2046
2046
  openAvailableProcessLinkTypesSubscription() {
2047
2047
  this._availableProcessLinkTypesSubscription = this._availableProcessLinkTypes$.subscribe(availableProcessLinkTypes => {
2048
- if (availableProcessLinkTypes.length > 1) {
2048
+ if (this.chooserProcessLinkTypes(availableProcessLinkTypes).length > 1) {
2049
2049
  this.setInitial();
2050
2050
  }
2051
2051
  });
@@ -6188,5 +6188,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
6188
6188
  * Generated bundle index. Do not edit.
6189
6189
  */
6190
6190
 
6191
- export { BB_MAPPINGS_TEST_IDS, BuildingBlockStateService, ChooseProcessLinkTypeComponent, FORM_CUSTOM_COMPONENT_TOKEN, FormFlowComponent, FormFlowService, PLUGIN_ACTION_CONFIGURATION_TEST_IDS, PLUGIN_ACTION_RESULT_MAPPINGS_TEST_IDS, PROCESS_LINK_MODAL_TEST_IDS, PROCESS_LINK_TYPE_BUTTON_TEST_ID_PREFIX, PROCESS_LINK_TYPE_CHOOSER_TEST_IDS, PluginActionConfigurationComponent, PluginStateService, ProcessLinkBuildingBlockApiService, ProcessLinkButtonService, ProcessLinkComponent, ProcessLinkModalComponent, ProcessLinkModule, ProcessLinkService, ProcessLinkStateService, ProcessLinkStepService, SELECT_PLUGIN_ACTION_TEST_IDS, SELECT_PLUGIN_ACTION_TILE_TEST_ID_PREFIX, SELECT_PLUGIN_CONFIGURATION_ROW_TEST_ID_PREFIX, SELECT_PLUGIN_CONFIGURATION_TEST_IDS, SelectPluginActionComponent, SelectPluginConfigurationComponent, UNSUPPORTED_PROCESS_LINK_TYPES_IN_BUILDING_BLOCK, USER_TASK_ACTIVITY, UrlResolverService, UrlValidatorService, ensureDocPrefix, formSizeToCarbonModalSizeMap };
6191
+ export { BB_MAPPINGS_TEST_IDS, BuildingBlockStateService, ChooseProcessLinkTypeComponent, EXTERNAL_PLUGIN_PROCESS_LINK_TYPES, FORM_CUSTOM_COMPONENT_TOKEN, FormFlowComponent, FormFlowService, PLUGIN_ACTION_CONFIGURATION_TEST_IDS, PLUGIN_ACTION_RESULT_MAPPINGS_TEST_IDS, PROCESS_LINK_MODAL_TEST_IDS, PROCESS_LINK_TYPE_BUTTON_TEST_ID_PREFIX, PROCESS_LINK_TYPE_CHOOSER_TEST_IDS, PluginActionConfigurationComponent, PluginStateService, ProcessLinkBuildingBlockApiService, ProcessLinkButtonService, ProcessLinkComponent, ProcessLinkModalComponent, ProcessLinkModule, ProcessLinkService, ProcessLinkStateService, ProcessLinkStepService, SELECT_PLUGIN_ACTION_TEST_IDS, SELECT_PLUGIN_ACTION_TILE_TEST_ID_PREFIX, SELECT_PLUGIN_CONFIGURATION_ROW_TEST_ID_PREFIX, SELECT_PLUGIN_CONFIGURATION_TEST_IDS, SelectPluginActionComponent, SelectPluginConfigurationComponent, UNSUPPORTED_PROCESS_LINK_TYPES_IN_BUILDING_BLOCK, USER_TASK_ACTIVITY, UrlResolverService, UrlValidatorService, ensureDocPrefix, formSizeToCarbonModalSizeMap };
6192
6192
  //# sourceMappingURL=valtimo-process-link.mjs.map