@osovitny/anatoly 1.0.1

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 (98) hide show
  1. package/README.md +0 -0
  2. package/bundles/osovitny-anatoly.umd.js +2065 -0
  3. package/bundles/osovitny-anatoly.umd.js.map +1 -0
  4. package/bundles/osovitny-anatoly.umd.min.js +16 -0
  5. package/bundles/osovitny-anatoly.umd.min.js.map +1 -0
  6. package/esm2015/lib/billing/billing.module.js +62 -0
  7. package/esm2015/lib/billing/components/buyaccess/buyaccess-button.component.js +123 -0
  8. package/esm2015/lib/billing/components/subscriptions/subscribe-plan-button.component.js +97 -0
  9. package/esm2015/lib/billing/components/subscriptions/upgrade-plan-button.component.js +84 -0
  10. package/esm2015/lib/billing/index.js +6 -0
  11. package/esm2015/lib/billing/services/base-billing-api.service.js +116 -0
  12. package/esm2015/lib/core/consts.js +15 -0
  13. package/esm2015/lib/core/core.module.js +47 -0
  14. package/esm2015/lib/core/index.js +12 -0
  15. package/esm2015/lib/core/services/appcontext.service.js +123 -0
  16. package/esm2015/lib/core/services/base-api.service.js +154 -0
  17. package/esm2015/lib/core/services/base-go.service.js +58 -0
  18. package/esm2015/lib/core/services/base-gridedit.service.js +202 -0
  19. package/esm2015/lib/identity/components/signin-button.component.js +38 -0
  20. package/esm2015/lib/identity/components/signout-button.component.js +38 -0
  21. package/esm2015/lib/identity/components/signup-button.component.js +39 -0
  22. package/esm2015/lib/identity/identity.module.js +43 -0
  23. package/esm2015/lib/identity/index.js +6 -0
  24. package/esm2015/lib/ui/components/base-edit.component.js +102 -0
  25. package/esm2015/lib/ui/components/base.component.js +57 -0
  26. package/esm2015/lib/ui/components/content-header/content-header.component.js +44 -0
  27. package/esm2015/lib/ui/components/html-editor/html-editor.component.js +267 -0
  28. package/esm2015/lib/ui/components/validation/form-validation-summary.component.js +51 -0
  29. package/esm2015/lib/ui/components/validation/item-validation-summary.component.js +45 -0
  30. package/esm2015/lib/ui/components/validation/validation-summary.component.js +93 -0
  31. package/esm2015/lib/ui/index.js +11 -0
  32. package/esm2015/lib/ui/ui.module.js +72 -0
  33. package/esm2015/osovitny-anatoly.js +9 -0
  34. package/esm2015/public-api.js +9 -0
  35. package/esm5/lib/billing/billing.module.js +66 -0
  36. package/esm5/lib/billing/components/buyaccess/buyaccess-button.component.js +128 -0
  37. package/esm5/lib/billing/components/subscriptions/subscribe-plan-button.component.js +100 -0
  38. package/esm5/lib/billing/components/subscriptions/upgrade-plan-button.component.js +86 -0
  39. package/esm5/lib/billing/index.js +6 -0
  40. package/esm5/lib/billing/services/base-billing-api.service.js +135 -0
  41. package/esm5/lib/core/consts.js +15 -0
  42. package/esm5/lib/core/core.module.js +51 -0
  43. package/esm5/lib/core/index.js +12 -0
  44. package/esm5/lib/core/services/appcontext.service.js +140 -0
  45. package/esm5/lib/core/services/base-api.service.js +205 -0
  46. package/esm5/lib/core/services/base-go.service.js +59 -0
  47. package/esm5/lib/core/services/base-gridedit.service.js +240 -0
  48. package/esm5/lib/identity/components/signin-button.component.js +41 -0
  49. package/esm5/lib/identity/components/signout-button.component.js +41 -0
  50. package/esm5/lib/identity/components/signup-button.component.js +41 -0
  51. package/esm5/lib/identity/identity.module.js +47 -0
  52. package/esm5/lib/identity/index.js +6 -0
  53. package/esm5/lib/ui/components/base-edit.component.js +137 -0
  54. package/esm5/lib/ui/components/base.component.js +72 -0
  55. package/esm5/lib/ui/components/content-header/content-header.component.js +51 -0
  56. package/esm5/lib/ui/components/html-editor/html-editor.component.js +309 -0
  57. package/esm5/lib/ui/components/validation/form-validation-summary.component.js +59 -0
  58. package/esm5/lib/ui/components/validation/item-validation-summary.component.js +49 -0
  59. package/esm5/lib/ui/components/validation/validation-summary.component.js +106 -0
  60. package/esm5/lib/ui/index.js +11 -0
  61. package/esm5/lib/ui/ui.module.js +76 -0
  62. package/esm5/osovitny-anatoly.js +9 -0
  63. package/esm5/public-api.js +9 -0
  64. package/fesm2015/osovitny-anatoly.js +1622 -0
  65. package/fesm2015/osovitny-anatoly.js.map +1 -0
  66. package/fesm5/osovitny-anatoly.js +1877 -0
  67. package/fesm5/osovitny-anatoly.js.map +1 -0
  68. package/lib/billing/billing.module.d.ts +2 -0
  69. package/lib/billing/components/buyaccess/buyaccess-button.component.d.ts +16 -0
  70. package/lib/billing/components/subscriptions/subscribe-plan-button.component.d.ts +15 -0
  71. package/lib/billing/components/subscriptions/upgrade-plan-button.component.d.ts +9 -0
  72. package/lib/billing/index.d.ts +1 -0
  73. package/lib/billing/services/base-billing-api.service.d.ts +9 -0
  74. package/lib/core/consts.d.ts +5 -0
  75. package/lib/core/core.module.d.ts +2 -0
  76. package/lib/core/index.d.ts +5 -0
  77. package/lib/core/services/appcontext.service.d.ts +14 -0
  78. package/lib/core/services/base-api.service.d.ts +18 -0
  79. package/lib/core/services/base-go.service.d.ts +7 -0
  80. package/lib/core/services/base-gridedit.service.d.ts +19 -0
  81. package/lib/identity/components/signin-button.component.d.ts +4 -0
  82. package/lib/identity/components/signout-button.component.d.ts +4 -0
  83. package/lib/identity/components/signup-button.component.d.ts +4 -0
  84. package/lib/identity/identity.module.d.ts +2 -0
  85. package/lib/identity/index.d.ts +1 -0
  86. package/lib/ui/components/base-edit.component.d.ts +14 -0
  87. package/lib/ui/components/base.component.d.ts +7 -0
  88. package/lib/ui/components/content-header/content-header.component.d.ts +5 -0
  89. package/lib/ui/components/html-editor/html-editor.component.d.ts +22 -0
  90. package/lib/ui/components/validation/form-validation-summary.component.d.ts +6 -0
  91. package/lib/ui/components/validation/item-validation-summary.component.d.ts +6 -0
  92. package/lib/ui/components/validation/validation-summary.component.d.ts +6 -0
  93. package/lib/ui/index.d.ts +4 -0
  94. package/lib/ui/ui.module.d.ts +2 -0
  95. package/osovitny-anatoly.d.ts +4 -0
  96. package/osovitny-anatoly.metadata.json +1 -0
  97. package/package.json +22 -0
  98. package/public-api.d.ts +4 -0
@@ -0,0 +1,1622 @@
1
+ import { Injectable, NgModule, Component, Input } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { HttpClient, HttpClientModule, HttpClientXsrfModule, HttpClientJsonpModule } from '@angular/common/http';
4
+ import { map } from 'rxjs/operators';
5
+ import { BehaviorSubject } from 'rxjs';
6
+ import { ActivatedRoute, Router } from '@angular/router';
7
+ import { ReactiveFormsModule, FormsModule } from '@angular/forms';
8
+ import { FroalaEditorModule, FroalaViewModule } from 'angular-froala-wysiwyg';
9
+ import { GridModule } from '@progress/kendo-angular-grid';
10
+ import { PopupModule } from '@progress/kendo-angular-popup';
11
+ import { ButtonsModule } from '@progress/kendo-angular-buttons';
12
+ import { DropDownsModule } from '@progress/kendo-angular-dropdowns';
13
+
14
+ /**
15
+ * @fileoverview added by tsickle
16
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
17
+ */
18
+ var anatoly$1;
19
+ (function (anatoly) {
20
+ var consts;
21
+ (function (consts) {
22
+ consts.jsonUrl = "/dist/json/";
23
+ consts.appUrl = "/";
24
+ consts.apiUrl = "/api/";
25
+ })(consts = anatoly.consts || (anatoly.consts = {}));
26
+ })(anatoly$1 || (anatoly$1 = {}));
27
+ ((/** @type {?} */ (window))).anatoly = anatoly$1;
28
+
29
+ /**
30
+ * @fileoverview added by tsickle
31
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
32
+ */
33
+ class BaseApiService {
34
+ /**
35
+ * @param {?} http
36
+ */
37
+ constructor(http) {
38
+ this.http = http;
39
+ this.baseUrl = anatoly.consts.apiUrl;
40
+ }
41
+ /**
42
+ * @private
43
+ * @param {?=} data
44
+ * @return {?}
45
+ */
46
+ serializeParams(data) {
47
+ return data ? ('?' + $.param(data)) : '';
48
+ }
49
+ //webApi
50
+ /**
51
+ * @template T
52
+ * @param {?} action
53
+ * @param {?=} data
54
+ * @return {?}
55
+ */
56
+ get(action, data) {
57
+ /** @type {?} */
58
+ var url = this.baseUrl + `${action}${this.serializeParams(data)}`;
59
+ return this.http.get(url).pipe(map((/**
60
+ * @param {?} res
61
+ * @return {?}
62
+ */
63
+ res => (/** @type {?} */ (res)))));
64
+ }
65
+ /**
66
+ * @param {?} action
67
+ * @param {?=} data
68
+ * @return {?}
69
+ */
70
+ post(action, data) {
71
+ /** @type {?} */
72
+ var url = this.baseUrl + `${action}`;
73
+ return this.http.post(url, data, { responseType: 'text' });
74
+ }
75
+ /**
76
+ * @param {?} action
77
+ * @param {?=} data
78
+ * @return {?}
79
+ */
80
+ postQS(action, data) {
81
+ /** @type {?} */
82
+ var url = this.baseUrl + `${action}${this.serializeParams(data)}`;
83
+ return this.http.post(url, null, { responseType: 'text' });
84
+ }
85
+ //gets
86
+ /**
87
+ * @template T
88
+ * @param {?=} data
89
+ * @return {?}
90
+ */
91
+ getAll(data) {
92
+ return this.get('getall', data).pipe(map((/**
93
+ * @param {?} res
94
+ * @return {?}
95
+ */
96
+ res => (/** @type {?} */ (res)))));
97
+ }
98
+ /**
99
+ * @param {?} fileName
100
+ * @param {?} jsonVersion
101
+ * @return {?}
102
+ */
103
+ getJsonFile(fileName, jsonVersion) {
104
+ if (!jsonVersion) {
105
+ jsonVersion = "1.0";
106
+ }
107
+ /** @type {?} */
108
+ var url = anatoly.consts.jsonUrl + fileName + '?' + jsonVersion;
109
+ return this.http.get(url).pipe(map((/**
110
+ * @param {?} res
111
+ * @return {?}
112
+ */
113
+ res => (/** @type {?} */ (res)))));
114
+ }
115
+ /**
116
+ * @return {?}
117
+ */
118
+ getNewGuid() {
119
+ /** @type {?} */
120
+ var url = this.baseUrl + 'getNewGuid';
121
+ return this.http.get(url, { responseType: 'text' });
122
+ }
123
+ //CRUD function
124
+ /**
125
+ * @template T
126
+ * @param {?} id
127
+ * @return {?}
128
+ */
129
+ getById(id) {
130
+ return this.get('getById', { id: id });
131
+ }
132
+ /**
133
+ * @param {?} id
134
+ * @return {?}
135
+ */
136
+ remove(id) {
137
+ return this.postQS('remove', { id: id });
138
+ }
139
+ }
140
+ BaseApiService.decorators = [
141
+ { type: Injectable }
142
+ ];
143
+ /** @nocollapse */
144
+ BaseApiService.ctorParameters = () => [
145
+ { type: HttpClient }
146
+ ];
147
+ if (false) {
148
+ /**
149
+ * @type {?}
150
+ * @protected
151
+ */
152
+ BaseApiService.prototype.baseUrl;
153
+ /**
154
+ * @type {?}
155
+ * @protected
156
+ */
157
+ BaseApiService.prototype.jsonUrl;
158
+ /**
159
+ * @type {?}
160
+ * @protected
161
+ */
162
+ BaseApiService.prototype.http;
163
+ }
164
+
165
+ /**
166
+ * @fileoverview added by tsickle
167
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
168
+ */
169
+ class AppContextService extends BaseApiService {
170
+ /**
171
+ * @param {?} http
172
+ */
173
+ constructor(http) {
174
+ super(http);
175
+ this.http = http;
176
+ this.current = null;
177
+ this.successes = [];
178
+ this.subscription = null;
179
+ this.baseUrl = anatoly.consts.apiUrl + 'appcontext/';
180
+ }
181
+ /**
182
+ * @param {?} success
183
+ * @return {?}
184
+ */
185
+ getCurrent(success) {
186
+ if (typeof success == "undefined") {
187
+ return;
188
+ }
189
+ if (this.current != null) {
190
+ success(this.current);
191
+ return;
192
+ }
193
+ this.successes.push(success);
194
+ if (this.subscription != null) {
195
+ return;
196
+ }
197
+ this.subscription = this.get('GetCurrentContext', null).subscribe((/**
198
+ * @param {?} data
199
+ * @return {?}
200
+ */
201
+ data => {
202
+ this.dataReceived(data);
203
+ }), (/**
204
+ * @param {?} e
205
+ * @return {?}
206
+ */
207
+ e => { }));
208
+ }
209
+ /**
210
+ * @param {?} data
211
+ * @return {?}
212
+ */
213
+ dataReceived(data) {
214
+ this.current = data;
215
+ for (var i = 0; i < this.successes.length; i++) {
216
+ /** @type {?} */
217
+ var success = this.successes[i];
218
+ success(data);
219
+ }
220
+ this.successes = [];
221
+ this.subscription.unsubscribe();
222
+ this.subscription = null;
223
+ this.current = null;
224
+ }
225
+ /**
226
+ * @return {?}
227
+ */
228
+ isUserSignedIn() {
229
+ return ((/** @type {?} */ (window))).__context_isUserSignedIn;
230
+ }
231
+ /**
232
+ * @return {?}
233
+ */
234
+ isUserAdmin() {
235
+ return ((/** @type {?} */ (window))).__context_isUserAdmin;
236
+ }
237
+ }
238
+ AppContextService.decorators = [
239
+ { type: Injectable }
240
+ ];
241
+ /** @nocollapse */
242
+ AppContextService.ctorParameters = () => [
243
+ { type: HttpClient }
244
+ ];
245
+ if (false) {
246
+ /**
247
+ * @type {?}
248
+ * @private
249
+ */
250
+ AppContextService.prototype.current;
251
+ /**
252
+ * @type {?}
253
+ * @private
254
+ */
255
+ AppContextService.prototype.successes;
256
+ /**
257
+ * @type {?}
258
+ * @private
259
+ */
260
+ AppContextService.prototype.subscription;
261
+ /**
262
+ * @type {?}
263
+ * @protected
264
+ */
265
+ AppContextService.prototype.http;
266
+ }
267
+
268
+ /**
269
+ * @fileoverview added by tsickle
270
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
271
+ */
272
+ class AnatolyCoreModule {
273
+ }
274
+ AnatolyCoreModule.decorators = [
275
+ { type: NgModule, args: [{
276
+ imports: [
277
+ CommonModule,
278
+ HttpClientModule,
279
+ HttpClientXsrfModule,
280
+ HttpClientJsonpModule
281
+ ],
282
+ exports: [
283
+ CommonModule,
284
+ HttpClientModule,
285
+ HttpClientXsrfModule,
286
+ HttpClientJsonpModule
287
+ ],
288
+ declarations: [],
289
+ providers: [
290
+ AppContextService
291
+ ]
292
+ },] }
293
+ ];
294
+
295
+ /**
296
+ * @fileoverview added by tsickle
297
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
298
+ */
299
+ class BaseGridEditService extends BehaviorSubject {
300
+ /**
301
+ * @param {?} http
302
+ */
303
+ constructor(http) {
304
+ super([]);
305
+ this.http = http;
306
+ this.data = [];
307
+ this.baseUrl = anatoly.consts.apiUrl;
308
+ this.baseReadUrl = this.baseUrl + "getAll";
309
+ }
310
+ /**
311
+ * @private
312
+ * @param {?=} data
313
+ * @return {?}
314
+ */
315
+ serializeParams(data) {
316
+ return data ? ('?' + $.param(data)) : '';
317
+ }
318
+ /**
319
+ * @private
320
+ * @return {?}
321
+ */
322
+ reset() {
323
+ this.data = [];
324
+ }
325
+ /**
326
+ * @param {?} dataItem
327
+ * @return {?}
328
+ */
329
+ resetItem(dataItem) {
330
+ if (!dataItem) {
331
+ return;
332
+ }
333
+ //find orignal data item
334
+ /** @type {?} */
335
+ const originalDataItem = this.data.find((/**
336
+ * @param {?} item
337
+ * @return {?}
338
+ */
339
+ item => item.Id === dataItem.Id));
340
+ //revert changes
341
+ Object.assign(originalDataItem, dataItem);
342
+ super.next(this.data);
343
+ }
344
+ /**
345
+ * @param {?=} params
346
+ * @return {?}
347
+ */
348
+ read(params) {
349
+ if (this.data.length) {
350
+ return super.next(this.data);
351
+ }
352
+ /** @type {?} */
353
+ var url = this.baseReadUrl;
354
+ if (typeof params === 'undefined') {
355
+ params = this.savedReadParams;
356
+ }
357
+ if (typeof params !== 'undefined') {
358
+ url = this.baseReadUrl + `${this.serializeParams(params)}`;
359
+ this.savedReadParams = params;
360
+ }
361
+ // this.http.get(url)
362
+ // .map(res => <any[]>res)
363
+ // .do(data => { this.data = data; }).subscribe(data => { super.next(data); });
364
+ //}
365
+ this.http.get(url).pipe(map((/**
366
+ * @param {?} res
367
+ * @return {?}
368
+ */
369
+ res => (/** @type {?} */ (res))))).subscribe((/**
370
+ * @param {?} data
371
+ * @return {?}
372
+ */
373
+ data => { super.next(data); }));
374
+ }
375
+ /**
376
+ * @param {?} data
377
+ * @param {?} isNew
378
+ * @param {?=} sucess
379
+ * @return {?}
380
+ */
381
+ save(data, isNew, sucess) {
382
+ /** @type {?} */
383
+ const action = isNew ? 'add' : 'update';
384
+ this.reset();
385
+ this.post(action, data).subscribe((/**
386
+ * @return {?}
387
+ */
388
+ () => {
389
+ }), (/**
390
+ * @return {?}
391
+ */
392
+ () => {
393
+ this.read();
394
+ }), (/**
395
+ * @return {?}
396
+ */
397
+ () => {
398
+ this.read();
399
+ if (sucess)
400
+ sucess();
401
+ }));
402
+ }
403
+ /**
404
+ * @param {?} data
405
+ * @param {?=} sucess
406
+ * @return {?}
407
+ */
408
+ remove(data, sucess) {
409
+ this.reset();
410
+ this.post('remove', data).subscribe((/**
411
+ * @return {?}
412
+ */
413
+ () => {
414
+ }), (/**
415
+ * @return {?}
416
+ */
417
+ () => {
418
+ this.read();
419
+ }), (/**
420
+ * @return {?}
421
+ */
422
+ () => {
423
+ this.read();
424
+ if (sucess)
425
+ sucess();
426
+ }));
427
+ }
428
+ /**
429
+ * @param {?} action
430
+ * @param {?=} data
431
+ * @return {?}
432
+ */
433
+ post(action, data) {
434
+ /** @type {?} */
435
+ var url = this.baseUrl + `${action}${this.serializeParams(data)}`;
436
+ return this.http.post(url, data).pipe(map((/**
437
+ * @param {?} res
438
+ * @return {?}
439
+ */
440
+ res => (/** @type {?} */ (res)))));
441
+ }
442
+ }
443
+ BaseGridEditService.decorators = [
444
+ { type: Injectable }
445
+ ];
446
+ /** @nocollapse */
447
+ BaseGridEditService.ctorParameters = () => [
448
+ { type: HttpClient }
449
+ ];
450
+ if (false) {
451
+ /**
452
+ * @type {?}
453
+ * @protected
454
+ */
455
+ BaseGridEditService.prototype.baseUrl;
456
+ /**
457
+ * @type {?}
458
+ * @protected
459
+ */
460
+ BaseGridEditService.prototype.baseReadUrl;
461
+ /**
462
+ * @type {?}
463
+ * @protected
464
+ */
465
+ BaseGridEditService.prototype.savedReadParams;
466
+ /**
467
+ * @type {?}
468
+ * @private
469
+ */
470
+ BaseGridEditService.prototype.data;
471
+ /**
472
+ * @type {?}
473
+ * @protected
474
+ */
475
+ BaseGridEditService.prototype.http;
476
+ }
477
+
478
+ /**
479
+ * @fileoverview added by tsickle
480
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
481
+ */
482
+ class BaseGoService {
483
+ /**
484
+ * @param {?} route
485
+ * @param {?} router
486
+ */
487
+ constructor(route, router) {
488
+ this.route = route;
489
+ this.router = router;
490
+ }
491
+ /**
492
+ * @return {?}
493
+ */
494
+ locationReload() {
495
+ //this.router.navigate([this.route.url]);
496
+ ((/** @type {?} */ (window))).location.reload();
497
+ }
498
+ }
499
+ BaseGoService.decorators = [
500
+ { type: Injectable }
501
+ ];
502
+ /** @nocollapse */
503
+ BaseGoService.ctorParameters = () => [
504
+ { type: ActivatedRoute },
505
+ { type: Router }
506
+ ];
507
+ if (false) {
508
+ /**
509
+ * @type {?}
510
+ * @protected
511
+ */
512
+ BaseGoService.prototype.route;
513
+ /**
514
+ * @type {?}
515
+ * @protected
516
+ */
517
+ BaseGoService.prototype.router;
518
+ }
519
+
520
+ /**
521
+ * @fileoverview added by tsickle
522
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
523
+ */
524
+
525
+ /**
526
+ * @fileoverview added by tsickle
527
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
528
+ */
529
+ class SignInButtonComponent {
530
+ constructor() { }
531
+ }
532
+ SignInButtonComponent.decorators = [
533
+ { type: Component, args: [{
534
+ selector: 'anatoly-signin-button',
535
+ template: "<a href=\"identity/signIn\" class=\"{{classbtn}}\">Sign In</a>\r\n"
536
+ }] }
537
+ ];
538
+ /** @nocollapse */
539
+ SignInButtonComponent.ctorParameters = () => [];
540
+ SignInButtonComponent.propDecorators = {
541
+ classbtn: [{ type: Input }]
542
+ };
543
+ if (false) {
544
+ /** @type {?} */
545
+ SignInButtonComponent.prototype.classbtn;
546
+ }
547
+
548
+ /**
549
+ * @fileoverview added by tsickle
550
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
551
+ */
552
+ class SignUpButtonComponent {
553
+ constructor() {
554
+ }
555
+ }
556
+ SignUpButtonComponent.decorators = [
557
+ { type: Component, args: [{
558
+ selector: 'anatoly-signup-button',
559
+ template: "<a href=\"identity/signup\" class=\"{{classbtn}}\">Sign Up</a>\r\n"
560
+ }] }
561
+ ];
562
+ /** @nocollapse */
563
+ SignUpButtonComponent.ctorParameters = () => [];
564
+ SignUpButtonComponent.propDecorators = {
565
+ classbtn: [{ type: Input }]
566
+ };
567
+ if (false) {
568
+ /** @type {?} */
569
+ SignUpButtonComponent.prototype.classbtn;
570
+ }
571
+
572
+ /**
573
+ * @fileoverview added by tsickle
574
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
575
+ */
576
+ class SignOutButtonComponent {
577
+ constructor() { }
578
+ }
579
+ SignOutButtonComponent.decorators = [
580
+ { type: Component, args: [{
581
+ selector: 'anatoly-signout-button',
582
+ template: "<a href=\"identity/signOut\" class=\"{{classbtn}}\">Sign Out</a>\r\n"
583
+ }] }
584
+ ];
585
+ /** @nocollapse */
586
+ SignOutButtonComponent.ctorParameters = () => [];
587
+ SignOutButtonComponent.propDecorators = {
588
+ classbtn: [{ type: Input }]
589
+ };
590
+ if (false) {
591
+ /** @type {?} */
592
+ SignOutButtonComponent.prototype.classbtn;
593
+ }
594
+
595
+ /**
596
+ * @fileoverview added by tsickle
597
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
598
+ */
599
+ class AnatolyIdentityModule {
600
+ }
601
+ AnatolyIdentityModule.decorators = [
602
+ { type: NgModule, args: [{
603
+ imports: [],
604
+ exports: [
605
+ SignInButtonComponent,
606
+ SignUpButtonComponent,
607
+ SignOutButtonComponent
608
+ ],
609
+ declarations: [
610
+ SignInButtonComponent,
611
+ SignUpButtonComponent,
612
+ SignOutButtonComponent
613
+ ],
614
+ providers: []
615
+ },] }
616
+ ];
617
+
618
+ /**
619
+ * @fileoverview added by tsickle
620
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
621
+ */
622
+
623
+ /**
624
+ * @fileoverview added by tsickle
625
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
626
+ */
627
+ class SubscribePlanButtonComponent {
628
+ /**
629
+ * @param {?} appcontext
630
+ */
631
+ constructor(appcontext) {
632
+ this.appcontext = appcontext;
633
+ this.contextUpdated = false;
634
+ this.isUserSignedIn = false;
635
+ this.currentPlan = 0;
636
+ this.currentPlanTitle = "";
637
+ this.requestedPlan = 0;
638
+ this.requestedPlanTitle = "";
639
+ }
640
+ /**
641
+ * @return {?}
642
+ */
643
+ ngOnInit() {
644
+ if (!this.appcontext.isUserSignedIn()) {
645
+ this.contextUpdated = true;
646
+ return;
647
+ }
648
+ this.appcontext.getCurrent((/**
649
+ * @param {?} current
650
+ * @return {?}
651
+ */
652
+ (current) => {
653
+ this.isUserSignedIn = current.isUserSignedIn;
654
+ if (this.isUserSignedIn) {
655
+ this.currentPlan = current.account.billingPlan;
656
+ this.currentPlanTitle = current.account.billingPlanAsString;
657
+ this.requestedPlan = current.account.requestedBillingPlan;
658
+ this.requestedPlanTitle = current.account.requestedBillingPlanAsString;
659
+ }
660
+ this.contextUpdated = true;
661
+ }));
662
+ }
663
+ }
664
+ SubscribePlanButtonComponent.decorators = [
665
+ { type: Component, args: [{
666
+ selector: 'anatoly-subscribe-plan-button',
667
+ 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"
668
+ }] }
669
+ ];
670
+ /** @nocollapse */
671
+ SubscribePlanButtonComponent.ctorParameters = () => [
672
+ { type: AppContextService }
673
+ ];
674
+ SubscribePlanButtonComponent.propDecorators = {
675
+ plan: [{ type: Input }],
676
+ plantitle: [{ type: Input }]
677
+ };
678
+ if (false) {
679
+ /** @type {?} */
680
+ SubscribePlanButtonComponent.prototype.contextUpdated;
681
+ /** @type {?} */
682
+ SubscribePlanButtonComponent.prototype.isUserSignedIn;
683
+ /** @type {?} */
684
+ SubscribePlanButtonComponent.prototype.currentPlan;
685
+ /** @type {?} */
686
+ SubscribePlanButtonComponent.prototype.currentPlanTitle;
687
+ /** @type {?} */
688
+ SubscribePlanButtonComponent.prototype.requestedPlan;
689
+ /** @type {?} */
690
+ SubscribePlanButtonComponent.prototype.requestedPlanTitle;
691
+ /** @type {?} */
692
+ SubscribePlanButtonComponent.prototype.plan;
693
+ /** @type {?} */
694
+ SubscribePlanButtonComponent.prototype.plantitle;
695
+ /**
696
+ * @type {?}
697
+ * @private
698
+ */
699
+ SubscribePlanButtonComponent.prototype.appcontext;
700
+ }
701
+
702
+ /**
703
+ * @fileoverview added by tsickle
704
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
705
+ */
706
+ class BaseBillingApiService extends BaseApiService {
707
+ /**
708
+ * @param {?} http
709
+ */
710
+ constructor(http) {
711
+ super(http);
712
+ this.http = http;
713
+ this.baseUrl += 'billing/';
714
+ }
715
+ /**
716
+ * @param {?} requestedPlan
717
+ * @param {?=} success
718
+ * @param {?=} error
719
+ * @return {?}
720
+ */
721
+ requestNewSubscription(requestedPlan, success, error) {
722
+ this.postQS('requestNewSubscription', { requestedPlan: requestedPlan })
723
+ .subscribe((/**
724
+ * @param {?} data
725
+ * @return {?}
726
+ */
727
+ data => { }), (/**
728
+ * @param {?} e
729
+ * @return {?}
730
+ */
731
+ e => { if (error)
732
+ error(); }), (/**
733
+ * @return {?}
734
+ */
735
+ () => { if (success)
736
+ success(); }));
737
+ }
738
+ /**
739
+ * @param {?=} success
740
+ * @param {?=} error
741
+ * @return {?}
742
+ */
743
+ cancelRequestedSubscription(success, error) {
744
+ this.postQS('cancelRequestedSubscription', null)
745
+ .subscribe((/**
746
+ * @param {?} data
747
+ * @return {?}
748
+ */
749
+ data => { }), (/**
750
+ * @param {?} e
751
+ * @return {?}
752
+ */
753
+ e => { if (error)
754
+ error(); }), (/**
755
+ * @return {?}
756
+ */
757
+ () => { if (success)
758
+ success(); }));
759
+ }
760
+ /**
761
+ * @param {?} requestedPlan
762
+ * @param {?=} success
763
+ * @param {?=} error
764
+ * @return {?}
765
+ */
766
+ buyAccess(requestedPlan, success, error) {
767
+ this.postQS('buyAccess', { requestedPlan: requestedPlan })
768
+ .subscribe((/**
769
+ * @param {?} data
770
+ * @return {?}
771
+ */
772
+ data => { }), (/**
773
+ * @param {?} e
774
+ * @return {?}
775
+ */
776
+ e => { if (error)
777
+ error(); }), (/**
778
+ * @return {?}
779
+ */
780
+ () => { if (success)
781
+ success(); }));
782
+ }
783
+ }
784
+ BaseBillingApiService.decorators = [
785
+ { type: Injectable }
786
+ ];
787
+ /** @nocollapse */
788
+ BaseBillingApiService.ctorParameters = () => [
789
+ { type: HttpClient }
790
+ ];
791
+ if (false) {
792
+ /**
793
+ * @type {?}
794
+ * @protected
795
+ */
796
+ BaseBillingApiService.prototype.http;
797
+ }
798
+
799
+ /**
800
+ * @fileoverview added by tsickle
801
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
802
+ */
803
+ class UpgradePlanButtonComponent {
804
+ /**
805
+ * @param {?} api
806
+ */
807
+ constructor(api) {
808
+ this.api = api;
809
+ }
810
+ /**
811
+ * @return {?}
812
+ */
813
+ onUpgradePlan() {
814
+ /** @type {?} */
815
+ const text = `Current plan: ${this.currentplantitle} New plan: ${this.requestedplantitle}`;
816
+ /** @type {?} */
817
+ var that = this;
818
+ osovitny.ui.areYouSure(text, 'Change billing plan', 'Confirm change', 'Cancel', (/**
819
+ * @return {?}
820
+ */
821
+ () => {
822
+ that.api.requestNewSubscription(that.requestedplan, (/**
823
+ * @return {?}
824
+ */
825
+ () => {
826
+ osovitny.ui.alertSuccess('Your request for changing plan has been sent.', null, (/**
827
+ * @return {?}
828
+ */
829
+ () => {
830
+ ((/** @type {?} */ (window))).location.reload();
831
+ }));
832
+ }));
833
+ }));
834
+ }
835
+ }
836
+ UpgradePlanButtonComponent.decorators = [
837
+ { type: Component, args: [{
838
+ selector: 'anatoly-upgrade-plan-button',
839
+ template: "<button class=\"btn btn-block btn-primary\" (click)=\"onUpgradePlan()\">\r\n Upgrade\r\n</button>\r\n"
840
+ }] }
841
+ ];
842
+ /** @nocollapse */
843
+ UpgradePlanButtonComponent.ctorParameters = () => [
844
+ { type: BaseBillingApiService }
845
+ ];
846
+ UpgradePlanButtonComponent.propDecorators = {
847
+ currentplantitle: [{ type: Input }],
848
+ requestedplan: [{ type: Input }],
849
+ requestedplantitle: [{ type: Input }]
850
+ };
851
+ if (false) {
852
+ /** @type {?} */
853
+ UpgradePlanButtonComponent.prototype.currentplantitle;
854
+ /** @type {?} */
855
+ UpgradePlanButtonComponent.prototype.requestedplan;
856
+ /** @type {?} */
857
+ UpgradePlanButtonComponent.prototype.requestedplantitle;
858
+ /**
859
+ * @type {?}
860
+ * @private
861
+ */
862
+ UpgradePlanButtonComponent.prototype.api;
863
+ }
864
+
865
+ /**
866
+ * @fileoverview added by tsickle
867
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
868
+ */
869
+ class BuyAccessButtonComponent {
870
+ /**
871
+ * @param {?} appcontext
872
+ * @param {?} api
873
+ */
874
+ constructor(appcontext, api) {
875
+ this.appcontext = appcontext;
876
+ this.api = api;
877
+ this.contextUpdated = false;
878
+ this.isUserSignedIn = false;
879
+ this.currentPlan = 0;
880
+ this.currentPlanTitle = "";
881
+ }
882
+ /**
883
+ * @return {?}
884
+ */
885
+ ngOnInit() {
886
+ if (!this.appcontext.isUserSignedIn()) {
887
+ this.contextUpdated = true;
888
+ return;
889
+ }
890
+ this.appcontext.getCurrent((/**
891
+ * @param {?} current
892
+ * @return {?}
893
+ */
894
+ (current) => {
895
+ this.isUserSignedIn = current.isUserSignedIn;
896
+ if (this.isUserSignedIn) {
897
+ this.currentPlan = current.account.billingPlan;
898
+ this.currentPlanTitle = current.account.billingPlanAsString;
899
+ }
900
+ this.contextUpdated = true;
901
+ }));
902
+ }
903
+ /**
904
+ * @return {?}
905
+ */
906
+ onBuyPlan() {
907
+ /** @type {?} */
908
+ const text = `Requested plan: ${this.plantitle} `;
909
+ /** @type {?} */
910
+ var that = this;
911
+ osovitny.ui.areYouSure(text, 'Buying access', 'Confirm change', 'Cancel', (/**
912
+ * @return {?}
913
+ */
914
+ () => {
915
+ that.api.buyAccess(that.plan, (/**
916
+ * @return {?}
917
+ */
918
+ () => {
919
+ osovitny.ui.alertSuccess('Access Granted', null, (/**
920
+ * @return {?}
921
+ */
922
+ () => {
923
+ ((/** @type {?} */ (window))).location.reload();
924
+ }));
925
+ }));
926
+ }));
927
+ }
928
+ }
929
+ BuyAccessButtonComponent.decorators = [
930
+ { type: Component, args: [{
931
+ selector: 'anatoly-buyaccess-button',
932
+ 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"
933
+ }] }
934
+ ];
935
+ /** @nocollapse */
936
+ BuyAccessButtonComponent.ctorParameters = () => [
937
+ { type: AppContextService },
938
+ { type: BaseBillingApiService }
939
+ ];
940
+ BuyAccessButtonComponent.propDecorators = {
941
+ plan: [{ type: Input }],
942
+ plantitle: [{ type: Input }]
943
+ };
944
+ if (false) {
945
+ /** @type {?} */
946
+ BuyAccessButtonComponent.prototype.contextUpdated;
947
+ /** @type {?} */
948
+ BuyAccessButtonComponent.prototype.isUserSignedIn;
949
+ /** @type {?} */
950
+ BuyAccessButtonComponent.prototype.currentPlan;
951
+ /** @type {?} */
952
+ BuyAccessButtonComponent.prototype.currentPlanTitle;
953
+ /** @type {?} */
954
+ BuyAccessButtonComponent.prototype.plan;
955
+ /** @type {?} */
956
+ BuyAccessButtonComponent.prototype.plantitle;
957
+ /**
958
+ * @type {?}
959
+ * @private
960
+ */
961
+ BuyAccessButtonComponent.prototype.appcontext;
962
+ /**
963
+ * @type {?}
964
+ * @private
965
+ */
966
+ BuyAccessButtonComponent.prototype.api;
967
+ }
968
+
969
+ /**
970
+ * @fileoverview added by tsickle
971
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
972
+ */
973
+ class AnatolyBillingModule {
974
+ }
975
+ AnatolyBillingModule.decorators = [
976
+ { type: NgModule, args: [{
977
+ imports: [
978
+ CommonModule,
979
+ HttpClientModule,
980
+ HttpClientXsrfModule,
981
+ HttpClientJsonpModule,
982
+ AnatolyIdentityModule
983
+ ],
984
+ exports: [
985
+ CommonModule,
986
+ HttpClientModule,
987
+ HttpClientXsrfModule,
988
+ HttpClientJsonpModule,
989
+ SubscribePlanButtonComponent,
990
+ UpgradePlanButtonComponent,
991
+ BuyAccessButtonComponent
992
+ ],
993
+ declarations: [
994
+ SubscribePlanButtonComponent,
995
+ UpgradePlanButtonComponent,
996
+ BuyAccessButtonComponent
997
+ ],
998
+ providers: [
999
+ BaseBillingApiService
1000
+ ]
1001
+ },] }
1002
+ ];
1003
+
1004
+ /**
1005
+ * @fileoverview added by tsickle
1006
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1007
+ */
1008
+
1009
+ /**
1010
+ * @fileoverview added by tsickle
1011
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1012
+ */
1013
+ /*
1014
+ <file>
1015
+ Authors:
1016
+ Vadim Osovitny
1017
+
1018
+ Created:
1019
+ 28 Aug 2018
1020
+
1021
+ Version:
1022
+ 1.0
1023
+
1024
+ Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
1025
+ </file>
1026
+ */
1027
+ class BaseComponent {
1028
+ constructor() {
1029
+ }
1030
+ /**
1031
+ * @return {?}
1032
+ */
1033
+ getQSId() {
1034
+ /** @type {?} */
1035
+ var id = osovitny.utils.getValueByNameInQS("id");
1036
+ if (typeof id === 'undefined' || id == '')
1037
+ return null;
1038
+ return id;
1039
+ }
1040
+ /**
1041
+ * @return {?}
1042
+ */
1043
+ showLoading() {
1044
+ /** @type {?} */
1045
+ var panelLoading = $('#pnlLoading');
1046
+ panelLoading.show();
1047
+ }
1048
+ /**
1049
+ * @return {?}
1050
+ */
1051
+ hideLoading() {
1052
+ /** @type {?} */
1053
+ var panelLoading = $('#pnlLoading');
1054
+ panelLoading.hide();
1055
+ }
1056
+ /**
1057
+ * @param {?} e
1058
+ * @return {?}
1059
+ */
1060
+ handleError(e) {
1061
+ this.hideLoading();
1062
+ osovitny.ui.errorOccurred();
1063
+ }
1064
+ }
1065
+
1066
+ /**
1067
+ * @fileoverview added by tsickle
1068
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1069
+ */
1070
+ class BaseEditComponent extends BaseComponent {
1071
+ constructor() {
1072
+ super();
1073
+ this.formSubmitted = false;
1074
+ }
1075
+ /**
1076
+ * @return {?}
1077
+ */
1078
+ isActionAdding() {
1079
+ /** @type {?} */
1080
+ var id = osovitny.utils.getValueByNameInQS("id");
1081
+ if (typeof id === 'undefined' || id == '')
1082
+ return true;
1083
+ return false;
1084
+ }
1085
+ /**
1086
+ * @return {?}
1087
+ */
1088
+ getEntityId() {
1089
+ return this.getQSId();
1090
+ }
1091
+ /**
1092
+ * @param {?} name
1093
+ * @return {?}
1094
+ */
1095
+ isItemInvalid(name) {
1096
+ if (typeof name === 'undefined' || name == '') {
1097
+ return false;
1098
+ }
1099
+ if (this.formGroup.get(name)) {
1100
+ return (this.formSubmitted && this.formGroup.get(name).invalid) ||
1101
+ (this.formGroup.get(name).touched && this.formGroup.get(name).invalid);
1102
+ }
1103
+ return false;
1104
+ }
1105
+ /**
1106
+ * @param {?} name
1107
+ * @return {?}
1108
+ */
1109
+ getFormValue(name) {
1110
+ return this.formGroup.controls[name].value;
1111
+ }
1112
+ /**
1113
+ * @param {?} name
1114
+ * @param {?} value
1115
+ * @return {?}
1116
+ */
1117
+ setFormValue(name, value) {
1118
+ this.formGroup.controls[name].setValue(value);
1119
+ }
1120
+ /**
1121
+ * @param {?} groupName
1122
+ * @param {?} name
1123
+ * @return {?}
1124
+ */
1125
+ getFormGroupValue(groupName, name) {
1126
+ return this.formGroup.controls[groupName].get(name).value;
1127
+ }
1128
+ /**
1129
+ * @param {?} groupName
1130
+ * @param {?} name
1131
+ * @param {?} value
1132
+ * @return {?}
1133
+ */
1134
+ setFormGroupValue(groupName, name, value) {
1135
+ this.formGroup.controls[groupName].get(name).setValue(value);
1136
+ }
1137
+ }
1138
+ BaseEditComponent.propDecorators = {
1139
+ formGroup: [{ type: Input }],
1140
+ formSubmitted: [{ type: Input }]
1141
+ };
1142
+ if (false) {
1143
+ /** @type {?} */
1144
+ BaseEditComponent.prototype.formGroup;
1145
+ /** @type {?} */
1146
+ BaseEditComponent.prototype.formSubmitted;
1147
+ }
1148
+
1149
+ /**
1150
+ * @fileoverview added by tsickle
1151
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1152
+ */
1153
+ class ValidationSummaryComponent extends BaseEditComponent {
1154
+ constructor() {
1155
+ super();
1156
+ }
1157
+ /**
1158
+ * @return {?}
1159
+ */
1160
+ getFormValidationMessages() {
1161
+ /** @type {?} */
1162
+ let messages = [];
1163
+ Object.keys(this.formGroup.controls).forEach((/**
1164
+ * @param {?} k
1165
+ * @return {?}
1166
+ */
1167
+ k => {
1168
+ /** @type {?} */
1169
+ var control = this.formGroup.controls[k];
1170
+ if (((/** @type {?} */ (control))).controls != null) {
1171
+ Object.keys(((/** @type {?} */ (control))).controls).forEach((/**
1172
+ * @param {?} k
1173
+ * @return {?}
1174
+ */
1175
+ k => {
1176
+ /** @type {?} */
1177
+ var child = ((/** @type {?} */ (control))).controls[k];
1178
+ this.getValidationMessages(child, k).forEach((/**
1179
+ * @param {?} m
1180
+ * @return {?}
1181
+ */
1182
+ m => messages.push(m)));
1183
+ }));
1184
+ }
1185
+ else {
1186
+ this.getValidationMessages(control, k).forEach((/**
1187
+ * @param {?} m
1188
+ * @return {?}
1189
+ */
1190
+ m => messages.push(m)));
1191
+ }
1192
+ }));
1193
+ return messages;
1194
+ }
1195
+ /**
1196
+ * @param {?} state
1197
+ * @param {?=} thingName
1198
+ * @return {?}
1199
+ */
1200
+ getValidationMessages(state, thingName) {
1201
+ /** @type {?} */
1202
+ let thing = state.path || thingName;
1203
+ /** @type {?} */
1204
+ let messages = [];
1205
+ if (state.errors) {
1206
+ for (let errorName in state.errors) {
1207
+ if (state.errors.hasOwnProperty(errorName)) {
1208
+ switch (errorName) {
1209
+ case 'required':
1210
+ messages.push(`${thing} is required`);
1211
+ break;
1212
+ case 'minlength':
1213
+ messages.push(`${thing} must be at least ${state.errors['minlength'].requiredLength} characters`);
1214
+ break;
1215
+ case 'pattern':
1216
+ messages.push(`${thing} contains illegal characters`);
1217
+ break;
1218
+ }
1219
+ }
1220
+ }
1221
+ }
1222
+ return messages;
1223
+ }
1224
+ }
1225
+
1226
+ /**
1227
+ * @fileoverview added by tsickle
1228
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1229
+ */
1230
+ class FormValidationSummaryComponent extends ValidationSummaryComponent {
1231
+ constructor() {
1232
+ super();
1233
+ this.visible = false;
1234
+ }
1235
+ /**
1236
+ * @return {?}
1237
+ */
1238
+ getErrors() {
1239
+ /** @type {?} */
1240
+ var messages = this.getFormValidationMessages();
1241
+ return messages;
1242
+ }
1243
+ }
1244
+ FormValidationSummaryComponent.decorators = [
1245
+ { type: Component, args: [{
1246
+ selector: 'anatoly-form-validation-summary',
1247
+ 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"
1248
+ }] }
1249
+ ];
1250
+ /** @nocollapse */
1251
+ FormValidationSummaryComponent.ctorParameters = () => [];
1252
+ FormValidationSummaryComponent.propDecorators = {
1253
+ visible: [{ type: Input }]
1254
+ };
1255
+ if (false) {
1256
+ /** @type {?} */
1257
+ FormValidationSummaryComponent.prototype.visible;
1258
+ }
1259
+
1260
+ /**
1261
+ * @fileoverview added by tsickle
1262
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1263
+ */
1264
+ class ItemValidationSummaryComponent extends ValidationSummaryComponent {
1265
+ constructor() {
1266
+ super();
1267
+ }
1268
+ }
1269
+ ItemValidationSummaryComponent.decorators = [
1270
+ { type: Component, args: [{
1271
+ selector: 'anatoly-item-validation-summary',
1272
+ 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>"
1273
+ }] }
1274
+ ];
1275
+ /** @nocollapse */
1276
+ ItemValidationSummaryComponent.ctorParameters = () => [];
1277
+ ItemValidationSummaryComponent.propDecorators = {
1278
+ key: [{ type: Input }],
1279
+ title: [{ type: Input }]
1280
+ };
1281
+ if (false) {
1282
+ /** @type {?} */
1283
+ ItemValidationSummaryComponent.prototype.key;
1284
+ /** @type {?} */
1285
+ ItemValidationSummaryComponent.prototype.title;
1286
+ }
1287
+
1288
+ /**
1289
+ * @fileoverview added by tsickle
1290
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1291
+ */
1292
+ class HtmlEditorComponent extends BaseEditComponent {
1293
+ constructor() {
1294
+ super(...arguments);
1295
+ this._defaultEditorOptions = {
1296
+ placeholderText: 'Edit Your Content Here',
1297
+ charCounterCount: true,
1298
+ heightMin: 100,
1299
+ toolbarInline: false,
1300
+ toolbarButtons: [
1301
+ 'fullscreen', 'bold', 'italic', 'underline', 'strikeThrough', 'subscript', 'superscript', '|',
1302
+ 'fontFamily', 'fontSize', 'color', 'inlineStyle', 'paragraphStyle', '|',
1303
+ 'paragraphFormat', 'align', 'formatOL', 'formatUL', 'outdent', 'indent', 'quote', '-',
1304
+ 'insertLink', 'insertImage', 'insertTable', '|',
1305
+ 'emoticons', 'specialCharacters', 'insertHR', 'selectAll', 'clearFormatting', '|',
1306
+ 'print', 'help', 'html', '|', 'undo', 'redo'
1307
+ ],
1308
+ /*
1309
+ Upload:
1310
+ https://www.froala.com/wysiwyg-editor/docs/concepts/image/upload
1311
+ */
1312
+ imageUploadURL: '/api/HtmlEditor/UploadImage',
1313
+ imageAllowedTypes: ['jpeg', 'jpg', 'png'],
1314
+ imageUploadParams: { uploadType: '', uploadParentId: '' },
1315
+ //Events
1316
+ events: {
1317
+ 'image.beforeUpload': (/**
1318
+ * @param {?} images
1319
+ * @return {?}
1320
+ */
1321
+ function (images) {
1322
+ /** @type {?} */
1323
+ let editor = this;
1324
+ alert("v3 image.beforeUpload editor.opts.imageUploadParams.uploadType" + editor.opts.imageUploadParams.uploadType);
1325
+ })
1326
+ }
1327
+ };
1328
+ this._editorInitialized = false;
1329
+ //General params
1330
+ this.editorId = '';
1331
+ this.editorLabelText = 'Html';
1332
+ this.editorOptions = {};
1333
+ //Form based params
1334
+ this.isFormBased = '1';
1335
+ this.editorFormKey = 'html';
1336
+ }
1337
+ /**
1338
+ * @return {?}
1339
+ */
1340
+ ngOnInit() {
1341
+ /** @type {?} */
1342
+ var opt = this.editorOptions;
1343
+ if (typeof this.editorOptions == "string") {
1344
+ opt = JSON.parse(this.editorOptions);
1345
+ }
1346
+ /** @type {?} */
1347
+ var newOptions = $.extend({}, this._defaultEditorOptions, opt);
1348
+ /** @type {?} */
1349
+ var key = ((/** @type {?} */ (window))).__froalaEditor_Key;
1350
+ if (key) {
1351
+ newOptions = $.extend({}, JSON.parse('{ "key": "' + key + '" }'), newOptions);
1352
+ }
1353
+ this.options = newOptions;
1354
+ }
1355
+ /**
1356
+ * @return {?}
1357
+ */
1358
+ ngAfterViewInit() {
1359
+ this.initializeEditor();
1360
+ }
1361
+ /**
1362
+ * @param {?} control
1363
+ * @return {?}
1364
+ */
1365
+ initializeControl(control) {
1366
+ this._control = control;
1367
+ }
1368
+ /**
1369
+ * @private
1370
+ * @return {?}
1371
+ */
1372
+ initializeEditor() {
1373
+ if (this._editorInitialized) {
1374
+ return;
1375
+ }
1376
+ if (this._control) {
1377
+ this._control.initialize();
1378
+ //v2 BEGIN
1379
+ /** @type {?} */
1380
+ var jQueryEditor = this.getJQueryEditor();
1381
+ /** @type {?} */
1382
+ var that = this;
1383
+ jQueryEditor.on('froalaEditor.image.beforeUpload', (/**
1384
+ * @param {?} e
1385
+ * @param {?} editor
1386
+ * @param {?} images
1387
+ * @return {?}
1388
+ */
1389
+ function (e, editor, images) {
1390
+ /** @type {?} */
1391
+ var options = that.options;
1392
+ editor.opts.imageUploadParams.uploadType = options.imageUploadParams.uploadType;
1393
+ editor.opts.imageUploadParams.uploadParentId = options.imageUploadParams.uploadParentId;
1394
+ }));
1395
+ //v2 END
1396
+ this._editorInitialized = true;
1397
+ }
1398
+ }
1399
+ /**
1400
+ * @private
1401
+ * @return {?}
1402
+ */
1403
+ getJQueryEditor() {
1404
+ /** @type {?} */
1405
+ var jQueryEditor = $('.htmleditor-' + this.editorId);
1406
+ return jQueryEditor;
1407
+ }
1408
+ /**
1409
+ * @private
1410
+ * @return {?}
1411
+ */
1412
+ getEditor() {
1413
+ if (this._control)
1414
+ return this._control.getEditor();
1415
+ return null;
1416
+ }
1417
+ //Public Funcs
1418
+ /**
1419
+ * @param {?} uploadType
1420
+ * @param {?} uploadParentId
1421
+ * @return {?}
1422
+ */
1423
+ setUploadParams(uploadType, uploadParentId) {
1424
+ /** @type {?} */
1425
+ var that = this;
1426
+ /** @type {?} */
1427
+ var timeOut = 1000;
1428
+ if (this._editorInitialized) {
1429
+ timeOut = 0;
1430
+ }
1431
+ setTimeout((/**
1432
+ * @return {?}
1433
+ */
1434
+ function () {
1435
+ /** @type {?} */
1436
+ var newOptions = { imageUploadParams: { uploadType: '', uploadParentId: '' } };
1437
+ newOptions.imageUploadParams.uploadType = uploadType;
1438
+ newOptions.imageUploadParams.uploadParentId = uploadParentId;
1439
+ that.options = $.extend({}, that.options, newOptions);
1440
+ }), timeOut);
1441
+ }
1442
+ /**
1443
+ * @param {?} content
1444
+ * @return {?}
1445
+ */
1446
+ setHtml(content) {
1447
+ if (this.isFormBased == "1") {
1448
+ return;
1449
+ }
1450
+ this.initializeEditor();
1451
+ //v2
1452
+ /** @type {?} */
1453
+ var editor = this.getJQueryEditor();
1454
+ if (typeof (editor) == "undefined" || editor == null) {
1455
+ return;
1456
+ }
1457
+ editor.froalaEditor('html.set', content);
1458
+ /*
1459
+ //v3
1460
+ var editor = this.getEditor();
1461
+ if (typeof (editor) == "undefined" || editor == null) {
1462
+ return;
1463
+ }
1464
+
1465
+ editor.html.set(content);
1466
+ */
1467
+ }
1468
+ /**
1469
+ * @return {?}
1470
+ */
1471
+ getHtml() {
1472
+ if (this.isFormBased == "1") {
1473
+ return;
1474
+ }
1475
+ //v2
1476
+ /** @type {?} */
1477
+ var editor = this.getJQueryEditor();
1478
+ if (typeof (editor) == "undefined" || editor == null) {
1479
+ return "";
1480
+ }
1481
+ return editor.froalaEditor('html.get');
1482
+ /*
1483
+ //v3
1484
+ var editor = this.getEditor();
1485
+ if (typeof (editor) == "undefined" || editor == null) {
1486
+ return "";
1487
+ }
1488
+
1489
+ return editor.html.get(false);
1490
+ */
1491
+ }
1492
+ }
1493
+ HtmlEditorComponent.decorators = [
1494
+ { type: Component, args: [{
1495
+ selector: 'anatoly-html-editor',
1496
+ template: "<div [ngSwitch]=\"isFormBased\">\r\n <ng-template ngSwitchCase=\"0\">\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 </ng-template>\r\n\r\n <ng-template ngSwitchCase=\"1\">\r\n <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 </ng-template>\r\n</div>\r\n"
1497
+ }] }
1498
+ ];
1499
+ HtmlEditorComponent.propDecorators = {
1500
+ editorId: [{ type: Input }],
1501
+ editorLabelText: [{ type: Input }],
1502
+ editorOptions: [{ type: Input }],
1503
+ isFormBased: [{ type: Input }],
1504
+ editorFormKey: [{ type: Input }]
1505
+ };
1506
+ if (false) {
1507
+ /**
1508
+ * @type {?}
1509
+ * @private
1510
+ */
1511
+ HtmlEditorComponent.prototype._defaultEditorOptions;
1512
+ /**
1513
+ * @type {?}
1514
+ * @private
1515
+ */
1516
+ HtmlEditorComponent.prototype._control;
1517
+ /**
1518
+ * @type {?}
1519
+ * @private
1520
+ */
1521
+ HtmlEditorComponent.prototype._editorInitialized;
1522
+ /** @type {?} */
1523
+ HtmlEditorComponent.prototype.options;
1524
+ /** @type {?} */
1525
+ HtmlEditorComponent.prototype.editorId;
1526
+ /** @type {?} */
1527
+ HtmlEditorComponent.prototype.editorLabelText;
1528
+ /** @type {?} */
1529
+ HtmlEditorComponent.prototype.editorOptions;
1530
+ /** @type {?} */
1531
+ HtmlEditorComponent.prototype.isFormBased;
1532
+ /** @type {?} */
1533
+ HtmlEditorComponent.prototype.editorFormKey;
1534
+ }
1535
+
1536
+ /**
1537
+ * @fileoverview added by tsickle
1538
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1539
+ */
1540
+ class ContentHeaderComponent {
1541
+ /**
1542
+ * @return {?}
1543
+ */
1544
+ ngOnInit() {
1545
+ if (this.title == null) {
1546
+ this.title = '';
1547
+ }
1548
+ }
1549
+ }
1550
+ ContentHeaderComponent.decorators = [
1551
+ { type: Component, args: [{
1552
+ selector: 'anatoly-content-header',
1553
+ template: "<h2 class=\"page-header\">\r\n {{title}}\r\n <!--<small>Optional {{title}}</small>-->\r\n</h2>\r\n"
1554
+ }] }
1555
+ ];
1556
+ ContentHeaderComponent.propDecorators = {
1557
+ title: [{ type: Input }]
1558
+ };
1559
+ if (false) {
1560
+ /** @type {?} */
1561
+ ContentHeaderComponent.prototype.title;
1562
+ }
1563
+
1564
+ /**
1565
+ * @fileoverview added by tsickle
1566
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1567
+ */
1568
+ class AnatolyUIModule {
1569
+ }
1570
+ AnatolyUIModule.decorators = [
1571
+ { type: NgModule, args: [{
1572
+ imports: [
1573
+ CommonModule,
1574
+ ReactiveFormsModule,
1575
+ FormsModule,
1576
+ HttpClientModule,
1577
+ HttpClientXsrfModule,
1578
+ HttpClientJsonpModule,
1579
+ FroalaEditorModule.forRoot(),
1580
+ FroalaViewModule.forRoot(),
1581
+ GridModule,
1582
+ PopupModule,
1583
+ ButtonsModule,
1584
+ DropDownsModule
1585
+ ],
1586
+ exports: [
1587
+ CommonModule,
1588
+ HttpClientModule,
1589
+ HttpClientXsrfModule,
1590
+ HttpClientJsonpModule,
1591
+ ItemValidationSummaryComponent,
1592
+ FormValidationSummaryComponent,
1593
+ HtmlEditorComponent,
1594
+ ContentHeaderComponent
1595
+ ],
1596
+ declarations: [
1597
+ ItemValidationSummaryComponent,
1598
+ FormValidationSummaryComponent,
1599
+ HtmlEditorComponent,
1600
+ ContentHeaderComponent
1601
+ ],
1602
+ providers: []
1603
+ },] }
1604
+ ];
1605
+
1606
+ /**
1607
+ * @fileoverview added by tsickle
1608
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1609
+ */
1610
+
1611
+ /**
1612
+ * @fileoverview added by tsickle
1613
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1614
+ */
1615
+
1616
+ /**
1617
+ * @fileoverview added by tsickle
1618
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1619
+ */
1620
+
1621
+ export { AnatolyBillingModule, AnatolyCoreModule, AnatolyIdentityModule, AnatolyUIModule, AppContextService, BaseApiService, BaseComponent, BaseEditComponent, BaseGoService, BaseGridEditService, HtmlEditorComponent };
1622
+ //# sourceMappingURL=osovitny-anatoly.js.map