@tilde-nlp/ngx-common 8.1.32 → 8.1.34

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/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import * as i8 from '@angular/material/icon';
2
2
  import { MatIconRegistry } from '@angular/material/icon';
3
3
  import { DomSanitizer, Title } from '@angular/platform-browser';
4
4
  import * as i0 from '@angular/core';
5
- import { OnInit, EventEmitter, PipeTransform, ElementRef, ViewContainerRef, Renderer2, AfterViewInit, OnDestroy, ChangeDetectorRef, AfterContentInit, QueryList, OnChanges, SimpleChanges, InjectionToken, TemplateRef, Provider } from '@angular/core';
5
+ import { OnInit, EventEmitter, PipeTransform, ElementRef, ViewContainerRef, Renderer2, AfterViewInit, OnDestroy, ChangeDetectorRef, AfterContentInit, QueryList, OnChanges, SimpleChanges, InjectionToken, TemplateRef, Provider, EnvironmentProviders, Signal } from '@angular/core';
6
6
  import * as rxjs from 'rxjs';
7
7
  import { Observable, Subscription, Subject } from 'rxjs';
8
8
  import { HttpClient } from '@angular/common/http';
@@ -2590,7 +2590,15 @@ declare class CookieConsentComponent implements OnInit, OnDestroy {
2590
2590
  accept(): void;
2591
2591
  decline(): void;
2592
2592
  private removeListeners;
2593
+ private resolveInitialConsentState;
2594
+ private injectConsentScript;
2595
+ private setupTranslations;
2596
+ private translationKey;
2593
2597
  private isCookieConsentConfigured;
2598
+ private applyStoredConsent;
2599
+ private persistConsent;
2600
+ private writeConsent;
2601
+ private isPromise;
2594
2602
  static ɵfac: i0.ɵɵFactoryDeclaration<CookieConsentComponent, never>;
2595
2603
  static ɵcmp: i0.ɵɵComponentDeclaration<CookieConsentComponent, "lib-cookie-consent", never, { "script": { "alias": "script"; "required": false; }; "privacyPolicyUrl": { "alias": "privacyPolicyUrl"; "required": false; }; }, {}, never, never, true, never>;
2596
2604
  }
@@ -2615,5 +2623,114 @@ interface MatomoConfiguration {
2615
2623
  trackerUrl: string;
2616
2624
  }
2617
2625
 
2618
- export { ALERT_CONFIGURATION_TOKEN, AccessibilityContrasts, AccessibilityDialogComponent, AccessibilityFontSizes, AccessibilityService, AccessibilityTextMagnifierService, AlertService, AnalyticsService, AuthHeadersHelper, COLLECTIONS_MENU, CUSTOM_TITLE_CONFIGURATION_TOKEN, ClickOutsideDirective, ClickOutsideModule, CloseButtonComponent, CloseButtonModule, CombinedCollection, CombinedCollectionTooltipKey, CompanyProductComponent, CompanyProductModule, Confirmation, ConfirmationModalComponent, ConfirmationModalModule, ConfirmationService, ConversionHelper, CookieConsentComponent, CustomPaginatorInernationalizationHelper, CustomTitleStrategyService, CustomTranslateLoader, DISABLE_EXPORT_ATTRIBUTE_NAME, DOMService, DateAgoModule, DateAgoPipe, DomainTranslatePipe, DragAndDropDirective, DragAndDropModule, ERROR_CODES, EngineTermApiService, EngineTermCollectionScope, EngineTermCollectionSource, EngineTermCollectionStatus, EngineTermCollectionSubStatus, ExportFormat, ExtensionDialogComponent, ExtensionDialogModule, ExtensionDialogService, FILE_SIZE_UNIT, FileCategories, FileExtensionHelper, FileExtensions, FileSizeLabelPipe, FileTypeIcons, FileTypes, FileUploadComponent, FileUploadErrorTypeEnum, FileUploadModule, FilterBarComponent, FilterBarModule, FilterWithHighlightModule, FilterWithHighlightPipe, FooterComponent, FooterModule, GlobalMessageComponent, HashHelper, HtmlElementParseHelper, HtmlHelper, IconService, InlineMessageComponent, InlineMessageIconPosition, InlineMessageModule, InlineMessageType, LAST_USED_SYSTEM_LOCAL_STORAGE_KEY, LLMActions, LLMComponent, LLMModule, LLM_CONFIGURATION_TOKEN, LanguageTranslateModule, LanguageTranslatePipe, LanguageTranslateService, MatButtonLoadingDirective, MatButtonLoadingModule, MatomoService, MissingTranslationHandlerService, MissingTranslationHelper, MtCollectionStatus, MultiFunctionalTableComponent, MultiFunctionalTableModule, NewFeatureDialogWrapperComponent, NotificationMessageComponent, NotificationMessageModule, NotificationMessageType, NotificationService, OPEN_CLOSE_BTN_ICONS_TOKEN, ObjectLengthModule, ObjectLengthPipe, OpenCloseButtonComponent, OpenCloseButtonModule, OpenExtensionDialogComponent, Operations, PlausibleEventDirective, PlausibleHelper, PlausibleModule, ResolutionHelper, SCREEN_SIZE, SaveFileHelper, SelectLanguageDialogComponent, SidebarComponent, SidebarService, SortAlphabeticallyModule, SortAlphabeticallyPipe, SortByNumberPipe, SortDomainsPipe, SortHelper, SortLanguageListPipe, SortTranslationsByPropertyModule, SortTranslationsByPropertyPipe, SortTranslationsModule, SortTranslationsPipe, StatusDisplayComponent, StatusDisplayModule, SubscriptionComponent, SubscriptionPlan, SystemService, TerminologyApiService, TerminologyCollectionService, TerminologyComponent, TerminologyConfigService, TerminologyCreateCollectionComponent, TerminologyModule, TerminologyService, TextToSpeechComponent, TldLoaderComponent, TldLoaderModule, ToastComponent, ToastService, getFileSizeLabel, provideCustomTitleStrategy };
2619
- export type { ActiveData, AddEngineTermsRequestParams, Addon, AlertConfiguration, AuthSubscription, BatchConfig, Category, ChargebeeSettings, Column, ColumnConfig, ColumnSelectConfig, Config, ConfirmationBody, CustomTitleStrategyConfiguration, DefaultCollectionOrderUpdate, DialogData, Domain, DomainList, EngineTermCollection, EngineTermCollectionAccess, EngineTermCollectionAccessScope, EngineTermCollectionAccessScopeUpdate, EngineTermCollectionAccessUpdate, EngineTermCollectionList, ExportConfig, ExtensionWithIcon, FileUploadError, FilterBarChangeEvent, FilterBarFilter, FilterBarFilterItem, FilterBarSettings, GlobalMessageAction, ITldTermCollection, ITldTermCollectionLanguages, InlineMessage, JwtToken, LLMConfiguration, LangListItem, MatomoConfiguration, MobileScreenCustomPosition, MtCollection, MultiFunctionalTableConfig, NotificationMessage, NotificationWithOperation, OpenCloseBtnIcons, PaginatorConfig, PlausibleEvent, StatusDisplayConfig, System, TerminologyConfig, TranslatedLanguage, UpdateEngineTermsRequestParams, Vendor, Voice };
2626
+ interface AccessibilityPreferences {
2627
+ fontSizeIndex: number;
2628
+ contrast: AccessibilityContrasts;
2629
+ textMagnifierEnabled: boolean;
2630
+ screenMaskEnabled: boolean;
2631
+ }
2632
+ declare const DEFAULT_ACCESSIBILITY_PREFERENCES: AccessibilityPreferences;
2633
+
2634
+ interface CookieConsentPreferences {
2635
+ accepted: boolean;
2636
+ updatedAt?: string;
2637
+ }
2638
+ declare const DEFAULT_COOKIE_CONSENT_PREFERENCES: CookieConsentPreferences;
2639
+
2640
+ interface LanguagePreference {
2641
+ locale: string | null;
2642
+ }
2643
+
2644
+ interface UserConfigMetadata {
2645
+ version: number;
2646
+ updatedAt: string;
2647
+ }
2648
+ declare const USER_CONFIG_VERSION = 1;
2649
+ declare const createMetadata: (updatedAt?: string) => UserConfigMetadata;
2650
+
2651
+ interface UserConfig {
2652
+ accessibility: AccessibilityPreferences;
2653
+ cookieConsent: CookieConsentPreferences;
2654
+ language: LanguagePreference;
2655
+ metadata: UserConfigMetadata;
2656
+ }
2657
+ declare const DEFAULT_USER_CONFIG: UserConfig;
2658
+
2659
+ type UserConfigUpdate = Partial<{
2660
+ accessibility: Partial<AccessibilityPreferences>;
2661
+ cookieConsent: Partial<CookieConsentPreferences>;
2662
+ language: Partial<LanguagePreference>;
2663
+ }>;
2664
+
2665
+ declare enum UserConfigStrategy {
2666
+ Local = "local",
2667
+ Iframe = "iframe"
2668
+ }
2669
+
2670
+ interface UserConfigOptions {
2671
+ strategy: UserConfigStrategy;
2672
+ iframeUrl: string;
2673
+ }
2674
+
2675
+ type UserConfigOptionsFactoryProvider = {
2676
+ useFactory: (...deps: any[]) => Partial<UserConfigOptions> | UserConfigOptions | undefined;
2677
+ deps: any[];
2678
+ };
2679
+ type UserConfigOptionsInput = Partial<UserConfigOptions> | UserConfigOptionsFactoryProvider;
2680
+ declare function isUserConfigOptionsFactoryProvider(input: UserConfigOptionsInput): input is UserConfigOptionsFactoryProvider;
2681
+
2682
+ declare function provideUserConfig(options?: UserConfigOptionsInput): EnvironmentProviders;
2683
+
2684
+ declare const DEFAULT_USER_CONFIG_OPTIONS: UserConfigOptions;
2685
+
2686
+ declare const USER_CONFIG_STORAGE_KEY = "ngx_common_user_config";
2687
+
2688
+ declare const USER_CONFIG_IFRAME_NAME = "ngx-user-config-bridge";
2689
+ declare const DEFAULT_USER_CONFIG_IFRAME_URL = "/assets/static-files/user-config-bridge.html";
2690
+ declare const USER_CONFIG_IFRAME_TARGET_ORIGIN = "*";
2691
+ declare const USER_CONFIG_MESSAGE_SNAPSHOT = "ngx-user-config:snapshot";
2692
+ declare const USER_CONFIG_MESSAGE_REQUEST = "ngx-user-config:request";
2693
+ declare const USER_CONFIG_MESSAGE_UPDATE = "ngx-user-config:update";
2694
+
2695
+ interface UserConfigStorage {
2696
+ /** Reactive snapshot representing the latest persisted configuration. */
2697
+ readonly snapshot: Signal<UserConfig | null>;
2698
+ /** Reads the latest snapshot from persistence. */
2699
+ read(): Promise<UserConfig | null> | UserConfig | null;
2700
+ /**
2701
+ * Persists configuration updates. Implementations merge partials into the existing
2702
+ * snapshot and defaults to ensure a full config is stored.
2703
+ */
2704
+ write(config: Partial<UserConfig>): Promise<void> | void;
2705
+ }
2706
+
2707
+ declare const USER_CONFIG_OPTIONS: InjectionToken<UserConfigOptions>;
2708
+
2709
+ declare class IframeStorageStrategy implements UserConfigStorage, OnDestroy {
2710
+ #private;
2711
+ readonly snapshot: i0.WritableSignal<UserConfig | null>;
2712
+ constructor();
2713
+ read(): UserConfig | null;
2714
+ write(config: Partial<UserConfig>): void;
2715
+ ngOnDestroy(): void;
2716
+ static ɵfac: i0.ɵɵFactoryDeclaration<IframeStorageStrategy, never>;
2717
+ static ɵprov: i0.ɵɵInjectableDeclaration<IframeStorageStrategy>;
2718
+ }
2719
+
2720
+ declare class LocalStorageStrategy implements UserConfigStorage, OnDestroy {
2721
+ #private;
2722
+ readonly snapshot: i0.WritableSignal<UserConfig | null>;
2723
+ constructor();
2724
+ read(): UserConfig | null;
2725
+ write(config: Partial<UserConfig>): void;
2726
+ ngOnDestroy(): void;
2727
+ static ɵfac: i0.ɵɵFactoryDeclaration<LocalStorageStrategy, never>;
2728
+ static ɵprov: i0.ɵɵInjectableDeclaration<LocalStorageStrategy>;
2729
+ }
2730
+
2731
+ declare function userConfigStorageFactory(options: UserConfigOptions, localStorageStrategy: LocalStorageStrategy, iframeStrategy: IframeStorageStrategy): UserConfigStorage;
2732
+
2733
+ declare const USER_CONFIG_STORAGE: InjectionToken<UserConfigStorage>;
2734
+
2735
+ export { ALERT_CONFIGURATION_TOKEN, AccessibilityContrasts, AccessibilityDialogComponent, AccessibilityFontSizes, AccessibilityService, AccessibilityTextMagnifierService, AlertService, AnalyticsService, AuthHeadersHelper, COLLECTIONS_MENU, CUSTOM_TITLE_CONFIGURATION_TOKEN, ClickOutsideDirective, ClickOutsideModule, CloseButtonComponent, CloseButtonModule, CombinedCollection, CombinedCollectionTooltipKey, CompanyProductComponent, CompanyProductModule, Confirmation, ConfirmationModalComponent, ConfirmationModalModule, ConfirmationService, ConversionHelper, CookieConsentComponent, CustomPaginatorInernationalizationHelper, CustomTitleStrategyService, CustomTranslateLoader, DEFAULT_ACCESSIBILITY_PREFERENCES, DEFAULT_COOKIE_CONSENT_PREFERENCES, DEFAULT_USER_CONFIG, DEFAULT_USER_CONFIG_IFRAME_URL, DEFAULT_USER_CONFIG_OPTIONS, DISABLE_EXPORT_ATTRIBUTE_NAME, DOMService, DateAgoModule, DateAgoPipe, DomainTranslatePipe, DragAndDropDirective, DragAndDropModule, ERROR_CODES, EngineTermApiService, EngineTermCollectionScope, EngineTermCollectionSource, EngineTermCollectionStatus, EngineTermCollectionSubStatus, ExportFormat, ExtensionDialogComponent, ExtensionDialogModule, ExtensionDialogService, FILE_SIZE_UNIT, FileCategories, FileExtensionHelper, FileExtensions, FileSizeLabelPipe, FileTypeIcons, FileTypes, FileUploadComponent, FileUploadErrorTypeEnum, FileUploadModule, FilterBarComponent, FilterBarModule, FilterWithHighlightModule, FilterWithHighlightPipe, FooterComponent, FooterModule, GlobalMessageComponent, HashHelper, HtmlElementParseHelper, HtmlHelper, IconService, InlineMessageComponent, InlineMessageIconPosition, InlineMessageModule, InlineMessageType, LAST_USED_SYSTEM_LOCAL_STORAGE_KEY, LLMActions, LLMComponent, LLMModule, LLM_CONFIGURATION_TOKEN, LanguageTranslateModule, LanguageTranslatePipe, LanguageTranslateService, MatButtonLoadingDirective, MatButtonLoadingModule, MatomoService, MissingTranslationHandlerService, MissingTranslationHelper, MtCollectionStatus, MultiFunctionalTableComponent, MultiFunctionalTableModule, NewFeatureDialogWrapperComponent, NotificationMessageComponent, NotificationMessageModule, NotificationMessageType, NotificationService, OPEN_CLOSE_BTN_ICONS_TOKEN, ObjectLengthModule, ObjectLengthPipe, OpenCloseButtonComponent, OpenCloseButtonModule, OpenExtensionDialogComponent, Operations, PlausibleEventDirective, PlausibleHelper, PlausibleModule, ResolutionHelper, SCREEN_SIZE, SaveFileHelper, SelectLanguageDialogComponent, SidebarComponent, SidebarService, SortAlphabeticallyModule, SortAlphabeticallyPipe, SortByNumberPipe, SortDomainsPipe, SortHelper, SortLanguageListPipe, SortTranslationsByPropertyModule, SortTranslationsByPropertyPipe, SortTranslationsModule, SortTranslationsPipe, StatusDisplayComponent, StatusDisplayModule, SubscriptionComponent, SubscriptionPlan, SystemService, TerminologyApiService, TerminologyCollectionService, TerminologyComponent, TerminologyConfigService, TerminologyCreateCollectionComponent, TerminologyModule, TerminologyService, TextToSpeechComponent, TldLoaderComponent, TldLoaderModule, ToastComponent, ToastService, USER_CONFIG_IFRAME_NAME, USER_CONFIG_IFRAME_TARGET_ORIGIN, USER_CONFIG_MESSAGE_REQUEST, USER_CONFIG_MESSAGE_SNAPSHOT, USER_CONFIG_MESSAGE_UPDATE, USER_CONFIG_OPTIONS, USER_CONFIG_STORAGE, USER_CONFIG_STORAGE_KEY, USER_CONFIG_VERSION, UserConfigStrategy, createMetadata, getFileSizeLabel, isUserConfigOptionsFactoryProvider, provideCustomTitleStrategy, provideUserConfig, userConfigStorageFactory };
2736
+ export type { AccessibilityPreferences, ActiveData, AddEngineTermsRequestParams, Addon, AlertConfiguration, AuthSubscription, BatchConfig, Category, ChargebeeSettings, Column, ColumnConfig, ColumnSelectConfig, Config, ConfirmationBody, CookieConsentPreferences, CustomTitleStrategyConfiguration, DefaultCollectionOrderUpdate, DialogData, Domain, DomainList, EngineTermCollection, EngineTermCollectionAccess, EngineTermCollectionAccessScope, EngineTermCollectionAccessScopeUpdate, EngineTermCollectionAccessUpdate, EngineTermCollectionList, ExportConfig, ExtensionWithIcon, FileUploadError, FilterBarChangeEvent, FilterBarFilter, FilterBarFilterItem, FilterBarSettings, GlobalMessageAction, ITldTermCollection, ITldTermCollectionLanguages, InlineMessage, JwtToken, LLMConfiguration, LangListItem, LanguagePreference, MatomoConfiguration, MobileScreenCustomPosition, MtCollection, MultiFunctionalTableConfig, NotificationMessage, NotificationWithOperation, OpenCloseBtnIcons, PaginatorConfig, PlausibleEvent, StatusDisplayConfig, System, TerminologyConfig, TranslatedLanguage, UpdateEngineTermsRequestParams, UserConfig, UserConfigMetadata, UserConfigOptions, UserConfigOptionsFactoryProvider, UserConfigOptionsInput, UserConfigStorage, UserConfigUpdate, Vendor, Voice };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tilde-nlp/ngx-common",
3
- "version": "8.1.32",
3
+ "version": "8.1.34",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^20.0.0",
6
6
  "@angular/core": "^20.0.0",
@@ -0,0 +1,140 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <title>User Config Bridge</title>
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+ </head>
8
+ <body>
9
+ <script>
10
+ (function () {
11
+ const STORAGE_KEY = 'ngx_common_user_config';
12
+ const MESSAGE_REQUEST = 'ngx-user-config:request';
13
+ const MESSAGE_SNAPSHOT = 'ngx-user-config:snapshot';
14
+ const MESSAGE_UPDATE = 'ngx-user-config:update';
15
+ const parents = new Set();
16
+
17
+ const normalizeBoolean = (value) => value === 'true' || value === '1' || value === '';
18
+
19
+ const resolveDebugFlag = () => {
20
+ return true;
21
+
22
+ try {
23
+ const params = new URLSearchParams(window.location.search);
24
+ if (params.has('userConfigDebug')) {
25
+ return normalizeBoolean(params.get('userConfigDebug'));
26
+ }
27
+ return false;
28
+ } catch (error) {
29
+ console.warn('[user-config-bridge] Failed to resolve debug flag', error);
30
+ return false;
31
+ }
32
+ };
33
+
34
+ let debugEnabled = resolveDebugFlag();
35
+ const setDebugFlag = (enabled) => {
36
+ debugEnabled = !!enabled;
37
+ debugLog('Debug logging', enabled ? 'enabled' : 'disabled');
38
+ };
39
+
40
+ const debugLog = (...parts) => {
41
+ if (!debugEnabled) {
42
+ return;
43
+ }
44
+ console.log('[user-config-bridge]', ...parts);
45
+ };
46
+
47
+ // Expose runtime toggles for console use (both as methods object and legacy globals).
48
+ const debugControls = {
49
+ enable: () => setDebugFlag(true),
50
+ disable: () => setDebugFlag(false),
51
+ isEnabled: () => debugEnabled,
52
+ };
53
+
54
+ window.userConfigBridgeDebug = debugControls;
55
+ window.enableUserConfigBridgeDebugLogs = debugControls.enable;
56
+ window.disableUserConfigBridgeDebugLogs = debugControls.disable;
57
+
58
+ const readSnapshot = () => {
59
+ try {
60
+ const raw = window.localStorage.getItem(STORAGE_KEY);
61
+ const parsed = raw ? JSON.parse(raw) : null;
62
+ debugLog('Snapshot read', parsed);
63
+ return parsed;
64
+ } catch (error) {
65
+ console.warn('[user-config-bridge] Failed to parse snapshot', error);
66
+ return null;
67
+ }
68
+ };
69
+
70
+ const writeSnapshot = (config) => {
71
+ if (!config) {
72
+ return;
73
+ }
74
+ try {
75
+ window.localStorage.setItem(STORAGE_KEY, JSON.stringify(config));
76
+ debugLog('Snapshot written', config);
77
+ } catch (error) {
78
+ console.warn('[user-config-bridge] Failed to persist snapshot', error);
79
+ }
80
+ };
81
+
82
+ const postSnapshot = (target) => {
83
+ if (!target || typeof target.postMessage !== 'function') {
84
+ return;
85
+ }
86
+ debugLog('Posting snapshot to target');
87
+ target.postMessage(
88
+ {
89
+ type: MESSAGE_SNAPSHOT,
90
+ payload: readSnapshot(),
91
+ },
92
+ '*'
93
+ );
94
+ };
95
+
96
+ const broadcastSnapshot = () => {
97
+ debugLog('Broadcasting snapshot to parents count', parents.size);
98
+ parents.forEach((parentWindow) => postSnapshot(parentWindow));
99
+ };
100
+
101
+ window.addEventListener('message', (event) => {
102
+ if (event.source) {
103
+ parents.add(event.source);
104
+ }
105
+
106
+ debugLog('Received message', {
107
+ origin: event.origin,
108
+ type: event?.data?.type,
109
+ });
110
+
111
+ const data = event.data || {};
112
+ switch (data.type) {
113
+ case MESSAGE_REQUEST: {
114
+ debugLog('Handling request');
115
+ postSnapshot(event.source);
116
+ break;
117
+ }
118
+ case MESSAGE_UPDATE: {
119
+ debugLog('Handling update', data.payload);
120
+ writeSnapshot(data.payload);
121
+ broadcastSnapshot();
122
+ break;
123
+ }
124
+ default:
125
+ break;
126
+ }
127
+ });
128
+
129
+ window.addEventListener('storage', (event) => {
130
+ if (event.key === STORAGE_KEY) {
131
+ debugLog('Storage event detected, syncing snapshot');
132
+ broadcastSnapshot();
133
+ }
134
+ });
135
+
136
+ debugLog('Bridge initialized. Debug logging is enabled.');
137
+ })();
138
+ </script>
139
+ </body>
140
+ </html>