@osovitny/anatoly 3.19.7 → 3.19.9

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';
@@ -85,6 +85,18 @@ const IsProdMode = !IsDevMode;
85
85
  const ClientApps = AppCoreSettings?.clientApps;
86
86
  //Api
87
87
  const ApiUrl = `${AppCoreSettings?.api.url}`;
88
+ function formatUrl(url) {
89
+ let newUrl = url;
90
+ if (url) {
91
+ if (url.startsWith("http")) {
92
+ return url;
93
+ }
94
+ const isCDNEnabled = AppCoreSettings.cdn?.enabled;
95
+ const cdnUrl = AppCoreSettings.cdn?.url;
96
+ newUrl = isCDNEnabled ? cdnUrl + url : url;
97
+ }
98
+ return newUrl;
99
+ }
88
100
 
89
101
  /*
90
102
  <file>
@@ -2781,7 +2793,6 @@ class Subs {
2781
2793
 
2782
2794
  Authors:
2783
2795
  Vadim Osovitny vadim.osovitny@osovitny.com
2784
- Anatoly Osovitny anatoly.osovitny@osovitny.com
2785
2796
 
2786
2797
  Created:
2787
2798
  05 May 2020
@@ -2811,22 +2822,25 @@ class LocalizationService {
2811
2822
  }
2812
2823
  format(str, args) {
2813
2824
  return str.replace(/{(\d+)}/g, function (match, number) {
2814
- return typeof args[number] != 'undefined'
2815
- ? args[number]
2816
- : match;
2825
+ return typeof args[number] != 'undefined' ? args[number] : match;
2817
2826
  });
2818
2827
  }
2819
2828
  ;
2820
2829
  configureSettings(translate) {
2821
- //i10n
2822
- const browserLang = translate.getBrowserLang();
2823
- const lang = browserLang.match(/en|ru|es/) ? browserLang : this.defaultLanguage;
2824
- //dates
2825
- this.dateFnsLocale = { locale: enUS };
2826
- this.subs.sink = this.translate.onLangChange.subscribe((event) => {
2827
- console.log('Language Changed');
2828
- this.langchange.emit(event.lang);
2829
- });
2830
+ let lang = this.defaultLanguage;
2831
+ try {
2832
+ //i10n
2833
+ const browserLang = translate.getBrowserLang();
2834
+ lang = browserLang.match(/en|ru|es/) ? browserLang : this.defaultLanguage;
2835
+ //dates
2836
+ this.dateFnsLocale = { locale: enUS };
2837
+ this.subs.sink = this.translate.onLangChange.subscribe((event) => {
2838
+ console.log('Language Changed');
2839
+ this.langchange.emit(event.lang);
2840
+ });
2841
+ }
2842
+ catch {
2843
+ }
2830
2844
  return lang;
2831
2845
  }
2832
2846
  //Languages
@@ -2932,10 +2946,9 @@ class LocalizationService {
2932
2946
 
2933
2947
  Authors:
2934
2948
  Vadim Osovitny vadim.osovitny@osovitny.com
2935
- Anatoly Osovitny anatoly.osovitny@osovitny.com
2936
2949
 
2937
2950
  Created:
2938
- 10 May 2020
2951
+ 10 May 2020
2939
2952
 
2940
2953
  Copyright (c) 2016-2025 Osovitny Inc. All rights reserved.
2941
2954
  </file>
@@ -3013,33 +3026,14 @@ class LocalizePipe {
3013
3026
 
3014
3027
  Authors:
3015
3028
  Vadim Osovitny vadim.osovitny@osovitny.com
3016
- Anatoly Osovitny anatoly.osovitny@osovitny.com
3017
3029
 
3018
3030
  Created:
3019
- 05 May 2020
3031
+ 05 May 2020
3020
3032
 
3021
3033
  Copyright (c) 2016-2025 Osovitny Inc. All rights reserved.
3022
3034
  </file>
3023
3035
  */
3024
3036
  //Node
3025
- function localizationInitializerFactory(translate, localizationService, injector) {
3026
- return () => new Promise((resolve) => {
3027
- let locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
3028
- locationInitialized.then(() => {
3029
- let languageToSet = localizationService.configureSettings(translate);
3030
- translate.use(languageToSet).subscribe({
3031
- next: (data) => {
3032
- },
3033
- error: (e) => {
3034
- resolve(null);
3035
- },
3036
- complete: () => {
3037
- resolve(null);
3038
- }
3039
- });
3040
- });
3041
- });
3042
- }
3043
3037
  function translateLoaderFactory(httpClient) {
3044
3038
  let url = AppCoreSettings.assetsL10NUrl;
3045
3039
  let isCDNEnabled = AppCoreSettings.cdn.enabled;
@@ -3049,23 +3043,31 @@ function translateLoaderFactory(httpClient) {
3049
3043
  }
3050
3044
  return new TranslateHttpLoader(httpClient, `${url}/`, `.json?v=${AppVersion}`);
3051
3045
  }
3052
- let LocalizationInjectorInstance;
3046
+ let _localizationInjectorInstance;
3047
+ function getLocalizationInjector() {
3048
+ if (!_localizationInjectorInstance) {
3049
+ throw new Error('LocalizationInjector is not initialized.');
3050
+ }
3051
+ return _localizationInjectorInstance;
3052
+ }
3053
3053
  class LocalizationSettingsModule {
3054
3054
  constructor(injector) {
3055
3055
  this.injector = injector;
3056
- LocalizationInjectorInstance = this.injector;
3056
+ _localizationInjectorInstance = this.injector;
3057
3057
  }
3058
3058
  static { this.ɵfac = function LocalizationSettingsModule_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || LocalizationSettingsModule)(i0.ɵɵinject(i0.Injector)); }; }
3059
3059
  static { this.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: LocalizationSettingsModule }); }
3060
3060
  static { this.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ providers: [
3061
- {
3062
- provide: APP_INITIALIZER,
3063
- useFactory: localizationInitializerFactory,
3064
- deps: [TranslateService, LocalizationService, Injector],
3065
- multi: true
3066
- }
3067
- ], imports: [HttpClientModule,
3068
- TranslateModule.forRoot({
3061
+ TranslateService,
3062
+ LocalizationService,
3063
+ provideHttpClient(withFetch()),
3064
+ provideAppInitializer(() => {
3065
+ const translate = inject(TranslateService);
3066
+ const localizationService = inject(LocalizationService);
3067
+ const lang = localizationService.configureSettings(translate);
3068
+ return translate.use(lang);
3069
+ })
3070
+ ], imports: [TranslateModule.forRoot({
3069
3071
  loader: {
3070
3072
  provide: TranslateLoader,
3071
3073
  useFactory: translateLoaderFactory,
@@ -3077,7 +3079,6 @@ class LocalizationSettingsModule {
3077
3079
  type: NgModule,
3078
3080
  args: [{
3079
3081
  imports: [
3080
- HttpClientModule,
3081
3082
  TranslateModule.forRoot({
3082
3083
  loader: {
3083
3084
  provide: TranslateLoader,
@@ -3087,17 +3088,20 @@ class LocalizationSettingsModule {
3087
3088
  })
3088
3089
  ],
3089
3090
  providers: [
3090
- {
3091
- provide: APP_INITIALIZER,
3092
- useFactory: localizationInitializerFactory,
3093
- deps: [TranslateService, LocalizationService, Injector],
3094
- multi: true
3095
- }
3091
+ TranslateService,
3092
+ LocalizationService,
3093
+ provideHttpClient(withFetch()),
3094
+ provideAppInitializer(() => {
3095
+ const translate = inject(TranslateService);
3096
+ const localizationService = inject(LocalizationService);
3097
+ const lang = localizationService.configureSettings(translate);
3098
+ return translate.use(lang);
3099
+ })
3096
3100
  ],
3097
3101
  exports: []
3098
3102
  }]
3099
3103
  }], () => [{ type: i0.Injector }], null); })();
3100
- (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(LocalizationSettingsModule, { imports: [HttpClientModule, i1$3.TranslateModule] }); })();
3104
+ (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(LocalizationSettingsModule, { imports: [i1$3.TranslateModule] }); })();
3101
3105
 
3102
3106
  /*
3103
3107
  <file>
@@ -3106,10 +3110,9 @@ class LocalizationSettingsModule {
3106
3110
 
3107
3111
  Authors:
3108
3112
  Vadim Osovitny vadim.osovitny@osovitny.com
3109
- Anatoly Osovitny anatoly.osovitny@osovitny.com
3110
3113
 
3111
3114
  Created:
3112
- 12 May 2020
3115
+ 12 May 2020
3113
3116
 
3114
3117
  Copyright (c) 2016-2025 Osovitny Inc. All rights reserved.
3115
3118
  </file>
@@ -3150,7 +3153,6 @@ class LocalizationModule {
3150
3153
 
3151
3154
  Authors:
3152
3155
  Vadim Osovitny vadim.osovitny@osovitny.com
3153
- Anatoly Osovitny anatoly.osovitny@osovitny.com
3154
3156
 
3155
3157
  Created:
3156
3158
  2 July 2020
@@ -3161,7 +3163,7 @@ class LocalizationModule {
3161
3163
  //App
3162
3164
  class L10nUtils {
3163
3165
  static get localizationService() {
3164
- const ns = LocalizationInjectorInstance.get(LocalizationService);
3166
+ const ns = getLocalizationInjector().get(LocalizationService);
3165
3167
  return ns;
3166
3168
  }
3167
3169
  static getLocalizedValue(key, params, defaultKey) {
@@ -4586,16 +4588,10 @@ class ReplacerDirectiveBase {
4586
4588
  this.el = el;
4587
4589
  this.renderer = renderer;
4588
4590
  }
4589
- setCDN2Attribute(name, value) {
4590
- if (value) {
4591
- if (value.startsWith("http")) {
4592
- this.setAttribute(name, value);
4593
- return;
4594
- }
4595
- const isCDNEnabled = AppCoreSettings.cdn.enabled;
4596
- const cdnUrl = AppCoreSettings.cdn.url;
4597
- const newSrc = isCDNEnabled ? cdnUrl + value : value;
4598
- this.setAttribute(name, newSrc);
4591
+ setUrlAttribute(name, url) {
4592
+ if (url) {
4593
+ let newUrl = formatUrl(url);
4594
+ this.setAttribute(name, newUrl);
4599
4595
  }
4600
4596
  }
4601
4597
  setAttribute(name, value) {
@@ -4634,7 +4630,7 @@ class ImageReplacerDirective extends ReplacerDirectiveBase {
4634
4630
  }
4635
4631
  }
4636
4632
  setSrc(value) {
4637
- this.setCDN2Attribute('src', value);
4633
+ this.setUrlAttribute('src', value);
4638
4634
  }
4639
4635
  static { this.ɵfac = /*@__PURE__*/ (() => { let ɵImageReplacerDirective_BaseFactory; return function ImageReplacerDirective_Factory(__ngFactoryType__) { return (ɵImageReplacerDirective_BaseFactory || (ɵImageReplacerDirective_BaseFactory = i0.ɵɵgetInheritedFactory(ImageReplacerDirective)))(__ngFactoryType__ || ImageReplacerDirective); }; })(); }
4640
4636
  static { this.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: ImageReplacerDirective, selectors: [["img"]], inputs: { src: "src" }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature, i0.ɵɵNgOnChangesFeature] }); }
@@ -7852,7 +7848,7 @@ class AReplacerDirective extends ReplacerDirectiveBase {
7852
7848
  setHref(value) {
7853
7849
  if (value) {
7854
7850
  if (value.indexOf("assets") > -1) {
7855
- this.setCDN2Attribute('href', value);
7851
+ this.setUrlAttribute('href', value);
7856
7852
  }
7857
7853
  else {
7858
7854
  this.setAttribute('href', value);
@@ -11028,5 +11024,5 @@ class AnatolyModule {
11028
11024
  * Generated bundle index. Do not edit.
11029
11025
  */
11030
11026
 
11031
- 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 };
11027
+ 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, formatUrl, getAppSettingsById, getAppSettingsByName, getCurrentApp, getLocalizationInjector, is, throwIfAlreadyLoaded, timeFormats, translateLoaderFactory };
11032
11028
  //# sourceMappingURL=osovitny-anatoly.mjs.map