@techextensor/tab-sdk 0.0.2 → 0.0.3

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,443 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, Injectable } from '@angular/core';
3
+ import { TabInsertService, TabUpdateService, TabDeleteService, SessionStorageService, LocalStorageService, StorageConstants, MetadataHelper } from '@techextensor/tab-core-utility';
4
+
5
+ class DataService {
6
+ _tabInsertService = inject(TabInsertService);
7
+ _tabUpdateService = inject(TabUpdateService);
8
+ _tabDeleteService = inject(TabDeleteService);
9
+ /**
10
+ * Insert a new record
11
+ *
12
+ * @example
13
+ * const newRecord = await sdk.data.insert('123456', {
14
+ * name: 'ACME Corp',
15
+ * email: 'contact@acme.com'
16
+ * });
17
+ */
18
+ insert(objectId, data) {
19
+ return new Promise((resolve, reject) => {
20
+ this._tabInsertService.insertByObjectId(objectId, { data })
21
+ ?.subscribe((response) => {
22
+ if (response?.StatusCode == 200 && response?.Result) {
23
+ resolve(response.Result);
24
+ }
25
+ else {
26
+ reject(new Error('Failed to insert record'));
27
+ }
28
+ });
29
+ });
30
+ }
31
+ /**
32
+ * Update an existing record
33
+ *
34
+ * @example
35
+ * await sdk.data.update('12345', {
36
+ * Id: '12345',
37
+ * name: 'ACME Corporation',
38
+ * status: 'active'
39
+ * });
40
+ */
41
+ update(objectId, data) {
42
+ return new Promise((resolve, reject) => {
43
+ this._tabUpdateService.updateByObjectId(objectId, { data })
44
+ ?.subscribe((response) => {
45
+ if (response?.StatusCode == 200 && response?.Result) {
46
+ resolve(response.Result);
47
+ }
48
+ else {
49
+ reject(new Error('Failed to update record'));
50
+ }
51
+ });
52
+ });
53
+ }
54
+ /**
55
+ * Delete a record
56
+ *
57
+ * @example
58
+ * await sdk.data.delete('12345', {Id: '12345'});
59
+ */
60
+ delete(objectId, data) {
61
+ return new Promise((resolve, reject) => {
62
+ this._tabDeleteService.deleteRecord('', { data }, objectId)
63
+ ?.subscribe((response) => {
64
+ if (response?.StatusCode == 200) {
65
+ resolve();
66
+ }
67
+ else {
68
+ reject(new Error('Failed to delete record'));
69
+ }
70
+ });
71
+ });
72
+ }
73
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DataService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
74
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DataService, providedIn: 'root' });
75
+ }
76
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DataService, decorators: [{
77
+ type: Injectable,
78
+ args: [{
79
+ providedIn: 'root'
80
+ }]
81
+ }] });
82
+
83
+ class UiService {
84
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: UiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
85
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: UiService, providedIn: 'root' });
86
+ }
87
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: UiService, decorators: [{
88
+ type: Injectable,
89
+ args: [{
90
+ providedIn: 'root'
91
+ }]
92
+ }] });
93
+
94
+ class FormService {
95
+ _helperFunctionService = TabSdk.context?.HelperFunctionService;
96
+ /**
97
+ * Processes form components with individual actions in a single pass
98
+ *
99
+ * @example
100
+ * // Process multiple components with different actions in one pass
101
+ * sdk.form.processComponents(
102
+ * screenParameters.rendererInstance.form.components,
103
+ * [
104
+ * {
105
+ * keys: 'documentDetails', // Single key
106
+ * action: (component) => component.hidden = true,
107
+ * type: 'columns' // Optional type filter
108
+ * },
109
+ * {
110
+ * keys: 'documentPreview,documentComments', // Multiple keys as comma-separated string
111
+ * action: (component) => component.hidden = false
112
+ * }
113
+ * ]
114
+ * );
115
+ */
116
+ processComponents(components, processors) {
117
+ if (!components || !Array.isArray(components) || !processors?.length) {
118
+ return;
119
+ }
120
+ this._helperFunctionService?.eachComponent(components, (component) => {
121
+ processors.forEach(processor => {
122
+ // Split the keys string into an array
123
+ const keyList = processor.keys.split(',').map(k => k.trim());
124
+ // Check if component key is in the list of keys to process
125
+ if (!keyList.includes(component.key))
126
+ return;
127
+ // Check type match if specified
128
+ if (processor.type && component.type !== processor.type)
129
+ return;
130
+ // All criteria matched, execute the action
131
+ processor.action(component);
132
+ });
133
+ });
134
+ }
135
+ /**
136
+ * Updates visibility of multiple form components at once
137
+ *
138
+ * @example
139
+ * sdk.form.setComponentsVisibility(
140
+ * screenParameters.rendererInstance.form.components,
141
+ * {
142
+ * 'documentDetails': false,
143
+ * 'documentComments': true
144
+ * }
145
+ * );
146
+ */
147
+ setComponentsVisibility(components, visibilityMap) {
148
+ const keys = Object.keys(visibilityMap);
149
+ this.processComponents(components, keys.map(key => ({
150
+ keys: key,
151
+ action: (component) => {
152
+ component.hidden = visibilityMap[key];
153
+ }
154
+ })));
155
+ }
156
+ /**
157
+ * Finds components by key and returns them in a structured object
158
+ *
159
+ * @example
160
+ * const components = sdk.form.findComponentsByKeys(
161
+ * form.components,
162
+ * ['documentDetails', 'documentPreview', 'documentComments']
163
+ * );
164
+ */
165
+ findComponentsByKeys(components, keys, options) {
166
+ const result = {};
167
+ if (!components || !Array.isArray(components) || !keys?.length) {
168
+ return result;
169
+ }
170
+ // Use the existing eachComponent helper
171
+ this._helperFunctionService.eachComponent(components, (component) => {
172
+ if (!options?.type || component.type === options.type) {
173
+ result[component.key] = component;
174
+ }
175
+ }, keys);
176
+ return result;
177
+ }
178
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FormService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
179
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FormService, providedIn: 'root' });
180
+ }
181
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FormService, decorators: [{
182
+ type: Injectable,
183
+ args: [{
184
+ providedIn: 'root'
185
+ }]
186
+ }] });
187
+
188
+ class AuthService {
189
+ _sessionStorageService = inject(SessionStorageService);
190
+ _localStorageService = inject(LocalStorageService);
191
+ /**
192
+ * Get the current application code/identifier
193
+ *
194
+ * @example
195
+ * const appCode = sdk.config.getAppCode();
196
+ */
197
+ getAppCode() {
198
+ return this._sessionStorageService.getSessionStorage(StorageConstants.applicationCode) ?? '';
199
+ }
200
+ /**
201
+ * Get the current user ID
202
+ *
203
+ * @example
204
+ * const userId = sdk.auth.getCurrentUserId();
205
+ */
206
+ getCurrentUserId() {
207
+ const userInfo = this.getCurrentUser();
208
+ return userInfo?.user?.Id ?? '';
209
+ }
210
+ /**
211
+ * Get the current user information
212
+ *
213
+ * @example
214
+ * const user = sdk.auth.getCurrentUser();
215
+ */
216
+ getCurrentUser() {
217
+ const userInfoStr = this._localStorageService.getLocalStorage(StorageConstants.userInfo);
218
+ if (userInfoStr) {
219
+ return JSON.parse(userInfoStr);
220
+ }
221
+ return null;
222
+ }
223
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
224
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthService, providedIn: 'root' });
225
+ }
226
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthService, decorators: [{
227
+ type: Injectable,
228
+ args: [{
229
+ providedIn: 'root'
230
+ }]
231
+ }] });
232
+
233
+ class UtilsService {
234
+ _authService = inject(AuthService);
235
+ _helperFunctionService = TabSdk.context?.HelperFunctionService;
236
+ /**
237
+ * Extracts the event name from various event parameter structures
238
+ *
239
+ * @example
240
+ * const eventName = sdk.utils.extractEventName(screenParameters.event);
241
+ * if (eventName === 'deleteDocument') {
242
+ * // Handle delete document event
243
+ * }
244
+ */
245
+ extractEventName(event) {
246
+ if (!event)
247
+ return '';
248
+ // Check common patterns for event names
249
+ return event.event?.component?.configuration?.configScreen?.componentValue?.eventName ??
250
+ event.detail?.type ??
251
+ event.type ??
252
+ event.name ??
253
+ '';
254
+ }
255
+ /**
256
+ * Builds an application URL with the specified path and parameters
257
+ *
258
+ * @example
259
+ * // Get full URL with protocol
260
+ * const fullUrl = sdk.utils.buildAppUrl('screen/12345', { id: '12345' });
261
+ */
262
+ buildAppUrl(path, parameters, includeProtocol = true) {
263
+ const appCode = this._authService.getAppCode();
264
+ const params = new URLSearchParams();
265
+ // Add parameters to the URL
266
+ if (parameters) {
267
+ Object.entries(parameters).forEach(([key, value]) => {
268
+ if (value !== undefined && value !== null) {
269
+ params.append(key, String(value));
270
+ }
271
+ });
272
+ }
273
+ // Build query string
274
+ const queryString = params.toString() ? `?${params.toString()}` : '';
275
+ // Build URL
276
+ if (includeProtocol) {
277
+ const host = window.location.host;
278
+ return `http://${host}/${appCode}/${path}${queryString}`;
279
+ }
280
+ else {
281
+ return `/${appCode}/${path}${queryString}`;
282
+ }
283
+ }
284
+ /**
285
+ * Generates and copies a screen URL to the clipboard
286
+ *
287
+ * @example
288
+ * // Copy URL to clipboard
289
+ * sdk.utils.copyScreenLink('12345', { id: '12345' });
290
+ */
291
+ copyScreenLinkToClipboard(screenId, parameters) {
292
+ const url = this.buildAppUrl(`screen/${screenId}`, parameters);
293
+ return this._helperFunctionService.copyToClipboard(url);
294
+ }
295
+ /**
296
+ * Downloads a blob as a file
297
+ *
298
+ * @example
299
+ * // Download a blob as 'report.pdf'
300
+ * const pdfBlob = new Blob([pdfContent], { type: 'application/pdf' });
301
+ * sdk.utils.downloadBlob(pdfBlob, 'report.pdf');
302
+ */
303
+ downloadBlob(blob, filename) {
304
+ // Create object URL
305
+ const url = URL.createObjectURL(blob);
306
+ // Create download link
307
+ const downloadLink = document.createElement('a');
308
+ downloadLink.href = url;
309
+ downloadLink.download = filename;
310
+ // Append to body, click, and remove
311
+ document.body.appendChild(downloadLink);
312
+ downloadLink.click();
313
+ document.body.removeChild(downloadLink);
314
+ // Release object URL after a short delay to ensure download starts
315
+ setTimeout(() => URL.revokeObjectURL(url), 100);
316
+ }
317
+ /**
318
+ * Exports HTML content as a Word document (.doc)
319
+ *
320
+ * @example
321
+ * // Export editor content as Word document
322
+ * sdk.utils.exportAsWord(editorContent, 'report');
323
+ */
324
+ exportAsWord(content, filename = 'document') {
325
+ // Format content with Word-compatible namespaces
326
+ const docContent = `
327
+ <html xmlns:o="urn:schemas-microsoft-com:office:office"
328
+ xmlns:w="urn:schemas-microsoft-com:office:word"
329
+ xmlns="http://www.w3.org/TR/REC-html40">
330
+ <head>
331
+ <meta charset="utf-8">
332
+ <title>${filename}</title>
333
+ </head>
334
+ <body>${content}</body>
335
+ </html>`;
336
+ // Create blob with BOM for Word compatibility
337
+ const blob = new Blob(['\ufeff', docContent], {
338
+ type: 'application/msword'
339
+ });
340
+ // Use the downloadBlob utility
341
+ this.downloadBlob(blob, `${filename}.doc`);
342
+ }
343
+ /**
344
+ * Exports HTML content as PDF using browser print functionality
345
+ *
346
+ * @example
347
+ * // Export content as PDF
348
+ * sdk.utils.exportAsPdf(documentContent, 'Invoice');
349
+ */
350
+ exportAsPdf(content, title = 'Document') {
351
+ // Open new window
352
+ const printWindow = window.open('', '', 'width=800,height=600');
353
+ // Add content with basic styling
354
+ printWindow.document?.write(`
355
+ <html>
356
+ <head>
357
+ <title>${title}</title>
358
+ <style>
359
+ body { font-family: Arial, sans-serif; margin: 20px; }
360
+ @media print {
361
+ body { margin: 0mm; }
362
+ }
363
+ </style>
364
+ </head>
365
+ <body>
366
+ ${content}
367
+ </body>
368
+ </html>
369
+ `);
370
+ // Prepare for printing
371
+ printWindow.document.close();
372
+ printWindow.focus();
373
+ // Use timeout to ensure content is rendered before printing
374
+ setTimeout(() => {
375
+ printWindow.print();
376
+ // Close window after print dialog is closed or printing is complete
377
+ printWindow.addEventListener('afterprint', () => {
378
+ printWindow.close();
379
+ });
380
+ }, 300);
381
+ }
382
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: UtilsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
383
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: UtilsService, providedIn: 'root' });
384
+ }
385
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: UtilsService, decorators: [{
386
+ type: Injectable,
387
+ args: [{
388
+ providedIn: 'root'
389
+ }]
390
+ }] });
391
+
392
+ class TabSdk {
393
+ static data;
394
+ static ui;
395
+ static form;
396
+ static auth;
397
+ static utils;
398
+ static metadataUtils;
399
+ static context;
400
+ /**
401
+ * Initialize the SDK with necessary services
402
+ */
403
+ static init(injector, context) {
404
+ // Expose to window for global access if needed
405
+ window.TabSdk = TabSdk;
406
+ // external services
407
+ this.context = context;
408
+ // Initialize services
409
+ this.data = injector.get(DataService);
410
+ this.ui = injector.get(UiService);
411
+ this.form = injector.get(FormService);
412
+ this.auth = injector.get(AuthService);
413
+ this.utils = injector.get(UtilsService);
414
+ this.metadataUtils = injector.get(MetadataHelper);
415
+ // Freeze the global object to prevent modifications
416
+ Object.freeze(this);
417
+ Object.freeze(this.context);
418
+ Object.freeze(this.data);
419
+ Object.freeze(this.ui);
420
+ Object.freeze(this.form);
421
+ Object.freeze(this.auth);
422
+ Object.freeze(this.utils);
423
+ }
424
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TabSdk, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
425
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TabSdk, providedIn: 'root' });
426
+ }
427
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TabSdk, decorators: [{
428
+ type: Injectable,
429
+ args: [{
430
+ providedIn: 'root'
431
+ }]
432
+ }] });
433
+
434
+ /*
435
+ * Public API Surface of tab-sdk
436
+ */
437
+
438
+ /**
439
+ * Generated bundle index. Do not edit.
440
+ */
441
+
442
+ export { TabSdk };
443
+ //# sourceMappingURL=techextensor-tab-sdk.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"techextensor-tab-sdk.mjs","sources":["../../../projects/tab-sdk/src/lib/data/data.service.ts","../../../projects/tab-sdk/src/lib/ui/ui.service.ts","../../../projects/tab-sdk/src/lib/ui/form.service.ts","../../../projects/tab-sdk/src/lib/core/auth.service.ts","../../../projects/tab-sdk/src/lib/common/utils.service.ts","../../../projects/tab-sdk/src/lib/tab-sdk.service.ts","../../../projects/tab-sdk/src/public-api.ts","../../../projects/tab-sdk/src/techextensor-tab-sdk.ts"],"sourcesContent":["import { inject, Injectable } from \"@angular/core\";\nimport { TabDeleteService, TabInsertService, TabUpdateService } from '@techextensor/tab-core-utility';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class DataService {\n private readonly _tabInsertService: TabInsertService = inject(TabInsertService);\n private readonly _tabUpdateService: TabUpdateService = inject(TabUpdateService);\n private readonly _tabDeleteService: TabDeleteService = inject(TabDeleteService);\n\n /**\n * Insert a new record\n * \n * @example\n * const newRecord = await sdk.data.insert('123456', {\n * name: 'ACME Corp',\n * email: 'contact@acme.com'\n * });\n */\n insert(objectId: string, data: any): Promise<void> {\n return new Promise((resolve, reject) => {\n this._tabInsertService.insertByObjectId(objectId, { data })\n ?.subscribe((response: any) => {\n if (response?.StatusCode == 200 && response?.Result) {\n resolve(response.Result);\n } else {\n reject(new Error('Failed to insert record'));\n }\n });\n });\n }\n\n /**\n * Update an existing record\n * \n * @example\n * await sdk.data.update('12345', {\n * Id: '12345',\n * name: 'ACME Corporation',\n * status: 'active'\n * });\n */\n update(objectId: string, data: any): Promise<void> {\n return new Promise((resolve, reject) => {\n this._tabUpdateService.updateByObjectId(objectId, { data })\n ?.subscribe((response: any) => {\n if (response?.StatusCode == 200 && response?.Result) {\n resolve(response.Result);\n } else {\n reject(new Error('Failed to update record'));\n }\n });\n });\n }\n\n /**\n * Delete a record\n * \n * @example\n * await sdk.data.delete('12345', {Id: '12345'});\n */\n delete(objectId: string, data: any): Promise<void> {\n return new Promise((resolve, reject) => {\n this._tabDeleteService.deleteRecord('', {data}, objectId)\n ?.subscribe((response: any) => {\n if (response?.StatusCode == 200) {\n resolve();\n } else {\n reject(new Error('Failed to delete record'));\n }\n });\n });\n }\n}","import { Injectable } from \"@angular/core\";\n\n@Injectable({\n providedIn: 'root'\n})\nexport class UiService {}","import { Injectable } from \"@angular/core\";\nimport { TabSdk } from \"../tab-sdk.service\";\n\n@Injectable({\n providedIn: 'root'\n})\nexport class FormService {\n private readonly _helperFunctionService: any = TabSdk.context?.HelperFunctionService;\n\n /**\n * Processes form components with individual actions in a single pass\n * \n * @example\n * // Process multiple components with different actions in one pass\n * sdk.form.processComponents(\n * screenParameters.rendererInstance.form.components,\n * [\n * { \n * keys: 'documentDetails', // Single key\n * action: (component) => component.hidden = true,\n * type: 'columns' // Optional type filter\n * },\n * { \n * keys: 'documentPreview,documentComments', // Multiple keys as comma-separated string\n * action: (component) => component.hidden = false \n * }\n * ]\n * );\n */\n processComponents(\n components: any[],\n processors: Array<{\n keys: string, // Required: Component key(s) to match (comma-separated for multiple)\n type?: string, // Optional: Component type to match\n action: (component: any) => void // Action to perform on matched component\n }>\n ): void {\n if (!components || !Array.isArray(components) || !processors?.length) {\n return;\n }\n\n this._helperFunctionService?.eachComponent(components, (component: any) => {\n processors.forEach(processor => {\n // Split the keys string into an array\n const keyList = processor.keys.split(',').map(k => k.trim());\n\n // Check if component key is in the list of keys to process\n if (!keyList.includes(component.key)) return;\n\n // Check type match if specified\n if (processor.type && component.type !== processor.type) return;\n\n // All criteria matched, execute the action\n processor.action(component);\n });\n });\n }\n\n /**\n * Updates visibility of multiple form components at once\n * \n * @example\n * sdk.form.setComponentsVisibility(\n * screenParameters.rendererInstance.form.components, \n * {\n * 'documentDetails': false,\n * 'documentComments': true\n * }\n * );\n */\n setComponentsVisibility(\n components: any[],\n visibilityMap: Record<string, boolean>\n ): void {\n const keys = Object.keys(visibilityMap);\n\n this.processComponents(components,\n keys.map(key => ({\n keys: key,\n action: (component) => {\n component.hidden = visibilityMap[key];\n }\n }))\n );\n }\n\n /**\n * Finds components by key and returns them in a structured object\n * \n * @example\n * const components = sdk.form.findComponentsByKeys(\n * form.components,\n * ['documentDetails', 'documentPreview', 'documentComments']\n * );\n */\n findComponentsByKeys(\n components: any[],\n keys: string[],\n options?: {\n type?: string\n }\n ): Record<string, any> {\n const result: Record<string, any> = {};\n\n if (!components || !Array.isArray(components) || !keys?.length) {\n return result;\n }\n\n // Use the existing eachComponent helper \n this._helperFunctionService.eachComponent(components, (component: any) => {\n if (!options?.type || component.type === options.type) {\n result[component.key] = component;\n }\n }, keys);\n\n return result;\n }\n}","import { inject, Injectable } from \"@angular/core\";\nimport { LocalStorageService, SessionStorageService, StorageConstants } from \"@techextensor/tab-core-utility\";\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AuthService {\n private readonly _sessionStorageService: SessionStorageService = inject(SessionStorageService);\n private readonly _localStorageService: LocalStorageService = inject(LocalStorageService);\n\n /**\n * Get the current application code/identifier\n * \n * @example\n * const appCode = sdk.config.getAppCode();\n */\n getAppCode(): string {\n return this._sessionStorageService.getSessionStorage(StorageConstants.applicationCode) ?? '';\n }\n\n /**\n * Get the current user ID\n * \n * @example\n * const userId = sdk.auth.getCurrentUserId();\n */\n getCurrentUserId(): string {\n const userInfo = this.getCurrentUser();\n return userInfo?.user?.Id ?? '';\n }\n\n /**\n * Get the current user information\n * \n * @example\n * const user = sdk.auth.getCurrentUser();\n */\n getCurrentUser(): any {\n const userInfoStr = this._localStorageService.getLocalStorage(StorageConstants.userInfo);\n if (userInfoStr) {\n return JSON.parse(userInfoStr);\n }\n\n return null;\n }\n}","import { inject, Injectable } from \"@angular/core\";\nimport { AuthService } from \"../core/auth.service\";\nimport { TabSdk } from \"../tab-sdk.service\";\n\n@Injectable({\n providedIn: 'root'\n})\nexport class UtilsService {\n private readonly _authService: AuthService = inject(AuthService);\n private readonly _helperFunctionService: any = TabSdk.context?.HelperFunctionService;\n \n\n /**\n * Extracts the event name from various event parameter structures\n * \n * @example\n * const eventName = sdk.utils.extractEventName(screenParameters.event);\n * if (eventName === 'deleteDocument') {\n * // Handle delete document event\n * }\n */\n extractEventName(event: any): string {\n if (!event) return '';\n\n // Check common patterns for event names\n return event.event?.component?.configuration?.configScreen?.componentValue?.eventName ??\n event.detail?.type ??\n event.type ??\n event.name ??\n '';\n }\n\n\n /**\n * Builds an application URL with the specified path and parameters\n * \n * @example\n * // Get full URL with protocol\n * const fullUrl = sdk.utils.buildAppUrl('screen/12345', { id: '12345' });\n */\n buildAppUrl(\n path: string,\n parameters?: Record<string, any>,\n includeProtocol: boolean = true\n ): string {\n const appCode = this._authService.getAppCode();\n const params = new URLSearchParams();\n\n // Add parameters to the URL\n if (parameters) {\n Object.entries(parameters).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n params.append(key, String(value));\n }\n });\n }\n\n // Build query string\n const queryString = params.toString() ? `?${params.toString()}` : '';\n\n // Build URL\n if (includeProtocol) {\n const host = window.location.host;\n return `http://${host}/${appCode}/${path}${queryString}`;\n\n } else {\n return `/${appCode}/${path}${queryString}`;\n }\n }\n\n /**\n * Generates and copies a screen URL to the clipboard\n * \n * @example\n * // Copy URL to clipboard\n * sdk.utils.copyScreenLink('12345', { id: '12345' });\n */\n copyScreenLinkToClipboard(\n screenId: string,\n parameters?: Record<string, any>\n ): any {\n const url = this.buildAppUrl(`screen/${screenId}`, parameters); \n return this._helperFunctionService.copyToClipboard(url);\n }\n\n /**\n * Downloads a blob as a file\n * \n * @example\n * // Download a blob as 'report.pdf'\n * const pdfBlob = new Blob([pdfContent], { type: 'application/pdf' });\n * sdk.utils.downloadBlob(pdfBlob, 'report.pdf');\n */\n downloadBlob(blob: Blob, filename: string): void {\n // Create object URL\n const url = URL.createObjectURL(blob);\n\n // Create download link\n const downloadLink = document.createElement('a');\n downloadLink.href = url;\n downloadLink.download = filename;\n\n // Append to body, click, and remove\n document.body.appendChild(downloadLink);\n downloadLink.click();\n document.body.removeChild(downloadLink);\n\n // Release object URL after a short delay to ensure download starts\n setTimeout(() => URL.revokeObjectURL(url), 100);\n }\n\n /**\n * Exports HTML content as a Word document (.doc)\n * \n * @example\n * // Export editor content as Word document\n * sdk.utils.exportAsWord(editorContent, 'report');\n */\n exportAsWord(content: string, filename: string = 'document'): void {\n // Format content with Word-compatible namespaces\n const docContent = `\n <html xmlns:o=\"urn:schemas-microsoft-com:office:office\" \n xmlns:w=\"urn:schemas-microsoft-com:office:word\" \n xmlns=\"http://www.w3.org/TR/REC-html40\">\n <head>\n <meta charset=\"utf-8\">\n <title>${filename}</title>\n </head>\n <body>${content}</body>\n </html>`;\n\n // Create blob with BOM for Word compatibility\n const blob = new Blob(['\\ufeff', docContent], {\n type: 'application/msword'\n });\n\n // Use the downloadBlob utility\n this.downloadBlob(blob, `${filename}.doc`);\n }\n\n\n /**\n * Exports HTML content as PDF using browser print functionality\n * \n * @example\n * // Export content as PDF\n * sdk.utils.exportAsPdf(documentContent, 'Invoice');\n */\n exportAsPdf(content: string, title: string = 'Document'): void {\n // Open new window\n const printWindow: any = window.open('', '', 'width=800,height=600');\n\n // Add content with basic styling\n printWindow.document?.write(`\n <html>\n <head>\n <title>${title}</title>\n <style>\n body { font-family: Arial, sans-serif; margin: 20px; }\n @media print {\n body { margin: 0mm; }\n }\n </style>\n </head>\n <body>\n ${content}\n </body>\n </html>\n `);\n\n // Prepare for printing\n printWindow.document.close();\n printWindow.focus();\n\n // Use timeout to ensure content is rendered before printing\n setTimeout(() => {\n printWindow.print();\n // Close window after print dialog is closed or printing is complete\n printWindow.addEventListener('afterprint', () => {\n printWindow.close();\n });\n }, 300);\n }\n}","import { Injectable, Injector } from '@angular/core';\nimport { DataService } from './data/data.service';\nimport { UiService } from './ui/ui.service';\nimport { FormService } from './ui/form.service';\nimport { AuthService } from './core/auth.service';\nimport { UtilsService } from './common/utils.service';\nimport { MetadataHelper } from '@techextensor/tab-core-utility';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class TabSdk {\n public static data: DataService;\n public static ui: UiService;\n public static form: FormService;\n public static auth: AuthService;\n public static utils: UtilsService;\n public static metadataUtils: MetadataHelper;\n public static context: any;\n\n /**\n * Initialize the SDK with necessary services\n */\n public static init(injector: Injector, context: any): void {\n // Expose to window for global access if needed\n (window as any).TabSdk = TabSdk;\n\n // external services\n this.context = context;\n\n // Initialize services\n this.data = injector.get(DataService);\n this.ui = injector.get(UiService);\n this.form = injector.get(FormService);\n this.auth = injector.get(AuthService);\n this.utils = injector.get(UtilsService);\n this.metadataUtils = injector.get(MetadataHelper);\n\n // Freeze the global object to prevent modifications\n Object.freeze(this);\n Object.freeze(this.context);\n Object.freeze(this.data);\n Object.freeze(this.ui);\n Object.freeze(this.form);\n Object.freeze(this.auth);\n Object.freeze(this.utils);\n }\n}\n","/*\n * Public API Surface of tab-sdk\n */\n\nexport * from './lib/tab-sdk.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAMa,WAAW,CAAA;AACH,IAAA,iBAAiB,GAAqB,MAAM,CAAC,gBAAgB,CAAC;AAC9D,IAAA,iBAAiB,GAAqB,MAAM,CAAC,gBAAgB,CAAC;AAC9D,IAAA,iBAAiB,GAAqB,MAAM,CAAC,gBAAgB,CAAC;AAE/E;;;;;;;;AAQG;IACH,MAAM,CAAC,QAAgB,EAAE,IAAS,EAAA;QAC9B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAI;YACnC,IAAI,CAAC,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UAAA,EAAA,CAAA;AAAN,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,MAAM,cAFL,MAAM,EAAA,CAAA;;4FAEP,MAAM,EAAA,UAAA,EAAA,CAAA;kBAHlB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE;AACb,iBAAA;;;ACVD;;AAEG;;ACFH;;AAEG;;;;"}
package/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="@techextensor/tab-sdk" />
5
+ export * from './public-api';
@@ -0,0 +1,58 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class UtilsService {
3
+ private readonly _authService;
4
+ private readonly _helperFunctionService;
5
+ /**
6
+ * Extracts the event name from various event parameter structures
7
+ *
8
+ * @example
9
+ * const eventName = sdk.utils.extractEventName(screenParameters.event);
10
+ * if (eventName === 'deleteDocument') {
11
+ * // Handle delete document event
12
+ * }
13
+ */
14
+ extractEventName(event: any): string;
15
+ /**
16
+ * Builds an application URL with the specified path and parameters
17
+ *
18
+ * @example
19
+ * // Get full URL with protocol
20
+ * const fullUrl = sdk.utils.buildAppUrl('screen/12345', { id: '12345' });
21
+ */
22
+ buildAppUrl(path: string, parameters?: Record<string, any>, includeProtocol?: boolean): string;
23
+ /**
24
+ * Generates and copies a screen URL to the clipboard
25
+ *
26
+ * @example
27
+ * // Copy URL to clipboard
28
+ * sdk.utils.copyScreenLink('12345', { id: '12345' });
29
+ */
30
+ copyScreenLinkToClipboard(screenId: string, parameters?: Record<string, any>): any;
31
+ /**
32
+ * Downloads a blob as a file
33
+ *
34
+ * @example
35
+ * // Download a blob as 'report.pdf'
36
+ * const pdfBlob = new Blob([pdfContent], { type: 'application/pdf' });
37
+ * sdk.utils.downloadBlob(pdfBlob, 'report.pdf');
38
+ */
39
+ downloadBlob(blob: Blob, filename: string): void;
40
+ /**
41
+ * Exports HTML content as a Word document (.doc)
42
+ *
43
+ * @example
44
+ * // Export editor content as Word document
45
+ * sdk.utils.exportAsWord(editorContent, 'report');
46
+ */
47
+ exportAsWord(content: string, filename?: string): void;
48
+ /**
49
+ * Exports HTML content as PDF using browser print functionality
50
+ *
51
+ * @example
52
+ * // Export content as PDF
53
+ * sdk.utils.exportAsPdf(documentContent, 'Invoice');
54
+ */
55
+ exportAsPdf(content: string, title?: string): void;
56
+ static ɵfac: i0.ɵɵFactoryDeclaration<UtilsService, never>;
57
+ static ɵprov: i0.ɵɵInjectableDeclaration<UtilsService>;
58
+ }
@@ -0,0 +1,28 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class AuthService {
3
+ private readonly _sessionStorageService;
4
+ private readonly _localStorageService;
5
+ /**
6
+ * Get the current application code/identifier
7
+ *
8
+ * @example
9
+ * const appCode = sdk.config.getAppCode();
10
+ */
11
+ getAppCode(): string;
12
+ /**
13
+ * Get the current user ID
14
+ *
15
+ * @example
16
+ * const userId = sdk.auth.getCurrentUserId();
17
+ */
18
+ getCurrentUserId(): string;
19
+ /**
20
+ * Get the current user information
21
+ *
22
+ * @example
23
+ * const user = sdk.auth.getCurrentUser();
24
+ */
25
+ getCurrentUser(): any;
26
+ static ɵfac: i0.ɵɵFactoryDeclaration<AuthService, never>;
27
+ static ɵprov: i0.ɵɵInjectableDeclaration<AuthService>;
28
+ }
@@ -0,0 +1,36 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class DataService {
3
+ private readonly _tabInsertService;
4
+ private readonly _tabUpdateService;
5
+ private readonly _tabDeleteService;
6
+ /**
7
+ * Insert a new record
8
+ *
9
+ * @example
10
+ * const newRecord = await sdk.data.insert('123456', {
11
+ * name: 'ACME Corp',
12
+ * email: 'contact@acme.com'
13
+ * });
14
+ */
15
+ insert(objectId: string, data: any): Promise<void>;
16
+ /**
17
+ * Update an existing record
18
+ *
19
+ * @example
20
+ * await sdk.data.update('12345', {
21
+ * Id: '12345',
22
+ * name: 'ACME Corporation',
23
+ * status: 'active'
24
+ * });
25
+ */
26
+ update(objectId: string, data: any): Promise<void>;
27
+ /**
28
+ * Delete a record
29
+ *
30
+ * @example
31
+ * await sdk.data.delete('12345', {Id: '12345'});
32
+ */
33
+ delete(objectId: string, data: any): Promise<void>;
34
+ static ɵfac: i0.ɵɵFactoryDeclaration<DataService, never>;
35
+ static ɵprov: i0.ɵɵInjectableDeclaration<DataService>;
36
+ }
@@ -0,0 +1,23 @@
1
+ import { Injector } from '@angular/core';
2
+ import { DataService } from './data/data.service';
3
+ import { UiService } from './ui/ui.service';
4
+ import { FormService } from './ui/form.service';
5
+ import { AuthService } from './core/auth.service';
6
+ import { UtilsService } from './common/utils.service';
7
+ import { MetadataHelper } from '@techextensor/tab-core-utility';
8
+ import * as i0 from "@angular/core";
9
+ export declare class TabSdk {
10
+ static data: DataService;
11
+ static ui: UiService;
12
+ static form: FormService;
13
+ static auth: AuthService;
14
+ static utils: UtilsService;
15
+ static metadataUtils: MetadataHelper;
16
+ static context: any;
17
+ /**
18
+ * Initialize the SDK with necessary services
19
+ */
20
+ static init(injector: Injector, context: any): void;
21
+ static ɵfac: i0.ɵɵFactoryDeclaration<TabSdk, never>;
22
+ static ɵprov: i0.ɵɵInjectableDeclaration<TabSdk>;
23
+ }