@osovitny/anatoly 1.2.4 → 1.2.6

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