@bnsights/bbsf-utilities 1.0.0
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/README.md +24 -0
- package/bnsights-bbsf-utilities-1.0.0.tgz +0 -0
- package/bnsights-bbsf-utilities.d.ts +4 -0
- package/bnsights-bbsf-utilities.metadata.json +1 -0
- package/bundles/bnsights-bbsf-utilities.umd.js +1127 -0
- package/bundles/bnsights-bbsf-utilities.umd.js.map +1 -0
- package/esm2015/bnsights-bbsf-utilities.js +5 -0
- package/esm2015/lib/bbsf-utilities.module.js +50 -0
- package/esm2015/lib/shared/authentication/auth.service.js +157 -0
- package/esm2015/lib/shared/config/environment.js +12 -0
- package/esm2015/lib/shared/models/ErrorModel.js +3 -0
- package/esm2015/lib/shared/models/RequestOptionsModel.js +9 -0
- package/esm2015/lib/shared/services/controlvalidation.service.js +151 -0
- package/esm2015/lib/shared/services/environment.service.js +31 -0
- package/esm2015/lib/shared/services/masterlayout.service.js +65 -0
- package/esm2015/lib/shared/services/requesthandler.service.js +85 -0
- package/esm2015/lib/shared/services/stylesbundle.service.js +46 -0
- package/esm2015/lib/shared/services/translate.service.js +13 -0
- package/esm2015/lib/shared/services/utility.service.js +96 -0
- package/esm2015/public-api.js +15 -0
- package/fesm2015/bnsights-bbsf-utilities.js +661 -0
- package/fesm2015/bnsights-bbsf-utilities.js.map +1 -0
- package/lib/bbsf-utilities.module.d.ts +6 -0
- package/lib/shared/authentication/auth.service.d.ts +32 -0
- package/lib/shared/config/environment.d.ts +1 -0
- package/lib/shared/models/ErrorModel.d.ts +5 -0
- package/lib/shared/models/RequestOptionsModel.d.ts +9 -0
- package/lib/shared/services/controlvalidation.service.d.ts +19 -0
- package/lib/shared/services/environment.service.d.ts +7 -0
- package/lib/shared/services/masterlayout.service.d.ts +18 -0
- package/lib/shared/services/requesthandler.service.d.ts +23 -0
- package/lib/shared/services/stylesbundle.service.d.ts +6 -0
- package/lib/shared/services/translate.service.d.ts +3 -0
- package/lib/shared/services/utility.service.d.ts +19 -0
- package/package.json +38 -0
- package/public-api.d.ts +11 -0
|
@@ -0,0 +1,1127 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/router'), require('@ngx-translate/core'), require('ng-block-ui'), require('ngx-toastr'), require('@angular/http'), require('@angular/common/http'), require('oidc-client'), require('rxjs'), require('rxjs/operators')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@bnsights/bbsf-utilities', ['exports', '@angular/common', '@angular/core', '@angular/router', '@ngx-translate/core', 'ng-block-ui', 'ngx-toastr', '@angular/http', '@angular/common/http', 'oidc-client', 'rxjs', 'rxjs/operators'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.bnsights = global.bnsights || {}, global.bnsights["bbsf-utilities"] = {}), global.ng.common, global.ng.core, global.ng.router, global.i1$1, global.ngBlockUi, global.ngxToastr, global.ng.http, global.ng.common.http, global.oidcClient, global.rxjs, global.rxjs.operators));
|
|
5
|
+
})(this, (function (exports, i1$2, i0, i1$3, i1$1, ngBlockUi, ngxToastr, http, i1, oidcClient, rxjs, operators) { 'use strict';
|
|
6
|
+
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
n["default"] = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var i1__namespace$2 = /*#__PURE__*/_interopNamespace(i1$2);
|
|
26
|
+
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
27
|
+
var i1__namespace$3 = /*#__PURE__*/_interopNamespace(i1$3);
|
|
28
|
+
var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
|
|
29
|
+
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
|
30
|
+
|
|
31
|
+
/*! *****************************************************************************
|
|
32
|
+
Copyright (c) Microsoft Corporation.
|
|
33
|
+
|
|
34
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
35
|
+
purpose with or without fee is hereby granted.
|
|
36
|
+
|
|
37
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
38
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
39
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
40
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
41
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
42
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
43
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
44
|
+
***************************************************************************** */
|
|
45
|
+
/* global Reflect, Promise */
|
|
46
|
+
var extendStatics = function (d, b) {
|
|
47
|
+
extendStatics = Object.setPrototypeOf ||
|
|
48
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
49
|
+
function (d, b) { for (var p in b)
|
|
50
|
+
if (Object.prototype.hasOwnProperty.call(b, p))
|
|
51
|
+
d[p] = b[p]; };
|
|
52
|
+
return extendStatics(d, b);
|
|
53
|
+
};
|
|
54
|
+
function __extends(d, b) {
|
|
55
|
+
if (typeof b !== "function" && b !== null)
|
|
56
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
57
|
+
extendStatics(d, b);
|
|
58
|
+
function __() { this.constructor = d; }
|
|
59
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
60
|
+
}
|
|
61
|
+
var __assign = function () {
|
|
62
|
+
__assign = Object.assign || function __assign(t) {
|
|
63
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
64
|
+
s = arguments[i];
|
|
65
|
+
for (var p in s)
|
|
66
|
+
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
67
|
+
t[p] = s[p];
|
|
68
|
+
}
|
|
69
|
+
return t;
|
|
70
|
+
};
|
|
71
|
+
return __assign.apply(this, arguments);
|
|
72
|
+
};
|
|
73
|
+
function __rest(s, e) {
|
|
74
|
+
var t = {};
|
|
75
|
+
for (var p in s)
|
|
76
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
77
|
+
t[p] = s[p];
|
|
78
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
79
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
80
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
81
|
+
t[p[i]] = s[p[i]];
|
|
82
|
+
}
|
|
83
|
+
return t;
|
|
84
|
+
}
|
|
85
|
+
function __decorate(decorators, target, key, desc) {
|
|
86
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
87
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
88
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
89
|
+
else
|
|
90
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
91
|
+
if (d = decorators[i])
|
|
92
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
93
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
94
|
+
}
|
|
95
|
+
function __param(paramIndex, decorator) {
|
|
96
|
+
return function (target, key) { decorator(target, key, paramIndex); };
|
|
97
|
+
}
|
|
98
|
+
function __metadata(metadataKey, metadataValue) {
|
|
99
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
100
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
101
|
+
}
|
|
102
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
103
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
104
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
105
|
+
function fulfilled(value) { try {
|
|
106
|
+
step(generator.next(value));
|
|
107
|
+
}
|
|
108
|
+
catch (e) {
|
|
109
|
+
reject(e);
|
|
110
|
+
} }
|
|
111
|
+
function rejected(value) { try {
|
|
112
|
+
step(generator["throw"](value));
|
|
113
|
+
}
|
|
114
|
+
catch (e) {
|
|
115
|
+
reject(e);
|
|
116
|
+
} }
|
|
117
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
118
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function __generator(thisArg, body) {
|
|
122
|
+
var _ = { label: 0, sent: function () { if (t[0] & 1)
|
|
123
|
+
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
124
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
|
125
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
126
|
+
function step(op) {
|
|
127
|
+
if (f)
|
|
128
|
+
throw new TypeError("Generator is already executing.");
|
|
129
|
+
while (_)
|
|
130
|
+
try {
|
|
131
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
|
132
|
+
return t;
|
|
133
|
+
if (y = 0, t)
|
|
134
|
+
op = [op[0] & 2, t.value];
|
|
135
|
+
switch (op[0]) {
|
|
136
|
+
case 0:
|
|
137
|
+
case 1:
|
|
138
|
+
t = op;
|
|
139
|
+
break;
|
|
140
|
+
case 4:
|
|
141
|
+
_.label++;
|
|
142
|
+
return { value: op[1], done: false };
|
|
143
|
+
case 5:
|
|
144
|
+
_.label++;
|
|
145
|
+
y = op[1];
|
|
146
|
+
op = [0];
|
|
147
|
+
continue;
|
|
148
|
+
case 7:
|
|
149
|
+
op = _.ops.pop();
|
|
150
|
+
_.trys.pop();
|
|
151
|
+
continue;
|
|
152
|
+
default:
|
|
153
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
154
|
+
_ = 0;
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
|
158
|
+
_.label = op[1];
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
162
|
+
_.label = t[1];
|
|
163
|
+
t = op;
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
if (t && _.label < t[2]) {
|
|
167
|
+
_.label = t[2];
|
|
168
|
+
_.ops.push(op);
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
if (t[2])
|
|
172
|
+
_.ops.pop();
|
|
173
|
+
_.trys.pop();
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
op = body.call(thisArg, _);
|
|
177
|
+
}
|
|
178
|
+
catch (e) {
|
|
179
|
+
op = [6, e];
|
|
180
|
+
y = 0;
|
|
181
|
+
}
|
|
182
|
+
finally {
|
|
183
|
+
f = t = 0;
|
|
184
|
+
}
|
|
185
|
+
if (op[0] & 5)
|
|
186
|
+
throw op[1];
|
|
187
|
+
return { value: op[0] ? op[1] : void 0, done: true };
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
|
191
|
+
if (k2 === undefined)
|
|
192
|
+
k2 = k;
|
|
193
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
|
194
|
+
}) : (function (o, m, k, k2) {
|
|
195
|
+
if (k2 === undefined)
|
|
196
|
+
k2 = k;
|
|
197
|
+
o[k2] = m[k];
|
|
198
|
+
});
|
|
199
|
+
function __exportStar(m, o) {
|
|
200
|
+
for (var p in m)
|
|
201
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
|
202
|
+
__createBinding(o, m, p);
|
|
203
|
+
}
|
|
204
|
+
function __values(o) {
|
|
205
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
206
|
+
if (m)
|
|
207
|
+
return m.call(o);
|
|
208
|
+
if (o && typeof o.length === "number")
|
|
209
|
+
return {
|
|
210
|
+
next: function () {
|
|
211
|
+
if (o && i >= o.length)
|
|
212
|
+
o = void 0;
|
|
213
|
+
return { value: o && o[i++], done: !o };
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
217
|
+
}
|
|
218
|
+
function __read(o, n) {
|
|
219
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
220
|
+
if (!m)
|
|
221
|
+
return o;
|
|
222
|
+
var i = m.call(o), r, ar = [], e;
|
|
223
|
+
try {
|
|
224
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
225
|
+
ar.push(r.value);
|
|
226
|
+
}
|
|
227
|
+
catch (error) {
|
|
228
|
+
e = { error: error };
|
|
229
|
+
}
|
|
230
|
+
finally {
|
|
231
|
+
try {
|
|
232
|
+
if (r && !r.done && (m = i["return"]))
|
|
233
|
+
m.call(i);
|
|
234
|
+
}
|
|
235
|
+
finally {
|
|
236
|
+
if (e)
|
|
237
|
+
throw e.error;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return ar;
|
|
241
|
+
}
|
|
242
|
+
/** @deprecated */
|
|
243
|
+
function __spread() {
|
|
244
|
+
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
245
|
+
ar = ar.concat(__read(arguments[i]));
|
|
246
|
+
return ar;
|
|
247
|
+
}
|
|
248
|
+
/** @deprecated */
|
|
249
|
+
function __spreadArrays() {
|
|
250
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
251
|
+
s += arguments[i].length;
|
|
252
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
253
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
254
|
+
r[k] = a[j];
|
|
255
|
+
return r;
|
|
256
|
+
}
|
|
257
|
+
function __spreadArray(to, from, pack) {
|
|
258
|
+
if (pack || arguments.length === 2)
|
|
259
|
+
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
260
|
+
if (ar || !(i in from)) {
|
|
261
|
+
if (!ar)
|
|
262
|
+
ar = Array.prototype.slice.call(from, 0, i);
|
|
263
|
+
ar[i] = from[i];
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
267
|
+
}
|
|
268
|
+
function __await(v) {
|
|
269
|
+
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
270
|
+
}
|
|
271
|
+
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
272
|
+
if (!Symbol.asyncIterator)
|
|
273
|
+
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
274
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
275
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
276
|
+
function verb(n) { if (g[n])
|
|
277
|
+
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
278
|
+
function resume(n, v) { try {
|
|
279
|
+
step(g[n](v));
|
|
280
|
+
}
|
|
281
|
+
catch (e) {
|
|
282
|
+
settle(q[0][3], e);
|
|
283
|
+
} }
|
|
284
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
285
|
+
function fulfill(value) { resume("next", value); }
|
|
286
|
+
function reject(value) { resume("throw", value); }
|
|
287
|
+
function settle(f, v) { if (f(v), q.shift(), q.length)
|
|
288
|
+
resume(q[0][0], q[0][1]); }
|
|
289
|
+
}
|
|
290
|
+
function __asyncDelegator(o) {
|
|
291
|
+
var i, p;
|
|
292
|
+
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
293
|
+
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
|
294
|
+
}
|
|
295
|
+
function __asyncValues(o) {
|
|
296
|
+
if (!Symbol.asyncIterator)
|
|
297
|
+
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
298
|
+
var m = o[Symbol.asyncIterator], i;
|
|
299
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
300
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
301
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
302
|
+
}
|
|
303
|
+
function __makeTemplateObject(cooked, raw) {
|
|
304
|
+
if (Object.defineProperty) {
|
|
305
|
+
Object.defineProperty(cooked, "raw", { value: raw });
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
cooked.raw = raw;
|
|
309
|
+
}
|
|
310
|
+
return cooked;
|
|
311
|
+
}
|
|
312
|
+
;
|
|
313
|
+
var __setModuleDefault = Object.create ? (function (o, v) {
|
|
314
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
315
|
+
}) : function (o, v) {
|
|
316
|
+
o["default"] = v;
|
|
317
|
+
};
|
|
318
|
+
function __importStar(mod) {
|
|
319
|
+
if (mod && mod.__esModule)
|
|
320
|
+
return mod;
|
|
321
|
+
var result = {};
|
|
322
|
+
if (mod != null)
|
|
323
|
+
for (var k in mod)
|
|
324
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
325
|
+
__createBinding(result, mod, k);
|
|
326
|
+
__setModuleDefault(result, mod);
|
|
327
|
+
return result;
|
|
328
|
+
}
|
|
329
|
+
function __importDefault(mod) {
|
|
330
|
+
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
331
|
+
}
|
|
332
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
333
|
+
if (kind === "a" && !f)
|
|
334
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
335
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
336
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
337
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
338
|
+
}
|
|
339
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
340
|
+
if (kind === "m")
|
|
341
|
+
throw new TypeError("Private method is not writable");
|
|
342
|
+
if (kind === "a" && !f)
|
|
343
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
344
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
345
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
346
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
// This file can be replaced during build by using the `fileReplacements` array.
|
|
350
|
+
// `ng build ---prod` replaces `environment.ts` with `environment.prod.ts`.
|
|
351
|
+
// The list of file replacements can be found in `angular.json`.
|
|
352
|
+
var environment = Object.assign({}, window.Envirnment);
|
|
353
|
+
/*
|
|
354
|
+
* In development mode, to ignore zone related error stack frames such as
|
|
355
|
+
* `zone.run`, `zoneDelegate.invokeTask` for easier debugging, you can
|
|
356
|
+
* import the following file, but please comment it out in production mode
|
|
357
|
+
* because it will have performance impact when throw error
|
|
358
|
+
*/
|
|
359
|
+
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
|
|
360
|
+
|
|
361
|
+
var EnvironmentService = /** @class */ (function () {
|
|
362
|
+
function EnvironmentService() {
|
|
363
|
+
}
|
|
364
|
+
EnvironmentService.prototype.getEnvironmentObject = function () {
|
|
365
|
+
return environment;
|
|
366
|
+
};
|
|
367
|
+
EnvironmentService.prototype.getBaseUrl = function () {
|
|
368
|
+
var Url = environment["BBSF_BaseUrl"];
|
|
369
|
+
return Url;
|
|
370
|
+
};
|
|
371
|
+
EnvironmentService.prototype.getApiUrl = function () {
|
|
372
|
+
var Url = environment["BBSF_ApiUrl"];
|
|
373
|
+
return Url;
|
|
374
|
+
};
|
|
375
|
+
EnvironmentService.prototype.getProductionMode = function () {
|
|
376
|
+
var Mode = environment["BBSF_IsProduction"];
|
|
377
|
+
return Mode;
|
|
378
|
+
};
|
|
379
|
+
EnvironmentService.prototype.getIdentityServerUrl = function () {
|
|
380
|
+
var Url = environment["BBSF_IdentityServerUrl"];
|
|
381
|
+
return Url;
|
|
382
|
+
};
|
|
383
|
+
return EnvironmentService;
|
|
384
|
+
}());
|
|
385
|
+
EnvironmentService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function EnvironmentService_Factory() { return new EnvironmentService(); }, token: EnvironmentService, providedIn: "root" });
|
|
386
|
+
EnvironmentService.decorators = [
|
|
387
|
+
{ type: i0.Injectable, args: [{
|
|
388
|
+
providedIn: 'root'
|
|
389
|
+
},] }
|
|
390
|
+
];
|
|
391
|
+
|
|
392
|
+
var AuthService = /** @class */ (function () {
|
|
393
|
+
function AuthService(http, environmentService) {
|
|
394
|
+
var _this = this;
|
|
395
|
+
this.http = http;
|
|
396
|
+
this.environmentService = environmentService;
|
|
397
|
+
// Observable navItem source
|
|
398
|
+
this._authNavStatusSource = new rxjs.BehaviorSubject(false);
|
|
399
|
+
// Observable navItem stream
|
|
400
|
+
this.authNavStatus$ = this._authNavStatusSource.asObservable();
|
|
401
|
+
// Observable navItem source
|
|
402
|
+
this._userSource = new rxjs.Subject();
|
|
403
|
+
this.UserStatus$ = this._userSource.asObservable();
|
|
404
|
+
this.manager = new oidcClient.UserManager({
|
|
405
|
+
authority: this.environmentService.getIdentityServerUrl(),
|
|
406
|
+
client_id: 'angular_spa',
|
|
407
|
+
redirect_uri: this.environmentService.getIdentityServerUrl() + '/Admin/authentication/auth-callback',
|
|
408
|
+
post_logout_redirect_uri: this.environmentService.getBaseUrl(),
|
|
409
|
+
response_type: "id_token token",
|
|
410
|
+
scope: "openid profile email IdentityServerApi",
|
|
411
|
+
filterProtocolClaims: true,
|
|
412
|
+
loadUserInfo: true,
|
|
413
|
+
automaticSilentRenew: true,
|
|
414
|
+
silent_redirect_uri: this.environmentService.getIdentityServerUrl() + '/assets/silent-callback.html',
|
|
415
|
+
userStore: new oidcClient.WebStorageStateStore({ store: window.localStorage })
|
|
416
|
+
});
|
|
417
|
+
this.redirectUrl = "";
|
|
418
|
+
this.manager.getUser().then(function (user) { return __awaiter(_this, void 0, void 0, function () {
|
|
419
|
+
var _a, _b;
|
|
420
|
+
return __generator(this, function (_c) {
|
|
421
|
+
switch (_c.label) {
|
|
422
|
+
case 0:
|
|
423
|
+
this.manager.storeUser(user);
|
|
424
|
+
AuthService.user = user;
|
|
425
|
+
this.user = user;
|
|
426
|
+
_b = (_a = this._authNavStatusSource).next;
|
|
427
|
+
return [4 /*yield*/, this.isAuthenticated()];
|
|
428
|
+
case 1:
|
|
429
|
+
_b.apply(_a, [_c.sent()]);
|
|
430
|
+
return [2 /*return*/];
|
|
431
|
+
}
|
|
432
|
+
});
|
|
433
|
+
}); });
|
|
434
|
+
this.manager.events.addAccessTokenExpired(function (_) {
|
|
435
|
+
_this._authNavStatusSource.next(false);
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
AuthService.prototype.login = function () {
|
|
439
|
+
return this.manager.signinRedirect();
|
|
440
|
+
};
|
|
441
|
+
AuthService.prototype.getUser = function () {
|
|
442
|
+
var _this = this;
|
|
443
|
+
this.manager.getUser().then(function (user) { return __awaiter(_this, void 0, void 0, function () {
|
|
444
|
+
var _a, _b;
|
|
445
|
+
return __generator(this, function (_c) {
|
|
446
|
+
switch (_c.label) {
|
|
447
|
+
case 0:
|
|
448
|
+
;
|
|
449
|
+
AuthService.user = user;
|
|
450
|
+
this.user = user;
|
|
451
|
+
_b = (_a = this._authNavStatusSource).next;
|
|
452
|
+
return [4 /*yield*/, this.isAuthenticated()];
|
|
453
|
+
case 1:
|
|
454
|
+
_b.apply(_a, [_c.sent()]);
|
|
455
|
+
return [2 /*return*/];
|
|
456
|
+
}
|
|
457
|
+
});
|
|
458
|
+
}); });
|
|
459
|
+
};
|
|
460
|
+
AuthService.prototype.storUser = function (User) {
|
|
461
|
+
this.manager.storeUser(User);
|
|
462
|
+
};
|
|
463
|
+
AuthService.prototype.revokeAccessToken = function () {
|
|
464
|
+
this.manager.revokeAccessToken();
|
|
465
|
+
};
|
|
466
|
+
AuthService.prototype.signinSilent = function () {
|
|
467
|
+
var x = this.manager.signinSilentCallback();
|
|
468
|
+
x.then(function (s) {
|
|
469
|
+
//console.log(s)
|
|
470
|
+
});
|
|
471
|
+
};
|
|
472
|
+
AuthService.prototype.completeAuthentication = function () {
|
|
473
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
474
|
+
var _a, _b, _c;
|
|
475
|
+
return __generator(this, function (_d) {
|
|
476
|
+
switch (_d.label) {
|
|
477
|
+
case 0:
|
|
478
|
+
_a = this;
|
|
479
|
+
return [4 /*yield*/, this.manager.signinRedirectCallback()];
|
|
480
|
+
case 1:
|
|
481
|
+
_a.user = _d.sent();
|
|
482
|
+
AuthService.user = this.user;
|
|
483
|
+
this._userSource.next(AuthService.user);
|
|
484
|
+
_c = (_b = this._authNavStatusSource).next;
|
|
485
|
+
return [4 /*yield*/, this.isAuthenticated()];
|
|
486
|
+
case 2:
|
|
487
|
+
_c.apply(_b, [_d.sent()]);
|
|
488
|
+
return [2 /*return*/];
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
});
|
|
492
|
+
};
|
|
493
|
+
AuthService.prototype.refreshToken = function (token) {
|
|
494
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
495
|
+
var httpOptions;
|
|
496
|
+
var _this = this;
|
|
497
|
+
return __generator(this, function (_a) {
|
|
498
|
+
switch (_a.label) {
|
|
499
|
+
case 0:
|
|
500
|
+
httpOptions = {
|
|
501
|
+
headers: new i1.HttpHeaders({
|
|
502
|
+
'Content-Type': 'application/json',
|
|
503
|
+
'Authorization': token
|
|
504
|
+
})
|
|
505
|
+
};
|
|
506
|
+
this.manager.revokeAccessToken();
|
|
507
|
+
return [4 /*yield*/, this.http.post(this.environmentService.getIdentityServerUrl() + "/users/refresh-token", httpOptions, { withCredentials: true }).subscribe(function (user) {
|
|
508
|
+
_this._userSource.next(user);
|
|
509
|
+
AuthService.user = user;
|
|
510
|
+
_this.user = user;
|
|
511
|
+
})];
|
|
512
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
});
|
|
516
|
+
};
|
|
517
|
+
AuthService.prototype.getCurrentUser = function () {
|
|
518
|
+
return this.manager.getUser();
|
|
519
|
+
};
|
|
520
|
+
AuthService.prototype.isAuthenticated = function (allowedPermission) {
|
|
521
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
522
|
+
var user, isUserInRole;
|
|
523
|
+
return __generator(this, function (_a) {
|
|
524
|
+
switch (_a.label) {
|
|
525
|
+
case 0: return [4 /*yield*/, this.manager.getUser().then(function (user) {
|
|
526
|
+
return user;
|
|
527
|
+
})];
|
|
528
|
+
case 1:
|
|
529
|
+
user = _a.sent();
|
|
530
|
+
if (allowedPermission != null && allowedPermission != undefined) {
|
|
531
|
+
if (allowedPermission.length == 0) {
|
|
532
|
+
return [2 /*return*/, this.user != null && !this.user.expired];
|
|
533
|
+
}
|
|
534
|
+
else {
|
|
535
|
+
isUserInRole = this.isUserInRole(allowedPermission);
|
|
536
|
+
return [2 /*return*/, this.user != null && !this.user.expired && isUserInRole];
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
else
|
|
540
|
+
return [2 /*return*/, this.user != null && !this.user.expired];
|
|
541
|
+
return [2 /*return*/];
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
});
|
|
545
|
+
};
|
|
546
|
+
AuthService.prototype.isUserInRole = function (allowedPermission) {
|
|
547
|
+
;
|
|
548
|
+
var permissionSetSID = this.user.profile["permissionSetSID"].split(templateObject_1 || (templateObject_1 = __makeTemplateObject([","], [","]))).map(function (x) { return +x; });
|
|
549
|
+
return allowedPermission.every(function (i) { return permissionSetSID.includes(i); });
|
|
550
|
+
};
|
|
551
|
+
AuthService.prototype.authorizationHeaderValue = function () {
|
|
552
|
+
return AuthService.user.token_type + " " + AuthService.user.access_token;
|
|
553
|
+
};
|
|
554
|
+
AuthService.prototype.name = function () {
|
|
555
|
+
return AuthService.user != null ? AuthService.user.profile.given_name : '';
|
|
556
|
+
};
|
|
557
|
+
AuthService.prototype.setUrl = function (url) {
|
|
558
|
+
localStorage.setItem("redirectUrl", url);
|
|
559
|
+
};
|
|
560
|
+
AuthService.prototype.getUrl = function () {
|
|
561
|
+
return localStorage.getItem("redirectUrl");
|
|
562
|
+
};
|
|
563
|
+
AuthService.prototype.signinSilentCallback = function () {
|
|
564
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
565
|
+
var user;
|
|
566
|
+
return __generator(this, function (_a) {
|
|
567
|
+
switch (_a.label) {
|
|
568
|
+
case 0: return [4 /*yield*/, this.manager.signinSilentCallback()];
|
|
569
|
+
case 1:
|
|
570
|
+
user = _a.sent();
|
|
571
|
+
//await this.manager.storeUser(user);
|
|
572
|
+
AuthService.user = user;
|
|
573
|
+
console.log("Token from signinSilentCallback :" + AuthService.user);
|
|
574
|
+
this.user = user;
|
|
575
|
+
return [2 /*return*/];
|
|
576
|
+
}
|
|
577
|
+
});
|
|
578
|
+
});
|
|
579
|
+
};
|
|
580
|
+
AuthService.prototype.signout = function () {
|
|
581
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
582
|
+
return __generator(this, function (_a) {
|
|
583
|
+
switch (_a.label) {
|
|
584
|
+
case 0:
|
|
585
|
+
localStorage.clear();
|
|
586
|
+
return [4 /*yield*/, this.manager.signoutRedirect()];
|
|
587
|
+
case 1:
|
|
588
|
+
_a.sent();
|
|
589
|
+
return [2 /*return*/];
|
|
590
|
+
}
|
|
591
|
+
});
|
|
592
|
+
});
|
|
593
|
+
};
|
|
594
|
+
return AuthService;
|
|
595
|
+
}());
|
|
596
|
+
AuthService.user = null;
|
|
597
|
+
AuthService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function AuthService_Factory() { return new AuthService(i0__namespace.ɵɵinject(i1__namespace.HttpClient), i0__namespace.ɵɵinject(EnvironmentService)); }, token: AuthService, providedIn: "root" });
|
|
598
|
+
AuthService.decorators = [
|
|
599
|
+
{ type: i0.Injectable, args: [{
|
|
600
|
+
providedIn: 'root'
|
|
601
|
+
},] }
|
|
602
|
+
];
|
|
603
|
+
AuthService.ctorParameters = function () { return [
|
|
604
|
+
{ type: i1.HttpClient },
|
|
605
|
+
{ type: EnvironmentService }
|
|
606
|
+
]; };
|
|
607
|
+
var templateObject_1;
|
|
608
|
+
|
|
609
|
+
var BBSFTranslateService = /** @class */ (function (_super) {
|
|
610
|
+
__extends(BBSFTranslateService, _super);
|
|
611
|
+
function BBSFTranslateService() {
|
|
612
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
613
|
+
}
|
|
614
|
+
return BBSFTranslateService;
|
|
615
|
+
}(i1$1.TranslateService));
|
|
616
|
+
BBSFTranslateService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function BBSFTranslateService_Factory() { return new BBSFTranslateService(i0__namespace.ɵɵinject(i1__namespace$1.TranslateStore), i0__namespace.ɵɵinject(i1__namespace$1.TranslateLoader), i0__namespace.ɵɵinject(i1__namespace$1.TranslateCompiler), i0__namespace.ɵɵinject(i1__namespace$1.TranslateParser), i0__namespace.ɵɵinject(i1__namespace$1.MissingTranslationHandler), i0__namespace.ɵɵinject(i1__namespace$1.USE_DEFAULT_LANG), i0__namespace.ɵɵinject(i1__namespace$1.USE_STORE), i0__namespace.ɵɵinject(i1__namespace$1.USE_EXTEND), i0__namespace.ɵɵinject(i1__namespace$1.DEFAULT_LANGUAGE)); }, token: BBSFTranslateService, providedIn: "root" });
|
|
617
|
+
BBSFTranslateService.decorators = [
|
|
618
|
+
{ type: i0.Injectable, args: [{
|
|
619
|
+
providedIn: 'root'
|
|
620
|
+
},] }
|
|
621
|
+
];
|
|
622
|
+
|
|
623
|
+
var UtilityService = /** @class */ (function () {
|
|
624
|
+
function UtilityService(Translator, authService) {
|
|
625
|
+
this.Translator = Translator;
|
|
626
|
+
this.authService = authService;
|
|
627
|
+
this.isCreatedBefore = false;
|
|
628
|
+
}
|
|
629
|
+
UtilityService.prototype.getResourceValue = function (Key) {
|
|
630
|
+
var ResourceValue = "";
|
|
631
|
+
this.Translator.get(Key).subscribe(function (data) { ResourceValue = data; return ResourceValue; });
|
|
632
|
+
return ResourceValue;
|
|
633
|
+
};
|
|
634
|
+
UtilityService.prototype.getCurrentLanguage = function () {
|
|
635
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
636
|
+
var user;
|
|
637
|
+
return __generator(this, function (_a) {
|
|
638
|
+
switch (_a.label) {
|
|
639
|
+
case 0: return [4 /*yield*/, this.authService.getCurrentUser().then(function (user) {
|
|
640
|
+
return user;
|
|
641
|
+
})];
|
|
642
|
+
case 1:
|
|
643
|
+
user = _a.sent();
|
|
644
|
+
return [2 /*return*/, user.profile.locale];
|
|
645
|
+
}
|
|
646
|
+
});
|
|
647
|
+
});
|
|
648
|
+
};
|
|
649
|
+
UtilityService.prototype.isCurrentLanguageEnglish = function () {
|
|
650
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
651
|
+
return __generator(this, function (_a) {
|
|
652
|
+
switch (_a.label) {
|
|
653
|
+
case 0: return [4 /*yield*/, this.getCurrentLanguage()];
|
|
654
|
+
case 1:
|
|
655
|
+
(_a.sent()) == "en" ? true : false;
|
|
656
|
+
return [2 /*return*/];
|
|
657
|
+
}
|
|
658
|
+
});
|
|
659
|
+
});
|
|
660
|
+
};
|
|
661
|
+
UtilityService.prototype.isCurrentLanguageArabic = function () {
|
|
662
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
663
|
+
return __generator(this, function (_a) {
|
|
664
|
+
switch (_a.label) {
|
|
665
|
+
case 0: return [4 /*yield*/, this.getCurrentLanguage()];
|
|
666
|
+
case 1:
|
|
667
|
+
(_a.sent()) == "ar" ? true : false;
|
|
668
|
+
return [2 /*return*/];
|
|
669
|
+
}
|
|
670
|
+
});
|
|
671
|
+
});
|
|
672
|
+
};
|
|
673
|
+
UtilityService.prototype.notifySuccessMessage = function (Message, title, time) {
|
|
674
|
+
var MessageTemplate = this.getResourceValue("SuccessMessage");
|
|
675
|
+
var titleTemplate = this.getResourceValue("Success");
|
|
676
|
+
if (Message) {
|
|
677
|
+
MessageTemplate = Message;
|
|
678
|
+
}
|
|
679
|
+
if (title) {
|
|
680
|
+
titleTemplate = title;
|
|
681
|
+
}
|
|
682
|
+
var toaster = exports.AppInjector.get(ngxToastr.ToastrService);
|
|
683
|
+
toaster.success(MessageTemplate, titleTemplate);
|
|
684
|
+
};
|
|
685
|
+
UtilityService.prototype.notifyErrorMessage = function (Message, title, time) {
|
|
686
|
+
var MessageTemplate = this.getResourceValue("ErrorMessage");
|
|
687
|
+
var titleTemplate = this.getResourceValue("Error");
|
|
688
|
+
if (Message) {
|
|
689
|
+
MessageTemplate = Message;
|
|
690
|
+
}
|
|
691
|
+
if (title) {
|
|
692
|
+
titleTemplate = title;
|
|
693
|
+
}
|
|
694
|
+
var toaster = exports.AppInjector.get(ngxToastr.ToastrService);
|
|
695
|
+
toaster.error(MessageTemplate, titleTemplate);
|
|
696
|
+
};
|
|
697
|
+
UtilityService.prototype.notifyWarningMessage = function (Message, title, time) {
|
|
698
|
+
var MessageTemplate = this.getResourceValue("WarningMessage");
|
|
699
|
+
var titleTemplate = this.getResourceValue("Warning");
|
|
700
|
+
if (Message) {
|
|
701
|
+
MessageTemplate = Message;
|
|
702
|
+
}
|
|
703
|
+
if (title) {
|
|
704
|
+
titleTemplate = title;
|
|
705
|
+
}
|
|
706
|
+
var toaster = exports.AppInjector.get(ngxToastr.ToastrService);
|
|
707
|
+
toaster.warning(MessageTemplate, titleTemplate);
|
|
708
|
+
};
|
|
709
|
+
UtilityService.prototype.startBlockUI = function () {
|
|
710
|
+
this.blockUI.start();
|
|
711
|
+
};
|
|
712
|
+
UtilityService.prototype.stopBlockUI = function () {
|
|
713
|
+
this.blockUI.stop();
|
|
714
|
+
};
|
|
715
|
+
return UtilityService;
|
|
716
|
+
}());
|
|
717
|
+
UtilityService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function UtilityService_Factory() { return new UtilityService(i0__namespace.ɵɵinject(BBSFTranslateService), i0__namespace.ɵɵinject(AuthService)); }, token: UtilityService, providedIn: "root" });
|
|
718
|
+
UtilityService.decorators = [
|
|
719
|
+
{ type: i0.Injectable, args: [{
|
|
720
|
+
providedIn: 'root'
|
|
721
|
+
},] }
|
|
722
|
+
];
|
|
723
|
+
UtilityService.ctorParameters = function () { return [
|
|
724
|
+
{ type: BBSFTranslateService },
|
|
725
|
+
{ type: AuthService }
|
|
726
|
+
]; };
|
|
727
|
+
__decorate([
|
|
728
|
+
ngBlockUi.BlockUI()
|
|
729
|
+
], UtilityService.prototype, "blockUI", void 0);
|
|
730
|
+
|
|
731
|
+
var RequestOptionsModel = /** @class */ (function () {
|
|
732
|
+
function RequestOptionsModel() {
|
|
733
|
+
this.disableSuccessNotification = false;
|
|
734
|
+
this.disableBlockUI = false;
|
|
735
|
+
this.responseType = "";
|
|
736
|
+
this.formGroup = null;
|
|
737
|
+
}
|
|
738
|
+
return RequestOptionsModel;
|
|
739
|
+
}());
|
|
740
|
+
|
|
741
|
+
var ControlValidationService = /** @class */ (function () {
|
|
742
|
+
function ControlValidationService(utilityService) {
|
|
743
|
+
this.utilityService = utilityService;
|
|
744
|
+
this.requestOptions = new RequestOptionsModel();
|
|
745
|
+
this.isCreatedBefor = false;
|
|
746
|
+
}
|
|
747
|
+
ControlValidationService.prototype.showGlobalError = function (errorMessage) {
|
|
748
|
+
var globalErorrElement = document.getElementsByClassName('alert alert-danger alert-InvalidValidation');
|
|
749
|
+
if (globalErorrElement.length > 0) {
|
|
750
|
+
this.removeElementsByClass('alert alert-danger alert-InvalidValidation');
|
|
751
|
+
}
|
|
752
|
+
if (this.isCreatedBefor == true) {
|
|
753
|
+
this.removeElementsByClass('alert alert-danger alert-InvalidValidation');
|
|
754
|
+
}
|
|
755
|
+
// tslint:disable-next-line: prefer-const
|
|
756
|
+
var objects = document.querySelectorAll('form.ng-invalid.ng-touched');
|
|
757
|
+
var tagName = 'div';
|
|
758
|
+
// tslint:disable-next-line: prefer-const
|
|
759
|
+
var elementToAppend = document.createElement(tagName); // Your tag name here
|
|
760
|
+
var message = "";
|
|
761
|
+
if (localStorage.getItem('language') == "ar")
|
|
762
|
+
message = errorMessage ? errorMessage : "لديك بعص الأخطاء . من فضلك قم بالمراجعه ";
|
|
763
|
+
else
|
|
764
|
+
message = errorMessage ? errorMessage : "You have some validation errors. Please check below";
|
|
765
|
+
elementToAppend.innerHTML = "<ul><li>" + message + "</li></ul>";
|
|
766
|
+
elementToAppend.className += 'alert alert-danger alert-InvalidValidation';
|
|
767
|
+
elementToAppend.id += 'errorId';
|
|
768
|
+
// tslint:disable-next-line: prefer-for-of
|
|
769
|
+
for (var i = 0; i < objects.length; i++) {
|
|
770
|
+
// const elementToAppen = elementToAppend.cloneNode(true);
|
|
771
|
+
// objects[i].insertBefore(elementToAppen, objects[i].firstChild);
|
|
772
|
+
var elementToAppen = elementToAppend.cloneNode(true);
|
|
773
|
+
var targetElement = objects[i].getElementsByClassName("b-control")[0];
|
|
774
|
+
targetElement.parentNode.insertBefore(elementToAppen, targetElement);
|
|
775
|
+
this.isCreatedBefor = true;
|
|
776
|
+
break;
|
|
777
|
+
}
|
|
778
|
+
};
|
|
779
|
+
ControlValidationService.prototype.RemoveGlobalError = function () {
|
|
780
|
+
var removedList = document.getElementsByClassName('alert alert-danger alert-InvalidValidation');
|
|
781
|
+
// tslint:disable-next-line: prefer-for-of
|
|
782
|
+
for (var index = 0; index < removedList.length; index++) {
|
|
783
|
+
var element = removedList[index];
|
|
784
|
+
element.remove();
|
|
785
|
+
}
|
|
786
|
+
this.isCreatedBefor = false;
|
|
787
|
+
};
|
|
788
|
+
ControlValidationService.prototype.showInputErro = function (errors) {
|
|
789
|
+
var e_1, _a;
|
|
790
|
+
// show error on top of form
|
|
791
|
+
this.showGlobalError();
|
|
792
|
+
// remove old error from server
|
|
793
|
+
this.removeElementsByClass('errortemplet');
|
|
794
|
+
// Looping in error Object
|
|
795
|
+
for (var key in errors) {
|
|
796
|
+
if (errors.hasOwnProperty(key)) {
|
|
797
|
+
try {
|
|
798
|
+
for (var _b = (e_1 = void 0, __values(errors[key])), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
799
|
+
var iterator = _c.value;
|
|
800
|
+
var input = document.querySelectorAll('[ng-reflect-name=' + key + ']')[0];
|
|
801
|
+
if (input.attributes['ng-reflect-name'].value === key) {
|
|
802
|
+
this.removeElementsByClass('erroclass-' + key);
|
|
803
|
+
var tagName = 'p';
|
|
804
|
+
var elementToAppend = document.createElement(tagName); // Your tag name here
|
|
805
|
+
elementToAppend.innerHTML = iterator;
|
|
806
|
+
elementToAppend.style.color = 'red';
|
|
807
|
+
elementToAppend.className += 'errortemplet erroclass-' + key;
|
|
808
|
+
var elementToappen = elementToAppend.cloneNode(true);
|
|
809
|
+
input.parentNode.insertBefore(elementToappen, input.lastChild);
|
|
810
|
+
break;
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
815
|
+
finally {
|
|
816
|
+
try {
|
|
817
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
818
|
+
}
|
|
819
|
+
finally { if (e_1) throw e_1.error; }
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
};
|
|
824
|
+
ControlValidationService.prototype.removeElementsByClass = function (className) {
|
|
825
|
+
var elements = document.getElementsByClassName(className);
|
|
826
|
+
while (elements.length > 0) {
|
|
827
|
+
elements[0].parentNode.removeChild(elements[0]);
|
|
828
|
+
}
|
|
829
|
+
};
|
|
830
|
+
ControlValidationService.prototype.renderServerErrors = function (form, err, requestOptions) {
|
|
831
|
+
var _this = this;
|
|
832
|
+
if (err.error == null) {
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
this.requestOptions = requestOptions;
|
|
836
|
+
err.error.validation_errors.forEach(function (element) {
|
|
837
|
+
var fieldName = element.field;
|
|
838
|
+
var controlName = element.control_name;
|
|
839
|
+
var message = element.message;
|
|
840
|
+
if (form == null) {
|
|
841
|
+
_this.requestOptions.customErrorMessage ? _this.utilityService.notifyErrorMessage(_this.requestOptions.customErrorMessage) : _this.utilityService.notifyErrorMessage(fieldName + ": " + message);
|
|
842
|
+
}
|
|
843
|
+
else if (!_this.hasControlName(form, controlName)) {
|
|
844
|
+
_this.showGlobalError(fieldName + ": " + message);
|
|
845
|
+
}
|
|
846
|
+
else {
|
|
847
|
+
_this.setFieldError(form, controlName, fieldName, message);
|
|
848
|
+
}
|
|
849
|
+
});
|
|
850
|
+
};
|
|
851
|
+
ControlValidationService.prototype.hasControlName = function (form, controlName) {
|
|
852
|
+
var control = form.get(controlName);
|
|
853
|
+
return control != null;
|
|
854
|
+
};
|
|
855
|
+
ControlValidationService.prototype.setFieldError = function (form, controlName, fieldName, message) {
|
|
856
|
+
var _a;
|
|
857
|
+
var control = form.get(controlName);
|
|
858
|
+
var errors = (_a = {}, _a[message] = true, _a);
|
|
859
|
+
var fieldNameArray = fieldName.split('.');
|
|
860
|
+
if (fieldNameArray.length >= 1) {
|
|
861
|
+
switch (fieldNameArray[length - 1].toLocaleLowerCase()) {
|
|
862
|
+
case "english":
|
|
863
|
+
var englishControl = control.get("EnglishValue");
|
|
864
|
+
englishControl.setErrors(errors);
|
|
865
|
+
englishControl.markAsTouched();
|
|
866
|
+
englishControl.updateValueAndValidity();
|
|
867
|
+
break;
|
|
868
|
+
case "arabic":
|
|
869
|
+
var arabicControl = control.get("ArabicValue");
|
|
870
|
+
arabicControl.setErrors(errors);
|
|
871
|
+
arabicControl.markAsTouched();
|
|
872
|
+
arabicControl.updateValueAndValidity();
|
|
873
|
+
break;
|
|
874
|
+
default:
|
|
875
|
+
control.setErrors(errors);
|
|
876
|
+
control.markAsTouched();
|
|
877
|
+
control.updateValueAndValidity();
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
else {
|
|
881
|
+
this.requestOptions.customErrorMessage ? this.utilityService.notifyErrorMessage(this.requestOptions.customErrorMessage) : this.utilityService.notifyErrorMessage(fieldName + ": " + message);
|
|
882
|
+
}
|
|
883
|
+
};
|
|
884
|
+
return ControlValidationService;
|
|
885
|
+
}());
|
|
886
|
+
ControlValidationService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function ControlValidationService_Factory() { return new ControlValidationService(i0__namespace.ɵɵinject(UtilityService)); }, token: ControlValidationService, providedIn: "root" });
|
|
887
|
+
ControlValidationService.decorators = [
|
|
888
|
+
{ type: i0.Injectable, args: [{
|
|
889
|
+
providedIn: 'root'
|
|
890
|
+
},] }
|
|
891
|
+
];
|
|
892
|
+
ControlValidationService.ctorParameters = function () { return [
|
|
893
|
+
{ type: UtilityService }
|
|
894
|
+
]; };
|
|
895
|
+
__decorate([
|
|
896
|
+
ngBlockUi.BlockUI()
|
|
897
|
+
], ControlValidationService.prototype, "blockUI", void 0);
|
|
898
|
+
|
|
899
|
+
var RequestHandlerService = /** @class */ (function () {
|
|
900
|
+
function RequestHandlerService(http, authService, environmentService, utilityService, controlValidationService, bbsfTranslateService) {
|
|
901
|
+
var _this = this;
|
|
902
|
+
this.http = http;
|
|
903
|
+
this.authService = authService;
|
|
904
|
+
this.environmentService = environmentService;
|
|
905
|
+
this.utilityService = utilityService;
|
|
906
|
+
this.controlValidationService = controlValidationService;
|
|
907
|
+
this.bbsfTranslateService = bbsfTranslateService;
|
|
908
|
+
this.requestOptions = new RequestOptionsModel();
|
|
909
|
+
this.currentLanguage = "";
|
|
910
|
+
this.onDestroy$ = new rxjs.Subject();
|
|
911
|
+
//using localStorage to avoid call getCurrentLanguage() because it is not all to use async in constructor
|
|
912
|
+
this.currentLanguage = localStorage.getItem('language');
|
|
913
|
+
this.bbsfTranslateService.onLangChange.subscribe(function (event) {
|
|
914
|
+
if (_this.currentLanguage != event.lang) {
|
|
915
|
+
_this.currentLanguage = event.lang;
|
|
916
|
+
}
|
|
917
|
+
});
|
|
918
|
+
}
|
|
919
|
+
RequestHandlerService.prototype.get = function (Url, params, requestOptions) {
|
|
920
|
+
var _this = this;
|
|
921
|
+
if (requestOptions)
|
|
922
|
+
this.requestOptions = requestOptions;
|
|
923
|
+
var headers = new i1.HttpHeaders({
|
|
924
|
+
'Content-Type': 'application/json',
|
|
925
|
+
'Authorization': this.authService.authorizationHeaderValue(),
|
|
926
|
+
});
|
|
927
|
+
headers = headers.set('Accept-Language', this.currentLanguage.toString());
|
|
928
|
+
if (!this.requestOptions.disableBlockUI)
|
|
929
|
+
this.utilityService.startBlockUI();
|
|
930
|
+
return this.http.get(this.environmentService.getApiUrl() + Url, { headers: headers, params: params }).pipe(operators.takeUntil(this.onDestroy$), operators.tap(function (result) {
|
|
931
|
+
if (!_this.requestOptions.disableBlockUI)
|
|
932
|
+
_this.utilityService.stopBlockUI();
|
|
933
|
+
}));
|
|
934
|
+
};
|
|
935
|
+
RequestHandlerService.prototype.post = function (Url, model, params, requestOptions) {
|
|
936
|
+
var _this = this;
|
|
937
|
+
if (requestOptions)
|
|
938
|
+
this.requestOptions = requestOptions;
|
|
939
|
+
var headers = new i1.HttpHeaders({
|
|
940
|
+
'Content-Type': 'application/json',
|
|
941
|
+
'Authorization': this.authService.authorizationHeaderValue(),
|
|
942
|
+
});
|
|
943
|
+
headers = headers.set('Accept-Language', this.currentLanguage.toString());
|
|
944
|
+
if (!this.requestOptions.disableBlockUI)
|
|
945
|
+
this.utilityService.startBlockUI();
|
|
946
|
+
return this.http.post(this.environmentService.getApiUrl() + Url, model, { headers: headers, params: params, responseType: this.requestOptions.responseType }).pipe(operators.takeUntil(this.onDestroy$), operators.tap(function (result) {
|
|
947
|
+
if (!_this.requestOptions.disableBlockUI)
|
|
948
|
+
_this.utilityService.stopBlockUI();
|
|
949
|
+
}));
|
|
950
|
+
};
|
|
951
|
+
RequestHandlerService.prototype.destroyHandler = function () {
|
|
952
|
+
this.onDestroy$.next();
|
|
953
|
+
};
|
|
954
|
+
return RequestHandlerService;
|
|
955
|
+
}());
|
|
956
|
+
RequestHandlerService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function RequestHandlerService_Factory() { return new RequestHandlerService(i0__namespace.ɵɵinject(i1__namespace.HttpClient), i0__namespace.ɵɵinject(AuthService), i0__namespace.ɵɵinject(EnvironmentService), i0__namespace.ɵɵinject(UtilityService), i0__namespace.ɵɵinject(ControlValidationService), i0__namespace.ɵɵinject(BBSFTranslateService)); }, token: RequestHandlerService, providedIn: "root" });
|
|
957
|
+
RequestHandlerService.decorators = [
|
|
958
|
+
{ type: i0.Injectable, args: [{
|
|
959
|
+
providedIn: 'root'
|
|
960
|
+
},] }
|
|
961
|
+
];
|
|
962
|
+
RequestHandlerService.ctorParameters = function () { return [
|
|
963
|
+
{ type: i1.HttpClient },
|
|
964
|
+
{ type: AuthService },
|
|
965
|
+
{ type: EnvironmentService },
|
|
966
|
+
{ type: UtilityService },
|
|
967
|
+
{ type: ControlValidationService },
|
|
968
|
+
{ type: BBSFTranslateService }
|
|
969
|
+
]; };
|
|
970
|
+
|
|
971
|
+
var StylesBundleService = /** @class */ (function () {
|
|
972
|
+
function StylesBundleService(document) {
|
|
973
|
+
this.document = document;
|
|
974
|
+
}
|
|
975
|
+
StylesBundleService.prototype.loadThemes = function (lang, bundleEnglishName, bundleArabicName) {
|
|
976
|
+
if (lang == "ar") {
|
|
977
|
+
this.loadStyleBundle(bundleArabicName.toString());
|
|
978
|
+
document.querySelector('html').setAttribute("lang", "ar");
|
|
979
|
+
document.querySelector('html').setAttribute("dir", "rtl");
|
|
980
|
+
}
|
|
981
|
+
else {
|
|
982
|
+
this.loadStyleBundle(bundleEnglishName.toString());
|
|
983
|
+
document.querySelector('html').setAttribute("lang", "en");
|
|
984
|
+
document.querySelector('html').setAttribute("dir", "ltr");
|
|
985
|
+
}
|
|
986
|
+
};
|
|
987
|
+
StylesBundleService.prototype.loadStyleBundle = function (styleName) {
|
|
988
|
+
var head = this.document.getElementsByTagName('head')[0];
|
|
989
|
+
var themeLink = this.document.getElementById('client-theme');
|
|
990
|
+
if (themeLink && themeLink.href.includes(styleName)) {
|
|
991
|
+
return;
|
|
992
|
+
}
|
|
993
|
+
else if (themeLink && !themeLink.href.includes(styleName)) {
|
|
994
|
+
themeLink.remove();
|
|
995
|
+
}
|
|
996
|
+
var style = this.document.createElement('link');
|
|
997
|
+
style.id = 'client-theme';
|
|
998
|
+
style.rel = 'stylesheet';
|
|
999
|
+
style.href = "" + styleName;
|
|
1000
|
+
head.appendChild(style);
|
|
1001
|
+
};
|
|
1002
|
+
return StylesBundleService;
|
|
1003
|
+
}());
|
|
1004
|
+
StylesBundleService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function StylesBundleService_Factory() { return new StylesBundleService(i0__namespace.ɵɵinject(i1__namespace$2.DOCUMENT)); }, token: StylesBundleService, providedIn: "root" });
|
|
1005
|
+
StylesBundleService.decorators = [
|
|
1006
|
+
{ type: i0.Injectable, args: [{
|
|
1007
|
+
providedIn: 'root'
|
|
1008
|
+
},] }
|
|
1009
|
+
];
|
|
1010
|
+
StylesBundleService.ctorParameters = function () { return [
|
|
1011
|
+
{ type: Document, decorators: [{ type: i0.Inject, args: [i1$2.DOCUMENT,] }] }
|
|
1012
|
+
]; };
|
|
1013
|
+
|
|
1014
|
+
var MasterLayoutService = /** @class */ (function () {
|
|
1015
|
+
function MasterLayoutService(router, http, authService, stylesBundleService, translate) {
|
|
1016
|
+
this.router = router;
|
|
1017
|
+
this.http = http;
|
|
1018
|
+
this.authService = authService;
|
|
1019
|
+
this.stylesBundleService = stylesBundleService;
|
|
1020
|
+
this.translate = translate;
|
|
1021
|
+
this.ApiUrl = "/api/admin/Users/";
|
|
1022
|
+
}
|
|
1023
|
+
MasterLayoutService.prototype.switchLang = function (lang, bundleEnglishName, bundleArabicName) {
|
|
1024
|
+
var _this = this;
|
|
1025
|
+
this.changeLanguage(lang).subscribe(function (result) {
|
|
1026
|
+
_this.updateUserInfo().subscribe(function (Value) {
|
|
1027
|
+
var UserInfoObject = Value;
|
|
1028
|
+
_this.authService.getUser();
|
|
1029
|
+
_this.authService.user.profile = Object.assign(_this.authService.user.profile, UserInfoObject);
|
|
1030
|
+
_this.authService.storUser(_this.authService.user);
|
|
1031
|
+
_this.stylesBundleService.loadThemes(lang, bundleEnglishName, bundleArabicName);
|
|
1032
|
+
localStorage.setItem('language', lang);
|
|
1033
|
+
_this.translate.use(lang);
|
|
1034
|
+
});
|
|
1035
|
+
});
|
|
1036
|
+
};
|
|
1037
|
+
MasterLayoutService.prototype.reloadComponent = function () {
|
|
1038
|
+
var currentUrl = this.router.url;
|
|
1039
|
+
this.router.routeReuseStrategy.shouldReuseRoute = function () { return false; };
|
|
1040
|
+
this.router.onSameUrlNavigation = 'reload';
|
|
1041
|
+
this.router.navigate([currentUrl]);
|
|
1042
|
+
};
|
|
1043
|
+
MasterLayoutService.prototype.changeLanguage = function (key) {
|
|
1044
|
+
var params = new i1.HttpParams();
|
|
1045
|
+
params = params.append("UserId", this.authService.user.profile.id);
|
|
1046
|
+
params = params.append("LanguageKey", key);
|
|
1047
|
+
return this.http.post(this.ApiUrl + 'updateLaguage', null, params);
|
|
1048
|
+
};
|
|
1049
|
+
MasterLayoutService.prototype.updateUserInfo = function () {
|
|
1050
|
+
return this.http.get('/connect/userinfo');
|
|
1051
|
+
};
|
|
1052
|
+
return MasterLayoutService;
|
|
1053
|
+
}());
|
|
1054
|
+
MasterLayoutService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function MasterLayoutService_Factory() { return new MasterLayoutService(i0__namespace.ɵɵinject(i1__namespace$3.Router), i0__namespace.ɵɵinject(RequestHandlerService), i0__namespace.ɵɵinject(AuthService), i0__namespace.ɵɵinject(StylesBundleService), i0__namespace.ɵɵinject(i1__namespace$1.TranslateService)); }, token: MasterLayoutService, providedIn: "root" });
|
|
1055
|
+
MasterLayoutService.decorators = [
|
|
1056
|
+
{ type: i0.Injectable, args: [{
|
|
1057
|
+
providedIn: 'root'
|
|
1058
|
+
},] }
|
|
1059
|
+
];
|
|
1060
|
+
MasterLayoutService.ctorParameters = function () { return [
|
|
1061
|
+
{ type: i1$3.Router },
|
|
1062
|
+
{ type: RequestHandlerService },
|
|
1063
|
+
{ type: AuthService },
|
|
1064
|
+
{ type: StylesBundleService },
|
|
1065
|
+
{ type: i1$1.TranslateService }
|
|
1066
|
+
]; };
|
|
1067
|
+
|
|
1068
|
+
exports.AppInjector = void 0;
|
|
1069
|
+
var BBSFUtilitiesModule = /** @class */ (function () {
|
|
1070
|
+
function BBSFUtilitiesModule(injector) {
|
|
1071
|
+
this.injector = injector;
|
|
1072
|
+
exports.AppInjector = this.injector;
|
|
1073
|
+
}
|
|
1074
|
+
return BBSFUtilitiesModule;
|
|
1075
|
+
}());
|
|
1076
|
+
BBSFUtilitiesModule.decorators = [
|
|
1077
|
+
{ type: i0.NgModule, args: [{
|
|
1078
|
+
declarations: [],
|
|
1079
|
+
imports: [
|
|
1080
|
+
i1$2.CommonModule,
|
|
1081
|
+
ngBlockUi.BlockUIModule.forRoot(),
|
|
1082
|
+
http.HttpModule,
|
|
1083
|
+
i1$3.RouterModule,
|
|
1084
|
+
ngxToastr.ToastrModule.forRoot(),
|
|
1085
|
+
],
|
|
1086
|
+
exports: [],
|
|
1087
|
+
providers: [
|
|
1088
|
+
UtilityService,
|
|
1089
|
+
EnvironmentService,
|
|
1090
|
+
AuthService,
|
|
1091
|
+
RequestHandlerService,
|
|
1092
|
+
StylesBundleService,
|
|
1093
|
+
i1$1.TranslateService,
|
|
1094
|
+
BBSFTranslateService,
|
|
1095
|
+
ControlValidationService,
|
|
1096
|
+
MasterLayoutService
|
|
1097
|
+
]
|
|
1098
|
+
},] }
|
|
1099
|
+
];
|
|
1100
|
+
BBSFUtilitiesModule.ctorParameters = function () { return [
|
|
1101
|
+
{ type: i0.Injector }
|
|
1102
|
+
]; };
|
|
1103
|
+
|
|
1104
|
+
/*
|
|
1105
|
+
* Public API Surface of bbsf-utilities
|
|
1106
|
+
*/
|
|
1107
|
+
|
|
1108
|
+
/**
|
|
1109
|
+
* Generated bundle index. Do not edit.
|
|
1110
|
+
*/
|
|
1111
|
+
|
|
1112
|
+
exports.AuthService = AuthService;
|
|
1113
|
+
exports.BBSFTranslateService = BBSFTranslateService;
|
|
1114
|
+
exports.BBSFUtilitiesModule = BBSFUtilitiesModule;
|
|
1115
|
+
exports.ControlValidationService = ControlValidationService;
|
|
1116
|
+
exports.EnvironmentService = EnvironmentService;
|
|
1117
|
+
exports.MasterLayoutService = MasterLayoutService;
|
|
1118
|
+
exports.RequestHandlerService = RequestHandlerService;
|
|
1119
|
+
exports.RequestOptionsModel = RequestOptionsModel;
|
|
1120
|
+
exports.StylesBundleService = StylesBundleService;
|
|
1121
|
+
exports.UtilityService = UtilityService;
|
|
1122
|
+
exports.environment = environment;
|
|
1123
|
+
|
|
1124
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1125
|
+
|
|
1126
|
+
}));
|
|
1127
|
+
//# sourceMappingURL=bnsights-bbsf-utilities.umd.js.map
|