@osovitny/anatoly 2.0.33 → 2.0.35

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.
@@ -168,6 +168,12 @@ class LoadingService extends BehaviorSubject {
168
168
  this.isFreezed = false;
169
169
  }, timeout);
170
170
  }
171
+ reset() {
172
+ if (this.counter > 0) {
173
+ this.next(false);
174
+ }
175
+ this.counter = 0;
176
+ }
171
177
  }
172
178
  LoadingService.ɵprov = ɵɵdefineInjectable({ factory: function LoadingService_Factory() { return new LoadingService(); }, token: LoadingService, providedIn: "root" });
173
179
  LoadingService.decorators = [
@@ -1076,54 +1082,65 @@ NotificationService.ctorParameters = () => [
1076
1082
  class BaseApiService {
1077
1083
  constructor(http) {
1078
1084
  this.http = http;
1079
- this.baseUrl = '';
1080
1085
  }
1081
1086
  serializeParams(data) {
1082
- return data ? '?' + $.param(data) : '';
1087
+ return data ? ('?' + $.param(data)) : '';
1083
1088
  }
1084
- // api
1089
+ //api
1085
1090
  get(action, data, responseType) {
1086
1091
  if (!responseType) {
1087
1092
  responseType = 'json';
1088
1093
  }
1089
- const url = `${this.baseUrl}/${action}${this.serializeParams(data)}`;
1090
- return this.http
1091
- .get(url, { responseType })
1092
- .pipe(map((res) => res));
1094
+ var url = `${this.baseUrl}/${action}${this.serializeParams(data)}`;
1095
+ return this.http.get(url, { responseType: responseType }).pipe(map(res => res));
1093
1096
  }
1094
1097
  post(action, data, responseType) {
1095
1098
  if (!responseType) {
1096
1099
  responseType = 'text';
1097
1100
  }
1098
- const url = `${this.baseUrl}/${action}`;
1099
- return this.http.post(url, data, { responseType });
1101
+ var url = `${this.baseUrl}/${action}`;
1102
+ return this.http.post(url, data, { responseType: responseType });
1100
1103
  }
1101
1104
  postQS(action, data, responseType) {
1102
1105
  if (!responseType) {
1103
1106
  responseType = 'text';
1104
1107
  }
1105
- const url = `${this.baseUrl}/${action}${this.serializeParams(data)}`;
1106
- return this.http.post(url, null, { responseType });
1108
+ var url = `${this.baseUrl}/${action}${this.serializeParams(data)}`;
1109
+ return this.http.post(url, null, { responseType: responseType });
1107
1110
  }
1108
1111
  delete(action, data, responseType) {
1109
1112
  if (!responseType) {
1110
1113
  responseType = 'text';
1111
1114
  }
1112
- const url = `${this.baseUrl}/${action}${this.serializeParams(data)}`;
1113
- return this.http.delete(url, { responseType });
1115
+ var url = `${this.baseUrl}/${action}${this.serializeParams(data)}`;
1116
+ return this.http.delete(url, { responseType: responseType });
1114
1117
  }
1115
- // gets
1118
+ //gets
1116
1119
  getById(id) {
1117
1120
  return this.get('getById', { id });
1118
1121
  }
1119
1122
  getAll(data) {
1120
- return this.get('getall', data).pipe(map((res) => res));
1123
+ return this.get('getAll', data).pipe(map((res) => res));
1124
+ }
1125
+ getExternalTextFile(url) {
1126
+ return this.http.get(url);
1127
+ }
1128
+ getExternalJsonFile(url) {
1129
+ return this.http.get(url);
1121
1130
  }
1122
1131
  getJsonFile(fileName) {
1123
1132
  const jsonsUrl = AppCoreSettings.jsonsUrl;
1124
1133
  const jsonVersion = AppCoreSettings.jsonVersion;
1125
- const url = jsonsUrl + '/' + fileName + '?' + jsonVersion;
1126
- return this.http.get(url).pipe(map((res) => res));
1134
+ const isCDNEnabled = AppCoreSettings.isCDNEnabled;
1135
+ const cdnSasToken = AppCoreSettings.cdnSasToken;
1136
+ let url = "";
1137
+ if (isCDNEnabled) {
1138
+ url = jsonsUrl + "/" + fileName + cdnSasToken;
1139
+ }
1140
+ else {
1141
+ url = jsonsUrl + "/" + fileName + '?' + jsonVersion;
1142
+ }
1143
+ return this.http.get(url).pipe(map(res => res));
1127
1144
  }
1128
1145
  }
1129
1146
  BaseApiService.decorators = [
@@ -1462,32 +1479,28 @@ class BaseGridReadService extends BehaviorSubject {
1462
1479
  constructor(http) {
1463
1480
  super([]);
1464
1481
  this.http = http;
1465
- this.baseReadUrl = "";
1466
1482
  this.data = [];
1467
1483
  }
1468
1484
  serializeParams(data) {
1469
- return data ? "?" + $.param(data) : "";
1485
+ return data ? ('?' + $.param(data)) : '';
1470
1486
  }
1471
1487
  read(params, success, error) {
1472
1488
  if (this.data.length) {
1473
1489
  return super.next(this.data);
1474
1490
  }
1475
1491
  var url = this.baseReadUrl;
1476
- if (typeof params === "undefined") {
1492
+ if (typeof params === 'undefined') {
1477
1493
  params = this.savedReadParams;
1478
1494
  }
1479
1495
  if (params) {
1480
1496
  url = this.baseReadUrl + `${this.serializeParams(params)}`;
1481
1497
  this.savedReadParams = params;
1482
1498
  }
1483
- this.http
1484
- .get(url)
1485
- .pipe(map((res) => res))
1486
- .subscribe((data) => {
1499
+ this.http.get(url).pipe(map(res => res)).subscribe(data => {
1487
1500
  super.next(data);
1488
1501
  if (success)
1489
1502
  success();
1490
- }, (e) => {
1503
+ }, e => {
1491
1504
  if (error)
1492
1505
  error(e);
1493
1506
  });
@@ -1522,7 +1535,6 @@ class BaseGridEditService extends BaseGridReadService {
1522
1535
  constructor(http) {
1523
1536
  super(http);
1524
1537
  this.http = http;
1525
- this.baseUrl = "";
1526
1538
  }
1527
1539
  reset() {
1528
1540
  this.data = [];
@@ -1532,15 +1544,16 @@ class BaseGridEditService extends BaseGridReadService {
1532
1544
  return;
1533
1545
  }
1534
1546
  //find orignal data item
1535
- const originalDataItem = this.data.find((item) => item.Id === dataItem.Id);
1547
+ const originalDataItem = this.data.find(item => item.Id === dataItem.Id);
1536
1548
  //revert changes
1537
1549
  Object.assign(originalDataItem, dataItem);
1538
1550
  super.next(this.data);
1539
1551
  }
1540
1552
  save(data, isNew, sucess) {
1541
- const action = isNew ? "add" : "update";
1553
+ const action = isNew ? 'add' : 'update';
1542
1554
  this.reset();
1543
- this.post(action, data).subscribe(() => { }, () => {
1555
+ this.post(action, data).subscribe(() => {
1556
+ }, () => {
1544
1557
  this.read();
1545
1558
  }, () => {
1546
1559
  this.read();
@@ -1548,9 +1561,10 @@ class BaseGridEditService extends BaseGridReadService {
1548
1561
  sucess();
1549
1562
  });
1550
1563
  }
1551
- remove(data, sucess) {
1564
+ delete(data, sucess) {
1552
1565
  this.reset();
1553
- this.post("remove", data).subscribe(() => { }, () => {
1566
+ this.post('delete', data).subscribe(() => {
1567
+ }, () => {
1554
1568
  this.read();
1555
1569
  }, () => {
1556
1570
  this.read();
@@ -1560,7 +1574,7 @@ class BaseGridEditService extends BaseGridReadService {
1560
1574
  }
1561
1575
  post(action, data) {
1562
1576
  var url = this.baseUrl + `${action}${this.serializeParams(data)}`;
1563
- return this.http.post(url, data).pipe(map((res) => res));
1577
+ return this.http.post(url, data).pipe(map(res => res));
1564
1578
  }
1565
1579
  }
1566
1580
  BaseGridEditService.decorators = [
@@ -1657,30 +1671,30 @@ class BillingApiService extends BaseApiService {
1657
1671
  this.baseUrl = consts.billingApiPath;
1658
1672
  }
1659
1673
  requestNewSubscription(requestedPlan, success, error) {
1660
- this.postQS("requestNewSubscription", { requestedPlan: requestedPlan }).subscribe((data) => { }, (e) => {
1661
- if (error)
1662
- error();
1663
- }, () => {
1674
+ this.postQS("requestNewSubscription", { requestedPlan: requestedPlan }).subscribe((data) => {
1664
1675
  if (success)
1665
1676
  success();
1677
+ }, (e) => {
1678
+ if (error)
1679
+ error();
1666
1680
  });
1667
1681
  }
1668
1682
  cancelRequestedSubscription(success, error) {
1669
- this.postQS("cancelRequestedSubscription", null).subscribe((data) => { }, (e) => {
1670
- if (error)
1671
- error();
1672
- }, () => {
1683
+ this.postQS("cancelRequestedSubscription", null).subscribe((data) => {
1673
1684
  if (success)
1674
1685
  success();
1686
+ }, (e) => {
1687
+ if (error)
1688
+ error();
1675
1689
  });
1676
1690
  }
1677
1691
  buyAccess(requestedPlan, success, error) {
1678
- this.postQS("buyAccess", { requestedPlan: requestedPlan }).subscribe((data) => { }, (e) => {
1679
- if (error)
1680
- error();
1681
- }, () => {
1692
+ this.postQS("buyAccess", { requestedPlan: requestedPlan }).subscribe((data) => {
1682
1693
  if (success)
1683
1694
  success();
1695
+ }, (e) => {
1696
+ if (error)
1697
+ error();
1684
1698
  });
1685
1699
  }
1686
1700
  }
@@ -3011,12 +3025,12 @@ AnatolyUIModule.decorators = [
3011
3025
  ];
3012
3026
 
3013
3027
  /*
3014
- * Public API Surface of anatoly
3028
+ * Public API
3015
3029
  */
3016
3030
 
3017
3031
  /**
3018
3032
  * Generated bundle index. Do not edit.
3019
3033
  */
3020
3034
 
3021
- export { Alerts, AnatolyCoreModule, AnatolyDataModule, AnatolyHttpInterceptor, AnatolyUIModule, AppContextService, AppCoreSettings, BaseApiService, BaseComponent, BaseEditComponent, BaseGoService, BaseGridEditService, BaseGridReadService, BaseHtmlEditorComponent, BillingApiService, BuyAccessButtonComponent, ContentHeaderComponent, ContextInitState, Convert, DefaultEditorOptions, FileSizePipe, FormValidationSummaryComponent, FormsHtmlEditorComponent, FroalaEditorModuleWithProviders, FroalaViewModuleWithProviders, GlobalErrorHandler, Guid, HtmlEditorComponent, IdleService, InjectorInstance, ItemValidationSummaryComponent, LoadingComponent, LoadingService, LocalStorageService, LocalizationInjectorInstance, LocalizationModule, LocalizationService, LocalizationSettingsModule, LocalizePipe, LoggingService, NativeElementDirective, NotificationService, NotificationsApiService, ReplaceTextPipe, SafeHtmlPipe, SessionStorageService, SignInButtonComponent, SignOutButtonComponent, SignUpButtonComponent, SpinnerComponent, Subs, SubscribePlanButtonComponent, TranslateModuleAtRoot, UpgradePlanButtonComponent, Urls, Utils, ValidationSummaryComponent, consts, customTranslateLoaderFactory, localizationInitializerFactory, throwIfAlreadyLoaded };
3035
+ export { Alerts, AnatolyCoreModule, AnatolyDataModule, AnatolyHttpInterceptor, AnatolyUIModule, AppContextService, AppCoreSettings, BaseApiService, BaseComponent, BaseEditComponent, BaseGoService, BaseGridEditService, BaseGridReadService, BaseHtmlEditorComponent, BillingApiService, BuyAccessButtonComponent, ContentHeaderComponent, ContextInitState, Convert, DefaultEditorOptions, FileSizePipe, FormValidationSummaryComponent, FormsHtmlEditorComponent, FroalaEditorModuleWithProviders, FroalaViewModuleWithProviders, GlobalErrorHandler, Guid, HtmlEditorComponent, IdleService, InjectorInstance, ItemValidationSummaryComponent, LoadingComponent, LoadingService, LocalStorageService, LocalizationInjectorInstance, LocalizationModule, LocalizationService, LocalizationSettingsModule, LocalizePipe, LoggingService, NativeElementDirective, NotificationService, NotificationsApiService, ReplaceTextPipe, SafeHtmlPipe, SessionStorageService, SignInButtonComponent, SignOutButtonComponent, SignUpButtonComponent, SpinnerComponent, Subs, SubscribePlanButtonComponent, TranslateModuleAtRoot, UpgradePlanButtonComponent, Urls, Utils, ValidationSummaryComponent, customTranslateLoaderFactory, localizationInitializerFactory, throwIfAlreadyLoaded };
3022
3036
  //# sourceMappingURL=osovitny-anatoly.js.map