@acorex-platform/module-assessment-management-client 0.0.53 → 0.0.56

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 (74) hide show
  1. package/fesm2022/{acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-CZtfv53E.mjs → acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-juxXq2pM.mjs} +42 -42
  2. package/fesm2022/{acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-CZtfv53E.mjs.map → acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-juxXq2pM.mjs.map} +1 -1
  3. package/fesm2022/{acorex-platform-module-assessment-management-client-assessment-voice.commands-DvD4E7zS.mjs → acorex-platform-module-assessment-management-client-assessment-voice.commands-CaElbuNh.mjs} +2 -2
  4. package/fesm2022/{acorex-platform-module-assessment-management-client-assessment-voice.commands-DvD4E7zS.mjs.map → acorex-platform-module-assessment-management-client-assessment-voice.commands-CaElbuNh.mjs.map} +1 -1
  5. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-assessment-case.mjs +1 -1
  6. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-assessment-case.mjs.map +1 -1
  7. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-assessment-session.mjs +1 -1
  8. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-assessment-session.mjs.map +1 -1
  9. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-question-bank-item.mjs +1 -1
  10. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-question-bank-item.mjs.map +1 -1
  11. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-questionnaire.mjs +1 -1
  12. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-questionnaire.mjs.map +1 -1
  13. package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-acorex-platform-module-assessment-management-client-contracts-entity-catalog-Pa8mdKRV.mjs → acorex-platform-module-assessment-management-client-contracts-entity-catalog-acorex-platform-module-assessment-management-client-contracts-entity-catalog-DYpWu3Vx.mjs} +6 -6
  14. package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-acorex-platform-module-assessment-management-client-contracts-entity-catalog-Pa8mdKRV.mjs.map → acorex-platform-module-assessment-management-client-contracts-entity-catalog-acorex-platform-module-assessment-management-client-contracts-entity-catalog-DYpWu3Vx.mjs.map} +1 -1
  15. package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-case.entity-DJeaqilT.mjs → acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-case.entity-CUctZ-0K.mjs} +3 -3
  16. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-case.entity-CUctZ-0K.mjs.map +1 -0
  17. package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-session.entity-BSP4UQ47.mjs → acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-session.entity-C2JJw_JJ.mjs} +3 -3
  18. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-session.entity-C2JJw_JJ.mjs.map +1 -0
  19. package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-question-bank-item.entity-CVgepxbX.mjs → acorex-platform-module-assessment-management-client-contracts-entity-catalog-question-bank-item.entity-D3y_rWUI.mjs} +3 -3
  20. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-question-bank-item.entity-D3y_rWUI.mjs.map +1 -0
  21. package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-questionnaire.entity-8Dqdbm6i.mjs → acorex-platform-module-assessment-management-client-contracts-entity-catalog-questionnaire.entity-CVz5W0fF.mjs} +3 -3
  22. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-questionnaire.entity-CVz5W0fF.mjs.map +1 -0
  23. package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-template.entity-BTDJAnF1.mjs → acorex-platform-module-assessment-management-client-contracts-entity-catalog-template.entity-C01AW5NW.mjs} +2 -2
  24. package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-template.entity-BTDJAnF1.mjs.map → acorex-platform-module-assessment-management-client-contracts-entity-catalog-template.entity-C01AW5NW.mjs.map} +1 -1
  25. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog.mjs +1 -1
  26. package/fesm2022/{acorex-platform-module-assessment-management-client-fill-assessment-session.command-Dp6gSQWO.mjs → acorex-platform-module-assessment-management-client-fill-assessment-session.command-CMIq-DDl.mjs} +15 -8
  27. package/fesm2022/acorex-platform-module-assessment-management-client-fill-assessment-session.command-CMIq-DDl.mjs.map +1 -0
  28. package/fesm2022/{acorex-platform-module-assessment-management-client-form-template-viewer-popup.component-B94T15Vb.mjs → acorex-platform-module-assessment-management-client-form-template-viewer-popup.component-COZcUPEj.mjs} +2 -2
  29. package/fesm2022/{acorex-platform-module-assessment-management-client-form-template-viewer-popup.component-B94T15Vb.mjs.map → acorex-platform-module-assessment-management-client-form-template-viewer-popup.component-COZcUPEj.mjs.map} +1 -1
  30. package/fesm2022/{acorex-platform-module-assessment-management-client-form-template-viewer.service-DpEeqw34.mjs → acorex-platform-module-assessment-management-client-form-template-viewer.service-CvSRpoos.mjs} +3 -3
  31. package/fesm2022/{acorex-platform-module-assessment-management-client-form-template-viewer.service-DpEeqw34.mjs.map → acorex-platform-module-assessment-management-client-form-template-viewer.service-CvSRpoos.mjs.map} +1 -1
  32. package/fesm2022/{acorex-platform-module-assessment-management-client-open-form-template.command-5E3IK-OG.mjs → acorex-platform-module-assessment-management-client-open-form-template.command-CmR-xFHE.mjs} +3 -3
  33. package/fesm2022/{acorex-platform-module-assessment-management-client-open-form-template.command-5E3IK-OG.mjs.map → acorex-platform-module-assessment-management-client-open-form-template.command-CmR-xFHE.mjs.map} +1 -1
  34. package/fesm2022/{acorex-platform-module-assessment-management-client-preview-form-template.command-COIcfqBQ.mjs → acorex-platform-module-assessment-management-client-preview-form-template.command-BEzE0620.mjs} +2 -2
  35. package/fesm2022/{acorex-platform-module-assessment-management-client-preview-form-template.command-COIcfqBQ.mjs.map → acorex-platform-module-assessment-management-client-preview-form-template.command-BEzE0620.mjs.map} +1 -1
  36. package/fesm2022/{acorex-platform-module-assessment-management-client-preview-question.command-ZTIjmXdy.mjs → acorex-platform-module-assessment-management-client-preview-question.command-BGT8qB1_.mjs} +10 -7
  37. package/fesm2022/acorex-platform-module-assessment-management-client-preview-question.command-BGT8qB1_.mjs.map +1 -0
  38. package/fesm2022/{acorex-platform-module-assessment-management-client-preview-questionnaire.command-CyiaPtLs.mjs → acorex-platform-module-assessment-management-client-preview-questionnaire.command-duK7Tjjp.mjs} +8 -10
  39. package/fesm2022/acorex-platform-module-assessment-management-client-preview-questionnaire.command-duK7Tjjp.mjs.map +1 -0
  40. package/fesm2022/{acorex-platform-module-assessment-management-client-preview-session-pdf.command-BsiJU6ep.mjs → acorex-platform-module-assessment-management-client-preview-session-pdf.command-DjBxg7Yn.mjs} +2 -2
  41. package/fesm2022/acorex-platform-module-assessment-management-client-preview-session-pdf.command-DjBxg7Yn.mjs.map +1 -0
  42. package/fesm2022/{acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-CRRrPiJ9.mjs → acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-B7_G_C5B.mjs} +2 -2
  43. package/fesm2022/{acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-CRRrPiJ9.mjs.map → acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-B7_G_C5B.mjs.map} +1 -1
  44. package/fesm2022/{acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-Cn3kk7b6.mjs → acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-daQL4OD_.mjs} +2 -2
  45. package/fesm2022/{acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-Cn3kk7b6.mjs.map → acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-daQL4OD_.mjs.map} +1 -1
  46. package/fesm2022/{acorex-platform-module-assessment-management-client-review-assessment-session.command-Cf6SKE8F.mjs → acorex-platform-module-assessment-management-client-review-assessment-session.command-CPeFh1m7.mjs} +12 -7
  47. package/fesm2022/acorex-platform-module-assessment-management-client-review-assessment-session.command-CPeFh1m7.mjs.map +1 -0
  48. package/fesm2022/{acorex-platform-module-assessment-management-client-template-picker.component-RFv42PnE.mjs → acorex-platform-module-assessment-management-client-template-picker.component-D_UCdFOH.mjs} +3 -3
  49. package/fesm2022/acorex-platform-module-assessment-management-client-template-picker.component-D_UCdFOH.mjs.map +1 -0
  50. package/fesm2022/{acorex-platform-module-assessment-management-client-template-widget-edit.component-D3XNxDqe.mjs → acorex-platform-module-assessment-management-client-template-widget-edit.component-DERabYdH.mjs} +2 -2
  51. package/fesm2022/{acorex-platform-module-assessment-management-client-template-widget-edit.component-D3XNxDqe.mjs.map → acorex-platform-module-assessment-management-client-template-widget-edit.component-DERabYdH.mjs.map} +1 -1
  52. package/fesm2022/{acorex-platform-module-assessment-management-client-view-session-answers.command-DlnnmAlD.mjs → acorex-platform-module-assessment-management-client-view-session-answers.command-DjJajIkL.mjs} +2 -2
  53. package/fesm2022/{acorex-platform-module-assessment-management-client-view-session-answers.command-DlnnmAlD.mjs.map → acorex-platform-module-assessment-management-client-view-session-answers.command-DjJajIkL.mjs.map} +1 -1
  54. package/fesm2022/acorex-platform-module-assessment-management-client.mjs +1 -1
  55. package/i18n/en-AU/assessment-management.json +1083 -0
  56. package/i18n/en-AU/form-template-management.json +322 -0
  57. package/i18n/en-AU/questionnaire.json +195 -0
  58. package/i18n/en-US/assessment-management.json +1083 -0
  59. package/i18n/en-US/form-template-management.json +322 -0
  60. package/i18n/en-US/questionnaire.json +195 -0
  61. package/i18n/fa-IR/assessment-management.json +1118 -0
  62. package/i18n/fa-IR/form-template-management.json +322 -0
  63. package/i18n/fa-IR/questionnaire.json +195 -0
  64. package/package.json +3 -3
  65. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-case.entity-DJeaqilT.mjs.map +0 -1
  66. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-session.entity-BSP4UQ47.mjs.map +0 -1
  67. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-question-bank-item.entity-CVgepxbX.mjs.map +0 -1
  68. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-questionnaire.entity-8Dqdbm6i.mjs.map +0 -1
  69. package/fesm2022/acorex-platform-module-assessment-management-client-fill-assessment-session.command-Dp6gSQWO.mjs.map +0 -1
  70. package/fesm2022/acorex-platform-module-assessment-management-client-preview-question.command-ZTIjmXdy.mjs.map +0 -1
  71. package/fesm2022/acorex-platform-module-assessment-management-client-preview-questionnaire.command-CyiaPtLs.mjs.map +0 -1
  72. package/fesm2022/acorex-platform-module-assessment-management-client-preview-session-pdf.command-BsiJU6ep.mjs.map +0 -1
  73. package/fesm2022/acorex-platform-module-assessment-management-client-review-assessment-session.command-Cf6SKE8F.mjs.map +0 -1
  74. package/fesm2022/acorex-platform-module-assessment-management-client-template-picker.component-RFv42PnE.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-assessment-management-client-fill-assessment-session.command-CMIq-DDl.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/questionnaire-viewer/commands/fill-assessment-session.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult, type AXPMultiLanguageString } from '@acorex-platform/framework-shared/core';\n\nimport { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport { AXPDebugService } from '@acorex-platform/framework-client/core';\nimport { Injectable, inject } from '@angular/core';\nimport { defaultTo, first, get, isString } from 'lodash';\nimport { Router } from '@angular/router';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXMQuestionnaireViewerService } from '../questionnaire-viewer.service';\nimport type { AXMAssessmentManagementAssessmentCaseEntityModel } from '@acorex-platform/module-assessment-management-client/contracts';\nimport type { AXMAssessmentManagementAssessmentSessionEntityModel } from '@acorex-platform/module-assessment-management-client/contracts';\nimport type { AXMAssessmentManagementQuestionnaireEntityModel } from '@acorex-platform/module-assessment-management-client/contracts';\nimport {\n normalizeCompletionMode,\n toDisplaySettings,\n toPrePostConfig,\n toPrintSettings,\n} from '@acorex-platform/module-assessment-management-client/contracts';\nimport {\n RootConfig,\n type QuestionnaireCompletionMode,\n type QuestionnaireBuilderValue,\n} from '@acorex-platform/module-assessment-management-client/contracts';\n\n//#endregion\n\n//#region ---- Command Input/Output Types ----\n\n/**\n * How to show the questionnaire viewer when filling an assessment session.\n */\nexport type FillAssessmentSessionShowAs = 'popup' | 'page' | 'standalone';\n\nexport type FillAssessmentSessionOutcome = 'Submitted' | 'Saved' | 'Cancelled';\n\n/**\n * Input for FillAssessmentSession command.\n */\nexport interface FillAssessmentSessionCommandInput {\n caseId: string;\n sessionId?: string;\n /** Popup viewer title; falls back to assessment case title when omitted. */\n title?: AXPMultiLanguageString;\n showAs?: FillAssessmentSessionShowAs;\n responderId?: string;\n role?: 'responder' | 'supervisor' | 'reviewer';\n /** Overrides questionnaire display.completionMode when set. */\n completionMode?: QuestionnaireCompletionMode;\n /** Question answer keys that must stay readonly (e.g. asset prefill on work-order checklists). */\n readonlyAnswerKeys?: string[];\n}\n\n//#endregion\n\n//#region ---- Fill Assessment Session Command ----\n\n/**\n * Opens questionnaire viewer for filling/editing assessment session with draft save and workflow outcomes.\n */\n@Injectable()\nexport class FillAssessmentSessionCommand implements AXPCommand<FillAssessmentSessionCommandInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly sessionService = inject(AXPSessionService);\n private readonly router = inject(Router);\n private readonly entityService = inject(AXPEntityService);\n private readonly questionnaireViewerService = inject(AXMQuestionnaireViewerService);\n private readonly translationService = inject(AXTranslationService);\n private readonly debug = inject(AXPDebugService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: FillAssessmentSessionCommandInput): AXPCommandExecuteResultPromise<void> {\n try {\n const assessmentCase = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentCase.name)\n .data<string, AXMAssessmentManagementAssessmentCaseEntityModel>()\n .byKey(input.caseId);\n if (!assessmentCase) {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync(\n '@assessment-management:commands.fill-assessment-session.errors.case-not-found',\n { params: { caseId: input.caseId } },\n ),\n },\n metadata: { outcome: 'Cancelled' },\n };\n }\n\n const questionnaire = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.questionnaire.name)\n .data<string, AXMAssessmentManagementQuestionnaireEntityModel>()\n .byKey(assessmentCase.questionnaireId);\n if (!questionnaire) {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync(\n '@assessment-management:commands.fill-assessment-session.errors.questionnaire-not-found',\n { params: { questionnaireId: assessmentCase.questionnaireId } },\n ),\n },\n metadata: { outcome: 'Cancelled' },\n };\n }\n\n const questions = questionnaire.questions ?? { sections: [] };\n const structure: QuestionnaireBuilderValue = {\n ...questions,\n sections: questions.sections ?? [],\n displaySettings: toDisplaySettings(questionnaire) ?? undefined,\n printSettings: toPrintSettings(questionnaire) ?? undefined,\n };\n if (!structure.sections.length) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.fill-assessment-session.errors.no-questions' },\n metadata: { outcome: 'Cancelled' },\n };\n }\n\n const currentUser = this.sessionService.user;\n const responderId = input.responderId || currentUser?.id;\n if (!responderId) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.fill-assessment-session.errors.no-responder' },\n metadata: { outcome: 'Cancelled' },\n };\n }\n\n const role = input.role || 'responder';\n const displaySettings = toDisplaySettings(questionnaire);\n const completionMode: QuestionnaireCompletionMode =\n input.completionMode ?? normalizeCompletionMode(displaySettings?.completionMode);\n\n let existingSession: AXMAssessmentManagementAssessmentSessionEntityModel | null = null;\n let sessionId = input.sessionId ?? null;\n let initialAnswers: Record<string, unknown> = {};\n\n if (sessionId) {\n existingSession = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentSession.name)\n .data<string, AXMAssessmentManagementAssessmentSessionEntityModel>()\n .byKey(sessionId);\n if (existingSession) {\n initialAnswers = (existingSession.answers as Record<string, unknown>) || {};\n }\n }\n\n const sessionSubmitted = existingSession?.statusId === 'submitted';\n\n const showAs = input.showAs ?? 'popup';\n const appName = this.sessionService.application?.name ?? 'demo';\n const moduleRoute = (RootConfig.module as { route?: string }).route ?? 'assessment-management';\n\n if (showAs === 'page') {\n const path = `/${appName}/${moduleRoute}/questionnaire/fill/${input.caseId}`;\n const url = sessionId ? `${path}?sessionId=${encodeURIComponent(sessionId)}` : path;\n this.router.navigateByUrl(url);\n return { success: true, kind: 'object', data: undefined, metadata: { outcome: 'Cancelled' } };\n }\n\n if (showAs === 'standalone') {\n let sessionIdToOpen = sessionId;\n if (!sessionIdToOpen) {\n const now = new Date();\n sessionIdToOpen = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentSession.name)\n .data<string, AXMAssessmentManagementAssessmentSessionEntityModel>()\n .create({\n caseId: input.caseId,\n responderId,\n role,\n answers: {},\n progressPercentage: 0,\n answeredQuestionsCount: 0,\n lastSavedAt: now,\n startedAt: now,\n statusId: 'not-started',\n } as Omit<AXMAssessmentManagementAssessmentSessionEntityModel, 'id'>);\n }\n if (sessionIdToOpen) {\n this.router.navigateByUrl(`/assessment/fill/${sessionIdToOpen}`);\n }\n return { success: true, kind: 'object', data: undefined, metadata: { outcome: 'Cancelled' } };\n }\n\n const viewerTitle = await this.resolveViewerTitle(input.title, assessmentCase.title);\n\n const viewerConfig = {\n readonly: sessionSubmitted,\n completionMode,\n validationStrategy: displaySettings?.validationStrategy,\n viewMode: displaySettings?.viewMode,\n showProgressBar: displaySettings?.showProgressBar,\n timer: { showTimer: displaySettings?.showTimer ?? false },\n showQuestionNumbers: displaySettings?.showQuestionNumbers,\n readonlyAnswerKeys: input.readonlyAnswerKeys,\n };\n\n const result = await this.questionnaireViewerService.open({\n title: viewerTitle,\n structure,\n prePostConfig: toPrePostConfig(questionnaire),\n config: viewerConfig,\n initialAnswers,\n questionnaireId: questionnaire.id,\n assessmentFillContext: sessionSubmitted\n ? undefined\n : {\n caseId: input.caseId,\n sessionId: sessionId ?? null,\n responderId,\n role,\n },\n });\n\n const outcome = await this.resolveFillOutcome(input.caseId, input.sessionId ?? sessionId, result);\n this.debug.trace(\n 'assessment-management',\n 'fill-assessment-session',\n 'Resolved fill workflow outcome',\n () => ({\n caseId: input.caseId,\n sessionId: input.sessionId ?? sessionId,\n popupResult: {\n saved: result?.saved === true,\n submitted: result?.submitted === true,\n hasPayload: result != null,\n },\n outcome,\n }),\n );\n return { success: true, kind: 'object', data: undefined, metadata: { outcome },\n };\n } catch (error: unknown) {\n const fallback = await this.translationService.translateAsync(\n '@general:messages.generic.error.description',\n );\n const message = error instanceof Error ? error.message : fallback;\n console.error('Error filling assessment session:', error);\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync(\n '@assessment-management:commands.fill-assessment-session.errors.failed',\n { params: { message } },\n ),\n },\n metadata: { outcome: 'Cancelled' },\n };\n }\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n /**\n * Resolves popup title: explicit input, then case title, then translated default.\n */\n private async resolveViewerTitle(\n inputTitle: AXPMultiLanguageString | undefined,\n caseTitle: string | undefined,\n ): Promise<string> {\n const explicit = this.normalizeTitle(inputTitle);\n if (explicit) {\n return explicit;\n }\n\n const fromCase = this.normalizeTitle(caseTitle);\n if (fromCase) {\n return fromCase;\n }\n\n const fillTitleKey = '@assessment-management:cases.actions.fill-assessment.title';\n const fillTitleBase = await this.translationService.translateAsync(fillTitleKey);\n return fillTitleBase || 'Fill Assessment';\n }\n\n /** Resolves a multi-language or plain string title for the active locale. */\n private normalizeTitle(value: AXPMultiLanguageString | string | undefined | null | false): string {\n if (value == null || value === false) {\n return '';\n }\n if (typeof value === 'string') {\n return value.trim();\n }\n const locale = this.translationService.getActiveLang();\n return resolveMultiLanguageString(value, locale).trim();\n }\n\n /**\n * Resolves workflow outcome from popup result, falling back to persisted session status only\n * when the popup is dismissed without an explicit close payload.\n * After submit the viewer may show a summary step; closing via X without \"Done\" still leaves\n * the session submitted and must advance the workflow. Save-as-draft always sends an explicit\n * payload ({ saved: true }); inferring Submitted from the DB when a payload exists can wrongly\n * advance the workflow if flags are missing or a stale submitted session is resolved.\n */\n private async resolveFillOutcome(\n caseId: string,\n sessionId: string | null | undefined,\n result: { submitted?: boolean; saved?: boolean } | null | undefined,\n ): Promise<FillAssessmentSessionOutcome> {\n if (result?.saved) {\n return 'Saved';\n }\n if (result?.submitted) {\n return 'Submitted';\n }\n\n if (result != null) {\n return 'Cancelled';\n }\n\n const sessionSubmitted = await this.isAssessmentSessionSubmitted(caseId, sessionId);\n if (sessionSubmitted) {\n return 'Submitted';\n }\n\n return 'Cancelled';\n }\n\n private async isAssessmentSessionSubmitted(\n caseId: string,\n sessionId: string | null | undefined,\n ): Promise<boolean> {\n const resolvedSessionId = this.resolveText(sessionId) || (await this.findLatestSessionIdForCase(caseId));\n if (!resolvedSessionId) {\n return false;\n }\n\n const session = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentSession.name)\n .data<string, AXMAssessmentManagementAssessmentSessionEntityModel>()\n .byKey(resolvedSessionId);\n\n return get(session, 'statusId') === 'submitted';\n }\n\n private async findLatestSessionIdForCase(caseId: string): Promise<string> {\n const page = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentSession.name)\n .data<string, AXMAssessmentManagementAssessmentSessionEntityModel>()\n .query({\n skip: 0,\n take: 1,\n sort: [{ field: 'lastSavedAt', direction: 'desc' }],\n filter: {\n logic: 'and',\n filters: [{ field: 'caseId', operator: { type: 'equal' }, value: caseId }],\n },\n } as never);\n\n const session = first(defaultTo(get(page, 'items'), []));\n return this.resolveText(get(session, 'id'));\n }\n\n private resolveText(value: unknown): string {\n if (!isString(value)) {\n return '';\n }\n return value.trim();\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;;;AAwDA;AAEA;AAEA;;AAEG;MAEU,4BAA4B,CAAA;AADzC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC1C,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AACvB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,0BAA0B,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAClE,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AACjD,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,eAAe,CAAC;AAgTjD,IAAA;;;IA1SC,MAAM,OAAO,CAAC,KAAwC,EAAA;AACpD,QAAA,IAAI;AACF,YAAA,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC;AAC/B,iBAAA,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI;AAC1E,iBAAA,IAAI;AACJ,iBAAA,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC;YACtB,IAAI,CAAC,cAAc,EAAE;gBACnB,OAAO;AACL,oBAAA,OAAO,EAAE,KAAK;AACd,oBAAA,OAAO,EAAE;wBACP,IAAI,EAAE,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAChD,+EAA+E,EAC/E,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,CACrC;AACF,qBAAA;AACD,oB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AAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AACpB,YAAA,OAAO,EAAE;QACX;AACA,QAAA,OAAO,KAAK,CAAC,IAAI,EAAE;IACrB;8GArTW,4BAA4B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAA5B,4BAA4B,EAAA,CAAA,CAAA;;2FAA5B,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBADxC;;;"}
@@ -15,7 +15,7 @@ import * as i3 from '@angular/common';
15
15
  import { CommonModule } from '@angular/common';
16
16
  import * as i0 from '@angular/core';
17
17
  import { inject, viewChild, signal, computed, effect, Input, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
18
- import { a as AXMQuestionnaireViewerService, k as resolveSummaryPlaceholders, g as AXMPreQuestionnaireContentComponent, h as AXMPostQuestionnaireContentComponent } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-CZtfv53E.mjs';
18
+ import { a as AXMQuestionnaireViewerService, k as resolveSummaryPlaceholders, g as AXMPreQuestionnaireContentComponent, h as AXMPostQuestionnaireContentComponent } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-juxXq2pM.mjs';
19
19
 
20
20
  //#region ----- Imports -----
21
21
  const EMPTY_OUTCOME_STRUCTURE = { sections: [] };
@@ -235,4 +235,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
235
235
  }] } });
236
236
 
237
237
  export { AXMFormTemplateViewerPopupComponent };
238
- //# sourceMappingURL=acorex-platform-module-assessment-management-client-form-template-viewer-popup.component-B94T15Vb.mjs.map
238
+ //# sourceMappingURL=acorex-platform-module-assessment-management-client-form-template-viewer-popup.component-COZcUPEj.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-platform-module-assessment-management-client-form-template-viewer-popup.component-B94T15Vb.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/form-template/viewer/pages/form-template-viewer-popup/form-template-viewer-popup.component.ts","../../../../libs/modules/assessment-management/client/src/lib/features/form-template/viewer/pages/form-template-viewer-popup/form-template-viewer-popup.component.html"],"sourcesContent":["//#region ----- Imports -----\n\nimport { AXButtonModule } from '@acorex/components/button';\nimport { AXDecoratorModule } from '@acorex/components/decorators';\nimport { AXFormComponent, AXFormModule } from '@acorex/components/form';\nimport { AXBasePageComponent } from '@acorex/components/page';\nimport { AXTranslationModule, AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { DomSanitizer, type SafeHtml } from '@angular/platform-browser';\nimport {\n AXP_LOCAL_DATA_SOURCE_STORE,\n AXPWidgetCoreModule,\n createReadonlyLocalDataSourceStore,\n readLocalDataSourcesFromNode,\n} from '@acorex-platform/framework-client/layout/widget-core';\nimport { AXPContextChangeEvent, AXPWidgetsCatalog, type AXPWidgetNode } from '@acorex-platform/framework-shared/core';\nimport type {\n PrePostConfig,\n QuestionnaireBuilderValue,\n} from '@acorex-platform/module-assessment-management-client/contracts';\nimport { CommonModule } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n effect,\n inject,\n Input,\n signal,\n viewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport { AXMPreQuestionnaireContentComponent } from '../../../../questionnaire-viewer/components/pre-questionnaire-content';\nimport { AXMPostQuestionnaireContentComponent } from '../../../../questionnaire-viewer/components/post-questionnaire-content';\nimport { AXMQuestionnaireViewerService } from '../../../../questionnaire-viewer/questionnaire-viewer.service';\nimport {\n resolveSummaryPlaceholders,\n type SummaryPlaceholderValues,\n} from '../../../../questionnaire-viewer/utils/pre-post-content.utils';\nimport type { AXMFormTemplateViewerConfig, AXMFormTemplateViewerResult } from '../../form-template-viewer.types';\n\n//#endregion\n\n//#region ----- Types -----\n\ntype FormFlowStep = 'pre' | 'form' | 'review' | 'results' | 'summary';\n\nconst EMPTY_OUTCOME_STRUCTURE: QuestionnaireBuilderValue = { sections: [] };\n\n//#endregion\n\n//#region ----- Component -----\n\n@Component({\n selector: 'axm-form-template-viewer-popup',\n templateUrl: './form-template-viewer-popup.component.html',\n styleUrl: './form-template-viewer-popup.component.css',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [\n CommonModule,\n AXTranslationModule,\n AXButtonModule,\n AXDecoratorModule,\n AXFormModule,\n AXPWidgetCoreModule,\n AXMPreQuestionnaireContentComponent,\n AXMPostQuestionnaireContentComponent,\n ],\n providers: [\n {\n provide: AXP_LOCAL_DATA_SOURCE_STORE,\n useFactory: (host: AXMFormTemplateViewerPopupComponent) =>\n createReadonlyLocalDataSourceStore(() => host.sources()),\n deps: [AXMFormTemplateViewerPopupComponent],\n },\n ],\n})\nexport class AXMFormTemplateViewerPopupComponent extends AXBasePageComponent {\n //#region ----- Services & Dependencies -----\n\n private readonly questionnaireViewerService = inject(AXMQuestionnaireViewerService);\n private readonly translationService = inject(AXTranslationService);\n private readonly sanitizer = inject(DomSanitizer);\n private readonly formRef = viewChild<AXFormComponent>('form');\n\n //#endregion\n\n //#region ----- Inputs -----\n\n @Input() set config(value: AXMFormTemplateViewerConfig | undefined) {\n this._config.set(value);\n }\n\n //#endregion\n\n //#region ----- State Signals -----\n\n protected readonly _config = signal<AXMFormTemplateViewerConfig | undefined>(undefined);\n protected readonly flowStep = signal<FormFlowStep>('form');\n protected readonly submitResult = signal<SummaryPlaceholderValues | null>(null);\n protected readonly isSubmitting = signal(false);\n protected readonly document = signal({ type: AXPWidgetsCatalog.document } as AXPWidgetNode);\n protected readonly currentPageIndex = signal(0);\n private readonly initialFlowApplied = signal(false);\n private readonly templateLoaded = signal(false);\n\n protected context: Record<string, unknown> = {};\n\n readonly sources = computed(() => readLocalDataSourcesFromNode(this.document()));\n\n protected readonly currentPage = computed(\n () => this.document().children?.[this.currentPageIndex()] ?? ({ type: AXPWidgetsCatalog.pageLayout } as AXPWidgetNode),\n );\n\n protected readonly prePostConfig = computed((): PrePostConfig | null => this._config()?.prePostConfig ?? null);\n\n protected readonly widgetMode = computed(() =>\n this._config()?.readOnly || this.flowStep() === 'review' ? 'view' : 'edit',\n );\n\n protected readonly showReviewButton = computed(\n () => this.flowStep() === 'form' && !this._config()?.readOnly && this.prePostConfig()?.post?.reviewEnabled === true,\n );\n\n protected readonly showSubmitButton = computed(\n () => this.flowStep() === 'form' && !this._config()?.readOnly && !this.showReviewButton(),\n );\n\n protected readonly isPreviewMode = computed(() => this._config()?.previewMode === true);\n\n protected readonly submitActionLabel = computed(() =>\n this.isPreviewMode()\n ? '@form-template-management:templates.viewer.preview.finish.title'\n : '@general:actions.submit.title',\n );\n\n /** Summary rich text with outcome placeholders. Empty author content stays blank. */\n protected readonly summaryHtml = computed((): SafeHtml | '' => {\n const content = this.prePostConfig()?.post?.summaryContent;\n const locale = this.translationService.getActiveLang?.() ?? 'en-US';\n let resolved = resolveMultiLanguageString(content, locale);\n const values = this.submitResult();\n if (resolved && values) {\n resolved = resolveSummaryPlaceholders(resolved, values);\n }\n return resolved ? this.sanitizer.bypassSecurityTrustHtml(resolved) : '';\n });\n\n //#endregion\n\n //#region ----- Lifecycle -----\n\n constructor() {\n super();\n effect(() => {\n const cfg = this._config();\n if (!cfg) {\n return;\n }\n if (!this.templateLoaded()) {\n this.loadTemplate(cfg);\n this.templateLoaded.set(true);\n }\n if (!this.initialFlowApplied()) {\n this.flowStep.set(cfg.prePostConfig?.pre?.enabled === true ? 'pre' : 'form');\n this.initialFlowApplied.set(true);\n }\n });\n }\n\n //#endregion\n\n //#region ----- Event Handlers -----\n\n protected handleContextChanged(event: AXPContextChangeEvent): void {\n this.context = event.data ?? {};\n }\n\n protected handleCancel(): void {\n this.finish(true);\n }\n\n protected handleStart(): void {\n this.flowStep.set('form');\n }\n\n protected handleEdit(): void {\n this.flowStep.set('form');\n }\n\n protected async handleReviewClick(): Promise<void> {\n if (!(await this.validateForm())) {\n return;\n }\n this.flowStep.set('review');\n }\n\n protected async handleSubmitClick(): Promise<void> {\n if (this.flowStep() === 'form' && !(await this.validateForm())) {\n return;\n }\n await this.advanceAfterSubmit();\n }\n\n protected handleResultsNext(): void {\n if (this.prePostConfig()?.post?.summaryEnabled) {\n this.flowStep.set('summary');\n return;\n }\n this.finish(false);\n }\n\n protected handleDone(): void {\n this.finish(false);\n }\n\n //#endregion\n\n //#region ----- Template Loading -----\n\n private loadTemplate(config: AXMFormTemplateViewerConfig): void {\n let templateData: AXPWidgetNode;\n if (typeof config.template === 'string') {\n try {\n templateData = JSON.parse(config.template) as AXPWidgetNode;\n } catch (error) {\n console.error('Failed to parse form template JSON:', error);\n return;\n }\n } else {\n templateData = config.template;\n }\n this.document.set(templateData);\n if (config.context) {\n this.context = { ...config.context };\n }\n }\n\n //#endregion\n\n //#region ----- Submit Flow -----\n\n private async validateForm(): Promise<boolean> {\n const form = this.formRef();\n if (!form) {\n return false;\n }\n const formResult = await form.validate();\n return formResult.result === true;\n }\n\n private async advanceAfterSubmit(): Promise<void> {\n if (this.isSubmitting()) {\n return;\n }\n this.isSubmitting.set(true);\n try {\n const rules = this._config()?.outcomeRules ?? [];\n const post = this.prePostConfig()?.post;\n let placeholders: SummaryPlaceholderValues | null = null;\n if (rules.length > 0) {\n placeholders = await this.questionnaireViewerService.buildSummaryPlaceholderValues(\n EMPTY_OUTCOME_STRUCTURE,\n this.context,\n { outcomeRules: rules },\n );\n }\n this.submitResult.set(placeholders);\n if (post?.showOutcomeResults) {\n this.flowStep.set('results');\n return;\n }\n if (post?.summaryEnabled) {\n this.flowStep.set('summary');\n return;\n }\n this.finish(false);\n } finally {\n this.isSubmitting.set(false);\n }\n }\n\n private finish(cancelled: boolean): void {\n const result: AXMFormTemplateViewerResult = {\n context: this.context,\n cancelled,\n metadata: this._config()?.metadata,\n };\n this.close(result);\n }\n\n //#endregion\n}\n\n//#endregion\n","<div\n class=\"__content-area flex flex-1 min-h-0 flex-col\"\n [class.overflow-hidden]=\"flowStep() === 'form' || flowStep() === 'review'\"\n [class.overflow-y-auto]=\"flowStep() !== 'form' && flowStep() !== 'review'\"\n>\n <!-- ----- Welcome content before the form ----- -->\n @if (flowStep() === 'pre') {\n <axm-pre-questionnaire-content [content]=\"prePostConfig()?.pre?.content\"></axm-pre-questionnaire-content>\n }\n <!-- ----- Outcome results after submit ----- -->\n @else if (flowStep() === 'results') {\n <axm-post-questionnaire-content mode=\"results\" [placeholderValues]=\"submitResult()\"></axm-post-questionnaire-content>\n }\n <!-- ----- Summary content after submit ----- -->\n @else if (flowStep() === 'summary') {\n <div class=\"flex flex-col items-center justify-center p-8 min-h-[200px] text-on-surface\">\n <div class=\"max-w-2xl w-full prose text-on-surface\" [innerHTML]=\"summaryHtml()\"></div>\n </div>\n }\n <!-- ----- Form body, including readonly review ----- -->\n @else {\n <!-- ----- Review heading while the filled form is shown read-only ----- -->\n @if (flowStep() === 'review') {\n <div class=\"p-4 border-b border-surface\">\n <h2 class=\"text-lg font-semibold text-on-surface\">\n {{ '@form-template-management:templates.viewer.flow.review-title' | translate | async }}\n </h2>\n </div>\n }\n <div class=\"flex flex-1 min-h-0 flex-col overflow-y-auto overflow-x-hidden p-4\">\n <ax-form #form>\n <axp-widgets-container [context]=\"context\" (onContextChanged)=\"handleContextChanged($event)\">\n <ng-container axp-widget-renderer [node]=\"currentPage()\" [mode]=\"widgetMode()\"></ng-container>\n </axp-widgets-container>\n </ax-form>\n </div>\n }\n</div>\n\n<ax-footer class=\"__popup-footer flex-shrink-0 border-t px-4 py-3\">\n <ax-suffix>\n <!-- ----- Welcome step ----- -->\n @if (flowStep() === 'pre') {\n <ax-button\n [text]=\"'@general:actions.cancel.title' | translate | async\"\n (onClick)=\"handleCancel()\"\n ></ax-button>\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"'@form-template-management:templates.viewer.flow.start' | translate | async\"\n (onClick)=\"handleStart()\"\n ></ax-button>\n }\n <!-- ----- Fill step ----- -->\n @else if (flowStep() === 'form') {\n <ax-button\n [text]=\"'@general:actions.cancel.title' | translate | async\"\n (onClick)=\"handleCancel()\"\n ></ax-button>\n <!-- ----- Review before submit when post review is enabled ----- -->\n @if (showReviewButton()) {\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"'@form-template-management:templates.viewer.flow.review' | translate | async\"\n [disabled]=\"isSubmitting()\"\n (onClick)=\"handleReviewClick()\"\n ></ax-button>\n }\n <!-- ----- Submit when review is off ----- -->\n @else if (showSubmitButton()) {\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"submitActionLabel() | translate | async\"\n [disabled]=\"isSubmitting()\"\n (onClick)=\"handleSubmitClick()\"\n ></ax-button>\n }\n }\n <!-- ----- Review step ----- -->\n @else if (flowStep() === 'review') {\n <ax-button\n look=\"outline\"\n [text]=\"'@form-template-management:templates.viewer.flow.edit' | translate | async\"\n (onClick)=\"handleEdit()\"\n ></ax-button>\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"submitActionLabel() | translate | async\"\n [disabled]=\"isSubmitting()\"\n (onClick)=\"handleSubmitClick()\"\n ></ax-button>\n }\n <!-- ----- Outcome results step ----- -->\n @else if (flowStep() === 'results') {\n <!-- ----- Continue to the summary when it is enabled ----- -->\n @if (prePostConfig()?.post?.summaryEnabled) {\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"'@general:actions.next.title' | translate | async\"\n (onClick)=\"handleResultsNext()\"\n ></ax-button>\n }\n <!-- ----- Close when there is no summary step ----- -->\n @else {\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"'@form-template-management:templates.viewer.flow.done' | translate | async\"\n (onClick)=\"handleDone()\"\n ></ax-button>\n }\n }\n <!-- ----- Summary step ----- -->\n @else if (flowStep() === 'summary') {\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"'@form-template-management:templates.viewer.flow.done' | translate | async\"\n (onClick)=\"handleDone()\"\n ></ax-button>\n }\n </ax-suffix>\n</ax-footer>\n"],"names":["i3","i4","i5","i6"],"mappings":";;;;;;;;;;;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qC;AAC5C,yBAAA;AACF,qBAAA,EAAA,QAAA,EAAA,21JAAA,EAAA,MAAA,EAAA,CAAA,yVAAA,CAAA,EAAA;+FAQqD,MAAM,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,MAAA,EAAA,CAAA;sBAM3D;;;"}
1
+ {"version":3,"file":"acorex-platform-module-assessment-management-client-form-template-viewer-popup.component-COZcUPEj.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/form-template/viewer/pages/form-template-viewer-popup/form-template-viewer-popup.component.ts","../../../../libs/modules/assessment-management/client/src/lib/features/form-template/viewer/pages/form-template-viewer-popup/form-template-viewer-popup.component.html"],"sourcesContent":["//#region ----- Imports -----\n\nimport { AXButtonModule } from '@acorex/components/button';\nimport { AXDecoratorModule } from '@acorex/components/decorators';\nimport { AXFormComponent, AXFormModule } from '@acorex/components/form';\nimport { AXBasePageComponent } from '@acorex/components/page';\nimport { AXTranslationModule, AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { DomSanitizer, type SafeHtml } from '@angular/platform-browser';\nimport {\n AXP_LOCAL_DATA_SOURCE_STORE,\n AXPWidgetCoreModule,\n createReadonlyLocalDataSourceStore,\n readLocalDataSourcesFromNode,\n} from '@acorex-platform/framework-client/layout/widget-core';\nimport { AXPContextChangeEvent, AXPWidgetsCatalog, type AXPWidgetNode } from '@acorex-platform/framework-shared/core';\nimport type {\n PrePostConfig,\n QuestionnaireBuilderValue,\n} from '@acorex-platform/module-assessment-management-client/contracts';\nimport { CommonModule } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n effect,\n inject,\n Input,\n signal,\n viewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport { AXMPreQuestionnaireContentComponent } from '../../../../questionnaire-viewer/components/pre-questionnaire-content';\nimport { AXMPostQuestionnaireContentComponent } from '../../../../questionnaire-viewer/components/post-questionnaire-content';\nimport { AXMQuestionnaireViewerService } from '../../../../questionnaire-viewer/questionnaire-viewer.service';\nimport {\n resolveSummaryPlaceholders,\n type SummaryPlaceholderValues,\n} from '../../../../questionnaire-viewer/utils/pre-post-content.utils';\nimport type { AXMFormTemplateViewerConfig, AXMFormTemplateViewerResult } from '../../form-template-viewer.types';\n\n//#endregion\n\n//#region ----- Types -----\n\ntype FormFlowStep = 'pre' | 'form' | 'review' | 'results' | 'summary';\n\nconst EMPTY_OUTCOME_STRUCTURE: QuestionnaireBuilderValue = { sections: [] };\n\n//#endregion\n\n//#region ----- Component -----\n\n@Component({\n selector: 'axm-form-template-viewer-popup',\n templateUrl: './form-template-viewer-popup.component.html',\n styleUrl: './form-template-viewer-popup.component.css',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [\n CommonModule,\n AXTranslationModule,\n AXButtonModule,\n AXDecoratorModule,\n AXFormModule,\n AXPWidgetCoreModule,\n AXMPreQuestionnaireContentComponent,\n AXMPostQuestionnaireContentComponent,\n ],\n providers: [\n {\n provide: AXP_LOCAL_DATA_SOURCE_STORE,\n useFactory: (host: AXMFormTemplateViewerPopupComponent) =>\n createReadonlyLocalDataSourceStore(() => host.sources()),\n deps: [AXMFormTemplateViewerPopupComponent],\n },\n ],\n})\nexport class AXMFormTemplateViewerPopupComponent extends AXBasePageComponent {\n //#region ----- Services & Dependencies -----\n\n private readonly questionnaireViewerService = inject(AXMQuestionnaireViewerService);\n private readonly translationService = inject(AXTranslationService);\n private readonly sanitizer = inject(DomSanitizer);\n private readonly formRef = viewChild<AXFormComponent>('form');\n\n //#endregion\n\n //#region ----- Inputs -----\n\n @Input() set config(value: AXMFormTemplateViewerConfig | undefined) {\n this._config.set(value);\n }\n\n //#endregion\n\n //#region ----- State Signals -----\n\n protected readonly _config = signal<AXMFormTemplateViewerConfig | undefined>(undefined);\n protected readonly flowStep = signal<FormFlowStep>('form');\n protected readonly submitResult = signal<SummaryPlaceholderValues | null>(null);\n protected readonly isSubmitting = signal(false);\n protected readonly document = signal({ type: AXPWidgetsCatalog.document } as AXPWidgetNode);\n protected readonly currentPageIndex = signal(0);\n private readonly initialFlowApplied = signal(false);\n private readonly templateLoaded = signal(false);\n\n protected context: Record<string, unknown> = {};\n\n readonly sources = computed(() => readLocalDataSourcesFromNode(this.document()));\n\n protected readonly currentPage = computed(\n () => this.document().children?.[this.currentPageIndex()] ?? ({ type: AXPWidgetsCatalog.pageLayout } as AXPWidgetNode),\n );\n\n protected readonly prePostConfig = computed((): PrePostConfig | null => this._config()?.prePostConfig ?? null);\n\n protected readonly widgetMode = computed(() =>\n this._config()?.readOnly || this.flowStep() === 'review' ? 'view' : 'edit',\n );\n\n protected readonly showReviewButton = computed(\n () => this.flowStep() === 'form' && !this._config()?.readOnly && this.prePostConfig()?.post?.reviewEnabled === true,\n );\n\n protected readonly showSubmitButton = computed(\n () => this.flowStep() === 'form' && !this._config()?.readOnly && !this.showReviewButton(),\n );\n\n protected readonly isPreviewMode = computed(() => this._config()?.previewMode === true);\n\n protected readonly submitActionLabel = computed(() =>\n this.isPreviewMode()\n ? '@form-template-management:templates.viewer.preview.finish.title'\n : '@general:actions.submit.title',\n );\n\n /** Summary rich text with outcome placeholders. Empty author content stays blank. */\n protected readonly summaryHtml = computed((): SafeHtml | '' => {\n const content = this.prePostConfig()?.post?.summaryContent;\n const locale = this.translationService.getActiveLang?.() ?? 'en-US';\n let resolved = resolveMultiLanguageString(content, locale);\n const values = this.submitResult();\n if (resolved && values) {\n resolved = resolveSummaryPlaceholders(resolved, values);\n }\n return resolved ? this.sanitizer.bypassSecurityTrustHtml(resolved) : '';\n });\n\n //#endregion\n\n //#region ----- Lifecycle -----\n\n constructor() {\n super();\n effect(() => {\n const cfg = this._config();\n if (!cfg) {\n return;\n }\n if (!this.templateLoaded()) {\n this.loadTemplate(cfg);\n this.templateLoaded.set(true);\n }\n if (!this.initialFlowApplied()) {\n this.flowStep.set(cfg.prePostConfig?.pre?.enabled === true ? 'pre' : 'form');\n this.initialFlowApplied.set(true);\n }\n });\n }\n\n //#endregion\n\n //#region ----- Event Handlers -----\n\n protected handleContextChanged(event: AXPContextChangeEvent): void {\n this.context = event.data ?? {};\n }\n\n protected handleCancel(): void {\n this.finish(true);\n }\n\n protected handleStart(): void {\n this.flowStep.set('form');\n }\n\n protected handleEdit(): void {\n this.flowStep.set('form');\n }\n\n protected async handleReviewClick(): Promise<void> {\n if (!(await this.validateForm())) {\n return;\n }\n this.flowStep.set('review');\n }\n\n protected async handleSubmitClick(): Promise<void> {\n if (this.flowStep() === 'form' && !(await this.validateForm())) {\n return;\n }\n await this.advanceAfterSubmit();\n }\n\n protected handleResultsNext(): void {\n if (this.prePostConfig()?.post?.summaryEnabled) {\n this.flowStep.set('summary');\n return;\n }\n this.finish(false);\n }\n\n protected handleDone(): void {\n this.finish(false);\n }\n\n //#endregion\n\n //#region ----- Template Loading -----\n\n private loadTemplate(config: AXMFormTemplateViewerConfig): void {\n let templateData: AXPWidgetNode;\n if (typeof config.template === 'string') {\n try {\n templateData = JSON.parse(config.template) as AXPWidgetNode;\n } catch (error) {\n console.error('Failed to parse form template JSON:', error);\n return;\n }\n } else {\n templateData = config.template;\n }\n this.document.set(templateData);\n if (config.context) {\n this.context = { ...config.context };\n }\n }\n\n //#endregion\n\n //#region ----- Submit Flow -----\n\n private async validateForm(): Promise<boolean> {\n const form = this.formRef();\n if (!form) {\n return false;\n }\n const formResult = await form.validate();\n return formResult.result === true;\n }\n\n private async advanceAfterSubmit(): Promise<void> {\n if (this.isSubmitting()) {\n return;\n }\n this.isSubmitting.set(true);\n try {\n const rules = this._config()?.outcomeRules ?? [];\n const post = this.prePostConfig()?.post;\n let placeholders: SummaryPlaceholderValues | null = null;\n if (rules.length > 0) {\n placeholders = await this.questionnaireViewerService.buildSummaryPlaceholderValues(\n EMPTY_OUTCOME_STRUCTURE,\n this.context,\n { outcomeRules: rules },\n );\n }\n this.submitResult.set(placeholders);\n if (post?.showOutcomeResults) {\n this.flowStep.set('results');\n return;\n }\n if (post?.summaryEnabled) {\n this.flowStep.set('summary');\n return;\n }\n this.finish(false);\n } finally {\n this.isSubmitting.set(false);\n }\n }\n\n private finish(cancelled: boolean): void {\n const result: AXMFormTemplateViewerResult = {\n context: this.context,\n cancelled,\n metadata: this._config()?.metadata,\n };\n this.close(result);\n }\n\n //#endregion\n}\n\n//#endregion\n","<div\n class=\"__content-area flex flex-1 min-h-0 flex-col\"\n [class.overflow-hidden]=\"flowStep() === 'form' || flowStep() === 'review'\"\n [class.overflow-y-auto]=\"flowStep() !== 'form' && flowStep() !== 'review'\"\n>\n <!-- ----- Welcome content before the form ----- -->\n @if (flowStep() === 'pre') {\n <axm-pre-questionnaire-content [content]=\"prePostConfig()?.pre?.content\"></axm-pre-questionnaire-content>\n }\n <!-- ----- Outcome results after submit ----- -->\n @else if (flowStep() === 'results') {\n <axm-post-questionnaire-content mode=\"results\" [placeholderValues]=\"submitResult()\"></axm-post-questionnaire-content>\n }\n <!-- ----- Summary content after submit ----- -->\n @else if (flowStep() === 'summary') {\n <div class=\"flex flex-col items-center justify-center p-8 min-h-[200px] text-on-surface\">\n <div class=\"max-w-2xl w-full prose text-on-surface\" [innerHTML]=\"summaryHtml()\"></div>\n </div>\n }\n <!-- ----- Form body, including readonly review ----- -->\n @else {\n <!-- ----- Review heading while the filled form is shown read-only ----- -->\n @if (flowStep() === 'review') {\n <div class=\"p-4 border-b border-surface\">\n <h2 class=\"text-lg font-semibold text-on-surface\">\n {{ '@form-template-management:templates.viewer.flow.review-title' | translate | async }}\n </h2>\n </div>\n }\n <div class=\"flex flex-1 min-h-0 flex-col overflow-y-auto overflow-x-hidden p-4\">\n <ax-form #form>\n <axp-widgets-container [context]=\"context\" (onContextChanged)=\"handleContextChanged($event)\">\n <ng-container axp-widget-renderer [node]=\"currentPage()\" [mode]=\"widgetMode()\"></ng-container>\n </axp-widgets-container>\n </ax-form>\n </div>\n }\n</div>\n\n<ax-footer class=\"__popup-footer flex-shrink-0 border-t px-4 py-3\">\n <ax-suffix>\n <!-- ----- Welcome step ----- -->\n @if (flowStep() === 'pre') {\n <ax-button\n [text]=\"'@general:actions.cancel.title' | translate | async\"\n (onClick)=\"handleCancel()\"\n ></ax-button>\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"'@form-template-management:templates.viewer.flow.start' | translate | async\"\n (onClick)=\"handleStart()\"\n ></ax-button>\n }\n <!-- ----- Fill step ----- -->\n @else if (flowStep() === 'form') {\n <ax-button\n [text]=\"'@general:actions.cancel.title' | translate | async\"\n (onClick)=\"handleCancel()\"\n ></ax-button>\n <!-- ----- Review before submit when post review is enabled ----- -->\n @if (showReviewButton()) {\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"'@form-template-management:templates.viewer.flow.review' | translate | async\"\n [disabled]=\"isSubmitting()\"\n (onClick)=\"handleReviewClick()\"\n ></ax-button>\n }\n <!-- ----- Submit when review is off ----- -->\n @else if (showSubmitButton()) {\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"submitActionLabel() | translate | async\"\n [disabled]=\"isSubmitting()\"\n (onClick)=\"handleSubmitClick()\"\n ></ax-button>\n }\n }\n <!-- ----- Review step ----- -->\n @else if (flowStep() === 'review') {\n <ax-button\n look=\"outline\"\n [text]=\"'@form-template-management:templates.viewer.flow.edit' | translate | async\"\n (onClick)=\"handleEdit()\"\n ></ax-button>\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"submitActionLabel() | translate | async\"\n [disabled]=\"isSubmitting()\"\n (onClick)=\"handleSubmitClick()\"\n ></ax-button>\n }\n <!-- ----- Outcome results step ----- -->\n @else if (flowStep() === 'results') {\n <!-- ----- Continue to the summary when it is enabled ----- -->\n @if (prePostConfig()?.post?.summaryEnabled) {\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"'@general:actions.next.title' | translate | async\"\n (onClick)=\"handleResultsNext()\"\n ></ax-button>\n }\n <!-- ----- Close when there is no summary step ----- -->\n @else {\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"'@form-template-management:templates.viewer.flow.done' | translate | async\"\n (onClick)=\"handleDone()\"\n ></ax-button>\n }\n }\n <!-- ----- Summary step ----- -->\n @else if (flowStep() === 'summary') {\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"'@form-template-management:templates.viewer.flow.done' | translate | async\"\n (onClick)=\"handleDone()\"\n ></ax-button>\n }\n </ax-suffix>\n</ax-footer>\n"],"names":["i3","i4","i5","i6"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AA8CA,MAAM,uBAAuB,GAA8B,EAAE,QAAQ,EAAE,EAAE,EAAE;AAE3E;AAEA;AA2BM,MAAO,mCAAoC,SAAQ,mBAAmB,CAAA;;;IAY1E,IAAa,MAAM,CAAC,KAA8C,EAAA;AAChE,QAAA,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC;IACzB;;;AA6DA,IAAA,WAAA,GAAA;AACE,QAAA,KAAK,EAAE;;AAzEQ,QAAA,IAAA,CAAA,0BAA0B,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAClE,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AACjD,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC;QAChC,IAAA,CAAA,OAAO,GAAG,SAAS,CAAkB,MAAM;oFAAC;;;QAc1C,IAAA,CAAA,OAAO,GAAG,MAAM,CAA0C,SAAS;oFAAC;QACpE,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAe,MAAM;qFAAC;QACvC,IAAA,CAAA,YAAY,GAAG,MAAM,CAAkC,IAAI;yFAAC;QAC5D,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,KAAK;yFAAC;QAC5B,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,EAAE,IAAI,EAAE,iBAAiB,CAAC,QAAQ,EAAmB;qFAAC;QACxE,IAAA,CAAA,gBAAgB,GAAG,MAAM,CAAC,CAAC;6FAAC;QAC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BAAmB;wBACnB,cAAc;wBACd,iBAAiB;wBACjB,YAAY;wBACZ,mBAAmB;wBACnB,mCAAmC;wBACnC,oCAAoC;qBACrC,EAAA,SAAA,EACU;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,2BAA2B;AACpC,4BAAA,UAAU,EAAE,CAAC,IAAyC,KACpD,kCAAkC,CAAC,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;AAC1D,4BAAA,IAAI,EAAE,CAAA,mCAAA,CAAqC;AAC5C,yBAAA;AACF,qBAAA,EAAA,QAAA,EAAA,21JAAA,EAAA,MAAA,EAAA,CAAA,yVAAA,CAAA,EAAA;+FAQqD,MAAM,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,MAAA,EAAA,CAAA;sBAM3D;;;"}
@@ -6,7 +6,7 @@ import { AXPWidgetsCatalog } from '@acorex-platform/framework-shared/core';
6
6
  import { RootConfig, toPrePostConfig, flattenQuestionnaireOutcomeItems } from '@acorex-platform/module-assessment-management-client/contracts';
7
7
  import * as i0 from '@angular/core';
8
8
  import { inject, Injectable } from '@angular/core';
9
- import { f as formatQuestionnairePreviewDialogTitle } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-CZtfv53E.mjs';
9
+ import { f as formatQuestionnairePreviewDialogTitle } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-juxXq2pM.mjs';
10
10
 
11
11
  //#region ----- Imports -----
12
12
  //#endregion
@@ -56,7 +56,7 @@ class AXMFormTemplateViewerService {
56
56
  const popupTitle = input.previewMode
57
57
  ? formatQuestionnairePreviewDialogTitle((await this.translationService.translateAsync('@form-template-management:templates.entities.template.actions.preview.title')) || 'Preview', displayTitle)
58
58
  : displayTitle || fallbackTitle;
59
- const { AXMFormTemplateViewerPopupComponent } = await import('./acorex-platform-module-assessment-management-client-form-template-viewer-popup.component-B94T15Vb.mjs');
59
+ const { AXMFormTemplateViewerPopupComponent } = await import('./acorex-platform-module-assessment-management-client-form-template-viewer-popup.component-COZcUPEj.mjs');
60
60
  const config = {
61
61
  template: templateData,
62
62
  title,
@@ -90,4 +90,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
90
90
  }] });
91
91
 
92
92
  export { AXMFormTemplateViewerService as A };
93
- //# sourceMappingURL=acorex-platform-module-assessment-management-client-form-template-viewer.service-DpEeqw34.mjs.map
93
+ //# sourceMappingURL=acorex-platform-module-assessment-management-client-form-template-viewer.service-CvSRpoos.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-platform-module-assessment-management-client-form-template-viewer.service-DpEeqw34.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/form-template/viewer/form-template-viewer.service.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport { AXPopupService } from '@acorex/components/popup';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPDeviceService } from '@acorex-platform/framework-client/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPWidgetsCatalog, type AXPMetaData } from '@acorex-platform/framework-shared/core';\nimport {\n flattenQuestionnaireOutcomeItems,\n RootConfig,\n toPrePostConfig,\n type AXMFormTemplateDetailDto,\n} from '@acorex-platform/module-assessment-management-client/contracts';\nimport { inject, Injectable } from '@angular/core';\nimport { formatQuestionnairePreviewDialogTitle } from '../../questionnaire-viewer/utils/questionnaire-preview-title.util';\nimport type {\n AXMFormTemplateViewerConfig,\n AXMFormTemplateViewerOpenStatus,\n AXMFormTemplateViewerResult,\n} from './form-template-viewer.types';\n\n//#endregion\n\n//#region ----- Service -----\n\n/**\n * Opens a form template in the same pre → form → review → results → summary flow as questionnaires.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXMFormTemplateViewerService {\n //#region ----- Services & Dependencies -----\n\n private readonly popupService = inject(AXPopupService);\n private readonly entityService = inject(AXPEntityService);\n private readonly translationService = inject(AXTranslationService);\n private readonly deviceService = inject(AXPDeviceService);\n\n //#endregion\n\n //#region ----- Public Methods -----\n\n async open(input: {\n id?: string;\n template?: string;\n title?: string;\n metadata?: AXPMetaData;\n readOnly?: boolean;\n previewMode?: boolean;\n context?: Record<string, unknown>;\n }): Promise<AXMFormTemplateViewerResult | AXMFormTemplateViewerOpenStatus> {\n let templateData = input.template;\n let title: string | undefined;\n let prePostConfig = null as AXMFormTemplateViewerConfig['prePostConfig'];\n let outcomeRules: AXMFormTemplateViewerConfig['outcomeRules'] = [];\n\n if (input.id) {\n const item = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.template.name)\n .data<string, AXMFormTemplateDetailDto>()\n .byKey(input.id);\n if (!item) {\n return 'not-found';\n }\n templateData = item.template ?? '';\n title = item.title?.trim() || undefined;\n prePostConfig = toPrePostConfig({ pre: item.pre, post: item.post });\n outcomeRules = flattenQuestionnaireOutcomeItems(item.outcomes);\n }\n\n if (!templateData) {\n if (!input.id) {\n return 'missing';\n }\n templateData = JSON.stringify({\n type: AXPWidgetsCatalog.document,\n children: [{ type: AXPWidgetsCatalog.pageLayout }],\n });\n }\n\n const fallbackTitle =\n (await this.translationService.translateAsync('@form-template-management:templates.viewer.title')) || 'Form';\n const displayTitle = input.title?.trim() || title;\n const popupTitle = input.previewMode\n ? formatQuestionnairePreviewDialogTitle(\n (await this.translationService.translateAsync(\n '@form-template-management:templates.entities.template.actions.preview.title',\n )) || 'Preview',\n displayTitle,\n )\n : displayTitle || fallbackTitle;\n\n const { AXMFormTemplateViewerPopupComponent } = await import(\n './pages/form-template-viewer-popup/form-template-viewer-popup.component'\n );\n\n const config: AXMFormTemplateViewerConfig = {\n template: templateData,\n title,\n prePostConfig,\n outcomeRules,\n context: input.context ?? {},\n metadata: input.metadata,\n readOnly: input.readOnly === true,\n previewMode: input.previewMode === true,\n };\n\n const result = await this.popupService.open(AXMFormTemplateViewerPopupComponent, {\n title: popupTitle,\n size: this.deviceService.isSmall() ? 'full' : 'lg',\n closeButton: false,\n closeOnBackdropClick: false,\n draggable: false,\n data: { config },\n });\n\n return (\n (result?.data as AXMFormTemplateViewerResult | undefined) ?? {\n context: input.context ?? {},\n cancelled: true,\n metadata: input.metadata,\n }\n );\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;;AAAA;AAqBA;AAEA;AAEA;;AAEG;MAEU,4BAA4B,CAAA;AADzC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC;AACrC,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AACjD,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AA0F1D,IAAA;;;IApFC,MAAM,IAAI,CAAC,KAQV,EAAA;AACC,QAAA,IAAI,YAAY,GAAG,KAAK,CAAC,QAAQ;AACjC,QAAA,IAAI,KAAyB;QAC7B,IAAI,aAAa,GAAG,IAAoD;QACxE,IAAI,YAAY,GAAgD,EAAE;AAElE,QAAA,IAAI,KAAK,CAAC,EAAE,EAAE;AACZ,YAAA,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;AACrB,iBAAA,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI;AACpE,iBAAA,IAAI;AACJ,iBAAA,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;YAClB,IAAI,CAAC,IAAI,EAAE;AACT,gBAAA,OAAO,WAAW;YACpB;AACA,YAAA,YAAY,GAAG,IAAI,CAAC,QAAQ,IAAI,EAAE;YAClC,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,SAAS;AACvC,YAAA,aAAa,GAAG,eAAe,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAA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EAAE,UAAU;AACjB,YAAA,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,GAAG,MAAM,GAAG,IAAI;AAClD,YAAA,WAAW,EAAE,KAAK;AAClB,YAAA,oBAAoB,EAAE,KAAK;AAC3B,YAAA,SAAS,EAAE,KAAK;YAChB,IAAI,EAAE,EAAE,MAAM,EAAE;AACjB,SAAA,CAAC;AAEF,QAAA,QACG,MAAM,EAAE,IAAgD,IAAI;AAC3D,YAAA,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,EAAE;AAC5B,YAAA,SAAS,EAAE,IAAI;YACf,QAAQ,EAAE,KAAK,CAAC,QAAQ;AACzB,SAAA;IAEL;8GA7FW,4BAA4B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA5B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,4BAA4B,cADf,MAAM,EAAA,CAAA,CAAA;;2FACnB,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBADxC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
1
+ {"version":3,"file":"acorex-platform-module-assessment-management-client-form-template-viewer.service-CvSRpoos.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/form-template/viewer/form-template-viewer.service.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport { AXPopupService } from '@acorex/components/popup';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPDeviceService } from '@acorex-platform/framework-client/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPWidgetsCatalog, type AXPMetaData } from '@acorex-platform/framework-shared/core';\nimport {\n flattenQuestionnaireOutcomeItems,\n RootConfig,\n toPrePostConfig,\n type AXMFormTemplateDetailDto,\n} from '@acorex-platform/module-assessment-management-client/contracts';\nimport { inject, Injectable } from '@angular/core';\nimport { formatQuestionnairePreviewDialogTitle } from '../../questionnaire-viewer/utils/questionnaire-preview-title.util';\nimport type {\n AXMFormTemplateViewerConfig,\n AXMFormTemplateViewerOpenStatus,\n AXMFormTemplateViewerResult,\n} from './form-template-viewer.types';\n\n//#endregion\n\n//#region ----- Service -----\n\n/**\n * Opens a form template in the same pre → form → review → results → summary flow as questionnaires.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXMFormTemplateViewerService {\n //#region ----- Services & Dependencies -----\n\n private readonly popupService = inject(AXPopupService);\n private readonly entityService = inject(AXPEntityService);\n private readonly translationService = inject(AXTranslationService);\n private readonly deviceService = inject(AXPDeviceService);\n\n //#endregion\n\n //#region ----- Public Methods -----\n\n async open(input: {\n id?: string;\n template?: string;\n title?: string;\n metadata?: AXPMetaData;\n readOnly?: boolean;\n previewMode?: boolean;\n context?: Record<string, unknown>;\n }): Promise<AXMFormTemplateViewerResult | AXMFormTemplateViewerOpenStatus> {\n let templateData = input.template;\n let title: string | undefined;\n let prePostConfig = null as AXMFormTemplateViewerConfig['prePostConfig'];\n let outcomeRules: AXMFormTemplateViewerConfig['outcomeRules'] = [];\n\n if (input.id) {\n const item = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.template.name)\n .data<string, AXMFormTemplateDetailDto>()\n .byKey(input.id);\n if (!item) {\n return 'not-found';\n }\n templateData = item.template ?? '';\n title = item.title?.trim() || undefined;\n prePostConfig = toPrePostConfig({ pre: item.pre, post: item.post });\n outcomeRules = flattenQuestionnaireOutcomeItems(item.outcomes);\n }\n\n if (!templateData) {\n if (!input.id) {\n return 'missing';\n }\n templateData = JSON.stringify({\n type: AXPWidgetsCatalog.document,\n children: [{ type: AXPWidgetsCatalog.pageLayout }],\n });\n }\n\n const fallbackTitle =\n (await this.translationService.translateAsync('@form-template-management:templates.viewer.title')) || 'Form';\n const displayTitle = input.title?.trim() || title;\n const popupTitle = input.previewMode\n ? formatQuestionnairePreviewDialogTitle(\n (await this.translationService.translateAsync(\n '@form-template-management:templates.entities.template.actions.preview.title',\n )) || 'Preview',\n displayTitle,\n )\n : displayTitle || fallbackTitle;\n\n const { AXMFormTemplateViewerPopupComponent } = await import(\n './pages/form-template-viewer-popup/form-template-viewer-popup.component'\n );\n\n const config: AXMFormTemplateViewerConfig = {\n template: templateData,\n title,\n prePostConfig,\n outcomeRules,\n context: input.context ?? {},\n metadata: input.metadata,\n readOnly: input.readOnly === true,\n previewMode: input.previewMode === true,\n };\n\n const result = await this.popupService.open(AXMFormTemplateViewerPopupComponent, {\n title: popupTitle,\n size: this.deviceService.isSmall() ? 'full' : 'lg',\n closeButton: false,\n closeOnBackdropClick: false,\n draggable: false,\n data: { config },\n });\n\n return (\n (result?.data as AXMFormTemplateViewerResult | undefined) ?? {\n context: input.context ?? {},\n cancelled: true,\n metadata: input.metadata,\n }\n );\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;;AAAA;AAqBA;AAEA;AAEA;;AAEG;MAEU,4BAA4B,CAAA;AADzC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC;AACrC,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AACjD,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AA0F1D,IAAA;;;IApFC,MAAM,IAAI,CAAC,KAQV,EAAA;AACC,QAAA,IAAI,YAAY,GAAG,KAAK,CAAC,QAAQ;AACjC,QAAA,IAAI,KAAyB;QAC7B,IAAI,aAAa,GAAG,IAAoD;QACxE,IAAI,YAAY,GAAgD,EAAE;AAElE,QAAA,IAAI,KAAK,CAAC,EAAE,EAAE;AACZ,YAAA,MAAM,IAAI,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,UAAA,EAAA,CAAA;kBADxC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { inject, Injectable } from '@angular/core';
3
- import { A as AXMFormTemplateViewerService } from './acorex-platform-module-assessment-management-client-form-template-viewer.service-DpEeqw34.mjs';
4
- import { A as AXPFormTemplateViewerConnector } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-CZtfv53E.mjs';
3
+ import { A as AXMFormTemplateViewerService } from './acorex-platform-module-assessment-management-client-form-template-viewer.service-CvSRpoos.mjs';
4
+ import { A as AXPFormTemplateViewerConnector } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-juxXq2pM.mjs';
5
5
 
6
6
  const MISSING_TEMPLATE_KEY = '@form-template-management:templates.viewer.messages.missing-template';
7
7
  const NOT_FOUND_KEY = '@form-template-management:templates.viewer.messages.not-found';
@@ -52,4 +52,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
52
52
  }] });
53
53
 
54
54
  export { AXMOpenFormTemplateCommand };
55
- //# sourceMappingURL=acorex-platform-module-assessment-management-client-open-form-template.command-5E3IK-OG.mjs.map
55
+ //# sourceMappingURL=acorex-platform-module-assessment-management-client-open-form-template.command-CmR-xFHE.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-platform-module-assessment-management-client-open-form-template.command-5E3IK-OG.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/form-template/viewer/commands/open-form-template.command.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport type { AXPMetaData } from '@acorex-platform/framework-shared/core';\nimport { inject, Injectable } from '@angular/core';\n\nimport { AXMFormTemplateViewerService } from '../form-template-viewer.service';\nimport { AXPFormTemplateViewerConnector } from '../viewer-connector.service';\n\n//#endregion\n\n//#region ----- Types -----\n\nexport interface AXMOpenFormTemplateCommandInput {\n data?: {\n id?: string;\n template?: string;\n };\n metadata?: AXPMetaData;\n}\n\nconst MISSING_TEMPLATE_KEY = '@form-template-management:templates.viewer.messages.missing-template';\nconst NOT_FOUND_KEY = '@form-template-management:templates.viewer.messages.not-found';\nconst OPEN_FAILED_KEY = '@form-template-management:templates.viewer.messages.open-failed';\n\n//#endregion\n\n//#region ----- Open form template command -----\n\n@Injectable({ providedIn: 'root' })\nexport class AXMOpenFormTemplateCommand implements AXPCommand<AXMOpenFormTemplateCommandInput> {\n //#region ----- Services & Dependencies -----\n\n private readonly formViewer = inject(AXMFormTemplateViewerService);\n private readonly connector = inject(AXPFormTemplateViewerConnector);\n\n //#endregion\n\n //#region ----- Command Implementation -----\n\n async execute(input: AXMOpenFormTemplateCommandInput = {}): AXPCommandExecuteResultPromise {\n try {\n const data = input.data ?? {};\n const metadata = input.metadata;\n const { id, template } = data;\n\n if (!id && !template) {\n return { success: false, message: { text: MISSING_TEMPLATE_KEY } };\n }\n\n const result = await this.formViewer.open({ id, template, metadata });\n if (result === 'missing') {\n return { success: false, message: { text: MISSING_TEMPLATE_KEY } };\n }\n if (result === 'not-found') {\n return { success: false, message: { text: NOT_FOUND_KEY } };\n }\n if (result.cancelled) {\n return { success: false };\n }\n\n if (id) {\n await this.connector.submit(id, result.context, metadata);\n }\n\n return { success: true, kind: 'object', data: result.context };\n } catch {\n return { success: false, message: { text: OPEN_FAILED_KEY } };\n }\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;AAqBA,MAAM,oBAAoB,GAAG,sEAAsE;AACnG,MAAM,aAAa,GAAG,+DAA+D;AACrF,MAAM,eAAe,GAAG,iEAAiE;AAEzF;AAEA;MAGa,0BAA0B,CAAA;AADvC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,4BAA4B,CAAC;AACjD,QAAA,IAAA,CAAA,SAAS,GAAG,MA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M;AACN,YAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,EAAE;QAC/D;IACF;8GAvCW,0BAA0B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA1B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,0BAA0B,cADb,MAAM,EAAA,CAAA,CAAA;;2FACnB,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBADtC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
1
+ {"version":3,"file":"acorex-platform-module-assessment-management-client-open-form-template.command-CmR-xFHE.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/form-template/viewer/commands/open-form-template.command.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport type { AXPMetaData } from '@acorex-platform/framework-shared/core';\nimport { inject, Injectable } from '@angular/core';\n\nimport { AXMFormTemplateViewerService } from '../form-template-viewer.service';\nimport { AXPFormTemplateViewerConnector } from '../viewer-connector.service';\n\n//#endregion\n\n//#region ----- Types -----\n\nexport interface AXMOpenFormTemplateCommandInput {\n data?: {\n id?: string;\n template?: string;\n };\n metadata?: AXPMetaData;\n}\n\nconst MISSING_TEMPLATE_KEY = '@form-template-management:templates.viewer.messages.missing-template';\nconst NOT_FOUND_KEY = '@form-template-management:templates.viewer.messages.not-found';\nconst OPEN_FAILED_KEY = '@form-template-management:templates.viewer.messages.open-failed';\n\n//#endregion\n\n//#region ----- Open form template command -----\n\n@Injectable({ providedIn: 'root' })\nexport class AXMOpenFormTemplateCommand implements AXPCommand<AXMOpenFormTemplateCommandInput> {\n //#region ----- Services & Dependencies -----\n\n private readonly formViewer = inject(AXMFormTemplateViewerService);\n private readonly connector = inject(AXPFormTemplateViewerConnector);\n\n //#endregion\n\n //#region ----- Command Implementation -----\n\n async execute(input: AXMOpenFormTemplateCommandInput = {}): AXPCommandExecuteResultPromise {\n try {\n const data = input.data ?? {};\n const metadata = input.metadata;\n const { id, template } = data;\n\n if (!id && !template) {\n return { success: false, message: { text: MISSING_TEMPLATE_KEY } };\n }\n\n const result = await this.formViewer.open({ id, template, metadata });\n if (result === 'missing') {\n return { success: false, message: { text: MISSING_TEMPLATE_KEY } };\n }\n if (result === 'not-found') {\n return { success: false, message: { text: NOT_FOUND_KEY } };\n }\n if (result.cancelled) {\n return { success: false };\n }\n\n if (id) {\n await this.connector.submit(id, result.context, metadata);\n }\n\n return { success: true, kind: 'object', data: result.context };\n } catch {\n return { success: false, message: { text: OPEN_FAILED_KEY } };\n }\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;AAqBA,MAAM,oBAAoB,GAAG,sEAAsE;AACnG,MAAM,aAAa,GAAG,+DAA+D;AACrF,MAAM,eAAe,GAAG,iEAAiE;AAEzF;AAEA;MAGa,0BAA0B,CAAA;AADvC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,4BAA4B,CAAC;AACjD,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,8BAA8B,CAAC;AAsCpE,IAAA;;;AAhCC,IAAA,MAAM,OAAO,CAAC,KAAA,GAAyC,EAAE,EAAA;AACvD,QAAA,IAAI;AACF,YAAA,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,EAAE;AAC7B,YAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ;AAC/B,YAAA,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,IAAI;AAE7B,YAAA,IAAI,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE;AAC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AA,EAAA,EAAA,IAAA,EAAA,0BAA0B,cADb,MAAM,EAAA,CAAA,CAAA;;2FACnB,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBADtC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { inject, Injectable } from '@angular/core';
3
- import { A as AXMFormTemplateViewerService } from './acorex-platform-module-assessment-management-client-form-template-viewer.service-DpEeqw34.mjs';
3
+ import { A as AXMFormTemplateViewerService } from './acorex-platform-module-assessment-management-client-form-template-viewer.service-CvSRpoos.mjs';
4
4
 
5
5
  const MISSING_TEMPLATE_KEY = '@form-template-management:templates.viewer.messages.missing-template';
6
6
  const NOT_FOUND_KEY = '@form-template-management:templates.viewer.messages.not-found';
@@ -87,4 +87,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
87
87
  }] });
88
88
 
89
89
  export { AXMPreviewFormTemplateCommand };
90
- //# sourceMappingURL=acorex-platform-module-assessment-management-client-preview-form-template.command-COIcfqBQ.mjs.map
90
+ //# sourceMappingURL=acorex-platform-module-assessment-management-client-preview-form-template.command-BEzE0620.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-platform-module-assessment-management-client-preview-form-template.command-COIcfqBQ.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/form-template/viewer/commands/preview-form-template.command.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { inject, Injectable } from '@angular/core';\n\nimport { AXMFormTemplateViewerService } from '../form-template-viewer.service';\n\n//#endregion\n\n//#region ----- Types -----\n\nexport interface AXMPreviewFormTemplateCommandInput {\n templateId?: string;\n templateTitle?: string;\n}\n\ntype AXMPreviewFormTemplateCommandInvocation = AXMPreviewFormTemplateCommandInput & {\n data?: Record<string, unknown>;\n options?: Partial<AXMPreviewFormTemplateCommandInput> & Record<string, unknown>;\n};\n\nconst MISSING_TEMPLATE_KEY = '@form-template-management:templates.viewer.messages.missing-template';\nconst NOT_FOUND_KEY = '@form-template-management:templates.viewer.messages.not-found';\nconst OPEN_FAILED_KEY = '@form-template-management:templates.viewer.messages.open-failed';\n\n//#endregion\n\n//#region ----- Preview form template command -----\n\n/**\n * Opens a form template preview. Answers are not saved.\n */\n@Injectable()\nexport class AXMPreviewFormTemplateCommand implements AXPCommand<AXMPreviewFormTemplateCommandInput, void> {\n //#region ----- Services & Dependencies -----\n\n private readonly formViewer = inject(AXMFormTemplateViewerService);\n\n //#endregion\n\n //#region ----- Command Implementation -----\n\n private resolvePayload(\n input: AXMPreviewFormTemplateCommandInvocation,\n ): AXMPreviewFormTemplateCommandInput | null {\n const ctxOpts = input.options;\n const ctxData = input.data;\n\n const asNonEmptyString = (value: unknown): string | undefined =>\n typeof value === 'string' && value.length > 0 ? value : undefined;\n\n const asDisplayTitle = (value: unknown): string | undefined => {\n const text = asNonEmptyString(value);\n if (text) {\n return text;\n }\n if (value && typeof value === 'object') {\n const record = value as Record<string, unknown>;\n const fromTitle = record['title'];\n if (typeof fromTitle === 'string' && fromTitle.trim()) {\n return fromTitle.trim();\n }\n const fromName = record['name'];\n if (typeof fromName === 'string' && fromName.trim()) {\n return fromName.trim();\n }\n }\n return undefined;\n };\n\n const templateId =\n asNonEmptyString(input.templateId) ??\n asNonEmptyString(ctxOpts?.templateId) ??\n (ctxData?.['id'] != null ? String(ctxData['id']) : undefined);\n\n if (!templateId) {\n return null;\n }\n\n const templateTitle =\n asDisplayTitle(input.templateTitle) ??\n asDisplayTitle(ctxOpts?.templateTitle) ??\n asDisplayTitle(ctxData?.['title']) ??\n asDisplayTitle(ctxData?.['name']);\n\n return { templateId, templateTitle };\n }\n\n async execute(input: AXMPreviewFormTemplateCommandInvocation): AXPCommandExecuteResultPromise<void> {\n try {\n const resolved = this.resolvePayload(input);\n if (!resolved?.templateId) {\n return { success: false, message: { text: MISSING_TEMPLATE_KEY } };\n }\n\n const result = await this.formViewer.open({\n id: resolved.templateId,\n title: resolved.templateTitle,\n previewMode: true,\n });\n\n if (result === 'missing') {\n return { success: false, message: { text: MISSING_TEMPLATE_KEY } };\n }\n if (result === 'not-found') {\n return { success: false, message: { text: NOT_FOUND_KEY } };\n }\n\n return {\n success: true,\n kind: 'object',\n data: undefined,\n metadata: { outcome: result.cancelled ? 'Cancelled' : 'Previewed', refresh: false },\n };\n } catch {\n return { success: false, message: { text: OPEN_FAILED_KEY } };\n }\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;AAqBA,MAAM,oBAAoB,GAAG,sEAAsE;AACnG,MAAM,aAAa,GAAG,+DAA+D;AACrF,MAAM,eAAe,GAAG,iEAAiE;AAEzF;AAEA;AAEA;;AAEG;MAEU,6BAA6B,CAAA;AAD1C,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,4BAA4B,CAAC;AAoFnE,IAAA;;;AA9ES,IAAA,cAAc,CACpB,KAA8C,EAAA;AAE9C,QAAA,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO;AAC7B,QAAA,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI;QAE1B,MAAM,gBAAgB,GAAG,CAAC,KAAc,KACtC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,KAAK,GAAG,SAAS;AAEnE,QAAA,MAAM,cAAc,GAAG,CAAC,KAAc,KAAwB;AAC5D,YAAA,MAAM,IAAI,GAAG,gBAAgB,CAAC,KAAK,CAAC;YACpC,IAAI,IAAI,EAAE;AACR,gBAAA,OAAO,IAAI;YACb;AACA,YAAA,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;gBACtC,MAAM,MAAM,GAAG,KAAgC;AAC/C,gBAAA,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC;gBACjC,IAAI,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IAAI,CAAC;gBACxC,EAAE,EAAE,QAAQ,CAAC,UAAU;gBACvB,KAAK,EAAE,QAAQ,CAAC,aAAa;AAC7B,gBAAA,WAAW,EAAE,IAAI;AAClB,aAAA,CAAC;AAEF,YAAA,IAAI,MAAM,KAAK,SAAS,EAAE;AACxB,gBAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,oBAAoB,EAAE,EAAE;YACpE;AACA,YAAA,IAAI,MAAM,KAAK,WAAW,EAAE;AAC1B,gBAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE;YAC7D;YAEA,OAAO;AACL,gBAAA,OAAO,EAAE,IAAI;AACb,gBAAA,IAAI,EAAE,QAAQ;AACd,gBAAA,IAAI,EAAE,SAAS;AACf,gBAAA,QAAQ,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,SAAS,GAAG,WAAW,GAAG,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE;aACpF;QACH;AAAE,QAAA,MAAM;AACN,YAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,EAAE;QAC/D;IACF;8GApFW,6BAA6B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAA7B,6BAA6B,EAAA,CAAA,CAAA;;2FAA7B,6BAA6B,EAAA,UAAA,EAAA,CAAA;kBADzC;;;"}
1
+ {"version":3,"file":"acorex-platform-module-assessment-management-client-preview-form-template.command-BEzE0620.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/form-template/viewer/commands/preview-form-template.command.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { inject, Injectable } from '@angular/core';\n\nimport { AXMFormTemplateViewerService } from '../form-template-viewer.service';\n\n//#endregion\n\n//#region ----- Types -----\n\nexport interface AXMPreviewFormTemplateCommandInput {\n templateId?: string;\n templateTitle?: string;\n}\n\ntype AXMPreviewFormTemplateCommandInvocation = AXMPreviewFormTemplateCommandInput & {\n data?: Record<string, unknown>;\n options?: Partial<AXMPreviewFormTemplateCommandInput> & Record<string, unknown>;\n};\n\nconst MISSING_TEMPLATE_KEY = '@form-template-management:templates.viewer.messages.missing-template';\nconst NOT_FOUND_KEY = '@form-template-management:templates.viewer.messages.not-found';\nconst OPEN_FAILED_KEY = '@form-template-management:templates.viewer.messages.open-failed';\n\n//#endregion\n\n//#region ----- Preview form template command -----\n\n/**\n * Opens a form template preview. Answers are not saved.\n */\n@Injectable()\nexport class AXMPreviewFormTemplateCommand implements AXPCommand<AXMPreviewFormTemplateCommandInput, void> {\n //#region ----- Services & Dependencies -----\n\n private readonly formViewer = inject(AXMFormTemplateViewerService);\n\n //#endregion\n\n //#region ----- Command Implementation -----\n\n private resolvePayload(\n input: AXMPreviewFormTemplateCommandInvocation,\n ): AXMPreviewFormTemplateCommandInput | null {\n const ctxOpts = input.options;\n const ctxData = input.data;\n\n const asNonEmptyString = (value: unknown): string | undefined =>\n typeof value === 'string' && value.length > 0 ? value : undefined;\n\n const asDisplayTitle = (value: unknown): string | undefined => {\n const text = asNonEmptyString(value);\n if (text) {\n return text;\n }\n if (value && typeof value === 'object') {\n const record = value as Record<string, unknown>;\n const fromTitle = record['title'];\n if (typeof fromTitle === 'string' && fromTitle.trim()) {\n return fromTitle.trim();\n }\n const fromName = record['name'];\n if (typeof fromName === 'string' && fromName.trim()) {\n return fromName.trim();\n }\n }\n return undefined;\n };\n\n const templateId =\n asNonEmptyString(input.templateId) ??\n asNonEmptyString(ctxOpts?.templateId) ??\n (ctxData?.['id'] != null ? String(ctxData['id']) : undefined);\n\n if (!templateId) {\n return null;\n }\n\n const templateTitle =\n asDisplayTitle(input.templateTitle) ??\n asDisplayTitle(ctxOpts?.templateTitle) ??\n asDisplayTitle(ctxData?.['title']) ??\n asDisplayTitle(ctxData?.['name']);\n\n return { templateId, templateTitle };\n }\n\n async execute(input: AXMPreviewFormTemplateCommandInvocation): AXPCommandExecuteResultPromise<void> {\n try {\n const resolved = this.resolvePayload(input);\n if (!resolved?.templateId) {\n return { success: false, message: { text: MISSING_TEMPLATE_KEY } };\n }\n\n const result = await this.formViewer.open({\n id: resolved.templateId,\n title: resolved.templateTitle,\n previewMode: true,\n });\n\n if (result === 'missing') {\n return { success: false, message: { text: MISSING_TEMPLATE_KEY } };\n }\n if (result === 'not-found') {\n return { success: false, message: { text: NOT_FOUND_KEY } };\n }\n\n return {\n success: true,\n kind: 'object',\n data: undefined,\n metadata: { outcome: result.cancelled ? 'Cancelled' : 'Previewed', refresh: false },\n };\n } catch {\n return { success: false, message: { text: OPEN_FAILED_KEY } };\n }\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;AAqBA,MAAM,oBAAoB,GAAG,sEAAsE;AACnG,MAAM,aAAa,GAAG,+DAA+D;AACrF,MAAM,eAAe,GAAG,iEAAiE;AAEzF;AAEA;AAEA;;AAEG;MAEU,6BAA6B,CAAA;AAD1C,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,4BAA4B,CAAC;AAoFnE,IAAA;;;AA9ES,IAAA,cAAc,CACpB,KAA8C,EAAA;AAE9C,QAAA,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO;AAC7B,QAAA,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI;QAE1B,MAAM,gBAAgB,GAAG,CAAC,KAAc,KACtC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,KAAK,GAAG,SAAS;AAEnE,QAAA,MAAM,cAAc,GAAG,CAAC,KAAc,KAAwB;AAC5D,YAAA,MAAM,IAAI,GAAG,gBAAgB,CAAC,KAAK,CAAC;YACp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acorex-platform/framework-client/layout/entit
3
3
  import * as i0 from '@angular/core';
4
4
  import { inject, Injectable } from '@angular/core';
5
5
  import { RootConfig } from '@acorex-platform/module-assessment-management-client/contracts';
6
- import { a as AXMQuestionnaireViewerService } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-CZtfv53E.mjs';
6
+ import { a as AXMQuestionnaireViewerService } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-juxXq2pM.mjs';
7
7
 
8
8
  //#endregion
9
9
  //#region ---- Preview Question Command ----
@@ -44,7 +44,7 @@ class PreviewQuestionCommand {
44
44
  if (!item) {
45
45
  return {
46
46
  success: false,
47
- message: { text: 'Question not found' },
47
+ message: { text: '@assessment-management:commands.preview-question.errors.not-found' },
48
48
  };
49
49
  }
50
50
  const locale = this.translationService.getActiveLang?.() ?? 'en-US';
@@ -78,14 +78,14 @@ class PreviewQuestionCommand {
78
78
  if (!structure?.sections?.length) {
79
79
  return {
80
80
  success: false,
81
- message: { text: 'No question structure to preview' },
81
+ message: { text: '@assessment-management:commands.preview-question.errors.no-structure' },
82
82
  };
83
83
  }
84
84
  const totalQuestions = structure.sections?.reduce((s, sec) => s + (sec.items?.length ?? 0), 0) ?? 0;
85
85
  if (totalQuestions === 0) {
86
86
  return {
87
87
  success: false,
88
- message: { text: 'No question to preview' },
88
+ message: { text: '@assessment-management:commands.preview-question.errors.no-question' },
89
89
  };
90
90
  }
91
91
  const previewTitleKey = '@assessment-management:question-bank.entities.question-bank-item.actions.preview.title';
@@ -105,10 +105,13 @@ class PreviewQuestionCommand {
105
105
  };
106
106
  }
107
107
  catch (error) {
108
- const message = error instanceof Error ? error.message : 'Unknown error';
108
+ const fallback = await this.translationService.translateAsync('@general:messages.generic.error.description');
109
+ const message = error instanceof Error ? error.message : fallback;
109
110
  return {
110
111
  success: false,
111
- message: { text: `Error previewing question: ${message}` },
112
+ message: {
113
+ text: await this.translationService.translateAsync('@assessment-management:commands.preview-question.errors.failed', { params: { message } }),
114
+ },
112
115
  };
113
116
  }
114
117
  }
@@ -120,4 +123,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
120
123
  }] });
121
124
 
122
125
  export { PreviewQuestionCommand };
123
- //# sourceMappingURL=acorex-platform-module-assessment-management-client-preview-question.command-ZTIjmXdy.mjs.map
126
+ //# sourceMappingURL=acorex-platform-module-assessment-management-client-preview-question.command-BGT8qB1_.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-assessment-management-client-preview-question.command-BGT8qB1_.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/questionnaire-viewer/commands/preview-question.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport { Injectable, inject } from '@angular/core';\nimport { RootConfig } from '@acorex-platform/module-assessment-management-client/contracts';\nimport type { AXMAssessmentManagementQuestionBankItemEntityModel } from '@acorex-platform/module-assessment-management-client/contracts';\nimport { QuestionnaireBuilderValue } from '@acorex-platform/module-assessment-management-client/contracts';\nimport { AXMQuestionnaireViewerService } from '../questionnaire-viewer.service';\n\n//#endregion\n\n//#region ---- Command Input/Output Types ----\n\n/**\n * Input for PreviewQuestion command.\n * Pass id to load the question bank item (title and structure come from the item).\n * Or pass pre-built structure (e.g. from builder) with optional title.\n */\nexport interface PreviewQuestionCommandInput {\n /** Question bank item id. */\n id?: string;\n /** Pre-built structure; when set, id is not required. */\n structure?: QuestionnaireBuilderValue;\n /** Dialog title when using pre-built structure. */\n title?: string;\n data?: Record<string, unknown>;\n options?: Record<string, unknown>;\n}\n\n//#endregion\n\n//#region ---- Preview Question Command ----\n\n/**\n * Command that opens a preview of a single question in a dialog.\n * Used from the questionnaire builder per-question primary action.\n */\n@Injectable()\nexport class PreviewQuestionCommand implements AXPCommand<PreviewQuestionCommandInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly questionnaireViewerService = inject(AXMQuestionnaireViewerService);\n private readonly entityService = inject(AXPEntityService);\n private readonly translationService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n private resolveId(input: PreviewQuestionCommandInput): string | undefined {\n const record = input as Record<string, unknown>;\n const ctxData = input.data as Record<string, unknown> | undefined;\n const ctxOptions = input.options as Record<string, unknown> | undefined;\n const asString = (v: unknown): string | undefined => (typeof v === 'string' && v.length > 0 ? v : undefined);\n return (\n asString(input.id) ??\n asString(record['questionBankItemId']) ??\n asString(ctxOptions?.['questionBankItemId']) ??\n asString(ctxData?.['id']) ??\n asString(record['id'])\n );\n }\n\n async execute(input: PreviewQuestionCommandInput): AXPCommandExecuteResultPromise<void> {\n try {\n const id = this.resolveId(input);\n let structure: QuestionnaireBuilderValue | undefined = input.structure;\n let title = input.title;\n\n if (id) {\n const item = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.questionBankItem.name)\n .data<string, AXMAssessmentManagementQuestionBankItemEntityModel>()\n .byKey(id);\n if (!item) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.preview-question.errors.not-found' },\n };\n }\n const locale = this.translationService.getActiveLang?.() ?? 'en-US';\n const resolvedListTitle = resolveMultiLanguageString(item.title, locale);\n structure = {\n sections: [\n {\n name: `preview-section-${item.id}`,\n title: resolvedListTitle || 'Question',\n description: undefined,\n order: 0,\n items: [\n {\n name: String(item.id),\n questionBankItemId: item.id,\n order: 0,\n isRequired: false,\n interfaceOverride: item.interface,\n } as QuestionnaireBuilderValue['sections'][0]['items'][0],\n ],\n },\n ],\n displaySettings: {\n viewMode: 'single-page',\n showProgressBar: false,\n showQuestionNumbers: false,\n },\n };\n title = resolvedListTitle || undefined;\n }\n\n if (!structure?.sections?.length) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.preview-question.errors.no-structure' },\n };\n }\n\n const totalQuestions =\n structure.sections?.reduce((s: number, sec: { items?: unknown[] }) => s + (sec.items?.length ?? 0), 0) ?? 0;\n if (totalQuestions === 0) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.preview-question.errors.no-question' },\n };\n }\n\n const previewTitleKey = '@assessment-management:question-bank.entities.question-bank-item.actions.preview.title';\n const defaultTitle = (await this.translationService.translateAsync(previewTitleKey)) || 'Preview';\n const dialogTitle = title?.trim() || defaultTitle;\n\n await this.questionnaireViewerService.open({\n title: dialogTitle,\n structure,\n config: { previewMode: true },\n });\n\n return {\n success: true,\n kind: 'object',\n data: undefined,\n message: { text: '' },\n metadata: { refresh: false },\n };\n } catch (error: unknown) {\n const fallback = await this.translationService.translateAsync(\n '@general:messages.generic.error.description',\n );\n const message = error instanceof Error ? error.message : fallback;\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync(\n '@assessment-management:commands.preview-question.errors.failed',\n { params: { message } },\n ),\n },\n };\n }\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;AAiCA;AAEA;AAEA;;;AAGG;MAEU,sBAAsB,CAAA;AADnC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,0BAA0B,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAClE,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AAqHnE,IAAA;;;AA/GS,IAAA,SAAS,CAAC,KAAkC,EAAA;QAClD,MAAM,MAAM,GAAG,KAAgC;AAC/C,QAAA,MAAM,OAAO,GAAG,KAAK,CAAC,IAA2C;AACjE,QAAA,MAAM,UAAU,GAAG,KAAK,CAAC,OAA8C;QACvE,MAAM,QAAQ,GAAG,CAAC,CAAU,MAA0B,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,MA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,WAAW,GAAG,KAAK,EAAE,IAAI,EAAE,IAAI,YAAY;AAEjD,YAAA,MAAM,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC;AACzC,gBAAA,KAAK,EAAE,WAAW;gBAClB,SAAS;AACT,gBAAA,MAAM,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE;AAC9B,aAAA,CAAC;YAEF,OAAO;AACL,gBAAA,OAAO,EAAE,IAAI;AACb,gBAAA,IAAI,EAAE,QAAQ;AACd,gBAAA,IAAI,EAAE,SAAS;AACf,gBAAA,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;AACrB,gBAAA,QAAQ,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;aAC7B;QACH;QAAE,OAAO,KAAc,EAAE;YACvB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAC3D,6CAA6C,CAC9C;AACD,YAAA,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,QAAQ;YACjE,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE;AACP,oBAAA,IAAI,EAAE,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAChD,gEAAgE,EAChE,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,CACxB;AACF,iBAAA;aACF;QACH;IACF;8GAvHW,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAAtB,sBAAsB,EAAA,CAAA,CAAA;;2FAAtB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBADlC;;;"}
@@ -2,7 +2,7 @@ import { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/t
2
2
  import * as i0 from '@angular/core';
3
3
  import { inject, Injectable } from '@angular/core';
4
4
  import { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
5
- import { a as AXMQuestionnaireViewerService, f as formatQuestionnairePreviewDialogTitle } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-CZtfv53E.mjs';
5
+ import { a as AXMQuestionnaireViewerService, f as formatQuestionnairePreviewDialogTitle } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-juxXq2pM.mjs';
6
6
  import { RootConfig, toPrePostConfig, toDisplaySettings, toPrintSettings } from '@acorex-platform/module-assessment-management-client/contracts';
7
7
 
8
8
  //#endregion
@@ -59,9 +59,7 @@ class AXPPreviewQuestionnaireCommand {
59
59
  if (!resolved) {
60
60
  return {
61
61
  success: false,
62
- message: {
63
- text: 'Questionnaire id is missing (could not resolve from command context).',
64
- },
62
+ message: { text: '@assessment-management:commands.preview-questionnaire.errors.missing-id' },
65
63
  };
66
64
  }
67
65
  const { questionnaireId, questionnaireTitle } = resolved;
@@ -74,7 +72,7 @@ class AXPPreviewQuestionnaireCommand {
74
72
  return {
75
73
  success: false,
76
74
  message: {
77
- text: `Questionnaire with ID ${questionnaireId} not found`,
75
+ text: await this.translationService.translateAsync('@assessment-management:commands.preview-questionnaire.errors.not-found', { params: { questionnaireId } }),
78
76
  },
79
77
  };
80
78
  }
@@ -82,9 +80,7 @@ class AXPPreviewQuestionnaireCommand {
82
80
  if (!questionnaire.questions || !questionnaire.questions.sections || questionnaire.questions.sections.length === 0) {
83
81
  return {
84
82
  success: false,
85
- message: {
86
- text: 'Questionnaire has no questions to preview',
87
- },
83
+ message: { text: '@assessment-management:commands.preview-questionnaire.errors.no-questions' },
88
84
  };
89
85
  }
90
86
  // Get preview title
@@ -137,10 +133,12 @@ class AXPPreviewQuestionnaireCommand {
137
133
  };
138
134
  }
139
135
  catch (error) {
136
+ const fallback = await this.translationService.translateAsync('@general:messages.generic.error.description');
137
+ const message = error instanceof Error ? error.message : fallback;
140
138
  return {
141
139
  success: false,
142
140
  message: {
143
- text: `Error previewing questionnaire: ${error.message || 'Unknown error'}`,
141
+ text: await this.translationService.translateAsync('@assessment-management:commands.preview-questionnaire.errors.failed', { params: { message } }),
144
142
  },
145
143
  };
146
144
  }
@@ -162,4 +160,4 @@ function asEntityId(value) {
162
160
  }
163
161
 
164
162
  export { AXPPreviewQuestionnaireCommand };
165
- //# sourceMappingURL=acorex-platform-module-assessment-management-client-preview-questionnaire.command-CyiaPtLs.mjs.map
163
+ //# sourceMappingURL=acorex-platform-module-assessment-management-client-preview-questionnaire.command-duK7Tjjp.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-assessment-management-client-preview-questionnaire.command-duK7Tjjp.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/questionnaire-viewer/commands/preview-questionnaire.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\n\nimport { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { Injectable, inject } from '@angular/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXMQuestionnaireViewerService } from '../../../features/questionnaire-viewer/questionnaire-viewer.service';\nimport {\n type AXMAssessmentManagementQuestionnaireEntityModel,\n toDisplaySettings,\n toPrePostConfig,\n toPrintSettings,\n} from '@acorex-platform/module-assessment-management-client/contracts';\nimport { RootConfig } from '@acorex-platform/module-assessment-management-client/contracts';\nimport { formatQuestionnairePreviewDialogTitle } from '../utils/questionnaire-preview-title.util';\n\n//#endregion\n\n//#region ---- Command Input/Output Types ----\n\n/**\n * Input for PreviewQuestionnaire command.\n */\nexport interface AXPPreviewQuestionnaireCommandInput {\n /**\n * Questionnaire ID to preview.\n */\n questionnaireId: string;\n\n /**\n * Questionnaire title (for display).\n */\n questionnaireTitle?: string;\n}\n\n/** Entity list passes evaluated action options on `options` (see entity-master-list view model). */\ntype AXPPreviewQuestionnaireCommandInvocation = AXPPreviewQuestionnaireCommandInput & {\n data?: Record<string, unknown>;\n options?: Partial<AXPPreviewQuestionnaireCommandInput> & Record<string, unknown>;\n};\n\n//#endregion\n\n//#region ---- Preview Questionnaire Command ----\n\n/**\n * Command that opens a preview of a questionnaire in a dialog.\n */\n@Injectable()\nexport class AXPPreviewQuestionnaireCommand implements AXPCommand<AXPPreviewQuestionnaireCommandInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly questionnaireViewerService = inject(AXMQuestionnaireViewerService);\n private readonly translationService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n /**\n * Resolves questionnaire id/title from root input or from entity action payload (`options` / row `data`).\n */\n private resolvePayload(input: AXPPreviewQuestionnaireCommandInvocation): AXPPreviewQuestionnaireCommandInput | null {\n const ctxOpts = input.options;\n const ctxData = input.data;\n\n const asNonEmptyString = (v: unknown): string | undefined =>\n typeof v === 'string' && v.length > 0 ? v : undefined;\n\n const asDisplayTitle = (v: unknown): string | undefined => {\n const s = asNonEmptyString(v);\n if (s) return s;\n if (v && typeof v === 'object') {\n const o = v as Record<string, unknown>;\n const fromTitle = o['title'];\n if (typeof fromTitle === 'string' && fromTitle.trim()) return fromTitle.trim();\n const fromName = o['name'];\n if (typeof fromName === 'string' && fromName.trim()) return fromName.trim();\n }\n return undefined;\n };\n\n const questionnaireId =\n asNonEmptyString(input.questionnaireId) ??\n asNonEmptyString(ctxOpts?.questionnaireId) ??\n (ctxData?.['id'] != null ? String(ctxData['id']) : undefined);\n\n if (!questionnaireId) {\n return null;\n }\n\n const questionnaireTitle =\n asDisplayTitle(input.questionnaireTitle) ??\n asDisplayTitle(ctxOpts?.questionnaireTitle) ??\n asDisplayTitle(ctxData?.['title']) ??\n asDisplayTitle(ctxData?.['name']);\n\n return { questionnaireId, questionnaireTitle };\n }\n\n async execute(input: AXPPreviewQuestionnaireCommandInvocation): AXPCommandExecuteResultPromise<void> {\n try {\n const resolved = this.resolvePayload(input);\n if (!resolved) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.preview-questionnaire.errors.missing-id' },\n };\n }\n\n const { questionnaireId, questionnaireTitle } = resolved;\n\n // Get questionnaire data\n const questionnaire = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.questionnaire.name)\n .data<string, AXMAssessmentManagementQuestionnaireEntityModel>()\n .byKey(questionnaireId);\n\n if (!questionnaire) {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync(\n '@assessment-management:commands.preview-questionnaire.errors.not-found',\n { params: { questionnaireId } },\n ),\n },\n };\n }\n\n // Check if questionnaire has questions\n if (!questionnaire.questions || !questionnaire.questions.sections || questionnaire.questions.sections.length === 0) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.preview-questionnaire.errors.no-questions' },\n };\n }\n\n // Get preview title\n const previewTitleKey = '@assessment-management:questionnaires.entities.questionnaire.actions.preview.title';\n const previewTitleBase = (await this.translationService.translateAsync(previewTitleKey)) || 'Preview';\n const locale = this.translationService.getActiveLang?.() ?? 'en-US';\n const entityTitle = resolveMultiLanguageString(questionnaire.title, locale).trim();\n const displayTitle = questionnaireTitle?.trim() || entityTitle || undefined;\n const previewTitle = formatQuestionnairePreviewDialogTitle(previewTitleBase, displayTitle);\n\n const cfg = toPrePostConfig(questionnaire);\n const displaySettings = toDisplaySettings(questionnaire);\n const questions = questionnaire.questions;\n const structure = {\n sections: questions?.sections ?? [],\n displaySettings: displaySettings ?? undefined,\n printSettings: toPrintSettings(questionnaire) ?? undefined,\n };\n const result = await this.questionnaireViewerService.open({\n title: previewTitle,\n structure,\n prePostConfig: cfg,\n config: {\n previewMode: true,\n completionMode: 'submit-only',\n viewMode: displaySettings?.viewMode,\n showProgressBar: displaySettings?.showProgressBar,\n timer: { showTimer: displaySettings?.showTimer ?? false },\n showQuestionNumbers: displaySettings?.showQuestionNumbers,\n validationStrategy: displaySettings?.validationStrategy,\n },\n questionnaireId,\n printTemplateId: asEntityId(questionnaire.printTemplateId),\n submitHandler: async (answers: Record<string, any>) =>\n this.questionnaireViewerService.buildSummaryPlaceholderValues(structure, answers, {\n questionnaireId,\n }),\n });\n\n if (result?.submitted && result.answers) {\n return {\n success: true,\n kind: 'object',\n data: undefined,\n metadata: { outcome: 'Previewed', refresh: false },\n };\n }\n return {\n success: true,\n kind: 'object',\n data: undefined,\n metadata: { outcome: 'Cancelled', refresh: false },\n };\n } catch (error: unknown) {\n const fallback = await this.translationService.translateAsync(\n '@general:messages.generic.error.description',\n );\n const message = error instanceof Error ? error.message : fallback;\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync(\n '@assessment-management:commands.preview-questionnaire.errors.failed',\n { params: { message } },\n ),\n },\n };\n }\n }\n\n //#endregion\n}\n\nfunction asEntityId(value: unknown): string | undefined {\n if (typeof value === 'string' && value.trim()) {\n return value.trim();\n }\n if (value && typeof value === 'object' && 'id' in value) {\n return asEntityId((value as { id: unknown }).id);\n }\n return undefined;\n}\n\n//#endregion\n\n"],"names":[],"mappings":";;;;;;;AA2CA;AAEA;AAEA;;AAEG;MAEU,8BAA8B,CAAA;AAD3C,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,0BAA0B,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAClE,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AA0JnE,IAAA;;;AApJC;;AAEG;AACK,IAAA,cAAc,CAAC,KAA+C,EAAA;AACpE,QAAA,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO;AAC7B,QAAA,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI;QAE1B,MAAM,gBAAgB,GAAG,CAAC,CAAU,KAClC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,GAAG,SAAS;AAEvD,QAAA,MAAM,cAAc,GAAG,CAAC,CAAU,KAAwB;AACxD,YAAA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ACA,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAI,IAAI,KAAK,EAAE;AACvD,QAAA,OAAO,UAAU,CAAE,KAAyB,CAAC,EAAE,CAAC;IAClD;AACA,IAAA,OAAO,SAAS;AAClB;;"}
@@ -26,7 +26,7 @@ class PreviewSessionPdfCommand {
26
26
  this.closePreviewWindow(previewWindow);
27
27
  return {
28
28
  success: false,
29
- message: { text: 'Assessment case ID, session ID, or print HTML is required' },
29
+ message: { text: '@assessment-management:commands.preview-session-pdf.errors.ids-required' },
30
30
  };
31
31
  }
32
32
  const locale = this.asNonEmptyString(input.locale) ??
@@ -175,4 +175,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
175
175
  }] });
176
176
 
177
177
  export { PreviewSessionPdfCommand };
178
- //# sourceMappingURL=acorex-platform-module-assessment-management-client-preview-session-pdf.command-BsiJU6ep.mjs.map
178
+ //# sourceMappingURL=acorex-platform-module-assessment-management-client-preview-session-pdf.command-DjBxg7Yn.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-assessment-management-client-preview-session-pdf.command-DjBxg7Yn.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/questionnaire-viewer/commands/preview-session-pdf.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { runtimeCommandPayloadData } from '@acorex-platform/framework-shared/core';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { Injectable, inject } from '@angular/core';\nimport { get, isEmpty, isString, toString } from 'lodash';\nimport { AXPCommandService } from '@acorex-platform/framework-client/runtime';\nimport {\n AXM_ASSESSMENT_SESSION_PREVIEW_PDF_COMMAND_KEY,\n type AXMAssessmentSessionPreviewPdfRequest,\n type AXMAssessmentSessionPreviewPdfResult,\n} from '@acorex-platform/module-assessment-management-client/contracts';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface PreviewSessionPdfCommandInput {\n caseId?: string;\n sessionId?: string;\n questionnaireId?: string;\n locale?: string;\n printHtmlGzip?: string;\n title?: string;\n printTemplateId?: string;\n paperSize?: 'A4' | 'Letter' | 'Legal';\n orientation?: 'portrait' | 'landscape';\n watermark?: string;\n}\n\ntype PreviewSessionPdfCommandInvocation = PreviewSessionPdfCommandInput & {\n data?: Record<string, unknown>;\n options?: Partial<PreviewSessionPdfCommandInput>;\n /** Reserved tab from the click handler so popup blockers do not hide the PDF. */\n previewWindow?: Window | null;\n};\n\n//#endregion\n\n//#region ---- Preview session PDF command ----\n\n@Injectable()\nexport class PreviewSessionPdfCommand implements AXPCommand<PreviewSessionPdfCommandInput, void> {\n private readonly commandService = inject(AXPCommandService);\n private readonly translationService = inject(AXTranslationService);\n\n async execute(input: PreviewSessionPdfCommandInvocation): AXPCommandExecuteResultPromise<void> {\n const previewWindow = input.previewWindow ?? this.openPreviewWindow();\n this.writePreviewPlaceholder(previewWindow);\n try {\n const printHtmlGzip = this.asNonEmptyString(input.printHtmlGzip);\n const sessionId = this.resolveSessionId(input);\n const caseId = this.resolveCaseId(input);\n const questionnaireId = this.asEntityId(input.questionnaireId);\n const printTemplateId = this.asEntityId(input.printTemplateId);\n if (!printHtmlGzip && !sessionId && !caseId) {\n this.closePreviewWindow(previewWindow);\n return {\n success: false,\n message: { text: '@assessment-management:commands.preview-session-pdf.errors.ids-required' },\n };\n }\n\n const locale =\n this.asNonEmptyString(input.locale) ??\n this.asNonEmptyString(this.translationService.getActiveLang()) ??\n 'en-US';\n const documentTitle = this.asNonEmptyString(input.title);\n\n const result = await this.commandService.executeRemote<\n AXMAssessmentSessionPreviewPdfRequest,\n AXMAssessmentSessionPreviewPdfResult\n >(AXM_ASSESSMENT_SESSION_PREVIEW_PDF_COMMAND_KEY, {\n ...(printHtmlGzip ? { printHtmlGzip } : {}),\n ...(documentTitle ? { title: documentTitle } : {}),\n ...(sessionId ? { sessionId } : {}),\n ...(caseId ? { caseId } : {}),\n ...(questionnaireId ? { questionnaireId } : {}),\n ...(printTemplateId ? { printTemplateId } : {}),\n ...(this.asNonEmptyString(input.paperSize) ? { paperSize: input.paperSize } : {}),\n ...(this.asNonEmptyString(input.orientation) ? { orientation: input.orientation } : {}),\n ...(input.watermark != null ? { watermark: input.watermark } : {}),\n locale,\n });\n\n const pdf = runtimeCommandPayloadData(result);\n if (!pdf?.base64) {\n this.closePreviewWindow(previewWindow);\n const message =\n (typeof result?.message?.text === 'string' && result.message.text.trim()) ||\n (await this.translationService.translateAsync(\n '@assessment-management:sessions.actions.preview-pdf.failed',\n )) ||\n 'Failed to preview assessment session PDF.';\n return { success: false, message: { text: message } };\n }\n\n this.showPdfInBrowser(previewWindow, pdf.base64, pdf.filename || 'questionnaire.pdf');\n return { success: true, kind: 'object', data: undefined };\n } catch (error: unknown) {\n this.closePreviewWindow(previewWindow);\n return {\n success: false,\n message: {\n text: error instanceof Error ? error.message : 'Failed to preview assessment session PDF.',\n },\n };\n }\n }\n\n private openPreviewWindow(): Window | null {\n if (typeof window === 'undefined') {\n return null;\n }\n const preview = window.open('about:blank', '_blank');\n this.writePreviewPlaceholder(preview);\n window.focus();\n return preview;\n }\n\n private writePreviewPlaceholder(preview: Window | null): void {\n if (!preview || preview.closed) {\n return;\n }\n try {\n preview.document.title = 'Preview PDF';\n preview.document.body.innerHTML =\n '<p style=\"font-family:sans-serif;padding:24px;color:#64748b\">Generating PDF…</p>';\n } catch {\n // about:blank can be briefly cross-origin in some browsers\n }\n }\n\n private showPdfInBrowser(preview: Window | null, base64: string, filename: string): void {\n const bytes = Uint8Array.from(atob(base64), (char) => char.charCodeAt(0));\n const blob = new Blob([bytes], { type: 'application/pdf' });\n const url = URL.createObjectURL(blob);\n if (preview && !preview.closed) {\n preview.location.replace(url);\n try {\n preview.focus();\n } catch {\n // some browsers block focus from a backgrounded opener\n }\n window.setTimeout(() => URL.revokeObjectURL(url), 60_000);\n return;\n }\n const opened = window.open(url, '_blank', 'noopener');\n if (opened) {\n window.setTimeout(() => URL.revokeObjectURL(url), 60_000);\n return;\n }\n const link = document.createElement('a');\n link.href = url;\n link.download = filename;\n link.rel = 'noopener';\n link.click();\n window.setTimeout(() => URL.revokeObjectURL(url), 60_000);\n }\n\n private closePreviewWindow(preview: Window | null): void {\n if (preview && !preview.closed) {\n preview.close();\n }\n }\n\n private resolveSessionId(input: PreviewSessionPdfCommandInvocation): string | undefined {\n const candidates = [get(input, 'sessionId'), get(input, 'options.sessionId')];\n for (const candidate of candidates) {\n const resolved = this.asNonEmptyString(candidate);\n if (resolved) {\n return resolved;\n }\n }\n const row = get(input, 'data') as Record<string, unknown> | undefined;\n if (row && this.asNonEmptyString(get(row, 'caseId'))) {\n return this.asNonEmptyString(get(row, 'id'));\n }\n return undefined;\n }\n\n private resolveCaseId(input: PreviewSessionPdfCommandInvocation): string | undefined {\n const candidates = [get(input, 'caseId'), get(input, 'options.caseId')];\n for (const candidate of candidates) {\n const resolved = this.asNonEmptyString(candidate);\n if (resolved) {\n return resolved;\n }\n }\n const row = get(input, 'data') as Record<string, unknown> | undefined;\n if (row && !this.asNonEmptyString(get(row, 'caseId'))) {\n return this.asNonEmptyString(get(row, 'id'));\n }\n return undefined;\n }\n\n private asEntityId(value: unknown): string | undefined {\n if (isString(value) && !isEmpty(value.trim())) {\n return value.trim();\n }\n if (value && typeof value === 'object' && 'id' in value) {\n return this.asEntityId((value as { id: unknown }).id);\n }\n return undefined;\n }\n\n private asNonEmptyString(value: unknown): string | undefined {\n if (isString(value) && !isEmpty(value)) {\n return value;\n }\n if (value != null && !isString(value)) {\n const normalized = toString(value).trim();\n return isEmpty(normalized) ? undefined : normalized;\n }\n return undefined;\n }\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;AAsCA;AAEA;MAGa,wBAAwB,CAAA;AADrC,IAAA,WAAA,GAAA;AAEmB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC1C,QAAA,I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