@masterteam/client-components 0.0.9 → 0.0.10

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.
@@ -2,19 +2,43 @@ import * as i0 from '@angular/core';
2
2
  import { inject, Injectable, input, signal, computed, effect, untracked, Component } from '@angular/core';
3
3
  import { EntitiesPreview } from '@masterteam/components/entities';
4
4
  import { HttpClient } from '@angular/common/http';
5
+ import { forkJoin, map } from 'rxjs';
5
6
 
6
7
  class ClientInstancePreviewApiService {
7
8
  http = inject(HttpClient);
8
- baseUrl = 'data/modules/cards';
9
+ fetchBaseUrl = 'fetch';
10
+ displayConfigBaseUrl = 'display-configurations';
9
11
  resolve(config) {
10
- return this.http.get(this.baseUrl, {
11
- params: {
12
- masterModuleDataId: config.instanceId,
13
- moduleId: config.moduleId,
14
- levelId: config.levelId,
15
- displayAreas: config.displayAreas,
12
+ const contextKey = config.contextKey;
13
+ const areaKeys = config.displayAreas?.length
14
+ ? config.displayAreas
15
+ : ['card'];
16
+ return forkJoin({
17
+ recordResponse: this.http.get(`${this.fetchBaseUrl}/records/${config.instanceId}`, {
18
+ params: { contextKey },
19
+ }),
20
+ displayConfigResponse: this.http.get(this.displayConfigBaseUrl, {
21
+ params: {
22
+ contextKey,
23
+ areaKeys,
24
+ },
25
+ }),
26
+ }).pipe(map(({ recordResponse, displayConfigResponse }) => ({
27
+ endpoint: recordResponse.endpoint,
28
+ status: recordResponse.status,
29
+ code: recordResponse.code,
30
+ locale: recordResponse.locale,
31
+ message: recordResponse.message,
32
+ errors: recordResponse.errors,
33
+ cacheSession: recordResponse.cacheSession,
34
+ data: {
35
+ contextKey,
36
+ schemas: recordResponse.data?.schemas ?? [],
37
+ catalog: recordResponse.data?.catalog ?? { properties: [] },
38
+ record: recordResponse.data?.record ?? null,
39
+ displayConfigurations: displayConfigResponse.data ?? [],
16
40
  },
17
- });
41
+ })));
18
42
  }
19
43
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: ClientInstancePreviewApiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
20
44
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: ClientInstancePreviewApiService, providedIn: 'root' });
@@ -31,7 +55,7 @@ class ClientInstancePreview {
31
55
  loading = signal(false, ...(ngDevMode ? [{ debugName: "loading" }] : []));
32
56
  error = signal(null, ...(ngDevMode ? [{ debugName: "error" }] : []));
33
57
  response = signal(null, ...(ngDevMode ? [{ debugName: "response" }] : []));
34
- entities = computed(() => mapPreviewToEntities(this.response()), ...(ngDevMode ? [{ debugName: "entities" }] : []));
58
+ entities = computed(() => mapPreviewToEntities(this.response(), this.config().displayAreas ?? ['card']), ...(ngDevMode ? [{ debugName: "entities" }] : []));
35
59
  constructor() {
36
60
  effect(() => {
37
61
  const config = this.config();
@@ -72,44 +96,92 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImpor
72
96
  type: Component,
73
97
  args: [{ selector: 'mt-client-instance-preview', standalone: true, imports: [EntitiesPreview], template: "@if (loading()) {\r\n <div class=\"grid grid-cols-1 gap-3 md:grid-cols-2\">\r\n @for (item of [1, 2, 3, 4]; track item) {\r\n <div class=\"rounded-2xl border border-surface-200 bg-surface-50 p-4\">\r\n <div class=\"mb-3 h-4 w-28 animate-pulse rounded bg-surface-200\"></div>\r\n <div class=\"h-5 w-40 animate-pulse rounded bg-surface-200\"></div>\r\n </div>\r\n }\r\n </div>\r\n} @else if (error()) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-2xl border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ error() }}\r\n </p>\r\n </div>\r\n} @else if (entities().length) {\r\n <mt-entities-preview [entities]=\"entities()\" />\r\n} @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-2xl border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n No preview data is available for this instance.\r\n </p>\r\n </div>\r\n}\r\n" }]
74
98
  }], ctorParameters: () => [], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }] } });
75
- // ─── Mapping helpers ───
76
- function buildDisplayConfigLookup(displayConfigurations) {
77
- const lookup = new Map();
78
- for (const config of displayConfigurations) {
79
- for (const prop of config.properties ?? []) {
80
- if (prop.areaKey !== 'card' || !prop.propertyKey)
81
- continue;
82
- lookup.set(prop.propertyKey, prop);
83
- }
99
+ function mapPreviewToEntities(response, areaKeys) {
100
+ const record = response?.record;
101
+ if (!record) {
102
+ return [];
84
103
  }
85
- return lookup;
104
+ const properties = response?.catalog?.properties ?? [];
105
+ const propertyMetaByKey = new Map(properties.map((property) => [property.normalizedKey, property]));
106
+ const displayConfigurations = response?.displayConfigurations ?? [];
107
+ const orderedKeys = resolvePropertyKeys(record, properties, displayConfigurations, areaKeys);
108
+ return orderedKeys
109
+ .map((propertyKey) => toEntityData(propertyKey, record.values?.[propertyKey], propertyMetaByKey.get(propertyKey), displayConfigurations, areaKeys, record.id))
110
+ .filter((entity) => entity !== null);
86
111
  }
87
- function mapPropertiesToEntities(properties, configLookup) {
88
- return properties
89
- .map((prop, index) => {
90
- const displayConfig = configLookup.get(prop.key);
91
- return {
92
- id: prop.propertyId,
93
- propertyId: prop.propertyId,
94
- key: prop.key,
95
- normalizedKey: prop.normalizedKey,
96
- name: prop.name,
97
- rawValue: prop.rawValue,
98
- value: prop.value,
99
- viewType: prop.viewType,
100
- type: prop.type,
101
- order: displayConfig?.order ?? index + 1,
102
- configuration: displayConfig?.configuration ?? { size: 4 },
103
- };
112
+ function resolvePropertyKeys(record, properties, displayConfigurations, areaKeys) {
113
+ const orderedDisplayKeys = new Set();
114
+ displayConfigurations
115
+ .filter((config) => areaKeys.includes(config.areaKey))
116
+ .sort((a, b) => {
117
+ const areaDiff = areaKeys.indexOf(a.areaKey) - areaKeys.indexOf(b.areaKey);
118
+ return areaDiff === 0 ? a.order - b.order : areaDiff;
104
119
  })
105
- .sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
120
+ .forEach((config) => {
121
+ if (config.propertyKey) {
122
+ orderedDisplayKeys.add(config.propertyKey);
123
+ }
124
+ });
125
+ if (orderedDisplayKeys.size) {
126
+ return Array.from(orderedDisplayKeys);
127
+ }
128
+ const propertyKeysWithValues = [...properties]
129
+ .filter((property) => record.values?.[property.normalizedKey] !== undefined)
130
+ .sort((a, b) => a.order - b.order)
131
+ .map((property) => property.normalizedKey);
132
+ if (propertyKeysWithValues.length) {
133
+ return propertyKeysWithValues;
134
+ }
135
+ return Object.keys(record.values ?? {});
106
136
  }
107
- function mapPreviewToEntities(response) {
108
- if (!response?.master?.properties?.length) {
109
- return [];
137
+ function toEntityData(propertyKey, cell, meta, displayConfigurations, areaKeys, recordId) {
138
+ const displayConfig = resolveDisplayConfiguration(propertyKey, displayConfigurations, areaKeys);
139
+ const viewType = toEntityViewType(meta?.viewType);
140
+ return {
141
+ id: recordId,
142
+ propertyId: meta?.id,
143
+ key: meta?.key ?? propertyKey,
144
+ normalizedKey: meta?.normalizedKey ?? propertyKey,
145
+ name: meta?.label ?? propertyKey,
146
+ rawValue: toRawValue(cell?.raw),
147
+ value: toEntityValue(cell, viewType),
148
+ viewType,
149
+ type: meta?.source,
150
+ order: displayConfig?.order,
151
+ configuration: displayConfig?.configuration ?? meta?.configuration ?? undefined,
152
+ };
153
+ }
154
+ function resolveDisplayConfiguration(propertyKey, displayConfigurations, areaKeys) {
155
+ return displayConfigurations
156
+ .filter((config) => config.propertyKey === propertyKey && areaKeys.includes(config.areaKey))
157
+ .sort((a, b) => {
158
+ const areaDiff = areaKeys.indexOf(a.areaKey) - areaKeys.indexOf(b.areaKey);
159
+ return areaDiff === 0 ? a.order - b.order : areaDiff;
160
+ })[0];
161
+ }
162
+ function toEntityValue(cell, viewType) {
163
+ const displayValue = readCellDisplayValue(cell);
164
+ switch (viewType) {
165
+ case 'Status':
166
+ case 'Lookup':
167
+ case 'User':
168
+ case 'Attachment':
169
+ return (cell?.value ?? null);
170
+ default:
171
+ return displayValue;
172
+ }
173
+ }
174
+ function readCellDisplayValue(cell) {
175
+ return String(cell?.display ?? cell?.value ?? cell?.raw ?? '');
176
+ }
177
+ function toRawValue(value) {
178
+ if (value === null || value === undefined) {
179
+ return undefined;
110
180
  }
111
- const configLookup = buildDisplayConfigLookup(response.displayConfigurations ?? []);
112
- return mapPropertiesToEntities(response.master.properties, configLookup);
181
+ return String(value);
182
+ }
183
+ function toEntityViewType(value) {
184
+ return (value ?? 'Text');
113
185
  }
114
186
 
115
187
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"masterteam-client-components-client-instance-preview.mjs","sources":["../../../../packages/masterteam/client-components/client-instance-preview/client-instance-preview-api.service.ts","../../../../packages/masterteam/client-components/client-instance-preview/client-instance-preview.ts","../../../../packages/masterteam/client-components/client-instance-preview/client-instance-preview.html","../../../../packages/masterteam/client-components/client-instance-preview/masterteam-client-components-client-instance-preview.ts"],"sourcesContent":["import { Injectable, inject } from '@angular/core';\r\nimport { HttpClient } from '@angular/common/http';\r\nimport { Observable } from 'rxjs';\r\nimport { PreviewResponse, Response } from './client-instance-preview.model';\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class ClientInstancePreviewApiService {\r\n private readonly http = inject(HttpClient);\r\n private readonly baseUrl = 'data/modules/cards';\r\n\r\n resolve(config: any): Observable<Response<PreviewResponse>> {\r\n return this.http.get<Response<PreviewResponse>>(this.baseUrl, {\r\n params: {\r\n masterModuleDataId: config.instanceId,\r\n moduleId: config.moduleId,\r\n levelId: config.levelId,\r\n displayAreas: config.displayAreas,\r\n },\r\n });\r\n }\r\n}\r\n","import {\n Component,\n computed,\n effect,\n inject,\n input,\n OnDestroy,\n signal,\n untracked,\n} from '@angular/core';\nimport { Subscription } from 'rxjs';\n\r\nimport { EntitiesPreview, EntityData } from '@masterteam/components/entities';\r\n\r\nimport { ClientInstancePreviewApiService } from './client-instance-preview-api.service';\r\nimport {\r\n ClientInstancePreviewConfig,\r\n DisplayConfiguration,\r\n DisplayPropertyConfig,\r\n PreviewProperty,\r\n PreviewResponse,\r\n} from './client-instance-preview.model';\r\n\r\n@Component({\r\n selector: 'mt-client-instance-preview',\r\n standalone: true,\r\n imports: [EntitiesPreview],\r\n templateUrl: './client-instance-preview.html',\r\n})\nexport class ClientInstancePreview implements OnDestroy {\n private readonly clientInstancePreviewApiService = inject(\r\n ClientInstancePreviewApiService,\r\n );\r\n private loadSub?: Subscription;\r\n readonly config = input.required<ClientInstancePreviewConfig>();\r\n readonly loading = signal(false);\r\n readonly error = signal<string | null>(null);\n readonly response = signal<PreviewResponse | null>(null);\n\n readonly entities = computed(() => mapPreviewToEntities(this.response()));\n\n constructor() {\n effect(() => {\n const config = this.config();\n if (!config) {\n return;\n }\n\n untracked(() => this.load(config));\n });\n }\n\n load(config: ClientInstancePreviewConfig): void {\n this.loadSub?.unsubscribe();\n this.loading.set(true);\n this.error.set(null);\n\n this.loadSub = this.clientInstancePreviewApiService\r\n .resolve(config)\r\n .subscribe({\r\n next: (response) => {\r\n this.loading.set(false);\r\n this.response.set(response.data);\r\n },\r\n error: (error) => {\r\n this.loading.set(false);\r\n this.response.set(null);\r\n const message =\r\n error?.error?.message ??\r\n error?.message ??\r\n 'Failed to load instance preview';\r\n this.error.set(message);\r\n },\r\n });\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.loadSub?.unsubscribe();\r\n }\r\n}\r\n\r\n// ─── Mapping helpers ───\r\n\r\nfunction buildDisplayConfigLookup(\r\n displayConfigurations: DisplayConfiguration[],\r\n): Map<string, DisplayPropertyConfig> {\r\n const lookup = new Map<string, DisplayPropertyConfig>();\r\n for (const config of displayConfigurations) {\r\n for (const prop of config.properties ?? []) {\r\n if (prop.areaKey !== 'card' || !prop.propertyKey) continue;\r\n lookup.set(prop.propertyKey, prop);\r\n }\r\n }\r\n return lookup;\r\n}\r\n\r\nfunction mapPropertiesToEntities(\r\n properties: PreviewProperty[],\r\n configLookup: Map<string, DisplayPropertyConfig>,\r\n): EntityData[] {\r\n return properties\r\n .map((prop, index) => {\r\n const displayConfig = configLookup.get(prop.key);\r\n return {\r\n id: prop.propertyId,\r\n propertyId: prop.propertyId,\r\n key: prop.key,\r\n normalizedKey: prop.normalizedKey,\r\n name: prop.name,\r\n rawValue: prop.rawValue,\r\n value: prop.value as EntityData['value'],\r\n viewType: prop.viewType as EntityData['viewType'],\r\n type: prop.type,\r\n order: displayConfig?.order ?? index + 1,\r\n configuration: displayConfig?.configuration ?? { size: 4 },\r\n } as EntityData;\r\n })\r\n .sort((a, b) => (a.order ?? 0) - (b.order ?? 0));\r\n}\r\n\r\nfunction mapPreviewToEntities(response: PreviewResponse | null): EntityData[] {\r\n if (!response?.master?.properties?.length) {\r\n return [];\r\n }\r\n\r\n const configLookup = buildDisplayConfigLookup(\r\n response.displayConfigurations ?? [],\r\n );\r\n\r\n return mapPropertiesToEntities(response.master.properties, configLookup);\r\n}\r\n","@if (loading()) {\r\n <div class=\"grid grid-cols-1 gap-3 md:grid-cols-2\">\r\n @for (item of [1, 2, 3, 4]; track item) {\r\n <div class=\"rounded-2xl border border-surface-200 bg-surface-50 p-4\">\r\n <div class=\"mb-3 h-4 w-28 animate-pulse rounded bg-surface-200\"></div>\r\n <div class=\"h-5 w-40 animate-pulse rounded bg-surface-200\"></div>\r\n </div>\r\n }\r\n </div>\r\n} @else if (error()) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-2xl border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ error() }}\r\n </p>\r\n </div>\r\n} @else if (entities().length) {\r\n <mt-entities-preview [entities]=\"entities()\" />\r\n} @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-2xl border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n No preview data is available for this instance.\r\n </p>\r\n </div>\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAMa,+BAA+B,CAAA;AACzB,IAAA,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC;IACzB,OAAO,GAAG,oBAAoB;AAE/C,IAAA,OAAO,CAAC,MAAW,EAAA;QACjB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAA4B,IAAI,CAAC,OAAO,EAAE;AAC5D,YAAA,MAAM,EAAE;gBACN,kBAAkB,EAAE,MAAM,CAAC,UAAU;gBACrC,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,YAAY,EAAE,MAAM,CAAC,YAAY;AAClC,aAAA;AACF,SAAA,CAAC;IACJ;uGAbW,+BAA+B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAA/B,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,+BAA+B,cADlB,MAAM,EAAA,CAAA;;2FACnB,+BAA+B,EAAA,UAAA,EAAA,CAAA;kBAD3C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;MCwBrB,qBAAqB,CAAA;AACf,IAAA,+BAA+B,GAAG,MAAM,CACvD,+BAA+B,CAChC;AACO,IAAA,OAAO;AACN,IAAA,MAAM,GAAG,KAAK,CAAC,QAAQ,iDAA+B;AACtD,IAAA,OAAO,GAAG,MAAM,CAAC,KAAK,mDAAC;AACvB,IAAA,KAAK,GAAG,MAAM,CAAgB,IAAI,iDAAC;AACnC,IAAA,QAAQ,GAAG,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uBAAuB,CAC9B,UAA6B,EAC7B,YAAgD,EAAA;AAEhD,IAAA,OAAO;AACJ,SAAA,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,KAAI;QACnB,MAAM,aAAa,GAAG,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC;QAChD,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,UAAU;YACnB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,KAAK,EAAE,IAAI,CAAC,KAA4B;YACxC,QAAQ,EAAE,IAAI,CAAC,QAAkC;YACjD,IAAI,EAAE,IAAI,CAAC,IAAI;AACf,YAAA,KAAK,EAAE,aAAa,EAAE,KAAK,IAAI,KAAK,GAAG,CAAC;YACxC,aAAa,EAAE,aAAa,EAAE,aAAa,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE;SAC7C;AACjB,IAAA,CAAC;SACA,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC;AACpD;AAEA,SAAS,oBAAoB,CAAC,QAAgC,EAAA;IAC5D,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE;AACzC,QAAA,OAAO,EAAE;IACX;IAEA,MAAM,YAAY,GAAG,wBAAwB,CAC3C,QAAQ,CAAC,qBAAqB,IAAI,EAAE,CACrC;IAED,OAAO,uBAAuB,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC;AAC1E;;AElIA;;AAEG;;;;"}
1
+ {"version":3,"file":"masterteam-client-components-client-instance-preview.mjs","sources":["../../../../packages/masterteam/client-components/client-instance-preview/client-instance-preview-api.service.ts","../../../../packages/masterteam/client-components/client-instance-preview/client-instance-preview.ts","../../../../packages/masterteam/client-components/client-instance-preview/client-instance-preview.html","../../../../packages/masterteam/client-components/client-instance-preview/masterteam-client-components-client-instance-preview.ts"],"sourcesContent":["import { Injectable, inject } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { forkJoin, map, Observable } from 'rxjs';\nimport {\n ClientInstancePreviewConfig,\n DisplayConfiguration,\n PreviewFetchRecordResponse,\n PreviewResponse,\n Response,\n} from './client-instance-preview.model';\n\n@Injectable({ providedIn: 'root' })\nexport class ClientInstancePreviewApiService {\n private readonly http = inject(HttpClient);\n private readonly fetchBaseUrl = 'fetch';\n private readonly displayConfigBaseUrl = 'display-configurations';\n\n resolve(\n config: ClientInstancePreviewConfig,\n ): Observable<Response<PreviewResponse>> {\n const contextKey = config.contextKey;\n const areaKeys = config.displayAreas?.length\n ? config.displayAreas\n : ['card'];\n\n return forkJoin({\n recordResponse: this.http.get<Response<PreviewFetchRecordResponse>>(\n `${this.fetchBaseUrl}/records/${config.instanceId}`,\n {\n params: { contextKey },\n },\n ),\n displayConfigResponse: this.http.get<Response<DisplayConfiguration[]>>(\n this.displayConfigBaseUrl,\n {\n params: {\n contextKey,\n areaKeys,\n },\n },\n ),\n }).pipe(\n map(({ recordResponse, displayConfigResponse }) => ({\n endpoint: recordResponse.endpoint,\n status: recordResponse.status,\n code: recordResponse.code,\n locale: recordResponse.locale,\n message: recordResponse.message,\n errors: recordResponse.errors,\n cacheSession: recordResponse.cacheSession,\n data: {\n contextKey,\n schemas: recordResponse.data?.schemas ?? [],\n catalog: recordResponse.data?.catalog ?? { properties: [] },\n record: recordResponse.data?.record ?? null,\n displayConfigurations: displayConfigResponse.data ?? [],\n },\n })),\n );\n }\n}\n","import {\n Component,\n computed,\n effect,\n inject,\n input,\n OnDestroy,\n signal,\n untracked,\n} from '@angular/core';\nimport { Subscription } from 'rxjs';\n\nimport { EntitiesPreview, EntityData } from '@masterteam/components/entities';\n\nimport { ClientInstancePreviewApiService } from './client-instance-preview-api.service';\nimport {\n ClientInstancePreviewConfig,\n DisplayConfiguration,\n PreviewFetchPropertyMeta,\n PreviewFetchRecord,\n PreviewFetchValueCell,\n PreviewResponse,\n} from './client-instance-preview.model';\n\n@Component({\n selector: 'mt-client-instance-preview',\n standalone: true,\n imports: [EntitiesPreview],\n templateUrl: './client-instance-preview.html',\n})\nexport class ClientInstancePreview implements OnDestroy {\n private readonly clientInstancePreviewApiService = inject(\n ClientInstancePreviewApiService,\n );\n private loadSub?: Subscription;\n\n readonly config = input.required<ClientInstancePreviewConfig>();\n readonly loading = signal(false);\n readonly error = signal<string | null>(null);\n readonly response = signal<PreviewResponse | null>(null);\n\n readonly entities = computed(() =>\n mapPreviewToEntities(\n this.response(),\n this.config().displayAreas ?? ['card'],\n ),\n );\n\n constructor() {\n effect(() => {\n const config = this.config();\n if (!config) {\n return;\n }\n\n untracked(() => this.load(config));\n });\n }\n\n load(config: ClientInstancePreviewConfig): void {\n this.loadSub?.unsubscribe();\n this.loading.set(true);\n this.error.set(null);\n\n this.loadSub = this.clientInstancePreviewApiService\n .resolve(config)\n .subscribe({\n next: (response) => {\n this.loading.set(false);\n this.response.set(response.data);\n },\n error: (error) => {\n this.loading.set(false);\n this.response.set(null);\n const message =\n error?.error?.message ??\n error?.message ??\n 'Failed to load instance preview';\n this.error.set(message);\n },\n });\n }\n\n ngOnDestroy(): void {\n this.loadSub?.unsubscribe();\n }\n}\n\nfunction mapPreviewToEntities(\n response: PreviewResponse | null,\n areaKeys: string[],\n): EntityData[] {\n const record = response?.record;\n if (!record) {\n return [];\n }\n\n const properties = response?.catalog?.properties ?? [];\n const propertyMetaByKey = new Map(\n properties.map((property) => [property.normalizedKey, property]),\n );\n const displayConfigurations = response?.displayConfigurations ?? [];\n const orderedKeys = resolvePropertyKeys(\n record,\n properties,\n displayConfigurations,\n areaKeys,\n );\n\n return orderedKeys\n .map((propertyKey) =>\n toEntityData(\n propertyKey,\n record.values?.[propertyKey],\n propertyMetaByKey.get(propertyKey),\n displayConfigurations,\n areaKeys,\n record.id,\n ),\n )\n .filter((entity): entity is EntityData => entity !== null);\n}\n\nfunction resolvePropertyKeys(\n record: PreviewFetchRecord,\n properties: PreviewFetchPropertyMeta[],\n displayConfigurations: DisplayConfiguration[],\n areaKeys: string[],\n): string[] {\n const orderedDisplayKeys = new Set<string>();\n\n displayConfigurations\n .filter((config) => areaKeys.includes(config.areaKey))\n .sort((a, b) => {\n const areaDiff =\n areaKeys.indexOf(a.areaKey) - areaKeys.indexOf(b.areaKey);\n\n return areaDiff === 0 ? a.order - b.order : areaDiff;\n })\n .forEach((config) => {\n if (config.propertyKey) {\n orderedDisplayKeys.add(config.propertyKey);\n }\n });\n\n if (orderedDisplayKeys.size) {\n return Array.from(orderedDisplayKeys);\n }\n\n const propertyKeysWithValues = [...properties]\n .filter((property) => record.values?.[property.normalizedKey] !== undefined)\n .sort((a, b) => a.order - b.order)\n .map((property) => property.normalizedKey);\n\n if (propertyKeysWithValues.length) {\n return propertyKeysWithValues;\n }\n\n return Object.keys(record.values ?? {});\n}\n\nfunction toEntityData(\n propertyKey: string,\n cell: PreviewFetchValueCell | undefined,\n meta: PreviewFetchPropertyMeta | undefined,\n displayConfigurations: DisplayConfiguration[],\n areaKeys: string[],\n recordId: number,\n): EntityData | null {\n const displayConfig = resolveDisplayConfiguration(\n propertyKey,\n displayConfigurations,\n areaKeys,\n );\n const viewType = toEntityViewType(meta?.viewType);\n\n return {\n id: recordId,\n propertyId: meta?.id,\n key: meta?.key ?? propertyKey,\n normalizedKey: meta?.normalizedKey ?? propertyKey,\n name: meta?.label ?? propertyKey,\n rawValue: toRawValue(cell?.raw),\n value: toEntityValue(cell, viewType),\n viewType,\n type: meta?.source,\n order: displayConfig?.order,\n configuration:\n displayConfig?.configuration ?? meta?.configuration ?? undefined,\n };\n}\n\nfunction resolveDisplayConfiguration(\n propertyKey: string,\n displayConfigurations: DisplayConfiguration[],\n areaKeys: string[],\n): DisplayConfiguration | undefined {\n return displayConfigurations\n .filter(\n (config) =>\n config.propertyKey === propertyKey && areaKeys.includes(config.areaKey),\n )\n .sort((a, b) => {\n const areaDiff =\n areaKeys.indexOf(a.areaKey) - areaKeys.indexOf(b.areaKey);\n\n return areaDiff === 0 ? a.order - b.order : areaDiff;\n })[0];\n}\n\nfunction toEntityValue(\n cell: PreviewFetchValueCell | undefined,\n viewType: EntityData['viewType'],\n): EntityData['value'] {\n const displayValue = readCellDisplayValue(cell);\n\n switch (viewType) {\n case 'Status':\n case 'Lookup':\n case 'User':\n case 'Attachment':\n return (cell?.value ?? null) as EntityData['value'];\n default:\n return displayValue;\n }\n}\n\nfunction readCellDisplayValue(cell: PreviewFetchValueCell | undefined): string {\n return String(cell?.display ?? cell?.value ?? cell?.raw ?? '');\n}\n\nfunction toRawValue(value: unknown): string | undefined {\n if (value === null || value === undefined) {\n return undefined;\n }\n\n return String(value);\n}\n\nfunction toEntityViewType(value: string | undefined): EntityData['viewType'] {\n return (value ?? 'Text') as EntityData['viewType'];\n}\n","@if (loading()) {\r\n <div class=\"grid grid-cols-1 gap-3 md:grid-cols-2\">\r\n @for (item of [1, 2, 3, 4]; track item) {\r\n <div class=\"rounded-2xl border border-surface-200 bg-surface-50 p-4\">\r\n <div class=\"mb-3 h-4 w-28 animate-pulse rounded bg-surface-200\"></div>\r\n <div class=\"h-5 w-40 animate-pulse rounded bg-surface-200\"></div>\r\n </div>\r\n }\r\n </div>\r\n} @else if (error()) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-2xl border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ error() }}\r\n </p>\r\n </div>\r\n} @else if (entities().length) {\r\n <mt-entities-preview [entities]=\"entities()\" />\r\n} @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-2xl border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n No preview data is available for this instance.\r\n </p>\r\n </div>\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MAYa,+BAA+B,CAAA;AACzB,IAAA,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC;IACzB,YAAY,GAAG,OAAO;IACtB,oBAAoB,GAAG,wBAAwB;AAEhE,IAAA,OAAO,CACL,MAAmC,EAAA;AAEnC,QAAA,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU;AACpC,QAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,YAAY,EAAE;cAClC,MAAM,CAAC;AACT,cAAE,CAAC,MAAM,CAAC;AAEZ,QAAA,OAAO,QAAQ,CAAC;AACd,YAAA,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAC3B,CAAA,EAAG,IAAI,CAAC,YAAY,CAAA,SAAA,EAAY,MAAM,CAAC,UAAU,EAAE,EACnD;gBACE,MAAM,EAAE,EAAE,UAAU,EAAE;aACvB,CACF;YACD,qBAAqB,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAClC,IAAI,CAAC,oBAAoB,EACzB;AACE,gBAAA,MAAM,EAAE;oBACN,UAAU;oBACV,QAAQ;AACT,iBAAA;aACF,CACF;AACF,SAAA,CAAC,CAAC,IAAI,CACL,GAAG,CAAC,CAAC,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM;YAClD,QAAQ,EAAE,cAAc,CAAC,QAAQ;YACjC,MAAM,EAAE,cAAc,CAAC,MAAM;YAC7B,IAAI,EAAE,cAAc,CAAC,IAAI;YACzB,MAAM,EAAE,cAAc,CAAC,MAAM;YAC7B,OAAO,EAAE,cAAc,CAAC,OAAO;YAC/B,MAAM,EAAE,cAAc,CAAC,MAAM;YAC7B,YAAY,EAAE,cAAc,CAAC,YAAY;AACzC,YAAA,IAAI,EAAE;gBACJ,UAAU;AACV,gBAAA,OAAO,EAAE,cAA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