@acorex-platform/extension-project-management-simpro-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.
@@ -0,0 +1,579 @@
1
+ import { AXMIntegrationManagementModule } from '@acorex-platform/module-integration-management-client';
2
+ import { AXPIntegrationRuntimeService, AXP_INTEGRATION_SECRET_STORE, AXPSettingsService, AXP_INTEGRATION_RUNTIME_PROVIDER, AXP_INTEGRATION_CONNECTION_LIFECYCLE, AXP_MENU_PROVIDER, AXP_INTEGRATION_PROVIDER } from '@acorex-platform/framework-client/common';
3
+ import { AXP_LOGO_PROVIDER, AXP_MODULE_MANIFEST_PROVIDER, AXP_EXPRESSION_EVALUATOR_SCOPE_PROVIDER } from '@acorex-platform/framework-client/core';
4
+ import { AXPEntityService, ensureListActions, actionExists, AXP_ENTITY_MODIFIER } from '@acorex-platform/framework-client/layout/entity';
5
+ import { AXPCommandService, provideCommandSetups } from '@acorex-platform/framework-client/runtime';
6
+ import * as i0 from '@angular/core';
7
+ import { inject, Injectable, NgModule, input, computed, ChangeDetectionStrategy, Component } from '@angular/core';
8
+ import { AXESimproCommandKeys, RootConfig as RootConfig$2, AXPAdministrationPermissionKeys, AXESimproMenuKeys } from '@acorex-platform/extension-project-management-simpro-client/contracts';
9
+ import { AXE_PM_INTEGRATION_PROVIDER_SIMPRO } from '@acorex-platform/extension-project-management-core-client/contracts';
10
+ import { RootConfig } from '@acorex-platform/module-project-management-client/contracts';
11
+ import { AXPSystemActionType, AXPWidgetsList, AXP_INTEGRATION_AUTH_METHOD_TYPE, AXP_INTEGRATION_CONNECTION_SCOPE, AXP_INTEGRATION_CAPABILITY, AXPRegionalSetting, AXP_INTEGRATION_CONNECTION_STATUS } from '@acorex-platform/framework-shared/core';
12
+ import { AXPEntityCommandScope } from '@acorex-platform/framework-shared/entity';
13
+ import { RootConfig as RootConfig$1 } from '@acorex-platform/module-customer-management-client/contracts';
14
+ import { AXFormatService } from '@acorex/core/format';
15
+ import { trim, defaultTo } from 'lodash-es';
16
+ import { AXPCommonMenuKeys } from '@acorex-platform/module-common-client/contracts';
17
+
18
+ const AXE_SIMPRO_EXPRESSION_SCOPE = 'SimproExtension';
19
+
20
+ //#region ---- Imports ----
21
+ //#endregion
22
+ class AXESimproProjectLinkExpressionEvaluatorScopeProvider {
23
+ constructor() {
24
+ this.entityService = inject(AXPEntityService);
25
+ this.integrationRuntime = inject(AXPIntegrationRuntimeService);
26
+ }
27
+ async provide(context) {
28
+ context.addScope(AXE_SIMPRO_EXPRESSION_SCOPE, {
29
+ hasProjectLink: async (platformProjectIdRaw) => {
30
+ const platformProjectId = typeof platformProjectIdRaw === 'string' ? platformProjectIdRaw.trim() : '';
31
+ if (!platformProjectId) {
32
+ return false;
33
+ }
34
+ const project = (await this.entityService
35
+ .withEntity(RootConfig.module.name, RootConfig.entities.project.name)
36
+ .data()
37
+ .byKey(platformProjectId));
38
+ return project?.integrationRef?.source === AXE_PM_INTEGRATION_PROVIDER_SIMPRO;
39
+ },
40
+ hasSimproConnection: async () => {
41
+ try {
42
+ await this.integrationRuntime.getConnection({ providerId: 'simpro', connectionScope: 'tenant' });
43
+ return true;
44
+ }
45
+ catch {
46
+ return false;
47
+ }
48
+ },
49
+ });
50
+ }
51
+ }
52
+ //#endregion
53
+
54
+ //#region ---- Imports ----
55
+ //#endregion
56
+ const IMPORT_ORDER$1 = 36;
57
+ const SYNC_ORDER = 37;
58
+ function buildImportAction$1() {
59
+ return {
60
+ name: AXESimproCommandKeys.ProjectImportFromSimpro,
61
+ title: '@extensions-simpro:actions.import-from-simpro.title',
62
+ command: { name: AXESimproCommandKeys.ProjectImportFromSimpro },
63
+ priority: 'secondary',
64
+ type: AXPSystemActionType.Import,
65
+ icon: 'fa-light fa-briefcase',
66
+ scope: AXPEntityCommandScope.TypeLevel,
67
+ order: IMPORT_ORDER$1,
68
+ };
69
+ }
70
+ function buildSyncAction() {
71
+ return {
72
+ name: AXESimproCommandKeys.ProjectSync,
73
+ title: '@extensions-simpro:actions.sync.title',
74
+ command: {
75
+ name: AXESimproCommandKeys.ProjectSync,
76
+ options: { platformProjectId: '{{ context.eval("id") }}' },
77
+ },
78
+ priority: 'secondary',
79
+ type: AXPSystemActionType.Sync,
80
+ icon: 'fa-light fa-arrows-rotate',
81
+ scope: AXPEntityCommandScope.Individual,
82
+ order: SYNC_ORDER,
83
+ hidden: `{{ !(await ${AXE_SIMPRO_EXPRESSION_SCOPE}.hasProjectLink(context.eval("id"))) }}`,
84
+ };
85
+ }
86
+ /** Adds Simpro import/sync actions to ProjectManagement.Project views. */
87
+ const AXESimproProjectEntityModifier = {
88
+ entityName: RootConfig.entities.project.name,
89
+ order: 50,
90
+ modifier: (ctx) => {
91
+ if (ctx.module.get() !== RootConfig.module.name) {
92
+ return;
93
+ }
94
+ ensureListActions(ctx);
95
+ ctx.interfaces.update((interfaces) => {
96
+ const next = (interfaces ?? {});
97
+ const master = (next['master'] ?? {});
98
+ const list = (master['list'] ?? { actions: [], views: [] });
99
+ const listActions = (list['actions'] ?? []);
100
+ if (!actionExists(listActions, AXESimproCommandKeys.ProjectImportFromSimpro)) {
101
+ listActions.push(buildImportAction$1());
102
+ }
103
+ list['actions'] = listActions;
104
+ master['list'] = list;
105
+ const single = master['single'];
106
+ if (single) {
107
+ const singleActions = (single['actions'] ?? []);
108
+ if (!actionExists(singleActions, AXESimproCommandKeys.ProjectSync)) {
109
+ singleActions.push(buildSyncAction());
110
+ }
111
+ single['actions'] = singleActions;
112
+ }
113
+ next['master'] = master;
114
+ return next;
115
+ });
116
+ },
117
+ };
118
+ //#endregion
119
+
120
+ //#region ---- Imports ----
121
+ //#endregion
122
+ //#region ----- Constants -----
123
+ const IMPORT_ORDER = 36;
124
+ //#endregion
125
+ //#region ----- Actions -----
126
+ function buildImportAction() {
127
+ return {
128
+ name: AXESimproCommandKeys.CustomerImportFromSimpro,
129
+ title: '@extensions-simpro:actions.import-from-simpro.title',
130
+ command: { name: AXESimproCommandKeys.CustomerImportFromSimpro },
131
+ priority: 'secondary',
132
+ type: AXPSystemActionType.Import,
133
+ icon: 'fa-light fa-briefcase',
134
+ scope: AXPEntityCommandScope.TypeLevel,
135
+ order: IMPORT_ORDER,
136
+ };
137
+ }
138
+ //#endregion
139
+ //#region ----- Modifier -----
140
+ /** Adds Simpro import action to CustomerManagement.Customer list views. */
141
+ const AXESimproCustomerEntityModifier = {
142
+ entityName: RootConfig$1.entities.customer.name,
143
+ order: 50,
144
+ modifier: (ctx) => {
145
+ if (ctx.module.get() !== RootConfig$1.module.name) {
146
+ return;
147
+ }
148
+ ensureListActions(ctx);
149
+ ctx.interfaces.update((interfaces) => {
150
+ const next = (interfaces ?? {});
151
+ const master = (next['master'] ?? {});
152
+ const list = (master['list'] ?? { actions: [], views: [] });
153
+ const listActions = (list['actions'] ?? []);
154
+ if (!actionExists(listActions, AXESimproCommandKeys.CustomerImportFromSimpro)) {
155
+ listActions.push(buildImportAction());
156
+ }
157
+ list['actions'] = listActions;
158
+ master['list'] = list;
159
+ next['master'] = master;
160
+ return next;
161
+ });
162
+ },
163
+ };
164
+ //#endregion
165
+
166
+ //#region ---- Simpro logo registry key ----
167
+ const axpSimproLogoKey = 'simpro';
168
+ //#endregion
169
+
170
+ class AXESimproIntegrationProvider {
171
+ async provide(context) {
172
+ const I18N = `@${RootConfig$2.config.i18n}:integration`;
173
+ context.register({
174
+ domainId: 'project-management',
175
+ id: 'simpro',
176
+ module: RootConfig$2.module.name,
177
+ displayName: `${I18N}.display-name`,
178
+ description: `${I18N}.description`,
179
+ icon: RootConfig$2.module.icon,
180
+ logoKey: axpSimproLogoKey,
181
+ capabilities: [AXP_INTEGRATION_CAPABILITY.Sync, AXP_INTEGRATION_CAPABILITY.Import],
182
+ connectionScopes: [AXP_INTEGRATION_CONNECTION_SCOPE.Tenant],
183
+ allowMultipleConnections: true,
184
+ defaultConnectionKey: 'default',
185
+ connectCommandKey: AXESimproCommandKeys.ConnectionConnect,
186
+ completeOAuthCommandKey: AXESimproCommandKeys.ConnectionCompleteOAuth,
187
+ authMethods: [
188
+ {
189
+ type: AXP_INTEGRATION_AUTH_METHOD_TYPE.OAuth2,
190
+ label: `${I18N}.auth.oauth.label`,
191
+ instructions: `${I18N}.auth.oauth.instructions`,
192
+ usesRedirect: false,
193
+ supportsRefresh: true,
194
+ supportsRevoke: false,
195
+ supportsValidation: true,
196
+ fields: [
197
+ {
198
+ type: AXPWidgetsList.Editors.TextBox,
199
+ path: 'clientId',
200
+ options: { placeholder: `${I18N}.auth.oauth.client-id.placeholder` },
201
+ },
202
+ {
203
+ type: AXPWidgetsList.Editors.PasswordBox,
204
+ path: 'clientSecret',
205
+ options: { placeholder: `${I18N}.auth.oauth.client-secret.placeholder` },
206
+ },
207
+ ],
208
+ },
209
+ ],
210
+ });
211
+ }
212
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXESimproIntegrationProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
213
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXESimproIntegrationProvider }); }
214
+ }
215
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXESimproIntegrationProvider, decorators: [{
216
+ type: Injectable
217
+ }] });
218
+
219
+ //#region ---- Simpro integration settings badges ----
220
+ const SIMPRO_I18N = '@extensions-simpro:integration.badges';
221
+ async function formatSyncTimestamp(iso, formatService, settingsService) {
222
+ const parsed = Date.parse(iso);
223
+ if (!Number.isFinite(parsed)) {
224
+ return undefined;
225
+ }
226
+ const dateFormat = await settingsService.get(AXPRegionalSetting.ShortDate);
227
+ const timeFormat = await settingsService.get(AXPRegionalSetting.ShortTime);
228
+ const format = `${dateFormat} ${timeFormat}`.trim();
229
+ return formatService.format(new Date(parsed), 'datetime', { format });
230
+ }
231
+ async function resolveSimproConnectionSettingsBadges(ctx, formatService, settingsService) {
232
+ const config = (ctx.connection.config ?? {});
233
+ const jobsSync = config.jobsSync;
234
+ const lastSync = config.jobsSync?.lastSyncAt?.trim() ||
235
+ (typeof jobsSync?.['lastSuccessfulSyncAt'] === 'string' ? jobsSync['lastSuccessfulSyncAt'].trim() : '');
236
+ if (!lastSync) {
237
+ return [
238
+ {
239
+ labelKey: `${SIMPRO_I18N}.never-synced`,
240
+ color: 'warning',
241
+ },
242
+ ];
243
+ }
244
+ const datetime = await formatSyncTimestamp(lastSync, formatService, settingsService);
245
+ if (!datetime) {
246
+ return [];
247
+ }
248
+ return [
249
+ {
250
+ labelKey: `${SIMPRO_I18N}.last-sync`,
251
+ params: { datetime },
252
+ color: 'success',
253
+ },
254
+ ];
255
+ }
256
+ //#endregion
257
+
258
+ class AXESimproIntegrationRuntimeProvider {
259
+ constructor() {
260
+ this.providerId = 'simpro';
261
+ this.secretStore = inject(AXP_INTEGRATION_SECRET_STORE, { optional: true });
262
+ this.formatService = inject(AXFormatService);
263
+ this.settingsService = inject(AXPSettingsService);
264
+ }
265
+ async getHooks() {
266
+ return {
267
+ validateConnection: (ctx) => this.validateConnection(ctx),
268
+ createClient: (ctx) => this.createClient(ctx),
269
+ getConnectionSettingsBadges: (ctx) => resolveSimproConnectionSettingsBadges(ctx, this.formatService, this.settingsService),
270
+ };
271
+ }
272
+ async validateConnection(ctx) {
273
+ const buildUrl = trim(defaultTo(ctx.instanceUrl, ''));
274
+ if (!buildUrl) {
275
+ return {
276
+ valid: false,
277
+ status: AXP_INTEGRATION_CONNECTION_STATUS.Invalid,
278
+ errorMessage: 'Simpro build URL is missing on the connection.',
279
+ };
280
+ }
281
+ if (!this.hasClientCredentials(ctx)) {
282
+ return {
283
+ valid: false,
284
+ status: AXP_INTEGRATION_CONNECTION_STATUS.Invalid,
285
+ errorMessage: 'Simpro client ID and client secret are required.',
286
+ };
287
+ }
288
+ return {
289
+ valid: true,
290
+ status: AXP_INTEGRATION_CONNECTION_STATUS.Connected,
291
+ externalAccountName: buildUrl,
292
+ };
293
+ }
294
+ async createClient(ctx) {
295
+ const credentials = await this.resolveClientCredentials(ctx);
296
+ return {
297
+ clientId: credentials.clientId,
298
+ baseUrl: defaultTo(ctx.instanceUrl, undefined),
299
+ };
300
+ }
301
+ hasClientCredentials(ctx) {
302
+ const config = (ctx.config ?? {});
303
+ const clientId = trim(defaultTo(config.clientId, ''));
304
+ const clientSecret = trim(defaultTo(config.clientSecret, ''));
305
+ const legacyToken = trim(defaultTo(config.accessToken, ''));
306
+ const refreshToken = trim(defaultTo(config.refreshToken, ''));
307
+ return Boolean((clientId && clientSecret) || legacyToken || refreshToken);
308
+ }
309
+ async resolveClientCredentials(ctx) {
310
+ const config = (ctx.config ?? {});
311
+ const configClientId = trim(defaultTo(config.clientId, ''));
312
+ const configClientSecret = trim(defaultTo(config.clientSecret, ''));
313
+ if (configClientId && configClientSecret) {
314
+ return { clientId: configClientId, clientSecret: configClientSecret };
315
+ }
316
+ if (!this.secretStore || !trim(defaultTo(ctx.secretRef, ''))) {
317
+ throw new Error('Simpro connection has no client credentials.');
318
+ }
319
+ const credentials = await this.secretStore.resolve(ctx.secretRef, ctx);
320
+ const clientId = trim(defaultTo(credentials.token ?? credentials.email, ''));
321
+ const clientSecret = trim(defaultTo(credentials.password ?? credentials.apiToken, ''));
322
+ if (!clientId || !clientSecret) {
323
+ throw new Error('Simpro connection has no usable client credentials.');
324
+ }
325
+ return { clientId, clientSecret };
326
+ }
327
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXESimproIntegrationRuntimeProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
328
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXESimproIntegrationRuntimeProvider }); }
329
+ }
330
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXESimproIntegrationRuntimeProvider, decorators: [{
331
+ type: Injectable
332
+ }] });
333
+ const provideSimproIntegrationRuntimeProvider = {
334
+ provide: AXP_INTEGRATION_RUNTIME_PROVIDER,
335
+ useClass: AXESimproIntegrationRuntimeProvider,
336
+ multi: true,
337
+ };
338
+
339
+ //#region ---- Imports ----
340
+ //#endregion
341
+ //#region ---- Handler ----
342
+ class AXESimproConnectionLifecycleHandler {
343
+ constructor() {
344
+ this.providerId = 'simpro';
345
+ this.commandService = inject(AXPCommandService);
346
+ }
347
+ async onDisconnected(connection) {
348
+ await this.runLifecycle(connection.id, 'disconnected');
349
+ }
350
+ async onDeleted(connection) {
351
+ await this.runLifecycle(connection.id, 'deleted');
352
+ }
353
+ async onEnabledChanged(connection, enabled) {
354
+ if (enabled) {
355
+ if (connection.status === AXP_INTEGRATION_CONNECTION_STATUS.Connected) {
356
+ await this.runLifecycle(connection.id, 'enabled');
357
+ }
358
+ return;
359
+ }
360
+ await this.runLifecycle(connection.id, 'disabled');
361
+ }
362
+ async runLifecycle(connectionId, action) {
363
+ await this.commandService.execute(AXESimproCommandKeys.ConnectionLifecycle, {
364
+ connectionId,
365
+ action,
366
+ });
367
+ }
368
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXESimproConnectionLifecycleHandler, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
369
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXESimproConnectionLifecycleHandler }); }
370
+ }
371
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXESimproConnectionLifecycleHandler, decorators: [{
372
+ type: Injectable
373
+ }] });
374
+ const provideSimproConnectionLifecycleHandler = {
375
+ provide: AXP_INTEGRATION_CONNECTION_LIFECYCLE,
376
+ useClass: AXESimproConnectionLifecycleHandler,
377
+ multi: true,
378
+ };
379
+
380
+ const simproLogoProvider = {
381
+ key: axpSimproLogoKey,
382
+ resolve: async (request) => ({
383
+ kind: 'component',
384
+ load: () => Promise.resolve().then(function () { return simproLogo_component; }).then((module) => module.AXESimproLogoComponent),
385
+ inputs: {
386
+ appearance: request.appearance,
387
+ size: request.size,
388
+ },
389
+ }),
390
+ };
391
+ const AXE_SIMPRO_LOGO_PROVIDER = {
392
+ provide: AXP_LOGO_PROVIDER,
393
+ useValue: simproLogoProvider,
394
+ multi: true,
395
+ };
396
+
397
+ //#region ---- Manifest ----
398
+ const SimproExtensionManifest = {
399
+ name: RootConfig$2.module.name,
400
+ version: '1.0.0',
401
+ title: RootConfig$2.module.title,
402
+ icon: RootConfig$2.module.icon,
403
+ i18n: RootConfig$2.config.i18n,
404
+ type: 'integration',
405
+ domain: 'project-management',
406
+ dependencies: [],
407
+ };
408
+ //#endregion
409
+
410
+ //#region ---- Imports ----
411
+ //#endregion
412
+ class AXESimproMenuProvider {
413
+ async provide(context) {
414
+ const module = RootConfig$2.module;
415
+ const policy = {
416
+ features: [module.name],
417
+ permissions: [AXPAdministrationPermissionKeys.MaintainConnections],
418
+ };
419
+ const configMenu = context.find(AXPCommonMenuKeys.Configuration);
420
+ if (!context.find(AXESimproMenuKeys.SimproExtensionConfig).exists) {
421
+ configMenu.addItems([
422
+ {
423
+ name: AXESimproMenuKeys.SimproExtensionConfig,
424
+ text: '@extensions-simpro:module.menus.configuration.title',
425
+ icon: module.icon,
426
+ type: 'menu',
427
+ priority: 8940,
428
+ policy,
429
+ children: [],
430
+ },
431
+ ]);
432
+ }
433
+ }
434
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXESimproMenuProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
435
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXESimproMenuProvider }); }
436
+ }
437
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXESimproMenuProvider, decorators: [{
438
+ type: Injectable
439
+ }] });
440
+
441
+ //#region ---- Imports ----
442
+ //#endregion
443
+ class AXESimproExtensionModule {
444
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXESimproExtensionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
445
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.8", ngImport: i0, type: AXESimproExtensionModule, imports: [AXMIntegrationManagementModule] }); }
446
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXESimproExtensionModule, providers: [
447
+ AXE_SIMPRO_LOGO_PROVIDER,
448
+ { provide: AXP_MODULE_MANIFEST_PROVIDER, useValue: SimproExtensionManifest, multi: true },
449
+ { provide: AXP_MENU_PROVIDER, useClass: AXESimproMenuProvider, multi: true },
450
+ { provide: AXP_ENTITY_MODIFIER, useValue: AXESimproProjectEntityModifier, multi: true },
451
+ { provide: AXP_ENTITY_MODIFIER, useValue: AXESimproCustomerEntityModifier, multi: true },
452
+ {
453
+ provide: AXP_EXPRESSION_EVALUATOR_SCOPE_PROVIDER,
454
+ useClass: AXESimproProjectLinkExpressionEvaluatorScopeProvider,
455
+ multi: true,
456
+ },
457
+ { provide: AXP_INTEGRATION_PROVIDER, useClass: AXESimproIntegrationProvider, multi: true },
458
+ provideSimproIntegrationRuntimeProvider,
459
+ provideSimproConnectionLifecycleHandler,
460
+ provideCommandSetups([
461
+ {
462
+ key: AXESimproCommandKeys.ConnectionConnect,
463
+ command: () => import('./acorex-platform-extension-project-management-simpro-client-connect-simpro.command-BPDls4Yt.mjs').then((c) => c.ConnectSimproCommand),
464
+ },
465
+ {
466
+ key: AXESimproCommandKeys.ConnectionCompleteOAuth,
467
+ command: () => import('./acorex-platform-extension-project-management-simpro-client-complete-simpro-oauth.command-BA01rFnU.mjs').then((c) => c.CompleteSimproOAuthCommand),
468
+ },
469
+ ]),
470
+ ], imports: [AXMIntegrationManagementModule] }); }
471
+ }
472
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXESimproExtensionModule, decorators: [{
473
+ type: NgModule,
474
+ args: [{
475
+ imports: [AXMIntegrationManagementModule],
476
+ providers: [
477
+ AXE_SIMPRO_LOGO_PROVIDER,
478
+ { provide: AXP_MODULE_MANIFEST_PROVIDER, useValue: SimproExtensionManifest, multi: true },
479
+ { provide: AXP_MENU_PROVIDER, useClass: AXESimproMenuProvider, multi: true },
480
+ { provide: AXP_ENTITY_MODIFIER, useValue: AXESimproProjectEntityModifier, multi: true },
481
+ { provide: AXP_ENTITY_MODIFIER, useValue: AXESimproCustomerEntityModifier, multi: true },
482
+ {
483
+ provide: AXP_EXPRESSION_EVALUATOR_SCOPE_PROVIDER,
484
+ useClass: AXESimproProjectLinkExpressionEvaluatorScopeProvider,
485
+ multi: true,
486
+ },
487
+ { provide: AXP_INTEGRATION_PROVIDER, useClass: AXESimproIntegrationProvider, multi: true },
488
+ provideSimproIntegrationRuntimeProvider,
489
+ provideSimproConnectionLifecycleHandler,
490
+ provideCommandSetups([
491
+ {
492
+ key: AXESimproCommandKeys.ConnectionConnect,
493
+ command: () => import('./acorex-platform-extension-project-management-simpro-client-connect-simpro.command-BPDls4Yt.mjs').then((c) => c.ConnectSimproCommand),
494
+ },
495
+ {
496
+ key: AXESimproCommandKeys.ConnectionCompleteOAuth,
497
+ command: () => import('./acorex-platform-extension-project-management-simpro-client-complete-simpro-oauth.command-BA01rFnU.mjs').then((c) => c.CompleteSimproOAuthCommand),
498
+ },
499
+ ]),
500
+ ],
501
+ }]
502
+ }] });
503
+
504
+ //#region ---- Simpro mark vector paths ----
505
+ const AXE_SIMPRO_MARK_BLUE = '#00338D';
506
+ const AXE_SIMPRO_MARK_GOLD = '#FFCC00';
507
+ const AXE_SIMPRO_MARK_PATH = 'M12 4.2C12.5 4.2 12.5 8.6 13.6 9.2C14.7 9.9 18.5 7.6 18.8 8.1C19 8.6 15.2 10.7 15.2 12C15.2 13.3 19 15.4 18.8 15.9C18.5 16.4 14.7 14.1 13.6 14.8C12.5 15.4 12.5 19.8 12 19.8C11.5 19.8 11.5 15.4 10.4 14.8C9.3 14.1 5.5 16.4 5.2 15.9C5 15.4 8.8 13.3 8.8 12C8.8 10.7 5 8.6 5.2 8.1C5.5 7.6 9.3 9.9 10.4 9.2C11.5 8.6 11.5 4.2 12 4.2Z';
508
+ //#endregion
509
+
510
+ //#region ---- Simpro brand logo (owned by Simpro extension) ----
511
+ class AXESimproLogoComponent {
512
+ constructor() {
513
+ this.appearance = input('colored', /* @ts-ignore */
514
+ ...(ngDevMode ? [{ debugName: "appearance" }] : /* istanbul ignore next */ []));
515
+ this.size = input(20, /* @ts-ignore */
516
+ ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
517
+ this.markPath = AXE_SIMPRO_MARK_PATH;
518
+ this.markBlue = AXE_SIMPRO_MARK_BLUE;
519
+ this.markGold = AXE_SIMPRO_MARK_GOLD;
520
+ this.resolvedAppearance = computed(() => {
521
+ const value = this.appearance();
522
+ return value === 'monochrome' ? 'monochrome' : 'colored';
523
+ }, /* @ts-ignore */
524
+ ...(ngDevMode ? [{ debugName: "resolvedAppearance" }] : /* istanbul ignore next */ []));
525
+ }
526
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXESimproLogoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
527
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: AXESimproLogoComponent, isStandalone: true, selector: "axe-simpro-logo", inputs: { appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "inline-flex items-center justify-center" }, ngImport: i0, template: `
528
+ @switch (resolvedAppearance()) {
529
+ @case ('monochrome') {
530
+ <svg [attr.width]="size()" [attr.height]="size()" viewBox="0 0 24 24" aria-hidden="true">
531
+ <circle cx="12" cy="12" r="12" fill="currentColor" />
532
+ <path fill="#fff" [attr.d]="markPath" />
533
+ </svg>
534
+ }
535
+ @default {
536
+ <svg [attr.width]="size()" [attr.height]="size()" viewBox="0 0 24 24" aria-hidden="true">
537
+ <circle cx="12" cy="12" r="12" [attr.fill]="markBlue" />
538
+ <path [attr.fill]="markGold" [attr.d]="markPath" />
539
+ </svg>
540
+ }
541
+ }
542
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.Eager }); }
543
+ }
544
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXESimproLogoComponent, decorators: [{
545
+ type: Component,
546
+ args: [{
547
+ selector: 'axe-simpro-logo',
548
+ host: { class: 'inline-flex items-center justify-center' },
549
+ changeDetection: ChangeDetectionStrategy.Eager,
550
+ template: `
551
+ @switch (resolvedAppearance()) {
552
+ @case ('monochrome') {
553
+ <svg [attr.width]="size()" [attr.height]="size()" viewBox="0 0 24 24" aria-hidden="true">
554
+ <circle cx="12" cy="12" r="12" fill="currentColor" />
555
+ <path fill="#fff" [attr.d]="markPath" />
556
+ </svg>
557
+ }
558
+ @default {
559
+ <svg [attr.width]="size()" [attr.height]="size()" viewBox="0 0 24 24" aria-hidden="true">
560
+ <circle cx="12" cy="12" r="12" [attr.fill]="markBlue" />
561
+ <path [attr.fill]="markGold" [attr.d]="markPath" />
562
+ </svg>
563
+ }
564
+ }
565
+ `,
566
+ }]
567
+ }], propDecorators: { appearance: [{ type: i0.Input, args: [{ isSignal: true, alias: "appearance", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
568
+
569
+ var simproLogo_component = /*#__PURE__*/Object.freeze({
570
+ __proto__: null,
571
+ AXESimproLogoComponent: AXESimproLogoComponent
572
+ });
573
+
574
+ /**
575
+ * Generated bundle index. Do not edit.
576
+ */
577
+
578
+ export { AXESimproExtensionModule, AXESimproLogoComponent, AXE_SIMPRO_LOGO_PROVIDER, AXE_SIMPRO_MARK_BLUE, AXE_SIMPRO_MARK_GOLD, AXE_SIMPRO_MARK_PATH, axpSimproLogoKey };
579
+ //# sourceMappingURL=acorex-platform-extension-project-management-simpro-client.mjs.map