@tilde-nlp/ngx-common 8.1.20 → 8.1.22

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.
@@ -9035,11 +9035,11 @@ const translations = {
9035
9035
  PURPOSE: 'Mērķis',
9036
9036
  CATEGORY: 'Kategorija',
9037
9037
  DURATION: 'Apstrādes termiņš',
9038
- ALLOW_COOKIES: 'allowCookies',
9038
+ ALLOW_COOKIES: 'mtm_cookie_consent',
9039
9039
  ALLOW_COOKIES_PURPOSE: 'Saglabā lietotāja piekrišanu sīkdatņu izmantošanai un statistikas ieguvei.',
9040
9040
  FUNCTIONAL_COOKIES: 'Funkcionālās sīkdatnes',
9041
9041
  ONE_YEAR: '1 gads',
9042
- CULTURE: 'culture',
9042
+ CULTURE: 'language',
9043
9043
  CULTURE_PURPOSE: 'Saglabā lietotāja izvēlēto valodu, lai lietotājam katru reizi nav jāpārslēdz.',
9044
9044
  ONE_MONTH: '1 mēnesis',
9045
9045
  PK_ID: '_pk_id',
@@ -9066,11 +9066,11 @@ const translations = {
9066
9066
  PURPOSE: 'Purpose',
9067
9067
  CATEGORY: 'Category',
9068
9068
  DURATION: 'Duration',
9069
- ALLOW_COOKIES: 'allowCookies',
9069
+ ALLOW_COOKIES: 'mtm_cookie_consent',
9070
9070
  ALLOW_COOKIES_PURPOSE: 'Saves user consent for cookie usage and statistics gathering.',
9071
9071
  FUNCTIONAL_COOKIES: 'Functional cookies',
9072
9072
  ONE_YEAR: '1 year',
9073
- CULTURE: 'culture',
9073
+ CULTURE: 'language',
9074
9074
  CULTURE_PURPOSE: "Saves user selected language so it doesn't need to be switched every time.",
9075
9075
  ONE_MONTH: '1 month',
9076
9076
  PK_ID: '_pk_id',
@@ -9086,15 +9086,29 @@ const translations = {
9086
9086
  },
9087
9087
  };
9088
9088
 
9089
- class AnalyticsService {
9090
- constructor() {
9091
- this.cookieConsentSubject = new Subject();
9092
- }
9093
- getCookieConsent() {
9094
- return this.cookieConsentSubject.asObservable();
9089
+ class MatomoService {
9090
+ setCookies() {
9091
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9092
+ window['_paq'].push(['setCookieConsentGiven']);
9093
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9094
+ window['_paq'].push(['rememberCookieConsentGiven']);
9095
9095
  }
9096
+ static { this.ɵfac = function MatomoService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MatomoService)(); }; }
9097
+ static { this.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: MatomoService, factory: MatomoService.ɵfac, providedIn: 'root' }); }
9098
+ }
9099
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MatomoService, [{
9100
+ type: Injectable,
9101
+ args: [{
9102
+ providedIn: 'root',
9103
+ }]
9104
+ }], null, null); })();
9105
+
9106
+ class AnalyticsService {
9107
+ #matomo = inject(MatomoService);
9096
9108
  cookieConsentGiven(approved) {
9097
- this.cookieConsentSubject.next(approved);
9109
+ if (approved) {
9110
+ this.#matomo.setCookies();
9111
+ }
9098
9112
  }
9099
9113
  static { this.ɵfac = function AnalyticsService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || AnalyticsService)(); }; }
9100
9114
  static { this.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AnalyticsService, factory: AnalyticsService.ɵfac, providedIn: 'root' }); }
@@ -9295,6 +9309,7 @@ class CookieConsentComponent {
9295
9309
  this.isDetailsVisible = false;
9296
9310
  this.#COOKIE_CONSENT_ACCEPTED_KEY = 'cookie-consent-accepted';
9297
9311
  this.#COOKIE_CONSENT_DECLINED_KEY = 'cookie-consent-declined';
9312
+ this.destroy = new Subject();
9298
9313
  }
9299
9314
  #analytics;
9300
9315
  #translate;
@@ -9312,18 +9327,30 @@ class CookieConsentComponent {
9312
9327
  }
9313
9328
  const currentLang = this.#translate.getCurrentLang();
9314
9329
  this.#translate.setTranslation(currentLang, translations[currentLang.split('-')[0]], true);
9330
+ this.#translate.onLangChange.pipe(takeUntil(this.destroy)).subscribe((langChangeEvent) => {
9331
+ const newLang = langChangeEvent.lang;
9332
+ this.#translate.setTranslation(newLang, translations[newLang.split('-')[0]], true);
9333
+ });
9334
+ }
9335
+ ngOnDestroy() {
9336
+ this.removeListeners();
9315
9337
  }
9316
9338
  toggleDetails() {
9317
9339
  this.isDetailsVisible = !this.isDetailsVisible;
9318
9340
  }
9319
9341
  accept() {
9320
- this.isClosed = true;
9321
9342
  this.#analytics.cookieConsentGiven(true);
9322
9343
  localStorage.setItem(this.#COOKIE_CONSENT_ACCEPTED_KEY, 'true');
9344
+ this.removeListeners();
9323
9345
  }
9324
9346
  decline() {
9325
- this.isClosed = true;
9326
9347
  localStorage.setItem(this.#COOKIE_CONSENT_DECLINED_KEY, 'true');
9348
+ this.removeListeners();
9349
+ }
9350
+ removeListeners() {
9351
+ this.isClosed = true;
9352
+ this.destroy.next();
9353
+ this.destroy.complete();
9327
9354
  }
9328
9355
  isCookieConsentConfigured() {
9329
9356
  const isAccepted = localStorage.getItem(this.#COOKIE_CONSENT_ACCEPTED_KEY) === 'true';
@@ -9348,7 +9375,7 @@ class CookieConsentComponent {
9348
9375
  }], privacyPolicyUrl: [{
9349
9376
  type: Input
9350
9377
  }] }); })();
9351
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CookieConsentComponent, { className: "CookieConsentComponent", filePath: "lib/analytics/cookie-consent/cookie-consent.component.ts", lineNumber: 15 }); })();
9378
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CookieConsentComponent, { className: "CookieConsentComponent", filePath: "lib/analytics/cookie-consent/cookie-consent.component.ts", lineNumber: 16 }); })();
9352
9379
 
9353
9380
  /*
9354
9381
  * Public API Surface of ngx-common
@@ -9358,5 +9385,5 @@ class CookieConsentComponent {
9358
9385
  * Generated bundle index. Do not edit.
9359
9386
  */
9360
9387
 
9361
- 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, 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 };
9388
+ 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 };
9362
9389
  //# sourceMappingURL=tilde-nlp-ngx-common.mjs.map