@osovitny/anatoly 3.19.6 → 3.19.8

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.
@@ -1,11 +1,11 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, EventEmitter, Component, Output, Input, Inject, Pipe, Injector, APP_INITIALIZER, NgModule, Directive, ChangeDetectionStrategy, ViewChild, ViewEncapsulation, HostListener, HostBinding, Optional, SkipSelf } from '@angular/core';
2
+ import { Injectable, EventEmitter, Component, Output, Input, Inject, Pipe, provideAppInitializer, inject, NgModule, Directive, ChangeDetectionStrategy, ViewChild, ViewEncapsulation, HostListener, HostBinding, Optional, SkipSelf } from '@angular/core';
3
3
  import { BehaviorSubject, Subject, filter, takeUntil, map as map$1, catchError, of, merge, forkJoin, timer, fromEvent, firstValueFrom } from 'rxjs';
4
4
  import { map, tap, mergeMap } from 'rxjs/operators';
5
5
  import * as i1 from '@angular/common/http';
6
- import { HttpResponse, HttpClientModule, HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http';
6
+ import { HttpResponse, HttpClient, provideHttpClient, withFetch, HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http';
7
7
  import * as i1$1 from '@angular/common';
8
- import { LOCATION_INITIALIZED, DOCUMENT, CommonModule } from '@angular/common';
8
+ import { DOCUMENT, CommonModule } from '@angular/common';
9
9
  import js_beautify from 'js-beautify';
10
10
  import * as i1$2 from '@angular/router';
11
11
  import { NavigationEnd, NavigationStart, NavigationCancel, NavigationError, RouterModule } from '@angular/router';
@@ -1911,10 +1911,15 @@ class AuthService extends ApiServiceBase {
1911
1911
  });
1912
1912
  }
1913
1913
  checkAndSetActiveAccount() {
1914
- let activeAccount = this.msalService.instance.getActiveAccount();
1915
- let accounts = this.msalService.instance.getAllAccounts();
1916
- if (!activeAccount && accounts.length > 0) {
1917
- this.msalService.instance.setActiveAccount(accounts[0]);
1914
+ try {
1915
+ let activeAccount = this.msalService.instance.getActiveAccount();
1916
+ let accounts = this.msalService.instance.getAllAccounts();
1917
+ if (!activeAccount && accounts.length > 0) {
1918
+ this.msalService.instance.setActiveAccount(accounts[0]);
1919
+ }
1920
+ }
1921
+ catch (error) {
1922
+ console.error("An error occurred: ", error);
1918
1923
  }
1919
1924
  }
1920
1925
  isPopup(popup) {
@@ -1940,8 +1945,13 @@ class AuthService extends ApiServiceBase {
1940
1945
  }
1941
1946
  // Public funcs
1942
1947
  getActiveAccount() {
1943
- this.checkAndSetActiveAccount();
1944
- return this.msalService.instance.getActiveAccount();
1948
+ try {
1949
+ this.checkAndSetActiveAccount();
1950
+ return this.msalService.instance.getActiveAccount();
1951
+ }
1952
+ catch (error) {
1953
+ console.error("An error occurred: ", error);
1954
+ }
1945
1955
  }
1946
1956
  getUserEmail() {
1947
1957
  let user = this.appContext.user;
@@ -2096,7 +2106,13 @@ class AuthService extends ApiServiceBase {
2096
2106
  }
2097
2107
  //MSAL check
2098
2108
  isUserAuthenticated() {
2099
- return this.msalService.instance.getActiveAccount() != null;
2109
+ try {
2110
+ return this.msalService.instance.getActiveAccount() != null;
2111
+ }
2112
+ catch (error) {
2113
+ console.error("An error occurred: ", error);
2114
+ }
2115
+ return false;
2100
2116
  }
2101
2117
  //MSAL + appContext check
2102
2118
  isUserSignedIn() {
@@ -2765,7 +2781,6 @@ class Subs {
2765
2781
 
2766
2782
  Authors:
2767
2783
  Vadim Osovitny vadim.osovitny@osovitny.com
2768
- Anatoly Osovitny anatoly.osovitny@osovitny.com
2769
2784
 
2770
2785
  Created:
2771
2786
  05 May 2020
@@ -2795,22 +2810,25 @@ class LocalizationService {
2795
2810
  }
2796
2811
  format(str, args) {
2797
2812
  return str.replace(/{(\d+)}/g, function (match, number) {
2798
- return typeof args[number] != 'undefined'
2799
- ? args[number]
2800
- : match;
2813
+ return typeof args[number] != 'undefined' ? args[number] : match;
2801
2814
  });
2802
2815
  }
2803
2816
  ;
2804
2817
  configureSettings(translate) {
2805
- //i10n
2806
- const browserLang = translate.getBrowserLang();
2807
- const lang = browserLang.match(/en|ru|es/) ? browserLang : this.defaultLanguage;
2808
- //dates
2809
- this.dateFnsLocale = { locale: enUS };
2810
- this.subs.sink = this.translate.onLangChange.subscribe((event) => {
2811
- console.log('Language Changed');
2812
- this.langchange.emit(event.lang);
2813
- });
2818
+ let lang = this.defaultLanguage;
2819
+ try {
2820
+ //i10n
2821
+ const browserLang = translate.getBrowserLang();
2822
+ lang = browserLang.match(/en|ru|es/) ? browserLang : this.defaultLanguage;
2823
+ //dates
2824
+ this.dateFnsLocale = { locale: enUS };
2825
+ this.subs.sink = this.translate.onLangChange.subscribe((event) => {
2826
+ console.log('Language Changed');
2827
+ this.langchange.emit(event.lang);
2828
+ });
2829
+ }
2830
+ catch {
2831
+ }
2814
2832
  return lang;
2815
2833
  }
2816
2834
  //Languages
@@ -2916,10 +2934,9 @@ class LocalizationService {
2916
2934
 
2917
2935
  Authors:
2918
2936
  Vadim Osovitny vadim.osovitny@osovitny.com
2919
- Anatoly Osovitny anatoly.osovitny@osovitny.com
2920
2937
 
2921
2938
  Created:
2922
- 10 May 2020
2939
+ 10 May 2020
2923
2940
 
2924
2941
  Copyright (c) 2016-2025 Osovitny Inc. All rights reserved.
2925
2942
  </file>
@@ -2997,33 +3014,14 @@ class LocalizePipe {
2997
3014
 
2998
3015
  Authors:
2999
3016
  Vadim Osovitny vadim.osovitny@osovitny.com
3000
- Anatoly Osovitny anatoly.osovitny@osovitny.com
3001
3017
 
3002
3018
  Created:
3003
- 05 May 2020
3019
+ 05 May 2020
3004
3020
 
3005
3021
  Copyright (c) 2016-2025 Osovitny Inc. All rights reserved.
3006
3022
  </file>
3007
3023
  */
3008
3024
  //Node
3009
- function localizationInitializerFactory(translate, localizationService, injector) {
3010
- return () => new Promise((resolve) => {
3011
- let locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
3012
- locationInitialized.then(() => {
3013
- let languageToSet = localizationService.configureSettings(translate);
3014
- translate.use(languageToSet).subscribe({
3015
- next: (data) => {
3016
- },
3017
- error: (e) => {
3018
- resolve(null);
3019
- },
3020
- complete: () => {
3021
- resolve(null);
3022
- }
3023
- });
3024
- });
3025
- });
3026
- }
3027
3025
  function translateLoaderFactory(httpClient) {
3028
3026
  let url = AppCoreSettings.assetsL10NUrl;
3029
3027
  let isCDNEnabled = AppCoreSettings.cdn.enabled;
@@ -3033,23 +3031,31 @@ function translateLoaderFactory(httpClient) {
3033
3031
  }
3034
3032
  return new TranslateHttpLoader(httpClient, `${url}/`, `.json?v=${AppVersion}`);
3035
3033
  }
3036
- let LocalizationInjectorInstance;
3034
+ let _localizationInjectorInstance;
3035
+ function getLocalizationInjector() {
3036
+ if (!_localizationInjectorInstance) {
3037
+ throw new Error('LocalizationInjector is not initialized.');
3038
+ }
3039
+ return _localizationInjectorInstance;
3040
+ }
3037
3041
  class LocalizationSettingsModule {
3038
3042
  constructor(injector) {
3039
3043
  this.injector = injector;
3040
- LocalizationInjectorInstance = this.injector;
3044
+ _localizationInjectorInstance = this.injector;
3041
3045
  }
3042
3046
  static { this.ɵfac = function LocalizationSettingsModule_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || LocalizationSettingsModule)(i0.ɵɵinject(i0.Injector)); }; }
3043
3047
  static { this.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: LocalizationSettingsModule }); }
3044
3048
  static { this.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ providers: [
3045
- {
3046
- provide: APP_INITIALIZER,
3047
- useFactory: localizationInitializerFactory,
3048
- deps: [TranslateService, LocalizationService, Injector],
3049
- multi: true
3050
- }
3051
- ], imports: [HttpClientModule,
3052
- TranslateModule.forRoot({
3049
+ TranslateService,
3050
+ LocalizationService,
3051
+ provideHttpClient(withFetch()),
3052
+ provideAppInitializer(() => {
3053
+ const translate = inject(TranslateService);
3054
+ const localizationService = inject(LocalizationService);
3055
+ const lang = localizationService.configureSettings(translate);
3056
+ return translate.use(lang);
3057
+ })
3058
+ ], imports: [TranslateModule.forRoot({
3053
3059
  loader: {
3054
3060
  provide: TranslateLoader,
3055
3061
  useFactory: translateLoaderFactory,
@@ -3061,7 +3067,6 @@ class LocalizationSettingsModule {
3061
3067
  type: NgModule,
3062
3068
  args: [{
3063
3069
  imports: [
3064
- HttpClientModule,
3065
3070
  TranslateModule.forRoot({
3066
3071
  loader: {
3067
3072
  provide: TranslateLoader,
@@ -3071,17 +3076,20 @@ class LocalizationSettingsModule {
3071
3076
  })
3072
3077
  ],
3073
3078
  providers: [
3074
- {
3075
- provide: APP_INITIALIZER,
3076
- useFactory: localizationInitializerFactory,
3077
- deps: [TranslateService, LocalizationService, Injector],
3078
- multi: true
3079
- }
3079
+ TranslateService,
3080
+ LocalizationService,
3081
+ provideHttpClient(withFetch()),
3082
+ provideAppInitializer(() => {
3083
+ const translate = inject(TranslateService);
3084
+ const localizationService = inject(LocalizationService);
3085
+ const lang = localizationService.configureSettings(translate);
3086
+ return translate.use(lang);
3087
+ })
3080
3088
  ],
3081
3089
  exports: []
3082
3090
  }]
3083
3091
  }], () => [{ type: i0.Injector }], null); })();
3084
- (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(LocalizationSettingsModule, { imports: [HttpClientModule, i1$3.TranslateModule] }); })();
3092
+ (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(LocalizationSettingsModule, { imports: [i1$3.TranslateModule] }); })();
3085
3093
 
3086
3094
  /*
3087
3095
  <file>
@@ -3090,10 +3098,9 @@ class LocalizationSettingsModule {
3090
3098
 
3091
3099
  Authors:
3092
3100
  Vadim Osovitny vadim.osovitny@osovitny.com
3093
- Anatoly Osovitny anatoly.osovitny@osovitny.com
3094
3101
 
3095
3102
  Created:
3096
- 12 May 2020
3103
+ 12 May 2020
3097
3104
 
3098
3105
  Copyright (c) 2016-2025 Osovitny Inc. All rights reserved.
3099
3106
  </file>
@@ -3134,7 +3141,6 @@ class LocalizationModule {
3134
3141
 
3135
3142
  Authors:
3136
3143
  Vadim Osovitny vadim.osovitny@osovitny.com
3137
- Anatoly Osovitny anatoly.osovitny@osovitny.com
3138
3144
 
3139
3145
  Created:
3140
3146
  2 July 2020
@@ -3145,7 +3151,7 @@ class LocalizationModule {
3145
3151
  //App
3146
3152
  class L10nUtils {
3147
3153
  static get localizationService() {
3148
- const ns = LocalizationInjectorInstance.get(LocalizationService);
3154
+ const ns = getLocalizationInjector().get(LocalizationService);
3149
3155
  return ns;
3150
3156
  }
3151
3157
  static getLocalizedValue(key, params, defaultKey) {
@@ -11012,5 +11018,5 @@ class AnatolyModule {
11012
11018
  * Generated bundle index. Do not edit.
11013
11019
  */
11014
11020
 
11015
- export { AReplacerDirective, AddressComponent, AdminGuard, Alerts, AnatolyBillingModule, AnatolyCoreModule, AnatolyDataModule, AnatolyHttpInterceptor, AnatolyIAMModule, AnatolyIAMPagesModule, AnatolyModule, AnatolyUIModule, ApiServiceBase, ApiUrl, AppContextService, AppCoreSettings, AppName, AppSettings, AppVersion, AppsGoServiceBase, AuthService, AuthenticationGuard, BillingUtils, BraintreeDialog, Browser, BuyAccessButtonComponent, CardBodyComponent, CardComponent, CardFooterComponent, CardHeaderComponent, CheckIconComponent, ClientApps, CompanyComponent, ComponentBase, ContactUsDialog, ContactUsForm, ControlPanelComponent, Convert, Copy2ClipboardComponent, CoreApiService, CountryDropdownlist, CurrenciesApiService, CurrenciesStorageService, DOM, DataPagerComponent, DataViewType, DateConvert, DefaultEditorOptions, DialogBase, DigitalMarketingService, DiscountCodeStatus, DiscountCodeType, DiscountCodesApiService, EditComponentBase, EditPageBase, EmailsApiService, EnumEditComponentBase, FeatureWillBeReadyComponent, FileSizePipe, FormValidationSummaryComponent, GABillingEvents, GAEvents, GlobalErrorHandler, GoServiceBase, GoogleAnalyticsService, GridEditServiceBase, GridReadServiceBase, Guid, HoveringDirective, HtmlEditorComponent, HtmlEditorComponentBase, IdleService, ImageReplacerDirective, InjectorInstance, IsDevMode, IsProdMode, ItemValidationSummaryComponent, L10nUtils, ListBase, LoadingComponent, LoadingService, LocalStorageService, LocalizationInjectorInstance, LocalizationModule, LocalizationService, LocalizationSettingsModule, LocalizePipe, LoggingService, MSALUtils, ModerationStatus, ModerationStatusDropdownlist, NativeElementDirective, NoMobileSupportComponent, NodataComponent, NotificationService, OrderSummaryComponent, PageBase, PageSpinnerComponent, PagedPageBase, PayPalComponent, PayPalScriptService, PaymentMethod, PaymentMethodsComponent, PaymentOptionsComponent, PaymentStage, PaymentType, PaymentsApiService, PaymentsService, PaypalButtonComponent, PaypalSubscribeButtonComponent, PublishStatus, PublishStatusDropdownlist, QSUtils, ReplaceTextPipe, SafeHtmlPipe, ScriptService, SessionStorageService, SignInButtonComponent, SignOutButtonComponent, SignUpButtonComponent, StarterGuard, StarterService, Stopwatch, StripeDialog, Subs, SubscribePlanButtonComponent, SubscriptionProvider, SubscriptionsApiService, TimezoneDropdownlist, TransactionsApiService, UrlSlugComponent, Utils, ValidationSummaryComponent, XmlFormatter, YouAgreeToOurTermsComponent, dateFormats, dateTimeFormats, getAppSettingsById, getAppSettingsByName, getCurrentApp, is, localizationInitializerFactory, throwIfAlreadyLoaded, timeFormats, translateLoaderFactory };
11021
+ export { AReplacerDirective, AddressComponent, AdminGuard, Alerts, AnatolyBillingModule, AnatolyCoreModule, AnatolyDataModule, AnatolyHttpInterceptor, AnatolyIAMModule, AnatolyIAMPagesModule, AnatolyModule, AnatolyUIModule, ApiServiceBase, ApiUrl, AppContextService, AppCoreSettings, AppName, AppSettings, AppVersion, AppsGoServiceBase, AuthService, AuthenticationGuard, BillingUtils, BraintreeDialog, Browser, BuyAccessButtonComponent, CardBodyComponent, CardComponent, CardFooterComponent, CardHeaderComponent, CheckIconComponent, ClientApps, CompanyComponent, ComponentBase, ContactUsDialog, ContactUsForm, ControlPanelComponent, Convert, Copy2ClipboardComponent, CoreApiService, CountryDropdownlist, CurrenciesApiService, CurrenciesStorageService, DOM, DataPagerComponent, DataViewType, DateConvert, DefaultEditorOptions, DialogBase, DigitalMarketingService, DiscountCodeStatus, DiscountCodeType, DiscountCodesApiService, EditComponentBase, EditPageBase, EmailsApiService, EnumEditComponentBase, FeatureWillBeReadyComponent, FileSizePipe, FormValidationSummaryComponent, GABillingEvents, GAEvents, GlobalErrorHandler, GoServiceBase, GoogleAnalyticsService, GridEditServiceBase, GridReadServiceBase, Guid, HoveringDirective, HtmlEditorComponent, HtmlEditorComponentBase, IdleService, ImageReplacerDirective, InjectorInstance, IsDevMode, IsProdMode, ItemValidationSummaryComponent, L10nUtils, ListBase, LoadingComponent, LoadingService, LocalStorageService, LocalizationModule, LocalizationService, LocalizationSettingsModule, LocalizePipe, LoggingService, MSALUtils, ModerationStatus, ModerationStatusDropdownlist, NativeElementDirective, NoMobileSupportComponent, NodataComponent, NotificationService, OrderSummaryComponent, PageBase, PageSpinnerComponent, PagedPageBase, PayPalComponent, PayPalScriptService, PaymentMethod, PaymentMethodsComponent, PaymentOptionsComponent, PaymentStage, PaymentType, PaymentsApiService, PaymentsService, PaypalButtonComponent, PaypalSubscribeButtonComponent, PublishStatus, PublishStatusDropdownlist, QSUtils, ReplaceTextPipe, SafeHtmlPipe, ScriptService, SessionStorageService, SignInButtonComponent, SignOutButtonComponent, SignUpButtonComponent, StarterGuard, StarterService, Stopwatch, StripeDialog, Subs, SubscribePlanButtonComponent, SubscriptionProvider, SubscriptionsApiService, TimezoneDropdownlist, TransactionsApiService, UrlSlugComponent, Utils, ValidationSummaryComponent, XmlFormatter, YouAgreeToOurTermsComponent, dateFormats, dateTimeFormats, getAppSettingsById, getAppSettingsByName, getCurrentApp, getLocalizationInjector, is, throwIfAlreadyLoaded, timeFormats, translateLoaderFactory };
11016
11022
  //# sourceMappingURL=osovitny-anatoly.mjs.map