@osovitny/anatoly 1.2.8 → 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 (54) hide show
  1. package/bundles/osovitny-anatoly.umd.js +148 -94
  2. package/bundles/osovitny-anatoly.umd.js.map +1 -1
  3. package/bundles/osovitny-anatoly.umd.min.js +1 -1
  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/alerts.js +53 -8
  9. package/esm2015/lib/core/components/html-editor/base-html-editor.component.js +2 -2
  10. package/esm2015/lib/core/components/html-editor/forms-html-editor.component.js +2 -2
  11. package/esm2015/lib/core/components/validation/item-validation-summary.component.js +4 -4
  12. package/esm2015/lib/core/services/appcontext.service.js +3 -4
  13. package/esm2015/lib/data/base/base-api.service.js +73 -0
  14. package/esm2015/lib/data/base/grid/base-grid-edit.service.js +75 -0
  15. package/esm2015/lib/data/base/grid/base-grid-read.service.js +60 -0
  16. package/esm2015/lib/data/index.js +5 -6
  17. package/esm2015/lib/data/services/{base-billing-api.service.js → billing-api.service.js} +8 -7
  18. package/esm5/lib/billing/billing.module.js +3 -3
  19. package/esm5/lib/billing/components/buyaccess/buyaccess-button.component.js +3 -3
  20. package/esm5/lib/billing/components/subscriptions/upgrade-plan-button.component.js +3 -3
  21. package/esm5/lib/core/alerts.js +53 -8
  22. package/esm5/lib/core/components/html-editor/base-html-editor.component.js +1 -1
  23. package/esm5/lib/core/components/html-editor/forms-html-editor.component.js +2 -2
  24. package/esm5/lib/core/components/validation/item-validation-summary.component.js +4 -4
  25. package/esm5/lib/core/services/appcontext.service.js +3 -4
  26. package/esm5/lib/data/base/base-api.service.js +74 -0
  27. package/esm5/lib/data/base/grid/base-grid-edit.service.js +80 -0
  28. package/esm5/lib/data/base/grid/base-grid-read.service.js +64 -0
  29. package/esm5/lib/data/index.js +5 -6
  30. package/esm5/lib/data/services/billing-api.service.js +56 -0
  31. package/fesm2015/osovitny-anatoly.js +135 -81
  32. package/fesm2015/osovitny-anatoly.js.map +1 -1
  33. package/fesm5/osovitny-anatoly.js +148 -94
  34. package/fesm5/osovitny-anatoly.js.map +1 -1
  35. package/lib/billing/components/buyaccess/buyaccess-button.component.d.ts +2 -2
  36. package/lib/billing/components/subscriptions/upgrade-plan-button.component.d.ts +2 -2
  37. package/lib/core/alerts.d.ts +3 -1
  38. package/lib/core/components/validation/item-validation-summary.component.d.ts +2 -2
  39. package/lib/core/services/appcontext.service.d.ts +1 -1
  40. package/lib/data/{services → base}/base-api.service.d.ts +6 -6
  41. package/lib/data/{services/base-gridedit.service.d.ts → base/grid/base-grid-edit.service.d.ts} +2 -7
  42. package/lib/data/base/grid/base-grid-read.service.d.ts +11 -0
  43. package/lib/data/index.d.ts +4 -4
  44. package/lib/data/services/{base-billing-api.service.d.ts → billing-api.service.d.ts} +2 -2
  45. package/osovitny-anatoly.metadata.json +1 -1
  46. package/package.json +1 -1
  47. package/esm2015/lib/data/consts.js +0 -21
  48. package/esm2015/lib/data/services/base-api.service.js +0 -71
  49. package/esm2015/lib/data/services/base-gridedit.service.js +0 -98
  50. package/esm5/lib/data/consts.js +0 -25
  51. package/esm5/lib/data/services/base-api.service.js +0 -72
  52. package/esm5/lib/data/services/base-billing-api.service.js +0 -55
  53. package/esm5/lib/data/services/base-gridedit.service.js +0 -104
  54. package/lib/data/consts.d.ts +0 -6
@@ -222,7 +222,7 @@
222
222
  }
223
223
  Alerts.Info = function (text) {
224
224
  Swal.fire({
225
- title: "Info!",
225
+ title: "Information",
226
226
  text: text,
227
227
  icon: "info",
228
228
  confirmButtonText: "OK"
@@ -230,7 +230,7 @@
230
230
  };
231
231
  Alerts.Warning = function (text) {
232
232
  Swal.fire({
233
- title: "warning!",
233
+ title: "Warning",
234
234
  text: text,
235
235
  icon: "warning",
236
236
  confirmButtonText: "OK"
@@ -238,7 +238,7 @@
238
238
  };
239
239
  Alerts.Error = function (text) {
240
240
  Swal.fire({
241
- title: "error!",
241
+ title: "Error",
242
242
  text: text,
243
243
  icon: "error",
244
244
  confirmButtonText: "OK"
@@ -280,7 +280,10 @@
280
280
  ;
281
281
  Alerts.Success = function (text, title, successAction) {
282
282
  if (typeof title == "undefined" || title == null)
283
- title = "Success!";
283
+ title = "Success";
284
+ if (!text) {
285
+ text = "Operation was successful";
286
+ }
284
287
  Swal.fire({
285
288
  title: title,
286
289
  text: text,
@@ -293,11 +296,53 @@
293
296
  }
294
297
  });
295
298
  };
296
- ;
297
299
  Alerts.Cancel = function (text) {
298
- Swal.fire('Cancelled', text, 'error');
300
+ if (!text) {
301
+ text = "Operation has been cancled";
302
+ }
303
+ Swal.fire({
304
+ title: 'Cancelled',
305
+ text: text,
306
+ icon: "info"
307
+ });
308
+ };
309
+ //Notifications
310
+ Alerts.NotificationCancel = function (text) {
311
+ if (!text) {
312
+ text = "Operation has been cancled";
313
+ }
314
+ var toast = Swal.mixin({
315
+ toast: true,
316
+ position: 'top-end',
317
+ showConfirmButton: false,
318
+ timer: 3000,
319
+ timerProgressBar: true
320
+ });
321
+ toast.fire({
322
+ title: 'Cancelled',
323
+ text: text,
324
+ icon: "info"
325
+ });
326
+ };
327
+ Alerts.NotificationSuccess = function (text, title) {
328
+ if (typeof title == "undefined" || title == null)
329
+ title = "Success";
330
+ if (!text) {
331
+ text = "Operation was successful";
332
+ }
333
+ var toast = Swal.mixin({
334
+ toast: true,
335
+ position: 'top-end',
336
+ showConfirmButton: false,
337
+ timer: 3000,
338
+ timerProgressBar: true
339
+ });
340
+ toast.fire({
341
+ title: title,
342
+ text: text,
343
+ icon: "success",
344
+ });
299
345
  };
300
- ;
301
346
  return Alerts;
302
347
  }());
303
348
 
@@ -362,30 +407,6 @@
362
407
  return BaseGoService;
363
408
  }());
364
409
 
365
- /*
366
- <file>
367
- Authors:
368
- Vadim Osovitny
369
-
370
- Created:
371
- 4 Mar 2020
372
-
373
- Version:
374
- 1.0
375
-
376
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
377
- </file>
378
- */
379
- var Consts = /** @class */ (function () {
380
- function Consts() {
381
- }
382
- Consts.JsonUrl = "/dist/jsons/";
383
- Consts.JsonVersion = "v=1.0.0";
384
- Consts.AppUrl = "/";
385
- Consts.ApiUrl = "/api/";
386
- return Consts;
387
- }());
388
-
389
410
  /*
390
411
  <file>
391
412
  Authors:
@@ -403,46 +424,48 @@
403
424
  var BaseApiService = /** @class */ (function () {
404
425
  function BaseApiService(http) {
405
426
  this.http = http;
406
- this.baseUrl = Consts.ApiUrl;
407
427
  }
408
428
  BaseApiService.prototype.serializeParams = function (data) {
409
429
  return data ? ('?' + $.param(data)) : '';
410
430
  };
411
- //webApi
431
+ //api
412
432
  BaseApiService.prototype.get = function (action, data) {
413
- var url = this.baseUrl + ("" + action + this.serializeParams(data));
433
+ var url = this.baseUrl + "/" + action + this.serializeParams(data);
414
434
  return this.http.get(url).pipe(operators.map(function (res) { return res; }));
415
435
  };
416
436
  BaseApiService.prototype.post = function (action, data) {
417
- var url = this.baseUrl + ("" + action);
418
- 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; }));
419
439
  };
420
440
  BaseApiService.prototype.postQS = function (action, data) {
421
- var url = this.baseUrl + ("" + action + this.serializeParams(data));
422
- 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; }));
423
447
  };
424
448
  //gets
449
+ BaseApiService.prototype.getById = function (id) {
450
+ return this.get('getById', { id: id });
451
+ };
425
452
  BaseApiService.prototype.getAll = function (data) {
426
453
  return this.get('getall', data).pipe(operators.map(function (res) { return res; }));
427
454
  };
428
- BaseApiService.prototype.getJsonFile = function (fileName, jsonVersion) {
455
+ BaseApiService.prototype.getJsonFile = function (fileName, jsonUrl, jsonVersion) {
456
+ if (!jsonUrl) {
457
+ jsonUrl = "/dist/jsons";
458
+ }
429
459
  if (!jsonVersion) {
430
460
  jsonVersion = "1.0";
431
461
  }
432
- var url = Consts.JsonUrl + fileName + '?' + jsonVersion;
462
+ var url = jsonUrl + "/" + fileName + '?' + jsonVersion;
433
463
  return this.http.get(url).pipe(operators.map(function (res) { return res; }));
434
464
  };
435
465
  BaseApiService.prototype.getNewGuid = function () {
436
- var url = this.baseUrl + 'getNewGuid';
466
+ var url = this.baseUrl + "/getNewGuid";
437
467
  return this.http.get(url, { responseType: 'text' });
438
468
  };
439
- //CRUD function
440
- BaseApiService.prototype.getById = function (id) {
441
- return this.get('getById', { id: id });
442
- };
443
- BaseApiService.prototype.remove = function (id) {
444
- return this.postQS('remove', { id: id });
445
- };
446
469
  BaseApiService.ctorParameters = function () { return [
447
470
  { type: http.HttpClient }
448
471
  ]; };
@@ -474,7 +497,7 @@
474
497
  _this.current = null;
475
498
  _this.successes = [];
476
499
  _this.subscription = null;
477
- _this.baseUrl = Consts.ApiUrl + 'appcontext/';
500
+ _this.baseUrl = '/api/appcontext/';
478
501
  return _this;
479
502
  }
480
503
  AppContextService.prototype.getCurrent = function (success) {
@@ -775,14 +798,14 @@
775
798
  }
776
799
  __decorate([
777
800
  core.Input()
778
- ], ItemValidationSummaryComponent.prototype, "key", void 0);
801
+ ], ItemValidationSummaryComponent.prototype, "controlName", void 0);
779
802
  __decorate([
780
803
  core.Input()
781
- ], ItemValidationSummaryComponent.prototype, "title", void 0);
804
+ ], ItemValidationSummaryComponent.prototype, "controlTitle", void 0);
782
805
  ItemValidationSummaryComponent = __decorate([
783
806
  core.Component({
784
807
  selector: 'anatoly-item-validation-summary',
785
- template: "<ul class=\"list-unstyled\" *ngIf=\"isItemInvalid(key)\">\r\n <li *ngFor=\"let error of getValidationMessages(formGroup.get(key), title)\">\r\n <span class=\"help-block\">{{ error }}</span>\r\n </li>\r\n</ul>"
808
+ template: "<ul class=\"list-unstyled\" *ngIf=\"isItemInvalid(controlName)\">\r\n <li *ngFor=\"let error of getValidationMessages(formGroup.get(controlName), controlTitle)\">\r\n <span class=\"help-block\">{{ error }}</span>\r\n </li>\r\n</ul>\r\n"
786
809
  })
787
810
  ], ItemValidationSummaryComponent);
788
811
  return ItemValidationSummaryComponent;
@@ -1007,7 +1030,7 @@
1007
1030
  FormsHtmlEditorComponent = __decorate([
1008
1031
  core.Component({
1009
1032
  selector: 'anatoly-forms-html-editor',
1010
- template: "<div [formGroup]=\"formGroup\">\r\n <div class=\"form-group\" [ngClass]=\"{'has-error': isItemInvalid(editorFormKey) }\">\r\n <label class=\"control-label\">{{ editorLabelText }}</label>\r\n <textarea id=\"htmleditor-{{editorId}}\" class=\"htmleditor-{{editorId}}\"\r\n [formControlName]=\"editorFormKey\"\r\n [froalaEditor]=\"options\" (froalaInit)=\"initializeControl($event)\">\r\n </textarea>\r\n <anatoly-item-validation-summary [formGroup]=\"formGroup\"\r\n [formSubmitted]=\"formSubmitted\"\r\n [key]=\"editorFormKey\"\r\n [title]=\"editorLabelText\">\r\n </anatoly-item-validation-summary>\r\n </div>\r\n</div>\r\n"
1033
+ template: "<div [formGroup]=\"formGroup\">\r\n <div class=\"form-group\" [ngClass]=\"{'has-error': isItemInvalid(editorFormKey) }\">\r\n <label class=\"control-label\">{{ editorLabelText }}</label>\r\n <textarea id=\"htmleditor-{{editorId}}\" class=\"htmleditor-{{editorId}}\"\r\n [formControlName]=\"editorFormKey\"\r\n [froalaEditor]=\"options\" (froalaInit)=\"initializeControl($event)\">\r\n </textarea>\r\n <anatoly-item-validation-summary [formGroup]=\"formGroup\"\r\n [formSubmitted]=\"formSubmitted\"\r\n [controlName]=\"editorFormKey\"\r\n [controlTitle]=\"editorLabelText\">\r\n </anatoly-item-validation-summary>\r\n </div>\r\n</div>\r\n"
1011
1034
  })
1012
1035
  ], FormsHtmlEditorComponent);
1013
1036
  return FormsHtmlEditorComponent;
@@ -1090,39 +1113,39 @@
1090
1113
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1091
1114
  </file>
1092
1115
  */
1093
- var BaseBillingApiService = /** @class */ (function (_super) {
1094
- __extends(BaseBillingApiService, _super);
1095
- function BaseBillingApiService(http) {
1116
+ var BillingApiService = /** @class */ (function (_super) {
1117
+ __extends(BillingApiService, _super);
1118
+ function BillingApiService(http) {
1096
1119
  var _this = _super.call(this, http) || this;
1097
1120
  _this.http = http;
1098
1121
  _this.baseUrl += 'billing/';
1099
1122
  return _this;
1100
1123
  }
1101
- BaseBillingApiService.prototype.requestNewSubscription = function (requestedPlan, success, error) {
1124
+ BillingApiService.prototype.requestNewSubscription = function (requestedPlan, success, error) {
1102
1125
  this.postQS('requestNewSubscription', { requestedPlan: requestedPlan })
1103
1126
  .subscribe(function (data) { }, function (e) { if (error)
1104
1127
  error(); }, function () { if (success)
1105
1128
  success(); });
1106
1129
  };
1107
- BaseBillingApiService.prototype.cancelRequestedSubscription = function (success, error) {
1130
+ BillingApiService.prototype.cancelRequestedSubscription = function (success, error) {
1108
1131
  this.postQS('cancelRequestedSubscription', null)
1109
1132
  .subscribe(function (data) { }, function (e) { if (error)
1110
1133
  error(); }, function () { if (success)
1111
1134
  success(); });
1112
1135
  };
1113
- BaseBillingApiService.prototype.buyAccess = function (requestedPlan, success, error) {
1136
+ BillingApiService.prototype.buyAccess = function (requestedPlan, success, error) {
1114
1137
  this.postQS('buyAccess', { requestedPlan: requestedPlan })
1115
1138
  .subscribe(function (data) { }, function (e) { if (error)
1116
1139
  error(); }, function () { if (success)
1117
1140
  success(); });
1118
1141
  };
1119
- BaseBillingApiService.ctorParameters = function () { return [
1142
+ BillingApiService.ctorParameters = function () { return [
1120
1143
  { type: http.HttpClient }
1121
1144
  ]; };
1122
- BaseBillingApiService = __decorate([
1145
+ BillingApiService = __decorate([
1123
1146
  core.Injectable()
1124
- ], BaseBillingApiService);
1125
- return BaseBillingApiService;
1147
+ ], BillingApiService);
1148
+ return BillingApiService;
1126
1149
  }(BaseApiService));
1127
1150
 
1128
1151
  /*
@@ -1176,7 +1199,7 @@
1176
1199
  };
1177
1200
  BuyAccessButtonComponent.ctorParameters = function () { return [
1178
1201
  { type: AppContextService },
1179
- { type: BaseBillingApiService }
1202
+ { type: BillingApiService }
1180
1203
  ]; };
1181
1204
  __decorate([
1182
1205
  core.Input()
@@ -1282,7 +1305,7 @@
1282
1305
  });
1283
1306
  };
1284
1307
  UpgradePlanButtonComponent.ctorParameters = function () { return [
1285
- { type: BaseBillingApiService }
1308
+ { type: BillingApiService }
1286
1309
  ]; };
1287
1310
  __decorate([
1288
1311
  core.Input()
@@ -1468,7 +1491,7 @@
1468
1491
  BuyAccessButtonComponent
1469
1492
  ],
1470
1493
  providers: [
1471
- BaseBillingApiService
1494
+ BillingApiService
1472
1495
  ]
1473
1496
  })
1474
1497
  ], AnatolyBillingModule);
@@ -1491,19 +1514,69 @@
1491
1514
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1492
1515
  </file>
1493
1516
  */
1494
- var BaseGridEditService = /** @class */ (function (_super) {
1495
- __extends(BaseGridEditService, _super);
1496
- function BaseGridEditService(http) {
1517
+ var BaseGridReadService = /** @class */ (function (_super) {
1518
+ __extends(BaseGridReadService, _super);
1519
+ function BaseGridReadService(http) {
1497
1520
  var _this = _super.call(this, []) || this;
1498
1521
  _this.http = http;
1499
1522
  _this.data = [];
1500
- _this.baseUrl = Consts.ApiUrl;
1501
- _this.baseReadUrl = _this.baseUrl + "getAll";
1502
1523
  return _this;
1503
1524
  }
1504
- BaseGridEditService.prototype.serializeParams = function (data) {
1525
+ BaseGridReadService.prototype.serializeParams = function (data) {
1505
1526
  return data ? ('?' + $.param(data)) : '';
1506
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
+ }
1507
1580
  BaseGridEditService.prototype.reset = function () {
1508
1581
  this.data = [];
1509
1582
  };
@@ -1517,25 +1590,6 @@
1517
1590
  Object.assign(originalDataItem, dataItem);
1518
1591
  _super.prototype.next.call(this, this.data);
1519
1592
  };
1520
- BaseGridEditService.prototype.read = function (params) {
1521
- var _this = this;
1522
- if (this.data.length) {
1523
- return _super.prototype.next.call(this, this.data);
1524
- }
1525
- var url = this.baseReadUrl;
1526
- if (typeof params === 'undefined') {
1527
- params = this.savedReadParams;
1528
- }
1529
- if (typeof params !== 'undefined') {
1530
- url = this.baseReadUrl + ("" + this.serializeParams(params));
1531
- this.savedReadParams = params;
1532
- }
1533
- // this.http.get(url)
1534
- // .map(res => <any[]>res)
1535
- // .do(data => { this.data = data; }).subscribe(data => { super.next(data); });
1536
- //}
1537
- this.http.get(url).pipe(operators.map(function (res) { return res; })).subscribe(function (data) { _super.prototype.next.call(_this, data); });
1538
- };
1539
1593
  BaseGridEditService.prototype.save = function (data, isNew, sucess) {
1540
1594
  var _this = this;
1541
1595
  var action = isNew ? 'add' : 'update';
@@ -1572,7 +1626,7 @@
1572
1626
  core.Injectable()
1573
1627
  ], BaseGridEditService);
1574
1628
  return BaseGridEditService;
1575
- }(rxjs.BehaviorSubject));
1629
+ }(BaseGridReadService));
1576
1630
 
1577
1631
  /*
1578
1632
  <file>
@@ -1619,13 +1673,13 @@
1619
1673
  exports.AnatolyIdentityModule = AnatolyIdentityModule;
1620
1674
  exports.AppContextService = AppContextService;
1621
1675
  exports.BaseApiService = BaseApiService;
1622
- exports.BaseBillingApiService = BaseBillingApiService;
1623
1676
  exports.BaseComponent = BaseComponent;
1624
1677
  exports.BaseEditComponent = BaseEditComponent;
1625
1678
  exports.BaseGoService = BaseGoService;
1626
1679
  exports.BaseGridEditService = BaseGridEditService;
1680
+ exports.BaseGridReadService = BaseGridReadService;
1681
+ exports.BillingApiService = BillingApiService;
1627
1682
  exports.BuyAccessButtonComponent = BuyAccessButtonComponent;
1628
- exports.Consts = Consts;
1629
1683
  exports.ContentHeaderComponent = ContentHeaderComponent;
1630
1684
  exports.FormValidationSummaryComponent = FormValidationSummaryComponent;
1631
1685
  exports.FormsHtmlEditorComponent = FormsHtmlEditorComponent;