@osovitny/anatoly 1.2.1 → 1.2.2
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.
- package/bundles/osovitny-anatoly.umd.js +1476 -0
- package/bundles/osovitny-anatoly.umd.js.map +1 -0
- package/bundles/osovitny-anatoly.umd.min.js +16 -0
- package/bundles/osovitny-anatoly.umd.min.js.map +1 -0
- package/esm2015/lib/billing/billing.module.js +60 -0
- package/esm2015/lib/billing/components/buyaccess/buyaccess-button.component.js +73 -0
- package/esm2015/lib/billing/components/subscriptions/subscribe-plan-button.component.js +63 -0
- package/esm2015/lib/billing/components/subscriptions/upgrade-plan-button.component.js +55 -0
- package/esm2015/lib/billing/index.js +9 -0
- package/esm2015/lib/billing/services/base-billing-api.service.js +53 -0
- package/esm2015/lib/core/consts.js +11 -0
- package/esm2015/lib/core/core.module.js +45 -0
- package/esm2015/lib/core/index.js +9 -0
- package/esm2015/lib/core/services/appcontext.service.js +72 -0
- package/esm2015/lib/core/services/base-api.service.js +71 -0
- package/esm2015/lib/core/services/base-go.service.js +36 -0
- package/esm2015/lib/core/services/base-gridedit.service.js +98 -0
- package/esm2015/lib/identity/components/signin-button.component.js +30 -0
- package/esm2015/lib/identity/components/signout-button.component.js +30 -0
- package/esm2015/lib/identity/components/signup-button.component.js +31 -0
- package/esm2015/lib/identity/identity.module.js +41 -0
- package/esm2015/lib/identity/index.js +7 -0
- package/esm2015/lib/ui/components/base-edit.component.js +66 -0
- package/esm2015/lib/ui/components/base.component.js +37 -0
- package/esm2015/lib/ui/components/content-header/content-header.component.js +35 -0
- package/esm2015/lib/ui/components/html-editor/base-html-editor.component.js +86 -0
- package/esm2015/lib/ui/components/html-editor/forms-html-editor.component.js +37 -0
- package/esm2015/lib/ui/components/html-editor/html-editor.component.js +49 -0
- package/esm2015/lib/ui/components/html-editor/html-editor.defaultoptions.js +38 -0
- package/esm2015/lib/ui/components/validation/form-validation-summary.component.js +39 -0
- package/esm2015/lib/ui/components/validation/item-validation-summary.component.js +37 -0
- package/esm2015/lib/ui/components/validation/validation-summary.component.js +60 -0
- package/esm2015/lib/ui/index.js +13 -0
- package/esm2015/lib/ui/ui.module.js +77 -0
- package/esm2015/osovitny-anatoly.js +5 -0
- package/esm2015/public-api.js +5 -0
- package/esm5/lib/billing/billing.module.js +63 -0
- package/esm5/lib/billing/components/buyaccess/buyaccess-button.component.js +75 -0
- package/esm5/lib/billing/components/subscriptions/subscribe-plan-button.component.js +65 -0
- package/esm5/lib/billing/components/subscriptions/upgrade-plan-button.component.js +56 -0
- package/esm5/lib/billing/index.js +9 -0
- package/esm5/lib/billing/services/base-billing-api.service.js +56 -0
- package/esm5/lib/core/consts.js +11 -0
- package/esm5/lib/core/core.module.js +48 -0
- package/esm5/lib/core/index.js +9 -0
- package/esm5/lib/core/services/appcontext.service.js +76 -0
- package/esm5/lib/core/services/base-api.service.js +72 -0
- package/esm5/lib/core/services/base-go.service.js +37 -0
- package/esm5/lib/core/services/base-gridedit.service.js +104 -0
- package/esm5/lib/identity/components/signin-button.component.js +32 -0
- package/esm5/lib/identity/components/signout-button.component.js +32 -0
- package/esm5/lib/identity/components/signup-button.component.js +32 -0
- package/esm5/lib/identity/identity.module.js +44 -0
- package/esm5/lib/identity/index.js +7 -0
- package/esm5/lib/ui/components/base-edit.component.js +70 -0
- package/esm5/lib/ui/components/base.component.js +39 -0
- package/esm5/lib/ui/components/content-header/content-header.component.js +38 -0
- package/esm5/lib/ui/components/html-editor/base-html-editor.component.js +90 -0
- package/esm5/lib/ui/components/html-editor/forms-html-editor.component.js +40 -0
- package/esm5/lib/ui/components/html-editor/html-editor.component.js +51 -0
- package/esm5/lib/ui/components/html-editor/html-editor.defaultoptions.js +38 -0
- package/esm5/lib/ui/components/validation/form-validation-summary.component.js +42 -0
- package/esm5/lib/ui/components/validation/item-validation-summary.component.js +39 -0
- package/esm5/lib/ui/components/validation/validation-summary.component.js +65 -0
- package/esm5/lib/ui/index.js +13 -0
- package/esm5/lib/ui/ui.module.js +80 -0
- package/esm5/osovitny-anatoly.js +5 -0
- package/esm5/public-api.js +5 -0
- package/fesm2015/osovitny-anatoly.js +1207 -0
- package/fesm2015/osovitny-anatoly.js.map +1 -0
- package/fesm5/osovitny-anatoly.js +1267 -0
- package/fesm5/osovitny-anatoly.js.map +1 -0
- package/lib/billing/billing.module.d.ts +2 -0
- package/lib/billing/components/buyaccess/buyaccess-button.component.d.ts +16 -0
- package/lib/billing/components/subscriptions/subscribe-plan-button.component.d.ts +15 -0
- package/lib/billing/components/subscriptions/upgrade-plan-button.component.d.ts +9 -0
- package/{src/lib/billing/index.ts → lib/billing/index.d.ts} +1 -6
- package/lib/billing/services/base-billing-api.service.d.ts +9 -0
- package/lib/core/consts.d.ts +5 -0
- package/lib/core/core.module.d.ts +2 -0
- package/{src/lib/core/index.ts → lib/core/index.d.ts} +1 -6
- package/lib/core/services/appcontext.service.d.ts +14 -0
- package/lib/core/services/base-api.service.d.ts +18 -0
- package/lib/core/services/base-go.service.d.ts +7 -0
- package/lib/core/services/base-gridedit.service.d.ts +19 -0
- package/lib/identity/components/signin-button.component.d.ts +4 -0
- package/lib/identity/components/signout-button.component.d.ts +4 -0
- package/lib/identity/components/signup-button.component.d.ts +4 -0
- package/lib/identity/identity.module.d.ts +2 -0
- package/{src/lib/identity/index.ts → lib/identity/index.d.ts} +1 -4
- package/lib/ui/components/base-edit.component.d.ts +14 -0
- package/lib/ui/components/base.component.d.ts +7 -0
- package/lib/ui/components/content-header/content-header.component.d.ts +5 -0
- package/lib/ui/components/html-editor/base-html-editor.component.d.ts +16 -0
- package/lib/ui/components/html-editor/forms-html-editor.component.d.ts +6 -0
- package/lib/ui/components/html-editor/html-editor.component.d.ts +6 -0
- package/lib/ui/components/html-editor/html-editor.defaultoptions.d.ts +1 -0
- package/lib/ui/components/validation/form-validation-summary.component.d.ts +6 -0
- package/lib/ui/components/validation/item-validation-summary.component.d.ts +6 -0
- package/lib/ui/components/validation/validation-summary.component.d.ts +6 -0
- package/{src/lib/ui/index.ts → lib/ui/index.d.ts} +1 -6
- package/lib/ui/ui.module.d.ts +2 -0
- package/osovitny-anatoly.d.ts +4 -0
- package/osovitny-anatoly.metadata.json +1 -0
- package/package.json +13 -2
- package/{src/public-api.ts → public-api.d.ts} +4 -4
- package/ng-package.json +0 -7
- package/src/lib/billing/billing.module.ts +0 -62
- package/src/lib/billing/components/buyaccess/buyaccess-button.component.html +0 -15
- package/src/lib/billing/components/buyaccess/buyaccess-button.component.ts +0 -70
- package/src/lib/billing/components/subscriptions/subscribe-plan-button.component.html +0 -21
- package/src/lib/billing/components/subscriptions/subscribe-plan-button.component.ts +0 -60
- package/src/lib/billing/components/subscriptions/upgrade-plan-button.component.html +0 -3
- package/src/lib/billing/components/subscriptions/upgrade-plan-button.component.ts +0 -47
- package/src/lib/billing/services/base-billing-api.service.ts +0 -56
- package/src/lib/core/consts.ts +0 -7
- package/src/lib/core/core.module.ts +0 -45
- package/src/lib/core/services/appcontext.service.ts +0 -81
- package/src/lib/core/services/base-api.service.ts +0 -87
- package/src/lib/core/services/base-go.service.ts +0 -33
- package/src/lib/core/services/base-gridedit.service.ts +0 -124
- package/src/lib/identity/components/signin-button.component.html +0 -1
- package/src/lib/identity/components/signin-button.component.ts +0 -27
- package/src/lib/identity/components/signout-button.component.html +0 -1
- package/src/lib/identity/components/signout-button.component.ts +0 -27
- package/src/lib/identity/components/signup-button.component.html +0 -1
- package/src/lib/identity/components/signup-button.component.ts +0 -28
- package/src/lib/identity/identity.module.ts +0 -41
- package/src/lib/ui/components/base-edit.component.ts +0 -77
- package/src/lib/ui/components/base.component.ts +0 -45
- package/src/lib/ui/components/content-header/content-header.component.html +0 -4
- package/src/lib/ui/components/content-header/content-header.component.ts +0 -32
- package/src/lib/ui/components/html-editor/base-html-editor.component.ts +0 -97
- package/src/lib/ui/components/html-editor/forms-html-editor.component.html +0 -14
- package/src/lib/ui/components/html-editor/forms-html-editor.component.ts +0 -35
- package/src/lib/ui/components/html-editor/html-editor.component.html +0 -6
- package/src/lib/ui/components/html-editor/html-editor.component.ts +0 -51
- package/src/lib/ui/components/html-editor/html-editor.defaultoptions.ts +0 -38
- package/src/lib/ui/components/validation/form-validation-summary.component.html +0 -4
- package/src/lib/ui/components/validation/form-validation-summary.component.ts +0 -36
- package/src/lib/ui/components/validation/item-validation-summary.component.html +0 -5
- package/src/lib/ui/components/validation/item-validation-summary.component.ts +0 -32
- package/src/lib/ui/components/validation/validation-summary.component.ts +0 -74
- package/src/lib/ui/index.js +0 -13
- package/src/lib/ui/index.js.map +0 -1
- package/src/lib/ui/ui.module.ts +0 -83
- package/tsconfig.lib.json +0 -32
- package/tsconfig.lib.prod.json +0 -6
- package/tslint.json +0 -17
- package/typings/osovitny-ui/index.d.ts +0 -24
|
@@ -0,0 +1,1207 @@
|
|
|
1
|
+
import { __decorate } from 'tslib';
|
|
2
|
+
import { Injectable, NgModule, Input, Component, CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from '@angular/core';
|
|
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 { CommonModule } from '@angular/common';
|
|
8
|
+
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
9
|
+
import { FroalaEditorModule, FroalaViewModule } from 'angular-froala-wysiwyg';
|
|
10
|
+
import { GridModule } from '@progress/kendo-angular-grid';
|
|
11
|
+
import { PopupModule } from '@progress/kendo-angular-popup';
|
|
12
|
+
import { ButtonsModule } from '@progress/kendo-angular-buttons';
|
|
13
|
+
import { DropDownsModule } from '@progress/kendo-angular-dropdowns';
|
|
14
|
+
|
|
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;
|
|
25
|
+
|
|
26
|
+
/*
|
|
27
|
+
<file>
|
|
28
|
+
Authors:
|
|
29
|
+
Vadim Osovitny
|
|
30
|
+
|
|
31
|
+
Created:
|
|
32
|
+
13 Nov 2017
|
|
33
|
+
|
|
34
|
+
Version:
|
|
35
|
+
1.0
|
|
36
|
+
|
|
37
|
+
Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
|
|
38
|
+
</file>
|
|
39
|
+
*/
|
|
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' });
|
|
60
|
+
}
|
|
61
|
+
//gets
|
|
62
|
+
getAll(data) {
|
|
63
|
+
return this.get('getall', data).pipe(map(res => res));
|
|
64
|
+
}
|
|
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));
|
|
71
|
+
}
|
|
72
|
+
getNewGuid() {
|
|
73
|
+
var url = this.baseUrl + 'getNewGuid';
|
|
74
|
+
return this.http.get(url, { responseType: 'text' });
|
|
75
|
+
}
|
|
76
|
+
//CRUD function
|
|
77
|
+
getById(id) {
|
|
78
|
+
return this.get('getById', { id: id });
|
|
79
|
+
}
|
|
80
|
+
remove(id) {
|
|
81
|
+
return this.postQS('remove', { id: id });
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
BaseApiService.ctorParameters = () => [
|
|
85
|
+
{ type: HttpClient }
|
|
86
|
+
];
|
|
87
|
+
BaseApiService = __decorate([
|
|
88
|
+
Injectable()
|
|
89
|
+
], BaseApiService);
|
|
90
|
+
|
|
91
|
+
/*
|
|
92
|
+
<file>
|
|
93
|
+
Authors:
|
|
94
|
+
Vadim Osovitny
|
|
95
|
+
|
|
96
|
+
Created:
|
|
97
|
+
29 Apr 2018
|
|
98
|
+
|
|
99
|
+
Version:
|
|
100
|
+
1.0
|
|
101
|
+
|
|
102
|
+
Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
|
|
103
|
+
</file>
|
|
104
|
+
*/
|
|
105
|
+
let BaseGridEditService = class BaseGridEditService extends BehaviorSubject {
|
|
106
|
+
constructor(http) {
|
|
107
|
+
super([]);
|
|
108
|
+
this.http = http;
|
|
109
|
+
this.data = [];
|
|
110
|
+
this.baseUrl = anatoly.consts.apiUrl;
|
|
111
|
+
this.baseReadUrl = this.baseUrl + "getAll";
|
|
112
|
+
}
|
|
113
|
+
serializeParams(data) {
|
|
114
|
+
return data ? ('?' + $.param(data)) : '';
|
|
115
|
+
}
|
|
116
|
+
reset() {
|
|
117
|
+
this.data = [];
|
|
118
|
+
}
|
|
119
|
+
resetItem(dataItem) {
|
|
120
|
+
if (!dataItem) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
//find orignal data item
|
|
124
|
+
const originalDataItem = this.data.find(item => item.Id === dataItem.Id);
|
|
125
|
+
//revert changes
|
|
126
|
+
Object.assign(originalDataItem, dataItem);
|
|
127
|
+
super.next(this.data);
|
|
128
|
+
}
|
|
129
|
+
read(params) {
|
|
130
|
+
if (this.data.length) {
|
|
131
|
+
return super.next(this.data);
|
|
132
|
+
}
|
|
133
|
+
var url = this.baseReadUrl;
|
|
134
|
+
if (typeof params === 'undefined') {
|
|
135
|
+
params = this.savedReadParams;
|
|
136
|
+
}
|
|
137
|
+
if (typeof params !== 'undefined') {
|
|
138
|
+
url = this.baseReadUrl + `${this.serializeParams(params)}`;
|
|
139
|
+
this.savedReadParams = params;
|
|
140
|
+
}
|
|
141
|
+
// this.http.get(url)
|
|
142
|
+
// .map(res => <any[]>res)
|
|
143
|
+
// .do(data => { this.data = data; }).subscribe(data => { super.next(data); });
|
|
144
|
+
//}
|
|
145
|
+
this.http.get(url).pipe(map(res => res)).subscribe(data => { super.next(data); });
|
|
146
|
+
}
|
|
147
|
+
save(data, isNew, sucess) {
|
|
148
|
+
const action = isNew ? 'add' : 'update';
|
|
149
|
+
this.reset();
|
|
150
|
+
this.post(action, data).subscribe(() => {
|
|
151
|
+
}, () => {
|
|
152
|
+
this.read();
|
|
153
|
+
}, () => {
|
|
154
|
+
this.read();
|
|
155
|
+
if (sucess)
|
|
156
|
+
sucess();
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
remove(data, sucess) {
|
|
160
|
+
this.reset();
|
|
161
|
+
this.post('remove', data).subscribe(() => {
|
|
162
|
+
}, () => {
|
|
163
|
+
this.read();
|
|
164
|
+
}, () => {
|
|
165
|
+
this.read();
|
|
166
|
+
if (sucess)
|
|
167
|
+
sucess();
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
post(action, data) {
|
|
171
|
+
var url = this.baseUrl + `${action}${this.serializeParams(data)}`;
|
|
172
|
+
return this.http.post(url, data).pipe(map(res => res));
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
BaseGridEditService.ctorParameters = () => [
|
|
176
|
+
{ type: HttpClient }
|
|
177
|
+
];
|
|
178
|
+
BaseGridEditService = __decorate([
|
|
179
|
+
Injectable()
|
|
180
|
+
], BaseGridEditService);
|
|
181
|
+
|
|
182
|
+
/*
|
|
183
|
+
<file>
|
|
184
|
+
Authors:
|
|
185
|
+
Vadim Osovitny
|
|
186
|
+
|
|
187
|
+
Created:
|
|
188
|
+
17 Jun 2018
|
|
189
|
+
|
|
190
|
+
Version:
|
|
191
|
+
1.0
|
|
192
|
+
|
|
193
|
+
Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
|
|
194
|
+
</file>
|
|
195
|
+
*/
|
|
196
|
+
let BaseGoService = class BaseGoService {
|
|
197
|
+
constructor(route, router) {
|
|
198
|
+
this.route = route;
|
|
199
|
+
this.router = router;
|
|
200
|
+
}
|
|
201
|
+
locationReload() {
|
|
202
|
+
//this.router.navigate([this.route.url]);
|
|
203
|
+
window.location.reload();
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
BaseGoService.ctorParameters = () => [
|
|
207
|
+
{ type: ActivatedRoute },
|
|
208
|
+
{ type: Router }
|
|
209
|
+
];
|
|
210
|
+
BaseGoService = __decorate([
|
|
211
|
+
Injectable()
|
|
212
|
+
], BaseGoService);
|
|
213
|
+
|
|
214
|
+
/*
|
|
215
|
+
<file>
|
|
216
|
+
Authors:
|
|
217
|
+
Vadim Osovitny
|
|
218
|
+
|
|
219
|
+
Created:
|
|
220
|
+
13 Nov 2017
|
|
221
|
+
|
|
222
|
+
Version:
|
|
223
|
+
1.0
|
|
224
|
+
|
|
225
|
+
Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
|
|
226
|
+
</file>
|
|
227
|
+
*/
|
|
228
|
+
let AppContextService = class AppContextService extends BaseApiService {
|
|
229
|
+
constructor(http) {
|
|
230
|
+
super(http);
|
|
231
|
+
this.http = http;
|
|
232
|
+
this.current = null;
|
|
233
|
+
this.successes = [];
|
|
234
|
+
this.subscription = null;
|
|
235
|
+
this.baseUrl = anatoly.consts.apiUrl + 'appcontext/';
|
|
236
|
+
}
|
|
237
|
+
getCurrent(success) {
|
|
238
|
+
if (typeof success == "undefined") {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
if (this.current != null) {
|
|
242
|
+
success(this.current);
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
this.successes.push(success);
|
|
246
|
+
if (this.subscription != null) {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
this.subscription = this.get('GetCurrentContext', null).subscribe(data => {
|
|
250
|
+
this.dataReceived(data);
|
|
251
|
+
}, e => { });
|
|
252
|
+
}
|
|
253
|
+
dataReceived(data) {
|
|
254
|
+
this.current = data;
|
|
255
|
+
for (var i = 0; i < this.successes.length; i++) {
|
|
256
|
+
var success = this.successes[i];
|
|
257
|
+
success(data);
|
|
258
|
+
}
|
|
259
|
+
this.successes = [];
|
|
260
|
+
this.subscription.unsubscribe();
|
|
261
|
+
this.subscription = null;
|
|
262
|
+
this.current = null;
|
|
263
|
+
}
|
|
264
|
+
isUserSignedIn() {
|
|
265
|
+
return window.__context_isUserSignedIn;
|
|
266
|
+
}
|
|
267
|
+
isUserAdmin() {
|
|
268
|
+
return window.__context_isUserAdmin;
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
AppContextService.ctorParameters = () => [
|
|
272
|
+
{ type: HttpClient }
|
|
273
|
+
];
|
|
274
|
+
AppContextService = __decorate([
|
|
275
|
+
Injectable()
|
|
276
|
+
], AppContextService);
|
|
277
|
+
|
|
278
|
+
/*
|
|
279
|
+
<file>
|
|
280
|
+
Authors:
|
|
281
|
+
Vadim Osovitny
|
|
282
|
+
|
|
283
|
+
Created:
|
|
284
|
+
10 Nov 2017
|
|
285
|
+
|
|
286
|
+
Version:
|
|
287
|
+
1.0
|
|
288
|
+
|
|
289
|
+
Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
|
|
290
|
+
</file>
|
|
291
|
+
*/
|
|
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
|
|
316
|
+
|
|
317
|
+
/*
|
|
318
|
+
<file>
|
|
319
|
+
Authors:
|
|
320
|
+
Vadim Osovitny
|
|
321
|
+
|
|
322
|
+
Created:
|
|
323
|
+
12 Nov 2017
|
|
324
|
+
|
|
325
|
+
Version:
|
|
326
|
+
1.0
|
|
327
|
+
|
|
328
|
+
Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
|
|
329
|
+
</file>
|
|
330
|
+
*/
|
|
331
|
+
let BaseBillingApiService = class BaseBillingApiService extends BaseApiService {
|
|
332
|
+
constructor(http) {
|
|
333
|
+
super(http);
|
|
334
|
+
this.http = http;
|
|
335
|
+
this.baseUrl += 'billing/';
|
|
336
|
+
}
|
|
337
|
+
requestNewSubscription(requestedPlan, success, error) {
|
|
338
|
+
this.postQS('requestNewSubscription', { requestedPlan: requestedPlan })
|
|
339
|
+
.subscribe(data => { }, e => { if (error)
|
|
340
|
+
error(); }, () => { if (success)
|
|
341
|
+
success(); });
|
|
342
|
+
}
|
|
343
|
+
cancelRequestedSubscription(success, error) {
|
|
344
|
+
this.postQS('cancelRequestedSubscription', null)
|
|
345
|
+
.subscribe(data => { }, e => { if (error)
|
|
346
|
+
error(); }, () => { if (success)
|
|
347
|
+
success(); });
|
|
348
|
+
}
|
|
349
|
+
buyAccess(requestedPlan, success, error) {
|
|
350
|
+
this.postQS('buyAccess', { requestedPlan: requestedPlan })
|
|
351
|
+
.subscribe(data => { }, e => { if (error)
|
|
352
|
+
error(); }, () => { if (success)
|
|
353
|
+
success(); });
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
BaseBillingApiService.ctorParameters = () => [
|
|
357
|
+
{ type: HttpClient }
|
|
358
|
+
];
|
|
359
|
+
BaseBillingApiService = __decorate([
|
|
360
|
+
Injectable()
|
|
361
|
+
], BaseBillingApiService);
|
|
362
|
+
|
|
363
|
+
/*
|
|
364
|
+
<file>
|
|
365
|
+
Authors:
|
|
366
|
+
Vadim Osovitny
|
|
367
|
+
|
|
368
|
+
Created:
|
|
369
|
+
14 Aug 2018
|
|
370
|
+
|
|
371
|
+
Version:
|
|
372
|
+
1.0
|
|
373
|
+
|
|
374
|
+
Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
|
|
375
|
+
</file>
|
|
376
|
+
*/
|
|
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
|
+
}
|
|
386
|
+
ngOnInit() {
|
|
387
|
+
if (!this.appcontext.isUserSignedIn()) {
|
|
388
|
+
this.contextUpdated = true;
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
this.appcontext.getCurrent((current) => {
|
|
392
|
+
this.isUserSignedIn = current.isUserSignedIn;
|
|
393
|
+
if (this.isUserSignedIn) {
|
|
394
|
+
this.currentPlan = current.account.billingPlan;
|
|
395
|
+
this.currentPlanTitle = current.account.billingPlanAsString;
|
|
396
|
+
}
|
|
397
|
+
this.contextUpdated = true;
|
|
398
|
+
});
|
|
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
|
+
}
|
|
411
|
+
};
|
|
412
|
+
BuyAccessButtonComponent.ctorParameters = () => [
|
|
413
|
+
{ type: AppContextService },
|
|
414
|
+
{ type: BaseBillingApiService }
|
|
415
|
+
];
|
|
416
|
+
__decorate([
|
|
417
|
+
Input()
|
|
418
|
+
], BuyAccessButtonComponent.prototype, "plan", void 0);
|
|
419
|
+
__decorate([
|
|
420
|
+
Input()
|
|
421
|
+
], BuyAccessButtonComponent.prototype, "plantitle", void 0);
|
|
422
|
+
BuyAccessButtonComponent = __decorate([
|
|
423
|
+
Component({
|
|
424
|
+
selector: 'anatoly-buyaccess-button',
|
|
425
|
+
template: "<div *ngIf=\"contextUpdated\">\r\n <div *ngIf=\"!isUserSignedIn\">\r\n <anatoly-signup-button classbtn=\"btn btn-block btn-primary\"></anatoly-signup-button>\r\n </div>\r\n\r\n <div *ngIf=\"isUserSignedIn\">\r\n <button class=\"btn btn-block btn-success selectPlan\" *ngIf=\"plan == currentPlan\">\r\n Your Plan\r\n </button>\r\n\r\n <button class=\"btn btn-block btn-warning selectPlan\" *ngIf=\"plan != currentPlan && currentPlan == 1\" (click)=\"onBuyPlan()\">\r\n Buy Now\r\n </button>\r\n </div>\r\n</div>\r\n"
|
|
426
|
+
})
|
|
427
|
+
], BuyAccessButtonComponent);
|
|
428
|
+
|
|
429
|
+
/*
|
|
430
|
+
<file>
|
|
431
|
+
Authors:
|
|
432
|
+
Vadim Osovitny
|
|
433
|
+
|
|
434
|
+
Created:
|
|
435
|
+
1 Jun 2018
|
|
436
|
+
|
|
437
|
+
Version:
|
|
438
|
+
1.0
|
|
439
|
+
|
|
440
|
+
Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
|
|
441
|
+
</file>
|
|
442
|
+
*/
|
|
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 = "";
|
|
452
|
+
}
|
|
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
|
+
}
|
|
466
|
+
this.contextUpdated = true;
|
|
467
|
+
});
|
|
468
|
+
}
|
|
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);
|
|
485
|
+
|
|
486
|
+
/*
|
|
487
|
+
<file>
|
|
488
|
+
Authors:
|
|
489
|
+
Vadim Osovitny
|
|
490
|
+
|
|
491
|
+
Created:
|
|
492
|
+
12 Nov 2017
|
|
493
|
+
|
|
494
|
+
Version:
|
|
495
|
+
1.0
|
|
496
|
+
|
|
497
|
+
Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
|
|
498
|
+
</file>
|
|
499
|
+
*/
|
|
500
|
+
let UpgradePlanButtonComponent = class UpgradePlanButtonComponent {
|
|
501
|
+
constructor(api) {
|
|
502
|
+
this.api = api;
|
|
503
|
+
}
|
|
504
|
+
onUpgradePlan() {
|
|
505
|
+
const text = `Current plan: ${this.currentplantitle} New plan: ${this.requestedplantitle}`;
|
|
506
|
+
var that = this;
|
|
507
|
+
osovitny.ui.areYouSure(text, 'Change billing plan', 'Confirm change', 'Cancel', () => {
|
|
508
|
+
that.api.requestNewSubscription(that.requestedplan, () => {
|
|
509
|
+
osovitny.ui.alertSuccess('Your request for changing plan has been sent.', null, () => {
|
|
510
|
+
window.location.reload();
|
|
511
|
+
});
|
|
512
|
+
});
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
};
|
|
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
|
+
__decorate([
|
|
526
|
+
Input()
|
|
527
|
+
], UpgradePlanButtonComponent.prototype, "requestedplantitle", void 0);
|
|
528
|
+
UpgradePlanButtonComponent = __decorate([
|
|
529
|
+
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"
|
|
532
|
+
})
|
|
533
|
+
], UpgradePlanButtonComponent);
|
|
534
|
+
|
|
535
|
+
/*
|
|
536
|
+
<file>
|
|
537
|
+
Authors:
|
|
538
|
+
Vadim Osovitny
|
|
539
|
+
|
|
540
|
+
Created:
|
|
541
|
+
4 Jul 2018
|
|
542
|
+
|
|
543
|
+
Version:
|
|
544
|
+
1.0
|
|
545
|
+
|
|
546
|
+
Copyright (c) 2018 Osovitny Inc. All rights reserved.
|
|
547
|
+
</file>
|
|
548
|
+
*/
|
|
549
|
+
let SignInButtonComponent = class SignInButtonComponent {
|
|
550
|
+
constructor() { }
|
|
551
|
+
};
|
|
552
|
+
__decorate([
|
|
553
|
+
Input()
|
|
554
|
+
], SignInButtonComponent.prototype, "classbtn", void 0);
|
|
555
|
+
SignInButtonComponent = __decorate([
|
|
556
|
+
Component({
|
|
557
|
+
selector: 'anatoly-signin-button',
|
|
558
|
+
template: "<a href=\"identity/signIn\" class=\"{{classbtn}}\">Sign In</a>\r\n"
|
|
559
|
+
})
|
|
560
|
+
], SignInButtonComponent);
|
|
561
|
+
|
|
562
|
+
/*
|
|
563
|
+
<file>
|
|
564
|
+
Authors:
|
|
565
|
+
Vadim Osovitny
|
|
566
|
+
|
|
567
|
+
Created:
|
|
568
|
+
4 Jul 2018
|
|
569
|
+
|
|
570
|
+
Version:
|
|
571
|
+
1.0
|
|
572
|
+
|
|
573
|
+
Copyright (c) 2018 Osovitny Inc. All rights reserved.
|
|
574
|
+
</file>
|
|
575
|
+
*/
|
|
576
|
+
let SignOutButtonComponent = class SignOutButtonComponent {
|
|
577
|
+
constructor() { }
|
|
578
|
+
};
|
|
579
|
+
__decorate([
|
|
580
|
+
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);
|
|
588
|
+
|
|
589
|
+
/*
|
|
590
|
+
<file>
|
|
591
|
+
Authors:
|
|
592
|
+
Vadim Osovitny
|
|
593
|
+
|
|
594
|
+
Created:
|
|
595
|
+
4 Jul 2018
|
|
596
|
+
|
|
597
|
+
Version:
|
|
598
|
+
1.0
|
|
599
|
+
|
|
600
|
+
Copyright (c) 2018 Osovitny Inc. All rights reserved.
|
|
601
|
+
</file>
|
|
602
|
+
*/
|
|
603
|
+
let SignUpButtonComponent = class SignUpButtonComponent {
|
|
604
|
+
constructor() {
|
|
605
|
+
}
|
|
606
|
+
};
|
|
607
|
+
__decorate([
|
|
608
|
+
Input()
|
|
609
|
+
], SignUpButtonComponent.prototype, "classbtn", void 0);
|
|
610
|
+
SignUpButtonComponent = __decorate([
|
|
611
|
+
Component({
|
|
612
|
+
selector: 'anatoly-signup-button',
|
|
613
|
+
template: "<a href=\"identity/signup\" class=\"{{classbtn}}\">Sign Up</a>\r\n"
|
|
614
|
+
})
|
|
615
|
+
], SignUpButtonComponent);
|
|
616
|
+
|
|
617
|
+
/*
|
|
618
|
+
<file>
|
|
619
|
+
Authors:
|
|
620
|
+
Vadim Osovitny
|
|
621
|
+
|
|
622
|
+
Created:
|
|
623
|
+
4 Jul 2018
|
|
624
|
+
|
|
625
|
+
Version:
|
|
626
|
+
1.0
|
|
627
|
+
|
|
628
|
+
Copyright (c) 2018 Osovitny Inc. All rights reserved.
|
|
629
|
+
</file>
|
|
630
|
+
*/
|
|
631
|
+
let AnatolyIdentityModule = class AnatolyIdentityModule {
|
|
632
|
+
};
|
|
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: []
|
|
647
|
+
})
|
|
648
|
+
], AnatolyIdentityModule);
|
|
649
|
+
|
|
650
|
+
// Components
|
|
651
|
+
|
|
652
|
+
/*
|
|
653
|
+
<file>
|
|
654
|
+
Authors:
|
|
655
|
+
Vadim Osovitny
|
|
656
|
+
|
|
657
|
+
Created:
|
|
658
|
+
10 Nov 2017
|
|
659
|
+
|
|
660
|
+
Version:
|
|
661
|
+
1.0
|
|
662
|
+
|
|
663
|
+
Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
|
|
664
|
+
</file>
|
|
665
|
+
*/
|
|
666
|
+
let AnatolyBillingModule = class AnatolyBillingModule {
|
|
667
|
+
};
|
|
668
|
+
AnatolyBillingModule = __decorate([
|
|
669
|
+
NgModule({
|
|
670
|
+
imports: [
|
|
671
|
+
CommonModule,
|
|
672
|
+
HttpClientModule,
|
|
673
|
+
HttpClientXsrfModule,
|
|
674
|
+
HttpClientJsonpModule,
|
|
675
|
+
AnatolyIdentityModule
|
|
676
|
+
],
|
|
677
|
+
exports: [
|
|
678
|
+
CommonModule,
|
|
679
|
+
HttpClientModule,
|
|
680
|
+
HttpClientXsrfModule,
|
|
681
|
+
HttpClientJsonpModule,
|
|
682
|
+
SubscribePlanButtonComponent,
|
|
683
|
+
UpgradePlanButtonComponent,
|
|
684
|
+
BuyAccessButtonComponent
|
|
685
|
+
],
|
|
686
|
+
declarations: [
|
|
687
|
+
SubscribePlanButtonComponent,
|
|
688
|
+
UpgradePlanButtonComponent,
|
|
689
|
+
BuyAccessButtonComponent
|
|
690
|
+
],
|
|
691
|
+
providers: [
|
|
692
|
+
BaseBillingApiService
|
|
693
|
+
]
|
|
694
|
+
})
|
|
695
|
+
], AnatolyBillingModule);
|
|
696
|
+
|
|
697
|
+
// Components
|
|
698
|
+
|
|
699
|
+
/*
|
|
700
|
+
<file>
|
|
701
|
+
Authors:
|
|
702
|
+
Vadim Osovitny
|
|
703
|
+
|
|
704
|
+
Created:
|
|
705
|
+
28 Aug 2018
|
|
706
|
+
|
|
707
|
+
Version:
|
|
708
|
+
1.0
|
|
709
|
+
|
|
710
|
+
Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
|
|
711
|
+
</file>
|
|
712
|
+
*/
|
|
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;
|
|
721
|
+
}
|
|
722
|
+
showLoading() {
|
|
723
|
+
var panelLoading = $('#pnlLoading');
|
|
724
|
+
panelLoading.show();
|
|
725
|
+
}
|
|
726
|
+
hideLoading() {
|
|
727
|
+
var panelLoading = $('#pnlLoading');
|
|
728
|
+
panelLoading.hide();
|
|
729
|
+
}
|
|
730
|
+
handleError(e) {
|
|
731
|
+
this.hideLoading();
|
|
732
|
+
osovitny.ui.errorOccurred();
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
/*
|
|
737
|
+
<file>
|
|
738
|
+
Authors:
|
|
739
|
+
Vadim Osovitny
|
|
740
|
+
|
|
741
|
+
Created:
|
|
742
|
+
20 Nov 2017
|
|
743
|
+
|
|
744
|
+
Version:
|
|
745
|
+
1.0
|
|
746
|
+
|
|
747
|
+
Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
|
|
748
|
+
</file>
|
|
749
|
+
*/
|
|
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();
|
|
763
|
+
}
|
|
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);
|
|
774
|
+
}
|
|
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;
|
|
785
|
+
}
|
|
786
|
+
setFormGroupValue(groupName, name, value) {
|
|
787
|
+
this.formGroup.controls[groupName].get(name).setValue(value);
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
__decorate([
|
|
791
|
+
Input()
|
|
792
|
+
], BaseEditComponent.prototype, "formGroup", void 0);
|
|
793
|
+
__decorate([
|
|
794
|
+
Input()
|
|
795
|
+
], BaseEditComponent.prototype, "formSubmitted", void 0);
|
|
796
|
+
|
|
797
|
+
/*
|
|
798
|
+
<file>
|
|
799
|
+
Authors:
|
|
800
|
+
Anatoly Osovitny
|
|
801
|
+
|
|
802
|
+
Created:
|
|
803
|
+
23 Apr 2018
|
|
804
|
+
|
|
805
|
+
Version:
|
|
806
|
+
1.0
|
|
807
|
+
|
|
808
|
+
Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
|
|
809
|
+
</file>
|
|
810
|
+
*/
|
|
811
|
+
let ContentHeaderComponent = class ContentHeaderComponent {
|
|
812
|
+
ngOnInit() {
|
|
813
|
+
if (this.title == null) {
|
|
814
|
+
this.title = '';
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
};
|
|
818
|
+
__decorate([
|
|
819
|
+
Input()
|
|
820
|
+
], ContentHeaderComponent.prototype, "title", void 0);
|
|
821
|
+
ContentHeaderComponent = __decorate([
|
|
822
|
+
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"
|
|
825
|
+
})
|
|
826
|
+
], ContentHeaderComponent);
|
|
827
|
+
|
|
828
|
+
/*
|
|
829
|
+
<file>
|
|
830
|
+
Authors:
|
|
831
|
+
Vadim Osovitny
|
|
832
|
+
|
|
833
|
+
Created:
|
|
834
|
+
8 Dec 2017
|
|
835
|
+
|
|
836
|
+
Version:
|
|
837
|
+
1.0
|
|
838
|
+
|
|
839
|
+
Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
|
|
840
|
+
</file>
|
|
841
|
+
*/
|
|
842
|
+
class ValidationSummaryComponent extends BaseEditComponent {
|
|
843
|
+
constructor() {
|
|
844
|
+
super();
|
|
845
|
+
}
|
|
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));
|
|
854
|
+
});
|
|
855
|
+
}
|
|
856
|
+
else {
|
|
857
|
+
this.getValidationMessages(control, k).forEach(m => messages.push(m));
|
|
858
|
+
}
|
|
859
|
+
});
|
|
860
|
+
return messages;
|
|
861
|
+
}
|
|
862
|
+
getValidationMessages(state, thingName) {
|
|
863
|
+
let thing = state.path || thingName;
|
|
864
|
+
let messages = [];
|
|
865
|
+
if (state.errors) {
|
|
866
|
+
for (let errorName in state.errors) {
|
|
867
|
+
if (state.errors.hasOwnProperty(errorName)) {
|
|
868
|
+
switch (errorName) {
|
|
869
|
+
case 'required':
|
|
870
|
+
messages.push(`${thing} is required`);
|
|
871
|
+
break;
|
|
872
|
+
case 'minlength':
|
|
873
|
+
messages.push(`${thing} must be at least ${state.errors['minlength'].requiredLength} characters`);
|
|
874
|
+
break;
|
|
875
|
+
case 'pattern':
|
|
876
|
+
messages.push(`${thing} contains illegal characters`);
|
|
877
|
+
break;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
return messages;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
/*
|
|
887
|
+
<file>
|
|
888
|
+
Authors:
|
|
889
|
+
Vadim Osovitny
|
|
890
|
+
|
|
891
|
+
Created:
|
|
892
|
+
7 Dec 2017
|
|
893
|
+
|
|
894
|
+
Version:
|
|
895
|
+
1.0
|
|
896
|
+
|
|
897
|
+
Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
|
|
898
|
+
</file>
|
|
899
|
+
*/
|
|
900
|
+
let FormValidationSummaryComponent = class FormValidationSummaryComponent extends ValidationSummaryComponent {
|
|
901
|
+
constructor() {
|
|
902
|
+
super();
|
|
903
|
+
this.visible = false;
|
|
904
|
+
}
|
|
905
|
+
getErrors() {
|
|
906
|
+
var messages = this.getFormValidationMessages();
|
|
907
|
+
return messages;
|
|
908
|
+
}
|
|
909
|
+
};
|
|
910
|
+
__decorate([
|
|
911
|
+
Input()
|
|
912
|
+
], FormValidationSummaryComponent.prototype, "visible", void 0);
|
|
913
|
+
FormValidationSummaryComponent = __decorate([
|
|
914
|
+
Component({
|
|
915
|
+
selector: 'anatoly-form-validation-summary',
|
|
916
|
+
template: "<div class=\"callout callout-danger\" *ngIf=\"visible\">\r\n <h4 class=\"box-title\">There are problems with the form</h4>\r\n <p *ngFor=\"let error of getErrors()\"><span class=\"help-block \" style=\"color:white\">{{error}}</span></p>\r\n</div>\r\n"
|
|
917
|
+
})
|
|
918
|
+
], FormValidationSummaryComponent);
|
|
919
|
+
|
|
920
|
+
/*
|
|
921
|
+
<file>
|
|
922
|
+
Authors:
|
|
923
|
+
Vadim Osovitny
|
|
924
|
+
|
|
925
|
+
Created:
|
|
926
|
+
6 Dec 2017
|
|
927
|
+
|
|
928
|
+
Version:
|
|
929
|
+
1.0
|
|
930
|
+
|
|
931
|
+
Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
|
|
932
|
+
</file>
|
|
933
|
+
*/
|
|
934
|
+
let ItemValidationSummaryComponent = class ItemValidationSummaryComponent extends ValidationSummaryComponent {
|
|
935
|
+
constructor() {
|
|
936
|
+
super();
|
|
937
|
+
}
|
|
938
|
+
};
|
|
939
|
+
__decorate([
|
|
940
|
+
Input()
|
|
941
|
+
], ItemValidationSummaryComponent.prototype, "key", void 0);
|
|
942
|
+
__decorate([
|
|
943
|
+
Input()
|
|
944
|
+
], ItemValidationSummaryComponent.prototype, "title", void 0);
|
|
945
|
+
ItemValidationSummaryComponent = __decorate([
|
|
946
|
+
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>"
|
|
949
|
+
})
|
|
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
|
+
};
|
|
988
|
+
|
|
989
|
+
/*
|
|
990
|
+
<file>
|
|
991
|
+
Authors:
|
|
992
|
+
Anatoly Osovitny
|
|
993
|
+
Vadim Osovitny
|
|
994
|
+
|
|
995
|
+
Created:
|
|
996
|
+
12 Dec 2017
|
|
997
|
+
|
|
998
|
+
Version:
|
|
999
|
+
1.0
|
|
1000
|
+
|
|
1001
|
+
Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
|
|
1002
|
+
</file>
|
|
1003
|
+
*/
|
|
1004
|
+
class BaseHtmlEditorComponent extends BaseEditComponent {
|
|
1005
|
+
constructor() {
|
|
1006
|
+
super();
|
|
1007
|
+
this.editorInitialized = false;
|
|
1008
|
+
//General params
|
|
1009
|
+
this.editorId = '';
|
|
1010
|
+
this.editorLabelText = 'Html';
|
|
1011
|
+
this.editorOptions = {};
|
|
1012
|
+
}
|
|
1013
|
+
ngOnInit() {
|
|
1014
|
+
let opt = this.editorOptions;
|
|
1015
|
+
if (typeof this.editorOptions == "string") {
|
|
1016
|
+
opt = JSON.parse(this.editorOptions);
|
|
1017
|
+
}
|
|
1018
|
+
let newOptions = $.extend({}, DefaultEditorOptions, opt);
|
|
1019
|
+
let key = window.__froalaEditor_Key;
|
|
1020
|
+
if (key) {
|
|
1021
|
+
newOptions = $.extend({}, newOptions, JSON.parse('{ "key": "' + key + '" }'));
|
|
1022
|
+
}
|
|
1023
|
+
if (newOptions.events && newOptions.events.initialized) {
|
|
1024
|
+
newOptions.events.initialized.overridden = false;
|
|
1025
|
+
}
|
|
1026
|
+
this.options = newOptions;
|
|
1027
|
+
}
|
|
1028
|
+
doAfterEditorInitialized(action) {
|
|
1029
|
+
var that = this;
|
|
1030
|
+
var timeOut = 500;
|
|
1031
|
+
if (this.editorInitialized) {
|
|
1032
|
+
timeOut = 100;
|
|
1033
|
+
}
|
|
1034
|
+
setTimeout(function () { action(that); }, timeOut);
|
|
1035
|
+
}
|
|
1036
|
+
getEditor() {
|
|
1037
|
+
if (this._control)
|
|
1038
|
+
return this._control.getEditor();
|
|
1039
|
+
return null;
|
|
1040
|
+
}
|
|
1041
|
+
//Public Funcs
|
|
1042
|
+
initializeControl(control) {
|
|
1043
|
+
this._control = control;
|
|
1044
|
+
this._control.initialize();
|
|
1045
|
+
this.editorInitialized = true;
|
|
1046
|
+
}
|
|
1047
|
+
setUploadParams(uploadType, uploadParentId) {
|
|
1048
|
+
this.doAfterEditorInitialized(function (that) {
|
|
1049
|
+
var editor = that.getEditor();
|
|
1050
|
+
if (typeof (editor) == "undefined" || editor == null) {
|
|
1051
|
+
return;
|
|
1052
|
+
}
|
|
1053
|
+
editor.opts.imageUploadParams.uploadType = uploadType;
|
|
1054
|
+
editor.opts.imageUploadParams.uploadParentId = uploadParentId;
|
|
1055
|
+
});
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
__decorate([
|
|
1059
|
+
Input()
|
|
1060
|
+
], BaseHtmlEditorComponent.prototype, "editorId", void 0);
|
|
1061
|
+
__decorate([
|
|
1062
|
+
Input()
|
|
1063
|
+
], BaseHtmlEditorComponent.prototype, "editorLabelText", void 0);
|
|
1064
|
+
__decorate([
|
|
1065
|
+
Input()
|
|
1066
|
+
], BaseHtmlEditorComponent.prototype, "editorOptions", void 0);
|
|
1067
|
+
|
|
1068
|
+
/*
|
|
1069
|
+
<file>
|
|
1070
|
+
Authors:
|
|
1071
|
+
Anatoly Osovitny
|
|
1072
|
+
Vadim Osovitny
|
|
1073
|
+
|
|
1074
|
+
Created:
|
|
1075
|
+
12 Dec 2017
|
|
1076
|
+
|
|
1077
|
+
Version:
|
|
1078
|
+
1.0
|
|
1079
|
+
|
|
1080
|
+
Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
|
|
1081
|
+
</file>
|
|
1082
|
+
*/
|
|
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
|
+
}
|
|
1103
|
+
};
|
|
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>"
|
|
1108
|
+
})
|
|
1109
|
+
], HtmlEditorComponent);
|
|
1110
|
+
|
|
1111
|
+
/*
|
|
1112
|
+
<file>
|
|
1113
|
+
Authors:
|
|
1114
|
+
Anatoly Osovitny
|
|
1115
|
+
Vadim Osovitny
|
|
1116
|
+
|
|
1117
|
+
Created:
|
|
1118
|
+
12 Dec 2017
|
|
1119
|
+
|
|
1120
|
+
Version:
|
|
1121
|
+
1.0
|
|
1122
|
+
|
|
1123
|
+
Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
|
|
1124
|
+
</file>
|
|
1125
|
+
*/
|
|
1126
|
+
let FormsHtmlEditorComponent = class FormsHtmlEditorComponent extends BaseHtmlEditorComponent {
|
|
1127
|
+
constructor() {
|
|
1128
|
+
super();
|
|
1129
|
+
this.editorFormKey = 'html';
|
|
1130
|
+
}
|
|
1131
|
+
};
|
|
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"
|
|
1139
|
+
})
|
|
1140
|
+
], FormsHtmlEditorComponent);
|
|
1141
|
+
|
|
1142
|
+
/*
|
|
1143
|
+
<file>
|
|
1144
|
+
Authors:
|
|
1145
|
+
Vadim Osovitny
|
|
1146
|
+
|
|
1147
|
+
Created:
|
|
1148
|
+
3 Jun 2018
|
|
1149
|
+
|
|
1150
|
+
Version:
|
|
1151
|
+
1.0
|
|
1152
|
+
|
|
1153
|
+
Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
|
|
1154
|
+
</file>
|
|
1155
|
+
*/
|
|
1156
|
+
let AnatolyUIModule = class AnatolyUIModule {
|
|
1157
|
+
};
|
|
1158
|
+
AnatolyUIModule = __decorate([
|
|
1159
|
+
NgModule({
|
|
1160
|
+
imports: [
|
|
1161
|
+
CommonModule,
|
|
1162
|
+
ReactiveFormsModule,
|
|
1163
|
+
FormsModule,
|
|
1164
|
+
HttpClientModule,
|
|
1165
|
+
HttpClientXsrfModule,
|
|
1166
|
+
HttpClientJsonpModule,
|
|
1167
|
+
FroalaEditorModule.forRoot(),
|
|
1168
|
+
FroalaViewModule.forRoot(),
|
|
1169
|
+
GridModule,
|
|
1170
|
+
PopupModule,
|
|
1171
|
+
ButtonsModule,
|
|
1172
|
+
DropDownsModule
|
|
1173
|
+
],
|
|
1174
|
+
exports: [
|
|
1175
|
+
CommonModule,
|
|
1176
|
+
HttpClientModule,
|
|
1177
|
+
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
|
|
1191
|
+
],
|
|
1192
|
+
providers: [],
|
|
1193
|
+
schemas: [
|
|
1194
|
+
CUSTOM_ELEMENTS_SCHEMA,
|
|
1195
|
+
NO_ERRORS_SCHEMA
|
|
1196
|
+
]
|
|
1197
|
+
})
|
|
1198
|
+
], AnatolyUIModule);
|
|
1199
|
+
|
|
1200
|
+
// Base Components
|
|
1201
|
+
|
|
1202
|
+
/**
|
|
1203
|
+
* Generated bundle index. Do not edit.
|
|
1204
|
+
*/
|
|
1205
|
+
|
|
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 };
|
|
1207
|
+
//# sourceMappingURL=osovitny-anatoly.js.map
|