@memberjunction/ng-shared 5.22.0 → 5.23.0
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/dist/lib/__tests__/shared.test.js +3 -10
- package/dist/lib/__tests__/shared.test.js.map +1 -1
- package/dist/lib/shared.service.d.ts +1 -3
- package/dist/lib/shared.service.d.ts.map +1 -1
- package/dist/lib/shared.service.js +4 -7
- package/dist/lib/shared.service.js.map +1 -1
- package/dist/module.d.ts +2 -3
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +2 -6
- package/dist/module.js.map +1 -1
- package/package.json +11 -12
|
@@ -82,10 +82,6 @@ vi.mock('@memberjunction/graphql-dataprovider', () => ({
|
|
|
82
82
|
GraphQLDataProvider: class {
|
|
83
83
|
},
|
|
84
84
|
}));
|
|
85
|
-
vi.mock('@progress/kendo-angular-notification', () => ({
|
|
86
|
-
NotificationService: class {
|
|
87
|
-
},
|
|
88
|
-
}));
|
|
89
85
|
vi.mock('@memberjunction/ng-notifications', () => ({
|
|
90
86
|
MJNotificationService: class {
|
|
91
87
|
static UserNotifications = [];
|
|
@@ -235,10 +231,9 @@ describe('SharedService resource type mapping', () => {
|
|
|
235
231
|
it('should map resource type names to route segments', async () => {
|
|
236
232
|
const { SharedService } = await import('../shared.service');
|
|
237
233
|
// Construct with mocked dependencies
|
|
238
|
-
const notif = { show: vi.fn() };
|
|
239
234
|
const mjNotif = { CreateNotification: vi.fn(), CreateSimpleNotification: vi.fn() };
|
|
240
235
|
const injector = { get: vi.fn() };
|
|
241
|
-
const svc = new SharedService(
|
|
236
|
+
const svc = new SharedService(mjNotif, injector);
|
|
242
237
|
expect(svc.mapResourceTypeNameToRouteSegment('Records')).toBe('record');
|
|
243
238
|
expect(svc.mapResourceTypeNameToRouteSegment('MJ: User Views')).toBe('view');
|
|
244
239
|
expect(svc.mapResourceTypeNameToRouteSegment('Dashboards')).toBe('dashboard');
|
|
@@ -250,10 +245,9 @@ describe('SharedService resource type mapping', () => {
|
|
|
250
245
|
});
|
|
251
246
|
it('should map route segments to resource type names', async () => {
|
|
252
247
|
const { SharedService } = await import('../shared.service');
|
|
253
|
-
const notif = { show: vi.fn() };
|
|
254
248
|
const mjNotif = { CreateNotification: vi.fn(), CreateSimpleNotification: vi.fn() };
|
|
255
249
|
const injector = { get: vi.fn() };
|
|
256
|
-
const svc = new SharedService(
|
|
250
|
+
const svc = new SharedService(mjNotif, injector);
|
|
257
251
|
expect(svc.mapResourceTypeRouteSegmentToName('record')).toBe('records');
|
|
258
252
|
expect(svc.mapResourceTypeRouteSegmentToName('view')).toBe('user views');
|
|
259
253
|
expect(svc.mapResourceTypeRouteSegmentToName('dashboard')).toBe('dashboards');
|
|
@@ -261,10 +255,9 @@ describe('SharedService resource type mapping', () => {
|
|
|
261
255
|
});
|
|
262
256
|
it('should be case-insensitive for resource type mapping', async () => {
|
|
263
257
|
const { SharedService } = await import('../shared.service');
|
|
264
|
-
const notif = { show: vi.fn() };
|
|
265
258
|
const mjNotif = { CreateNotification: vi.fn(), CreateSimpleNotification: vi.fn() };
|
|
266
259
|
const injector = { get: vi.fn() };
|
|
267
|
-
const svc = new SharedService(
|
|
260
|
+
const svc = new SharedService(mjNotif, injector);
|
|
268
261
|
expect(svc.mapResourceTypeNameToRouteSegment('RECORDS')).toBe('record');
|
|
269
262
|
expect(svc.mapResourceTypeNameToRouteSegment(' Records ')).toBe('record');
|
|
270
263
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.test.js","sourceRoot":"","sources":["../../../src/lib/__tests__/shared.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAE9D,4BAA4B;AAC5B,EAAE,CAAC,IAAI,CAAC,eAAe,EAAE,GAAG,EAAE,CAAC,CAAC;IAC9B,IAAI,EAAE,GAAG,EAAE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,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;QAC5D,MAAM,KAAK,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;QAChC,MAAM,OAAO,GAAG,EAAE,kBAAkB,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,wBAAwB,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;QACnF,MAAM,QAAQ,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;QAClC,MAAM,GAAG,GAAG,IAAI,aAAa,CAAC,KAAc,EAAE,OAAgB,EAAE,QAAiB,CAAC,CAAC;QAEnF,MAAM,CAAC,GAAG,CAAC,iCAAiC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACxE,MAAM,CAAC,GAAG,CAAC,iCAAiC,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/**\n * Tests for shared package utilities:\n * - SimpleTextFormatPipe\n * - URLPipe\n * - TitleService\n * - EventCodes / HtmlListType constants\n */\nimport { describe, it, expect, vi, beforeEach } from 'vitest';\n\n// Mock Angular dependencies\nvi.mock('@angular/core', () => ({\n Pipe: () => (target: Function) => target,\n PipeTransform: class {},\n Injectable: () => (target: Function) => target,\n Directive: () => (target: Function) => target,\n Input: () => () => {},\n Output: () => () => {},\n EventEmitter: class { emit() {} },\n ElementRef: class {},\n OnInit: class {},\n OnDestroy: class {},\n Injector: class {},\n}));\n\nvi.mock('@angular/platform-browser', () => ({\n Title: class {\n private title = '';\n setTitle(t: string) { this.title = t; }\n getTitle() { return this.title; }\n }\n}));\n\nvi.mock('@memberjunction/core', () => ({\n Metadata: class {},\n CompositeKey: class {},\n LogError: vi.fn(),\n LogStatus: vi.fn(),\n StartupManager: { Instance: { Startup: vi.fn() } },\n LocalCacheManager: class {},\n BaseEntity: class {},\n RunView: class {},\n}));\n\nvi.mock('@memberjunction/core-entities', () => ({\n ResourcePermissionEngine: { Instance: { ResourceTypes: [] } },\n UserInfoEngine: { Instance: { GetSetting: vi.fn(), SetSetting: vi.fn() } },\n MJResourceTypeEntity: class {},\n MJUserNotificationEntity: class {},\n ArtifactMetadataEngine: { Instance: { Config: vi.fn() } },\n DashboardEngine: { Instance: { Config: vi.fn() } },\n ViewColumnInfo: class {},\n MJDashboardEntityExtended: class {},\n ResourceData: class {\n ResourceRecordID = '';\n },\n}));\n\nvi.mock('@memberjunction/global', () => ({\n MJGlobal: { Instance: { GetEventListener: vi.fn(() => ({ subscribe: vi.fn() })) } },\n MJEventType: { LoggedIn: 'LoggedIn', ComponentEvent: 'ComponentEvent' },\n ConvertMarkdownStringToHtmlList: vi.fn((type: string, text: string) => `<${type}>${text}</${type}>`),\n InvokeManualResize: vi.fn(),\n}));\n\nvi.mock('@memberjunction/ai-engine-base', () => ({\n AIEngineBase: { Instance: { Config: vi.fn() } },\n}));\n\nvi.mock('@memberjunction/entity-communications-base', () => ({\n EntityCommunicationsEngineBase: { Instance: { Config: vi.fn() } },\n}));\n\nvi.mock('@memberjunction/graphql-dataprovider', () => ({\n GraphQLDataProvider: class {},\n}));\n\nvi.mock('@progress/kendo-angular-notification', () => ({\n NotificationService: class {},\n}));\n\nvi.mock('@memberjunction/ng-notifications', () => ({\n MJNotificationService: class {\n static UserNotifications: never[] = [];\n static UnreadUserNotifications: never[] = [];\n static UnreadUserNotificationCount = 0;\n static RefreshUserNotifications = vi.fn();\n CreateNotification = vi.fn();\n CreateSimpleNotification = vi.fn();\n },\n}));\n\nvi.mock('@memberjunction/ng-base-types', () => ({\n BaseAngularComponent: class {},\n}));\n\nvi.mock('@memberjunction/ng-base-application', () => ({\n WorkspaceStateManager: class {},\n ApplicationManager: class {\n GetActiveApp = vi.fn();\n GetAppByName = vi.fn();\n GetAppById = vi.fn();\n },\n NavItem: class {},\n TabRequest: class {},\n}));\n\nvi.mock('rxjs', async () => {\n const actual = await vi.importActual<typeof import('rxjs')>('rxjs');\n return actual;\n});\n\n// ======================= SimpleTextFormatPipe =======================\ndescribe('SimpleTextFormatPipe', () => {\n let pipe: { transform(value: string): string };\n\n beforeEach(async () => {\n const mod = await import('../simpleTextFormat');\n pipe = new mod.SimpleTextFormatPipe();\n });\n\n it('should replace newlines with <br> tags', () => {\n expect(pipe.transform('hello\\nworld')).toBe('hello<br>world');\n });\n\n it('should replace tabs with non-breaking spaces', () => {\n expect(pipe.transform('col1\\tcol2')).toBe('col1 col2');\n });\n\n it('should handle mixed newlines and tabs', () => {\n expect(pipe.transform('line1\\n\\tindented')).toBe('line1<br> indented');\n });\n\n it('should return falsy values as-is', () => {\n expect(pipe.transform('')).toBe('');\n expect(pipe.transform(null as unknown as string)).toBeNull();\n expect(pipe.transform(undefined as unknown as string)).toBeUndefined();\n });\n\n it('should return plain text unchanged', () => {\n expect(pipe.transform('no special chars')).toBe('no special chars');\n });\n});\n\n// ======================= URLPipe =======================\ndescribe('URLPipe', () => {\n let pipe: { transform(value: string): string };\n\n beforeEach(async () => {\n const mod = await import('../urlPipe');\n pipe = new mod.URLPipe();\n });\n\n it('should prepend https:// when no protocol is present', () => {\n expect(pipe.transform('example.com')).toBe('https://example.com');\n });\n\n it('should not modify URLs that already have http', () => {\n expect(pipe.transform('http://example.com')).toBe('http://example.com');\n });\n\n it('should not modify URLs that already have https', () => {\n expect(pipe.transform('https://example.com')).toBe('https://example.com');\n });\n\n it('should return falsy values as-is', () => {\n expect(pipe.transform('')).toBe('');\n expect(pipe.transform(null as unknown as string)).toBeNull();\n });\n});\n\n// ======================= TitleService =======================\ndescribe('TitleService', () => {\n let service: InstanceType<typeof import('../title.service').TitleService>;\n\n beforeEach(async () => {\n const mod = await import('../title.service');\n const { Title } = await import('@angular/platform-browser');\n service = new mod.TitleService(new Title(document));\n });\n\n it('should have default base title of MemberJunction', () => {\n expect(service.getBaseTitle()).toBe('MemberJunction');\n });\n\n it('should build title with base only when no context is set', () => {\n expect(service.getFullTitle()).toBe('MemberJunction');\n });\n\n it('should build title with app name', () => {\n service.setAppName('Sales');\n expect(service.getFullTitle()).toBe('Sales - MemberJunction');\n });\n\n it('should build title with resource name', () => {\n service.setResourceName('Contacts');\n expect(service.getFullTitle()).toBe('Contacts - MemberJunction');\n });\n\n it('should build title with both app and resource (resource first)', () => {\n service.setAppName('Sales');\n service.setResourceName('Contacts');\n expect(service.getFullTitle()).toBe('Contacts - Sales - MemberJunction');\n });\n\n it('should update base title', () => {\n service.setBaseTitle('Skip');\n expect(service.getFullTitle()).toBe('Skip');\n });\n\n it('should set context in one call', () => {\n service.setContext('Marketing', 'Campaigns');\n expect(service.getFullTitle()).toBe('Campaigns - Marketing - MemberJunction');\n });\n\n it('should reset to just base title', () => {\n service.setContext('Marketing', 'Campaigns');\n service.reset();\n expect(service.getFullTitle()).toBe('MemberJunction');\n expect(service.getAppName()).toBeNull();\n expect(service.getResourceName()).toBeNull();\n });\n\n it('should clear app name with null', () => {\n service.setAppName('Sales');\n service.setAppName(null);\n expect(service.getFullTitle()).toBe('MemberJunction');\n });\n});\n\n// ======================= EventCodes & HtmlListType =======================\ndescribe('EventCodes', () => {\n it('should export expected event codes', async () => {\n const { EventCodes } = await import('../shared.service');\n expect(EventCodes.ViewClicked).toBe('ViewClicked');\n expect(EventCodes.EntityRecordClicked).toBe('EntityRecordClicked');\n expect(EventCodes.AddDashboard).toBe('AddDashboard');\n expect(EventCodes.RunSearch).toBe('RunSearch');\n expect(EventCodes.CloseCurrentTab).toBe('CloseCurrentTab');\n expect(EventCodes.AvatarUpdated).toBe('AvatarUpdated');\n });\n});\n\ndescribe('HtmlListType', () => {\n it('should export Unordered and Ordered list types', async () => {\n const { HtmlListType } = await import('../shared.service');\n expect(HtmlListType.Unordered).toBe('Unordered');\n expect(HtmlListType.Ordered).toBe('Ordered');\n });\n});\n\n// ======================= SharedService resource type mapping =======================\ndescribe('SharedService resource type mapping', () => {\n it('should map resource type names to route segments', async () => {\n const { SharedService } = await import('../shared.service');\n // Construct with mocked dependencies\n const notif = { show: vi.fn() };\n const mjNotif = { CreateNotification: vi.fn(), CreateSimpleNotification: vi.fn() };\n const injector = { get: vi.fn() };\n const svc = new SharedService(notif as never, mjNotif as never, injector as never);\n\n expect(svc.mapResourceTypeNameToRouteSegment('Records')).toBe('record');\n expect(svc.mapResourceTypeNameToRouteSegment('MJ: User Views')).toBe('view');\n expect(svc.mapResourceTypeNameToRouteSegment('Dashboards')).toBe('dashboard');\n expect(svc.mapResourceTypeNameToRouteSegment('Reports')).toBe('report');\n expect(svc.mapResourceTypeNameToRouteSegment('Search Results')).toBe('search');\n expect(svc.mapResourceTypeNameToRouteSegment('Queries')).toBe('query');\n expect(svc.mapResourceTypeNameToRouteSegment('Lists')).toBe('list');\n expect(svc.mapResourceTypeNameToRouteSegment('Unknown')).toBeNull();\n });\n\n it('should map route segments to resource type names', async () => {\n const { SharedService } = await import('../shared.service');\n const notif = { show: vi.fn() };\n const mjNotif = { CreateNotification: vi.fn(), CreateSimpleNotification: vi.fn() };\n const injector = { get: vi.fn() };\n const svc = new SharedService(notif as never, mjNotif as never, injector as never);\n\n expect(svc.mapResourceTypeRouteSegmentToName('record')).toBe('records');\n expect(svc.mapResourceTypeRouteSegmentToName('view')).toBe('user views');\n expect(svc.mapResourceTypeRouteSegmentToName('dashboard')).toBe('dashboards');\n expect(svc.mapResourceTypeRouteSegmentToName('nonexistent')).toBeNull();\n });\n\n it('should be case-insensitive for resource type mapping', async () => {\n const { SharedService } = await import('../shared.service');\n const notif = { show: vi.fn() };\n const mjNotif = { CreateNotification: vi.fn(), CreateSimpleNotification: vi.fn() };\n const injector = { get: vi.fn() };\n const svc = new SharedService(notif as never, mjNotif as never, injector as never);\n\n expect(svc.mapResourceTypeNameToRouteSegment('RECORDS')).toBe('record');\n expect(svc.mapResourceTypeNameToRouteSegment(' Records ')).toBe('record');\n });\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KAAK,IAAI,EAAE;QACpE,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;QAC5D,MAAM,OAAO,GAAG,EAAE,kBAAkB,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,wBAAwB,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;QACnF,MAAM,QAAQ,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;QAClC,MAAM,GAAG,GAAG,IAAI,aAAa,CAAC,OAAgB,EAAE,QAAiB,CAAC,CAAC;QAEnE,MAAM,CAAC,GAAG,CAAC,iCAAiC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACxE,MAAM,CAAC,GAAG,CAAC,iCAAiC,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/**\n * Tests for shared package utilities:\n * - SimpleTextFormatPipe\n * - URLPipe\n * - TitleService\n * - EventCodes / HtmlListType constants\n */\nimport { describe, it, expect, vi, beforeEach } from 'vitest';\n\n// Mock Angular dependencies\nvi.mock('@angular/core', () => ({\n Pipe: () => (target: Function) => target,\n PipeTransform: class {},\n Injectable: () => (target: Function) => target,\n Directive: () => (target: Function) => target,\n Input: () => () => {},\n Output: () => () => {},\n EventEmitter: class { emit() {} },\n ElementRef: class {},\n OnInit: class {},\n OnDestroy: class {},\n Injector: class {},\n}));\n\nvi.mock('@angular/platform-browser', () => ({\n Title: class {\n private title = '';\n setTitle(t: string) { this.title = t; }\n getTitle() { return this.title; }\n }\n}));\n\nvi.mock('@memberjunction/core', () => ({\n Metadata: class {},\n CompositeKey: class {},\n LogError: vi.fn(),\n LogStatus: vi.fn(),\n StartupManager: { Instance: { Startup: vi.fn() } },\n LocalCacheManager: class {},\n BaseEntity: class {},\n RunView: class {},\n}));\n\nvi.mock('@memberjunction/core-entities', () => ({\n ResourcePermissionEngine: { Instance: { ResourceTypes: [] } },\n UserInfoEngine: { Instance: { GetSetting: vi.fn(), SetSetting: vi.fn() } },\n MJResourceTypeEntity: class {},\n MJUserNotificationEntity: class {},\n ArtifactMetadataEngine: { Instance: { Config: vi.fn() } },\n DashboardEngine: { Instance: { Config: vi.fn() } },\n ViewColumnInfo: class {},\n MJDashboardEntityExtended: class {},\n ResourceData: class {\n ResourceRecordID = '';\n },\n}));\n\nvi.mock('@memberjunction/global', () => ({\n MJGlobal: { Instance: { GetEventListener: vi.fn(() => ({ subscribe: vi.fn() })) } },\n MJEventType: { LoggedIn: 'LoggedIn', ComponentEvent: 'ComponentEvent' },\n ConvertMarkdownStringToHtmlList: vi.fn((type: string, text: string) => `<${type}>${text}</${type}>`),\n InvokeManualResize: vi.fn(),\n}));\n\nvi.mock('@memberjunction/ai-engine-base', () => ({\n AIEngineBase: { Instance: { Config: vi.fn() } },\n}));\n\nvi.mock('@memberjunction/entity-communications-base', () => ({\n EntityCommunicationsEngineBase: { Instance: { Config: vi.fn() } },\n}));\n\nvi.mock('@memberjunction/graphql-dataprovider', () => ({\n GraphQLDataProvider: class {},\n}));\n\nvi.mock('@memberjunction/ng-notifications', () => ({\n MJNotificationService: class {\n static UserNotifications: never[] = [];\n static UnreadUserNotifications: never[] = [];\n static UnreadUserNotificationCount = 0;\n static RefreshUserNotifications = vi.fn();\n CreateNotification = vi.fn();\n CreateSimpleNotification = vi.fn();\n },\n}));\n\nvi.mock('@memberjunction/ng-base-types', () => ({\n BaseAngularComponent: class {},\n}));\n\nvi.mock('@memberjunction/ng-base-application', () => ({\n WorkspaceStateManager: class {},\n ApplicationManager: class {\n GetActiveApp = vi.fn();\n GetAppByName = vi.fn();\n GetAppById = vi.fn();\n },\n NavItem: class {},\n TabRequest: class {},\n}));\n\nvi.mock('rxjs', async () => {\n const actual = await vi.importActual<typeof import('rxjs')>('rxjs');\n return actual;\n});\n\n// ======================= SimpleTextFormatPipe =======================\ndescribe('SimpleTextFormatPipe', () => {\n let pipe: { transform(value: string): string };\n\n beforeEach(async () => {\n const mod = await import('../simpleTextFormat');\n pipe = new mod.SimpleTextFormatPipe();\n });\n\n it('should replace newlines with <br> tags', () => {\n expect(pipe.transform('hello\\nworld')).toBe('hello<br>world');\n });\n\n it('should replace tabs with non-breaking spaces', () => {\n expect(pipe.transform('col1\\tcol2')).toBe('col1 col2');\n });\n\n it('should handle mixed newlines and tabs', () => {\n expect(pipe.transform('line1\\n\\tindented')).toBe('line1<br> indented');\n });\n\n it('should return falsy values as-is', () => {\n expect(pipe.transform('')).toBe('');\n expect(pipe.transform(null as unknown as string)).toBeNull();\n expect(pipe.transform(undefined as unknown as string)).toBeUndefined();\n });\n\n it('should return plain text unchanged', () => {\n expect(pipe.transform('no special chars')).toBe('no special chars');\n });\n});\n\n// ======================= URLPipe =======================\ndescribe('URLPipe', () => {\n let pipe: { transform(value: string): string };\n\n beforeEach(async () => {\n const mod = await import('../urlPipe');\n pipe = new mod.URLPipe();\n });\n\n it('should prepend https:// when no protocol is present', () => {\n expect(pipe.transform('example.com')).toBe('https://example.com');\n });\n\n it('should not modify URLs that already have http', () => {\n expect(pipe.transform('http://example.com')).toBe('http://example.com');\n });\n\n it('should not modify URLs that already have https', () => {\n expect(pipe.transform('https://example.com')).toBe('https://example.com');\n });\n\n it('should return falsy values as-is', () => {\n expect(pipe.transform('')).toBe('');\n expect(pipe.transform(null as unknown as string)).toBeNull();\n });\n});\n\n// ======================= TitleService =======================\ndescribe('TitleService', () => {\n let service: InstanceType<typeof import('../title.service').TitleService>;\n\n beforeEach(async () => {\n const mod = await import('../title.service');\n const { Title } = await import('@angular/platform-browser');\n service = new mod.TitleService(new Title(document));\n });\n\n it('should have default base title of MemberJunction', () => {\n expect(service.getBaseTitle()).toBe('MemberJunction');\n });\n\n it('should build title with base only when no context is set', () => {\n expect(service.getFullTitle()).toBe('MemberJunction');\n });\n\n it('should build title with app name', () => {\n service.setAppName('Sales');\n expect(service.getFullTitle()).toBe('Sales - MemberJunction');\n });\n\n it('should build title with resource name', () => {\n service.setResourceName('Contacts');\n expect(service.getFullTitle()).toBe('Contacts - MemberJunction');\n });\n\n it('should build title with both app and resource (resource first)', () => {\n service.setAppName('Sales');\n service.setResourceName('Contacts');\n expect(service.getFullTitle()).toBe('Contacts - Sales - MemberJunction');\n });\n\n it('should update base title', () => {\n service.setBaseTitle('Skip');\n expect(service.getFullTitle()).toBe('Skip');\n });\n\n it('should set context in one call', () => {\n service.setContext('Marketing', 'Campaigns');\n expect(service.getFullTitle()).toBe('Campaigns - Marketing - MemberJunction');\n });\n\n it('should reset to just base title', () => {\n service.setContext('Marketing', 'Campaigns');\n service.reset();\n expect(service.getFullTitle()).toBe('MemberJunction');\n expect(service.getAppName()).toBeNull();\n expect(service.getResourceName()).toBeNull();\n });\n\n it('should clear app name with null', () => {\n service.setAppName('Sales');\n service.setAppName(null);\n expect(service.getFullTitle()).toBe('MemberJunction');\n });\n});\n\n// ======================= EventCodes & HtmlListType =======================\ndescribe('EventCodes', () => {\n it('should export expected event codes', async () => {\n const { EventCodes } = await import('../shared.service');\n expect(EventCodes.ViewClicked).toBe('ViewClicked');\n expect(EventCodes.EntityRecordClicked).toBe('EntityRecordClicked');\n expect(EventCodes.AddDashboard).toBe('AddDashboard');\n expect(EventCodes.RunSearch).toBe('RunSearch');\n expect(EventCodes.CloseCurrentTab).toBe('CloseCurrentTab');\n expect(EventCodes.AvatarUpdated).toBe('AvatarUpdated');\n });\n});\n\ndescribe('HtmlListType', () => {\n it('should export Unordered and Ordered list types', async () => {\n const { HtmlListType } = await import('../shared.service');\n expect(HtmlListType.Unordered).toBe('Unordered');\n expect(HtmlListType.Ordered).toBe('Ordered');\n });\n});\n\n// ======================= SharedService resource type mapping =======================\ndescribe('SharedService resource type mapping', () => {\n it('should map resource type names to route segments', async () => {\n const { SharedService } = await import('../shared.service');\n // Construct with mocked dependencies\n const mjNotif = { CreateNotification: vi.fn(), CreateSimpleNotification: vi.fn() };\n const injector = { get: vi.fn() };\n const svc = new SharedService(mjNotif as never, injector as never);\n\n expect(svc.mapResourceTypeNameToRouteSegment('Records')).toBe('record');\n expect(svc.mapResourceTypeNameToRouteSegment('MJ: User Views')).toBe('view');\n expect(svc.mapResourceTypeNameToRouteSegment('Dashboards')).toBe('dashboard');\n expect(svc.mapResourceTypeNameToRouteSegment('Reports')).toBe('report');\n expect(svc.mapResourceTypeNameToRouteSegment('Search Results')).toBe('search');\n expect(svc.mapResourceTypeNameToRouteSegment('Queries')).toBe('query');\n expect(svc.mapResourceTypeNameToRouteSegment('Lists')).toBe('list');\n expect(svc.mapResourceTypeNameToRouteSegment('Unknown')).toBeNull();\n });\n\n it('should map route segments to resource type names', async () => {\n const { SharedService } = await import('../shared.service');\n const mjNotif = { CreateNotification: vi.fn(), CreateSimpleNotification: vi.fn() };\n const injector = { get: vi.fn() };\n const svc = new SharedService(mjNotif as never, injector as never);\n\n expect(svc.mapResourceTypeRouteSegmentToName('record')).toBe('records');\n expect(svc.mapResourceTypeRouteSegmentToName('view')).toBe('user views');\n expect(svc.mapResourceTypeRouteSegmentToName('dashboard')).toBe('dashboards');\n expect(svc.mapResourceTypeRouteSegmentToName('nonexistent')).toBeNull();\n });\n\n it('should be case-insensitive for resource type mapping', async () => {\n const { SharedService } = await import('../shared.service');\n const mjNotif = { CreateNotification: vi.fn(), CreateSimpleNotification: vi.fn() };\n const injector = { get: vi.fn() };\n const svc = new SharedService(mjNotif as never, injector as never);\n\n expect(svc.mapResourceTypeNameToRouteSegment('RECORDS')).toBe('record');\n expect(svc.mapResourceTypeNameToRouteSegment(' Records ')).toBe('record');\n });\n});\n"]}
|
|
@@ -2,11 +2,9 @@ import { ElementRef, Injector } from '@angular/core';
|
|
|
2
2
|
import { CompositeKey } from '@memberjunction/core';
|
|
3
3
|
import { MJResourceTypeEntity, MJUserNotificationEntity, ViewColumnInfo } from '@memberjunction/core-entities';
|
|
4
4
|
import { Observable } from 'rxjs';
|
|
5
|
-
import { NotificationService } from "@progress/kendo-angular-notification";
|
|
6
5
|
import { MJNotificationService } from '@memberjunction/ng-notifications';
|
|
7
6
|
import * as i0 from "@angular/core";
|
|
8
7
|
export declare class SharedService {
|
|
9
|
-
private notificationService;
|
|
10
8
|
private mjNotificationsService;
|
|
11
9
|
private injector;
|
|
12
10
|
private static readonly _globalStoreKey;
|
|
@@ -16,7 +14,7 @@ export declare class SharedService {
|
|
|
16
14
|
private tabChange;
|
|
17
15
|
tabChange$: Observable<unknown>;
|
|
18
16
|
private _navigationService;
|
|
19
|
-
constructor(
|
|
17
|
+
constructor(mjNotificationsService: MJNotificationService, injector: Injector);
|
|
20
18
|
static get Instance(): SharedService;
|
|
21
19
|
/**
|
|
22
20
|
* Pre-warms commonly used engines in the background after login.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.service.d.ts","sourceRoot":"","sources":["../../src/lib/shared.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAc,QAAQ,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,YAAY,EAAyD,MAAM,sBAAsB,CAAC;AAC3G,OAAO,EAAqE,oBAAoB,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAKlL,OAAO,EAAW,UAAU,EAAmC,MAAM,MAAM,CAAC;AAE5E,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"shared.service.d.ts","sourceRoot":"","sources":["../../src/lib/shared.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAc,QAAQ,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,YAAY,EAAyD,MAAM,sBAAsB,CAAC;AAC3G,OAAO,EAAqE,oBAAoB,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAKlL,OAAO,EAAW,UAAU,EAAmC,MAAM,MAAM,CAAC;AAE5E,OAAO,EAAE,qBAAqB,EAAE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EAAE,UAAU,EAAE,YAAY;yCAlUzD,aAAa;6CAAb,aAAa;CA6UzB;AAED,eAAO,MAAM,YAAY;;;CAGf,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAG1E,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;CAgBb,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC"}
|
|
@@ -9,10 +9,8 @@ import { first, tap } from 'rxjs/operators';
|
|
|
9
9
|
import { MJNotificationService } from '@memberjunction/ng-notifications';
|
|
10
10
|
import { NavigationService } from './navigation.service';
|
|
11
11
|
import * as i0 from "@angular/core";
|
|
12
|
-
import * as i1 from "@
|
|
13
|
-
import * as i2 from "@memberjunction/ng-notifications";
|
|
12
|
+
import * as i1 from "@memberjunction/ng-notifications";
|
|
14
13
|
export class SharedService {
|
|
15
|
-
notificationService;
|
|
16
14
|
mjNotificationsService;
|
|
17
15
|
injector;
|
|
18
16
|
static _globalStoreKey = '___SINGLETON__SharedService';
|
|
@@ -22,8 +20,7 @@ export class SharedService {
|
|
|
22
20
|
tabChange = new Subject();
|
|
23
21
|
tabChange$ = this.tabChange.asObservable();
|
|
24
22
|
_navigationService = null;
|
|
25
|
-
constructor(
|
|
26
|
-
this.notificationService = notificationService;
|
|
23
|
+
constructor(mjNotificationsService, injector) {
|
|
27
24
|
this.mjNotificationsService = mjNotificationsService;
|
|
28
25
|
this.injector = injector;
|
|
29
26
|
const g = GetGlobalObjectStore();
|
|
@@ -295,7 +292,7 @@ export class SharedService {
|
|
|
295
292
|
LogError(e);
|
|
296
293
|
}
|
|
297
294
|
}
|
|
298
|
-
static ɵfac = function SharedService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || SharedService)(i0.ɵɵinject(i1.
|
|
295
|
+
static ɵfac = function SharedService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || SharedService)(i0.ɵɵinject(i1.MJNotificationService), i0.ɵɵinject(i0.Injector)); };
|
|
299
296
|
static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: SharedService, factory: SharedService.ɵfac, providedIn: 'root' });
|
|
300
297
|
}
|
|
301
298
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SharedService, [{
|
|
@@ -303,7 +300,7 @@ export class SharedService {
|
|
|
303
300
|
args: [{
|
|
304
301
|
providedIn: 'root'
|
|
305
302
|
}]
|
|
306
|
-
}], () => [{ type: i1.
|
|
303
|
+
}], () => [{ type: i1.MJNotificationService }, { type: i0.Injector }], null); })();
|
|
307
304
|
export const HtmlListType = {
|
|
308
305
|
Unordered: 'Unordered',
|
|
309
306
|
Ordered: 'Ordered',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.service.js","sourceRoot":"","sources":["../../src/lib/shared.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,UAAU,EAAY,MAAM,eAAe,CAAC;AACjE,OAAO,EAAmC,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3G,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,wBAAwB,EAAkE,MAAM,+BAA+B,CAAC;AAClL,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,+BAA+B,EAAE,kBAAkB,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEtJ,OAAO,EAAE,OAAO,EAAc,eAAe,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAC5E,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,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AE,eAAe;CACtB,CAAC","sourcesContent":["import { ElementRef, Injectable, Injector } from '@angular/core';\nimport { CompositeKey, LocalCacheManager, LogError, Metadata, StartupManager } from '@memberjunction/core';\nimport { ArtifactMetadataEngine, DashboardEngine, ResourcePermissionEngine, MJResourceTypeEntity, MJUserNotificationEntity, ViewColumnInfo } from '@memberjunction/core-entities';\nimport { AIEngineBase } from '@memberjunction/ai-engine-base';\nimport { EntityCommunicationsEngineBase } from \"@memberjunction/entity-communications-base\";\nimport { MJEventType, MJGlobal, ConvertMarkdownStringToHtmlList, InvokeManualResize, UUIDsEqual, GetGlobalObjectStore } from '@memberjunction/global';\nimport { GraphQLDataProvider } from '@memberjunction/graphql-dataprovider';\nimport { Subject, Observable, BehaviorSubject, firstValueFrom } from 'rxjs';\nimport { first, tap } from 'rxjs/operators';\nimport { NotificationService } from \"@progress/kendo-angular-notification\";\nimport { MJNotificationService } from '@memberjunction/ng-notifications';\nimport { NavigationService } from './navigation.service';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class SharedService {\n private static readonly _globalStoreKey = '___SINGLETON__SharedService';\n private static _loaded: boolean = false;\n private static _resourceTypes: MJResourceTypeEntity[] = [];\n private static isLoading$ = new BehaviorSubject<boolean>(false);\n private tabChange = new Subject();\n tabChange$ = this.tabChange.asObservable();\n private _navigationService: NavigationService | null = null;\n\n constructor(\n private notificationService: NotificationService,\n private mjNotificationsService: MJNotificationService,\n private injector: Injector\n ) {\n const g = GetGlobalObjectStore()!;\n if (g[SharedService._globalStoreKey]) {\n return g[SharedService._globalStoreKey] as SharedService;\n }\n g[SharedService._globalStoreKey] = this;\n\n MJGlobal.Instance.GetEventListener(true).subscribe(async (event) => {\n switch (event.event) {\n case MJEventType.LoggedIn:\n if (SharedService._loaded === false) {\n // Pre-warm non-critical engines IMMEDIATELY on LoggedIn, before\n // StartupManager.Startup() completes. These engines only need\n // Metadata.Provider (set during setupGraphQLClient's provider.Config()).\n // Firing them here allows their RunViews calls to be coalesced with\n // the startup engines' calls into fewer mega-batched GraphQL requests.\n SharedService.preWarmEngines();\n\n // Handle app startup — joins the same Startup() promise that\n // setupGraphQLClient kicked off.\n await StartupManager.Instance.Startup();\n\n await SharedService.RefreshData(false);\n }\n break;\n }\n }); \n }\n\n public static get Instance(): SharedService {\n return GetGlobalObjectStore()![SharedService._globalStoreKey] as SharedService;\n }\n\n /**\n * Pre-warms commonly used engines in the background after login.\n * This reduces perceived latency when users navigate to features like\n * Conversations, Dashboards, or Artifacts. Fire-and-forget pattern -\n * errors are logged but don't block the UI.\n */\n private static preWarmEngines(): void {\n // AIEngineBase is the slowest - loads agents, models, prompts, etc.\n // Critical for Conversations feature\n AIEngineBase.Instance.Config(false).catch(err =>\n LogError(`Failed to pre-warm AIEngineBase: ${err}`)\n );\n\n // ArtifactMetadataEngine is lightweight (just artifact types)\n // Used by Conversations and Artifact viewer\n ArtifactMetadataEngine.Instance.Config(false).catch(err =>\n LogError(`Failed to pre-warm ArtifactMetadataEngine: ${err}`)\n );\n\n // DashboardEngine loads dashboard metadata\n // Used when viewing dashboards\n DashboardEngine.Instance.Config(false).catch(err =>\n LogError(`Failed to pre-warm DashboardEngine: ${err}`)\n );\n\n EntityCommunicationsEngineBase.Instance.Config(false).catch(err =>\n LogError(`Failed to pre-warm DashboardEngine: ${err}`)\n );\n }\n\n /**\n * Get the NavigationService singleton instance\n * Lazy-loaded to avoid circular dependency issues\n */\n private get navigationService(): NavigationService {\n if (!this._navigationService) {\n this._navigationService = this.injector.get(NavigationService);\n }\n return this._navigationService;\n }\n\n /**\n * Get the neutral color used for system-wide resources\n */\n public get ExplorerAppColor(): string {\n return this.navigationService.ExplorerAppColor;\n }\n\n /**\n * Returns the current session ID, which is automatically created when the service is instantiated.\n */\n public get SessionId(): string {\n return (<GraphQLDataProvider>Metadata.Provider).sessionId;\n }\n\n public get ResourceTypes(): MJResourceTypeEntity[] {\n return SharedService._resourceTypes;\n }\n public get ViewResourceType(): MJResourceTypeEntity {\n return SharedService._resourceTypes.find(rt => rt.Name.trim().toLowerCase() === 'user views')!;\n }\n public get RecordResourceType(): MJResourceTypeEntity {\n return SharedService._resourceTypes.find(rt => rt.Name.trim().toLowerCase() === 'records')!;\n }\n public get DashboardResourceType(): MJResourceTypeEntity {\n return SharedService._resourceTypes.find(rt => rt.Name.trim().toLowerCase() === 'dashboards')!;\n }\n public get ReportResourceType(): MJResourceTypeEntity {\n return SharedService._resourceTypes.find(rt => rt.Name.trim().toLowerCase() === 'reports')!;\n }\n public get SearchResultsResourceType(): MJResourceTypeEntity {\n return SharedService._resourceTypes.find(rt => rt.Name.trim().toLowerCase() === 'search results')!;\n }\n public get ListResourceType(): MJResourceTypeEntity {\n return SharedService._resourceTypes.find(rt => rt.Name.trim().toLowerCase() === 'lists')!;\n }\n public ResourceTypeByID(id: string): MJResourceTypeEntity | undefined {\n return SharedService._resourceTypes.find(rt => UUIDsEqual(rt.ID, id));\n }\n public ResourceTypeByName(name: string): MJResourceTypeEntity | undefined {\n return SharedService._resourceTypes.find(rt => rt.Name.trim().toLowerCase() === name.trim().toLowerCase());\n }\n\n /**\n * Refreshes the data for the service. If OnlyIfNeeded is true, then the data is only refreshed if it hasn't been loaded yet.\n */\n public static async RefreshData(OnlyIfNeeded: boolean = false) {\n if (OnlyIfNeeded && SharedService._loaded) {\n return;\n }\n\n const canProceed$ = SharedService.isLoading$.pipe(\n first(isLoading => !isLoading),\n tap(() => SharedService.isLoading$.next(true))\n );\n\n await firstValueFrom(canProceed$);\n\n try {\n // After waiting for the current loading operation to complete, check again\n // if _loaded is true and OnlyIfNeeded is true, return early\n if (OnlyIfNeeded && SharedService._loaded) {\n return;\n }\n\n await SharedService.handleDataLoading();\n\n // Mark as loaded\n SharedService._loaded = true;\n } finally {\n // Ensure we always reset the loading flag\n SharedService.isLoading$.next(false);\n }\n }\n\n private static async handleDataLoading() {\n const md = new Metadata();\n\n // make sure startup is done\n await StartupManager.Instance.Startup(); \n\n this._resourceTypes = ResourcePermissionEngine.Instance.ResourceTypes;\n\n // Note: RefreshUserNotifications() removed here because MJNotificationService\n // already handles it via its own MJEventType.LoggedIn subscription. Calling it\n // from both places caused a duplicate User Notifications GraphQL request on login.\n } \n\n FormatColumnValue(col: ViewColumnInfo, value: any, maxLength: number = 0, trailingChars: string = \"...\") {\n if (value === null || value === undefined)\n return value;\n\n try {\n const retVal = col.EntityField.FormatValue(value, 0);\n if (maxLength > 0 && retVal && retVal.length > maxLength)\n return retVal.substring(0, maxLength) + trailingChars;\n else\n return retVal;\n }\n catch (e) {\n LogError(e);\n return value;\n }\n }\n\n public ConvertMarkdownStringToHtmlList(listType: HtmlListType, text: string): string {\n return ConvertMarkdownStringToHtmlList(listType, text) ?? text;\n }\n\n \n public InvokeManualResize(delay: number = 50) {\n return InvokeManualResize(delay, this);\n }\n\n public PushStatusUpdates(): Observable<string> {\n const gp: GraphQLDataProvider = <GraphQLDataProvider>Metadata.Provider;\n return gp.PushStatusUpdates();\n }\n\n private _currentUserImage: string | Blob = '/assets/user.png';\n public get CurrentUserImage(): string | Blob {\n return this._currentUserImage;\n }\n public set CurrentUserImage(value: string | Blob) {\n this._currentUserImage = value;\n }\n\n /**\n * @deprecated Use MJNotificationService.UserNotifications instead\n */\n public static get UserNotifications(): MJUserNotificationEntity[] {\n return MJNotificationService.UserNotifications;\n }\n /**\n * @deprecated Use MJNotificationService.UnreadUserNotifications instead\n */\n public static get UnreadUserNotifications(): MJUserNotificationEntity[] {\n return MJNotificationService.UnreadUserNotifications;\n }\n /**\n * @deprecated Use MJNotificationService.UnreadUserNotificationCount instead\n */\n public static get UnreadUserNotificationCount(): number {\n return MJNotificationService.UnreadUserNotificationCount;\n }\n\n /**\n * Utility method that returns true if child is a descendant of parent, false otherwise. \n */\n public static IsDescendant(parent: ElementRef, child: ElementRef) {\n if (parent && child && parent.nativeElement && child.nativeElement) {\n let node = child.nativeElement.parentNode;\n while (node != null) {\n if (node == parent.nativeElement) {\n return true;\n }\n node = node.parentNode;\n }\n }\n return false;\n }\n\n\n /**\n * Creates a notification in the database and refreshes the UI. Returns the notification object.\n * @param title \n * @param message \n * @param resourceTypeId \n * @param resourceRecordId \n * @param resourceConfiguration Any object, it is converted to a string by JSON.stringify and stored in the database\n * @returns \n * @deprecated Use MJNotificationService.CreateNotification instead\n */\n public async CreateNotification(title: string, message: string, resourceTypeId: string | null, resourceRecordId: string | null, resourceConfiguration: any | null, displayToUser : boolean = true): Promise<MJUserNotificationEntity> {\n return this.mjNotificationsService.CreateNotification(title, message, resourceTypeId, resourceRecordId, resourceConfiguration, displayToUser);\n }\n\n /**\n * @deprecated Use MJNotificationService.RefreshUserNotifications instead\n */\n public static async RefreshUserNotifications() {\n MJNotificationService.RefreshUserNotifications();\n }\n\n /**\n * Creates a message that is not saved to the User Notifications table, but is displayed to the user.\n * @param message - text to display\n * @param style - display styling\n * @param hideAfter - option to auto hide after the specified delay in milliseconds\n * @deprecated Use MJNotificationService.CreateSimpleNotification instead\n */\n public CreateSimpleNotification(message: string, style: \"none\" | \"success\" | \"error\" | \"warning\" | \"info\" = \"success\", hideAfter?: number) {\n return this.mjNotificationsService.CreateSimpleNotification(message, style, hideAfter);\n }\n\n\n\n private _resourceTypeMap = [\n { routeSegment: 'record', name: 'records' },\n { routeSegment: 'view', name: 'user views' },\n { routeSegment: 'search', name: 'search results' },\n { routeSegment: 'report', name: 'reports' },\n { routeSegment: 'query', name: 'queries' },\n { routeSegment: 'dashboard', name: 'dashboards' },\n { routeSegment: 'list', name: 'lists' },\n \n ]\n /**\n * Maps a Resource Type record Name column to the corresponding route segment\n * @param resourceTypeName \n * @returns \n */\n public mapResourceTypeNameToRouteSegment(resourceTypeName: string) {\n const item = this._resourceTypeMap.find(rt => rt.name.trim().toLowerCase() === resourceTypeName.trim().toLowerCase());\n if (item)\n return item.routeSegment;\n else\n return null \n }\n\n /**\n * Maps a route segment to the corresponding Resource Type record Name column\n * @param resourceRouteSegment \n * @returns \n */\n public mapResourceTypeRouteSegmentToName(resourceRouteSegment: string) {\n const item = this._resourceTypeMap.find(rt => rt.routeSegment.trim().toLowerCase() === resourceRouteSegment.trim().toLowerCase());\n if (item)\n return item.name;\n else\n return null \n }\n\n /**\n * Opens an entity record in a new or existing tab\n * Uses the modern NavigationService for tab-based navigation\n */\n public OpenEntityRecord(entityName: string, recordPkey: CompositeKey) {\n try {\n console.log('SharedService.OpenEntityRecord called:', entityName, recordPkey.ToURLSegment());\n // Use NavigationService to open in new tab-based UX\n this.navigationService.OpenEntityRecord(entityName, recordPkey);\n }\n catch (e) {\n console.error('Error in OpenEntityRecord:', e);\n LogError(e);\n }\n }\n}\n\nexport const HtmlListType = {\n Unordered: 'Unordered',\n Ordered: 'Ordered',\n} as const;\n\nexport type HtmlListType = typeof HtmlListType[keyof typeof HtmlListType];\n\n\nexport const EventCodes = {\n ViewClicked: \"ViewClicked\",\n EntityRecordClicked: \"EntityRecordClicked\",\n AddDashboard: \"AddDashboard\",\n AddReport: \"AddReport\",\n AddQuery: \"AddQuery\",\n ViewCreated: \"ViewCreated\",\n ViewUpdated: \"ViewUpdated\",\n RunSearch: \"RunSearch\",\n ViewNotifications: \"ViewNotifications\",\n PushStatusUpdates: \"PushStatusUpdates\",\n UserNotificationsUpdated: \"UserNotificationsUpdated\",\n CloseCurrentTab: \"CloseCurrentTab\",\n ListCreated: \"ListCreated\",\n ListClicked: 'ListClicked',\n AvatarUpdated: 'AvatarUpdated'\n} as const;\n\nexport type EventCodes = typeof EventCodes[keyof typeof EventCodes];"]}
|
|
1
|
+
{"version":3,"file":"shared.service.js","sourceRoot":"","sources":["../../src/lib/shared.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,UAAU,EAAY,MAAM,eAAe,CAAC;AACjE,OAAO,EAAmC,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3G,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,wBAAwB,EAAkE,MAAM,+BAA+B,CAAC;AAClL,OAAO,EAAE,YAAY,EAAE,MAA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qBAAqB;IAC1C,YAAY,EAAE,cAAc;IAC5B,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,UAAU;IACpB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,aAAa;IAC1B,SAAS,EAAE,WAAW;IACtB,iBAAiB,EAAE,mBAAmB;IACtC,iBAAiB,EAAE,mBAAmB;IACtC,wBAAwB,EAAE,0BAA0B;IACpD,eAAe,EAAE,iBAAiB;IAClC,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,aAAa;IAC1B,aAAa,EAAE,eAAe;CACtB,CAAC","sourcesContent":["import { ElementRef, Injectable, Injector } from '@angular/core';\nimport { CompositeKey, LocalCacheManager, LogError, Metadata, StartupManager } from '@memberjunction/core';\nimport { ArtifactMetadataEngine, DashboardEngine, ResourcePermissionEngine, MJResourceTypeEntity, MJUserNotificationEntity, ViewColumnInfo } from '@memberjunction/core-entities';\nimport { AIEngineBase } from '@memberjunction/ai-engine-base';\nimport { EntityCommunicationsEngineBase } from \"@memberjunction/entity-communications-base\";\nimport { MJEventType, MJGlobal, ConvertMarkdownStringToHtmlList, InvokeManualResize, UUIDsEqual, GetGlobalObjectStore } from '@memberjunction/global';\nimport { GraphQLDataProvider } from '@memberjunction/graphql-dataprovider';\nimport { Subject, Observable, BehaviorSubject, firstValueFrom } from 'rxjs';\nimport { first, tap } from 'rxjs/operators';\nimport { MJNotificationService } from '@memberjunction/ng-notifications';\nimport { NavigationService } from './navigation.service';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class SharedService {\n private static readonly _globalStoreKey = '___SINGLETON__SharedService';\n private static _loaded: boolean = false;\n private static _resourceTypes: MJResourceTypeEntity[] = [];\n private static isLoading$ = new BehaviorSubject<boolean>(false);\n private tabChange = new Subject();\n tabChange$ = this.tabChange.asObservable();\n private _navigationService: NavigationService | null = null;\n\n constructor(\n private mjNotificationsService: MJNotificationService,\n private injector: Injector\n ) {\n const g = GetGlobalObjectStore()!;\n if (g[SharedService._globalStoreKey]) {\n return g[SharedService._globalStoreKey] as SharedService;\n }\n g[SharedService._globalStoreKey] = this;\n\n MJGlobal.Instance.GetEventListener(true).subscribe(async (event) => {\n switch (event.event) {\n case MJEventType.LoggedIn:\n if (SharedService._loaded === false) {\n // Pre-warm non-critical engines IMMEDIATELY on LoggedIn, before\n // StartupManager.Startup() completes. These engines only need\n // Metadata.Provider (set during setupGraphQLClient's provider.Config()).\n // Firing them here allows their RunViews calls to be coalesced with\n // the startup engines' calls into fewer mega-batched GraphQL requests.\n SharedService.preWarmEngines();\n\n // Handle app startup — joins the same Startup() promise that\n // setupGraphQLClient kicked off.\n await StartupManager.Instance.Startup();\n\n await SharedService.RefreshData(false);\n }\n break;\n }\n }); \n }\n\n public static get Instance(): SharedService {\n return GetGlobalObjectStore()![SharedService._globalStoreKey] as SharedService;\n }\n\n /**\n * Pre-warms commonly used engines in the background after login.\n * This reduces perceived latency when users navigate to features like\n * Conversations, Dashboards, or Artifacts. Fire-and-forget pattern -\n * errors are logged but don't block the UI.\n */\n private static preWarmEngines(): void {\n // AIEngineBase is the slowest - loads agents, models, prompts, etc.\n // Critical for Conversations feature\n AIEngineBase.Instance.Config(false).catch(err =>\n LogError(`Failed to pre-warm AIEngineBase: ${err}`)\n );\n\n // ArtifactMetadataEngine is lightweight (just artifact types)\n // Used by Conversations and Artifact viewer\n ArtifactMetadataEngine.Instance.Config(false).catch(err =>\n LogError(`Failed to pre-warm ArtifactMetadataEngine: ${err}`)\n );\n\n // DashboardEngine loads dashboard metadata\n // Used when viewing dashboards\n DashboardEngine.Instance.Config(false).catch(err =>\n LogError(`Failed to pre-warm DashboardEngine: ${err}`)\n );\n\n EntityCommunicationsEngineBase.Instance.Config(false).catch(err =>\n LogError(`Failed to pre-warm DashboardEngine: ${err}`)\n );\n }\n\n /**\n * Get the NavigationService singleton instance\n * Lazy-loaded to avoid circular dependency issues\n */\n private get navigationService(): NavigationService {\n if (!this._navigationService) {\n this._navigationService = this.injector.get(NavigationService);\n }\n return this._navigationService;\n }\n\n /**\n * Get the neutral color used for system-wide resources\n */\n public get ExplorerAppColor(): string {\n return this.navigationService.ExplorerAppColor;\n }\n\n /**\n * Returns the current session ID, which is automatically created when the service is instantiated.\n */\n public get SessionId(): string {\n return (<GraphQLDataProvider>Metadata.Provider).sessionId;\n }\n\n public get ResourceTypes(): MJResourceTypeEntity[] {\n return SharedService._resourceTypes;\n }\n public get ViewResourceType(): MJResourceTypeEntity {\n return SharedService._resourceTypes.find(rt => rt.Name.trim().toLowerCase() === 'user views')!;\n }\n public get RecordResourceType(): MJResourceTypeEntity {\n return SharedService._resourceTypes.find(rt => rt.Name.trim().toLowerCase() === 'records')!;\n }\n public get DashboardResourceType(): MJResourceTypeEntity {\n return SharedService._resourceTypes.find(rt => rt.Name.trim().toLowerCase() === 'dashboards')!;\n }\n public get ReportResourceType(): MJResourceTypeEntity {\n return SharedService._resourceTypes.find(rt => rt.Name.trim().toLowerCase() === 'reports')!;\n }\n public get SearchResultsResourceType(): MJResourceTypeEntity {\n return SharedService._resourceTypes.find(rt => rt.Name.trim().toLowerCase() === 'search results')!;\n }\n public get ListResourceType(): MJResourceTypeEntity {\n return SharedService._resourceTypes.find(rt => rt.Name.trim().toLowerCase() === 'lists')!;\n }\n public ResourceTypeByID(id: string): MJResourceTypeEntity | undefined {\n return SharedService._resourceTypes.find(rt => UUIDsEqual(rt.ID, id));\n }\n public ResourceTypeByName(name: string): MJResourceTypeEntity | undefined {\n return SharedService._resourceTypes.find(rt => rt.Name.trim().toLowerCase() === name.trim().toLowerCase());\n }\n\n /**\n * Refreshes the data for the service. If OnlyIfNeeded is true, then the data is only refreshed if it hasn't been loaded yet.\n */\n public static async RefreshData(OnlyIfNeeded: boolean = false) {\n if (OnlyIfNeeded && SharedService._loaded) {\n return;\n }\n\n const canProceed$ = SharedService.isLoading$.pipe(\n first(isLoading => !isLoading),\n tap(() => SharedService.isLoading$.next(true))\n );\n\n await firstValueFrom(canProceed$);\n\n try {\n // After waiting for the current loading operation to complete, check again\n // if _loaded is true and OnlyIfNeeded is true, return early\n if (OnlyIfNeeded && SharedService._loaded) {\n return;\n }\n\n await SharedService.handleDataLoading();\n\n // Mark as loaded\n SharedService._loaded = true;\n } finally {\n // Ensure we always reset the loading flag\n SharedService.isLoading$.next(false);\n }\n }\n\n private static async handleDataLoading() {\n const md = new Metadata();\n\n // make sure startup is done\n await StartupManager.Instance.Startup(); \n\n this._resourceTypes = ResourcePermissionEngine.Instance.ResourceTypes;\n\n // Note: RefreshUserNotifications() removed here because MJNotificationService\n // already handles it via its own MJEventType.LoggedIn subscription. Calling it\n // from both places caused a duplicate User Notifications GraphQL request on login.\n } \n\n FormatColumnValue(col: ViewColumnInfo, value: any, maxLength: number = 0, trailingChars: string = \"...\") {\n if (value === null || value === undefined)\n return value;\n\n try {\n const retVal = col.EntityField.FormatValue(value, 0);\n if (maxLength > 0 && retVal && retVal.length > maxLength)\n return retVal.substring(0, maxLength) + trailingChars;\n else\n return retVal;\n }\n catch (e) {\n LogError(e);\n return value;\n }\n }\n\n public ConvertMarkdownStringToHtmlList(listType: HtmlListType, text: string): string {\n return ConvertMarkdownStringToHtmlList(listType, text) ?? text;\n }\n\n \n public InvokeManualResize(delay: number = 50) {\n return InvokeManualResize(delay, this);\n }\n\n public PushStatusUpdates(): Observable<string> {\n const gp: GraphQLDataProvider = <GraphQLDataProvider>Metadata.Provider;\n return gp.PushStatusUpdates();\n }\n\n private _currentUserImage: string | Blob = '/assets/user.png';\n public get CurrentUserImage(): string | Blob {\n return this._currentUserImage;\n }\n public set CurrentUserImage(value: string | Blob) {\n this._currentUserImage = value;\n }\n\n /**\n * @deprecated Use MJNotificationService.UserNotifications instead\n */\n public static get UserNotifications(): MJUserNotificationEntity[] {\n return MJNotificationService.UserNotifications;\n }\n /**\n * @deprecated Use MJNotificationService.UnreadUserNotifications instead\n */\n public static get UnreadUserNotifications(): MJUserNotificationEntity[] {\n return MJNotificationService.UnreadUserNotifications;\n }\n /**\n * @deprecated Use MJNotificationService.UnreadUserNotificationCount instead\n */\n public static get UnreadUserNotificationCount(): number {\n return MJNotificationService.UnreadUserNotificationCount;\n }\n\n /**\n * Utility method that returns true if child is a descendant of parent, false otherwise. \n */\n public static IsDescendant(parent: ElementRef, child: ElementRef) {\n if (parent && child && parent.nativeElement && child.nativeElement) {\n let node = child.nativeElement.parentNode;\n while (node != null) {\n if (node == parent.nativeElement) {\n return true;\n }\n node = node.parentNode;\n }\n }\n return false;\n }\n\n\n /**\n * Creates a notification in the database and refreshes the UI. Returns the notification object.\n * @param title \n * @param message \n * @param resourceTypeId \n * @param resourceRecordId \n * @param resourceConfiguration Any object, it is converted to a string by JSON.stringify and stored in the database\n * @returns \n * @deprecated Use MJNotificationService.CreateNotification instead\n */\n public async CreateNotification(title: string, message: string, resourceTypeId: string | null, resourceRecordId: string | null, resourceConfiguration: any | null, displayToUser : boolean = true): Promise<MJUserNotificationEntity> {\n return this.mjNotificationsService.CreateNotification(title, message, resourceTypeId, resourceRecordId, resourceConfiguration, displayToUser);\n }\n\n /**\n * @deprecated Use MJNotificationService.RefreshUserNotifications instead\n */\n public static async RefreshUserNotifications() {\n MJNotificationService.RefreshUserNotifications();\n }\n\n /**\n * Creates a message that is not saved to the User Notifications table, but is displayed to the user.\n * @param message - text to display\n * @param style - display styling\n * @param hideAfter - option to auto hide after the specified delay in milliseconds\n * @deprecated Use MJNotificationService.CreateSimpleNotification instead\n */\n public CreateSimpleNotification(message: string, style: \"none\" | \"success\" | \"error\" | \"warning\" | \"info\" = \"success\", hideAfter?: number) {\n return this.mjNotificationsService.CreateSimpleNotification(message, style, hideAfter);\n }\n\n\n\n private _resourceTypeMap = [\n { routeSegment: 'record', name: 'records' },\n { routeSegment: 'view', name: 'user views' },\n { routeSegment: 'search', name: 'search results' },\n { routeSegment: 'report', name: 'reports' },\n { routeSegment: 'query', name: 'queries' },\n { routeSegment: 'dashboard', name: 'dashboards' },\n { routeSegment: 'list', name: 'lists' },\n \n ]\n /**\n * Maps a Resource Type record Name column to the corresponding route segment\n * @param resourceTypeName \n * @returns \n */\n public mapResourceTypeNameToRouteSegment(resourceTypeName: string) {\n const item = this._resourceTypeMap.find(rt => rt.name.trim().toLowerCase() === resourceTypeName.trim().toLowerCase());\n if (item)\n return item.routeSegment;\n else\n return null \n }\n\n /**\n * Maps a route segment to the corresponding Resource Type record Name column\n * @param resourceRouteSegment \n * @returns \n */\n public mapResourceTypeRouteSegmentToName(resourceRouteSegment: string) {\n const item = this._resourceTypeMap.find(rt => rt.routeSegment.trim().toLowerCase() === resourceRouteSegment.trim().toLowerCase());\n if (item)\n return item.name;\n else\n return null \n }\n\n /**\n * Opens an entity record in a new or existing tab\n * Uses the modern NavigationService for tab-based navigation\n */\n public OpenEntityRecord(entityName: string, recordPkey: CompositeKey) {\n try {\n console.log('SharedService.OpenEntityRecord called:', entityName, recordPkey.ToURLSegment());\n // Use NavigationService to open in new tab-based UX\n this.navigationService.OpenEntityRecord(entityName, recordPkey);\n }\n catch (e) {\n console.error('Error in OpenEntityRecord:', e);\n LogError(e);\n }\n }\n}\n\nexport const HtmlListType = {\n Unordered: 'Unordered',\n Ordered: 'Ordered',\n} as const;\n\nexport type HtmlListType = typeof HtmlListType[keyof typeof HtmlListType];\n\n\nexport const EventCodes = {\n ViewClicked: \"ViewClicked\",\n EntityRecordClicked: \"EntityRecordClicked\",\n AddDashboard: \"AddDashboard\",\n AddReport: \"AddReport\",\n AddQuery: \"AddQuery\",\n ViewCreated: \"ViewCreated\",\n ViewUpdated: \"ViewUpdated\",\n RunSearch: \"RunSearch\",\n ViewNotifications: \"ViewNotifications\",\n PushStatusUpdates: \"PushStatusUpdates\",\n UserNotificationsUpdated: \"UserNotificationsUpdated\",\n CloseCurrentTab: \"CloseCurrentTab\",\n ListCreated: \"ListCreated\",\n ListClicked: 'ListClicked',\n AvatarUpdated: 'AvatarUpdated'\n} as const;\n\nexport type EventCodes = typeof EventCodes[keyof typeof EventCodes];"]}
|
package/dist/module.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import * as i1 from "./lib/urlPipe";
|
|
3
3
|
import * as i2 from "./lib/simpleTextFormat";
|
|
4
|
-
import * as i3 from "@
|
|
5
|
-
import * as i4 from "@memberjunction/ng-notifications";
|
|
4
|
+
import * as i3 from "@memberjunction/ng-notifications";
|
|
6
5
|
export declare class MemberJunctionSharedModule {
|
|
7
6
|
static ɵfac: i0.ɵɵFactoryDeclaration<MemberJunctionSharedModule, never>;
|
|
8
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<MemberJunctionSharedModule, [typeof i1.URLPipe, typeof i2.SimpleTextFormatPipe], [typeof i3.
|
|
7
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<MemberJunctionSharedModule, [typeof i1.URLPipe, typeof i2.SimpleTextFormatPipe], [typeof i3.MJNotificationsModule], [typeof i1.URLPipe, typeof i2.SimpleTextFormatPipe]>;
|
|
9
8
|
static ɵinj: i0.ɵɵInjectorDeclaration<MemberJunctionSharedModule>;
|
|
10
9
|
}
|
|
11
10
|
//# sourceMappingURL=module.d.ts.map
|
package/dist/module.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":";;;;AAIA,qBAaa,0BAA0B;yCAA1B,0BAA0B;0CAA1B,0BAA0B;0CAA1B,0BAA0B;CAAI"}
|
package/dist/module.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { NgModule } from '@angular/core';
|
|
2
2
|
import { URLPipe } from './lib/urlPipe';
|
|
3
|
-
import { NotificationModule } from '@progress/kendo-angular-notification';
|
|
4
3
|
import { SimpleTextFormatPipe } from './lib/simpleTextFormat';
|
|
5
4
|
import { MJNotificationsModule } from '@memberjunction/ng-notifications';
|
|
6
5
|
import * as i0 from "@angular/core";
|
|
7
6
|
export class MemberJunctionSharedModule {
|
|
8
7
|
static ɵfac = function MemberJunctionSharedModule_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MemberJunctionSharedModule)(); };
|
|
9
8
|
static ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: MemberJunctionSharedModule });
|
|
10
|
-
static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [
|
|
11
|
-
MJNotificationsModule] });
|
|
9
|
+
static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [MJNotificationsModule] });
|
|
12
10
|
}
|
|
13
11
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MemberJunctionSharedModule, [{
|
|
14
12
|
type: NgModule,
|
|
@@ -18,7 +16,6 @@ export class MemberJunctionSharedModule {
|
|
|
18
16
|
SimpleTextFormatPipe
|
|
19
17
|
],
|
|
20
18
|
imports: [
|
|
21
|
-
NotificationModule,
|
|
22
19
|
MJNotificationsModule
|
|
23
20
|
],
|
|
24
21
|
exports: [
|
|
@@ -28,7 +25,6 @@ export class MemberJunctionSharedModule {
|
|
|
28
25
|
}]
|
|
29
26
|
}], null, null); })();
|
|
30
27
|
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(MemberJunctionSharedModule, { declarations: [URLPipe,
|
|
31
|
-
SimpleTextFormatPipe], imports: [
|
|
32
|
-
MJNotificationsModule], exports: [URLPipe,
|
|
28
|
+
SimpleTextFormatPipe], imports: [MJNotificationsModule], exports: [URLPipe,
|
|
33
29
|
SimpleTextFormatPipe] }); })();
|
|
34
30
|
//# sourceMappingURL=module.js.map
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;;AAczE,MAAM,OAAO,0BAA0B;oHAA1B,0BAA0B;4DAA1B,0BAA0B;gEAPnC,qBAAqB;;iFAOZ,0BAA0B;cAbtC,QAAQ;eAAC;gBACR,YAAY,EAAE;oBACZ,OAAO;oBACP,oBAAoB;iBACrB;gBACD,OAAO,EAAE;oBACP,qBAAqB;iBACtB;gBACD,OAAO,EAAE;oBACP,OAAO;oBACP,oBAAoB;iBACrB;aACF;;wFACY,0BAA0B,mBAXnC,OAAO;QACP,oBAAoB,aAGpB,qBAAqB,aAGrB,OAAO;QACP,oBAAoB","sourcesContent":["import { NgModule } from '@angular/core';\nimport { URLPipe } from './lib/urlPipe';\nimport { SimpleTextFormatPipe } from './lib/simpleTextFormat';\nimport { MJNotificationsModule } from '@memberjunction/ng-notifications';\n@NgModule({\n declarations: [\n URLPipe,\n SimpleTextFormatPipe\n ],\n imports: [\n MJNotificationsModule\n ],\n exports: [\n URLPipe,\n SimpleTextFormatPipe\n ]\n})\nexport class MemberJunctionSharedModule { }"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/ng-shared",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.23.0",
|
|
4
4
|
"description": "MemberJunction: MJ Explorer Angular Shared Package - utility functions and other reusable elements used across other MJ Angular packages within the MJ Explorer App - do not use outside of MJ Explorer.",
|
|
5
5
|
"main": "./dist/public-api.js",
|
|
6
6
|
"typings": "./dist/public-api.d.ts",
|
|
@@ -29,17 +29,16 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@angular/platform-browser": "21.1.3",
|
|
32
|
-
"@memberjunction/ai-engine-base": "5.
|
|
33
|
-
"@memberjunction/core": "5.
|
|
34
|
-
"@memberjunction/core-entities": "5.
|
|
35
|
-
"@memberjunction/
|
|
36
|
-
"@memberjunction/
|
|
37
|
-
"@memberjunction/
|
|
38
|
-
"@memberjunction/ng-base-application": "5.
|
|
39
|
-
"@memberjunction/ng-base-types": "5.
|
|
40
|
-
"@memberjunction/ng-notifications": "5.
|
|
41
|
-
"@memberjunction/ng-shared-generic": "5.
|
|
42
|
-
"@progress/kendo-angular-notification": "22.0.1",
|
|
32
|
+
"@memberjunction/ai-engine-base": "5.23.0",
|
|
33
|
+
"@memberjunction/core": "5.23.0",
|
|
34
|
+
"@memberjunction/core-entities": "5.23.0",
|
|
35
|
+
"@memberjunction/entity-communications-base": "5.23.0",
|
|
36
|
+
"@memberjunction/global": "5.23.0",
|
|
37
|
+
"@memberjunction/graphql-dataprovider": "5.23.0",
|
|
38
|
+
"@memberjunction/ng-base-application": "5.23.0",
|
|
39
|
+
"@memberjunction/ng-base-types": "5.23.0",
|
|
40
|
+
"@memberjunction/ng-notifications": "5.23.0",
|
|
41
|
+
"@memberjunction/ng-shared-generic": "5.23.0",
|
|
43
42
|
"html-to-image": "^1.11.11",
|
|
44
43
|
"tslib": "^2.8.1"
|
|
45
44
|
},
|