@acorex-platform/extension-communication-telegram-client 0.0.33 → 0.0.37
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.
- package/fesm2022/acorex-platform-extension-communication-telegram-client-communication-telegram-command-error.util-BTRYC0rH.mjs.map +1 -1
- package/fesm2022/acorex-platform-extension-communication-telegram-client-communication-test-telegram.command-Cir1ijfl.mjs.map +1 -1
- package/fesm2022/acorex-platform-extension-communication-telegram-client-connect-telegram.command-C2H_3TPw.mjs.map +1 -1
- package/fesm2022/acorex-platform-extension-communication-telegram-client-contracts.mjs.map +1 -1
- package/fesm2022/acorex-platform-extension-communication-telegram-client.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-extension-communication-telegram-client-communication-telegram-command-error.util-BTRYC0rH.mjs","sources":["../../../../libs/extensions/communication/telegram/client/src/lib/commands/communication-telegram-command.i18n.ts","../../../../libs/extensions/communication/telegram/client/src/lib/commands/communication-telegram-command-error.util.ts"],"sourcesContent":["import { RootConfig } from '@acorex-platform/extension-communication-telegram-client/contracts';\n\nconst ROOT = `@${RootConfig.config.i18n}`;\n\nexport const CommunicationTelegramCommandI18n = {\n errors: {\n chatIdRequired: `${ROOT}:settings.telegram.errors.chat-id-required`,\n botTokenNotConfigured: `${ROOT}:settings.telegram.errors.bot-token-not-configured`,\n tenantRequired: `${ROOT}:settings.telegram.errors.tenant-required`,\n chatNotFound: `${ROOT}:settings.telegram.errors.chat-not-found`,\n botUnauthorized: `${ROOT}:settings.telegram.errors.bot-unauthorized`,\n botBlocked: `${ROOT}:settings.telegram.errors.bot-blocked`,\n botCannotInitiate: `${ROOT}:settings.telegram.errors.bot-cannot-initiate`,\n apiError: `${ROOT}:settings.telegram.errors.api-error`,\n },\n test: {\n failed: `${ROOT}:settings.telegram.test.messages.failed`,\n },\n connect: {\n failed: `${ROOT}:integration.connect.messages.failed`,\n },\n} as const;\n","import { extractRequestErrorInfo } from '@acorex-platform/framework-client/common';\nimport { AXP_COMMUNICATION_TELEGRAM_ERROR_CODES } from '@acorex-platform/extension-communication-telegram-client/contracts';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { CommunicationTelegramCommandI18n } from './communication-telegram-command.i18n';\n\nconst ERROR_I18N_BY_CODE: Record<string, string> = {\n [AXP_COMMUNICATION_TELEGRAM_ERROR_CODES.CHAT_ID_REQUIRED]: CommunicationTelegramCommandI18n.errors.chatIdRequired,\n [AXP_COMMUNICATION_TELEGRAM_ERROR_CODES.BOT_TOKEN_NOT_CONFIGURED]:\n CommunicationTelegramCommandI18n.errors.botTokenNotConfigured,\n [AXP_COMMUNICATION_TELEGRAM_ERROR_CODES.TENANT_REQUIRED]: CommunicationTelegramCommandI18n.errors.tenantRequired,\n [AXP_COMMUNICATION_TELEGRAM_ERROR_CODES.CHAT_NOT_FOUND]: CommunicationTelegramCommandI18n.errors.chatNotFound,\n [AXP_COMMUNICATION_TELEGRAM_ERROR_CODES.BOT_UNAUTHORIZED]: CommunicationTelegramCommandI18n.errors.botUnauthorized,\n [AXP_COMMUNICATION_TELEGRAM_ERROR_CODES.BOT_BLOCKED]: CommunicationTelegramCommandI18n.errors.botBlocked,\n [AXP_COMMUNICATION_TELEGRAM_ERROR_CODES.BOT_CANNOT_INITIATE]:\n CommunicationTelegramCommandI18n.errors.botCannotInitiate,\n [AXP_COMMUNICATION_TELEGRAM_ERROR_CODES.API_ERROR]: CommunicationTelegramCommandI18n.errors.apiError,\n};\n\nexport async function resolveCommunicationTelegramCommandError(\n translationService: AXTranslationService,\n error: unknown,\n fallbackKey: string = CommunicationTelegramCommandI18n.test.failed,\n): Promise<{ messageKeyOrText: string; displayText: string }> {\n const httpInfo = extractRequestErrorInfo(error);\n if (httpInfo?.code) {\n const messageKey = ERROR_I18N_BY_CODE[httpInfo.code];\n if (messageKey) {\n const displayText = await translationService.translateAsync(messageKey, {\n params: httpInfo.params,\n });\n return { messageKeyOrText: messageKey, displayText };\n }\n }\n\n if (httpInfo?.message) {\n return { messageKeyOrText: httpInfo.message, displayText: httpInfo.message };\n }\n\n if (error instanceof Error && error.message.trim()) {\n return { messageKeyOrText: error.message, displayText: error.message };\n }\n\n const displayText = await translationService.translateAsync(fallbackKey);\n return { messageKeyOrText: fallbackKey, displayText };\n}\n"],"names":[],"mappings":";;;AAEA,MAAM,IAAI,GAAG,CAAA,CAAA,EAAI,UAAU,CAAC,MAAM,CAAC,IAAI,CAAA,CAAE;AAElC,MAAM,gCAAgC,GAAG;AAC9C,IAAA,MAAM,EAAE;QACN,cAAc,EAAE,CAAA,EAAG,IAAI,CAAA,0CAAA,CAA4C;QACnE,qBAAqB,EAAE,CAAA,EAAG,IAAI,CAAA,kDAAA,CAAoD;QAClF,cAAc,EAAE,CAAA,EAAG,IAAI,CAAA,yCAAA,CAA2C;QAClE,YAAY,EAAE,CAAA,EAAG,IAAI,CAAA,wCAAA,CAA0C;QAC/D,eAAe,EAAE,CAAA,EAAG,IAAI,CAAA,0CAAA,CAA4C;QACpE,UAAU,EAAE,CAAA,EAAG,IAAI,CAAA,qCAAA,CAAuC;QAC1D,iBAAiB,EAAE,CAAA,EAAG,IAAI,CAAA,6CAAA,CAA+C;QACzE,QAAQ,EAAE,CAAA,EAAG,IAAI,CAAA,mCAAA,CAAqC;AACvD,KAAA;AACD,IAAA,IAAI,EAAE;QACJ,MAAM,EAAE,CAAA,EAAG,IAAI,CAAA,uCAAA,CAAyC;AACzD,KAAA;AACD,IAAA,OAAO,EAAE;QACP,MAAM,EAAE,CAAA,EAAG,IAAI,CAAA,oCAAA,CAAsC;AACtD,KAAA;;;ACfH,MAAM,kBAAkB,GAA2B;IACjD,CAAC,sCAAsC,CAAC,gBAAgB,GAAG,gCAAgC,CAAC,MAAM,CAAC,cAAc;IACjH,CAAC,sCAAsC,CAAC,wBAAwB,GAC9D,gCAAgC,CAAC,MAAM,CAAC,qBAAqB;IAC/D,CAAC,sCAAsC,CAAC,eAAe,GA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;IAEA,MAAM,WAAW,GAAG,MAAM,kBAAkB,CAAC,cAAc,CAAC,WAAW,CAAC;AACxE,IAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE;AACvD
|
|
1
|
+
{"version":3,"file":"acorex-platform-extension-communication-telegram-client-communication-telegram-command-error.util-BTRYC0rH.mjs","sources":["../../../../libs/extensions/communication/telegram/client/src/lib/commands/communication-telegram-command.i18n.ts","../../../../libs/extensions/communication/telegram/client/src/lib/commands/communication-telegram-command-error.util.ts"],"sourcesContent":["import { RootConfig } from '@acorex-platform/extension-communication-telegram-client/contracts';\n\nconst ROOT = `@${RootConfig.config.i18n}`;\n\nexport const CommunicationTelegramCommandI18n = {\n errors: {\n chatIdRequired: `${ROOT}:settings.telegram.errors.chat-id-required`,\n botTokenNotConfigured: `${ROOT}:settings.telegram.errors.bot-token-not-configured`,\n tenantRequired: `${ROOT}:settings.telegram.errors.tenant-required`,\n chatNotFound: `${ROOT}:settings.telegram.errors.chat-not-found`,\n botUnauthorized: `${ROOT}:settings.telegram.errors.bot-unauthorized`,\n botBlocked: `${ROOT}:settings.telegram.errors.bot-blocked`,\n botCannotInitiate: `${ROOT}:settings.telegram.errors.bot-cannot-initiate`,\n apiError: `${ROOT}:settings.telegram.errors.api-error`,\n },\n test: {\n failed: `${ROOT}:settings.telegram.test.messages.failed`,\n },\n connect: {\n failed: `${ROOT}:integration.connect.messages.failed`,\n },\n} as const;\n","import { extractRequestErrorInfo } from '@acorex-platform/framework-client/common';\nimport { AXP_COMMUNICATION_TELEGRAM_ERROR_CODES } from '@acorex-platform/extension-communication-telegram-client/contracts';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { CommunicationTelegramCommandI18n } from './communication-telegram-command.i18n';\n\nconst ERROR_I18N_BY_CODE: Record<string, string> = {\n [AXP_COMMUNICATION_TELEGRAM_ERROR_CODES.CHAT_ID_REQUIRED]: CommunicationTelegramCommandI18n.errors.chatIdRequired,\n [AXP_COMMUNICATION_TELEGRAM_ERROR_CODES.BOT_TOKEN_NOT_CONFIGURED]:\n CommunicationTelegramCommandI18n.errors.botTokenNotConfigured,\n [AXP_COMMUNICATION_TELEGRAM_ERROR_CODES.TENANT_REQUIRED]: CommunicationTelegramCommandI18n.errors.tenantRequired,\n [AXP_COMMUNICATION_TELEGRAM_ERROR_CODES.CHAT_NOT_FOUND]: CommunicationTelegramCommandI18n.errors.chatNotFound,\n [AXP_COMMUNICATION_TELEGRAM_ERROR_CODES.BOT_UNAUTHORIZED]: CommunicationTelegramCommandI18n.errors.botUnauthorized,\n [AXP_COMMUNICATION_TELEGRAM_ERROR_CODES.BOT_BLOCKED]: CommunicationTelegramCommandI18n.errors.botBlocked,\n [AXP_COMMUNICATION_TELEGRAM_ERROR_CODES.BOT_CANNOT_INITIATE]:\n CommunicationTelegramCommandI18n.errors.botCannotInitiate,\n [AXP_COMMUNICATION_TELEGRAM_ERROR_CODES.API_ERROR]: CommunicationTelegramCommandI18n.errors.apiError,\n};\n\nexport async function resolveCommunicationTelegramCommandError(\n translationService: AXTranslationService,\n error: unknown,\n fallbackKey: string = CommunicationTelegramCommandI18n.test.failed,\n): Promise<{ messageKeyOrText: string; displayText: string }> {\n const httpInfo = extractRequestErrorInfo(error);\n if (httpInfo?.code) {\n const messageKey = ERROR_I18N_BY_CODE[httpInfo.code];\n if (messageKey) {\n const displayText = await translationService.translateAsync(messageKey, {\n params: httpInfo.params,\n });\n return { messageKeyOrText: messageKey, displayText };\n }\n }\n\n if (httpInfo?.message) {\n return { messageKeyOrText: httpInfo.message, displayText: httpInfo.message };\n }\n\n if (error instanceof Error && error.message.trim()) {\n return { messageKeyOrText: error.message, displayText: error.message };\n }\n\n const displayText = await translationService.translateAsync(fallbackKey);\n return { messageKeyOrText: fallbackKey, displayText };\n}\n"],"names":[],"mappings":";;;AAEA,MAAM,IAAI,GAAG,CAAA,CAAA,EAAI,UAAU,CAAC,MAAM,CAAC,IAAI,CAAA,CAAE;AAElC,MAAM,gCAAgC,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C3D,CAAC,sCAAsC,CAAC,SAAS,GAAG,gCAAgC,CAAC,MAAM,CAAC,QAAQ;CACrG;AAEM,eAAe,wCAAwC,CAC5D,kBAAwC,EACxC,KAAc,EACd,WAAA,GAAsB,gCAAgC,CAAC,IAAI,CAAC,MAAM,EAAA;AAElE,IAAA,MAAM,QAAQ,GAAG,uBAAuB,CAAC,KAAK,CAAC;AAC/C,IAAA,IAAI,QAAQ,EAAE,IAAI,EAAE;QAClB,MAAM,UAAU,GAAG,kBAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC;QACpD,IAAI,UAAU,EAAE;YACd,MAAM,WAAW,GAAG,MAAM,kBAAkB,CAAC,cAAc,CAAC,UAAU,EAAE;gBACtE,MAAM,EAAE,QAAQ,CAAC,MAAM;AACxB,aAAA,CAAC;AACF,YAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,WAAW,EAAE;QACtD;IACF;AAEA,IAAA,IAAI,QAAQ,EAAE,OAAO,EAAE;AACrB,QAAA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,CAAC,OAAO,EAAE;IAC9E;IAEA,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE;AAClD,QAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,CAAC,OAAO,EAAE;IACxE;IAEA,MAAM,WAAW,GAAG,MAAM,kBAAkB,CAAC,cAAc,CAAC,WAAW,CAAC;AACxE,IAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE;AACvD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-extension-communication-telegram-client-communication-test-telegram.command-Cir1ijfl.mjs","sources":["../../../../libs/extensions/communication/telegram/client/src/lib/features/telegram/communication-telegram-test-dialog.service.ts","../../../../libs/extensions/communication/telegram/client/src/lib/commands/communication-test-telegram.command.ts"],"sourcesContent":["import { AXTranslationService } from '@acorex/core/translation';\nimport { AXPRuntimeCommandResult, AXP_INTEGRATION_CONNECTION_STATUS } from '@acorex-platform/framework-shared/core';\nimport {\n AXPLayoutBuilderService,\n resolveLayoutBuilderDialogResult,\n type AXPDialogRef,\n} from '@acorex-platform/framework-client/layout/builder';\nimport { Injectable, inject } from '@angular/core';\nimport {\n RootConfig,\n type CommunicationTelegramTestResult,\n type CommunicationTelegramUserLinkConfig,\n} from '@acorex-platform/extension-communication-telegram-client/contracts';\nimport { AXPCommunicationTelegramClient } from '../../communication-telegram-client.port';\nimport { AXMIntegrationConnectionManager } from '@acorex-platform/module-integration-management-client';\nimport { resolveCommunicationTelegramCommandError } from '../../commands/communication-telegram-command-error.util';\n\n//#region ----- Types -----\n\ntype TelegramTestDialogResult = AXPRuntimeCommandResult<CommunicationTelegramTestResult> | null;\n\n//#endregion\n\n//#region ----- Telegram test dialog -----\n\n@Injectable({ providedIn: 'root' })\nexport class AXECommunicationTelegramTestDialogService {\n private readonly layoutBuilder = inject(AXPLayoutBuilderService);\n private readonly translationService = inject(AXTranslationService);\n private readonly client = inject(AXPCommunicationTelegramClient);\n private readonly connectionManager = inject(AXMIntegrationConnectionManager);\n\n private async resolveDefaultChatId(): Promise<string> {\n const connection = await this.connectionManager.findByUniqueKey({\n providerId: RootConfig.integration.providerId,\n connectionScope: 'user',\n connectionKey: 'default',\n });\n\n if (\n !connection ||\n connection.status !== AXP_INTEGRATION_CONNECTION_STATUS.Connected ||\n connection.isRevoked ||\n connection.isDisabled\n ) {\n return '';\n }\n\n const config = (connection.config ?? {}) as unknown as CommunicationTelegramUserLinkConfig;\n return String(config.chatId ?? connection.externalAccountId ?? '').trim();\n }\n\n async openAndSendTestMessage(): Promise<TelegramTestDialogResult> {\n const defaultChatId = await this.resolveDefaultChatId();\n\n try {\n const result = await this.layoutBuilder\n .create()\n .dialog<TelegramTestDialogResult>((dialog) => {\n dialog\n .setTitle('@extensions-communication-telegram:settings.telegram.test.dialog.title')\n .setSize('sm')\n .setCloseButton(true)\n .setContext({ chatId: defaultChatId })\n .content((flex) => {\n flex\n .setDirection('column')\n .setGap('16px')\n .formField('@extensions-communication-telegram:settings.telegram.test.dialog.fields.chat-id.title', (field) => {\n field.path('chatId');\n field.textBox({\n validations: [{ rule: 'required' }],\n placeholder:\n '@extensions-communication-telegram:settings.telegram.test.dialog.fields.chat-id.placeholder',\n });\n });\n })\n .setActions((actions) => {\n actions\n .cancel('@general:actions.cancel.title')\n .submit('@extensions-communication-telegram:settings.telegram.test.dialog.actions.send');\n })\n .onAction(async (dialogRef: AXPDialogRef) => {\n if (dialogRef.action() === 'cancel') {\n return null;\n }\n\n const context = dialogRef.context() as Record<string, unknown> | null;\n const chatId = String(context?.['chatId'] ?? '').trim();\n if (!chatId) {\n throw new Error(\n await this.translationService.translateAsync(\n '@extensions-communication-telegram:settings.telegram.test.messages.chat-id-required',\n ),\n );\n }\n\n try {\n const data = await this.client.testTelegram({ chatId });\n return { success: true, kind: 'object', data };\n } catch (error) {\n const { messageKeyOrText } = await resolveCommunicationTelegramCommandError(\n this.translationService,\n error,\n );\n return {\n success: false,\n message: { text: messageKeyOrText },\n };\n }\n });\n })\n .show();\n\n return resolveLayoutBuilderDialogResult<AXPRuntimeCommandResult<CommunicationTelegramTestResult>>(result);\n } catch (error) {\n const { messageKeyOrText } = await resolveCommunicationTelegramCommandError(\n this.translationService,\n error,\n );\n return {\n success: false,\n message: { text: messageKeyOrText },\n };\n }\n }\n}\n\n//#endregion\n","import { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport type { AXPCommand, AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport type { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport type { CommunicationTelegramTestResult } from '@acorex-platform/extension-communication-telegram-client/contracts';\nimport { Injectable, inject } from '@angular/core';\nimport { CommunicationTelegramCommandI18n } from './communication-telegram-command.i18n';\nimport { AXECommunicationTelegramTestDialogService } from '../features/telegram/communication-telegram-test-dialog.service';\n\n//#region ----- Telegram test command -----\n\n@Injectable()\nexport class CommunicationTestTelegramCommand\n implements AXPCommand<void, CommunicationTelegramTestResult | null>\n{\n private readonly dialog = inject(AXECommunicationTelegramTestDialogService);\n private readonly toastService = inject(AXToastService);\n private readonly translationService = inject(AXTranslationService);\n\n async execute(): AXPCommandExecuteResultPromise<CommunicationTelegramTestResult | null> {\n const result = await this.dialog.openAndSendTestMessage();\n\n // Cancel / header close — not a failure for the integrations panel.\n if (!result) {\n return { success: true, kind: 'object', data: null };\n }\n\n if (result.success) {\n this.toastService.success(\n await this.translationService.translateAsync(\n '@extensions-communication-telegram:settings.telegram.test.messages.success',\n ),\n );\n return result;\n }\n\n if (result.message?.text) {\n const content = await this.translationService.translateAsync(result.message.text);\n const title = await this.translationService.translateAsync(\n CommunicationTelegramCommandI18n.test.failed,\n );\n this.toastService.show({ color: 'danger', title, content });\n }\n\n return result;\n }\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;;;AAqBA;AAEA;MAGa,yCAAyC,CAAA;AADtD,IAAA,WAAA,GAAA;AAEmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,uBAAuB,CAAC;AAC/C,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AACjD,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,8BAA8B,CAAC;AAC/C,QAAA,IAAA,CAAA,iBAAiB,GAAG,MAAM,CAAC,+BAA+B,CAAC;AAgG7E,IAAA;AA9FS,IAAA,MAAM,oBAAoB,GAAA;QAChC,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC;AAC9D,YAAA,UAAU,EAAE,UAAU,CAAC,WAAW,CAAC,UAAU;AAC7C,YAAA,eAAe,EAAE,MAAM;AACvB,YAAA,aAAa,EAAE,SAAS;AAC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Ac,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;AACjF,YAAA,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,CACxD,gCAAgC,CAAC,IAAI,CAAC,MAAM,CAC7C;AACD,YAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;QAC7D;AAEA,QAAA,OAAO,MAAM;IACf;8GAjCW,gCAAgC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAAhC,gCAAgC,EAAA,CAAA,CAAA;;2FAAhC,gCAAgC,EAAA,UAAA,EAAA,CAAA;kBAD5C;;;;;"}
|
|
1
|
+
{"version":3,"file":"acorex-platform-extension-communication-telegram-client-communication-test-telegram.command-Cir1ijfl.mjs","sources":["../../../../libs/extensions/communication/telegram/client/src/lib/features/telegram/communication-telegram-test-dialog.service.ts","../../../../libs/extensions/communication/telegram/client/src/lib/commands/communication-test-telegram.command.ts"],"sourcesContent":["import { AXTranslationService } from '@acorex/core/translation';\nimport { AXPRuntimeCommandResult, AXP_INTEGRATION_CONNECTION_STATUS } from '@acorex-platform/framework-shared/core';\nimport {\n AXPLayoutBuilderService,\n resolveLayoutBuilderDialogResult,\n type AXPDialogRef,\n} from '@acorex-platform/framework-client/layout/builder';\nimport { Injectable, inject } from '@angular/core';\nimport {\n RootConfig,\n type CommunicationTelegramTestResult,\n type CommunicationTelegramUserLinkConfig,\n} from '@acorex-platform/extension-communication-telegram-client/contracts';\nimport { AXPCommunicationTelegramClient } from '../../communication-telegram-client.port';\nimport { AXMIntegrationConnectionManager } from '@acorex-platform/module-integration-management-client';\nimport { resolveCommunicationTelegramCommandError } from '../../commands/communication-telegram-command-error.util';\n\n//#region ----- Types -----\n\ntype TelegramTestDialogResult = AXPRuntimeCommandResult<CommunicationTelegramTestResult> | null;\n\n//#endregion\n\n//#region ----- Telegram test dialog -----\n\n@Injectable({ providedIn: 'root' })\nexport class AXECommunicationTelegramTestDialogService {\n private readonly layoutBuilder = inject(AXPLayoutBuilderService);\n private readonly translationService = inject(AXTranslationService);\n private readonly client = inject(AXPCommunicationTelegramClient);\n private readonly connectionManager = inject(AXMIntegrationConnectionManager);\n\n private async resolveDefaultChatId(): Promise<string> {\n const connection = await this.connectionManager.findByUniqueKey({\n providerId: RootConfig.integration.providerId,\n connectionScope: 'user',\n connectionKey: 'default',\n });\n\n if (\n !connection ||\n connection.status !== AXP_INTEGRATION_CONNECTION_STATUS.Connected ||\n connection.isRevoked ||\n connection.isDisabled\n ) {\n return '';\n }\n\n const config = (connection.config ?? {}) as unknown as CommunicationTelegramUserLinkConfig;\n return String(config.chatId ?? connection.externalAccountId ?? '').trim();\n }\n\n async openAndSendTestMessage(): Promise<TelegramTestDialogResult> {\n const defaultChatId = await this.resolveDefaultChatId();\n\n try {\n const result = await this.layoutBuilder\n .create()\n .dialog<TelegramTestDialogResult>((dialog) => {\n dialog\n .setTitle('@extensions-communication-telegram:settings.telegram.test.dialog.title')\n .setSize('sm')\n .setCloseButton(true)\n .setContext({ chatId: defaultChatId })\n .content((flex) => {\n flex\n .setDirection('column')\n .setGap('16px')\n .formField('@extensions-communication-telegram:settings.telegram.test.dialog.fields.chat-id.title', (field) => {\n field.path('chatId');\n field.textBox({\n validations: [{ rule: 'required' }],\n placeholder:\n '@extensions-communication-telegram:settings.telegram.test.dialog.fields.chat-id.placeholder',\n });\n });\n })\n .setActions((actions) => {\n actions\n .cancel('@general:actions.cancel.title')\n .submit('@extensions-communication-telegram:settings.telegram.test.dialog.actions.send');\n })\n .onAction(async (dialogRef: AXPDialogRef) => {\n if (dialogRef.action() === 'cancel') {\n return null;\n }\n\n const context = dialogRef.context() as Record<string, unknown> | null;\n const chatId = String(context?.['chatId'] ?? '').trim();\n if (!chatId) {\n throw new Error(\n await this.translationService.translateAsync(\n '@extensions-communication-telegram:settings.telegram.test.messages.chat-id-required',\n ),\n );\n }\n\n try {\n const data = await this.client.testTelegram({ chatId });\n return { success: true, kind: 'object', data };\n } catch (error) {\n const { messageKeyOrText } = await resolveCommunicationTelegramCommandError(\n this.translationService,\n error,\n );\n return {\n success: false,\n message: { text: messageKeyOrText },\n };\n }\n });\n })\n .show();\n\n return resolveLayoutBuilderDialogResult<AXPRuntimeCommandResult<CommunicationTelegramTestResult>>(result);\n } catch (error) {\n const { messageKeyOrText } = await resolveCommunicationTelegramCommandError(\n this.translationService,\n error,\n );\n return {\n success: false,\n message: { text: messageKeyOrText },\n };\n }\n }\n}\n\n//#endregion\n","import { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport type { AXPCommand, AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport type { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport type { CommunicationTelegramTestResult } from '@acorex-platform/extension-communication-telegram-client/contracts';\nimport { Injectable, inject } from '@angular/core';\nimport { CommunicationTelegramCommandI18n } from './communication-telegram-command.i18n';\nimport { AXECommunicationTelegramTestDialogService } from '../features/telegram/communication-telegram-test-dialog.service';\n\n//#region ----- Telegram test command -----\n\n@Injectable()\nexport class CommunicationTestTelegramCommand\n implements AXPCommand<void, CommunicationTelegramTestResult | null>\n{\n private readonly dialog = inject(AXECommunicationTelegramTestDialogService);\n private readonly toastService = inject(AXToastService);\n private readonly translationService = inject(AXTranslationService);\n\n async execute(): AXPCommandExecuteResultPromise<CommunicationTelegramTestResult | null> {\n const result = await this.dialog.openAndSendTestMessage();\n\n // Cancel / header close — not a failure for the integrations panel.\n if (!result) {\n return { success: true, kind: 'object', data: null };\n }\n\n if (result.success) {\n this.toastService.success(\n await this.translationService.translateAsync(\n '@extensions-communication-telegram:settings.telegram.test.messages.success',\n ),\n );\n return result;\n }\n\n if (result.message?.text) {\n const content = await this.translationService.translateAsync(result.message.text);\n const title = await this.translationService.translateAsync(\n CommunicationTelegramCommandI18n.test.failed,\n );\n this.toastService.show({ color: 'danger', title, content });\n }\n\n return result;\n }\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;;;AAqBA;AAEA;MAGa,yCAAyC,CAAA;AADtD,IAAA,WAAA,GAAA;AAEmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,uBAAuB,CAAC;AAC/C,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AACjD,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,8BAA8B,CAAC;AAC/C,QAAA,IAAA,CAAA,iBAAiB,GAAG,MAAM,CAAC,+BAA+B,CAAC;AAgG7E,IAAA;AA9FS,IAAA,MAAM,oBAAoB,GAAA;QAChC,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC;AAC9D,YAAA,UAAU,EAAE,UAAU,CAAC,WAAW,CAAC,UAAU;AAC7C,YAAA,eAAe,EAAE,MAAM;AACvB,YAAA,aAAa,EAAE,SAAS;AACzB,SAAA,CAAC;AAEF,QAAA,IACE,CAAC,UAAU;AACX,YAAA,UAAU,CAAC,MAAM,KAAK,iCAAiC,CAAC,SAAS;AACjE,YAAA,UAAU,CAAC,SAAS;YACpB,UAAU,CAAC,UAAU,EACrB;AACA,YAAA,OAAO,EAAE;QACX;QAEA,MAAM,MAAM,IAAI,UAAU,CAAC,MAAM,IAAI,EAAE,CAAmD;AAC1F,QAAA,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,IAAI,UAAU,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;IAC3E;AAEA,IAAA,MAAM,sBAAsB,GAAA;AAC1B,QAAA,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,oBAAoB,EAAE;AAEvD,QAAA,IAAI;AACF,YAAA,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC;AACvB,iBAAA,MAAM;AACN,iBAAA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communication-telegram-client-connect-telegram.command-C2H_3TPw.mjs","sources":["../../../../libs/extensions/communication/telegram/client/src/lib/features/connect/communication-telegram-connect-dialog.service.ts","../../../../libs/extensions/communication/telegram/client/src/lib/features/connect/connect-telegram.command.ts"],"sourcesContent":["import { AXTranslationService } from '@acorex/core/translation';\nimport {\n AXPLayoutBuilderService,\n resolveLayoutBuilderDialogResult,\n type AXPDialogRef,\n type IActionBuilder,\n type IDialogBuilder,\n type IFlexContainerBuilder,\n} from '@acorex-platform/framework-client/layout/builder';\nimport { Injectable, inject } from '@angular/core';\nimport { AXPCommunicationTelegramClient } from '../../communication-telegram-client.port';\nimport { resolveCommunicationTelegramCommandError } from '../../commands/communication-telegram-command-error.util';\nimport { CommunicationTelegramCommandI18n } from '../../commands/communication-telegram-command.i18n';\n\n//#region ---- Telegram connect dialog ----\n\nconst POLL_INTERVAL_MS = 2000;\nconst POLL_TIMEOUT_MS = 2 * 60 * 1000;\n\nexport interface CommunicationTelegramConnectResult {\n chatId: string;\n username?: string;\n displayName?: string;\n}\n\ninterface TelegramConnectDialogContext {\n chatId: string;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class AXECommunicationTelegramConnectDialogService {\n private readonly layoutBuilder = inject(AXPLayoutBuilderService);\n private readonly translationService = inject(AXTranslationService);\n private readonly client = inject(AXPCommunicationTelegramClient);\n\n async openAndLinkAccount(): Promise<CommunicationTelegramConnectResult | null> {\n const result = await this.layoutBuilder\n .create()\n .dialog<CommunicationTelegramConnectResult | null>((dialog: IDialogBuilder<CommunicationTelegramConnectResult | null>) => {\n dialog\n .setTitle('@extensions-communication-telegram:integration.connect.dialog.title')\n .setSize('sm')\n .setCloseButton(true)\n .setContext({ chatId: '' } satisfies TelegramConnectDialogContext)\n .content((flex: IFlexContainerBuilder) => {\n flex\n .setDirection('column')\n .setGap('12px')\n .customWidget('text-block-layout', {\n content: '@extensions-communication-telegram:integration.connect.dialog.instructions',\n })\n .formField('@extensions-communication-telegram:integration.connect.dialog.fields.chat-id.title', (field) => {\n field.path('chatId');\n field.textBox({\n placeholder: '@extensions-communication-telegram:integration.connect.dialog.fields.chat-id.placeholder',\n });\n });\n })\n .setActions((actions: IActionBuilder) => {\n actions\n .cancel('@general:actions.cancel.title')\n .submit('@extensions-communication-telegram:integration.connect.dialog.actions.connect');\n })\n .onAction(async (ref: AXPDialogRef) => {\n if (ref.action() === 'cancel') {\n return null;\n }\n\n const context = ref.context() as TelegramConnectDialogContext;\n const manualChatId = String(context?.chatId ?? '').trim();\n if (manualChatId) {\n return { chatId: manualChatId };\n }\n\n let link;\n try {\n link = await this.client.startTelegramLink();\n } catch (error) {\n const { displayText } = await resolveCommunicationTelegramCommandError(\n this.translationService,\n error,\n CommunicationTelegramCommandI18n.connect.failed,\n );\n throw new Error(displayText);\n }\n\n window.open(link.deepLinkUrl, '_blank', 'noopener,noreferrer');\n\n const startedAt = Date.now();\n while (Date.now() - startedAt < POLL_TIMEOUT_MS) {\n try {\n const status = await this.client.getTelegramLinkStatus(link.linkToken);\n if (status.status === 'linked' && status.chatId) {\n return {\n chatId: status.chatId,\n username: status.username,\n displayName: status.displayName,\n };\n }\n if (status.status === 'expired') {\n throw new Error(\n await this.translationService.translateAsync(\n '@extensions-communication-telegram:integration.connect.messages.expired',\n ),\n );\n }\n } catch (error) {\n const { displayText } = await resolveCommunicationTelegramCommandError(\n this.translationService,\n error,\n CommunicationTelegramCommandI18n.connect.failed,\n );\n throw new Error(displayText);\n }\n\n await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));\n }\n\n throw new Error(\n await this.translationService.translateAsync(\n '@extensions-communication-telegram:integration.connect.messages.timeout',\n ),\n );\n });\n })\n .show();\n\n return resolveLayoutBuilderDialogResult<CommunicationTelegramConnectResult>(result);\n }\n}\n\n//#endregion\n","import { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport {\n AXP_INTEGRATION_AUTH_METHOD_TYPE,\n AXP_INTEGRATION_CONNECTION_SCOPE,\n AXP_INTEGRATION_CONNECTION_STATUS,\n type AXPRuntimeCommandResult,\n type AXPIntegrationConnectionScope,\n} from '@acorex-platform/framework-shared/core';\nimport type { AXPCommand, AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport {\n AXPLayoutBuilderService,\n resolveLayoutBuilderDialogResult,\n type AXPDialogRef,\n type IActionBuilder,\n type IDialogBuilder,\n type IFlexContainerBuilder,\n} from '@acorex-platform/framework-client/layout/builder';\nimport {\n AXMIntegrationConnectionManager,\n AXP_INTEGRATION_CREDENTIAL_MASK,\n hasConfiguredIntegrationCredentials,\n isMaskedIntegrationCredential,\n toSafeIntegrationConnectionDto,\n type ConnectCommandResult,\n} from '@acorex-platform/module-integration-management-client';\nimport { Injectable, inject } from '@angular/core';\nimport { defaultTo, trim } from 'lodash-es';\nimport { RootConfig } from '@acorex-platform/extension-communication-telegram-client/contracts';\nimport { resolveCommunicationTelegramCommandError } from '../../commands/communication-telegram-command-error.util';\nimport { CommunicationTelegramCommandI18n } from '../../commands/communication-telegram-command.i18n';\nimport { AXECommunicationTelegramConnectDialogService } from '../connect/communication-telegram-connect-dialog.service';\n\nexport interface ConnectTelegramCommandInput {\n providerId?: string;\n connectionScope?: AXPIntegrationConnectionScope;\n}\n\ninterface TelegramTenantConnectFormResult {\n botToken: string;\n}\n\n//#region ----- Connect Telegram (tenant bot or user link) -----\n\n@Injectable({ providedIn: 'root' })\nexport class ConnectTelegramCommand implements AXPCommand<ConnectTelegramCommandInput, ConnectCommandResult> {\n private readonly connectionManager = inject(AXMIntegrationConnectionManager);\n private readonly connectDialog = inject(AXECommunicationTelegramConnectDialogService);\n private readonly layoutBuilder = inject(AXPLayoutBuilderService);\n private readonly toastService = inject(AXToastService);\n private readonly translationService = inject(AXTranslationService);\n\n async execute(input: ConnectTelegramCommandInput = {}): AXPCommandExecuteResultPromise<ConnectCommandResult> {\n const connectionScope = input.connectionScope ?? AXP_INTEGRATION_CONNECTION_SCOPE.User;\n if (connectionScope === AXP_INTEGRATION_CONNECTION_SCOPE.Tenant) {\n return this.connectTenantBot(input);\n }\n return this.connectUserLink(input);\n }\n\n private async connectTenantBot(\n input: ConnectTelegramCommandInput,\n ): AXPCommandExecuteResultPromise<ConnectCommandResult> {\n try {\n const providerId = input.providerId ?? RootConfig.integration.providerId;\n const connectionScope = AXP_INTEGRATION_CONNECTION_SCOPE.Tenant;\n const I18N = `@${RootConfig.config.i18n}:integration.connect.tenant`;\n const existing = await this.connectionManager.findByUniqueKey({\n providerId,\n connectionScope,\n connectionKey: 'default',\n });\n const isReconfigure = hasConfiguredIntegrationCredentials(existing);\n\n const form = await this.openTenantConnectDialog({\n i18nPrefix: I18N,\n isReconfigure,\n botToken: isReconfigure ? AXP_INTEGRATION_CREDENTIAL_MASK : '',\n });\n\n if (!form) {\n return { success: true, kind: 'object', data: { outcome: 'cancelled' } };\n }\n\n let botToken = trim(form.botToken);\n if (isMaskedIntegrationCredential(botToken) && existing) {\n const config = (existing.config ?? {}) as { botToken?: string };\n botToken = trim(config.botToken ?? '');\n }\n if (!botToken) {\n return {\n success: false,\n message: { text: `${I18N}.messages.bot-token-required` },\n };\n }\n\n const connection = await this.connectionManager.upsertConnection({\n providerId,\n authMethodType: AXP_INTEGRATION_AUTH_METHOD_TYPE.ApiToken,\n connectionScope,\n connectionKey: 'default',\n displayName: existing?.displayName ?? 'Telegram',\n externalAccountName: AXP_INTEGRATION_CREDENTIAL_MASK,\n config: { botToken },\n status: AXP_INTEGRATION_CONNECTION_STATUS.Connected,\n isRevoked: false,\n isDisabled: false,\n });\n\n this.toastService.success(await this.translationService.translateAsync(`${I18N}.messages.success`));\n\n return { success: true, kind: 'object',\n data: {\n outcome: 'connected',\n connection: toSafeIntegrationConnectionDto(connection),\n },\n };\n } catch (error: unknown) {\n const { displayText } = await resolveCommunicationTelegramCommandError(\n this.translationService,\n error,\n CommunicationTelegramCommandI18n.connect.failed,\n );\n return { success: false, message: { text: displayText } };\n }\n }\n\n private async connectUserLink(\n input: ConnectTelegramCommandInput,\n ): AXPCommandExecuteResultPromise<ConnectCommandResult> {\n try {\n const providerId = input.providerId ?? RootConfig.integration.providerId;\n const connectionScope = AXP_INTEGRATION_CONNECTION_SCOPE.User;\n const existing = await this.connectionManager.findByUniqueKey({\n providerId,\n connectionScope,\n connectionKey: 'default',\n });\n\n const linked = await this.connectDialog.openAndLinkAccount();\n if (!linked || typeof linked !== 'object' || !('chatId' in linked)) {\n return { success: true, kind: 'object', data: { outcome: 'cancelled' } };\n }\n\n const chatId = trim(linked.chatId);\n if (!chatId) {\n return { success: true, kind: 'object', data: { outcome: 'cancelled' } };\n }\n\n const username = trim(linked.username ?? '');\n const displayName = defaultTo(trim(linked.displayName), username ? `@${username}` : 'Telegram');\n\n const connection = await this.connectionManager.upsertConnection({\n providerId,\n authMethodType: AXP_INTEGRATION_AUTH_METHOD_TYPE.ApiToken,\n connectionScope,\n connectionKey: 'default',\n displayName: existing?.displayName ?? displayName,\n externalAccountId: chatId,\n externalAccountName: username ? `@${username}` : chatId,\n config: {\n chatId,\n username: username || null,\n },\n status: AXP_INTEGRATION_CONNECTION_STATUS.Connected,\n isRevoked: false,\n isDisabled: false,\n });\n\n this.toastService.success(\n await this.translationService.translateAsync(\n '@extensions-communication-telegram:integration.connect.messages.success',\n ),\n );\n\n return { success: true, kind: 'object',\n data: {\n outcome: 'connected',\n connection: toSafeIntegrationConnectionDto(connection),\n },\n };\n } catch (error: unknown) {\n const { displayText } = await resolveCommunicationTelegramCommandError(\n this.translationService,\n error,\n CommunicationTelegramCommandI18n.connect.failed,\n );\n return { success: false, message: { text: displayText } };\n }\n }\n\n private async openTenantConnectDialog(input: {\n i18nPrefix: string;\n isReconfigure: boolean;\n botToken: string;\n }): Promise<TelegramTenantConnectFormResult | null> {\n const result = await this.layoutBuilder\n .create()\n .dialog<TelegramTenantConnectFormResult | null>((dialog: IDialogBuilder<TelegramTenantConnectFormResult | null>) => {\n dialog\n .setTitle(\n input.isReconfigure\n ? `${input.i18nPrefix}.dialog.configure-title`\n : `${input.i18nPrefix}.dialog.title`,\n )\n .setSize('md')\n .setCloseButton(true)\n .setContext({ botToken: input.botToken })\n .content((flex: IFlexContainerBuilder) => {\n flex\n .setDirection('column')\n .setGap('12px')\n .customWidget('text-block-layout', {\n content: `${input.i18nPrefix}.dialog.instructions`,\n })\n .formField(`${input.i18nPrefix}.dialog.fields.bot-token`, (field) => {\n field.path('botToken');\n field.passwordBox({\n placeholder: `${input.i18nPrefix}.dialog.placeholders.bot-token`,\n revealToggle: true,\n validations: [{ rule: 'required' }],\n });\n });\n })\n .setActions((actions: IActionBuilder) => {\n actions.cancel('@general:actions.cancel.title').submit(`${input.i18nPrefix}.dialog.actions.save`);\n })\n .onAction(async (ref: AXPDialogRef) => {\n if (ref.action() === 'cancel') {\n return null;\n }\n const ctx = ref.context() as { botToken?: string };\n const botToken = trim(ctx.botToken ?? '');\n if (!botToken) {\n throw new Error(`${input.i18nPrefix}.messages.bot-token-required`);\n }\n return { botToken };\n });\n })\n .show();\n\n return resolveLayoutBuilderDialogResult<TelegramTenantConnectFormResult>(result);\n }\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;;;;AAcA;AAEA,MAAM,gBAAgB,GAAG,IAAI;AAC7B,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI;MAaxB,4CAA4C,CAAA;AADzD,IAAA,WAAA,GAAA;AAEmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,uBAAuB,CAAC;AAC/C,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AACjD,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,8BAA8B,CAAC;AAgGjE,IAAA;AA9FC,IAAA,MAAM,kBAAkB,GAAA;AACtB,QAAA,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC;AACvB,aAAA,MAAM;AACN,aAAA,MAAM,CAA4C,CAAC,MAAiE,KAAI;YACvH;iBACG,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B,YAAA,CAAC,CAAC;AACN,QAAA,CAAC;AACA,aAAA,IAAI,EAAE;AAET,QAAA,OAAO,gCAAgC,CAAkC,MAAM,CAAC;IAClF;8GArMW,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAtB,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,sBAAsB,cADT,MAAM,EAAA,CAAA,CAAA;;2FACnB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBADlC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
1
|
+
{"version":3,"file":"acorex-platform-extension-communication-telegram-client-connect-telegram.command-C2H_3TPw.mjs","sources":["../../../../libs/extensions/communication/telegram/client/src/lib/features/connect/communication-telegram-connect-dialog.service.ts","../../../../libs/extensions/communication/telegram/client/src/lib/features/connect/connect-telegram.command.ts"],"sourcesContent":["import { AXTranslationService } from '@acorex/core/translation';\nimport {\n AXPLayoutBuilderService,\n resolveLayoutBuilderDialogResult,\n type AXPDialogRef,\n type IActionBuilder,\n type IDialogBuilder,\n type IFlexContainerBuilder,\n} from '@acorex-platform/framework-client/layout/builder';\nimport { Injectable, inject } from '@angular/core';\nimport { AXPCommunicationTelegramClient } from '../../communication-telegram-client.port';\nimport { resolveCommunicationTelegramCommandError } from '../../commands/communication-telegram-command-error.util';\nimport { CommunicationTelegramCommandI18n } from '../../commands/communication-telegram-command.i18n';\n\n//#region ---- Telegram connect dialog ----\n\nconst POLL_INTERVAL_MS = 2000;\nconst POLL_TIMEOUT_MS = 2 * 60 * 1000;\n\nexport interface CommunicationTelegramConnectResult {\n chatId: string;\n username?: string;\n displayName?: string;\n}\n\ninterface TelegramConnectDialogContext {\n chatId: string;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class AXECommunicationTelegramConnectDialogService {\n private readonly layoutBuilder = inject(AXPLayoutBuilderService);\n private readonly translationService = inject(AXTranslationService);\n private readonly client = inject(AXPCommunicationTelegramClient);\n\n async openAndLinkAccount(): Promise<CommunicationTelegramConnectResult | null> {\n const result = await this.layoutBuilder\n .create()\n .dialog<CommunicationTelegramConnectResult | null>((dialog: IDialogBuilder<CommunicationTelegramConnectResult | null>) => {\n dialog\n .setTitle('@extensions-communication-telegram:integration.connect.dialog.title')\n .setSize('sm')\n .setCloseButton(true)\n .setContext({ chatId: '' } satisfies TelegramConnectDialogContext)\n .content((flex: IFlexContainerBuilder) => {\n flex\n .setDirection('column')\n .setGap('12px')\n .customWidget('text-block-layout', {\n content: '@extensions-communication-telegram:integration.connect.dialog.instructions',\n })\n .formField('@extensions-communication-telegram:integration.connect.dialog.fields.chat-id.title', (field) => {\n field.path('chatId');\n field.textBox({\n placeholder: '@extensions-communication-telegram:integration.connect.dialog.fields.chat-id.placeholder',\n });\n });\n })\n .setActions((actions: IActionBuilder) => {\n actions\n .cancel('@general:actions.cancel.title')\n .submit('@extensions-communication-telegram:integration.connect.dialog.actions.connect');\n })\n .onAction(async (ref: AXPDialogRef) => {\n if (ref.action() === 'cancel') {\n return null;\n }\n\n const context = ref.context() as TelegramConnectDialogContext;\n const manualChatId = String(context?.chatId ?? '').trim();\n if (manualChatId) {\n return { chatId: manualChatId };\n }\n\n let link;\n try {\n link = await this.client.startTelegramLink();\n } catch (error) {\n const { displayText } = await resolveCommunicationTelegramCommandError(\n this.translationService,\n error,\n CommunicationTelegramCommandI18n.connect.failed,\n );\n throw new Error(displayText);\n }\n\n window.open(link.deepLinkUrl, '_blank', 'noopener,noreferrer');\n\n const startedAt = Date.now();\n while (Date.now() - startedAt < POLL_TIMEOUT_MS) {\n try {\n const status = await this.client.getTelegramLinkStatus(link.linkToken);\n if (status.status === 'linked' && status.chatId) {\n return {\n chatId: status.chatId,\n username: status.username,\n displayName: status.displayName,\n };\n }\n if (status.status === 'expired') {\n throw new Error(\n await this.translationService.translateAsync(\n '@extensions-communication-telegram:integration.connect.messages.expired',\n ),\n );\n }\n } catch (error) {\n const { displayText } = await resolveCommunicationTelegramCommandError(\n this.translationService,\n error,\n CommunicationTelegramCommandI18n.connect.failed,\n );\n throw new Error(displayText);\n }\n\n await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));\n }\n\n throw new Error(\n await this.translationService.translateAsync(\n '@extensions-communication-telegram:integration.connect.messages.timeout',\n ),\n );\n });\n })\n .show();\n\n return resolveLayoutBuilderDialogResult<CommunicationTelegramConnectResult>(result);\n }\n}\n\n//#endregion\n","import { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport {\n AXP_INTEGRATION_AUTH_METHOD_TYPE,\n AXP_INTEGRATION_CONNECTION_SCOPE,\n AXP_INTEGRATION_CONNECTION_STATUS,\n type AXPRuntimeCommandResult,\n type AXPIntegrationConnectionScope,\n} from '@acorex-platform/framework-shared/core';\nimport type { AXPCommand, AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport {\n AXPLayoutBuilderService,\n resolveLayoutBuilderDialogResult,\n type AXPDialogRef,\n type IActionBuilder,\n type IDialogBuilder,\n type IFlexContainerBuilder,\n} from '@acorex-platform/framework-client/layout/builder';\nimport {\n AXMIntegrationConnectionManager,\n AXP_INTEGRATION_CREDENTIAL_MASK,\n hasConfiguredIntegrationCredentials,\n isMaskedIntegrationCredential,\n toSafeIntegrationConnectionDto,\n type ConnectCommandResult,\n} from '@acorex-platform/module-integration-management-client';\nimport { Injectable, inject } from '@angular/core';\nimport { defaultTo, trim } from 'lodash-es';\nimport { RootConfig } from '@acorex-platform/extension-communication-telegram-client/contracts';\nimport { resolveCommunicationTelegramCommandError } from '../../commands/communication-telegram-command-error.util';\nimport { CommunicationTelegramCommandI18n } from '../../commands/communication-telegram-command.i18n';\nimport { AXECommunicationTelegramConnectDialogService } from '../connect/communication-telegram-connect-dialog.service';\n\nexport interface ConnectTelegramCommandInput {\n providerId?: string;\n connectionScope?: AXPIntegrationConnectionScope;\n}\n\ninterface TelegramTenantConnectFormResult {\n botToken: string;\n}\n\n//#region ----- Connect Telegram (tenant bot or user link) -----\n\n@Injectable({ providedIn: 'root' })\nexport class ConnectTelegramCommand implements AXPCommand<ConnectTelegramCommandInput, ConnectCommandResult> {\n private readonly connectionManager = inject(AXMIntegrationConnectionManager);\n private readonly connectDialog = inject(AXECommunicationTelegramConnectDialogService);\n private readonly layoutBuilder = inject(AXPLayoutBuilderService);\n private readonly toastService = inject(AXToastService);\n private readonly translationService = inject(AXTranslationService);\n\n async execute(input: ConnectTelegramCommandInput = {}): AXPCommandExecuteResultPromise<ConnectCommandResult> {\n const connectionScope = input.connectionScope ?? AXP_INTEGRATION_CONNECTION_SCOPE.User;\n if (connectionScope === AXP_INTEGRATION_CONNECTION_SCOPE.Tenant) {\n return this.connectTenantBot(input);\n }\n return this.connectUserLink(input);\n }\n\n private async connectTenantBot(\n input: ConnectTelegramCommandInput,\n ): AXPCommandExecuteResultPromise<ConnectCommandResult> {\n try {\n const providerId = input.providerId ?? RootConfig.integration.providerId;\n const connectionScope = AXP_INTEGRATION_CONNECTION_SCOPE.Tenant;\n const I18N = `@${RootConfig.config.i18n}:integration.connect.tenant`;\n const existing = await this.connectionManager.findByUniqueKey({\n providerId,\n connectionScope,\n connectionKey: 'default',\n });\n const isReconfigure = hasConfiguredIntegrationCredentials(existing);\n\n const form = await this.openTenantConnectDialog({\n i18nPrefix: I18N,\n isReconfigure,\n botToken: isReconfigure ? AXP_INTEGRATION_CREDENTIAL_MASK : '',\n });\n\n if (!form) {\n return { success: true, kind: 'object', data: { outcome: 'cancelled' } };\n }\n\n let botToken = trim(form.botToken);\n if (isMaskedIntegrationCredential(botToken) && existing) {\n const config = (existing.config ?? {}) as { botToken?: string };\n botToken = trim(config.botToken ?? '');\n }\n if (!botToken) {\n return {\n success: false,\n message: { text: `${I18N}.messages.bot-token-required` },\n };\n }\n\n const connection = await this.connectionManager.upsertConnection({\n providerId,\n authMethodType: AXP_INTEGRATION_AUTH_METHOD_TYPE.ApiToken,\n connectionScope,\n connectionKey: 'default',\n displayName: existing?.displayName ?? 'Telegram',\n externalAccountName: AXP_INTEGRATION_CREDENTIAL_MASK,\n config: { botToken },\n status: AXP_INTEGRATION_CONNECTION_STATUS.Connected,\n isRevoked: false,\n isDisabled: false,\n });\n\n this.toastService.success(await this.translationService.translateAsync(`${I18N}.messages.success`));\n\n return { success: true, kind: 'object',\n data: {\n outcome: 'connected',\n connection: toSafeIntegrationConnectionDto(connection),\n },\n };\n } catch (error: unknown) {\n const { displayText } = await resolveCommunicationTelegramCommandError(\n this.translationService,\n error,\n CommunicationTelegramCommandI18n.connect.failed,\n );\n return { success: false, message: { text: displayText } };\n }\n }\n\n private async connectUserLink(\n input: ConnectTelegramCommandInput,\n ): AXPCommandExecuteResultPromise<ConnectCommandResult> {\n try {\n const providerId = input.providerId ?? RootConfig.integration.providerId;\n const connectionScope = AXP_INTEGRATION_CONNECTION_SCOPE.User;\n const existing = await this.connectionManager.findByUniqueKey({\n providerId,\n connectionScope,\n connectionKey: 'default',\n });\n\n const linked = await this.connectDialog.openAndLinkAccount();\n if (!linked || typeof linked !== 'object' || !('chatId' in linked)) {\n return { success: true, kind: 'object', data: { outcome: 'cancelled' } };\n }\n\n const chatId = trim(linked.chatId);\n if (!chatId) {\n return { success: true, kind: 'object', data: { outcome: 'cancelled' } };\n }\n\n const username = trim(linked.username ?? '');\n const displayName = defaultTo(trim(linked.displayName), username ? `@${username}` : 'Telegram');\n\n const connection = await this.connectionManager.upsertConnection({\n providerId,\n authMethodType: AXP_INTEGRATION_AUTH_METHOD_TYPE.ApiToken,\n connectionScope,\n connectionKey: 'default',\n displayName: existing?.displayName ?? displayName,\n externalAccountId: chatId,\n externalAccountName: username ? `@${username}` : chatId,\n config: {\n chatId,\n username: username || null,\n },\n status: AXP_INTEGRATION_CONNECTION_STATUS.Connected,\n isRevoked: false,\n isDisabled: false,\n });\n\n this.toastService.success(\n await this.translationService.translateAsync(\n '@extensions-communication-telegram:integration.connect.messages.success',\n ),\n );\n\n return { success: true, kind: 'object',\n data: {\n outcome: 'connected',\n connection: toSafeIntegrationConnectionDto(connection),\n },\n };\n } catch (error: unknown) {\n const { displayText } = await resolveCommunicationTelegramCommandError(\n this.translationService,\n error,\n CommunicationTelegramCommandI18n.connect.failed,\n );\n return { success: false, message: { text: displayText } };\n }\n }\n\n private async openTenantConnectDialog(input: {\n i18nPrefix: string;\n isReconfigure: boolean;\n botToken: string;\n }): Promise<TelegramTenantConnectFormResult | null> {\n const result = await this.layoutBuilder\n .create()\n .dialog<TelegramTenantConnectFormResult | null>((dialog: IDialogBuilder<TelegramTenantConnectFormResult | null>) => {\n dialog\n .setTitle(\n input.isReconfigure\n ? `${input.i18nPrefix}.dialog.configure-title`\n : `${input.i18nPrefix}.dialog.title`,\n )\n .setSize('md')\n .setCloseButton(true)\n .setContext({ botToken: input.botToken })\n .content((flex: IFlexContainerBuilder) => {\n flex\n .setDirection('column')\n .setGap('12px')\n .customWidget('text-block-layout', {\n content: `${input.i18nPrefix}.dialog.instructions`,\n })\n .formField(`${input.i18nPrefix}.dialog.fields.bot-token`, (field) => {\n field.path('botToken');\n field.passwordBox({\n placeholder: `${input.i18nPrefix}.dialog.placeholders.bot-token`,\n revealToggle: true,\n validations: [{ rule: 'required' }],\n });\n });\n })\n .setActions((actions: IActionBuilder) => {\n actions.cancel('@general:actions.cancel.title').submit(`${input.i18nPrefix}.dialog.actions.save`);\n })\n .onAction(async (ref: AXPDialogRef) => {\n if (ref.action() === 'cancel') {\n return null;\n }\n const ctx = ref.context() as { botToken?: string };\n const botToken = trim(ctx.botToken ?? '');\n if (!botToken) {\n throw new Error(`${input.i18nPrefix}.messages.bot-token-required`);\n }\n return { botToken };\n });\n })\n .show();\n\n return resolveLayoutBuilderDialogResult<TelegramTenantConnectFormResult>(result);\n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AM,CAAC,+BAA+B,CAAC,CAAC,MAAM,CAAC,CAAA,EAAG,KAAK,CAAC,UAAU,CAAA,oBAAA,CAAsB,CAAC;AACnG,YAAA,CAAC;AACA,iBAAA,QAAQ,CAAC,OAAO,GAAiB,KAAI;AACpC,gBAAA,IAAI,GAAG,CAAC,MAAM,EAAE,KAAK,QAAQ,EAAE;AAC7B,oBAAA,OAAO,IAAI;gBACb;AACA,gBAAA,MAAM,GAAG,GAAG,GAAG,CAAC,OAAO,EAA2B;gBAClD,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC;gBACzC,IAAI,CAAC,QAAQ,EAAE;oBACb,MAAM,IAAI,KAAK,CAAC,CAAA,EAAG,KAAK,CAAC,UAAU,CAAA,4BAAA,CAA8B,CAAC;gBACpE;gBACA,OAAO,EAAE,QAAQ,EAAE;AACrB,YAAA,CAAC,CAAC;AACN,QAAA,CAAC;AACA,aAAA,IAAI,EAAE;AAET,QAAA,OAAO,gCAAgC,CAAkC,MAAM,CAAC;IAClF;8GArMW,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAtB,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,sBAAsB,cADT,MAAM,EAAA,CAAA,CAAA;;2FACnB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBADlC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-extension-communication-telegram-client-contracts.mjs","sources":["../../../../libs/extensions/communication/telegram/contracts/src/root-config.ts","../../../../libs/extensions/communication/telegram/contracts/src/integration-domain.constants.ts","../../../../libs/extensions/communication/telegram/contracts/src/communication-telegram.errors.ts","../../../../libs/extensions/communication/telegram/contracts/src/communication-telegram.test.types.ts","../../../../libs/extensions/communication/telegram/contracts/src/acorex-platform-extension-communication-telegram-client-contracts.ts"],"sourcesContent":["export const RootConfig = {\n module: {\n name: 'CommunicationTelegramExtension',\n icon: 'fa-brands fa-telegram',\n },\n config: {\n i18n: 'extensions-communication-telegram',\n },\n integration: {\n channelKey: 'telegram',\n providerId: 'telegram',\n },\n} as const;\n\nexport const AXPCommunicationTelegramSettingKeys = {\n /** Tenant-scoped bot token for Telegram delivery (IntegrationConnection is preferred at runtime). */\n BotToken: 'CommunicationTelegramExtension:Setting:Tenant.BotToken',\n DebugRedirectChatId: 'CommunicationTelegramExtension:Setting:Debug.Redirect.ChatId',\n UserDeliveryChannelEnabled: 'CommunicationTelegramExtension:Setting:User.DeliveryChannel.Enabled',\n} as const;\n\n/** Keys seeded at platform scope on startup (never include secrets). */\nexport const AXP_COMMUNICATION_TELEGRAM_PLATFORM_SEED_DEFAULTS: Record<string, unknown> = {\n [AXPCommunicationTelegramSettingKeys.DebugRedirectChatId]: '',\n};\n\nexport const AXP_COMMUNICATION_TELEGRAM_SETTING_DEFAULTS: Record<string, unknown> = {\n ...AXP_COMMUNICATION_TELEGRAM_PLATFORM_SEED_DEFAULTS,\n [AXPCommunicationTelegramSettingKeys.UserDeliveryChannelEnabled]: true,\n};\n\nexport const AXECommunicationTelegramCommandKeys = {\n TestTelegram: 'CommunicationTelegramExtension:Communication:TestTelegram',\n ConnectionConnect: 'CommunicationTelegramExtension:Integration:Connect',\n LinkStart: 'CommunicationTelegramExtension:Link:Start',\n LinkStatus: 'CommunicationTelegramExtension:Link:Status',\n} as const;\n","/** Shared communication integration domain (Telegram, WhatsApp, …). */\nexport const AXE_COMMUNICATION_DOMAIN_ID = 'communication';\n","export const AXP_COMMUNICATION_TELEGRAM_ERROR_CODES = {\n CHAT_ID_REQUIRED: 'COMMUNICATION_TELEGRAM_CHAT_ID_REQUIRED',\n BOT_TOKEN_NOT_CONFIGURED: 'COMMUNICATION_TELEGRAM_BOT_TOKEN_NOT_CONFIGURED',\n TENANT_REQUIRED: 'COMMUNICATION_TELEGRAM_TENANT_REQUIRED',\n CHAT_NOT_FOUND: 'COMMUNICATION_TELEGRAM_CHAT_NOT_FOUND',\n BOT_UNAUTHORIZED: 'COMMUNICATION_TELEGRAM_BOT_UNAUTHORIZED',\n BOT_BLOCKED: 'COMMUNICATION_TELEGRAM_BOT_BLOCKED',\n BOT_CANNOT_INITIATE: 'COMMUNICATION_TELEGRAM_BOT_CANNOT_INITIATE',\n API_ERROR: 'COMMUNICATION_TELEGRAM_API_ERROR',\n} as const;\n\nexport type AXPCommunicationTelegramErrorCode =\n (typeof AXP_COMMUNICATION_TELEGRAM_ERROR_CODES)[keyof typeof AXP_COMMUNICATION_TELEGRAM_ERROR_CODES];\n\nexport interface AXPCommunicationTelegramApiErrorPayload {\n code: AXPCommunicationTelegramErrorCode;\n description?: string;\n}\n","//#region ---- Telegram test types ----\n\nexport interface CommunicationTelegramTestInput {\n chatId: string;\n}\n\nexport interface CommunicationTelegramTestResult {\n chatId: string;\n messageId?: number;\n}\n\n//#endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAAO,MAAM,UAAU,GAAG;AACxB,IAAA,MAAM,EAAE;AACN,QAAA,IAAI,EAAE,gCAAgC;AACtC,QAAA,IAAI,EAAE,uBAAuB;AAC9B,KAAA;AACD,IAAA,MAAM,EAAE;AACN,QAAA,IAAI,EAAE,mCAAmC;AAC1C,KAAA;AACD,IAAA,WAAW,EAAE;AACX,QAAA,UAAU,EAAE,UAAU;AACtB,QAAA,UAAU,EAAE,UAAU;AACvB,KAAA;;AAGI,MAAM,mCAAmC,GAAG;;AAEjD,IAAA,QAAQ,EAAE,wDAAwD;AAClE,IAAA,mBAAmB,EAAE,8DAA8D;AACnF,IAAA,0BAA0B,EAAE,qEAAqE;;AAGnG;AACO,MAAM,iDAAiD,GAA4B;AACxF,IAAA,CAAC,mCAAmC,CAAC,mBAAmB,GAAG,EAAE;;AAGxD,MAAM,2CAA2C,GAA4B;AAClF,IAAA,GAAG,iDAAiD;AACpD,IAAA,CAAC,mCAAmC,CAAC,0BAA0B,GAAG,IAAI;;AAGjE,MAAM,mCAAmC,GAAG;AACjD,IAAA,YAAY,EAAE,2DAA2D;AACzE,IAAA,iBAAiB,EAAE,oDAAoD;AACvE,IAAA,SAAS,EAAE,2CAA2C;AACtD,IAAA,UAAU,EAAE,4CAA4C;;;ACnC1D;AACO,MAAM,2BAA2B,GAAG;;ACDpC,MAAM,sCAAsC,GAAG;AACpD,IAAA,gBAAgB,EAAE,yCAAyC;AAC3D,IAAA,wBAAwB,EAAE,iDAAiD;AAC3E,IAAA,eAAe,EAAE,wCAAwC;AACzD,IAAA,cAAc,EAAE,uCAAuC;AACvD,IAAA,gBAAgB,EAAE,yCAAyC;AAC3D,IAAA,WAAW,EAAE,oCAAoC;AACjD,IAAA,mBAAmB,EAAE,4CAA4C;AACjE,IAAA,SAAS,EAAE,kCAAkC;;;ACR/C;AAWA;;ACXA;;AAEG
|
|
1
|
+
{"version":3,"file":"acorex-platform-extension-communication-telegram-client-contracts.mjs","sources":["../../../../libs/extensions/communication/telegram/contracts/src/root-config.ts","../../../../libs/extensions/communication/telegram/contracts/src/integration-domain.constants.ts","../../../../libs/extensions/communication/telegram/contracts/src/communication-telegram.errors.ts","../../../../libs/extensions/communication/telegram/contracts/src/communication-telegram.test.types.ts","../../../../libs/extensions/communication/telegram/contracts/src/acorex-platform-extension-communication-telegram-client-contracts.ts"],"sourcesContent":["export const RootConfig = {\n module: {\n name: 'CommunicationTelegramExtension',\n icon: 'fa-brands fa-telegram',\n },\n config: {\n i18n: 'extensions-communication-telegram',\n },\n integration: {\n channelKey: 'telegram',\n providerId: 'telegram',\n },\n} as const;\n\nexport const AXPCommunicationTelegramSettingKeys = {\n /** Tenant-scoped bot token for Telegram delivery (IntegrationConnection is preferred at runtime). */\n BotToken: 'CommunicationTelegramExtension:Setting:Tenant.BotToken',\n DebugRedirectChatId: 'CommunicationTelegramExtension:Setting:Debug.Redirect.ChatId',\n UserDeliveryChannelEnabled: 'CommunicationTelegramExtension:Setting:User.DeliveryChannel.Enabled',\n} as const;\n\n/** Keys seeded at platform scope on startup (never include secrets). */\nexport const AXP_COMMUNICATION_TELEGRAM_PLATFORM_SEED_DEFAULTS: Record<string, unknown> = {\n [AXPCommunicationTelegramSettingKeys.DebugRedirectChatId]: '',\n};\n\nexport const AXP_COMMUNICATION_TELEGRAM_SETTING_DEFAULTS: Record<string, unknown> = {\n ...AXP_COMMUNICATION_TELEGRAM_PLATFORM_SEED_DEFAULTS,\n [AXPCommunicationTelegramSettingKeys.UserDeliveryChannelEnabled]: true,\n};\n\nexport const AXECommunicationTelegramCommandKeys = {\n TestTelegram: 'CommunicationTelegramExtension:Communication:TestTelegram',\n ConnectionConnect: 'CommunicationTelegramExtension:Integration:Connect',\n LinkStart: 'CommunicationTelegramExtension:Link:Start',\n LinkStatus: 'CommunicationTelegramExtension:Link:Status',\n} as const;\n","/** Shared communication integration domain (Telegram, WhatsApp, …). */\nexport const AXE_COMMUNICATION_DOMAIN_ID = 'communication';\n","export const AXP_COMMUNICATION_TELEGRAM_ERROR_CODES = {\n CHAT_ID_REQUIRED: 'COMMUNICATION_TELEGRAM_CHAT_ID_REQUIRED',\n BOT_TOKEN_NOT_CONFIGURED: 'COMMUNICATION_TELEGRAM_BOT_TOKEN_NOT_CONFIGURED',\n TENANT_REQUIRED: 'COMMUNICATION_TELEGRAM_TENANT_REQUIRED',\n CHAT_NOT_FOUND: 'COMMUNICATION_TELEGRAM_CHAT_NOT_FOUND',\n BOT_UNAUTHORIZED: 'COMMUNICATION_TELEGRAM_BOT_UNAUTHORIZED',\n BOT_BLOCKED: 'COMMUNICATION_TELEGRAM_BOT_BLOCKED',\n BOT_CANNOT_INITIATE: 'COMMUNICATION_TELEGRAM_BOT_CANNOT_INITIATE',\n API_ERROR: 'COMMUNICATION_TELEGRAM_API_ERROR',\n} as const;\n\nexport type AXPCommunicationTelegramErrorCode =\n (typeof AXP_COMMUNICATION_TELEGRAM_ERROR_CODES)[keyof typeof AXP_COMMUNICATION_TELEGRAM_ERROR_CODES];\n\nexport interface AXPCommunicationTelegramApiErrorPayload {\n code: AXPCommunicationTelegramErrorCode;\n description?: string;\n}\n","//#region ---- Telegram test types ----\n\nexport interface CommunicationTelegramTestInput {\n chatId: string;\n}\n\nexport interface CommunicationTelegramTestResult {\n chatId: string;\n messageId?: number;\n}\n\n//#endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAAO,MAAM,UAAU,GAAG;AACxB,IAAA,MAAM,EAAE;AACN,QAAA,IAAI,EAAE,gCAAgC;AACtC,QAAA,IAAI,EAAE,uBAAuB;AAC9B,KAAA;AACD,IAAA,MAAM,EAAE;AACN,QAAA,IAAI,EAAE,mCAAmC;AAC1C,KAAA;AACD,IAAA,WAAW,EAAE;AACX,QAAA,UAAU,EAAE,UAAU;AACtB,QAAA,UAAU,EAAE,UAAU;AACvB,KAAA;;AAGI,MAAM,mCAAmC,GAAG;;AAEjD,IAAA,QAAQ,EAAE,wDAAwD;AAClE,IAAA,mBAAmB,EAAE,8DAA8D;AACnF,IAAA,0BAA0B,EAAE,qEAAqE;;AAGnG;AACO,MAAM,iDAAiD,GAA4B;AACxF,IAAA,CAAC,mCAAmC,CAAC,mBAAmB,GAAG,EAAE;;AAGxD,MAAM,2CAA2C,GAA4B;AAClF,IAAA,GAAG,iDAAiD;AACpD,IAAA,CAAC,mCAAmC,CAAC,0BAA0B,GAAG,IAAI;;AAGjE,MAAM,mCAAmC,GAAG;AACjD,IAAA,YAAY,EAAE,2DAA2D;AACzE,IAAA,iBAAiB,EAAE,oDAAoD;AACvE,IAAA,SAAS,EAAE,2CAA2C;AACtD,IAAA,UAAU,EAAE,4CAA4C;;;ACnC1D;AACO,MAAM,2BAA2B,GAAG;;ACDpC,MAAM,sCAAsC,GAAG;AACpD,IAAA,gBAAgB,EAAE,yCAAyC;AAC3D,IAAA,wBAAwB,EAAE,iDAAiD;AAC3E,IAAA,eAAe,EAAE,wCAAwC;AACzD,IAAA,cAAc,EAAE,uCAAuC;AACvD,IAAA,gBAAgB,EAAE,yCAAyC;AAC3D,IAAA,WAAW,EAAE,oCAAoC;AACjD,IAAA,mBAAmB,EAAE,4CAA4C;AACjE,IAAA,SAAS,EAAE,kCAAkC;;;ACR/C;AAWA;;ACXA;;AAEG;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-extension-communication-telegram-client.mjs","sources":["../../../../libs/extensions/communication/telegram/client/src/lib/integration/communication.integration-domain.provider.ts","../../../../libs/extensions/communication/telegram/client/src/lib/brand/telegram-logo-key.ts","../../../../libs/extensions/communication/telegram/client/src/lib/integration/telegram.integration.provider.ts","../../../../libs/extensions/communication/telegram/client/src/lib/integration/telegram.integration-runtime.provider.ts","../../../../libs/extensions/communication/telegram/client/src/lib/brand/telegram-logo.provider.ts","../../../../libs/extensions/communication/telegram/client/src/lib/manifest.ts","../../../../libs/extensions/communication/telegram/client/src/lib/settings/communication-telegram-settings.provider.ts","../../../../libs/extensions/communication/telegram/client/src/lib/templates/communication-telegram-text-template-channel-definition.provider.ts","../../../../libs/extensions/communication/telegram/client/src/lib/communication-telegram-extension.module.ts","../../../../libs/extensions/communication/telegram/client/src/lib/communication-telegram-client.port.ts","../../../../libs/extensions/communication/telegram/client/src/lib/brand/telegram-mark.paths.ts","../../../../libs/extensions/communication/telegram/client/src/lib/brand/telegram-logo.component.ts","../../../../libs/extensions/communication/telegram/client/src/acorex-platform-extension-communication-telegram-client.ts"],"sourcesContent":["import { AXP_INTEGRATION_CATEGORY } from '@acorex-platform/framework-shared/core';\nimport {\n type AXPIntegrationDomainProvider,\n AXPIntegrationDomainProviderContext,\n} from '@acorex-platform/framework-client/common';\nimport { Injectable } from '@angular/core';\nimport {\n AXE_COMMUNICATION_DOMAIN_ID,\n RootConfig,\n} from '@acorex-platform/extension-communication-telegram-client/contracts';\n\nconst I18N = `@${RootConfig.config.i18n}:integration.domain`;\n\n//#region ---- Communication integration domain ----\n\n@Injectable()\nexport class AXECommunicationIntegrationDomainProvider implements AXPIntegrationDomainProvider {\n async provide(context: AXPIntegrationDomainProviderContext): Promise<void> {\n context.register({\n id: AXE_COMMUNICATION_DOMAIN_ID,\n module: RootConfig.module.name,\n displayName: `${I18N}.title`,\n description: `${I18N}.description`,\n icon: 'fa-light fa-comments',\n category: AXP_INTEGRATION_CATEGORY.Messaging,\n capabilities: [],\n settingsGroup: AXE_COMMUNICATION_DOMAIN_ID,\n sortOrder: 20,\n });\n }\n}\n\n//#endregion\n","//#region ---- Telegram logo registry key ----\n\nexport const axpTelegramLogoKey = 'telegram' as const;\n\n//#endregion\n","import {\n AXP_INTEGRATION_AUTH_METHOD_TYPE,\n AXP_INTEGRATION_CAPABILITY,\n AXP_INTEGRATION_CONNECTION_SCOPE,\n} from '@acorex-platform/framework-shared/core';\nimport {\n AXPIntegrationProvider,\n AXPIntegrationProviderContext,\n} from '@acorex-platform/framework-client/common';\nimport { Injectable } from '@angular/core';\nimport {\n AXE_COMMUNICATION_DOMAIN_ID,\n AXECommunicationTelegramCommandKeys,\n RootConfig,\n} from '@acorex-platform/extension-communication-telegram-client/contracts';\nimport { axpTelegramLogoKey } from '../brand/telegram-logo-key';\n\n//#region ---- Telegram integration provider ----\n\n@Injectable()\nexport class AXECommunicationTelegramIntegrationProvider implements AXPIntegrationProvider {\n async provide(context: AXPIntegrationProviderContext): Promise<void> {\n const I18N = `@${RootConfig.config.i18n}:integration`;\n\n context.register({\n domainId: AXE_COMMUNICATION_DOMAIN_ID,\n id: RootConfig.integration.providerId,\n module: RootConfig.module.name,\n displayName: `${I18N}.display-name`,\n description: `${I18N}.description`,\n icon: RootConfig.module.icon,\n logoKey: axpTelegramLogoKey,\n capabilities: [AXP_INTEGRATION_CAPABILITY.Messaging],\n connectionScopes: [\n AXP_INTEGRATION_CONNECTION_SCOPE.Tenant,\n AXP_INTEGRATION_CONNECTION_SCOPE.User,\n ],\n allowMultipleConnections: false,\n defaultConnectionKey: 'default',\n connectCommandKey: AXECommunicationTelegramCommandKeys.ConnectionConnect,\n connectDisabledBadgeKey: `@${RootConfig.config.i18n}:settings.user-integration.not-configured-badge`,\n connectDisabledMessageKey: `@${RootConfig.config.i18n}:settings.user-integration.not-configured-notice`,\n manageActions: [\n {\n titleKey: `@${RootConfig.config.i18n}:settings.telegram.test.action`,\n commandKey: AXECommunicationTelegramCommandKeys.TestTelegram,\n icon: 'fa-brands fa-telegram',\n color: 'primary',\n connectionScopes: [AXP_INTEGRATION_CONNECTION_SCOPE.Tenant],\n },\n ],\n authMethods: [\n {\n type: AXP_INTEGRATION_AUTH_METHOD_TYPE.ApiToken,\n label: `${I18N}.auth.link.label`,\n instructions: `${I18N}.auth.link.instructions`,\n supportsValidation: true,\n fields: [],\n },\n ],\n });\n }\n}\n\n//#endregion\n","import {\n AXP_INTEGRATION_CONNECTION_SCOPE,\n AXP_INTEGRATION_CONNECTION_STATUS,\n type AXPIntegrationConnectAvailabilityContext,\n type AXPIntegrationProviderRuntimeHooks,\n type AXPIntegrationRuntimeContext,\n type AXPIntegrationValidationResult,\n} from '@acorex-platform/framework-shared/core';\nimport { type AXPIntegrationRuntimeProvider } from '@acorex-platform/framework-client/common';\nimport {\n AXMIntegrationConnectionManager,\n hasConfiguredIntegrationCredentials,\n} from '@acorex-platform/module-integration-management-client';\nimport { Injectable, inject } from '@angular/core';\nimport {\n RootConfig,\n type CommunicationTelegramTenantConnectionConfig,\n type CommunicationTelegramUserLinkConfig,\n} from '@acorex-platform/extension-communication-telegram-client/contracts';\n\n//#region ---- Telegram integration runtime ----\n\n@Injectable()\nexport class AXECommunicationTelegramIntegrationRuntimeProvider implements AXPIntegrationRuntimeProvider {\n readonly providerId = RootConfig.integration.providerId;\n\n private readonly connectionManager = inject(AXMIntegrationConnectionManager);\n\n async getHooks(): Promise<AXPIntegrationProviderRuntimeHooks> {\n return {\n getConnectAvailability: (ctx) => this.isConnectAvailable(ctx),\n validateConnection: (ctx) => this.validateConnection(ctx),\n };\n }\n\n private async isConnectAvailable(\n ctx?: AXPIntegrationConnectAvailabilityContext,\n ): Promise<boolean> {\n // Tenant bot connect is always available; user link requires a tenant connection.\n if (ctx?.connectionScope !== AXP_INTEGRATION_CONNECTION_SCOPE.User) {\n return true;\n }\n\n const tenantConnection = await this.connectionManager.findByUniqueKey({\n providerId: RootConfig.integration.providerId,\n connectionScope: AXP_INTEGRATION_CONNECTION_SCOPE.Tenant,\n connectionKey: 'default',\n });\n\n return hasConfiguredIntegrationCredentials(tenantConnection);\n }\n\n private async validateConnection(\n ctx: AXPIntegrationRuntimeContext,\n ): Promise<AXPIntegrationValidationResult> {\n if (ctx.connectionScope === AXP_INTEGRATION_CONNECTION_SCOPE.Tenant) {\n const config = (ctx.config ?? {}) as CommunicationTelegramTenantConnectionConfig;\n const botToken = String(config.botToken ?? '').trim();\n if (!botToken) {\n return {\n valid: false,\n status: AXP_INTEGRATION_CONNECTION_STATUS.Invalid,\n errorMessage: 'Telegram bot token is missing from the connection.',\n };\n }\n return {\n valid: true,\n status: AXP_INTEGRATION_CONNECTION_STATUS.Connected,\n externalAccountName: 'Telegram Bot',\n };\n }\n\n const config = (ctx.config ?? {}) as unknown as CommunicationTelegramUserLinkConfig;\n const chatId = String(config.chatId ?? '').trim();\n\n if (!chatId) {\n return {\n valid: false,\n status: AXP_INTEGRATION_CONNECTION_STATUS.Invalid,\n errorMessage: 'Telegram chat ID is missing from the connection.',\n };\n }\n\n const username = String(config.username ?? '').trim();\n return {\n valid: true,\n status: AXP_INTEGRATION_CONNECTION_STATUS.Connected,\n externalAccountId: chatId,\n externalAccountName: username ? `@${username}` : chatId,\n };\n }\n}\n\n//#endregion\n","import {\n AXP_LOGO_PROVIDER,\n type AXPLogoProvider,\n type AXPLogoRequest,\n type AXPLogoView,\n} from '@acorex-platform/framework-client/core';\nimport { axpTelegramLogoKey } from './telegram-logo-key';\n\nconst telegramLogoProvider: AXPLogoProvider = {\n key: axpTelegramLogoKey,\n resolve: async (request: AXPLogoRequest): Promise<AXPLogoView> => ({\n kind: 'component',\n load: () =>\n import('./telegram-logo.component').then((module) => module.AXECommunicationTelegramLogoComponent),\n inputs: {\n appearance: request.appearance,\n size: request.size,\n },\n }),\n};\n\nexport const AXE_TELEGRAM_LOGO_PROVIDER = {\n provide: AXP_LOGO_PROVIDER,\n useValue: telegramLogoProvider,\n multi: true,\n} as const;\n","import { AXPModuleManifest } from '@acorex-platform/framework-client/core';\nimport { RootConfig } from '@acorex-platform/extension-communication-telegram-client/contracts';\n\nexport const CommunicationTelegramExtensionManifest: AXPModuleManifest = {\n name: RootConfig.module.name,\n version: '1.0.0',\n title: `@${RootConfig.config.i18n}:integration.display-name`,\n icon: RootConfig.module.icon,\n i18n: RootConfig.config.i18n,\n type: 'integration',\n domain: 'communication',\n dependencies: [],\n};\n","import { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport {\n AXPSettingDefinitionProvider,\n AXPSettingDefinitionProviderContext,\n} from '@acorex-platform/framework-client/common';\nimport { AXPWidgetsList } from '@acorex-platform/framework-shared/core';\nimport { Injectable, inject } from '@angular/core';\nimport {\n AXPCommunicationTelegramSettingKeys,\n AXP_COMMUNICATION_TELEGRAM_SETTING_DEFAULTS,\n RootConfig,\n} from '@acorex-platform/extension-communication-telegram-client/contracts';\nimport {\n AXP_PLATFORM_DEV_TOOLS_COMMUNICATION_DEBUG_REDIRECT_SECTION,\n AXP_PLATFORM_DEV_TOOLS_SETTINGS_GROUP,\n} from '@acorex-platform/module-platform-dev-tools-client/contracts';\nimport { resolveCommunicationDeliveryChannelsSettingsSection } from '@acorex-platform/module-communication-management-client';\n\nconst INTEGRATIONS_SETTINGS_GROUP = 'integrations';\nconst USER_INTEGRATION_I18N = `@${RootConfig.config.i18n}:settings.user-integration`;\nconst DELIVERY_CHANNEL_I18N = `@${RootConfig.config.i18n}:settings.delivery-channel`;\nconst DEV_TOOLS_I18N = '@platform-dev-tools:settings.communication-debug-redirect';\nconst DELIVERY_CHANNEL_VISIBILITY = `{{ integration.isUserConnected('${RootConfig.integration.providerId}') }}`;\n\n//#region ---- Telegram settings provider ----\n\n@Injectable()\nexport class AXECommunicationTelegramSettingsProvider implements AXPSettingDefinitionProvider {\n private readonly sessionService = inject(AXPSessionService);\n\n async provide(context: AXPSettingDefinitionProviderContext): Promise<void> {\n // User-facing Telegram settings only when the edition entitles this extension.\n if (this.sessionService.isModuleEnabled(RootConfig.module.name)) {\n this.registerDeliveryChannelPreference(context);\n this.registerUserIntegrationSettings(context);\n }\n this.registerDevToolsRedirectSettings(context);\n }\n\n /** User-scope receive toggle — only when Telegram integration is wired in this app. */\n private registerDeliveryChannelPreference(context: AXPSettingDefinitionProviderContext): void {\n if (!context.hasGroup(INTEGRATIONS_SETTINGS_GROUP)) {\n return;\n }\n\n const section = resolveCommunicationDeliveryChannelsSettingsSection(context);\n if (!section) {\n return;\n }\n\n section\n .addSetting({\n key: AXPCommunicationTelegramSettingKeys.UserDeliveryChannelEnabled,\n title: `${DELIVERY_CHANNEL_I18N}.title`,\n scope: 'U',\n overridableAt: [],\n isInherited: true,\n defaultValue:\n AXP_COMMUNICATION_TELEGRAM_SETTING_DEFAULTS[\n AXPCommunicationTelegramSettingKeys.UserDeliveryChannelEnabled\n ],\n widget: {\n type: AXPWidgetsList.Editors.ToggleSwitch,\n options: { visibility: DELIVERY_CHANNEL_VISIBILITY },\n },\n description: `${DELIVERY_CHANNEL_I18N}.description`,\n })\n .endSection();\n }\n\n private registerDevToolsRedirectSettings(context: AXPSettingDefinitionProviderContext): void {\n const section = resolveCommunicationDebugRedirectSection(context);\n if (!section) {\n return;\n }\n\n section\n .addSetting({\n key: AXPCommunicationTelegramSettingKeys.DebugRedirectChatId,\n title: `${DEV_TOOLS_I18N}.telegram-chat-id.title`,\n scope: 'P',\n overridableAt: [],\n isInherited: false,\n defaultValue: '',\n widget: {\n type: AXPWidgetsList.Editors.TextBox,\n },\n description: `${DEV_TOOLS_I18N}.telegram-chat-id.description`,\n })\n .endSection();\n }\n\n private registerUserIntegrationSettings(context: AXPSettingDefinitionProviderContext): void {\n if (!context.hasGroup(INTEGRATIONS_SETTINGS_GROUP)) {\n return;\n }\n\n const integrations = context.group(INTEGRATIONS_SETTINGS_GROUP);\n if (!integrations) {\n return;\n }\n\n integrations\n .addSection('telegram', `${USER_INTEGRATION_I18N}.section-title`, `${USER_INTEGRATION_I18N}.section-description`)\n .addSetting({\n key: 'Telegram:Setting:ConnectionPanel',\n title: `${USER_INTEGRATION_I18N}.connection-title`,\n scope: 'U',\n overridableAt: [],\n isInherited: false,\n widget: {\n type: AXPWidgetsList.Advanced.IntegrationConnectionsPanel,\n layout: { stacked: true },\n options: {\n providerId: RootConfig.integration.providerId,\n connectionScope: 'user',\n },\n },\n description: `${USER_INTEGRATION_I18N}.connection-description`,\n })\n .endSection();\n }\n}\n\nfunction resolveCommunicationDebugRedirectSection(context: AXPSettingDefinitionProviderContext) {\n const devTools = context.group(AXP_PLATFORM_DEV_TOOLS_SETTINGS_GROUP);\n if (!devTools) {\n return null;\n }\n\n const hasSection = context\n .getGroup(AXP_PLATFORM_DEV_TOOLS_SETTINGS_GROUP)\n ?.sections.some((section) => section.name === AXP_PLATFORM_DEV_TOOLS_COMMUNICATION_DEBUG_REDIRECT_SECTION);\n\n if (hasSection) {\n return devTools.section(AXP_PLATFORM_DEV_TOOLS_COMMUNICATION_DEBUG_REDIRECT_SECTION);\n }\n\n return devTools.addSection(\n AXP_PLATFORM_DEV_TOOLS_COMMUNICATION_DEBUG_REDIRECT_SECTION,\n `${DEV_TOOLS_I18N}.title`,\n `${DEV_TOOLS_I18N}.description`,\n );\n}\n\n//#endregion\n","import { Injectable } from '@angular/core';\nimport { RootConfig } from '@acorex-platform/extension-communication-telegram-client/contracts';\nimport { AXP_TEXT_TEMPLATE_CHANNEL_DEFINITION_PROVIDER } from '@acorex-platform/module-content-management-client';\nimport type {\n AXMTextTemplateChannelDefinition,\n AXMTextTemplateChannelDefinitionProvider,\n} from '@acorex-platform/module-content-management-client/contracts';\n\nconst TEMPLATE_I18N = `@${RootConfig.config.i18n}:templates.channels`;\n\n//#region ---- Telegram text template channel ----\n\n@Injectable()\nexport class AXECommunicationTelegramTextTemplateChannelDefinitionProvider\n implements AXMTextTemplateChannelDefinitionProvider\n{\n getChannels(): AXMTextTemplateChannelDefinition[] {\n return [\n {\n name: 'telegram',\n communicationChannelKey: 'telegram',\n title: `${TEMPLATE_I18N}.telegram`,\n type: 'plain',\n hasSubject: true,\n notConfiguredMessageKey: `${TEMPLATE_I18N}.not-configured.telegram`,\n configureSettings: {\n group: 'integrations',\n section: 'communication',\n scope: 'T',\n },\n },\n ];\n }\n}\n\n//#endregion\n\nexport const communicationTelegramTextTemplateChannelProvider = {\n provide: AXP_TEXT_TEMPLATE_CHANNEL_DEFINITION_PROVIDER,\n useClass: AXECommunicationTelegramTextTemplateChannelDefinitionProvider,\n multi: true,\n};\n","import { AXMIntegrationManagementModule } from '@acorex-platform/module-integration-management-client';\nimport {\n AXP_INTEGRATION_DOMAIN_PROVIDER,\n AXP_INTEGRATION_PROVIDER,\n AXP_INTEGRATION_RUNTIME_PROVIDER,\n AXP_SETTING_DEFINITION_PROVIDER,\n} from '@acorex-platform/framework-client/common';\nimport { AXP_MODULE_MANIFEST_PROVIDER } from '@acorex-platform/framework-client/core';\nimport { provideCommandSetups } from '@acorex-platform/framework-client/runtime';\nimport { NgModule } from '@angular/core';\nimport { AXECommunicationTelegramCommandKeys } from '@acorex-platform/extension-communication-telegram-client/contracts';\nimport { AXECommunicationIntegrationDomainProvider } from './integration/communication.integration-domain.provider';\nimport { AXECommunicationTelegramIntegrationProvider } from './integration/telegram.integration.provider';\nimport { AXECommunicationTelegramIntegrationRuntimeProvider } from './integration/telegram.integration-runtime.provider';\nimport { AXE_TELEGRAM_LOGO_PROVIDER } from './brand/telegram-logo.provider';\nimport { CommunicationTelegramExtensionManifest } from './manifest';\nimport { AXECommunicationTelegramSettingsProvider } from './settings/communication-telegram-settings.provider';\nimport { communicationTelegramTextTemplateChannelProvider } from './templates/communication-telegram-text-template-channel-definition.provider';\n\n//#region ---- Telegram extension client module ----\n\n@NgModule({\n imports: [AXMIntegrationManagementModule],\n providers: [\n { provide: AXP_MODULE_MANIFEST_PROVIDER, useValue: CommunicationTelegramExtensionManifest, multi: true },\n AXE_TELEGRAM_LOGO_PROVIDER,\n provideCommandSetups([\n {\n key: AXECommunicationTelegramCommandKeys.TestTelegram,\n command: () => import('./commands/communication-test-telegram.command').then((m) => m.CommunicationTestTelegramCommand),\n },\n {\n key: AXECommunicationTelegramCommandKeys.ConnectionConnect,\n command: () => import('./features/connect/connect-telegram.command').then((m) => m.ConnectTelegramCommand),\n },\n ]),\n {\n provide: AXP_SETTING_DEFINITION_PROVIDER,\n useClass: AXECommunicationTelegramSettingsProvider,\n multi: true,\n },\n {\n provide: AXP_INTEGRATION_DOMAIN_PROVIDER,\n useClass: AXECommunicationIntegrationDomainProvider,\n multi: true,\n },\n {\n provide: AXP_INTEGRATION_PROVIDER,\n useClass: AXECommunicationTelegramIntegrationProvider,\n multi: true,\n },\n {\n provide: AXP_INTEGRATION_RUNTIME_PROVIDER,\n useClass: AXECommunicationTelegramIntegrationRuntimeProvider,\n multi: true,\n },\n communicationTelegramTextTemplateChannelProvider,\n ],\n})\nexport class AXECommunicationTelegramExtensionModule {}\n\n//#endregion\n","import type {\n CommunicationTelegramLinkStartResult,\n CommunicationTelegramLinkStatusResult,\n CommunicationTelegramTestInput,\n CommunicationTelegramTestResult,\n} from '@acorex-platform/extension-communication-telegram-client/contracts';\n\nexport abstract class AXPCommunicationTelegramClient {\n abstract testTelegram(input: CommunicationTelegramTestInput): Promise<CommunicationTelegramTestResult>;\n abstract startTelegramLink(): Promise<CommunicationTelegramLinkStartResult>;\n abstract getTelegramLinkStatus(linkToken: string): Promise<CommunicationTelegramLinkStatusResult>;\n}\n","//#region ---- Telegram mark vector paths ----\n\nexport const AXE_TELEGRAM_MARK_BLUE = '#26A5E4';\n\n/** Circle + paper plane (Telegram brand mark). */\nexport const AXE_TELEGRAM_MARK_PATH =\n 'M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z';\n\n//#endregion\n","import type { AXPLogoAppearance } from '@acorex-platform/framework-client/core';\nimport { Component, computed, input, ChangeDetectionStrategy } from '@angular/core';\nimport { AXE_TELEGRAM_MARK_BLUE, AXE_TELEGRAM_MARK_PATH } from './telegram-mark.paths';\n\n//#region ---- Telegram brand logo (owned by Telegram extension) ----\n\n@Component({\n selector: 'axe-telegram-logo',\n host: { class: 'inline-flex items-center justify-center' },\n changeDetection: ChangeDetectionStrategy.Eager,\n template: `\n @switch (resolvedAppearance()) {\n @case ('monochrome') {\n <svg [attr.width]=\"size()\" [attr.height]=\"size()\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path fill=\"currentColor\" [attr.d]=\"markPath\" />\n </svg>\n }\n @default {\n <svg [attr.width]=\"size()\" [attr.height]=\"size()\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path [attr.fill]=\"markBlue\" [attr.d]=\"markPath\" />\n </svg>\n }\n }\n `,\n})\nexport class AXECommunicationTelegramLogoComponent {\n appearance = input<AXPLogoAppearance>('colored');\n size = input(20);\n\n protected readonly markPath = AXE_TELEGRAM_MARK_PATH;\n protected readonly markBlue = AXE_TELEGRAM_MARK_BLUE;\n\n protected readonly resolvedAppearance = computed(() => {\n const value = this.appearance();\n return value === 'monochrome' ? 'monochrome' : 'colored';\n });\n}\n\n//#endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAWA,MAAM,IAAI,GAAG,CAAA,CAAA,EAAI,UAAU,CAAC,MAAM,CAAC,IAAI,CAAA,mBAAA,CAAqB;AAE5D;MAGa,yCAAyC,CAAA;IACpD,MAAM,OAAO,CAAC,OAA4C,EAAA;QACxD,OAAO,CAAC,QAAQ,CAAC;AACf,YAAA,EAAE,EAAE,2BAA2B;AAC/B,YAAA,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI;YAC9B,WAAW,EAAE,CAAA,EAAG,IAAI,CAAA,MAAA,CAAQ;YAC5B,WAAW,EAAE,CAAA,EAAG,IAAI,CAAA,YAAA,CAAc;AAClC,YAAA,IAAI,EAAE,sBAAsB;YAC5B,QAAQ,EAAE,wBAAwB,CAAC,SAAS;AAC5C,YAAA,YAAY,EAAE,EAAE;AAChB,YAAA,aAAa,EAAE,2BAA2B;AAC1C,YAAA,SAAS,EAAE,EAAE;AACd,SAAA,CAAC;IACJ;8GAbW,yCAAyC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAAzC,yCAAyC,EAAA,CAAA,CAAA;;2FAAzC,yCAAyC,EAAA,UAAA,EAAA,CAAA;kBADrD;;;ACfD;AAEO,MAAM,kBAAkB,GAAG;AAElC;;ACaA;MAGa,2CAA2C,CAAA;IACtD,MAAM,OAAO,CAAC,OAAsC,EA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AA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,KAAA,EAAA,CAAA,CAAA;;2FAEU,qCAAqC,EAAA,UAAA,EAAA,CAAA;kBAnBjD,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,mBAAmB;AAC7B,oBAAA,IAAI,EAAE,EAAE,KAAK,EAAE,yCAAyC,EAAE;oBAC1D,eAAe,EAAE,uBAAuB,CAAC,KAAK;AAC9C,oBAAA,QAAQ,EAAE;;;;;;;;;;;;;AAaT,EAAA,CAAA;AACF,iBAAA;;;;;;;;ACxBD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"acorex-platform-extension-communication-telegram-client.mjs","sources":["../../../../libs/extensions/communication/telegram/client/src/lib/integration/communication.integration-domain.provider.ts","../../../../libs/extensions/communication/telegram/client/src/lib/brand/telegram-logo-key.ts","../../../../libs/extensions/communication/telegram/client/src/lib/integration/telegram.integration.provider.ts","../../../../libs/extensions/communication/telegram/client/src/lib/integration/telegram.integration-runtime.provider.ts","../../../../libs/extensions/communication/telegram/client/src/lib/brand/telegram-logo.provider.ts","../../../../libs/extensions/communication/telegram/client/src/lib/manifest.ts","../../../../libs/extensions/communication/telegram/client/src/lib/settings/communication-telegram-settings.provider.ts","../../../../libs/extensions/communication/telegram/client/src/lib/templates/communication-telegram-text-template-channel-definition.provider.ts","../../../../libs/extensions/communication/telegram/client/src/lib/communication-telegram-extension.module.ts","../../../../libs/extensions/communication/telegram/client/src/lib/communication-telegram-client.port.ts","../../../../libs/extensions/communication/telegram/client/src/lib/brand/telegram-mark.paths.ts","../../../../libs/extensions/communication/telegram/client/src/lib/brand/telegram-logo.component.ts","../../../../libs/extensions/communication/telegram/client/src/acorex-platform-extension-communication-telegram-client.ts"],"sourcesContent":["import { AXP_INTEGRATION_CATEGORY } from '@acorex-platform/framework-shared/core';\nimport {\n type AXPIntegrationDomainProvider,\n AXPIntegrationDomainProviderContext,\n} from '@acorex-platform/framework-client/common';\nimport { Injectable } from '@angular/core';\nimport {\n AXE_COMMUNICATION_DOMAIN_ID,\n RootConfig,\n} from '@acorex-platform/extension-communication-telegram-client/contracts';\n\nconst I18N = `@${RootConfig.config.i18n}:integration.domain`;\n\n//#region ---- Communication integration domain ----\n\n@Injectable()\nexport class AXECommunicationIntegrationDomainProvider implements AXPIntegrationDomainProvider {\n async provide(context: AXPIntegrationDomainProviderContext): Promise<void> {\n context.register({\n id: AXE_COMMUNICATION_DOMAIN_ID,\n module: RootConfig.module.name,\n displayName: `${I18N}.title`,\n description: `${I18N}.description`,\n icon: 'fa-light fa-comments',\n category: AXP_INTEGRATION_CATEGORY.Messaging,\n capabilities: [],\n settingsGroup: AXE_COMMUNICATION_DOMAIN_ID,\n sortOrder: 20,\n });\n }\n}\n\n//#endregion\n","//#region ---- Telegram logo registry key ----\n\nexport const axpTelegramLogoKey = 'telegram' as const;\n\n//#endregion\n","import {\n AXP_INTEGRATION_AUTH_METHOD_TYPE,\n AXP_INTEGRATION_CAPABILITY,\n AXP_INTEGRATION_CONNECTION_SCOPE,\n} from '@acorex-platform/framework-shared/core';\nimport {\n AXPIntegrationProvider,\n AXPIntegrationProviderContext,\n} from '@acorex-platform/framework-client/common';\nimport { Injectable } from '@angular/core';\nimport {\n AXE_COMMUNICATION_DOMAIN_ID,\n AXECommunicationTelegramCommandKeys,\n RootConfig,\n} from '@acorex-platform/extension-communication-telegram-client/contracts';\nimport { axpTelegramLogoKey } from '../brand/telegram-logo-key';\n\n//#region ---- Telegram integration provider ----\n\n@Injectable()\nexport class AXECommunicationTelegramIntegrationProvider implements AXPIntegrationProvider {\n async provide(context: AXPIntegrationProviderContext): Promise<void> {\n const I18N = `@${RootConfig.config.i18n}:integration`;\n\n context.register({\n domainId: AXE_COMMUNICATION_DOMAIN_ID,\n id: RootConfig.integration.providerId,\n module: RootConfig.module.name,\n displayName: `${I18N}.display-name`,\n description: `${I18N}.description`,\n icon: RootConfig.module.icon,\n logoKey: axpTelegramLogoKey,\n capabilities: [AXP_INTEGRATION_CAPABILITY.Messaging],\n connectionScopes: [\n AXP_INTEGRATION_CONNECTION_SCOPE.Tenant,\n AXP_INTEGRATION_CONNECTION_SCOPE.User,\n ],\n allowMultipleConnections: false,\n defaultConnectionKey: 'default',\n connectCommandKey: AXECommunicationTelegramCommandKeys.ConnectionConnect,\n connectDisabledBadgeKey: `@${RootConfig.config.i18n}:settings.user-integration.not-configured-badge`,\n connectDisabledMessageKey: `@${RootConfig.config.i18n}:settings.user-integration.not-configured-notice`,\n manageActions: [\n {\n titleKey: `@${RootConfig.config.i18n}:settings.telegram.test.action`,\n commandKey: AXECommunicationTelegramCommandKeys.TestTelegram,\n icon: 'fa-brands fa-telegram',\n color: 'primary',\n connectionScopes: [AXP_INTEGRATION_CONNECTION_SCOPE.Tenant],\n },\n ],\n authMethods: [\n {\n type: AXP_INTEGRATION_AUTH_METHOD_TYPE.ApiToken,\n label: `${I18N}.auth.link.label`,\n instructions: `${I18N}.auth.link.instructions`,\n supportsValidation: true,\n fields: [],\n },\n ],\n });\n }\n}\n\n//#endregion\n","import {\n AXP_INTEGRATION_CONNECTION_SCOPE,\n AXP_INTEGRATION_CONNECTION_STATUS,\n type AXPIntegrationConnectAvailabilityContext,\n type AXPIntegrationProviderRuntimeHooks,\n type AXPIntegrationRuntimeContext,\n type AXPIntegrationValidationResult,\n} from '@acorex-platform/framework-shared/core';\nimport { type AXPIntegrationRuntimeProvider } from '@acorex-platform/framework-client/common';\nimport {\n AXMIntegrationConnectionManager,\n hasConfiguredIntegrationCredentials,\n} from '@acorex-platform/module-integration-management-client';\nimport { Injectable, inject } from '@angular/core';\nimport {\n RootConfig,\n type CommunicationTelegramTenantConnectionConfig,\n type CommunicationTelegramUserLinkConfig,\n} from '@acorex-platform/extension-communication-telegram-client/contracts';\n\n//#region ---- Telegram integration runtime ----\n\n@Injectable()\nexport class AXECommunicationTelegramIntegrationRuntimeProvider implements AXPIntegrationRuntimeProvider {\n readonly providerId = RootConfig.integration.providerId;\n\n private readonly connectionManager = inject(AXMIntegrationConnectionManager);\n\n async getHooks(): Promise<AXPIntegrationProviderRuntimeHooks> {\n return {\n getConnectAvailability: (ctx) => this.isConnectAvailable(ctx),\n validateConnection: (ctx) => this.validateConnection(ctx),\n };\n }\n\n private async isConnectAvailable(\n ctx?: AXPIntegrationConnectAvailabilityContext,\n ): Promise<boolean> {\n // Tenant bot connect is always available; user link requires a tenant connection.\n if (ctx?.connectionScope !== AXP_INTEGRATION_CONNECTION_SCOPE.User) {\n return true;\n }\n\n const tenantConnection = await this.connectionManager.findByUniqueKey({\n providerId: RootConfig.integration.providerId,\n connectionScope: AXP_INTEGRATION_CONNECTION_SCOPE.Tenant,\n connectionKey: 'default',\n });\n\n return hasConfiguredIntegrationCredentials(tenantConnection);\n }\n\n private async validateConnection(\n ctx: AXPIntegrationRuntimeContext,\n ): Promise<AXPIntegrationValidationResult> {\n if (ctx.connectionScope === AXP_INTEGRATION_CONNECTION_SCOPE.Tenant) {\n const config = (ctx.config ?? {}) as CommunicationTelegramTenantConnectionConfig;\n const botToken = String(config.botToken ?? '').trim();\n if (!botToken) {\n return {\n valid: false,\n status: AXP_INTEGRATION_CONNECTION_STATUS.Invalid,\n errorMessage: 'Telegram bot token is missing from the connection.',\n };\n }\n return {\n valid: true,\n status: AXP_INTEGRATION_CONNECTION_STATUS.Connected,\n externalAccountName: 'Telegram Bot',\n };\n }\n\n const config = (ctx.config ?? {}) as unknown as CommunicationTelegramUserLinkConfig;\n const chatId = String(config.chatId ?? '').trim();\n\n if (!chatId) {\n return {\n valid: false,\n status: AXP_INTEGRATION_CONNECTION_STATUS.Invalid,\n errorMessage: 'Telegram chat ID is missing from the connection.',\n };\n }\n\n const username = String(config.username ?? '').trim();\n return {\n valid: true,\n status: AXP_INTEGRATION_CONNECTION_STATUS.Connected,\n externalAccountId: chatId,\n externalAccountName: username ? `@${username}` : chatId,\n };\n }\n}\n\n//#endregion\n","import {\n AXP_LOGO_PROVIDER,\n type AXPLogoProvider,\n type AXPLogoRequest,\n type AXPLogoView,\n} from '@acorex-platform/framework-client/core';\nimport { axpTelegramLogoKey } from './telegram-logo-key';\n\nconst telegramLogoProvider: AXPLogoProvider = {\n key: axpTelegramLogoKey,\n resolve: async (request: AXPLogoRequest): Promise<AXPLogoView> => ({\n kind: 'component',\n load: () =>\n import('./telegram-logo.component').then((module) => module.AXECommunicationTelegramLogoComponent),\n inputs: {\n appearance: request.appearance,\n size: request.size,\n },\n }),\n};\n\nexport const AXE_TELEGRAM_LOGO_PROVIDER = {\n provide: AXP_LOGO_PROVIDER,\n useValue: telegramLogoProvider,\n multi: true,\n} as const;\n","import { AXPModuleManifest } from '@acorex-platform/framework-client/core';\nimport { RootConfig } from '@acorex-platform/extension-communication-telegram-client/contracts';\n\nexport const CommunicationTelegramExtensionManifest: AXPModuleManifest = {\n name: RootConfig.module.name,\n version: '1.0.0',\n title: `@${RootConfig.config.i18n}:integration.display-name`,\n icon: RootConfig.module.icon,\n i18n: RootConfig.config.i18n,\n type: 'integration',\n domain: 'communication',\n dependencies: [],\n};\n","import { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport {\n AXPSettingDefinitionProvider,\n AXPSettingDefinitionProviderContext,\n} from '@acorex-platform/framework-client/common';\nimport { AXPWidgetsList } from '@acorex-platform/framework-shared/core';\nimport { Injectable, inject } from '@angular/core';\nimport {\n AXPCommunicationTelegramSettingKeys,\n AXP_COMMUNICATION_TELEGRAM_SETTING_DEFAULTS,\n RootConfig,\n} from '@acorex-platform/extension-communication-telegram-client/contracts';\nimport {\n AXP_PLATFORM_DEV_TOOLS_COMMUNICATION_DEBUG_REDIRECT_SECTION,\n AXP_PLATFORM_DEV_TOOLS_SETTINGS_GROUP,\n} from '@acorex-platform/module-platform-dev-tools-client/contracts';\nimport { resolveCommunicationDeliveryChannelsSettingsSection } from '@acorex-platform/module-communication-management-client';\n\nconst INTEGRATIONS_SETTINGS_GROUP = 'integrations';\nconst USER_INTEGRATION_I18N = `@${RootConfig.config.i18n}:settings.user-integration`;\nconst DELIVERY_CHANNEL_I18N = `@${RootConfig.config.i18n}:settings.delivery-channel`;\nconst DEV_TOOLS_I18N = '@platform-dev-tools:settings.communication-debug-redirect';\nconst DELIVERY_CHANNEL_VISIBILITY = `{{ integration.isUserConnected('${RootConfig.integration.providerId}') }}`;\n\n//#region ---- Telegram settings provider ----\n\n@Injectable()\nexport class AXECommunicationTelegramSettingsProvider implements AXPSettingDefinitionProvider {\n private readonly sessionService = inject(AXPSessionService);\n\n async provide(context: AXPSettingDefinitionProviderContext): Promise<void> {\n // User-facing Telegram settings only when the edition entitles this extension.\n if (this.sessionService.isModuleEnabled(RootConfig.module.name)) {\n this.registerDeliveryChannelPreference(context);\n this.registerUserIntegrationSettings(context);\n }\n this.registerDevToolsRedirectSettings(context);\n }\n\n /** User-scope receive toggle — only when Telegram integration is wired in this app. */\n private registerDeliveryChannelPreference(context: AXPSettingDefinitionProviderContext): void {\n if (!context.hasGroup(INTEGRATIONS_SETTINGS_GROUP)) {\n return;\n }\n\n const section = resolveCommunicationDeliveryChannelsSettingsSection(context);\n if (!section) {\n return;\n }\n\n section\n .addSetting({\n key: AXPCommunicationTelegramSettingKeys.UserDeliveryChannelEnabled,\n title: `${DELIVERY_CHANNEL_I18N}.title`,\n scope: 'U',\n overridableAt: [],\n isInherited: true,\n defaultValue:\n AXP_COMMUNICATION_TELEGRAM_SETTING_DEFAULTS[\n AXPCommunicationTelegramSettingKeys.UserDeliveryChannelEnabled\n ],\n widget: {\n type: AXPWidgetsList.Editors.ToggleSwitch,\n options: { visibility: DELIVERY_CHANNEL_VISIBILITY },\n },\n description: `${DELIVERY_CHANNEL_I18N}.description`,\n })\n .endSection();\n }\n\n private registerDevToolsRedirectSettings(context: AXPSettingDefinitionProviderContext): void {\n const section = resolveCommunicationDebugRedirectSection(context);\n if (!section) {\n return;\n }\n\n section\n .addSetting({\n key: AXPCommunicationTelegramSettingKeys.DebugRedirectChatId,\n title: `${DEV_TOOLS_I18N}.telegram-chat-id.title`,\n scope: 'P',\n overridableAt: [],\n isInherited: false,\n defaultValue: '',\n widget: {\n type: AXPWidgetsList.Editors.TextBox,\n },\n description: `${DEV_TOOLS_I18N}.telegram-chat-id.description`,\n })\n .endSection();\n }\n\n private registerUserIntegrationSettings(context: AXPSettingDefinitionProviderContext): void {\n if (!context.hasGroup(INTEGRATIONS_SETTINGS_GROUP)) {\n return;\n }\n\n const integrations = context.group(INTEGRATIONS_SETTINGS_GROUP);\n if (!integrations) {\n return;\n }\n\n integrations\n .addSection('telegram', `${USER_INTEGRATION_I18N}.section-title`, `${USER_INTEGRATION_I18N}.section-description`)\n .addSetting({\n key: 'Telegram:Setting:ConnectionPanel',\n title: `${USER_INTEGRATION_I18N}.connection-title`,\n scope: 'U',\n overridableAt: [],\n isInherited: false,\n widget: {\n type: AXPWidgetsList.Advanced.IntegrationConnectionsPanel,\n layout: { stacked: true },\n options: {\n providerId: RootConfig.integration.providerId,\n connectionScope: 'user',\n },\n },\n description: `${USER_INTEGRATION_I18N}.connection-description`,\n })\n .endSection();\n }\n}\n\nfunction resolveCommunicationDebugRedirectSection(context: AXPSettingDefinitionProviderContext) {\n const devTools = context.group(AXP_PLATFORM_DEV_TOOLS_SETTINGS_GROUP);\n if (!devTools) {\n return null;\n }\n\n const hasSection = context\n .getGroup(AXP_PLATFORM_DEV_TOOLS_SETTINGS_GROUP)\n ?.sections.some((section) => section.name === AXP_PLATFORM_DEV_TOOLS_COMMUNICATION_DEBUG_REDIRECT_SECTION);\n\n if (hasSection) {\n return devTools.section(AXP_PLATFORM_DEV_TOOLS_COMMUNICATION_DEBUG_REDIRECT_SECTION);\n }\n\n return devTools.addSection(\n AXP_PLATFORM_DEV_TOOLS_COMMUNICATION_DEBUG_REDIRECT_SECTION,\n `${DEV_TOOLS_I18N}.title`,\n `${DEV_TOOLS_I18N}.description`,\n );\n}\n\n//#endregion\n","import { Injectable } from '@angular/core';\nimport { RootConfig } from '@acorex-platform/extension-communication-telegram-client/contracts';\nimport { AXP_TEXT_TEMPLATE_CHANNEL_DEFINITION_PROVIDER } from '@acorex-platform/module-content-management-client';\nimport type {\n AXMTextTemplateChannelDefinition,\n AXMTextTemplateChannelDefinitionProvider,\n} from '@acorex-platform/module-content-management-client/contracts';\n\nconst TEMPLATE_I18N = `@${RootConfig.config.i18n}:templates.channels`;\n\n//#region ---- Telegram text template channel ----\n\n@Injectable()\nexport class AXECommunicationTelegramTextTemplateChannelDefinitionProvider\n implements AXMTextTemplateChannelDefinitionProvider\n{\n getChannels(): AXMTextTemplateChannelDefinition[] {\n return [\n {\n name: 'telegram',\n communicationChannelKey: 'telegram',\n title: `${TEMPLATE_I18N}.telegram`,\n type: 'plain',\n hasSubject: true,\n notConfiguredMessageKey: `${TEMPLATE_I18N}.not-configured.telegram`,\n configureSettings: {\n group: 'integrations',\n section: 'communication',\n scope: 'T',\n },\n },\n ];\n }\n}\n\n//#endregion\n\nexport const communicationTelegramTextTemplateChannelProvider = {\n provide: AXP_TEXT_TEMPLATE_CHANNEL_DEFINITION_PROVIDER,\n useClass: AXECommunicationTelegramTextTemplateChannelDefinitionProvider,\n multi: true,\n};\n","import { AXMIntegrationManagementModule } from '@acorex-platform/module-integration-management-client';\nimport {\n AXP_INTEGRATION_DOMAIN_PROVIDER,\n AXP_INTEGRATION_PROVIDER,\n AXP_INTEGRATION_RUNTIME_PROVIDER,\n AXP_SETTING_DEFINITION_PROVIDER,\n} from '@acorex-platform/framework-client/common';\nimport { AXP_MODULE_MANIFEST_PROVIDER } from '@acorex-platform/framework-client/core';\nimport { provideCommandSetups } from '@acorex-platform/framework-client/runtime';\nimport { NgModule } from '@angular/core';\nimport { AXECommunicationTelegramCommandKeys } from '@acorex-platform/extension-communication-telegram-client/contracts';\nimport { AXECommunicationIntegrationDomainProvider } from './integration/communication.integration-domain.provider';\nimport { AXECommunicationTelegramIntegrationProvider } from './integration/telegram.integration.provider';\nimport { AXECommunicationTelegramIntegrationRuntimeProvider } from './integration/telegram.integration-runtime.provider';\nimport { AXE_TELEGRAM_LOGO_PROVIDER } from './brand/telegram-logo.provider';\nimport { CommunicationTelegramExtensionManifest } from './manifest';\nimport { AXECommunicationTelegramSettingsProvider } from './settings/communication-telegram-settings.provider';\nimport { communicationTelegramTextTemplateChannelProvider } from './templates/communication-telegram-text-template-channel-definition.provider';\n\n//#region ---- Telegram extension client module ----\n\n@NgModule({\n imports: [AXMIntegrationManagementModule],\n providers: [\n { provide: AXP_MODULE_MANIFEST_PROVIDER, useValue: CommunicationTelegramExtensionManifest, multi: true },\n AXE_TELEGRAM_LOGO_PROVIDER,\n provideCommandSetups([\n {\n key: AXECommunicationTelegramCommandKeys.TestTelegram,\n command: () => import('./commands/communication-test-telegram.command').then((m) => m.CommunicationTestTelegramCommand),\n },\n {\n key: AXECommunicationTelegramCommandKeys.ConnectionConnect,\n command: () => import('./features/connect/connect-telegram.command').then((m) => m.ConnectTelegramCommand),\n },\n ]),\n {\n provide: AXP_SETTING_DEFINITION_PROVIDER,\n useClass: AXECommunicationTelegramSettingsProvider,\n multi: true,\n },\n {\n provide: AXP_INTEGRATION_DOMAIN_PROVIDER,\n useClass: AXECommunicationIntegrationDomainProvider,\n multi: true,\n },\n {\n provide: AXP_INTEGRATION_PROVIDER,\n useClass: AXECommunicationTelegramIntegrationProvider,\n multi: true,\n },\n {\n provide: AXP_INTEGRATION_RUNTIME_PROVIDER,\n useClass: AXECommunicationTelegramIntegrationRuntimeProvider,\n multi: true,\n },\n communicationTelegramTextTemplateChannelProvider,\n ],\n})\nexport class AXECommunicationTelegramExtensionModule {}\n\n//#endregion\n","import type {\n CommunicationTelegramLinkStartResult,\n CommunicationTelegramLinkStatusResult,\n CommunicationTelegramTestInput,\n CommunicationTelegramTestResult,\n} from '@acorex-platform/extension-communication-telegram-client/contracts';\n\nexport abstract class AXPCommunicationTelegramClient {\n abstract testTelegram(input: CommunicationTelegramTestInput): Promise<CommunicationTelegramTestResult>;\n abstract startTelegramLink(): Promise<CommunicationTelegramLinkStartResult>;\n abstract getTelegramLinkStatus(linkToken: string): Promise<CommunicationTelegramLinkStatusResult>;\n}\n","//#region ---- Telegram mark vector paths ----\n\nexport const AXE_TELEGRAM_MARK_BLUE = '#26A5E4';\n\n/** Circle + paper plane (Telegram brand mark). */\nexport const AXE_TELEGRAM_MARK_PATH =\n 'M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z';\n\n//#endregion\n","import type { AXPLogoAppearance } from '@acorex-platform/framework-client/core';\nimport { Component, computed, input, ChangeDetectionStrategy } from '@angular/core';\nimport { AXE_TELEGRAM_MARK_BLUE, AXE_TELEGRAM_MARK_PATH } from './telegram-mark.paths';\n\n//#region ---- Telegram brand logo (owned by Telegram extension) ----\n\n@Component({\n selector: 'axe-telegram-logo',\n host: { class: 'inline-flex items-center justify-center' },\n changeDetection: ChangeDetectionStrategy.Eager,\n template: `\n @switch (resolvedAppearance()) {\n @case ('monochrome') {\n <svg [attr.width]=\"size()\" [attr.height]=\"size()\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path fill=\"currentColor\" [attr.d]=\"markPath\" />\n </svg>\n }\n @default {\n <svg [attr.width]=\"size()\" [attr.height]=\"size()\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path [attr.fill]=\"markBlue\" [attr.d]=\"markPath\" />\n </svg>\n }\n }\n `,\n})\nexport class AXECommunicationTelegramLogoComponent {\n appearance = input<AXPLogoAppearance>('colored');\n size = input(20);\n\n protected readonly markPath = AXE_TELEGRAM_MARK_PATH;\n protected readonly markBlue = AXE_TELEGRAM_MARK_BLUE;\n\n protected readonly resolvedAppearance = computed(() => {\n const value = this.appearance();\n return value === 'monochrome' ? 'monochrome' : 'colored';\n });\n}\n\n//#endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAWA,MAAM,IAAI,GAAG,CAAA,CAAA,EAAI,UAAU,CAAC,MAAM,CAAC,IAAI,CAAA,mBAAA,CAAqB;AAE5D;MAGa,yCAAyC,CAAA;IACpD,MAAM,OAAO,CAAC,OAA4C,EAAA;QACxD,OAAO,CAAC,QAAQ,CAAC;AACf,YAAA,EAAE,EAAE,2BAA2B;AAC/B,YAAA,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI;YAC9B,WAAW,EAAE,CAAA,EAAG,IAAI,CAAA,MAAA,CAAQ;YAC5B,WAAW,EAAE,CAAA,EAAG,IAAI,CAAA,YAAA,CAAc;AAClC,YAAA,IAAI,EAAE,sBAAsB;YAC5B,QAAQ,EAAE,wBAAwB,CAAC,SAAS;AAC5C,YAAA,YAAY,EAAE,EAAE;AAChB,YAAA,aAAa,EAAE,2BAA2B;AAC1C,YAAA,SAAS,EAAE,EAAE;AACd,SAAA,CAAC;IACJ;8GAbW,yCAAyC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAAzC,yCAAyC,EAAA,CAAA,CAAA;;2FAAzC,yCAAyC,EAAA,UAAA,EAAA,CAAA;kBADrD;;;ACfD;AAEO,MAAM,kBAAkB,GAAG;AAElC;;ACaA;MAGa,2CAA2C,CAAA;IACtD,MAAM,O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