@acorex-platform/module-workflow-management-client 0.0.70 → 1.0.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.
Files changed (11) hide show
  1. package/fesm2022/{acorex-platform-module-workflow-management-client-acorex-platform-module-workflow-management-client-DwHNK7p5.mjs → acorex-platform-module-workflow-management-client-acorex-platform-module-workflow-management-client-BcOBHoOK.mjs} +143 -21
  2. package/fesm2022/acorex-platform-module-workflow-management-client-acorex-platform-module-workflow-management-client-BcOBHoOK.mjs.map +1 -0
  3. package/fesm2022/{acorex-platform-module-workflow-management-client-index-nljwSnXl.mjs → acorex-platform-module-workflow-management-client-index-Bx8vYkYe.mjs} +3 -3
  4. package/fesm2022/{acorex-platform-module-workflow-management-client-index-nljwSnXl.mjs.map → acorex-platform-module-workflow-management-client-index-Bx8vYkYe.mjs.map} +1 -1
  5. package/fesm2022/{acorex-platform-module-workflow-management-client-workflow-run-history-popup.component-BI-h2j5i.mjs → acorex-platform-module-workflow-management-client-workflow-run-history-popup.component-CHVdaY4M.mjs} +2 -2
  6. package/fesm2022/{acorex-platform-module-workflow-management-client-workflow-run-history-popup.component-BI-h2j5i.mjs.map → acorex-platform-module-workflow-management-client-workflow-run-history-popup.component-CHVdaY4M.mjs.map} +1 -1
  7. package/fesm2022/{acorex-platform-module-workflow-management-client-workflow-task-popover.component-Cmcd551i.mjs → acorex-platform-module-workflow-management-client-workflow-task-popover.component-BXutLQAO.mjs} +2 -2
  8. package/fesm2022/{acorex-platform-module-workflow-management-client-workflow-task-popover.component-Cmcd551i.mjs.map → acorex-platform-module-workflow-management-client-workflow-task-popover.component-BXutLQAO.mjs.map} +1 -1
  9. package/fesm2022/acorex-platform-module-workflow-management-client.mjs +1 -1
  10. package/package.json +2 -2
  11. package/fesm2022/acorex-platform-module-workflow-management-client-acorex-platform-module-workflow-management-client-DwHNK7p5.mjs.map +0 -1
@@ -3122,23 +3122,23 @@ class AXMWorkflowManagementModule {
3122
3122
  },
3123
3123
  {
3124
3124
  key: 'WorkflowManagement.WorkflowRun:Continue',
3125
- command: () => import('./acorex-platform-module-workflow-management-client-index-nljwSnXl.mjs').then((c) => c.ContinueWorkflowRunCommand),
3125
+ command: () => import('./acorex-platform-module-workflow-management-client-index-Bx8vYkYe.mjs').then((c) => c.ContinueWorkflowRunCommand),
3126
3126
  },
3127
3127
  {
3128
3128
  key: 'WorkflowManagement.WorkflowRun:CancelRun',
3129
- command: () => import('./acorex-platform-module-workflow-management-client-index-nljwSnXl.mjs').then((c) => c.CancelWorkflowRunCommand),
3129
+ command: () => import('./acorex-platform-module-workflow-management-client-index-Bx8vYkYe.mjs').then((c) => c.CancelWorkflowRunCommand),
3130
3130
  },
3131
3131
  {
3132
3132
  key: 'WorkflowManagement.WorkflowRun:TakeOver',
3133
- command: () => import('./acorex-platform-module-workflow-management-client-index-nljwSnXl.mjs').then((c) => c.TakeOverWorkflowRunCommand),
3133
+ command: () => import('./acorex-platform-module-workflow-management-client-index-Bx8vYkYe.mjs').then((c) => c.TakeOverWorkflowRunCommand),
3134
3134
  },
3135
3135
  {
3136
3136
  key: 'WorkflowManagement.WorkflowRun:ShowHistory',
3137
- command: () => import('./acorex-platform-module-workflow-management-client-index-nljwSnXl.mjs').then((c) => c.ShowWorkflowRunHistoryCommand),
3137
+ command: () => import('./acorex-platform-module-workflow-management-client-index-Bx8vYkYe.mjs').then((c) => c.ShowWorkflowRunHistoryCommand),
3138
3138
  },
3139
3139
  {
3140
3140
  key: 'WorkflowManagement.WorkflowRun:ShowHistory',
3141
- command: () => import('./acorex-platform-module-workflow-management-client-index-nljwSnXl.mjs').then((c) => c.ShowWorkflowRunHistoryCommand),
3141
+ command: () => import('./acorex-platform-module-workflow-management-client-index-Bx8vYkYe.mjs').then((c) => c.ShowWorkflowRunHistoryCommand),
3142
3142
  },
3143
3143
  ]),
3144
3144
  // provideEntity([RootConfig.entities.activityDefinition.fullName]),
@@ -3296,23 +3296,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
3296
3296
  },
3297
3297
  {
3298
3298
  key: 'WorkflowManagement.WorkflowRun:Continue',
3299
- command: () => import('./acorex-platform-module-workflow-management-client-index-nljwSnXl.mjs').then((c) => c.ContinueWorkflowRunCommand),
3299
+ command: () => import('./acorex-platform-module-workflow-management-client-index-Bx8vYkYe.mjs').then((c) => c.ContinueWorkflowRunCommand),
3300
3300
  },
3301
3301
  {
3302
3302
  key: 'WorkflowManagement.WorkflowRun:CancelRun',
3303
- command: () => import('./acorex-platform-module-workflow-management-client-index-nljwSnXl.mjs').then((c) => c.CancelWorkflowRunCommand),
3303
+ command: () => import('./acorex-platform-module-workflow-management-client-index-Bx8vYkYe.mjs').then((c) => c.CancelWorkflowRunCommand),
3304
3304
  },
3305
3305
  {
3306
3306
  key: 'WorkflowManagement.WorkflowRun:TakeOver',
3307
- command: () => import('./acorex-platform-module-workflow-management-client-index-nljwSnXl.mjs').then((c) => c.TakeOverWorkflowRunCommand),
3307
+ command: () => import('./acorex-platform-module-workflow-management-client-index-Bx8vYkYe.mjs').then((c) => c.TakeOverWorkflowRunCommand),
3308
3308
  },
3309
3309
  {
3310
3310
  key: 'WorkflowManagement.WorkflowRun:ShowHistory',
3311
- command: () => import('./acorex-platform-module-workflow-management-client-index-nljwSnXl.mjs').then((c) => c.ShowWorkflowRunHistoryCommand),
3311
+ command: () => import('./acorex-platform-module-workflow-management-client-index-Bx8vYkYe.mjs').then((c) => c.ShowWorkflowRunHistoryCommand),
3312
3312
  },
3313
3313
  {
3314
3314
  key: 'WorkflowManagement.WorkflowRun:ShowHistory',
3315
- command: () => import('./acorex-platform-module-workflow-management-client-index-nljwSnXl.mjs').then((c) => c.ShowWorkflowRunHistoryCommand),
3315
+ command: () => import('./acorex-platform-module-workflow-management-client-index-Bx8vYkYe.mjs').then((c) => c.ShowWorkflowRunHistoryCommand),
3316
3316
  },
3317
3317
  ]),
3318
3318
  // provideEntity([RootConfig.entities.activityDefinition.fullName]),
@@ -3756,6 +3756,108 @@ async function rehydrateWorkflowStateInputTitles(workflowState, translationServi
3756
3756
  }
3757
3757
  //#endregion
3758
3758
 
3759
+ //#region ----- Types -----
3760
+ function isRecord$1(value) {
3761
+ return value != null && typeof value === 'object' && !Array.isArray(value);
3762
+ }
3763
+ function resolveText(value) {
3764
+ return typeof value === 'string' ? value.trim() : '';
3765
+ }
3766
+ /** Workflow / task-board metadata keys that must not replace a business record id. */
3767
+ const TASK_BOARD_META_KEYS = new Set([
3768
+ 'instanceId',
3769
+ 'bookmarkId',
3770
+ 'activityId',
3771
+ 'activityType',
3772
+ 'activityName',
3773
+ 'taskToken',
3774
+ 'entityRefId',
3775
+ 'entityRefType',
3776
+ 'definitionId',
3777
+ 'statusColor',
3778
+ 'entityStatusDefinition',
3779
+ 'entityStatusDefinitionKey',
3780
+ 'hasExplicitDueDate',
3781
+ 'bookmarkConsumed',
3782
+ 'titleKey',
3783
+ 'descriptionKey',
3784
+ 'taskI18nParams',
3785
+ 'payload',
3786
+ 'dueStatus',
3787
+ ]);
3788
+ //#endregion
3789
+ //#region ----- Business record id -----
3790
+ /**
3791
+ * Resolves the business record id for a delegated platform command.
3792
+ * Prefers explicit command `data.id` / `workOrderId`, then bookmark context, then entityRef.
3793
+ * Never returns the workflow instance id or bookmark id.
3794
+ */
3795
+ function resolveBusinessRecordIdFromTaskContext(input) {
3796
+ const fromCommand = resolveText(input.commandData?.['id']) ||
3797
+ resolveText(input.commandData?.['workOrderId']);
3798
+ if (fromCommand) {
3799
+ return fromCommand;
3800
+ }
3801
+ const context = input.context ?? {};
3802
+ const fromContext = resolveText(context['workOrderId']) ||
3803
+ resolveText(context['id']) ||
3804
+ resolveText(context['documentId']) ||
3805
+ resolveText(context['taskId']) ||
3806
+ resolveText(context['lifecycleEventId']);
3807
+ if (fromContext) {
3808
+ return fromContext;
3809
+ }
3810
+ const refId = resolveText(input.entityRefId ?? input.taskData?.['entityRefId']);
3811
+ const refType = resolveText(input.entityRefType ?? input.taskData?.['entityRefType']);
3812
+ const expected = resolveText(input.expectedEntityRefType);
3813
+ if (refId && (!expected || refType === expected)) {
3814
+ return refId;
3815
+ }
3816
+ return '';
3817
+ }
3818
+ /**
3819
+ * Builds `options.data` for a delegated platform command so business-record
3820
+ * fields from the action definition / bookmark context are preserved.
3821
+ * Task-board metadata stays alongside (instanceId, bookmarkId, …) without
3822
+ * overwriting `id` with a bookmark or workflow-instance id.
3823
+ */
3824
+ function buildDelegatedPlatformCommandData(input) {
3825
+ const commandOptions = isRecord$1(input.commandOptions) ? input.commandOptions : {};
3826
+ const nestedData = isRecord$1(commandOptions['data']) ? commandOptions['data'] : {};
3827
+ const context = isRecord$1(input.context) ? input.context : {};
3828
+ const taskData = isRecord$1(input.taskData) ? input.taskData : {};
3829
+ const payload = isRecord$1(taskData['payload']) ? taskData['payload'] : {};
3830
+ const payloadContext = isRecord$1(payload['context']) ? payload['context'] : {};
3831
+ const mergedContext = { ...payloadContext, ...context };
3832
+ const businessId = resolveBusinessRecordIdFromTaskContext({
3833
+ commandData: nestedData,
3834
+ context: mergedContext,
3835
+ taskData,
3836
+ entityRefId: taskData['entityRefId'],
3837
+ entityRefType: taskData['entityRefType'],
3838
+ expectedEntityRefType: input.expectedEntityRefType,
3839
+ });
3840
+ const taskMeta = {};
3841
+ for (const [key, value] of Object.entries(taskData)) {
3842
+ if (TASK_BOARD_META_KEYS.has(key)) {
3843
+ taskMeta[key] = value;
3844
+ }
3845
+ }
3846
+ const data = {
3847
+ ...nestedData,
3848
+ ...mergedContext,
3849
+ ...taskMeta,
3850
+ };
3851
+ if (businessId) {
3852
+ data['id'] = businessId;
3853
+ if (!resolveText(data['workOrderId']) && (mergedContext['workOrderId'] || nestedData['workOrderId'] || input.expectedEntityRefType)) {
3854
+ data['workOrderId'] = businessId;
3855
+ }
3856
+ }
3857
+ return data;
3858
+ }
3859
+ //#endregion
3860
+
3759
3861
  //#region ---- Imports ----
3760
3862
  /**
3761
3863
  * Injection token for provider config. Use when registering via DI (provide token + useFactory with deps).
@@ -4293,20 +4395,27 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
4293
4395
  }
4294
4396
  if (this.isDelegatedPlatformCommand(command.name)) {
4295
4397
  const options = isRecord(command.options) ? command.options : {};
4296
- const nestedData = isRecord(options['data']) ? options['data'] : {};
4297
4398
  const rowData = isRecord(taskData) ? taskData : {};
4298
4399
  const payload = isRecord(rowData['payload']) ? rowData['payload'] : {};
4299
4400
  const payloadContext = isRecord(payload['context']) ? payload['context'] : {};
4401
+ const expectedEntityRefType = typeof rowData['entityRefType'] === 'string' ? String(rowData['entityRefType']).trim() : undefined;
4402
+ const data = buildDelegatedPlatformCommandData({
4403
+ commandOptions: options,
4404
+ context: payloadContext,
4405
+ taskData: rowData,
4406
+ expectedEntityRefType,
4407
+ });
4300
4408
  const documentId = (typeof options['documentId'] === 'string' ? options['documentId'].trim() : '') ||
4301
- (typeof payloadContext['documentId'] === 'string' ? payloadContext['documentId'].trim() : '');
4409
+ (typeof data['documentId'] === 'string' ? String(data['documentId']).trim() : '');
4302
4410
  const delegated = await this.commandService.execute(command.name, {
4303
4411
  ...options,
4304
4412
  ...(documentId ? { documentId } : {}),
4305
- data: {
4306
- ...nestedData,
4307
- ...rowData,
4308
- ...(documentId ? { documentId } : {}),
4309
- },
4413
+ // Preserve task-board ids for commands that close the source card after success.
4414
+ instanceId: options['instanceId'] ?? rowData['instanceId'],
4415
+ bookmarkId: options['bookmarkId'] ?? rowData['bookmarkId'],
4416
+ activityId: options['activityId'] ?? rowData['activityId'],
4417
+ taskToken: options['taskToken'] ?? rowData['taskToken'],
4418
+ data,
4310
4419
  });
4311
4420
  return delegated ?? { success: false };
4312
4421
  }
@@ -4364,12 +4473,24 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
4364
4473
  if (this.isDelegatedPlatformCommand(actionName)) {
4365
4474
  const isSignAction = actionName.toLowerCase().includes('sign');
4366
4475
  const isViewDocumentAction = action.name === 'view-document' || actionName.toLowerCase().includes('document:open');
4476
+ const declaredPriority = action.priority;
4477
+ const expectedEntityRefType = typeof taskData?.entityRefType === 'string' ? String(taskData.entityRefType).trim() : undefined;
4478
+ const delegatedData = buildDelegatedPlatformCommandData({
4479
+ commandOptions,
4480
+ context,
4481
+ taskData: isRecord(taskData) ? taskData : {},
4482
+ expectedEntityRefType,
4483
+ });
4367
4484
  actions.push({
4368
4485
  name: action.name || actionName,
4369
4486
  title: this.resolveWorkflowActionTitle(action.title, actionName),
4370
4487
  icon: action.icon,
4371
4488
  color: action.color,
4372
- priority: isSignAction || isViewDocumentAction ? 'primary' : 'secondary',
4489
+ priority: declaredPriority === 'primary' || declaredPriority === 'secondary'
4490
+ ? declaredPriority
4491
+ : isSignAction || isViewDocumentAction
4492
+ ? 'primary'
4493
+ : 'secondary',
4373
4494
  command: {
4374
4495
  name: actionName,
4375
4496
  options: {
@@ -4379,7 +4500,8 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
4379
4500
  bookmarkId: taskData.bookmarkId,
4380
4501
  activityId: taskData.activityId,
4381
4502
  taskToken: taskData.taskToken,
4382
- data: taskData,
4503
+ // Keep business-record data (e.g. WorkOrder id); do not replace with taskData.
4504
+ data: delegatedData,
4383
4505
  },
4384
4506
  },
4385
4507
  });
@@ -5031,7 +5153,7 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
5031
5153
  //#endregion
5032
5154
  //#region ---- Component ----
5033
5155
  getComponent() {
5034
- return () => import('./acorex-platform-module-workflow-management-client-workflow-task-popover.component-Cmcd551i.mjs').then((m) => m.AXMWorkflowTaskPopoverComponent);
5156
+ return () => import('./acorex-platform-module-workflow-management-client-workflow-task-popover.component-BXutLQAO.mjs').then((m) => m.AXMWorkflowTaskPopoverComponent);
5035
5157
  }
5036
5158
  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 }); }
5037
5159
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPGenericWorkflowTaskProvider }); }
@@ -5054,4 +5176,4 @@ var genericWorkflowTask_provider = /*#__PURE__*/Object.freeze({
5054
5176
  */
5055
5177
 
5056
5178
  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 };
5057
- //# sourceMappingURL=acorex-platform-module-workflow-management-client-acorex-platform-module-workflow-management-client-DwHNK7p5.mjs.map
5179
+ //# sourceMappingURL=acorex-platform-module-workflow-management-client-acorex-platform-module-workflow-management-client-BcOBHoOK.mjs.map