@osovitny/anatoly 1.2.2 → 1.2.5

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