@osovitny/anatoly 2.0.32 → 2.0.34

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.
@@ -1076,54 +1076,59 @@ NotificationService.ctorParameters = () => [
1076
1076
  class BaseApiService {
1077
1077
  constructor(http) {
1078
1078
  this.http = http;
1079
- this.baseUrl = '';
1080
1079
  }
1081
1080
  serializeParams(data) {
1082
- return data ? '?' + $.param(data) : '';
1081
+ return data ? ('?' + $.param(data)) : '';
1083
1082
  }
1084
- // api
1083
+ //api
1085
1084
  get(action, data, responseType) {
1086
1085
  if (!responseType) {
1087
1086
  responseType = 'json';
1088
1087
  }
1089
- const url = `${this.baseUrl}/${action}${this.serializeParams(data)}`;
1090
- return this.http
1091
- .get(url, { responseType })
1092
- .pipe(map((res) => res));
1088
+ var url = `${this.baseUrl}/${action}${this.serializeParams(data)}`;
1089
+ return this.http.get(url, { responseType: responseType }).pipe(map(res => res));
1093
1090
  }
1094
1091
  post(action, data, responseType) {
1095
1092
  if (!responseType) {
1096
1093
  responseType = 'text';
1097
1094
  }
1098
- const url = `${this.baseUrl}/${action}`;
1099
- return this.http.post(url, data, { responseType });
1095
+ var url = `${this.baseUrl}/${action}`;
1096
+ return this.http.post(url, data, { responseType: responseType });
1100
1097
  }
1101
1098
  postQS(action, data, responseType) {
1102
1099
  if (!responseType) {
1103
1100
  responseType = 'text';
1104
1101
  }
1105
- const url = `${this.baseUrl}/${action}${this.serializeParams(data)}`;
1106
- return this.http.post(url, null, { responseType });
1102
+ var url = `${this.baseUrl}/${action}${this.serializeParams(data)}`;
1103
+ return this.http.post(url, null, { responseType: responseType });
1107
1104
  }
1108
1105
  delete(action, data, responseType) {
1109
1106
  if (!responseType) {
1110
1107
  responseType = 'text';
1111
1108
  }
1112
- const url = `${this.baseUrl}/${action}${this.serializeParams(data)}`;
1113
- return this.http.delete(url, { responseType });
1109
+ var url = `${this.baseUrl}/${action}${this.serializeParams(data)}`;
1110
+ return this.http.delete(url, { responseType: responseType });
1114
1111
  }
1115
- // gets
1116
- getById(id) {
1117
- return this.get('getById', { id });
1112
+ //gets
1113
+ getExternalTextFile(url) {
1114
+ return this.http.get(url);
1118
1115
  }
1119
- getAll(data) {
1120
- return this.get('getall', data).pipe(map((res) => res));
1116
+ getExternalJsonFile(url) {
1117
+ return this.http.get(url);
1121
1118
  }
1122
1119
  getJsonFile(fileName) {
1123
1120
  const jsonsUrl = AppCoreSettings.jsonsUrl;
1124
1121
  const jsonVersion = AppCoreSettings.jsonVersion;
1125
- const url = jsonsUrl + '/' + fileName + '?' + jsonVersion;
1126
- return this.http.get(url).pipe(map((res) => res));
1122
+ const isCDNEnabled = AppCoreSettings.isCDNEnabled;
1123
+ const cdnSasToken = AppCoreSettings.cdnSasToken;
1124
+ let url = "";
1125
+ if (isCDNEnabled) {
1126
+ url = jsonsUrl + "/" + fileName + cdnSasToken;
1127
+ }
1128
+ else {
1129
+ url = jsonsUrl + "/" + fileName + '?' + jsonVersion;
1130
+ }
1131
+ return this.http.get(url).pipe(map(res => res));
1127
1132
  }
1128
1133
  }
1129
1134
  BaseApiService.decorators = [
@@ -1462,32 +1467,28 @@ class BaseGridReadService extends BehaviorSubject {
1462
1467
  constructor(http) {
1463
1468
  super([]);
1464
1469
  this.http = http;
1465
- this.baseReadUrl = "";
1466
1470
  this.data = [];
1467
1471
  }
1468
1472
  serializeParams(data) {
1469
- return data ? "?" + $.param(data) : "";
1473
+ return data ? ('?' + $.param(data)) : '';
1470
1474
  }
1471
1475
  read(params, success, error) {
1472
1476
  if (this.data.length) {
1473
1477
  return super.next(this.data);
1474
1478
  }
1475
1479
  var url = this.baseReadUrl;
1476
- if (typeof params === "undefined") {
1480
+ if (typeof params === 'undefined') {
1477
1481
  params = this.savedReadParams;
1478
1482
  }
1479
1483
  if (params) {
1480
1484
  url = this.baseReadUrl + `${this.serializeParams(params)}`;
1481
1485
  this.savedReadParams = params;
1482
1486
  }
1483
- this.http
1484
- .get(url)
1485
- .pipe(map((res) => res))
1486
- .subscribe((data) => {
1487
+ this.http.get(url).pipe(map(res => res)).subscribe(data => {
1487
1488
  super.next(data);
1488
1489
  if (success)
1489
1490
  success();
1490
- }, (e) => {
1491
+ }, e => {
1491
1492
  if (error)
1492
1493
  error(e);
1493
1494
  });
@@ -1522,7 +1523,6 @@ class BaseGridEditService extends BaseGridReadService {
1522
1523
  constructor(http) {
1523
1524
  super(http);
1524
1525
  this.http = http;
1525
- this.baseUrl = "";
1526
1526
  }
1527
1527
  reset() {
1528
1528
  this.data = [];
@@ -1532,15 +1532,16 @@ class BaseGridEditService extends BaseGridReadService {
1532
1532
  return;
1533
1533
  }
1534
1534
  //find orignal data item
1535
- const originalDataItem = this.data.find((item) => item.Id === dataItem.Id);
1535
+ const originalDataItem = this.data.find(item => item.Id === dataItem.Id);
1536
1536
  //revert changes
1537
1537
  Object.assign(originalDataItem, dataItem);
1538
1538
  super.next(this.data);
1539
1539
  }
1540
1540
  save(data, isNew, sucess) {
1541
- const action = isNew ? "add" : "update";
1541
+ const action = isNew ? 'add' : 'update';
1542
1542
  this.reset();
1543
- this.post(action, data).subscribe(() => { }, () => {
1543
+ this.post(action, data).subscribe(() => {
1544
+ }, () => {
1544
1545
  this.read();
1545
1546
  }, () => {
1546
1547
  this.read();
@@ -1548,9 +1549,10 @@ class BaseGridEditService extends BaseGridReadService {
1548
1549
  sucess();
1549
1550
  });
1550
1551
  }
1551
- remove(data, sucess) {
1552
+ delete(data, sucess) {
1552
1553
  this.reset();
1553
- this.post("remove", data).subscribe(() => { }, () => {
1554
+ this.post('delete', data).subscribe(() => {
1555
+ }, () => {
1554
1556
  this.read();
1555
1557
  }, () => {
1556
1558
  this.read();
@@ -1560,7 +1562,7 @@ class BaseGridEditService extends BaseGridReadService {
1560
1562
  }
1561
1563
  post(action, data) {
1562
1564
  var url = this.baseUrl + `${action}${this.serializeParams(data)}`;
1563
- return this.http.post(url, data).pipe(map((res) => res));
1565
+ return this.http.post(url, data).pipe(map(res => res));
1564
1566
  }
1565
1567
  }
1566
1568
  BaseGridEditService.decorators = [
@@ -1657,30 +1659,30 @@ class BillingApiService extends BaseApiService {
1657
1659
  this.baseUrl = consts.billingApiPath;
1658
1660
  }
1659
1661
  requestNewSubscription(requestedPlan, success, error) {
1660
- this.postQS("requestNewSubscription", { requestedPlan: requestedPlan }).subscribe((data) => { }, (e) => {
1661
- if (error)
1662
- error();
1663
- }, () => {
1662
+ this.postQS("requestNewSubscription", { requestedPlan: requestedPlan }).subscribe((data) => {
1664
1663
  if (success)
1665
1664
  success();
1665
+ }, (e) => {
1666
+ if (error)
1667
+ error();
1666
1668
  });
1667
1669
  }
1668
1670
  cancelRequestedSubscription(success, error) {
1669
- this.postQS("cancelRequestedSubscription", null).subscribe((data) => { }, (e) => {
1670
- if (error)
1671
- error();
1672
- }, () => {
1671
+ this.postQS("cancelRequestedSubscription", null).subscribe((data) => {
1673
1672
  if (success)
1674
1673
  success();
1674
+ }, (e) => {
1675
+ if (error)
1676
+ error();
1675
1677
  });
1676
1678
  }
1677
1679
  buyAccess(requestedPlan, success, error) {
1678
- this.postQS("buyAccess", { requestedPlan: requestedPlan }).subscribe((data) => { }, (e) => {
1679
- if (error)
1680
- error();
1681
- }, () => {
1680
+ this.postQS("buyAccess", { requestedPlan: requestedPlan }).subscribe((data) => {
1682
1681
  if (success)
1683
1682
  success();
1683
+ }, (e) => {
1684
+ if (error)
1685
+ error();
1684
1686
  });
1685
1687
  }
1686
1688
  }
@@ -2048,12 +2050,18 @@ const DefaultEditorOptions = {
2048
2050
  </file>
2049
2051
  */
2050
2052
  class BaseComponent {
2053
+ constructor() {
2054
+ this.subs = new Subs();
2055
+ }
2051
2056
  getQSId() {
2052
2057
  var id = Utils.getValueByNameInQS("id");
2053
2058
  if (typeof id === 'undefined' || id == '')
2054
2059
  return null;
2055
2060
  return id;
2056
2061
  }
2062
+ ngOnDestroy() {
2063
+ this.subs.unsubscribe();
2064
+ }
2057
2065
  }
2058
2066
 
2059
2067
  /*
@@ -3005,12 +3013,12 @@ AnatolyUIModule.decorators = [
3005
3013
  ];
3006
3014
 
3007
3015
  /*
3008
- * Public API Surface of anatoly
3016
+ * Public API
3009
3017
  */
3010
3018
 
3011
3019
  /**
3012
3020
  * Generated bundle index. Do not edit.
3013
3021
  */
3014
3022
 
3015
- 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 };
3023
+ 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 };
3016
3024
  //# sourceMappingURL=osovitny-anatoly.js.map