@osovitny/anatoly 1.2.9 → 1.2.10

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.
Files changed (44) hide show
  1. package/bundles/osovitny-anatoly.umd.js +92 -83
  2. package/bundles/osovitny-anatoly.umd.js.map +1 -1
  3. package/bundles/osovitny-anatoly.umd.min.js +2 -2
  4. package/bundles/osovitny-anatoly.umd.min.js.map +1 -1
  5. package/esm2015/lib/billing/billing.module.js +3 -3
  6. package/esm2015/lib/billing/components/buyaccess/buyaccess-button.component.js +3 -3
  7. package/esm2015/lib/billing/components/subscriptions/upgrade-plan-button.component.js +3 -3
  8. package/esm2015/lib/core/services/appcontext.service.js +3 -4
  9. package/esm2015/lib/data/base/base-api.service.js +73 -0
  10. package/esm2015/lib/data/base/grid/base-grid-edit.service.js +75 -0
  11. package/esm2015/lib/data/base/grid/base-grid-read.service.js +60 -0
  12. package/esm2015/lib/data/index.js +5 -6
  13. package/esm2015/lib/data/services/{base-billing-api.service.js → billing-api.service.js} +8 -7
  14. package/esm5/lib/billing/billing.module.js +3 -3
  15. package/esm5/lib/billing/components/buyaccess/buyaccess-button.component.js +3 -3
  16. package/esm5/lib/billing/components/subscriptions/upgrade-plan-button.component.js +3 -3
  17. package/esm5/lib/core/services/appcontext.service.js +3 -4
  18. package/esm5/lib/data/base/base-api.service.js +74 -0
  19. package/esm5/lib/data/base/grid/base-grid-edit.service.js +80 -0
  20. package/esm5/lib/data/base/grid/base-grid-read.service.js +64 -0
  21. package/esm5/lib/data/index.js +5 -6
  22. package/esm5/lib/data/services/billing-api.service.js +56 -0
  23. package/fesm2015/osovitny-anatoly.js +78 -69
  24. package/fesm2015/osovitny-anatoly.js.map +1 -1
  25. package/fesm5/osovitny-anatoly.js +92 -83
  26. package/fesm5/osovitny-anatoly.js.map +1 -1
  27. package/lib/billing/components/buyaccess/buyaccess-button.component.d.ts +2 -2
  28. package/lib/billing/components/subscriptions/upgrade-plan-button.component.d.ts +2 -2
  29. package/lib/core/services/appcontext.service.d.ts +1 -1
  30. package/lib/data/{services → base}/base-api.service.d.ts +6 -6
  31. package/lib/data/{services/base-gridedit.service.d.ts → base/grid/base-grid-edit.service.d.ts} +2 -7
  32. package/lib/data/base/grid/base-grid-read.service.d.ts +11 -0
  33. package/lib/data/index.d.ts +4 -4
  34. package/lib/data/services/{base-billing-api.service.d.ts → billing-api.service.d.ts} +2 -2
  35. package/osovitny-anatoly.metadata.json +1 -1
  36. package/package.json +1 -1
  37. package/esm2015/lib/data/consts.js +0 -21
  38. package/esm2015/lib/data/services/base-api.service.js +0 -71
  39. package/esm2015/lib/data/services/base-gridedit.service.js +0 -98
  40. package/esm5/lib/data/consts.js +0 -25
  41. package/esm5/lib/data/services/base-api.service.js +0 -72
  42. package/esm5/lib/data/services/base-billing-api.service.js +0 -55
  43. package/esm5/lib/data/services/base-gridedit.service.js +0 -104
  44. package/lib/data/consts.d.ts +0 -6
@@ -407,30 +407,6 @@
407
407
  return BaseGoService;
408
408
  }());
409
409
 
410
- /*
411
- <file>
412
- Authors:
413
- Vadim Osovitny
414
-
415
- Created:
416
- 4 Mar 2020
417
-
418
- Version:
419
- 1.0
420
-
421
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
422
- </file>
423
- */
424
- var Consts = /** @class */ (function () {
425
- function Consts() {
426
- }
427
- Consts.JsonUrl = "/dist/jsons/";
428
- Consts.JsonVersion = "v=1.0.0";
429
- Consts.AppUrl = "/";
430
- Consts.ApiUrl = "/api/";
431
- return Consts;
432
- }());
433
-
434
410
  /*
435
411
  <file>
436
412
  Authors:
@@ -448,46 +424,48 @@
448
424
  var BaseApiService = /** @class */ (function () {
449
425
  function BaseApiService(http) {
450
426
  this.http = http;
451
- this.baseUrl = Consts.ApiUrl;
452
427
  }
453
428
  BaseApiService.prototype.serializeParams = function (data) {
454
429
  return data ? ('?' + $.param(data)) : '';
455
430
  };
456
- //webApi
431
+ //api
457
432
  BaseApiService.prototype.get = function (action, data) {
458
- var url = this.baseUrl + ("" + action + this.serializeParams(data));
433
+ var url = this.baseUrl + "/" + action + this.serializeParams(data);
459
434
  return this.http.get(url).pipe(operators.map(function (res) { return res; }));
460
435
  };
461
436
  BaseApiService.prototype.post = function (action, data) {
462
- var url = this.baseUrl + ("" + action);
463
- return this.http.post(url, data, { responseType: 'text' });
437
+ var url = this.baseUrl + "/" + action;
438
+ return this.http.post(url, data).pipe(operators.map(function (res) { return res; }));
464
439
  };
465
440
  BaseApiService.prototype.postQS = function (action, data) {
466
- var url = this.baseUrl + ("" + action + this.serializeParams(data));
467
- return this.http.post(url, null, { responseType: 'text' });
441
+ var url = this.baseUrl + "/" + action + this.serializeParams(data);
442
+ return this.http.post(url, null).pipe(operators.map(function (res) { return res; }));
443
+ };
444
+ BaseApiService.prototype.delete = function (action, data) {
445
+ var url = this.baseUrl + "/" + action + this.serializeParams(data);
446
+ return this.http.delete(url).pipe(operators.map(function (res) { return res; }));
468
447
  };
469
448
  //gets
449
+ BaseApiService.prototype.getById = function (id) {
450
+ return this.get('getById', { id: id });
451
+ };
470
452
  BaseApiService.prototype.getAll = function (data) {
471
453
  return this.get('getall', data).pipe(operators.map(function (res) { return res; }));
472
454
  };
473
- BaseApiService.prototype.getJsonFile = function (fileName, jsonVersion) {
455
+ BaseApiService.prototype.getJsonFile = function (fileName, jsonUrl, jsonVersion) {
456
+ if (!jsonUrl) {
457
+ jsonUrl = "/dist/jsons";
458
+ }
474
459
  if (!jsonVersion) {
475
460
  jsonVersion = "1.0";
476
461
  }
477
- var url = Consts.JsonUrl + fileName + '?' + jsonVersion;
462
+ var url = jsonUrl + "/" + fileName + '?' + jsonVersion;
478
463
  return this.http.get(url).pipe(operators.map(function (res) { return res; }));
479
464
  };
480
465
  BaseApiService.prototype.getNewGuid = function () {
481
- var url = this.baseUrl + 'getNewGuid';
466
+ var url = this.baseUrl + "/getNewGuid";
482
467
  return this.http.get(url, { responseType: 'text' });
483
468
  };
484
- //CRUD function
485
- BaseApiService.prototype.getById = function (id) {
486
- return this.get('getById', { id: id });
487
- };
488
- BaseApiService.prototype.remove = function (id) {
489
- return this.postQS('remove', { id: id });
490
- };
491
469
  BaseApiService.ctorParameters = function () { return [
492
470
  { type: http.HttpClient }
493
471
  ]; };
@@ -519,7 +497,7 @@
519
497
  _this.current = null;
520
498
  _this.successes = [];
521
499
  _this.subscription = null;
522
- _this.baseUrl = Consts.ApiUrl + 'appcontext/';
500
+ _this.baseUrl = '/api/appcontext/';
523
501
  return _this;
524
502
  }
525
503
  AppContextService.prototype.getCurrent = function (success) {
@@ -1135,39 +1113,39 @@
1135
1113
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1136
1114
  </file>
1137
1115
  */
1138
- var BaseBillingApiService = /** @class */ (function (_super) {
1139
- __extends(BaseBillingApiService, _super);
1140
- function BaseBillingApiService(http) {
1116
+ var BillingApiService = /** @class */ (function (_super) {
1117
+ __extends(BillingApiService, _super);
1118
+ function BillingApiService(http) {
1141
1119
  var _this = _super.call(this, http) || this;
1142
1120
  _this.http = http;
1143
1121
  _this.baseUrl += 'billing/';
1144
1122
  return _this;
1145
1123
  }
1146
- BaseBillingApiService.prototype.requestNewSubscription = function (requestedPlan, success, error) {
1124
+ BillingApiService.prototype.requestNewSubscription = function (requestedPlan, success, error) {
1147
1125
  this.postQS('requestNewSubscription', { requestedPlan: requestedPlan })
1148
1126
  .subscribe(function (data) { }, function (e) { if (error)
1149
1127
  error(); }, function () { if (success)
1150
1128
  success(); });
1151
1129
  };
1152
- BaseBillingApiService.prototype.cancelRequestedSubscription = function (success, error) {
1130
+ BillingApiService.prototype.cancelRequestedSubscription = function (success, error) {
1153
1131
  this.postQS('cancelRequestedSubscription', null)
1154
1132
  .subscribe(function (data) { }, function (e) { if (error)
1155
1133
  error(); }, function () { if (success)
1156
1134
  success(); });
1157
1135
  };
1158
- BaseBillingApiService.prototype.buyAccess = function (requestedPlan, success, error) {
1136
+ BillingApiService.prototype.buyAccess = function (requestedPlan, success, error) {
1159
1137
  this.postQS('buyAccess', { requestedPlan: requestedPlan })
1160
1138
  .subscribe(function (data) { }, function (e) { if (error)
1161
1139
  error(); }, function () { if (success)
1162
1140
  success(); });
1163
1141
  };
1164
- BaseBillingApiService.ctorParameters = function () { return [
1142
+ BillingApiService.ctorParameters = function () { return [
1165
1143
  { type: http.HttpClient }
1166
1144
  ]; };
1167
- BaseBillingApiService = __decorate([
1145
+ BillingApiService = __decorate([
1168
1146
  core.Injectable()
1169
- ], BaseBillingApiService);
1170
- return BaseBillingApiService;
1147
+ ], BillingApiService);
1148
+ return BillingApiService;
1171
1149
  }(BaseApiService));
1172
1150
 
1173
1151
  /*
@@ -1221,7 +1199,7 @@
1221
1199
  };
1222
1200
  BuyAccessButtonComponent.ctorParameters = function () { return [
1223
1201
  { type: AppContextService },
1224
- { type: BaseBillingApiService }
1202
+ { type: BillingApiService }
1225
1203
  ]; };
1226
1204
  __decorate([
1227
1205
  core.Input()
@@ -1327,7 +1305,7 @@
1327
1305
  });
1328
1306
  };
1329
1307
  UpgradePlanButtonComponent.ctorParameters = function () { return [
1330
- { type: BaseBillingApiService }
1308
+ { type: BillingApiService }
1331
1309
  ]; };
1332
1310
  __decorate([
1333
1311
  core.Input()
@@ -1513,7 +1491,7 @@
1513
1491
  BuyAccessButtonComponent
1514
1492
  ],
1515
1493
  providers: [
1516
- BaseBillingApiService
1494
+ BillingApiService
1517
1495
  ]
1518
1496
  })
1519
1497
  ], AnatolyBillingModule);
@@ -1536,19 +1514,69 @@
1536
1514
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1537
1515
  </file>
1538
1516
  */
1539
- var BaseGridEditService = /** @class */ (function (_super) {
1540
- __extends(BaseGridEditService, _super);
1541
- function BaseGridEditService(http) {
1517
+ var BaseGridReadService = /** @class */ (function (_super) {
1518
+ __extends(BaseGridReadService, _super);
1519
+ function BaseGridReadService(http) {
1542
1520
  var _this = _super.call(this, []) || this;
1543
1521
  _this.http = http;
1544
1522
  _this.data = [];
1545
- _this.baseUrl = Consts.ApiUrl;
1546
- _this.baseReadUrl = _this.baseUrl + "getAll";
1547
1523
  return _this;
1548
1524
  }
1549
- BaseGridEditService.prototype.serializeParams = function (data) {
1525
+ BaseGridReadService.prototype.serializeParams = function (data) {
1550
1526
  return data ? ('?' + $.param(data)) : '';
1551
1527
  };
1528
+ BaseGridReadService.prototype.read = function (params, success, error) {
1529
+ var _this = this;
1530
+ if (this.data.length) {
1531
+ return _super.prototype.next.call(this, this.data);
1532
+ }
1533
+ var url = this.baseReadUrl;
1534
+ if (typeof params === 'undefined') {
1535
+ params = this.savedReadParams;
1536
+ }
1537
+ if (params) {
1538
+ url = this.baseReadUrl + ("" + this.serializeParams(params));
1539
+ this.savedReadParams = params;
1540
+ }
1541
+ this.http.get(url).pipe(operators.map(function (res) { return res; })).subscribe(function (data) {
1542
+ _super.prototype.next.call(_this, data);
1543
+ if (success)
1544
+ success();
1545
+ }, function (e) {
1546
+ if (error)
1547
+ error(e);
1548
+ });
1549
+ };
1550
+ BaseGridReadService.ctorParameters = function () { return [
1551
+ { type: http.HttpClient }
1552
+ ]; };
1553
+ BaseGridReadService = __decorate([
1554
+ core.Injectable()
1555
+ ], BaseGridReadService);
1556
+ return BaseGridReadService;
1557
+ }(rxjs.BehaviorSubject));
1558
+
1559
+ /*
1560
+ <file>
1561
+ Authors:
1562
+ Vadim Osovitny
1563
+
1564
+ Created:
1565
+ 29 Apr 2018
1566
+
1567
+ Version:
1568
+ 1.0
1569
+
1570
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1571
+ </file>
1572
+ */
1573
+ var BaseGridEditService = /** @class */ (function (_super) {
1574
+ __extends(BaseGridEditService, _super);
1575
+ function BaseGridEditService(http) {
1576
+ var _this = _super.call(this, http) || this;
1577
+ _this.http = http;
1578
+ return _this;
1579
+ }
1552
1580
  BaseGridEditService.prototype.reset = function () {
1553
1581
  this.data = [];
1554
1582
  };
@@ -1562,25 +1590,6 @@
1562
1590
  Object.assign(originalDataItem, dataItem);
1563
1591
  _super.prototype.next.call(this, this.data);
1564
1592
  };
1565
- BaseGridEditService.prototype.read = function (params) {
1566
- var _this = this;
1567
- if (this.data.length) {
1568
- return _super.prototype.next.call(this, this.data);
1569
- }
1570
- var url = this.baseReadUrl;
1571
- if (typeof params === 'undefined') {
1572
- params = this.savedReadParams;
1573
- }
1574
- if (typeof params !== 'undefined') {
1575
- url = this.baseReadUrl + ("" + this.serializeParams(params));
1576
- this.savedReadParams = params;
1577
- }
1578
- // this.http.get(url)
1579
- // .map(res => <any[]>res)
1580
- // .do(data => { this.data = data; }).subscribe(data => { super.next(data); });
1581
- //}
1582
- this.http.get(url).pipe(operators.map(function (res) { return res; })).subscribe(function (data) { _super.prototype.next.call(_this, data); });
1583
- };
1584
1593
  BaseGridEditService.prototype.save = function (data, isNew, sucess) {
1585
1594
  var _this = this;
1586
1595
  var action = isNew ? 'add' : 'update';
@@ -1617,7 +1626,7 @@
1617
1626
  core.Injectable()
1618
1627
  ], BaseGridEditService);
1619
1628
  return BaseGridEditService;
1620
- }(rxjs.BehaviorSubject));
1629
+ }(BaseGridReadService));
1621
1630
 
1622
1631
  /*
1623
1632
  <file>
@@ -1664,13 +1673,13 @@
1664
1673
  exports.AnatolyIdentityModule = AnatolyIdentityModule;
1665
1674
  exports.AppContextService = AppContextService;
1666
1675
  exports.BaseApiService = BaseApiService;
1667
- exports.BaseBillingApiService = BaseBillingApiService;
1668
1676
  exports.BaseComponent = BaseComponent;
1669
1677
  exports.BaseEditComponent = BaseEditComponent;
1670
1678
  exports.BaseGoService = BaseGoService;
1671
1679
  exports.BaseGridEditService = BaseGridEditService;
1680
+ exports.BaseGridReadService = BaseGridReadService;
1681
+ exports.BillingApiService = BillingApiService;
1672
1682
  exports.BuyAccessButtonComponent = BuyAccessButtonComponent;
1673
- exports.Consts = Consts;
1674
1683
  exports.ContentHeaderComponent = ContentHeaderComponent;
1675
1684
  exports.FormValidationSummaryComponent = FormValidationSummaryComponent;
1676
1685
  exports.FormsHtmlEditorComponent = FormsHtmlEditorComponent;