@acorex-platform/module-workflow-management-client 0.0.57 → 0.0.59

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.
Files changed (14) hide show
  1. package/fesm2022/{acorex-platform-module-workflow-management-client-acorex-platform-module-workflow-management-client-Ce2bU1tZ.mjs → acorex-platform-module-workflow-management-client-acorex-platform-module-workflow-management-client-DwHNK7p5.mjs} +84 -68
  2. package/fesm2022/acorex-platform-module-workflow-management-client-acorex-platform-module-workflow-management-client-DwHNK7p5.mjs.map +1 -0
  3. package/fesm2022/{acorex-platform-module-workflow-management-client-execute-workflow.command-Cd1vcrzK.mjs → acorex-platform-module-workflow-management-client-execute-workflow.command-D1AQsYgn.mjs} +9 -1
  4. package/fesm2022/{acorex-platform-module-workflow-management-client-execute-workflow.command-Cd1vcrzK.mjs.map → acorex-platform-module-workflow-management-client-execute-workflow.command-D1AQsYgn.mjs.map} +1 -1
  5. package/fesm2022/{acorex-platform-module-workflow-management-client-index-DjvJZef8.mjs → acorex-platform-module-workflow-management-client-index-nljwSnXl.mjs} +11 -6
  6. package/fesm2022/{acorex-platform-module-workflow-management-client-index-DjvJZef8.mjs.map → acorex-platform-module-workflow-management-client-index-nljwSnXl.mjs.map} +1 -1
  7. package/fesm2022/{acorex-platform-module-workflow-management-client-workflow-run-history-popup.component-DMdO3uX7.mjs → acorex-platform-module-workflow-management-client-workflow-run-history-popup.component-BI-h2j5i.mjs} +2 -2
  8. package/fesm2022/{acorex-platform-module-workflow-management-client-workflow-run-history-popup.component-DMdO3uX7.mjs.map → acorex-platform-module-workflow-management-client-workflow-run-history-popup.component-BI-h2j5i.mjs.map} +1 -1
  9. package/fesm2022/{acorex-platform-module-workflow-management-client-workflow-task-popover.component-Dmr9oHBd.mjs → acorex-platform-module-workflow-management-client-workflow-task-popover.component-Cmcd551i.mjs} +2 -2
  10. package/fesm2022/{acorex-platform-module-workflow-management-client-workflow-task-popover.component-Dmr9oHBd.mjs.map → acorex-platform-module-workflow-management-client-workflow-task-popover.component-Cmcd551i.mjs.map} +1 -1
  11. package/fesm2022/acorex-platform-module-workflow-management-client.mjs +1 -1
  12. package/package.json +2 -2
  13. package/types/acorex-platform-module-workflow-management-client.d.ts +4 -1
  14. package/fesm2022/acorex-platform-module-workflow-management-client-acorex-platform-module-workflow-management-client-Ce2bU1tZ.mjs.map +0 -1
@@ -17,7 +17,7 @@ import { ROUTES } from '@angular/router';
17
17
  import { AXDialogService } from '@acorex/components/dialog';
18
18
  import { AXTranslationService } from '@acorex/core/translation';
19
19
  import { AXPopupService } from '@acorex/components/popup';
20
- import { AXPDialogRendererComponent, AXPLayoutBuilderService, resolveLayoutBuilderDialogResult } from '@acorex-platform/framework-client/layout/builder';
20
+ import { AXPDialogOpener, AXPDialogRendererComponent, AXPLayoutBuilderService, resolveLayoutBuilderDialogResult } from '@acorex-platform/framework-client/layout/builder';
21
21
  import { cloneDeep, isString, trim, isEmpty, defaultTo, merge, get } from 'lodash';
22
22
  import { AXToastService } from '@acorex/components/toast';
23
23
  import { AXPWidgetsList, runtimeCommandPayloadData, AXPSystemActionType, AXPStatusProvider, AXPSystemStatusType, systemStatusToDefinition, AXPRegionalSetting, AXPSystemStatuses, AXPWidgetsCatalog } from '@acorex-platform/framework-shared/core';
@@ -163,6 +163,7 @@ class ShowLayoutPopupActivity {
163
163
  constructor() {
164
164
  //#region ---- Services & Dependencies ----
165
165
  this.popupService = inject(AXPopupService);
166
+ this.dialogOpener = inject(AXPDialogOpener);
166
167
  }
167
168
  //#endregion
168
169
  //#region ---- AXPCommand Implementation ----
@@ -217,27 +218,47 @@ class ShowLayoutPopupActivity {
217
218
  },
218
219
  };
219
220
  // Show dialog using AXPDialogRendererComponent. Close dialog before resolving so UI is updated before workflow continues.
220
- const dialogResult = await new Promise((resolve) => {
221
- this.popupService.open(AXPDialogRendererComponent, {
222
- title: dialogConfig.title,
223
- size: input.size || 'md',
224
- closeButton: input.closeButton !== undefined ? input.closeButton : true,
225
- closeOnBackdropClick: false,
226
- draggable: true,
227
- data: {
228
- config: dialogConfig,
229
- callBack: (result) => {
230
- if (typeof result?.close === 'function') {
231
- result.close();
232
- }
233
- resolve({
234
- context: result?.context?.() ?? dialogConfig.context,
235
- action: result?.action ? result.action() : 'cancel',
236
- });
221
+ const outcome = await this.dialogOpener.run({
222
+ load: () => Promise.resolve(AXPDialogRendererComponent),
223
+ data: { title: dialogConfig.title, size: input.size || 'md' },
224
+ present: (notifyShown, component) => new Promise((resolve) => {
225
+ let settled = false;
226
+ const finish = (value) => {
227
+ if (settled) {
228
+ return;
229
+ }
230
+ settled = true;
231
+ resolve(value);
232
+ };
233
+ const opened = this.popupService.open(component, {
234
+ title: dialogConfig.title,
235
+ size: input.size || 'md',
236
+ closeButton: input.closeButton !== undefined ? input.closeButton : true,
237
+ closeOnBackdropClick: false,
238
+ draggable: true,
239
+ data: {
240
+ config: dialogConfig,
241
+ callBack: (result) => {
242
+ if (typeof result?.close === 'function') {
243
+ result.close();
244
+ }
245
+ finish({
246
+ context: result?.context?.() ?? dialogConfig.context,
247
+ action: result?.action ? result.action() : 'cancel',
248
+ });
249
+ },
237
250
  },
238
- },
239
- });
251
+ });
252
+ notifyShown();
253
+ void opened.finally(() => {
254
+ finish({ context: dialogConfig.context, action: 'cancel' });
255
+ });
256
+ }),
240
257
  });
258
+ if (outcome.duplicate) {
259
+ return { success: false };
260
+ }
261
+ const dialogResult = outcome.result;
241
262
  // Extract result data and action
242
263
  const result = dialogResult?.context || {};
243
264
  let actionName = 'cancel'; // Default action
@@ -2721,43 +2742,15 @@ class AXPWorkflowTaskContinuationService {
2721
2742
  }
2722
2743
  //#endregion
2723
2744
  //#region ---- Hook ----
2724
- async offerBeforeInteractiveFlow(context) {
2725
- try {
2726
- // Resume from task board already means the user chose to act on this step.
2727
- if (context.completedActivityId) {
2728
- return 'not-offered';
2729
- }
2730
- const nextTask = context.pendingNextTask;
2731
- if (!nextTask || !axpIsWorkflowInlineFrontendTask(nextTask)) {
2732
- return 'not-offered';
2733
- }
2734
- const instance = await this.bookmarkAccess.loadInstanceForContinuation(context.instanceId);
2735
- if (!instance) {
2736
- return 'not-offered';
2737
- }
2738
- const bookmarks = this.bookmarkAccess.getActiveBookmarks(instance);
2739
- const activeActivityIds = bookmarks.map((b) => b.activityId);
2740
- if (!shouldOfferWorkflowContinuationAfterStep(context, activeActivityIds)) {
2741
- return 'not-offered';
2742
- }
2743
- const humanTaskAssigneeId = resolveWorkflowHumanTaskAssigneeId(instance, context.completedActivityId);
2744
- if (shouldSkipContinuationBeforeInteractive(context, nextTask, this.sessionService, instance, bookmarks, humanTaskAssigneeId)) {
2745
- return 'not-offered';
2746
- }
2747
- if (!shouldOfferWorkflowInteractiveStepContinuation(instance, this.sessionService, humanTaskAssigneeId)) {
2748
- return 'not-offered';
2749
- }
2750
- const takeOver = needsTakeOverForWorkflowInteractiveContinuation(instance, this.sessionService, humanTaskAssigneeId);
2751
- const confirmed = await this.confirmContinueToNextStep(takeOver);
2752
- return confirmed ? 'confirmed' : 'declined';
2753
- }
2754
- catch (error) {
2755
- console.warn('[AXPWorkflowTaskContinuationService] offerBeforeInteractiveFlow failed', error);
2756
- return 'not-offered';
2757
- }
2745
+ async offerBeforeInteractiveFlow(_context) {
2746
+ // The opening dialog is the step the user just started. Do not load the instance to ask.
2747
+ return 'not-offered';
2758
2748
  }
2759
2749
  async offerAfterWorkflowStep(context) {
2760
2750
  try {
2751
+ if (this.isAssignedToSomeoneElse(context.pendingNextTask)) {
2752
+ return 'not-offered';
2753
+ }
2761
2754
  const expectedActivityId = context.pendingNextTask?.activityId;
2762
2755
  const instance = await this.bookmarkAccess.loadInstanceForContinuation(context.instanceId, expectedActivityId);
2763
2756
  if (!instance) {
@@ -2830,6 +2823,9 @@ class AXPWorkflowTaskContinuationService {
2830
2823
  }
2831
2824
  async confirmAndAdvance(instanceId, continuationCtx, nextActivityId, nextBookmarkId) {
2832
2825
  const takeOver = needsTakeOverForWorkflowTaskContinuation(continuationCtx);
2826
+ if (takeOver) {
2827
+ return 'not-offered';
2828
+ }
2833
2829
  const confirmed = await this.confirmContinueToNextStep(takeOver);
2834
2830
  if (!confirmed) {
2835
2831
  return 'declined';
@@ -2892,6 +2888,26 @@ class AXPWorkflowTaskContinuationService {
2892
2888
  context: input['context'],
2893
2889
  };
2894
2890
  }
2891
+ /** Next human task belongs to another user. Do not ask the starter to take it over. */
2892
+ isAssignedToSomeoneElse(task) {
2893
+ if (!task || !axpIsWorkflowTaskBoardActivityType(task.activityType)) {
2894
+ return false;
2895
+ }
2896
+ const currentUserId = this.sessionService.user?.id;
2897
+ if (currentUserId == null) {
2898
+ return false;
2899
+ }
2900
+ const assigned = task.input?.['assignedUserIds'];
2901
+ const ids = Array.isArray(assigned)
2902
+ ? assigned.map((id) => String(id).trim()).filter((id) => id.length > 0)
2903
+ : assigned != null && String(assigned).trim().length > 0
2904
+ ? [String(assigned).trim()]
2905
+ : [];
2906
+ if (ids.length === 0) {
2907
+ return false;
2908
+ }
2909
+ return !ids.includes(String(currentUserId));
2910
+ }
2895
2911
  async confirmContinueToNextStep(requiresTakeOver) {
2896
2912
  const title = await this.translationService.translateAsync('@workflow-management:tasks.dialogs.continue-next-step.title');
2897
2913
  const messageKey = requiresTakeOver
@@ -3062,7 +3078,7 @@ class AXMWorkflowManagementModule {
3062
3078
  },
3063
3079
  {
3064
3080
  key: 'WorkflowManagement.WorkflowDefinition:Execute',
3065
- command: () => import('./acorex-platform-module-workflow-management-client-execute-workflow.command-Cd1vcrzK.mjs').then((c) => c.ExecuteWorkflowCommand),
3081
+ command: () => import('./acorex-platform-module-workflow-management-client-execute-workflow.command-D1AQsYgn.mjs').then((c) => c.ExecuteWorkflowCommand),
3066
3082
  },
3067
3083
  {
3068
3084
  key: 'WorkflowManagement.WorkflowDefinition:Activities:Save',
@@ -3106,23 +3122,23 @@ class AXMWorkflowManagementModule {
3106
3122
  },
3107
3123
  {
3108
3124
  key: 'WorkflowManagement.WorkflowRun:Continue',
3109
- command: () => import('./acorex-platform-module-workflow-management-client-index-DjvJZef8.mjs').then((c) => c.ContinueWorkflowRunCommand),
3125
+ command: () => import('./acorex-platform-module-workflow-management-client-index-nljwSnXl.mjs').then((c) => c.ContinueWorkflowRunCommand),
3110
3126
  },
3111
3127
  {
3112
3128
  key: 'WorkflowManagement.WorkflowRun:CancelRun',
3113
- command: () => import('./acorex-platform-module-workflow-management-client-index-DjvJZef8.mjs').then((c) => c.CancelWorkflowRunCommand),
3129
+ command: () => import('./acorex-platform-module-workflow-management-client-index-nljwSnXl.mjs').then((c) => c.CancelWorkflowRunCommand),
3114
3130
  },
3115
3131
  {
3116
3132
  key: 'WorkflowManagement.WorkflowRun:TakeOver',
3117
- command: () => import('./acorex-platform-module-workflow-management-client-index-DjvJZef8.mjs').then((c) => c.TakeOverWorkflowRunCommand),
3133
+ command: () => import('./acorex-platform-module-workflow-management-client-index-nljwSnXl.mjs').then((c) => c.TakeOverWorkflowRunCommand),
3118
3134
  },
3119
3135
  {
3120
3136
  key: 'WorkflowManagement.WorkflowRun:ShowHistory',
3121
- command: () => import('./acorex-platform-module-workflow-management-client-index-DjvJZef8.mjs').then((c) => c.ShowWorkflowRunHistoryCommand),
3137
+ command: () => import('./acorex-platform-module-workflow-management-client-index-nljwSnXl.mjs').then((c) => c.ShowWorkflowRunHistoryCommand),
3122
3138
  },
3123
3139
  {
3124
3140
  key: 'WorkflowManagement.WorkflowRun:ShowHistory',
3125
- command: () => import('./acorex-platform-module-workflow-management-client-index-DjvJZef8.mjs').then((c) => c.ShowWorkflowRunHistoryCommand),
3141
+ command: () => import('./acorex-platform-module-workflow-management-client-index-nljwSnXl.mjs').then((c) => c.ShowWorkflowRunHistoryCommand),
3126
3142
  },
3127
3143
  ]),
3128
3144
  // provideEntity([RootConfig.entities.activityDefinition.fullName]),
@@ -3236,7 +3252,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
3236
3252
  },
3237
3253
  {
3238
3254
  key: 'WorkflowManagement.WorkflowDefinition:Execute',
3239
- command: () => import('./acorex-platform-module-workflow-management-client-execute-workflow.command-Cd1vcrzK.mjs').then((c) => c.ExecuteWorkflowCommand),
3255
+ command: () => import('./acorex-platform-module-workflow-management-client-execute-workflow.command-D1AQsYgn.mjs').then((c) => c.ExecuteWorkflowCommand),
3240
3256
  },
3241
3257
  {
3242
3258
  key: 'WorkflowManagement.WorkflowDefinition:Activities:Save',
@@ -3280,23 +3296,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
3280
3296
  },
3281
3297
  {
3282
3298
  key: 'WorkflowManagement.WorkflowRun:Continue',
3283
- command: () => import('./acorex-platform-module-workflow-management-client-index-DjvJZef8.mjs').then((c) => c.ContinueWorkflowRunCommand),
3299
+ command: () => import('./acorex-platform-module-workflow-management-client-index-nljwSnXl.mjs').then((c) => c.ContinueWorkflowRunCommand),
3284
3300
  },
3285
3301
  {
3286
3302
  key: 'WorkflowManagement.WorkflowRun:CancelRun',
3287
- command: () => import('./acorex-platform-module-workflow-management-client-index-DjvJZef8.mjs').then((c) => c.CancelWorkflowRunCommand),
3303
+ command: () => import('./acorex-platform-module-workflow-management-client-index-nljwSnXl.mjs').then((c) => c.CancelWorkflowRunCommand),
3288
3304
  },
3289
3305
  {
3290
3306
  key: 'WorkflowManagement.WorkflowRun:TakeOver',
3291
- command: () => import('./acorex-platform-module-workflow-management-client-index-DjvJZef8.mjs').then((c) => c.TakeOverWorkflowRunCommand),
3307
+ command: () => import('./acorex-platform-module-workflow-management-client-index-nljwSnXl.mjs').then((c) => c.TakeOverWorkflowRunCommand),
3292
3308
  },
3293
3309
  {
3294
3310
  key: 'WorkflowManagement.WorkflowRun:ShowHistory',
3295
- command: () => import('./acorex-platform-module-workflow-management-client-index-DjvJZef8.mjs').then((c) => c.ShowWorkflowRunHistoryCommand),
3311
+ command: () => import('./acorex-platform-module-workflow-management-client-index-nljwSnXl.mjs').then((c) => c.ShowWorkflowRunHistoryCommand),
3296
3312
  },
3297
3313
  {
3298
3314
  key: 'WorkflowManagement.WorkflowRun:ShowHistory',
3299
- command: () => import('./acorex-platform-module-workflow-management-client-index-DjvJZef8.mjs').then((c) => c.ShowWorkflowRunHistoryCommand),
3315
+ command: () => import('./acorex-platform-module-workflow-management-client-index-nljwSnXl.mjs').then((c) => c.ShowWorkflowRunHistoryCommand),
3300
3316
  },
3301
3317
  ]),
3302
3318
  // provideEntity([RootConfig.entities.activityDefinition.fullName]),
@@ -5015,7 +5031,7 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
5015
5031
  //#endregion
5016
5032
  //#region ---- Component ----
5017
5033
  getComponent() {
5018
- return () => import('./acorex-platform-module-workflow-management-client-workflow-task-popover.component-Dmr9oHBd.mjs').then((m) => m.AXMWorkflowTaskPopoverComponent);
5034
+ return () => import('./acorex-platform-module-workflow-management-client-workflow-task-popover.component-Cmcd551i.mjs').then((m) => m.AXMWorkflowTaskPopoverComponent);
5019
5035
  }
5020
5036
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPGenericWorkflowTaskProvider, deps: [{ token: AXP_GENERIC_WORKFLOW_TASK_PROVIDER_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable }); }
5021
5037
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPGenericWorkflowTaskProvider }); }
@@ -5038,4 +5054,4 @@ var genericWorkflowTask_provider = /*#__PURE__*/Object.freeze({
5038
5054
  */
5039
5055
 
5040
5056
  export { AXPWorkflowInstanceHumanTaskService as A, needsTakeOverForWorkflowInteractiveContinuation as B, CartableTaskActivity as C, needsTakeOverForWorkflowTaskContinuation as D, parseWorkflowTaskContinuationPayload as E, resolveWorkflowHumanTaskAssigneeId as F, resolveWorkflowInitiatorUserIdFromVariables as G, HumanTaskActivity as H, resolveWorkflowTaskContinuationAssigneeId as I, shouldOfferWorkflowContinuationAfterStep as J, shouldOfferWorkflowInteractiveStepContinuation as K, shouldOfferWorkflowTaskContinuation as L, shouldSkipContinuationBeforeInteractive as M, wasWorkflowTaskBoardActivity as N, RejectionReasonActivity as R, ShowConfirmPopupActivity as S, AXMWorkflowManagementCommandKeys as a, buildWorkflowTaskDisplayParamsFromWorkflowState as b, createWorkflowInstanceBookmarkAccess as c, buildWorkflowTaskDisplayParams as d, AXCCategoryProvider as e, AXMMenuProvider as f, AXMWorkflowActivitiesDefinitionProvider as g, AXMWorkflowManagementModule as h, isWorkflowPooledClaimablePayload as i, AXPCreateEntityActivity as j, AXPGenericWorkflowTaskProvider as k, AXPWorkflowTaskContinuationService as l, AXPWorkflowTaskInstanceQueryService as m, normalizeWorkflowTaskUserIds as n, AXP_GENERIC_WORKFLOW_TASK_PROVIDER_CONFIG as o, CreateEntityFormActivity as p, ShowLayoutPopupActivity as q, rehydrateWorkflowStateInputTitles as r, ShowToastActivity as s, SignOffActivity as t, discoverWorkflowTaskProviders as u, findActiveHumanTaskAssigneeId as v, findHumanTaskAssigneeIdForActivity as w, getWorkflowInstanceInitiatorUserId as x, isWorkflowReassignableHumanTaskPayload as y, isWorkflowTaskBoardBookmarkPayload as z };
5041
- //# sourceMappingURL=acorex-platform-module-workflow-management-client-acorex-platform-module-workflow-management-client-Ce2bU1tZ.mjs.map
5057
+ //# sourceMappingURL=acorex-platform-module-workflow-management-client-acorex-platform-module-workflow-management-client-DwHNK7p5.mjs.map