@osovitny/anatoly 2.0.5 → 2.0.7

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