@acorex-platform/extension-communication-telegram-client 0.0.21
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 +56 -0
- package/fesm2022/acorex-platform-extension-communication-telegram-client-communication-telegram-command-error.util-BTRYC0rH.mjs.map +1 -0
- package/fesm2022/acorex-platform-extension-communication-telegram-client-communication-test-telegram.command-Cir1ijfl.mjs +137 -0
- package/fesm2022/acorex-platform-extension-communication-telegram-client-communication-test-telegram.command-Cir1ijfl.mjs.map +1 -0
- package/fesm2022/acorex-platform-extension-communication-telegram-client-connect-telegram.command-C2H_3TPw.mjs +276 -0
- package/fesm2022/acorex-platform-extension-communication-telegram-client-connect-telegram.command-C2H_3TPw.mjs.map +1 -0
- package/fesm2022/acorex-platform-extension-communication-telegram-client-contracts.mjs +57 -0
- package/fesm2022/acorex-platform-extension-communication-telegram-client-contracts.mjs.map +1 -0
- package/fesm2022/acorex-platform-extension-communication-telegram-client.mjs +482 -0
- package/fesm2022/acorex-platform-extension-communication-telegram-client.mjs.map +1 -0
- package/package.json +28 -0
- package/types/acorex-platform-extension-communication-telegram-client-contracts.d.ts +83 -0
- package/types/acorex-platform-extension-communication-telegram-client.d.ts +40 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { extractRequestErrorInfo } from '@acorex-platform/framework-client/common';
|
|
2
|
+
import { RootConfig, AXP_COMMUNICATION_TELEGRAM_ERROR_CODES } from '@acorex-platform/extension-communication-telegram-client/contracts';
|
|
3
|
+
|
|
4
|
+
const ROOT = `@${RootConfig.config.i18n}`;
|
|
5
|
+
const CommunicationTelegramCommandI18n = {
|
|
6
|
+
errors: {
|
|
7
|
+
chatIdRequired: `${ROOT}:settings.telegram.errors.chat-id-required`,
|
|
8
|
+
botTokenNotConfigured: `${ROOT}:settings.telegram.errors.bot-token-not-configured`,
|
|
9
|
+
tenantRequired: `${ROOT}:settings.telegram.errors.tenant-required`,
|
|
10
|
+
chatNotFound: `${ROOT}:settings.telegram.errors.chat-not-found`,
|
|
11
|
+
botUnauthorized: `${ROOT}:settings.telegram.errors.bot-unauthorized`,
|
|
12
|
+
botBlocked: `${ROOT}:settings.telegram.errors.bot-blocked`,
|
|
13
|
+
botCannotInitiate: `${ROOT}:settings.telegram.errors.bot-cannot-initiate`,
|
|
14
|
+
apiError: `${ROOT}:settings.telegram.errors.api-error`,
|
|
15
|
+
},
|
|
16
|
+
test: {
|
|
17
|
+
failed: `${ROOT}:settings.telegram.test.messages.failed`,
|
|
18
|
+
},
|
|
19
|
+
connect: {
|
|
20
|
+
failed: `${ROOT}:integration.connect.messages.failed`,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const ERROR_I18N_BY_CODE = {
|
|
25
|
+
[AXP_COMMUNICATION_TELEGRAM_ERROR_CODES.CHAT_ID_REQUIRED]: CommunicationTelegramCommandI18n.errors.chatIdRequired,
|
|
26
|
+
[AXP_COMMUNICATION_TELEGRAM_ERROR_CODES.BOT_TOKEN_NOT_CONFIGURED]: CommunicationTelegramCommandI18n.errors.botTokenNotConfigured,
|
|
27
|
+
[AXP_COMMUNICATION_TELEGRAM_ERROR_CODES.TENANT_REQUIRED]: CommunicationTelegramCommandI18n.errors.tenantRequired,
|
|
28
|
+
[AXP_COMMUNICATION_TELEGRAM_ERROR_CODES.CHAT_NOT_FOUND]: CommunicationTelegramCommandI18n.errors.chatNotFound,
|
|
29
|
+
[AXP_COMMUNICATION_TELEGRAM_ERROR_CODES.BOT_UNAUTHORIZED]: CommunicationTelegramCommandI18n.errors.botUnauthorized,
|
|
30
|
+
[AXP_COMMUNICATION_TELEGRAM_ERROR_CODES.BOT_BLOCKED]: CommunicationTelegramCommandI18n.errors.botBlocked,
|
|
31
|
+
[AXP_COMMUNICATION_TELEGRAM_ERROR_CODES.BOT_CANNOT_INITIATE]: CommunicationTelegramCommandI18n.errors.botCannotInitiate,
|
|
32
|
+
[AXP_COMMUNICATION_TELEGRAM_ERROR_CODES.API_ERROR]: CommunicationTelegramCommandI18n.errors.apiError,
|
|
33
|
+
};
|
|
34
|
+
async function resolveCommunicationTelegramCommandError(translationService, error, fallbackKey = CommunicationTelegramCommandI18n.test.failed) {
|
|
35
|
+
const httpInfo = extractRequestErrorInfo(error);
|
|
36
|
+
if (httpInfo?.code) {
|
|
37
|
+
const messageKey = ERROR_I18N_BY_CODE[httpInfo.code];
|
|
38
|
+
if (messageKey) {
|
|
39
|
+
const displayText = await translationService.translateAsync(messageKey, {
|
|
40
|
+
params: httpInfo.params,
|
|
41
|
+
});
|
|
42
|
+
return { messageKeyOrText: messageKey, displayText };
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (httpInfo?.message) {
|
|
46
|
+
return { messageKeyOrText: httpInfo.message, displayText: httpInfo.message };
|
|
47
|
+
}
|
|
48
|
+
if (error instanceof Error && error.message.trim()) {
|
|
49
|
+
return { messageKeyOrText: error.message, displayText: error.message };
|
|
50
|
+
}
|
|
51
|
+
const displayText = await translationService.translateAsync(fallbackKey);
|
|
52
|
+
return { messageKeyOrText: fallbackKey, displayText };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { CommunicationTelegramCommandI18n as C, resolveCommunicationTelegramCommandError as r };
|
|
56
|
+
//# sourceMappingURL=acorex-platform-extension-communication-telegram-client-communication-telegram-command-error.util-BTRYC0rH.mjs.map
|
|
@@ -0,0 +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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;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;;;;"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { AXToastService } from '@acorex/components/toast';
|
|
2
|
+
import { AXTranslationService } from '@acorex/core/translation';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { inject, Injectable } from '@angular/core';
|
|
5
|
+
import { r as resolveCommunicationTelegramCommandError, C as CommunicationTelegramCommandI18n } from './acorex-platform-extension-communication-telegram-client-communication-telegram-command-error.util-BTRYC0rH.mjs';
|
|
6
|
+
import { AXP_INTEGRATION_CONNECTION_STATUS } from '@acorex-platform/framework-shared/core';
|
|
7
|
+
import { AXPLayoutBuilderService, resolveLayoutBuilderDialogResult } from '@acorex-platform/framework-client/layout/builder';
|
|
8
|
+
import { RootConfig } from '@acorex-platform/extension-communication-telegram-client/contracts';
|
|
9
|
+
import { AXPCommunicationTelegramClient } from './acorex-platform-extension-communication-telegram-client.mjs';
|
|
10
|
+
import { AXMIntegrationConnectionManager } from '@acorex-platform/module-integration-management-client';
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region ----- Telegram test dialog -----
|
|
14
|
+
class AXECommunicationTelegramTestDialogService {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.layoutBuilder = inject(AXPLayoutBuilderService);
|
|
17
|
+
this.translationService = inject(AXTranslationService);
|
|
18
|
+
this.client = inject(AXPCommunicationTelegramClient);
|
|
19
|
+
this.connectionManager = inject(AXMIntegrationConnectionManager);
|
|
20
|
+
}
|
|
21
|
+
async resolveDefaultChatId() {
|
|
22
|
+
const connection = await this.connectionManager.findByUniqueKey({
|
|
23
|
+
providerId: RootConfig.integration.providerId,
|
|
24
|
+
connectionScope: 'user',
|
|
25
|
+
connectionKey: 'default',
|
|
26
|
+
});
|
|
27
|
+
if (!connection ||
|
|
28
|
+
connection.status !== AXP_INTEGRATION_CONNECTION_STATUS.Connected ||
|
|
29
|
+
connection.isRevoked ||
|
|
30
|
+
connection.isDisabled) {
|
|
31
|
+
return '';
|
|
32
|
+
}
|
|
33
|
+
const config = (connection.config ?? {});
|
|
34
|
+
return String(config.chatId ?? connection.externalAccountId ?? '').trim();
|
|
35
|
+
}
|
|
36
|
+
async openAndSendTestMessage() {
|
|
37
|
+
const defaultChatId = await this.resolveDefaultChatId();
|
|
38
|
+
try {
|
|
39
|
+
const result = await this.layoutBuilder
|
|
40
|
+
.create()
|
|
41
|
+
.dialog((dialog) => {
|
|
42
|
+
dialog
|
|
43
|
+
.setTitle('@extensions-communication-telegram:settings.telegram.test.dialog.title')
|
|
44
|
+
.setSize('sm')
|
|
45
|
+
.setCloseButton(true)
|
|
46
|
+
.setContext({ chatId: defaultChatId })
|
|
47
|
+
.content((flex) => {
|
|
48
|
+
flex
|
|
49
|
+
.setDirection('column')
|
|
50
|
+
.setGap('16px')
|
|
51
|
+
.formField('@extensions-communication-telegram:settings.telegram.test.dialog.fields.chat-id.title', (field) => {
|
|
52
|
+
field.path('chatId');
|
|
53
|
+
field.textBox({
|
|
54
|
+
validations: [{ rule: 'required' }],
|
|
55
|
+
placeholder: '@extensions-communication-telegram:settings.telegram.test.dialog.fields.chat-id.placeholder',
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
})
|
|
59
|
+
.setActions((actions) => {
|
|
60
|
+
actions
|
|
61
|
+
.cancel('@general:actions.cancel.title')
|
|
62
|
+
.submit('@extensions-communication-telegram:settings.telegram.test.dialog.actions.send');
|
|
63
|
+
})
|
|
64
|
+
.onAction(async (dialogRef) => {
|
|
65
|
+
if (dialogRef.action() === 'cancel') {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
const context = dialogRef.context();
|
|
69
|
+
const chatId = String(context?.['chatId'] ?? '').trim();
|
|
70
|
+
if (!chatId) {
|
|
71
|
+
throw new Error(await this.translationService.translateAsync('@extensions-communication-telegram:settings.telegram.test.messages.chat-id-required'));
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
const data = await this.client.testTelegram({ chatId });
|
|
75
|
+
return { success: true, kind: 'object', data };
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
const { messageKeyOrText } = await resolveCommunicationTelegramCommandError(this.translationService, error);
|
|
79
|
+
return {
|
|
80
|
+
success: false,
|
|
81
|
+
message: { text: messageKeyOrText },
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
})
|
|
86
|
+
.show();
|
|
87
|
+
return resolveLayoutBuilderDialogResult(result);
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
const { messageKeyOrText } = await resolveCommunicationTelegramCommandError(this.translationService, error);
|
|
91
|
+
return {
|
|
92
|
+
success: false,
|
|
93
|
+
message: { text: messageKeyOrText },
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXECommunicationTelegramTestDialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
98
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXECommunicationTelegramTestDialogService, providedIn: 'root' }); }
|
|
99
|
+
}
|
|
100
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXECommunicationTelegramTestDialogService, decorators: [{
|
|
101
|
+
type: Injectable,
|
|
102
|
+
args: [{ providedIn: 'root' }]
|
|
103
|
+
}] });
|
|
104
|
+
|
|
105
|
+
//#region ----- Telegram test command -----
|
|
106
|
+
class CommunicationTestTelegramCommand {
|
|
107
|
+
constructor() {
|
|
108
|
+
this.dialog = inject(AXECommunicationTelegramTestDialogService);
|
|
109
|
+
this.toastService = inject(AXToastService);
|
|
110
|
+
this.translationService = inject(AXTranslationService);
|
|
111
|
+
}
|
|
112
|
+
async execute() {
|
|
113
|
+
const result = await this.dialog.openAndSendTestMessage();
|
|
114
|
+
// Cancel / header close — not a failure for the integrations panel.
|
|
115
|
+
if (!result) {
|
|
116
|
+
return { success: true, kind: 'object', data: null };
|
|
117
|
+
}
|
|
118
|
+
if (result.success) {
|
|
119
|
+
this.toastService.success(await this.translationService.translateAsync('@extensions-communication-telegram:settings.telegram.test.messages.success'));
|
|
120
|
+
return result;
|
|
121
|
+
}
|
|
122
|
+
if (result.message?.text) {
|
|
123
|
+
const content = await this.translationService.translateAsync(result.message.text);
|
|
124
|
+
const title = await this.translationService.translateAsync(CommunicationTelegramCommandI18n.test.failed);
|
|
125
|
+
this.toastService.show({ color: 'danger', title, content });
|
|
126
|
+
}
|
|
127
|
+
return result;
|
|
128
|
+
}
|
|
129
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: CommunicationTestTelegramCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
130
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: CommunicationTestTelegramCommand }); }
|
|
131
|
+
}
|
|
132
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: CommunicationTestTelegramCommand, decorators: [{
|
|
133
|
+
type: Injectable
|
|
134
|
+
}] });
|
|
135
|
+
|
|
136
|
+
export { CommunicationTestTelegramCommand };
|
|
137
|
+
//# sourceMappingURL=acorex-platform-extension-communication-telegram-client-communication-test-telegram.command-Cir1ijfl.mjs.map
|
|
@@ -0,0 +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;AA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AM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,sBAAsB,EAAE;;QAGzD,IAAI,CAAC,MAAM,EAAE;AACX,YAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE;QACtD;AAEA,QAAA,IAAI,MAAM,CAAC,OAAO,EAAE;AAClB,YAAA,IAAI,CAAC,YAAY,CAAC,OAAO,CACvB,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAC1C,4EAA4E,CAC7E,CACF;AACD,YAAA,OAAO,MAAM;QACf;AAEA,QAAA,IAAI,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE;AACxB,YAAA,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,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;;;;;"}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import { AXToastService } from '@acorex/components/toast';
|
|
2
|
+
import { AXTranslationService } from '@acorex/core/translation';
|
|
3
|
+
import { AXP_INTEGRATION_CONNECTION_SCOPE, AXP_INTEGRATION_CONNECTION_STATUS, AXP_INTEGRATION_AUTH_METHOD_TYPE } from '@acorex-platform/framework-shared/core';
|
|
4
|
+
import { AXPLayoutBuilderService, resolveLayoutBuilderDialogResult } from '@acorex-platform/framework-client/layout/builder';
|
|
5
|
+
import { AXMIntegrationConnectionManager, hasConfiguredIntegrationCredentials, AXP_INTEGRATION_CREDENTIAL_MASK, isMaskedIntegrationCredential, toSafeIntegrationConnectionDto } from '@acorex-platform/module-integration-management-client';
|
|
6
|
+
import * as i0 from '@angular/core';
|
|
7
|
+
import { inject, Injectable } from '@angular/core';
|
|
8
|
+
import { trim, defaultTo } from 'lodash-es';
|
|
9
|
+
import { RootConfig } from '@acorex-platform/extension-communication-telegram-client/contracts';
|
|
10
|
+
import { r as resolveCommunicationTelegramCommandError, C as CommunicationTelegramCommandI18n } from './acorex-platform-extension-communication-telegram-client-communication-telegram-command-error.util-BTRYC0rH.mjs';
|
|
11
|
+
import { AXPCommunicationTelegramClient } from './acorex-platform-extension-communication-telegram-client.mjs';
|
|
12
|
+
|
|
13
|
+
//#region ---- Telegram connect dialog ----
|
|
14
|
+
const POLL_INTERVAL_MS = 2000;
|
|
15
|
+
const POLL_TIMEOUT_MS = 2 * 60 * 1000;
|
|
16
|
+
class AXECommunicationTelegramConnectDialogService {
|
|
17
|
+
constructor() {
|
|
18
|
+
this.layoutBuilder = inject(AXPLayoutBuilderService);
|
|
19
|
+
this.translationService = inject(AXTranslationService);
|
|
20
|
+
this.client = inject(AXPCommunicationTelegramClient);
|
|
21
|
+
}
|
|
22
|
+
async openAndLinkAccount() {
|
|
23
|
+
const result = await this.layoutBuilder
|
|
24
|
+
.create()
|
|
25
|
+
.dialog((dialog) => {
|
|
26
|
+
dialog
|
|
27
|
+
.setTitle('@extensions-communication-telegram:integration.connect.dialog.title')
|
|
28
|
+
.setSize('sm')
|
|
29
|
+
.setCloseButton(true)
|
|
30
|
+
.setContext({ chatId: '' })
|
|
31
|
+
.content((flex) => {
|
|
32
|
+
flex
|
|
33
|
+
.setDirection('column')
|
|
34
|
+
.setGap('12px')
|
|
35
|
+
.customWidget('text-block-layout', {
|
|
36
|
+
content: '@extensions-communication-telegram:integration.connect.dialog.instructions',
|
|
37
|
+
})
|
|
38
|
+
.formField('@extensions-communication-telegram:integration.connect.dialog.fields.chat-id.title', (field) => {
|
|
39
|
+
field.path('chatId');
|
|
40
|
+
field.textBox({
|
|
41
|
+
placeholder: '@extensions-communication-telegram:integration.connect.dialog.fields.chat-id.placeholder',
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
})
|
|
45
|
+
.setActions((actions) => {
|
|
46
|
+
actions
|
|
47
|
+
.cancel('@general:actions.cancel.title')
|
|
48
|
+
.submit('@extensions-communication-telegram:integration.connect.dialog.actions.connect');
|
|
49
|
+
})
|
|
50
|
+
.onAction(async (ref) => {
|
|
51
|
+
if (ref.action() === 'cancel') {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
const context = ref.context();
|
|
55
|
+
const manualChatId = String(context?.chatId ?? '').trim();
|
|
56
|
+
if (manualChatId) {
|
|
57
|
+
return { chatId: manualChatId };
|
|
58
|
+
}
|
|
59
|
+
let link;
|
|
60
|
+
try {
|
|
61
|
+
link = await this.client.startTelegramLink();
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
const { displayText } = await resolveCommunicationTelegramCommandError(this.translationService, error, CommunicationTelegramCommandI18n.connect.failed);
|
|
65
|
+
throw new Error(displayText);
|
|
66
|
+
}
|
|
67
|
+
window.open(link.deepLinkUrl, '_blank', 'noopener,noreferrer');
|
|
68
|
+
const startedAt = Date.now();
|
|
69
|
+
while (Date.now() - startedAt < POLL_TIMEOUT_MS) {
|
|
70
|
+
try {
|
|
71
|
+
const status = await this.client.getTelegramLinkStatus(link.linkToken);
|
|
72
|
+
if (status.status === 'linked' && status.chatId) {
|
|
73
|
+
return {
|
|
74
|
+
chatId: status.chatId,
|
|
75
|
+
username: status.username,
|
|
76
|
+
displayName: status.displayName,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
if (status.status === 'expired') {
|
|
80
|
+
throw new Error(await this.translationService.translateAsync('@extensions-communication-telegram:integration.connect.messages.expired'));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
const { displayText } = await resolveCommunicationTelegramCommandError(this.translationService, error, CommunicationTelegramCommandI18n.connect.failed);
|
|
85
|
+
throw new Error(displayText);
|
|
86
|
+
}
|
|
87
|
+
await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));
|
|
88
|
+
}
|
|
89
|
+
throw new Error(await this.translationService.translateAsync('@extensions-communication-telegram:integration.connect.messages.timeout'));
|
|
90
|
+
});
|
|
91
|
+
})
|
|
92
|
+
.show();
|
|
93
|
+
return resolveLayoutBuilderDialogResult(result);
|
|
94
|
+
}
|
|
95
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXECommunicationTelegramConnectDialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
96
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXECommunicationTelegramConnectDialogService, providedIn: 'root' }); }
|
|
97
|
+
}
|
|
98
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXECommunicationTelegramConnectDialogService, decorators: [{
|
|
99
|
+
type: Injectable,
|
|
100
|
+
args: [{ providedIn: 'root' }]
|
|
101
|
+
}] });
|
|
102
|
+
|
|
103
|
+
//#region ----- Connect Telegram (tenant bot or user link) -----
|
|
104
|
+
class ConnectTelegramCommand {
|
|
105
|
+
constructor() {
|
|
106
|
+
this.connectionManager = inject(AXMIntegrationConnectionManager);
|
|
107
|
+
this.connectDialog = inject(AXECommunicationTelegramConnectDialogService);
|
|
108
|
+
this.layoutBuilder = inject(AXPLayoutBuilderService);
|
|
109
|
+
this.toastService = inject(AXToastService);
|
|
110
|
+
this.translationService = inject(AXTranslationService);
|
|
111
|
+
}
|
|
112
|
+
async execute(input = {}) {
|
|
113
|
+
const connectionScope = input.connectionScope ?? AXP_INTEGRATION_CONNECTION_SCOPE.User;
|
|
114
|
+
if (connectionScope === AXP_INTEGRATION_CONNECTION_SCOPE.Tenant) {
|
|
115
|
+
return this.connectTenantBot(input);
|
|
116
|
+
}
|
|
117
|
+
return this.connectUserLink(input);
|
|
118
|
+
}
|
|
119
|
+
async connectTenantBot(input) {
|
|
120
|
+
try {
|
|
121
|
+
const providerId = input.providerId ?? RootConfig.integration.providerId;
|
|
122
|
+
const connectionScope = AXP_INTEGRATION_CONNECTION_SCOPE.Tenant;
|
|
123
|
+
const I18N = `@${RootConfig.config.i18n}:integration.connect.tenant`;
|
|
124
|
+
const existing = await this.connectionManager.findByUniqueKey({
|
|
125
|
+
providerId,
|
|
126
|
+
connectionScope,
|
|
127
|
+
connectionKey: 'default',
|
|
128
|
+
});
|
|
129
|
+
const isReconfigure = hasConfiguredIntegrationCredentials(existing);
|
|
130
|
+
const form = await this.openTenantConnectDialog({
|
|
131
|
+
i18nPrefix: I18N,
|
|
132
|
+
isReconfigure,
|
|
133
|
+
botToken: isReconfigure ? AXP_INTEGRATION_CREDENTIAL_MASK : '',
|
|
134
|
+
});
|
|
135
|
+
if (!form) {
|
|
136
|
+
return { success: true, kind: 'object', data: { outcome: 'cancelled' } };
|
|
137
|
+
}
|
|
138
|
+
let botToken = trim(form.botToken);
|
|
139
|
+
if (isMaskedIntegrationCredential(botToken) && existing) {
|
|
140
|
+
const config = (existing.config ?? {});
|
|
141
|
+
botToken = trim(config.botToken ?? '');
|
|
142
|
+
}
|
|
143
|
+
if (!botToken) {
|
|
144
|
+
return {
|
|
145
|
+
success: false,
|
|
146
|
+
message: { text: `${I18N}.messages.bot-token-required` },
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
const connection = await this.connectionManager.upsertConnection({
|
|
150
|
+
providerId,
|
|
151
|
+
authMethodType: AXP_INTEGRATION_AUTH_METHOD_TYPE.ApiToken,
|
|
152
|
+
connectionScope,
|
|
153
|
+
connectionKey: 'default',
|
|
154
|
+
displayName: existing?.displayName ?? 'Telegram',
|
|
155
|
+
externalAccountName: AXP_INTEGRATION_CREDENTIAL_MASK,
|
|
156
|
+
config: { botToken },
|
|
157
|
+
status: AXP_INTEGRATION_CONNECTION_STATUS.Connected,
|
|
158
|
+
isRevoked: false,
|
|
159
|
+
isDisabled: false,
|
|
160
|
+
});
|
|
161
|
+
this.toastService.success(await this.translationService.translateAsync(`${I18N}.messages.success`));
|
|
162
|
+
return { success: true, kind: 'object',
|
|
163
|
+
data: {
|
|
164
|
+
outcome: 'connected',
|
|
165
|
+
connection: toSafeIntegrationConnectionDto(connection),
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
const { displayText } = await resolveCommunicationTelegramCommandError(this.translationService, error, CommunicationTelegramCommandI18n.connect.failed);
|
|
171
|
+
return { success: false, message: { text: displayText } };
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
async connectUserLink(input) {
|
|
175
|
+
try {
|
|
176
|
+
const providerId = input.providerId ?? RootConfig.integration.providerId;
|
|
177
|
+
const connectionScope = AXP_INTEGRATION_CONNECTION_SCOPE.User;
|
|
178
|
+
const existing = await this.connectionManager.findByUniqueKey({
|
|
179
|
+
providerId,
|
|
180
|
+
connectionScope,
|
|
181
|
+
connectionKey: 'default',
|
|
182
|
+
});
|
|
183
|
+
const linked = await this.connectDialog.openAndLinkAccount();
|
|
184
|
+
if (!linked || typeof linked !== 'object' || !('chatId' in linked)) {
|
|
185
|
+
return { success: true, kind: 'object', data: { outcome: 'cancelled' } };
|
|
186
|
+
}
|
|
187
|
+
const chatId = trim(linked.chatId);
|
|
188
|
+
if (!chatId) {
|
|
189
|
+
return { success: true, kind: 'object', data: { outcome: 'cancelled' } };
|
|
190
|
+
}
|
|
191
|
+
const username = trim(linked.username ?? '');
|
|
192
|
+
const displayName = defaultTo(trim(linked.displayName), username ? `@${username}` : 'Telegram');
|
|
193
|
+
const connection = await this.connectionManager.upsertConnection({
|
|
194
|
+
providerId,
|
|
195
|
+
authMethodType: AXP_INTEGRATION_AUTH_METHOD_TYPE.ApiToken,
|
|
196
|
+
connectionScope,
|
|
197
|
+
connectionKey: 'default',
|
|
198
|
+
displayName: existing?.displayName ?? displayName,
|
|
199
|
+
externalAccountId: chatId,
|
|
200
|
+
externalAccountName: username ? `@${username}` : chatId,
|
|
201
|
+
config: {
|
|
202
|
+
chatId,
|
|
203
|
+
username: username || null,
|
|
204
|
+
},
|
|
205
|
+
status: AXP_INTEGRATION_CONNECTION_STATUS.Connected,
|
|
206
|
+
isRevoked: false,
|
|
207
|
+
isDisabled: false,
|
|
208
|
+
});
|
|
209
|
+
this.toastService.success(await this.translationService.translateAsync('@extensions-communication-telegram:integration.connect.messages.success'));
|
|
210
|
+
return { success: true, kind: 'object',
|
|
211
|
+
data: {
|
|
212
|
+
outcome: 'connected',
|
|
213
|
+
connection: toSafeIntegrationConnectionDto(connection),
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
catch (error) {
|
|
218
|
+
const { displayText } = await resolveCommunicationTelegramCommandError(this.translationService, error, CommunicationTelegramCommandI18n.connect.failed);
|
|
219
|
+
return { success: false, message: { text: displayText } };
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
async openTenantConnectDialog(input) {
|
|
223
|
+
const result = await this.layoutBuilder
|
|
224
|
+
.create()
|
|
225
|
+
.dialog((dialog) => {
|
|
226
|
+
dialog
|
|
227
|
+
.setTitle(input.isReconfigure
|
|
228
|
+
? `${input.i18nPrefix}.dialog.configure-title`
|
|
229
|
+
: `${input.i18nPrefix}.dialog.title`)
|
|
230
|
+
.setSize('md')
|
|
231
|
+
.setCloseButton(true)
|
|
232
|
+
.setContext({ botToken: input.botToken })
|
|
233
|
+
.content((flex) => {
|
|
234
|
+
flex
|
|
235
|
+
.setDirection('column')
|
|
236
|
+
.setGap('12px')
|
|
237
|
+
.customWidget('text-block-layout', {
|
|
238
|
+
content: `${input.i18nPrefix}.dialog.instructions`,
|
|
239
|
+
})
|
|
240
|
+
.formField(`${input.i18nPrefix}.dialog.fields.bot-token`, (field) => {
|
|
241
|
+
field.path('botToken');
|
|
242
|
+
field.passwordBox({
|
|
243
|
+
placeholder: `${input.i18nPrefix}.dialog.placeholders.bot-token`,
|
|
244
|
+
revealToggle: true,
|
|
245
|
+
validations: [{ rule: 'required' }],
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
})
|
|
249
|
+
.setActions((actions) => {
|
|
250
|
+
actions.cancel('@general:actions.cancel.title').submit(`${input.i18nPrefix}.dialog.actions.save`);
|
|
251
|
+
})
|
|
252
|
+
.onAction(async (ref) => {
|
|
253
|
+
if (ref.action() === 'cancel') {
|
|
254
|
+
return null;
|
|
255
|
+
}
|
|
256
|
+
const ctx = ref.context();
|
|
257
|
+
const botToken = trim(ctx.botToken ?? '');
|
|
258
|
+
if (!botToken) {
|
|
259
|
+
throw new Error(`${input.i18nPrefix}.messages.bot-token-required`);
|
|
260
|
+
}
|
|
261
|
+
return { botToken };
|
|
262
|
+
});
|
|
263
|
+
})
|
|
264
|
+
.show();
|
|
265
|
+
return resolveLayoutBuilderDialogResult(result);
|
|
266
|
+
}
|
|
267
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ConnectTelegramCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
268
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ConnectTelegramCommand, providedIn: 'root' }); }
|
|
269
|
+
}
|
|
270
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ConnectTelegramCommand, decorators: [{
|
|
271
|
+
type: Injectable,
|
|
272
|
+
args: [{ providedIn: 'root' }]
|
|
273
|
+
}] });
|
|
274
|
+
|
|
275
|
+
export { ConnectTelegramCommand };
|
|
276
|
+
//# sourceMappingURL=acorex-platform-extension-communication-telegram-client-connect-telegram.command-C2H_3TPw.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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 }\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,CA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,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;;;;;"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const RootConfig = {
|
|
2
|
+
module: {
|
|
3
|
+
name: 'CommunicationTelegramExtension',
|
|
4
|
+
icon: 'fa-brands fa-telegram',
|
|
5
|
+
},
|
|
6
|
+
config: {
|
|
7
|
+
i18n: 'extensions-communication-telegram',
|
|
8
|
+
},
|
|
9
|
+
integration: {
|
|
10
|
+
channelKey: 'telegram',
|
|
11
|
+
providerId: 'telegram',
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
const AXPCommunicationTelegramSettingKeys = {
|
|
15
|
+
/** Tenant-scoped bot token for Telegram delivery (IntegrationConnection is preferred at runtime). */
|
|
16
|
+
BotToken: 'CommunicationTelegramExtension:Setting:Tenant.BotToken',
|
|
17
|
+
DebugRedirectChatId: 'CommunicationTelegramExtension:Setting:Debug.Redirect.ChatId',
|
|
18
|
+
UserDeliveryChannelEnabled: 'CommunicationTelegramExtension:Setting:User.DeliveryChannel.Enabled',
|
|
19
|
+
};
|
|
20
|
+
/** Keys seeded at platform scope on startup (never include secrets). */
|
|
21
|
+
const AXP_COMMUNICATION_TELEGRAM_PLATFORM_SEED_DEFAULTS = {
|
|
22
|
+
[AXPCommunicationTelegramSettingKeys.DebugRedirectChatId]: '',
|
|
23
|
+
};
|
|
24
|
+
const AXP_COMMUNICATION_TELEGRAM_SETTING_DEFAULTS = {
|
|
25
|
+
...AXP_COMMUNICATION_TELEGRAM_PLATFORM_SEED_DEFAULTS,
|
|
26
|
+
[AXPCommunicationTelegramSettingKeys.UserDeliveryChannelEnabled]: true,
|
|
27
|
+
};
|
|
28
|
+
const AXECommunicationTelegramCommandKeys = {
|
|
29
|
+
TestTelegram: 'CommunicationTelegramExtension:Communication:TestTelegram',
|
|
30
|
+
ConnectionConnect: 'CommunicationTelegramExtension:Integration:Connect',
|
|
31
|
+
LinkStart: 'CommunicationTelegramExtension:Link:Start',
|
|
32
|
+
LinkStatus: 'CommunicationTelegramExtension:Link:Status',
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/** Shared communication integration domain (Telegram, WhatsApp, …). */
|
|
36
|
+
const AXE_COMMUNICATION_DOMAIN_ID = 'communication';
|
|
37
|
+
|
|
38
|
+
const AXP_COMMUNICATION_TELEGRAM_ERROR_CODES = {
|
|
39
|
+
CHAT_ID_REQUIRED: 'COMMUNICATION_TELEGRAM_CHAT_ID_REQUIRED',
|
|
40
|
+
BOT_TOKEN_NOT_CONFIGURED: 'COMMUNICATION_TELEGRAM_BOT_TOKEN_NOT_CONFIGURED',
|
|
41
|
+
TENANT_REQUIRED: 'COMMUNICATION_TELEGRAM_TENANT_REQUIRED',
|
|
42
|
+
CHAT_NOT_FOUND: 'COMMUNICATION_TELEGRAM_CHAT_NOT_FOUND',
|
|
43
|
+
BOT_UNAUTHORIZED: 'COMMUNICATION_TELEGRAM_BOT_UNAUTHORIZED',
|
|
44
|
+
BOT_BLOCKED: 'COMMUNICATION_TELEGRAM_BOT_BLOCKED',
|
|
45
|
+
BOT_CANNOT_INITIATE: 'COMMUNICATION_TELEGRAM_BOT_CANNOT_INITIATE',
|
|
46
|
+
API_ERROR: 'COMMUNICATION_TELEGRAM_API_ERROR',
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
//#region ---- Telegram test types ----
|
|
50
|
+
//#endregion
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Generated bundle index. Do not edit.
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
export { AXECommunicationTelegramCommandKeys, AXE_COMMUNICATION_DOMAIN_ID, AXPCommunicationTelegramSettingKeys, AXP_COMMUNICATION_TELEGRAM_ERROR_CODES, AXP_COMMUNICATION_TELEGRAM_PLATFORM_SEED_DEFAULTS, AXP_COMMUNICATION_TELEGRAM_SETTING_DEFAULTS, RootConfig };
|
|
57
|
+
//# sourceMappingURL=acorex-platform-extension-communication-telegram-client-contracts.mjs.map
|