@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
  });
@@ -1437,9 +1441,10 @@ class AppContextService extends BaseApiService {
1437
1441
  }
1438
1442
  let now = new Date();
1439
1443
  console.log('Requesting a new AppContext at ' + now);
1440
- this.subscription = this.get('getCurrentContext', null).subscribe((data) => {
1441
- this.dataReceived(data);
1442
- }, (e) => {
1444
+ this.subscription = this.get('getCurrentContext', null).subscribe({
1445
+ next: (data) => {
1446
+ this.dataReceived(data);
1447
+ }
1443
1448
  });
1444
1449
  }
1445
1450
  updateCurrent(success = null) {
@@ -1499,13 +1504,15 @@ class IdleService {
1499
1504
  this.startDate = new Date();
1500
1505
  }
1501
1506
  startTimer() {
1502
- this.timer$ = timer(this.timeOutMilliSeconds, 1 * 1000).subscribe((res) => {
1503
- let nowDate = new Date();
1504
- let exiredDate = new Date(this.startDate.getTime() + this.timeOutMilliSeconds);
1505
- if (nowDate.getTime() >= exiredDate.getTime()) {
1506
- //console.log("nowDate: " + nowDate);
1507
- //console.log("exiredDate: " + exiredDate);
1508
- this.expired$.next(true);
1507
+ this.timer$ = timer(this.timeOutMilliSeconds, 1 * 1000).subscribe({
1508
+ next: (data) => {
1509
+ let nowDate = new Date();
1510
+ let exiredDate = new Date(this.startDate.getTime() + this.timeOutMilliSeconds);
1511
+ if (nowDate.getTime() >= exiredDate.getTime()) {
1512
+ //console.log("nowDate: " + nowDate);
1513
+ //console.log("exiredDate: " + exiredDate);
1514
+ this.expired$.next(true);
1515
+ }
1509
1516
  }
1510
1517
  });
1511
1518
  }
@@ -1516,8 +1523,10 @@ class IdleService {
1516
1523
  startWatching(timeOutSeconds) {
1517
1524
  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'));
1518
1525
  this.resetTimeCounters(timeOutSeconds);
1519
- this.idleSubscription = this.idle$.subscribe((res) => {
1520
- this.resetTimer();
1526
+ this.idleSubscription = this.idle$.subscribe({
1527
+ next: (data) => {
1528
+ this.resetTimer();
1529
+ }
1521
1530
  });
1522
1531
  this.startTimer();
1523
1532
  return this.expired$;
@@ -1630,11 +1639,13 @@ class GoogleAnalyticsService {
1630
1639
  */
1631
1640
  }
1632
1641
  subscribe() {
1633
- this.subscription = this.router.events.subscribe(event => {
1634
- if (event instanceof NavigationEnd) {
1635
- if (window.ga) {
1636
- window.ga('set', 'page', event.urlAfterRedirects);
1637
- window.ga('send', 'pageview');
1642
+ this.subscription = this.router.events.subscribe({
1643
+ next: (event) => {
1644
+ if (event instanceof NavigationEnd) {
1645
+ if (window.ga) {
1646
+ window.ga('set', 'page', event.urlAfterRedirects);
1647
+ window.ga('send', 'pageview');
1648
+ }
1638
1649
  }
1639
1650
  }
1640
1651
  });
@@ -1969,13 +1980,16 @@ class BaseGridReadService extends BehaviorSubject {
1969
1980
  url = this.baseReadUrl + `${this.serializeParams(params)}`;
1970
1981
  this.savedReadParams = params;
1971
1982
  }
1972
- this.http.get(url).pipe(map(res => res)).subscribe(data => {
1973
- super.next(data);
1974
- if (success)
1975
- success();
1976
- }, e => {
1977
- if (error)
1978
- error(e);
1983
+ this.http.get(url).pipe(map(res => res)).subscribe({
1984
+ next: (data) => {
1985
+ super.next(data);
1986
+ if (success)
1987
+ success();
1988
+ },
1989
+ error: (e) => {
1990
+ if (error)
1991
+ error(e);
1992
+ }
1979
1993
  });
1980
1994
  }
1981
1995
  }
@@ -2021,24 +2035,31 @@ class BaseGridEditService extends BaseGridReadService {
2021
2035
  save(data, isNew, sucess) {
2022
2036
  const action = isNew ? 'add' : 'update';
2023
2037
  this.reset();
2024
- this.post(action, data).subscribe(() => {
2025
- }, () => {
2026
- this.read();
2027
- }, () => {
2028
- this.read();
2029
- if (sucess)
2030
- sucess();
2038
+ this.post(action, data).subscribe({
2039
+ next: (data) => {
2040
+ },
2041
+ error: (e) => {
2042
+ this.read();
2043
+ },
2044
+ complete: () => {
2045
+ this.read();
2046
+ if (sucess)
2047
+ sucess();
2048
+ }
2031
2049
  });
2032
2050
  }
2033
2051
  delete(data, sucess) {
2034
2052
  this.reset();
2035
2053
  const url = `${this.baseUrl}/delete${this.serializeParams(data)}`;
2036
- return this.http.delete(url).subscribe(() => {
2037
- this.read();
2038
- if (sucess)
2039
- sucess();
2040
- }, () => {
2041
- this.read();
2054
+ return this.http.delete(url).subscribe({
2055
+ next: (data) => {
2056
+ this.read();
2057
+ if (sucess)
2058
+ sucess();
2059
+ },
2060
+ error: (e) => {
2061
+ this.read();
2062
+ }
2042
2063
  });
2043
2064
  }
2044
2065
  post(action, data) {
@@ -2132,12 +2153,17 @@ class EmailsApiService extends BaseApiService {
2132
2153
  this.baseUrl = Consts.emailsApiPath;
2133
2154
  }
2134
2155
  sendContactUs(captcha, name, email, topic, subject, message, success, error) {
2135
- return this.post('sendContactUs', { captcha, name, email, topic, subject, message }).subscribe(data => {
2136
- if (success)
2137
- success(data);
2138
- }, e => {
2139
- if (error)
2140
- error(e);
2156
+ return this.post('sendContactUs', { captcha, name, email, topic, subject, message }).subscribe({
2157
+ next: (data) => {
2158
+ if (success) {
2159
+ success(data);
2160
+ }
2161
+ },
2162
+ error: (e) => {
2163
+ if (error) {
2164
+ error(e);
2165
+ }
2166
+ }
2141
2167
  });
2142
2168
  }
2143
2169
  }
@@ -2169,13 +2195,31 @@ class CoreApiService extends BaseApiService {
2169
2195
  this.baseUrl = Consts.coreApiPath;
2170
2196
  }
2171
2197
  getTimezonesJsonFile(done) {
2172
- this.getExternalJsonFile('anatoly', 'timezones.json').subscribe(data => done(data));
2198
+ this.getExternalJsonFile('anatoly', 'timezones.json').subscribe({
2199
+ next: (data) => {
2200
+ if (done) {
2201
+ done(data);
2202
+ }
2203
+ }
2204
+ });
2173
2205
  }
2174
2206
  getUSStatesJsonFile(done) {
2175
- this.getExternalJsonFile('anatoly', 'usStates.json').subscribe(data => done(data));
2207
+ this.getExternalJsonFile('anatoly', 'usStates.json').subscribe({
2208
+ next: (data) => {
2209
+ if (done) {
2210
+ done(data);
2211
+ }
2212
+ }
2213
+ });
2176
2214
  }
2177
2215
  getCountriesJsonFile(done) {
2178
- this.getExternalJsonFile('anatoly', 'countries.json').subscribe(data => done(data));
2216
+ this.getExternalJsonFile('anatoly', 'countries.json').subscribe({
2217
+ next: (data) => {
2218
+ if (done) {
2219
+ done(data);
2220
+ }
2221
+ }
2222
+ });
2179
2223
  }
2180
2224
  }
2181
2225
  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 });
@@ -3127,8 +3171,10 @@ class LoadingComponent {
3127
3171
  this.show = false;
3128
3172
  }
3129
3173
  ngOnInit() {
3130
- this.subs.sink = this.loadingService.subscribe((state) => {
3131
- this.show = state;
3174
+ this.subs.sink = this.loadingService.subscribe({
3175
+ next: (data) => {
3176
+ this.show = data;
3177
+ }
3132
3178
  });
3133
3179
  }
3134
3180
  ngOnDestroy() {
@@ -3173,19 +3219,22 @@ class PageSpinnerComponent {
3173
3219
  constructor(router, document) {
3174
3220
  this.router = router;
3175
3221
  this.document = document;
3176
- this.backgroundColor = '#2196f3';
3177
- this.spinner = Spinkit.skLine;
3178
3222
  this.isSpinnerVisible = true;
3179
3223
  this.Spinkit = Spinkit;
3180
- this.router.events.subscribe(event => {
3181
- if (event instanceof NavigationStart) {
3182
- this.isSpinnerVisible = true;
3183
- }
3184
- else if (event instanceof NavigationEnd || event instanceof NavigationCancel || event instanceof NavigationError) {
3224
+ this.backgroundColor = '#2196f3';
3225
+ this.spinner = Spinkit.skLine;
3226
+ this.router.events.subscribe({
3227
+ next: (event) => {
3228
+ if (event instanceof NavigationStart) {
3229
+ this.isSpinnerVisible = true;
3230
+ }
3231
+ else if (event instanceof NavigationEnd || event instanceof NavigationCancel || event instanceof NavigationError) {
3232
+ this.isSpinnerVisible = false;
3233
+ }
3234
+ },
3235
+ error: (e) => {
3185
3236
  this.isSpinnerVisible = false;
3186
3237
  }
3187
- }, () => {
3188
- this.isSpinnerVisible = false;
3189
3238
  });
3190
3239
  }
3191
3240
  ngOnDestroy() {
@@ -3816,15 +3865,19 @@ class UrlSlugComponent extends BaseEditComponent {
3816
3865
  this.setFormValue(this.controlName, event.urlSlug);
3817
3866
  }
3818
3867
  startWatching() {
3819
- this.subs.sink = this.formGroup.get(this.watchedControlName).valueChanges.subscribe(value => {
3820
- if (this.firstValue) {
3821
- this.firstValue = false;
3822
- return;
3868
+ this.subs.sink = this.formGroup.get(this.watchedControlName).valueChanges.subscribe({
3869
+ next: (value) => {
3870
+ if (this.firstValue) {
3871
+ this.firstValue = false;
3872
+ return;
3873
+ }
3874
+ this.generateUrlSlug(value);
3823
3875
  }
3824
- this.generateUrlSlug(value);
3825
3876
  });
3826
- this.subs.sink = this.formGroup.get(this.controlName).valueChanges.subscribe(value => {
3827
- this.hrefGo = value;
3877
+ this.subs.sink = this.formGroup.get(this.controlName).valueChanges.subscribe({
3878
+ next: (value) => {
3879
+ this.hrefGo = value;
3880
+ }
3828
3881
  });
3829
3882
  }
3830
3883
  //Events