@osovitny/anatoly 2.0.5 → 2.0.8

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 (124) hide show
  1. package/README.md +1 -3
  2. package/bundles/osovitny-anatoly.umd.js +1550 -1683
  3. package/bundles/osovitny-anatoly.umd.js.map +1 -1
  4. package/bundles/osovitny-anatoly.umd.min.js +13 -13
  5. package/bundles/osovitny-anatoly.umd.min.js.map +1 -1
  6. package/esm2015/lib/core/alerts.js +19 -23
  7. package/esm2015/lib/core/core.module.js +14 -79
  8. package/esm2015/lib/core/index.js +7 -17
  9. package/esm2015/lib/core/services/appcontext.service.js +12 -14
  10. package/esm2015/lib/core/services/base-go.service.js +8 -10
  11. package/esm2015/lib/core/utils.js +4 -2
  12. package/esm2015/lib/data/base/base-api.service.js +6 -8
  13. package/esm2015/lib/data/base/grid/base-grid-edit.service.js +6 -8
  14. package/esm2015/lib/data/base/grid/base-grid-read.service.js +6 -8
  15. package/esm2015/lib/data/data.module.js +21 -23
  16. package/esm2015/lib/data/index.js +1 -1
  17. package/esm2015/lib/data/services/billing-api.service.js +6 -8
  18. package/esm2015/lib/ui/components/base-edit.component.js +64 -0
  19. package/esm2015/lib/ui/components/base.component.js +38 -0
  20. package/esm2015/lib/ui/components/billing/buyaccess-button.component.js +71 -0
  21. package/esm2015/lib/ui/components/billing/subscribe-plan-button.component.js +59 -0
  22. package/esm2015/lib/ui/components/billing/upgrade-plan-button.component.js +50 -0
  23. package/esm2015/lib/ui/components/content-header/content-header.component.js +33 -0
  24. package/esm2015/lib/ui/components/html-editor/base-html-editor.component.js +96 -0
  25. package/esm2015/lib/ui/components/html-editor/forms-html-editor.component.js +41 -0
  26. package/esm2015/lib/ui/components/html-editor/html-editor.component.js +48 -0
  27. package/esm2015/lib/ui/components/html-editor/html-editor.defaultoptions.js +32 -0
  28. package/esm2015/lib/ui/components/identity/signin-button.component.js +29 -0
  29. package/esm2015/lib/ui/components/identity/signout-button.component.js +29 -0
  30. package/esm2015/lib/ui/components/identity/signup-button.component.js +27 -0
  31. package/esm2015/lib/ui/components/validation/form-validation-summary.component.js +38 -0
  32. package/esm2015/lib/ui/components/validation/item-validation-summary.component.js +34 -0
  33. package/esm2015/lib/ui/components/validation/validation-summary.component.js +60 -0
  34. package/esm2015/lib/ui/index.js +22 -0
  35. package/esm2015/lib/ui/ui.module.js +78 -0
  36. package/esm2015/osovitny-anatoly.js +1 -1
  37. package/esm2015/public-api.js +7 -5
  38. package/fesm2015/osovitny-anatoly.js +699 -785
  39. package/fesm2015/osovitny-anatoly.js.map +1 -1
  40. package/lib/core/core.module.d.ts +0 -3
  41. package/lib/core/index.d.ts +5 -13
  42. package/lib/core/services/appcontext.service.d.ts +2 -2
  43. package/lib/core/services/base-go.service.d.ts +1 -1
  44. package/lib/{core → ui}/components/base.component.d.ts +0 -1
  45. package/lib/{billing/components/buyaccess → ui/components/billing}/buyaccess-button.component.d.ts +3 -3
  46. package/lib/{billing/components/subscriptions → ui/components/billing}/upgrade-plan-button.component.d.ts +1 -1
  47. package/lib/{identity/components → ui/components/identity}/signup-button.component.d.ts +0 -1
  48. package/lib/{core → ui}/components/validation/form-validation-summary.component.d.ts +1 -1
  49. package/lib/{core → ui}/components/validation/validation-summary.component.d.ts +1 -1
  50. package/lib/ui/index.d.ts +15 -0
  51. package/lib/ui/ui.module.d.ts +6 -0
  52. package/osovitny-anatoly.metadata.json +1 -1
  53. package/package.json +8 -7
  54. package/public-api.d.ts +3 -4
  55. package/esm2015/lib/billing/billing.module.js +0 -60
  56. package/esm2015/lib/billing/components/buyaccess/buyaccess-button.component.js +0 -75
  57. package/esm2015/lib/billing/components/subscriptions/subscribe-plan-button.component.js +0 -63
  58. package/esm2015/lib/billing/components/subscriptions/upgrade-plan-button.component.js +0 -56
  59. package/esm2015/lib/billing/index.js +0 -7
  60. package/esm2015/lib/core/components/base-edit.component.js +0 -67
  61. package/esm2015/lib/core/components/base.component.js +0 -39
  62. package/esm2015/lib/core/components/content-header/content-header.component.js +0 -35
  63. package/esm2015/lib/core/components/html-editor/base-html-editor.component.js +0 -99
  64. package/esm2015/lib/core/components/html-editor/forms-html-editor.component.js +0 -42
  65. package/esm2015/lib/core/components/html-editor/html-editor.component.js +0 -49
  66. package/esm2015/lib/core/components/html-editor/html-editor.defaultoptions.js +0 -32
  67. package/esm2015/lib/core/components/validation/form-validation-summary.component.js +0 -39
  68. package/esm2015/lib/core/components/validation/item-validation-summary.component.js +0 -37
  69. package/esm2015/lib/core/components/validation/validation-summary.component.js +0 -60
  70. package/esm2015/lib/identity/components/signin-button.component.js +0 -30
  71. package/esm2015/lib/identity/components/signout-button.component.js +0 -30
  72. package/esm2015/lib/identity/components/signup-button.component.js +0 -31
  73. package/esm2015/lib/identity/identity.module.js +0 -41
  74. package/esm2015/lib/identity/index.js +0 -7
  75. package/esm5/lib/billing/billing.module.js +0 -63
  76. package/esm5/lib/billing/components/buyaccess/buyaccess-button.component.js +0 -77
  77. package/esm5/lib/billing/components/subscriptions/subscribe-plan-button.component.js +0 -65
  78. package/esm5/lib/billing/components/subscriptions/upgrade-plan-button.component.js +0 -57
  79. package/esm5/lib/billing/index.js +0 -7
  80. package/esm5/lib/core/alerts.js +0 -149
  81. package/esm5/lib/core/components/base-edit.component.js +0 -71
  82. package/esm5/lib/core/components/base.component.js +0 -41
  83. package/esm5/lib/core/components/content-header/content-header.component.js +0 -38
  84. package/esm5/lib/core/components/html-editor/base-html-editor.component.js +0 -103
  85. package/esm5/lib/core/components/html-editor/forms-html-editor.component.js +0 -45
  86. package/esm5/lib/core/components/html-editor/html-editor.component.js +0 -51
  87. package/esm5/lib/core/components/html-editor/html-editor.defaultoptions.js +0 -32
  88. package/esm5/lib/core/components/validation/form-validation-summary.component.js +0 -42
  89. package/esm5/lib/core/components/validation/item-validation-summary.component.js +0 -39
  90. package/esm5/lib/core/components/validation/validation-summary.component.js +0 -65
  91. package/esm5/lib/core/core.module.js +0 -82
  92. package/esm5/lib/core/index.js +0 -18
  93. package/esm5/lib/core/services/appcontext.service.js +0 -75
  94. package/esm5/lib/core/services/base-go.service.js +0 -37
  95. package/esm5/lib/core/utils.js +0 -29
  96. package/esm5/lib/data/base/base-api.service.js +0 -87
  97. package/esm5/lib/data/base/grid/base-grid-edit.service.js +0 -81
  98. package/esm5/lib/data/base/grid/base-grid-read.service.js +0 -65
  99. package/esm5/lib/data/data.module.js +0 -44
  100. package/esm5/lib/data/index.js +0 -8
  101. package/esm5/lib/data/services/billing-api.service.js +0 -56
  102. package/esm5/lib/identity/components/signin-button.component.js +0 -32
  103. package/esm5/lib/identity/components/signout-button.component.js +0 -32
  104. package/esm5/lib/identity/components/signup-button.component.js +0 -32
  105. package/esm5/lib/identity/identity.module.js +0 -44
  106. package/esm5/lib/identity/index.js +0 -7
  107. package/esm5/osovitny-anatoly.js +0 -5
  108. package/esm5/public-api.js +0 -5
  109. package/fesm5/osovitny-anatoly.js +0 -1491
  110. package/fesm5/osovitny-anatoly.js.map +0 -1
  111. package/lib/billing/billing.module.d.ts +0 -2
  112. package/lib/billing/index.d.ts +0 -4
  113. package/lib/identity/identity.module.d.ts +0 -2
  114. package/lib/identity/index.d.ts +0 -4
  115. /package/lib/{core → ui}/components/base-edit.component.d.ts +0 -0
  116. /package/lib/{billing/components/subscriptions → ui/components/billing}/subscribe-plan-button.component.d.ts +0 -0
  117. /package/lib/{core → ui}/components/content-header/content-header.component.d.ts +0 -0
  118. /package/lib/{core → ui}/components/html-editor/base-html-editor.component.d.ts +0 -0
  119. /package/lib/{core → ui}/components/html-editor/forms-html-editor.component.d.ts +0 -0
  120. /package/lib/{core → ui}/components/html-editor/html-editor.component.d.ts +0 -0
  121. /package/lib/{core → ui}/components/html-editor/html-editor.defaultoptions.d.ts +0 -0
  122. /package/lib/{identity/components → ui/components/identity}/signin-button.component.d.ts +0 -0
  123. /package/lib/{identity/components → ui/components/identity}/signout-button.component.d.ts +0 -0
  124. /package/lib/{core → ui}/components/validation/item-validation-summary.component.d.ts +0 -0
@@ -1,17 +1,12 @@
1
1
  import Swal from 'sweetalert2';
2
- import { __decorate } from 'tslib';
3
- import { Injectable, Input, Component, NgModule } from '@angular/core';
2
+ import { Injectable, NgModule, Component, Input } from '@angular/core';
4
3
  import { ActivatedRoute, Router } from '@angular/router';
5
4
  import { HttpClient, HttpClientModule, HttpClientXsrfModule, HttpClientJsonpModule } from '@angular/common/http';
6
5
  import { map } from 'rxjs/operators';
7
6
  import { CommonModule } from '@angular/common';
7
+ import { BehaviorSubject } from 'rxjs';
8
8
  import { ReactiveFormsModule, FormsModule } from '@angular/forms';
9
9
  import { FroalaEditorModule, FroalaViewModule } from 'angular-froala-wysiwyg';
10
- import { GridModule } from '@progress/kendo-angular-grid';
11
- import { PopupModule } from '@progress/kendo-angular-popup';
12
- import { ButtonsModule } from '@progress/kendo-angular-buttons';
13
- import { DropDownsModule } from '@progress/kendo-angular-dropdowns';
14
- import { BehaviorSubject } from 'rxjs';
15
10
 
16
11
  /*
17
12
  <file>
@@ -33,7 +28,7 @@ class Alerts {
33
28
  title: "Information",
34
29
  text: text,
35
30
  icon: "info",
36
- confirmButtonText: "OK"
31
+ confirmButtonText: "OK",
37
32
  });
38
33
  }
39
34
  static Warning(text) {
@@ -41,7 +36,7 @@ class Alerts {
41
36
  title: "Warning",
42
37
  text: text,
43
38
  icon: "warning",
44
- confirmButtonText: "OK"
39
+ confirmButtonText: "OK",
45
40
  });
46
41
  }
47
42
  static Error(text) {
@@ -49,43 +44,40 @@ class Alerts {
49
44
  title: "Error",
50
45
  text: text,
51
46
  icon: "error",
52
- confirmButtonText: "OK"
47
+ confirmButtonText: "OK",
53
48
  });
54
49
  }
55
50
  static NotImplemented() {
56
51
  this.Warning("Not Implemented Yet");
57
52
  }
58
- ;
59
53
  static ErrorOccurred() {
60
54
  this.Error("Sorry, an unexpected error occurred");
61
55
  }
62
- ;
63
56
  static AreYouSure(text, title, confirmButtonText, cancelButtonText, successAction, cancelAction) {
64
57
  if (typeof title == "undefined" || title == null)
65
58
  title = "Are you sure?";
66
59
  Swal.fire({
67
60
  title: title,
68
61
  text: text,
69
- icon: 'warning',
62
+ icon: "warning",
70
63
  confirmButtonText: confirmButtonText,
71
64
  cancelButtonText: cancelButtonText,
72
- showCancelButton: true
73
- })
74
- .then((result) => {
65
+ showCancelButton: true,
66
+ }).then((result) => {
75
67
  if (result.value) {
76
68
  if (successAction) {
77
69
  successAction();
78
70
  }
79
71
  }
80
72
  // result.dismiss can be 'cancel', 'overlay', 'close', and 'timer'
81
- else if (result.dismiss == Swal.DismissReason.cancel || result.dismiss == Swal.DismissReason.close) {
73
+ else if (result.dismiss == Swal.DismissReason.cancel ||
74
+ result.dismiss == Swal.DismissReason.close) {
82
75
  if (cancelAction) {
83
76
  cancelAction();
84
77
  }
85
78
  }
86
79
  });
87
80
  }
88
- ;
89
81
  static Success(text, title, successAction) {
90
82
  if (typeof title == "undefined" || title == null)
91
83
  title = "Success";
@@ -96,9 +88,8 @@ class Alerts {
96
88
  title: title,
97
89
  text: text,
98
90
  icon: "success",
99
- confirmButtonText: "OK"
100
- })
101
- .then(function () {
91
+ confirmButtonText: "OK",
92
+ }).then(function () {
102
93
  if (successAction) {
103
94
  successAction();
104
95
  }
@@ -109,9 +100,9 @@ class Alerts {
109
100
  text = "Operation has been cancled";
110
101
  }
111
102
  Swal.fire({
112
- title: 'Cancelled',
103
+ title: "Cancelled",
113
104
  text: text,
114
- icon: "info"
105
+ icon: "info",
115
106
  });
116
107
  }
117
108
  //Notifications
@@ -124,15 +115,15 @@ class Alerts {
124
115
  }
125
116
  const toast = Swal.mixin({
126
117
  toast: true,
127
- position: 'top-end',
118
+ position: "top-end",
128
119
  showConfirmButton: false,
129
120
  timer: 3000,
130
- timerProgressBar: true
121
+ timerProgressBar: true,
131
122
  });
132
123
  toast.fire({
133
124
  title: title,
134
125
  text: text,
135
- icon: "info"
126
+ icon: "info",
136
127
  });
137
128
  }
138
129
  static NotificationSuccess(text, title) {
@@ -144,10 +135,10 @@ class Alerts {
144
135
  }
145
136
  const toast = Swal.mixin({
146
137
  toast: true,
147
- position: 'top-end',
138
+ position: "top-end",
148
139
  showConfirmButton: false,
149
140
  timer: 3000,
150
- timerProgressBar: true
141
+ timerProgressBar: true,
151
142
  });
152
143
  toast.fire({
153
144
  title: title,
@@ -178,7 +169,9 @@ class Utils {
178
169
  static GetValueByName(url, name) {
179
170
  name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
180
171
  var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), results = regex.exec(url);
181
- return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
172
+ return results === null
173
+ ? ""
174
+ : decodeURIComponent(results[1].replace(/\+/g, " "));
182
175
  }
183
176
  }
184
177
 
@@ -196,7 +189,7 @@ class Utils {
196
189
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
197
190
  </file>
198
191
  */
199
- let BaseGoService = class BaseGoService {
192
+ class BaseGoService {
200
193
  constructor(route, router) {
201
194
  this.route = route;
202
195
  this.router = router;
@@ -205,14 +198,14 @@ let BaseGoService = class BaseGoService {
205
198
  //this.router.navigate([this.route.url]);
206
199
  window.location.reload();
207
200
  }
208
- };
201
+ }
202
+ BaseGoService.decorators = [
203
+ { type: Injectable }
204
+ ];
209
205
  BaseGoService.ctorParameters = () => [
210
206
  { type: ActivatedRoute },
211
207
  { type: Router }
212
- ];
213
- BaseGoService = __decorate([
214
- Injectable()
215
- ], BaseGoService);
208
+ ];
216
209
 
217
210
  /*
218
211
  <file>
@@ -228,7 +221,7 @@ BaseGoService = __decorate([
228
221
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
229
222
  </file>
230
223
  */
231
- let BaseApiService = class BaseApiService {
224
+ class BaseApiService {
232
225
  constructor(http) {
233
226
  this.http = http;
234
227
  this.baseUrl = "";
@@ -286,13 +279,13 @@ let BaseApiService = class BaseApiService {
286
279
  var url = `${this.baseUrl}/getNewGuid`;
287
280
  return this.http.get(url, { responseType: 'text' });
288
281
  }
289
- };
282
+ }
283
+ BaseApiService.decorators = [
284
+ { type: Injectable }
285
+ ];
290
286
  BaseApiService.ctorParameters = () => [
291
287
  { type: HttpClient }
292
- ];
293
- BaseApiService = __decorate([
294
- Injectable()
295
- ], BaseApiService);
288
+ ];
296
289
 
297
290
  /*
298
291
  <file>
@@ -308,14 +301,14 @@ BaseApiService = __decorate([
308
301
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
309
302
  </file>
310
303
  */
311
- let AppContextService = class AppContextService extends BaseApiService {
304
+ class AppContextService extends BaseApiService {
312
305
  constructor(http) {
313
306
  super(http);
314
307
  this.http = http;
315
308
  this.current = null;
316
309
  this.successes = [];
317
310
  this.subscription = null;
318
- this.baseUrl = '/api/appContext';
311
+ this.baseUrl = "/api/appContext";
319
312
  }
320
313
  getCurrent(success) {
321
314
  if (typeof success == "undefined") {
@@ -329,9 +322,9 @@ let AppContextService = class AppContextService extends BaseApiService {
329
322
  if (this.subscription != null) {
330
323
  return;
331
324
  }
332
- this.subscription = this.get('GetCurrentContext', null).subscribe(data => {
325
+ this.subscription = this.get("GetCurrentContext", null).subscribe((data) => {
333
326
  this.dataReceived(data);
334
- }, e => { });
327
+ }, (e) => { });
335
328
  }
336
329
  dataReceived(data) {
337
330
  this.current = data;
@@ -350,13 +343,23 @@ let AppContextService = class AppContextService extends BaseApiService {
350
343
  isUserAdmin() {
351
344
  return window.__context_isUserAdmin;
352
345
  }
353
- };
346
+ }
347
+ AppContextService.decorators = [
348
+ { type: Injectable }
349
+ ];
354
350
  AppContextService.ctorParameters = () => [
355
351
  { type: HttpClient }
356
- ];
357
- AppContextService = __decorate([
358
- Injectable()
359
- ], AppContextService);
352
+ ];
353
+
354
+ class AnatolyCoreModule {
355
+ }
356
+ AnatolyCoreModule.decorators = [
357
+ { type: NgModule, args: [{
358
+ declarations: [],
359
+ imports: [CommonModule],
360
+ providers: [AppContextService],
361
+ },] }
362
+ ];
360
363
 
361
364
  /*
362
365
  <file>
@@ -364,7 +367,7 @@ AppContextService = __decorate([
364
367
  Vadim Osovitny
365
368
 
366
369
  Created:
367
- 28 Aug 2018
370
+ 29 Apr 2018
368
371
 
369
372
  Version:
370
373
  1.0
@@ -372,28 +375,44 @@ AppContextService = __decorate([
372
375
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
373
376
  </file>
374
377
  */
375
- class BaseComponent {
376
- constructor() {
377
- }
378
- getQSId() {
379
- var id = Utils.GetValueByNameInQS("id");
380
- if (typeof id === 'undefined' || id == '')
381
- return null;
382
- return id;
383
- }
384
- showLoading() {
385
- var panelLoading = $('#pnlLoading');
386
- panelLoading.show();
378
+ class BaseGridReadService extends BehaviorSubject {
379
+ constructor(http) {
380
+ super([]);
381
+ this.http = http;
382
+ this.baseReadUrl = "";
383
+ this.data = [];
387
384
  }
388
- hideLoading() {
389
- var panelLoading = $('#pnlLoading');
390
- panelLoading.hide();
385
+ serializeParams(data) {
386
+ return data ? ('?' + $.param(data)) : '';
391
387
  }
392
- handleError(e) {
393
- this.hideLoading();
394
- Alerts.ErrorOccurred();
388
+ read(params, success, error) {
389
+ if (this.data.length) {
390
+ return super.next(this.data);
391
+ }
392
+ var url = this.baseReadUrl;
393
+ if (typeof params === 'undefined') {
394
+ params = this.savedReadParams;
395
+ }
396
+ if (params) {
397
+ url = this.baseReadUrl + `${this.serializeParams(params)}`;
398
+ this.savedReadParams = params;
399
+ }
400
+ this.http.get(url).pipe(map(res => res)).subscribe(data => {
401
+ super.next(data);
402
+ if (success)
403
+ success();
404
+ }, e => {
405
+ if (error)
406
+ error(e);
407
+ });
395
408
  }
396
- }
409
+ }
410
+ BaseGridReadService.decorators = [
411
+ { type: Injectable }
412
+ ];
413
+ BaseGridReadService.ctorParameters = () => [
414
+ { type: HttpClient }
415
+ ];
397
416
 
398
417
  /*
399
418
  <file>
@@ -401,7 +420,7 @@ class BaseComponent {
401
420
  Vadim Osovitny
402
421
 
403
422
  Created:
404
- 20 Nov 2017
423
+ 29 Apr 2018
405
424
 
406
425
  Version:
407
426
  1.0
@@ -409,60 +428,67 @@ class BaseComponent {
409
428
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
410
429
  </file>
411
430
  */
412
- class BaseEditComponent extends BaseComponent {
413
- constructor() {
414
- super();
415
- this.formSubmitted = false;
416
- }
417
- isActionAdding() {
418
- var id = Utils.GetValueByNameInQS("id");
419
- if (typeof id === 'undefined' || id == '')
420
- return true;
421
- return false;
431
+ class BaseGridEditService extends BaseGridReadService {
432
+ constructor(http) {
433
+ super(http);
434
+ this.http = http;
435
+ this.baseUrl = "";
422
436
  }
423
- getEntityId() {
424
- return this.getQSId();
437
+ reset() {
438
+ this.data = [];
425
439
  }
426
- isItemInvalid(name) {
427
- if (typeof name === 'undefined' || name == '') {
428
- return false;
429
- }
430
- if (!this.formGroup) {
431
- return false;
432
- }
433
- if (this.formGroup.get(name)) {
434
- return (this.formSubmitted && this.formGroup.get(name).invalid) ||
435
- (this.formGroup.get(name).touched && this.formGroup.get(name).invalid);
440
+ resetItem(dataItem) {
441
+ if (!dataItem) {
442
+ return;
436
443
  }
437
- return false;
438
- }
439
- getFormValue(name) {
440
- return this.formGroup.controls[name].value;
444
+ //find orignal data item
445
+ const originalDataItem = this.data.find(item => item.Id === dataItem.Id);
446
+ //revert changes
447
+ Object.assign(originalDataItem, dataItem);
448
+ super.next(this.data);
441
449
  }
442
- setFormValue(name, value) {
443
- this.formGroup.controls[name].setValue(value);
450
+ save(data, isNew, sucess) {
451
+ const action = isNew ? 'add' : 'update';
452
+ this.reset();
453
+ this.post(action, data).subscribe(() => {
454
+ }, () => {
455
+ this.read();
456
+ }, () => {
457
+ this.read();
458
+ if (sucess)
459
+ sucess();
460
+ });
444
461
  }
445
- getFormGroupValue(groupName, name) {
446
- return this.formGroup.controls[groupName].get(name).value;
462
+ remove(data, sucess) {
463
+ this.reset();
464
+ this.post('remove', data).subscribe(() => {
465
+ }, () => {
466
+ this.read();
467
+ }, () => {
468
+ this.read();
469
+ if (sucess)
470
+ sucess();
471
+ });
447
472
  }
448
- setFormGroupValue(groupName, name, value) {
449
- this.formGroup.controls[groupName].get(name).setValue(value);
473
+ post(action, data) {
474
+ var url = this.baseUrl + `${action}${this.serializeParams(data)}`;
475
+ return this.http.post(url, data).pipe(map(res => res));
450
476
  }
451
477
  }
452
- __decorate([
453
- Input()
454
- ], BaseEditComponent.prototype, "formGroup", void 0);
455
- __decorate([
456
- Input()
457
- ], BaseEditComponent.prototype, "formSubmitted", void 0);
478
+ BaseGridEditService.decorators = [
479
+ { type: Injectable }
480
+ ];
481
+ BaseGridEditService.ctorParameters = () => [
482
+ { type: HttpClient }
483
+ ];
458
484
 
459
485
  /*
460
486
  <file>
461
487
  Authors:
462
- Anatoly Osovitny
488
+ Vadim Osovitny
463
489
 
464
490
  Created:
465
- 23 Apr 2018
491
+ 12 Nov 2017
466
492
 
467
493
  Version:
468
494
  1.0
@@ -470,22 +496,37 @@ __decorate([
470
496
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
471
497
  </file>
472
498
  */
473
- let ContentHeaderComponent = class ContentHeaderComponent {
474
- ngOnInit() {
475
- if (this.title == null) {
476
- this.title = '';
477
- }
499
+ class BillingApiService extends BaseApiService {
500
+ constructor(http) {
501
+ super(http);
502
+ this.http = http;
503
+ this.baseUrl += 'billing/';
504
+ }
505
+ requestNewSubscription(requestedPlan, success, error) {
506
+ this.postQS('requestNewSubscription', { requestedPlan: requestedPlan })
507
+ .subscribe(data => { }, e => { if (error)
508
+ error(); }, () => { if (success)
509
+ success(); });
510
+ }
511
+ cancelRequestedSubscription(success, error) {
512
+ this.postQS('cancelRequestedSubscription', null)
513
+ .subscribe(data => { }, e => { if (error)
514
+ error(); }, () => { if (success)
515
+ success(); });
516
+ }
517
+ buyAccess(requestedPlan, success, error) {
518
+ this.postQS('buyAccess', { requestedPlan: requestedPlan })
519
+ .subscribe(data => { }, e => { if (error)
520
+ error(); }, () => { if (success)
521
+ success(); });
478
522
  }
479
- };
480
- __decorate([
481
- Input()
482
- ], ContentHeaderComponent.prototype, "title", void 0);
483
- ContentHeaderComponent = __decorate([
484
- Component({
485
- selector: 'anatoly-content-header',
486
- template: "<h2 class=\"page-header\">\r\n {{title}}\r\n <!--<small>Optional {{title}}</small>-->\r\n</h2>\r\n"
487
- })
488
- ], ContentHeaderComponent);
523
+ }
524
+ BillingApiService.decorators = [
525
+ { type: Injectable }
526
+ ];
527
+ BillingApiService.ctorParameters = () => [
528
+ { type: HttpClient }
529
+ ];
489
530
 
490
531
  /*
491
532
  <file>
@@ -493,7 +534,7 @@ ContentHeaderComponent = __decorate([
493
534
  Vadim Osovitny
494
535
 
495
536
  Created:
496
- 8 Dec 2017
537
+ 4 Mar 2020
497
538
 
498
539
  Version:
499
540
  1.0
@@ -501,49 +542,28 @@ ContentHeaderComponent = __decorate([
501
542
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
502
543
  </file>
503
544
  */
504
- class ValidationSummaryComponent extends BaseEditComponent {
505
- constructor() {
506
- super();
507
- }
508
- getFormValidationMessages() {
509
- let messages = [];
510
- Object.keys(this.formGroup.controls).forEach(k => {
511
- var control = this.formGroup.controls[k];
512
- if (control.controls != null) {
513
- Object.keys(control.controls).forEach(k => {
514
- var child = control.controls[k];
515
- this.getValidationMessages(child, k).forEach(m => messages.push(m));
516
- });
517
- }
518
- else {
519
- this.getValidationMessages(control, k).forEach(m => messages.push(m));
520
- }
521
- });
522
- return messages;
523
- }
524
- getValidationMessages(state, thingName) {
525
- let thing = state.path || thingName;
526
- let messages = [];
527
- if (state.errors) {
528
- for (let errorName in state.errors) {
529
- if (state.errors.hasOwnProperty(errorName)) {
530
- switch (errorName) {
531
- case 'required':
532
- messages.push(`${thing} is required`);
533
- break;
534
- case 'minlength':
535
- messages.push(`${thing} must be at least ${state.errors['minlength'].requiredLength} characters`);
536
- break;
537
- case 'pattern':
538
- messages.push(`${thing} contains illegal characters`);
539
- break;
540
- }
541
- }
542
- }
543
- }
544
- return messages;
545
- }
546
- }
545
+ class AnatolyDataModule {
546
+ }
547
+ AnatolyDataModule.decorators = [
548
+ { type: NgModule, args: [{
549
+ imports: [
550
+ CommonModule,
551
+ HttpClientModule,
552
+ HttpClientXsrfModule,
553
+ HttpClientJsonpModule
554
+ ],
555
+ exports: [
556
+ CommonModule,
557
+ HttpClientModule,
558
+ HttpClientXsrfModule,
559
+ HttpClientJsonpModule
560
+ ],
561
+ declarations: [],
562
+ providers: []
563
+ },] }
564
+ ];
565
+
566
+ // Services
547
567
 
548
568
  /*
549
569
  <file>
@@ -551,7 +571,7 @@ class ValidationSummaryComponent extends BaseEditComponent {
551
571
  Vadim Osovitny
552
572
 
553
573
  Created:
554
- 7 Dec 2017
574
+ 1 Jun 2018
555
575
 
556
576
  Version:
557
577
  1.0
@@ -559,25 +579,46 @@ class ValidationSummaryComponent extends BaseEditComponent {
559
579
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
560
580
  </file>
561
581
  */
562
- let FormValidationSummaryComponent = class FormValidationSummaryComponent extends ValidationSummaryComponent {
563
- constructor() {
564
- super();
565
- this.visible = false;
582
+ class SubscribePlanButtonComponent {
583
+ constructor(appcontext) {
584
+ this.appcontext = appcontext;
585
+ this.contextUpdated = false;
586
+ this.isUserSignedIn = false;
587
+ this.currentPlan = 0;
588
+ this.currentPlanTitle = '';
589
+ this.requestedPlan = 0;
590
+ this.requestedPlanTitle = '';
566
591
  }
567
- getErrors() {
568
- var messages = this.getFormValidationMessages();
569
- return messages;
592
+ ngOnInit() {
593
+ if (!this.appcontext.isUserSignedIn()) {
594
+ this.contextUpdated = true;
595
+ return;
596
+ }
597
+ this.appcontext.getCurrent((current) => {
598
+ this.isUserSignedIn = current.isUserSignedIn;
599
+ if (this.isUserSignedIn) {
600
+ this.currentPlan = current.account.billingPlan;
601
+ this.currentPlanTitle = current.account.billingPlanAsString;
602
+ this.requestedPlan = current.account.requestedBillingPlan;
603
+ this.requestedPlanTitle = current.account.requestedBillingPlanAsString;
604
+ }
605
+ this.contextUpdated = true;
606
+ });
570
607
  }
571
- };
572
- __decorate([
573
- Input()
574
- ], FormValidationSummaryComponent.prototype, "visible", void 0);
575
- FormValidationSummaryComponent = __decorate([
576
- Component({
577
- selector: 'anatoly-form-validation-summary',
578
- template: "<div class=\"callout callout-danger\" *ngIf=\"visible\">\r\n <h4 class=\"box-title\">There are problems with the form</h4>\r\n <p *ngFor=\"let error of getErrors()\"><span class=\"help-block \" style=\"color:white\">{{error}}</span></p>\r\n</div>\r\n"
579
- })
580
- ], FormValidationSummaryComponent);
608
+ }
609
+ SubscribePlanButtonComponent.decorators = [
610
+ { type: Component, args: [{
611
+ selector: 'anatoly-subscribe-plan-button',
612
+ template: "<div *ngIf=\"contextUpdated\">\r\n <div *ngIf=\"!isUserSignedIn\">\r\n <anatoly-signup-button classbtn=\"btn btn-block btn-primary\"></anatoly-signup-button>\r\n </div>\r\n\r\n <div *ngIf=\"isUserSignedIn\">\r\n <button class=\"btn btn-block btn-success selectPlan\" *ngIf=\"plan == currentPlan\">\r\n Your Plan\r\n </button>\r\n\r\n <button class=\"btn btn-block btn-warning selectPlan\" *ngIf=\"requestedPlan != null && requestedPlan != 0 && plan == requestedPlan\">\r\n Requested\r\n </button>\r\n\r\n <anatoly-upgrade-plan-button *ngIf=\"plan != currentPlan && plan != requestedPlan\"\r\n [currentplantitle]=\"currentPlanTitle\"\r\n [requestedplan]=plan\r\n [requestedplantitle]=\"plantitle\">\r\n </anatoly-upgrade-plan-button>\r\n </div>\r\n</div>\r\n"
613
+ },] }
614
+ ];
615
+ SubscribePlanButtonComponent.ctorParameters = () => [
616
+ { type: AppContextService }
617
+ ];
618
+ SubscribePlanButtonComponent.propDecorators = {
619
+ plan: [{ type: Input }],
620
+ plantitle: [{ type: Input }]
621
+ };
581
622
 
582
623
  /*
583
624
  <file>
@@ -585,7 +626,7 @@ FormValidationSummaryComponent = __decorate([
585
626
  Vadim Osovitny
586
627
 
587
628
  Created:
588
- 6 Dec 2017
629
+ 12 Nov 2017
589
630
 
590
631
  Version:
591
632
  1.0
@@ -593,64 +634,46 @@ FormValidationSummaryComponent = __decorate([
593
634
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
594
635
  </file>
595
636
  */
596
- let ItemValidationSummaryComponent = class ItemValidationSummaryComponent extends ValidationSummaryComponent {
597
- constructor() {
598
- super();
637
+ // Services
638
+ class UpgradePlanButtonComponent {
639
+ constructor(api) {
640
+ this.api = api;
599
641
  }
600
- };
601
- __decorate([
602
- Input()
603
- ], ItemValidationSummaryComponent.prototype, "controlName", void 0);
604
- __decorate([
605
- Input()
606
- ], ItemValidationSummaryComponent.prototype, "controlTitle", void 0);
607
- ItemValidationSummaryComponent = __decorate([
608
- Component({
609
- selector: 'anatoly-item-validation-summary',
610
- 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"
611
- })
612
- ], ItemValidationSummaryComponent);
613
-
614
- const DefaultEditorOptions = {
615
- placeholderText: 'Edit Your Content Here',
616
- charCounterCount: true,
617
- heightMin: 100,
618
- toolbarInline: false,
619
- toolbarButtons: {
620
- 'moreText': {
621
- 'buttons': ['bold', 'italic', 'underline', 'strikeThrough', 'subscript', 'superscript',
622
- 'fontFamily', 'fontSize', 'textColor', 'backgroundColor', 'inlineClass', 'inlineStyle']
623
- },
624
- 'moreParagraph': {
625
- 'buttons': ['alignLeft', 'alignCenter', 'formatOLSimple', 'alignRight', 'alignJustify',
626
- 'formatOL', 'formatUL', 'paragraphFormat', 'paragraphStyle', 'lineHeight', 'outdent', 'indent', 'quote']
627
- },
628
- 'moreRich': {
629
- 'buttons': ['insertLink', 'insertImage', 'insertTable', 'emoticons', 'fontAwesome',
630
- 'specialCharacters', 'embedly']
631
- },
632
- 'moreMisc': {
633
- 'buttons': ['selectAll', 'clearFormatting', 'html', 'undo', 'redo', 'fullscreen'],
634
- 'align': 'right',
635
- }
636
- },
637
- /*
638
- Upload:
639
- https://www.froala.com/wysiwyg-editor/docs/concepts/image/upload
640
- */
641
- imageUploadURL: '/api/HtmlEditor/UploadImage',
642
- imageAllowedTypes: ['jpeg', 'jpg', 'png'],
643
- imageUploadParams: { uploadType: '', uploadParentId: '' }
642
+ onUpgradePlan() {
643
+ const text = `Current plan: ${this.currentplantitle} New plan: ${this.requestedplantitle}`;
644
+ const that = this;
645
+ Alerts.AreYouSure(text, 'Change billing plan', 'Confirm change', 'Cancel', () => {
646
+ that.api.requestNewSubscription(that.requestedplan, () => {
647
+ Alerts.Success('Your request for changing plan has been sent.', null, () => {
648
+ window.location.reload();
649
+ });
650
+ });
651
+ });
652
+ }
653
+ }
654
+ UpgradePlanButtonComponent.decorators = [
655
+ { type: Component, args: [{
656
+ selector: 'anatoly-upgrade-plan-button',
657
+ template: "<button class=\"btn btn-block btn-primary\" (click)=\"onUpgradePlan()\">\r\n Upgrade\r\n</button>\r\n"
658
+ },] }
659
+ ];
660
+ UpgradePlanButtonComponent.ctorParameters = () => [
661
+ { type: BillingApiService }
662
+ ];
663
+ UpgradePlanButtonComponent.propDecorators = {
664
+ currentplantitle: [{ type: Input }],
665
+ requestedplan: [{ type: Input }],
666
+ requestedplantitle: [{ type: Input }]
644
667
  };
645
668
 
646
669
  /*
647
670
  <file>
648
671
  Authors:
649
- Anatoly Osovitny
650
672
  Vadim Osovitny
673
+ Anatoly Osovitny
651
674
 
652
675
  Created:
653
- 12 Dec 2017
676
+ 14 Aug 2018
654
677
 
655
678
  Version:
656
679
  1.0
@@ -658,162 +681,109 @@ const DefaultEditorOptions = {
658
681
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
659
682
  </file>
660
683
  */
661
- class BaseHtmlEditorComponent extends BaseEditComponent {
662
- constructor() {
663
- super();
664
- this.froalaEditorInitialized = false;
665
- this.afterInitializedActions = [];
666
- //Inputs
667
- this.editorLabelText = 'Html';
668
- this.editorOptions = {};
684
+ class BuyAccessButtonComponent {
685
+ constructor(appcontext, api) {
686
+ this.appcontext = appcontext;
687
+ this.api = api;
688
+ this.contextUpdated = false;
689
+ this.isUserSignedIn = false;
690
+ this.currentPlan = 0;
691
+ this.currentPlanTitle = '';
669
692
  }
670
693
  ngOnInit() {
671
- let opt = this.editorOptions;
672
- if (typeof this.editorOptions == "string") {
673
- opt = JSON.parse(this.editorOptions);
674
- }
675
- let newOptions = $.extend({}, DefaultEditorOptions, opt);
676
- let key = window.__froalaEditor_Key;
677
- if (key) {
678
- newOptions = $.extend({}, newOptions, JSON.parse('{ "key": "' + key + '" }'));
679
- }
680
- if (newOptions.events && newOptions.events.initialized) {
681
- newOptions.events.initialized.overridden = false;
694
+ if (!this.appcontext.isUserSignedIn()) {
695
+ this.contextUpdated = true;
696
+ return;
682
697
  }
683
- this.options = newOptions;
684
- }
685
- ngAfterViewInit() {
686
- let that = this;
687
- setTimeout(function () {
688
- that.froalaEditorInitialized = true;
689
- that.onInitialized();
690
- }, 300);
691
- }
692
- onInitialized() {
693
- let actions = this.afterInitializedActions;
694
- //Clear actions
695
- this.afterInitializedActions = [];
696
- if (actions) {
697
- for (var i = 0; i < actions.length; i++) {
698
- actions[i]();
698
+ this.appcontext.getCurrent((current) => {
699
+ this.isUserSignedIn = current.isUserSignedIn;
700
+ if (this.isUserSignedIn) {
701
+ this.currentPlan = current.account.billingPlan;
702
+ this.currentPlanTitle = current.account.billingPlanAsString;
699
703
  }
700
- }
701
- }
702
- getEditor() {
703
- if (this.froalaEditor)
704
- return this.froalaEditor.getEditor();
705
- return null;
706
- }
707
- //Public Funcs
708
- doAfterInitialized(action) {
709
- let that = this;
710
- if (!this.froalaEditorInitialized) {
711
- this.afterInitializedActions.push(() => { action(that); });
712
- }
713
- else {
714
- action(that);
715
- }
716
- }
717
- initializeControl(control) {
718
- this.froalaEditor = control;
719
- this.froalaEditor.initialize();
704
+ this.contextUpdated = true;
705
+ });
720
706
  }
721
- setUploadParams(uploadType, uploadParentId) {
722
- this.doAfterInitialized(function (that) {
723
- var editor = that.getEditor();
724
- if (typeof (editor) == "undefined" || editor == null) {
725
- return;
726
- }
727
- editor.opts.imageUploadParams.uploadType = uploadType;
728
- editor.opts.imageUploadParams.uploadParentId = uploadParentId;
707
+ onBuyPlan() {
708
+ const text = `Requested plan: ${this.plantitle} `;
709
+ const that = this;
710
+ Alerts.AreYouSure(text, 'Buying access', 'Confirm change', 'Cancel', () => {
711
+ that.api.buyAccess(that.plan, () => {
712
+ Alerts.Success('Access Granted', null, () => {
713
+ window.location.reload();
714
+ });
715
+ });
729
716
  });
730
717
  }
731
718
  }
732
- __decorate([
733
- Input()
734
- ], BaseHtmlEditorComponent.prototype, "editorLabelText", void 0);
735
- __decorate([
736
- Input()
737
- ], BaseHtmlEditorComponent.prototype, "editorOptions", void 0);
719
+ BuyAccessButtonComponent.decorators = [
720
+ { type: Component, args: [{
721
+ selector: 'anatoly-buyaccess-button',
722
+ template: "<div *ngIf=\"contextUpdated\">\r\n <div *ngIf=\"!isUserSignedIn\">\r\n <anatoly-signup-button classbtn=\"btn btn-block btn-primary\"></anatoly-signup-button>\r\n </div>\r\n\r\n <div *ngIf=\"isUserSignedIn\">\r\n <button class=\"btn btn-block btn-success selectPlan\" *ngIf=\"plan == currentPlan\">\r\n Your Plan\r\n </button>\r\n\r\n <button class=\"btn btn-block btn-warning selectPlan\" *ngIf=\"plan != currentPlan && currentPlan == 1\" (click)=\"onBuyPlan()\">\r\n Buy Now\r\n </button>\r\n </div>\r\n</div>\r\n"
723
+ },] }
724
+ ];
725
+ BuyAccessButtonComponent.ctorParameters = () => [
726
+ { type: AppContextService },
727
+ { type: BillingApiService }
728
+ ];
729
+ BuyAccessButtonComponent.propDecorators = {
730
+ plan: [{ type: Input }],
731
+ plantitle: [{ type: Input }]
732
+ };
738
733
 
739
734
  /*
740
735
  <file>
741
736
  Authors:
742
- Anatoly Osovitny
743
737
  Vadim Osovitny
744
738
 
745
739
  Created:
746
- 12 Dec 2017
740
+ 4 Jul 2018
747
741
 
748
742
  Version:
749
743
  1.0
750
744
 
751
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
745
+ Copyright (c) 2018 Osovitny Inc. All rights reserved.
752
746
  </file>
753
747
  */
754
- let HtmlEditorComponent = class HtmlEditorComponent extends BaseHtmlEditorComponent {
755
- constructor() {
756
- super();
757
- }
758
- setHtml(content) {
759
- this.doAfterInitialized(function (that) {
760
- var editor = that.getEditor();
761
- if (typeof (editor) == "undefined" || editor == null) {
762
- return;
763
- }
764
- editor.html.set(content);
765
- });
766
- }
767
- getHtml() {
768
- var editor = this.getEditor();
769
- if (typeof (editor) == "undefined" || editor == null) {
770
- return;
771
- }
772
- return editor.html.get(false);
773
- }
774
- };
775
- HtmlEditorComponent = __decorate([
776
- Component({
777
- selector: 'anatoly-html-editor',
778
- template: "<div>\r\n <label>{{ editorLabelText }}</label>\r\n <textarea [froalaEditor]=\"options\" (froalaInit)=\"initializeControl($event)\">\r\n </textarea>\r\n</div>"
779
- })
780
- ], HtmlEditorComponent);
748
+ class SignInButtonComponent {
749
+ constructor() { }
750
+ }
751
+ SignInButtonComponent.decorators = [
752
+ { type: Component, args: [{
753
+ selector: 'anatoly-signin-button',
754
+ template: "<a href=\"identity/signIn\" class=\"{{classbtn}}\">Sign In</a>\r\n"
755
+ },] }
756
+ ];
757
+ SignInButtonComponent.ctorParameters = () => [];
758
+ SignInButtonComponent.propDecorators = {
759
+ classbtn: [{ type: Input }]
760
+ };
781
761
 
782
762
  /*
783
763
  <file>
784
764
  Authors:
785
- Anatoly Osovitny
786
765
  Vadim Osovitny
787
766
 
788
767
  Created:
789
- 12 Dec 2017
768
+ 4 Jul 2018
790
769
 
791
770
  Version:
792
771
  1.0
793
772
 
794
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
773
+ Copyright (c) 2018 Osovitny Inc. All rights reserved.
795
774
  </file>
796
775
  */
797
- let FormsHtmlEditorComponent = class FormsHtmlEditorComponent extends BaseHtmlEditorComponent {
798
- constructor() {
799
- super();
800
- this.editorFormKey = 'html';
801
- }
802
- setFormValueAfterInitialized(name, value) {
803
- this.doAfterInitialized(function (that) {
804
- that.setFormValue(name, value);
805
- });
806
- }
807
- };
808
- __decorate([
809
- Input()
810
- ], FormsHtmlEditorComponent.prototype, "editorFormKey", void 0);
811
- FormsHtmlEditorComponent = __decorate([
812
- Component({
813
- selector: 'anatoly-forms-html-editor',
814
- 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 [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"
815
- })
816
- ], FormsHtmlEditorComponent);
776
+ class SignUpButtonComponent {
777
+ }
778
+ SignUpButtonComponent.decorators = [
779
+ { type: Component, args: [{
780
+ selector: "anatoly-signup-button",
781
+ template: "<a href=\"identity/signup\" class=\"{{classbtn}}\">Sign Up</a>\r\n"
782
+ },] }
783
+ ];
784
+ SignUpButtonComponent.propDecorators = {
785
+ classbtn: [{ type: Input }]
786
+ };
817
787
 
818
788
  /*
819
789
  <file>
@@ -821,57 +791,27 @@ FormsHtmlEditorComponent = __decorate([
821
791
  Vadim Osovitny
822
792
 
823
793
  Created:
824
- 10 Nov 2017
794
+ 4 Jul 2018
825
795
 
826
796
  Version:
827
797
  1.0
828
798
 
829
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
799
+ Copyright (c) 2018 Osovitny Inc. All rights reserved.
830
800
  </file>
831
801
  */
832
- //Froala
833
- const FroalaEditorModuleWithProviders = FroalaEditorModule.forRoot();
834
- const FroalaViewModuleWithProviders = FroalaViewModule.forRoot();
835
- let AnatolyCoreModule = class AnatolyCoreModule {
836
- };
837
- AnatolyCoreModule = __decorate([
838
- NgModule({
839
- imports: [
840
- CommonModule,
841
- ReactiveFormsModule,
842
- FormsModule,
843
- HttpClientModule,
844
- HttpClientXsrfModule,
845
- HttpClientJsonpModule,
846
- //FroalaEditorModule.forRoot(),
847
- //FroalaViewModule.forRoot(),
848
- FroalaEditorModuleWithProviders,
849
- FroalaViewModuleWithProviders,
850
- GridModule,
851
- PopupModule,
852
- ButtonsModule,
853
- DropDownsModule
854
- ],
855
- exports: [
856
- ItemValidationSummaryComponent,
857
- FormValidationSummaryComponent,
858
- ContentHeaderComponent,
859
- HtmlEditorComponent,
860
- FormsHtmlEditorComponent
861
- ],
862
- declarations: [
863
- ItemValidationSummaryComponent,
864
- FormValidationSummaryComponent,
865
- ContentHeaderComponent,
866
- HtmlEditorComponent,
867
- FormsHtmlEditorComponent
868
- ],
869
- providers: [
870
- AppContextService
871
- ],
872
- schemas: []
873
- })
874
- ], AnatolyCoreModule);
802
+ class SignOutButtonComponent {
803
+ constructor() { }
804
+ }
805
+ SignOutButtonComponent.decorators = [
806
+ { type: Component, args: [{
807
+ selector: 'anatoly-signout-button',
808
+ template: "<a href=\"identity/signOut\" class=\"{{classbtn}}\">Sign Out</a>\r\n"
809
+ },] }
810
+ ];
811
+ SignOutButtonComponent.ctorParameters = () => [];
812
+ SignOutButtonComponent.propDecorators = {
813
+ classbtn: [{ type: Input }]
814
+ };
875
815
 
876
816
  /*
877
817
  <file>
@@ -879,7 +819,7 @@ AnatolyCoreModule = __decorate([
879
819
  Vadim Osovitny
880
820
 
881
821
  Created:
882
- 12 Nov 2017
822
+ 28 Aug 2018
883
823
 
884
824
  Version:
885
825
  1.0
@@ -887,46 +827,34 @@ AnatolyCoreModule = __decorate([
887
827
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
888
828
  </file>
889
829
  */
890
- let BillingApiService = class BillingApiService extends BaseApiService {
891
- constructor(http) {
892
- super(http);
893
- this.http = http;
894
- this.baseUrl += 'billing/';
830
+ class BaseComponent {
831
+ getQSId() {
832
+ const id = Utils.GetValueByNameInQS('id');
833
+ if (typeof id === 'undefined' || id === '')
834
+ return null;
835
+ return id;
895
836
  }
896
- requestNewSubscription(requestedPlan, success, error) {
897
- this.postQS('requestNewSubscription', { requestedPlan: requestedPlan })
898
- .subscribe(data => { }, e => { if (error)
899
- error(); }, () => { if (success)
900
- success(); });
837
+ showLoading() {
838
+ const panelLoading = $('#pnlLoading');
839
+ panelLoading.show();
901
840
  }
902
- cancelRequestedSubscription(success, error) {
903
- this.postQS('cancelRequestedSubscription', null)
904
- .subscribe(data => { }, e => { if (error)
905
- error(); }, () => { if (success)
906
- success(); });
841
+ hideLoading() {
842
+ const panelLoading = $('#pnlLoading');
843
+ panelLoading.hide();
907
844
  }
908
- buyAccess(requestedPlan, success, error) {
909
- this.postQS('buyAccess', { requestedPlan: requestedPlan })
910
- .subscribe(data => { }, e => { if (error)
911
- error(); }, () => { if (success)
912
- success(); });
845
+ handleError(e) {
846
+ this.hideLoading();
847
+ Alerts.ErrorOccurred();
913
848
  }
914
- };
915
- BillingApiService.ctorParameters = () => [
916
- { type: HttpClient }
917
- ];
918
- BillingApiService = __decorate([
919
- Injectable()
920
- ], BillingApiService);
849
+ }
921
850
 
922
851
  /*
923
852
  <file>
924
853
  Authors:
925
854
  Vadim Osovitny
926
- Anatoly Osovitny
927
855
 
928
856
  Created:
929
- 14 Aug 2018
857
+ 20 Nov 2017
930
858
 
931
859
  Version:
932
860
  1.0
@@ -934,57 +862,50 @@ BillingApiService = __decorate([
934
862
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
935
863
  </file>
936
864
  */
937
- let BuyAccessButtonComponent = class BuyAccessButtonComponent {
938
- constructor(appcontext, api) {
939
- this.appcontext = appcontext;
940
- this.api = api;
941
- this.contextUpdated = false;
942
- this.isUserSignedIn = false;
943
- this.currentPlan = 0;
944
- this.currentPlanTitle = "";
865
+ class BaseEditComponent extends BaseComponent {
866
+ constructor() {
867
+ super();
868
+ this.formSubmitted = false;
945
869
  }
946
- ngOnInit() {
947
- if (!this.appcontext.isUserSignedIn()) {
948
- this.contextUpdated = true;
949
- return;
950
- }
951
- this.appcontext.getCurrent((current) => {
952
- this.isUserSignedIn = current.isUserSignedIn;
953
- if (this.isUserSignedIn) {
954
- this.currentPlan = current.account.billingPlan;
955
- this.currentPlanTitle = current.account.billingPlanAsString;
956
- }
957
- this.contextUpdated = true;
958
- });
870
+ isActionAdding() {
871
+ const id = Utils.GetValueByNameInQS('id');
872
+ if (typeof id === 'undefined' || id === '')
873
+ return true;
874
+ return false;
959
875
  }
960
- onBuyPlan() {
961
- const text = `Requested plan: ${this.plantitle} `;
962
- let that = this;
963
- Alerts.AreYouSure(text, "Buying access", "Confirm change", "Cancel", () => {
964
- that.api.buyAccess(that.plan, () => {
965
- Alerts.Success("Access Granted", null, () => {
966
- window.location.reload();
967
- });
968
- });
969
- });
876
+ getEntityId() {
877
+ return this.getQSId();
970
878
  }
971
- };
972
- BuyAccessButtonComponent.ctorParameters = () => [
973
- { type: AppContextService },
974
- { type: BillingApiService }
975
- ];
976
- __decorate([
977
- Input()
978
- ], BuyAccessButtonComponent.prototype, "plan", void 0);
979
- __decorate([
980
- Input()
981
- ], BuyAccessButtonComponent.prototype, "plantitle", void 0);
982
- BuyAccessButtonComponent = __decorate([
983
- Component({
984
- selector: "anatoly-buyaccess-button",
985
- template: "<div *ngIf=\"contextUpdated\">\r\n <div *ngIf=\"!isUserSignedIn\">\r\n <anatoly-signup-button classbtn=\"btn btn-block btn-primary\"></anatoly-signup-button>\r\n </div>\r\n\r\n <div *ngIf=\"isUserSignedIn\">\r\n <button class=\"btn btn-block btn-success selectPlan\" *ngIf=\"plan == currentPlan\">\r\n Your Plan\r\n </button>\r\n\r\n <button class=\"btn btn-block btn-warning selectPlan\" *ngIf=\"plan != currentPlan && currentPlan == 1\" (click)=\"onBuyPlan()\">\r\n Buy Now\r\n </button>\r\n </div>\r\n</div>\r\n"
986
- })
987
- ], BuyAccessButtonComponent);
879
+ isItemInvalid(name) {
880
+ if (typeof name === 'undefined' || name === '') {
881
+ return false;
882
+ }
883
+ if (!this.formGroup) {
884
+ return false;
885
+ }
886
+ if (this.formGroup.get(name)) {
887
+ return ((this.formSubmitted && this.formGroup.get(name).invalid) ||
888
+ (this.formGroup.get(name).touched && this.formGroup.get(name).invalid));
889
+ }
890
+ return false;
891
+ }
892
+ getFormValue(name) {
893
+ return this.formGroup.controls[name].value;
894
+ }
895
+ setFormValue(name, value) {
896
+ this.formGroup.controls[name].setValue(value);
897
+ }
898
+ getFormGroupValue(groupName, name) {
899
+ return this.formGroup.controls[groupName].get(name).value;
900
+ }
901
+ setFormGroupValue(groupName, name, value) {
902
+ this.formGroup.controls[groupName].get(name).setValue(value);
903
+ }
904
+ }
905
+ BaseEditComponent.propDecorators = {
906
+ formGroup: [{ type: Input }],
907
+ formSubmitted: [{ type: Input }]
908
+ };
988
909
 
989
910
  /*
990
911
  <file>
@@ -992,7 +913,7 @@ BuyAccessButtonComponent = __decorate([
992
913
  Vadim Osovitny
993
914
 
994
915
  Created:
995
- 1 Jun 2018
916
+ 8 Dec 2017
996
917
 
997
918
  Version:
998
919
  1.0
@@ -1000,48 +921,49 @@ BuyAccessButtonComponent = __decorate([
1000
921
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1001
922
  </file>
1002
923
  */
1003
- let SubscribePlanButtonComponent = class SubscribePlanButtonComponent {
1004
- constructor(appcontext) {
1005
- this.appcontext = appcontext;
1006
- this.contextUpdated = false;
1007
- this.isUserSignedIn = false;
1008
- this.currentPlan = 0;
1009
- this.currentPlanTitle = "";
1010
- this.requestedPlan = 0;
1011
- this.requestedPlanTitle = "";
924
+ class ValidationSummaryComponent extends BaseEditComponent {
925
+ constructor() {
926
+ super();
1012
927
  }
1013
- ngOnInit() {
1014
- if (!this.appcontext.isUserSignedIn()) {
1015
- this.contextUpdated = true;
1016
- return;
1017
- }
1018
- this.appcontext.getCurrent((current) => {
1019
- this.isUserSignedIn = current.isUserSignedIn;
1020
- if (this.isUserSignedIn) {
1021
- this.currentPlan = current.account.billingPlan;
1022
- this.currentPlanTitle = current.account.billingPlanAsString;
1023
- this.requestedPlan = current.account.requestedBillingPlan;
1024
- this.requestedPlanTitle = current.account.requestedBillingPlanAsString;
928
+ getFormValidationMessages() {
929
+ let messages = [];
930
+ Object.keys(this.formGroup.controls).forEach((k) => {
931
+ var control = this.formGroup.controls[k];
932
+ if (control.controls != null) {
933
+ Object.keys(control.controls).forEach((k) => {
934
+ var child = control.controls[k];
935
+ this.getValidationMessages(child, k).forEach((m) => messages.push(m));
936
+ });
937
+ }
938
+ else {
939
+ this.getValidationMessages(control, k).forEach((m) => messages.push(m));
1025
940
  }
1026
- this.contextUpdated = true;
1027
941
  });
942
+ return messages;
1028
943
  }
1029
- };
1030
- SubscribePlanButtonComponent.ctorParameters = () => [
1031
- { type: AppContextService }
1032
- ];
1033
- __decorate([
1034
- Input()
1035
- ], SubscribePlanButtonComponent.prototype, "plan", void 0);
1036
- __decorate([
1037
- Input()
1038
- ], SubscribePlanButtonComponent.prototype, "plantitle", void 0);
1039
- SubscribePlanButtonComponent = __decorate([
1040
- Component({
1041
- selector: 'anatoly-subscribe-plan-button',
1042
- template: "<div *ngIf=\"contextUpdated\">\r\n <div *ngIf=\"!isUserSignedIn\">\r\n <anatoly-signup-button classbtn=\"btn btn-block btn-primary\"></anatoly-signup-button>\r\n </div>\r\n\r\n <div *ngIf=\"isUserSignedIn\">\r\n <button class=\"btn btn-block btn-success selectPlan\" *ngIf=\"plan == currentPlan\">\r\n Your Plan\r\n </button>\r\n\r\n <button class=\"btn btn-block btn-warning selectPlan\" *ngIf=\"requestedPlan != null && requestedPlan != 0 && plan == requestedPlan\">\r\n Requested\r\n </button>\r\n\r\n <anatoly-upgrade-plan-button *ngIf=\"plan != currentPlan && plan != requestedPlan\"\r\n [currentplantitle]=\"currentPlanTitle\"\r\n [requestedplan]=plan\r\n [requestedplantitle]=\"plantitle\">\r\n </anatoly-upgrade-plan-button>\r\n </div>\r\n</div>\r\n"
1043
- })
1044
- ], SubscribePlanButtonComponent);
944
+ getValidationMessages(state, thingName) {
945
+ let thing = state.path || thingName;
946
+ let messages = [];
947
+ if (state.errors) {
948
+ for (let errorName in state.errors) {
949
+ if (state.errors.hasOwnProperty(errorName)) {
950
+ switch (errorName) {
951
+ case "required":
952
+ messages.push(`${thing} is required`);
953
+ break;
954
+ case "minlength":
955
+ messages.push(`${thing} must be at least ${state.errors["minlength"].requiredLength} characters`);
956
+ break;
957
+ case "pattern":
958
+ messages.push(`${thing} contains illegal characters`);
959
+ break;
960
+ }
961
+ }
962
+ }
963
+ }
964
+ return messages;
965
+ }
966
+ }
1045
967
 
1046
968
  /*
1047
969
  <file>
@@ -1049,7 +971,7 @@ SubscribePlanButtonComponent = __decorate([
1049
971
  Vadim Osovitny
1050
972
 
1051
973
  Created:
1052
- 12 Nov 2017
974
+ 7 Dec 2017
1053
975
 
1054
976
  Version:
1055
977
  1.0
@@ -1057,40 +979,26 @@ SubscribePlanButtonComponent = __decorate([
1057
979
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1058
980
  </file>
1059
981
  */
1060
- let UpgradePlanButtonComponent = class UpgradePlanButtonComponent {
1061
- constructor(api) {
1062
- this.api = api;
982
+ class FormValidationSummaryComponent extends ValidationSummaryComponent {
983
+ constructor() {
984
+ super();
985
+ this.isVisible = false;
1063
986
  }
1064
- onUpgradePlan() {
1065
- let text = `Current plan: ${this.currentplantitle} New plan: ${this.requestedplantitle}`;
1066
- let that = this;
1067
- Alerts.AreYouSure(text, 'Change billing plan', 'Confirm change', 'Cancel', () => {
1068
- that.api.requestNewSubscription(that.requestedplan, () => {
1069
- Alerts.Success('Your request for changing plan has been sent.', null, () => {
1070
- window.location.reload();
1071
- });
1072
- });
1073
- });
987
+ getErrors() {
988
+ const messages = this.getFormValidationMessages();
989
+ return messages;
1074
990
  }
1075
- };
1076
- UpgradePlanButtonComponent.ctorParameters = () => [
1077
- { type: BillingApiService }
991
+ }
992
+ FormValidationSummaryComponent.decorators = [
993
+ { type: Component, args: [{
994
+ selector: "anatoly-form-validation-summary",
995
+ template: "<div class=\"callout callout-danger\" *ngIf=\"isVisible\">\r\n <h4 class=\"box-title\">There are problems with the form</h4>\r\n <p *ngFor=\"let error of getErrors()\">\r\n <span class=\"help-block\" style=\"color: white;\">{{ error }}</span>\r\n </p>\r\n</div>\r\n"
996
+ },] }
1078
997
  ];
1079
- __decorate([
1080
- Input()
1081
- ], UpgradePlanButtonComponent.prototype, "currentplantitle", void 0);
1082
- __decorate([
1083
- Input()
1084
- ], UpgradePlanButtonComponent.prototype, "requestedplan", void 0);
1085
- __decorate([
1086
- Input()
1087
- ], UpgradePlanButtonComponent.prototype, "requestedplantitle", void 0);
1088
- UpgradePlanButtonComponent = __decorate([
1089
- Component({
1090
- selector: 'anatoly-upgrade-plan-button',
1091
- template: "<button class=\"btn btn-block btn-primary\" (click)=\"onUpgradePlan()\">\r\n Upgrade\r\n</button>\r\n"
1092
- })
1093
- ], UpgradePlanButtonComponent);
998
+ FormValidationSummaryComponent.ctorParameters = () => [];
999
+ FormValidationSummaryComponent.propDecorators = {
1000
+ isVisible: [{ type: Input }]
1001
+ };
1094
1002
 
1095
1003
  /*
1096
1004
  <file>
@@ -1098,124 +1006,162 @@ UpgradePlanButtonComponent = __decorate([
1098
1006
  Vadim Osovitny
1099
1007
 
1100
1008
  Created:
1101
- 4 Jul 2018
1009
+ 6 Dec 2017
1102
1010
 
1103
1011
  Version:
1104
1012
  1.0
1105
1013
 
1106
- Copyright (c) 2018 Osovitny Inc. All rights reserved.
1014
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1107
1015
  </file>
1108
1016
  */
1109
- let SignInButtonComponent = class SignInButtonComponent {
1110
- constructor() { }
1111
- };
1112
- __decorate([
1113
- Input()
1114
- ], SignInButtonComponent.prototype, "classbtn", void 0);
1115
- SignInButtonComponent = __decorate([
1116
- Component({
1117
- selector: 'anatoly-signin-button',
1118
- template: "<a href=\"identity/signIn\" class=\"{{classbtn}}\">Sign In</a>\r\n"
1119
- })
1120
- ], SignInButtonComponent);
1017
+ class ItemValidationSummaryComponent extends ValidationSummaryComponent {
1018
+ constructor() {
1019
+ super();
1020
+ }
1021
+ }
1022
+ ItemValidationSummaryComponent.decorators = [
1023
+ { type: Component, args: [{
1024
+ selector: "anatoly-item-validation-summary",
1025
+ 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"
1026
+ },] }
1027
+ ];
1028
+ ItemValidationSummaryComponent.ctorParameters = () => [];
1029
+ ItemValidationSummaryComponent.propDecorators = {
1030
+ controlName: [{ type: Input }],
1031
+ controlTitle: [{ type: Input }]
1032
+ };
1121
1033
 
1122
- /*
1123
- <file>
1124
- Authors:
1125
- Vadim Osovitny
1126
-
1127
- Created:
1128
- 4 Jul 2018
1129
-
1130
- Version:
1131
- 1.0
1132
-
1133
- Copyright (c) 2018 Osovitny Inc. All rights reserved.
1134
- </file>
1135
- */
1136
- let SignOutButtonComponent = class SignOutButtonComponent {
1137
- constructor() { }
1138
- };
1139
- __decorate([
1140
- Input()
1141
- ], SignOutButtonComponent.prototype, "classbtn", void 0);
1142
- SignOutButtonComponent = __decorate([
1143
- Component({
1144
- selector: 'anatoly-signout-button',
1145
- template: "<a href=\"identity/signOut\" class=\"{{classbtn}}\">Sign Out</a>\r\n"
1146
- })
1147
- ], SignOutButtonComponent);
1034
+ const DefaultEditorOptions = {
1035
+ placeholderText: 'Edit Your Content Here',
1036
+ charCounterCount: true,
1037
+ heightMin: 100,
1038
+ toolbarInline: false,
1039
+ toolbarButtons: {
1040
+ 'moreText': {
1041
+ 'buttons': ['bold', 'italic', 'underline', 'strikeThrough', 'subscript', 'superscript',
1042
+ 'fontFamily', 'fontSize', 'textColor', 'backgroundColor', 'inlineClass', 'inlineStyle']
1043
+ },
1044
+ 'moreParagraph': {
1045
+ 'buttons': ['alignLeft', 'alignCenter', 'formatOLSimple', 'alignRight', 'alignJustify',
1046
+ 'formatOL', 'formatUL', 'paragraphFormat', 'paragraphStyle', 'lineHeight', 'outdent', 'indent', 'quote']
1047
+ },
1048
+ 'moreRich': {
1049
+ 'buttons': ['insertLink', 'insertImage', 'insertTable', 'emoticons', 'fontAwesome',
1050
+ 'specialCharacters', 'embedly']
1051
+ },
1052
+ 'moreMisc': {
1053
+ 'buttons': ['selectAll', 'clearFormatting', 'html', 'undo', 'redo', 'fullscreen'],
1054
+ 'align': 'right',
1055
+ }
1056
+ },
1057
+ /*
1058
+ Upload:
1059
+ https://www.froala.com/wysiwyg-editor/docs/concepts/image/upload
1060
+ */
1061
+ imageUploadURL: '/api/HtmlEditor/UploadImage',
1062
+ imageAllowedTypes: ['jpeg', 'jpg', 'png'],
1063
+ imageUploadParams: { uploadType: '', uploadParentId: '' }
1064
+ };
1148
1065
 
1149
1066
  /*
1150
1067
  <file>
1151
1068
  Authors:
1069
+ Anatoly Osovitny
1152
1070
  Vadim Osovitny
1153
1071
 
1154
1072
  Created:
1155
- 4 Jul 2018
1073
+ 12 Dec 2017
1156
1074
 
1157
1075
  Version:
1158
1076
  1.0
1159
1077
 
1160
- Copyright (c) 2018 Osovitny Inc. All rights reserved.
1078
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1161
1079
  </file>
1162
1080
  */
1163
- let SignUpButtonComponent = class SignUpButtonComponent {
1081
+ class BaseHtmlEditorComponent extends BaseEditComponent {
1164
1082
  constructor() {
1083
+ super();
1084
+ this.froalaEditorInitialized = false;
1085
+ this.afterInitializedActions = [];
1086
+ //Inputs
1087
+ this.editorLabelText = 'Html';
1088
+ this.editorOptions = {};
1165
1089
  }
1166
- };
1167
- __decorate([
1168
- Input()
1169
- ], SignUpButtonComponent.prototype, "classbtn", void 0);
1170
- SignUpButtonComponent = __decorate([
1171
- Component({
1172
- selector: 'anatoly-signup-button',
1173
- template: "<a href=\"identity/signup\" class=\"{{classbtn}}\">Sign Up</a>\r\n"
1174
- })
1175
- ], SignUpButtonComponent);
1176
-
1177
- /*
1178
- <file>
1179
- Authors:
1180
- Vadim Osovitny
1181
-
1182
- Created:
1183
- 4 Jul 2018
1184
-
1185
- Version:
1186
- 1.0
1187
-
1188
- Copyright (c) 2018 Osovitny Inc. All rights reserved.
1189
- </file>
1190
- */
1191
- let AnatolyIdentityModule = class AnatolyIdentityModule {
1192
- };
1193
- AnatolyIdentityModule = __decorate([
1194
- NgModule({
1195
- imports: [],
1196
- exports: [
1197
- SignInButtonComponent,
1198
- SignUpButtonComponent,
1199
- SignOutButtonComponent
1200
- ],
1201
- declarations: [
1202
- SignInButtonComponent,
1203
- SignUpButtonComponent,
1204
- SignOutButtonComponent
1205
- ],
1206
- providers: []
1207
- })
1208
- ], AnatolyIdentityModule);
1209
-
1210
- // Components
1090
+ ngOnInit() {
1091
+ let opt = this.editorOptions;
1092
+ if (typeof this.editorOptions == "string") {
1093
+ opt = JSON.parse(this.editorOptions);
1094
+ }
1095
+ let newOptions = $.extend({}, DefaultEditorOptions, opt);
1096
+ let key = window.__froalaEditor_Key;
1097
+ if (key) {
1098
+ newOptions = $.extend({}, newOptions, JSON.parse('{ "key": "' + key + '" }'));
1099
+ }
1100
+ if (newOptions.events && newOptions.events.initialized) {
1101
+ newOptions.events.initialized.overridden = false;
1102
+ }
1103
+ this.options = newOptions;
1104
+ }
1105
+ ngAfterViewInit() {
1106
+ let that = this;
1107
+ setTimeout(function () {
1108
+ that.froalaEditorInitialized = true;
1109
+ that.onInitialized();
1110
+ }, 300);
1111
+ }
1112
+ onInitialized() {
1113
+ let actions = this.afterInitializedActions;
1114
+ //Clear actions
1115
+ this.afterInitializedActions = [];
1116
+ if (actions) {
1117
+ for (var i = 0; i < actions.length; i++) {
1118
+ actions[i]();
1119
+ }
1120
+ }
1121
+ }
1122
+ getEditor() {
1123
+ if (this.froalaEditor)
1124
+ return this.froalaEditor.getEditor();
1125
+ return null;
1126
+ }
1127
+ //Public Funcs
1128
+ doAfterInitialized(action) {
1129
+ let that = this;
1130
+ if (!this.froalaEditorInitialized) {
1131
+ this.afterInitializedActions.push(() => { action(that); });
1132
+ }
1133
+ else {
1134
+ action(that);
1135
+ }
1136
+ }
1137
+ initializeControl(control) {
1138
+ this.froalaEditor = control;
1139
+ this.froalaEditor.initialize();
1140
+ }
1141
+ setUploadParams(uploadType, uploadParentId) {
1142
+ this.doAfterInitialized(function (that) {
1143
+ var editor = that.getEditor();
1144
+ if (typeof (editor) == "undefined" || editor == null) {
1145
+ return;
1146
+ }
1147
+ editor.opts.imageUploadParams.uploadType = uploadType;
1148
+ editor.opts.imageUploadParams.uploadParentId = uploadParentId;
1149
+ });
1150
+ }
1151
+ }
1152
+ BaseHtmlEditorComponent.propDecorators = {
1153
+ editorLabelText: [{ type: Input }],
1154
+ editorOptions: [{ type: Input }]
1155
+ };
1211
1156
 
1212
1157
  /*
1213
1158
  <file>
1214
1159
  Authors:
1160
+ Anatoly Osovitny
1215
1161
  Vadim Osovitny
1216
1162
 
1217
1163
  Created:
1218
- 10 Nov 2017
1164
+ 12 Dec 2017
1219
1165
 
1220
1166
  Version:
1221
1167
  1.0
@@ -1223,46 +1169,43 @@ AnatolyIdentityModule = __decorate([
1223
1169
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1224
1170
  </file>
1225
1171
  */
1226
- let AnatolyBillingModule = class AnatolyBillingModule {
1227
- };
1228
- AnatolyBillingModule = __decorate([
1229
- NgModule({
1230
- imports: [
1231
- CommonModule,
1232
- HttpClientModule,
1233
- HttpClientXsrfModule,
1234
- HttpClientJsonpModule,
1235
- AnatolyIdentityModule
1236
- ],
1237
- exports: [
1238
- CommonModule,
1239
- HttpClientModule,
1240
- HttpClientXsrfModule,
1241
- HttpClientJsonpModule,
1242
- SubscribePlanButtonComponent,
1243
- UpgradePlanButtonComponent,
1244
- BuyAccessButtonComponent
1245
- ],
1246
- declarations: [
1247
- SubscribePlanButtonComponent,
1248
- UpgradePlanButtonComponent,
1249
- BuyAccessButtonComponent
1250
- ],
1251
- providers: [
1252
- BillingApiService
1253
- ]
1254
- })
1255
- ], AnatolyBillingModule);
1256
-
1257
- // Components
1172
+ class HtmlEditorComponent extends BaseHtmlEditorComponent {
1173
+ constructor() {
1174
+ super();
1175
+ }
1176
+ setHtml(content) {
1177
+ this.doAfterInitialized(function (that) {
1178
+ var editor = that.getEditor();
1179
+ if (typeof (editor) == "undefined" || editor == null) {
1180
+ return;
1181
+ }
1182
+ editor.html.set(content);
1183
+ });
1184
+ }
1185
+ getHtml() {
1186
+ var editor = this.getEditor();
1187
+ if (typeof (editor) == "undefined" || editor == null) {
1188
+ return;
1189
+ }
1190
+ return editor.html.get(false);
1191
+ }
1192
+ }
1193
+ HtmlEditorComponent.decorators = [
1194
+ { type: Component, args: [{
1195
+ selector: 'anatoly-html-editor',
1196
+ template: "<div>\r\n <label>{{ editorLabelText }}</label>\r\n <textarea [froalaEditor]=\"options\" (froalaInit)=\"initializeControl($event)\">\r\n </textarea>\r\n</div>"
1197
+ },] }
1198
+ ];
1199
+ HtmlEditorComponent.ctorParameters = () => [];
1258
1200
 
1259
1201
  /*
1260
1202
  <file>
1261
1203
  Authors:
1204
+ Anatoly Osovitny
1262
1205
  Vadim Osovitny
1263
1206
 
1264
1207
  Created:
1265
- 29 Apr 2018
1208
+ 12 Dec 2017
1266
1209
 
1267
1210
  Version:
1268
1211
  1.0
@@ -1270,52 +1213,35 @@ AnatolyBillingModule = __decorate([
1270
1213
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1271
1214
  </file>
1272
1215
  */
1273
- let BaseGridReadService = class BaseGridReadService extends BehaviorSubject {
1274
- constructor(http) {
1275
- super([]);
1276
- this.http = http;
1277
- this.baseReadUrl = "";
1278
- this.data = [];
1279
- }
1280
- serializeParams(data) {
1281
- return data ? ('?' + $.param(data)) : '';
1216
+ class FormsHtmlEditorComponent extends BaseHtmlEditorComponent {
1217
+ constructor() {
1218
+ super();
1219
+ this.editorFormKey = 'html';
1282
1220
  }
1283
- read(params, success, error) {
1284
- if (this.data.length) {
1285
- return super.next(this.data);
1286
- }
1287
- var url = this.baseReadUrl;
1288
- if (typeof params === 'undefined') {
1289
- params = this.savedReadParams;
1290
- }
1291
- if (params) {
1292
- url = this.baseReadUrl + `${this.serializeParams(params)}`;
1293
- this.savedReadParams = params;
1294
- }
1295
- this.http.get(url).pipe(map(res => res)).subscribe(data => {
1296
- super.next(data);
1297
- if (success)
1298
- success();
1299
- }, e => {
1300
- if (error)
1301
- error(e);
1221
+ setFormValueAfterInitialized(name, value) {
1222
+ this.doAfterInitialized(function (that) {
1223
+ that.setFormValue(name, value);
1302
1224
  });
1303
1225
  }
1304
- };
1305
- BaseGridReadService.ctorParameters = () => [
1306
- { type: HttpClient }
1226
+ }
1227
+ FormsHtmlEditorComponent.decorators = [
1228
+ { type: Component, args: [{
1229
+ selector: 'anatoly-forms-html-editor',
1230
+ 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 [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"
1231
+ },] }
1307
1232
  ];
1308
- BaseGridReadService = __decorate([
1309
- Injectable()
1310
- ], BaseGridReadService);
1233
+ FormsHtmlEditorComponent.ctorParameters = () => [];
1234
+ FormsHtmlEditorComponent.propDecorators = {
1235
+ editorFormKey: [{ type: Input }]
1236
+ };
1311
1237
 
1312
1238
  /*
1313
1239
  <file>
1314
1240
  Authors:
1315
- Vadim Osovitny
1241
+ Anatoly Osovitny
1316
1242
 
1317
1243
  Created:
1318
- 29 Apr 2018
1244
+ 23 Apr 2018
1319
1245
 
1320
1246
  Version:
1321
1247
  1.0
@@ -1323,59 +1249,22 @@ BaseGridReadService = __decorate([
1323
1249
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1324
1250
  </file>
1325
1251
  */
1326
- let BaseGridEditService = class BaseGridEditService extends BaseGridReadService {
1327
- constructor(http) {
1328
- super(http);
1329
- this.http = http;
1330
- this.baseUrl = "";
1331
- }
1332
- reset() {
1333
- this.data = [];
1334
- }
1335
- resetItem(dataItem) {
1336
- if (!dataItem) {
1337
- return;
1252
+ class ContentHeaderComponent {
1253
+ ngOnInit() {
1254
+ if (this.title == null) {
1255
+ this.title = '';
1338
1256
  }
1339
- //find orignal data item
1340
- const originalDataItem = this.data.find(item => item.Id === dataItem.Id);
1341
- //revert changes
1342
- Object.assign(originalDataItem, dataItem);
1343
- super.next(this.data);
1344
- }
1345
- save(data, isNew, sucess) {
1346
- const action = isNew ? 'add' : 'update';
1347
- this.reset();
1348
- this.post(action, data).subscribe(() => {
1349
- }, () => {
1350
- this.read();
1351
- }, () => {
1352
- this.read();
1353
- if (sucess)
1354
- sucess();
1355
- });
1356
- }
1357
- remove(data, sucess) {
1358
- this.reset();
1359
- this.post('remove', data).subscribe(() => {
1360
- }, () => {
1361
- this.read();
1362
- }, () => {
1363
- this.read();
1364
- if (sucess)
1365
- sucess();
1366
- });
1367
- }
1368
- post(action, data) {
1369
- var url = this.baseUrl + `${action}${this.serializeParams(data)}`;
1370
- return this.http.post(url, data).pipe(map(res => res));
1371
1257
  }
1372
- };
1373
- BaseGridEditService.ctorParameters = () => [
1374
- { type: HttpClient }
1258
+ }
1259
+ ContentHeaderComponent.decorators = [
1260
+ { type: Component, args: [{
1261
+ selector: 'anatoly-content-header',
1262
+ template: "<h2 class=\"page-header\">\r\n {{title}}\r\n <!--<small>Optional {{title}}</small>-->\r\n</h2>\r\n"
1263
+ },] }
1375
1264
  ];
1376
- BaseGridEditService = __decorate([
1377
- Injectable()
1378
- ], BaseGridEditService);
1265
+ ContentHeaderComponent.propDecorators = {
1266
+ title: [{ type: Input }]
1267
+ };
1379
1268
 
1380
1269
  /*
1381
1270
  <file>
@@ -1383,7 +1272,7 @@ BaseGridEditService = __decorate([
1383
1272
  Vadim Osovitny
1384
1273
 
1385
1274
  Created:
1386
- 4 Mar 2020
1275
+ 10 Nov 2017
1387
1276
 
1388
1277
  Version:
1389
1278
  1.0
@@ -1391,32 +1280,57 @@ BaseGridEditService = __decorate([
1391
1280
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1392
1281
  </file>
1393
1282
  */
1394
- let AnatolyDataModule = class AnatolyDataModule {
1395
- };
1396
- AnatolyDataModule = __decorate([
1397
- NgModule({
1398
- imports: [
1399
- CommonModule,
1400
- HttpClientModule,
1401
- HttpClientXsrfModule,
1402
- HttpClientJsonpModule
1403
- ],
1404
- exports: [
1405
- CommonModule,
1406
- HttpClientModule,
1407
- HttpClientXsrfModule,
1408
- HttpClientJsonpModule
1409
- ],
1410
- declarations: [],
1411
- providers: []
1412
- })
1413
- ], AnatolyDataModule);
1283
+ const FroalaEditorModuleWithProviders = FroalaEditorModule.forRoot();
1284
+ const FroalaViewModuleWithProviders = FroalaViewModule.forRoot();
1285
+ class AnatolyUIModule {
1286
+ }
1287
+ AnatolyUIModule.decorators = [
1288
+ { type: NgModule, args: [{
1289
+ imports: [
1290
+ CommonModule,
1291
+ ReactiveFormsModule,
1292
+ FormsModule,
1293
+ FroalaEditorModuleWithProviders,
1294
+ FroalaViewModuleWithProviders,
1295
+ ],
1296
+ declarations: [
1297
+ SubscribePlanButtonComponent,
1298
+ UpgradePlanButtonComponent,
1299
+ BuyAccessButtonComponent,
1300
+ SignInButtonComponent,
1301
+ SignUpButtonComponent,
1302
+ SignOutButtonComponent,
1303
+ FormValidationSummaryComponent,
1304
+ ItemValidationSummaryComponent,
1305
+ HtmlEditorComponent,
1306
+ FormsHtmlEditorComponent,
1307
+ ContentHeaderComponent,
1308
+ ],
1309
+ exports: [
1310
+ SubscribePlanButtonComponent,
1311
+ UpgradePlanButtonComponent,
1312
+ BuyAccessButtonComponent,
1313
+ SignInButtonComponent,
1314
+ SignUpButtonComponent,
1315
+ SignOutButtonComponent,
1316
+ FormValidationSummaryComponent,
1317
+ ItemValidationSummaryComponent,
1318
+ HtmlEditorComponent,
1319
+ FormsHtmlEditorComponent,
1320
+ ContentHeaderComponent,
1321
+ ]
1322
+ },] }
1323
+ ];
1414
1324
 
1415
- // Services
1325
+ // Module
1326
+
1327
+ /*
1328
+ * Public API Surface of anatoly
1329
+ */
1416
1330
 
1417
1331
  /**
1418
1332
  * Generated bundle index. Do not edit.
1419
1333
  */
1420
1334
 
1421
- export { Alerts, AnatolyBillingModule, AnatolyCoreModule, AnatolyDataModule, AnatolyIdentityModule, AppContextService, BaseApiService, BaseComponent, BaseEditComponent, BaseGoService, BaseGridEditService, BaseGridReadService, BillingApiService, BuyAccessButtonComponent, ContentHeaderComponent, FormValidationSummaryComponent, FormsHtmlEditorComponent, HtmlEditorComponent, ItemValidationSummaryComponent, SignInButtonComponent, SignOutButtonComponent, SignUpButtonComponent, SubscribePlanButtonComponent, UpgradePlanButtonComponent, Utils, ValidationSummaryComponent };
1335
+ export { Alerts, AnatolyCoreModule, AnatolyDataModule, AnatolyUIModule, AppContextService, BaseApiService, BaseComponent, BaseEditComponent, BaseGoService, BaseGridEditService, BaseGridReadService, BillingApiService, BuyAccessButtonComponent, ContentHeaderComponent, FormValidationSummaryComponent, FormsHtmlEditorComponent, HtmlEditorComponent, ItemValidationSummaryComponent, SignInButtonComponent, SignOutButtonComponent, SignUpButtonComponent, SubscribePlanButtonComponent, UpgradePlanButtonComponent, Utils, ValidationSummaryComponent };
1422
1336
  //# sourceMappingURL=osovitny-anatoly.js.map