@osovitny/anatoly 2.14.39 → 2.14.40

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.
@@ -683,11 +683,15 @@ function localizationInitializerFactory(translate, localizationService, injector
683
683
  let locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
684
684
  locationInitialized.then(() => {
685
685
  let languageToSet = localizationService.configureTranslationSettings(translate);
686
- translate.use(languageToSet).subscribe(() => {
687
- }, () => {
688
- resolve(null);
689
- }, () => {
690
- resolve(null);
686
+ translate.use(languageToSet).subscribe({
687
+ next: (data) => {
688
+ },
689
+ error: (e) => {
690
+ resolve(null);
691
+ },
692
+ complete: () => {
693
+ resolve(null);
694
+ }
691
695
  });
692
696
  });
693
697
  });
@@ -1421,9 +1425,10 @@ class AppContextService extends BaseApiService {
1421
1425
  }
1422
1426
  let now = new Date();
1423
1427
  console.log('Requesting a new AppContext at ' + now);
1424
- this.subscription = this.get('getCurrentContext', null).subscribe((data) => {
1425
- this.dataReceived(data);
1426
- }, (e) => {
1428
+ this.subscription = this.get('getCurrentContext', null).subscribe({
1429
+ next: (data) => {
1430
+ this.dataReceived(data);
1431
+ }
1427
1432
  });
1428
1433
  }
1429
1434
  updateCurrent(success = null) {
@@ -1483,13 +1488,15 @@ class IdleService {
1483
1488
  this.startDate = new Date();
1484
1489
  }
1485
1490
  startTimer() {
1486
- this.timer$ = timer(this.timeOutMilliSeconds, 1 * 1000).subscribe((res) => {
1487
- let nowDate = new Date();
1488
- let exiredDate = new Date(this.startDate.getTime() + this.timeOutMilliSeconds);
1489
- if (nowDate.getTime() >= exiredDate.getTime()) {
1490
- //console.log("nowDate: " + nowDate);
1491
- //console.log("exiredDate: " + exiredDate);
1492
- this.expired$.next(true);
1491
+ this.timer$ = timer(this.timeOutMilliSeconds, 1 * 1000).subscribe({
1492
+ next: (data) => {
1493
+ let nowDate = new Date();
1494
+ let exiredDate = new Date(this.startDate.getTime() + this.timeOutMilliSeconds);
1495
+ if (nowDate.getTime() >= exiredDate.getTime()) {
1496
+ //console.log("nowDate: " + nowDate);
1497
+ //console.log("exiredDate: " + exiredDate);
1498
+ this.expired$.next(true);
1499
+ }
1493
1500
  }
1494
1501
  });
1495
1502
  }
@@ -1500,8 +1507,10 @@ class IdleService {
1500
1507
  startWatching(timeOutSeconds) {
1501
1508
  this.idle$ = merge(fromEvent(document, 'mousemove'), fromEvent(document, 'click'), fromEvent(document, 'mousedown'), fromEvent(document, 'keypress'), fromEvent(document, 'DOMMouseScroll'), fromEvent(document, 'mousewheel'), fromEvent(document, 'touchmove'), fromEvent(document, 'MSPointerMove'), fromEvent(window, 'mousemove'), fromEvent(window, 'resize'));
1502
1509
  this.resetTimeCounters(timeOutSeconds);
1503
- this.idleSubscription = this.idle$.subscribe((res) => {
1504
- this.resetTimer();
1510
+ this.idleSubscription = this.idle$.subscribe({
1511
+ next: (data) => {
1512
+ this.resetTimer();
1513
+ }
1505
1514
  });
1506
1515
  this.startTimer();
1507
1516
  return this.expired$;
@@ -1616,11 +1625,13 @@ class GoogleAnalyticsService {
1616
1625
  */
1617
1626
  }
1618
1627
  subscribe() {
1619
- this.subscription = this.router.events.subscribe(event => {
1620
- if (event instanceof NavigationEnd) {
1621
- if (window.ga) {
1622
- window.ga('set', 'page', event.urlAfterRedirects);
1623
- window.ga('send', 'pageview');
1628
+ this.subscription = this.router.events.subscribe({
1629
+ next: (event) => {
1630
+ if (event instanceof NavigationEnd) {
1631
+ if (window.ga) {
1632
+ window.ga('set', 'page', event.urlAfterRedirects);
1633
+ window.ga('send', 'pageview');
1634
+ }
1624
1635
  }
1625
1636
  }
1626
1637
  });
@@ -1955,13 +1966,16 @@ class BaseGridReadService extends BehaviorSubject {
1955
1966
  url = this.baseReadUrl + `${this.serializeParams(params)}`;
1956
1967
  this.savedReadParams = params;
1957
1968
  }
1958
- this.http.get(url).pipe(map(res => res)).subscribe(data => {
1959
- super.next(data);
1960
- if (success)
1961
- success();
1962
- }, e => {
1963
- if (error)
1964
- error(e);
1969
+ this.http.get(url).pipe(map(res => res)).subscribe({
1970
+ next: (data) => {
1971
+ super.next(data);
1972
+ if (success)
1973
+ success();
1974
+ },
1975
+ error: (e) => {
1976
+ if (error)
1977
+ error(e);
1978
+ }
1965
1979
  });
1966
1980
  }
1967
1981
  }
@@ -2007,24 +2021,31 @@ class BaseGridEditService extends BaseGridReadService {
2007
2021
  save(data, isNew, sucess) {
2008
2022
  const action = isNew ? 'add' : 'update';
2009
2023
  this.reset();
2010
- this.post(action, data).subscribe(() => {
2011
- }, () => {
2012
- this.read();
2013
- }, () => {
2014
- this.read();
2015
- if (sucess)
2016
- sucess();
2024
+ this.post(action, data).subscribe({
2025
+ next: (data) => {
2026
+ },
2027
+ error: (e) => {
2028
+ this.read();
2029
+ },
2030
+ complete: () => {
2031
+ this.read();
2032
+ if (sucess)
2033
+ sucess();
2034
+ }
2017
2035
  });
2018
2036
  }
2019
2037
  delete(data, sucess) {
2020
2038
  this.reset();
2021
2039
  const url = `${this.baseUrl}/delete${this.serializeParams(data)}`;
2022
- return this.http.delete(url).subscribe(() => {
2023
- this.read();
2024
- if (sucess)
2025
- sucess();
2026
- }, () => {
2027
- this.read();
2040
+ return this.http.delete(url).subscribe({
2041
+ next: (data) => {
2042
+ this.read();
2043
+ if (sucess)
2044
+ sucess();
2045
+ },
2046
+ error: (e) => {
2047
+ this.read();
2048
+ }
2028
2049
  });
2029
2050
  }
2030
2051
  post(action, data) {
@@ -2118,12 +2139,17 @@ class EmailsApiService extends BaseApiService {
2118
2139
  this.baseUrl = Consts.emailsApiPath;
2119
2140
  }
2120
2141
  sendContactUs(captcha, name, email, topic, subject, message, success, error) {
2121
- return this.post('sendContactUs', { captcha, name, email, topic, subject, message }).subscribe(data => {
2122
- if (success)
2123
- success(data);
2124
- }, e => {
2125
- if (error)
2126
- error(e);
2142
+ return this.post('sendContactUs', { captcha, name, email, topic, subject, message }).subscribe({
2143
+ next: (data) => {
2144
+ if (success) {
2145
+ success(data);
2146
+ }
2147
+ },
2148
+ error: (e) => {
2149
+ if (error) {
2150
+ error(e);
2151
+ }
2152
+ }
2127
2153
  });
2128
2154
  }
2129
2155
  }
@@ -2155,13 +2181,31 @@ class CoreApiService extends BaseApiService {
2155
2181
  this.baseUrl = Consts.coreApiPath;
2156
2182
  }
2157
2183
  getTimezonesJsonFile(done) {
2158
- this.getExternalJsonFile('anatoly', 'timezones.json').subscribe(data => done(data));
2184
+ this.getExternalJsonFile('anatoly', 'timezones.json').subscribe({
2185
+ next: (data) => {
2186
+ if (done) {
2187
+ done(data);
2188
+ }
2189
+ }
2190
+ });
2159
2191
  }
2160
2192
  getUSStatesJsonFile(done) {
2161
- this.getExternalJsonFile('anatoly', 'usStates.json').subscribe(data => done(data));
2193
+ this.getExternalJsonFile('anatoly', 'usStates.json').subscribe({
2194
+ next: (data) => {
2195
+ if (done) {
2196
+ done(data);
2197
+ }
2198
+ }
2199
+ });
2162
2200
  }
2163
2201
  getCountriesJsonFile(done) {
2164
- this.getExternalJsonFile('anatoly', 'countries.json').subscribe(data => done(data));
2202
+ this.getExternalJsonFile('anatoly', 'countries.json').subscribe({
2203
+ next: (data) => {
2204
+ if (done) {
2205
+ done(data);
2206
+ }
2207
+ }
2208
+ });
2165
2209
  }
2166
2210
  }
2167
2211
  CoreApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: CoreApiService, deps: [{ token: i1$3.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -3116,8 +3160,10 @@ class LoadingComponent {
3116
3160
  this.show = false;
3117
3161
  }
3118
3162
  ngOnInit() {
3119
- this.subs.sink = this.loadingService.subscribe((state) => {
3120
- this.show = state;
3163
+ this.subs.sink = this.loadingService.subscribe({
3164
+ next: (data) => {
3165
+ this.show = data;
3166
+ }
3121
3167
  });
3122
3168
  }
3123
3169
  ngOnDestroy() {
@@ -3162,19 +3208,22 @@ class PageSpinnerComponent {
3162
3208
  constructor(router, document) {
3163
3209
  this.router = router;
3164
3210
  this.document = document;
3165
- this.backgroundColor = '#2196f3';
3166
- this.spinner = Spinkit.skLine;
3167
3211
  this.isSpinnerVisible = true;
3168
3212
  this.Spinkit = Spinkit;
3169
- this.router.events.subscribe(event => {
3170
- if (event instanceof NavigationStart) {
3171
- this.isSpinnerVisible = true;
3172
- }
3173
- else if (event instanceof NavigationEnd || event instanceof NavigationCancel || event instanceof NavigationError) {
3213
+ this.backgroundColor = '#2196f3';
3214
+ this.spinner = Spinkit.skLine;
3215
+ this.router.events.subscribe({
3216
+ next: (event) => {
3217
+ if (event instanceof NavigationStart) {
3218
+ this.isSpinnerVisible = true;
3219
+ }
3220
+ else if (event instanceof NavigationEnd || event instanceof NavigationCancel || event instanceof NavigationError) {
3221
+ this.isSpinnerVisible = false;
3222
+ }
3223
+ },
3224
+ error: (e) => {
3174
3225
  this.isSpinnerVisible = false;
3175
3226
  }
3176
- }, () => {
3177
- this.isSpinnerVisible = false;
3178
3227
  });
3179
3228
  }
3180
3229
  ngOnDestroy() {
@@ -3808,15 +3857,19 @@ class UrlSlugComponent extends BaseEditComponent {
3808
3857
  this.setFormValue(this.controlName, event.urlSlug);
3809
3858
  }
3810
3859
  startWatching() {
3811
- this.subs.sink = this.formGroup.get(this.watchedControlName).valueChanges.subscribe(value => {
3812
- if (this.firstValue) {
3813
- this.firstValue = false;
3814
- return;
3860
+ this.subs.sink = this.formGroup.get(this.watchedControlName).valueChanges.subscribe({
3861
+ next: (value) => {
3862
+ if (this.firstValue) {
3863
+ this.firstValue = false;
3864
+ return;
3865
+ }
3866
+ this.generateUrlSlug(value);
3815
3867
  }
3816
- this.generateUrlSlug(value);
3817
3868
  });
3818
- this.subs.sink = this.formGroup.get(this.controlName).valueChanges.subscribe(value => {
3819
- this.hrefGo = value;
3869
+ this.subs.sink = this.formGroup.get(this.controlName).valueChanges.subscribe({
3870
+ next: (value) => {
3871
+ this.hrefGo = value;
3872
+ }
3820
3873
  });
3821
3874
  }
3822
3875
  //Events