@dontdrinkandroot/ngx-extensions 0.1.0 → 0.2.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/{esm2015/dontdrinkandroot-ngx-extensions.js → esm2020/dontdrinkandroot-ngx-extensions.mjs} +0 -0
- package/esm2020/public-api.mjs +24 -0
- package/{esm2015/src/cookie/cookie.service.js → esm2020/src/cookie/cookie.service.mjs} +4 -4
- package/{esm2015/src/ddr-extensions.module.js → esm2020/src/ddr-extensions.module.mjs} +6 -6
- package/{esm2015/src/http/redirect-to-login-interceptor.service.js → esm2020/src/http/redirect-to-login-interceptor.service.mjs} +4 -4
- package/{esm2015/src/http/url-info.js → esm2020/src/http/url-info.mjs} +0 -0
- package/{esm2015/src/http/with-credentials-interceptor.service.js → esm2020/src/http/with-credentials-interceptor.service.mjs} +4 -4
- package/{esm2015/src/image/lazy-image.directive.js → esm2020/src/image/lazy-image.directive.mjs} +4 -4
- package/{esm2015/src/jwt/jwt-interceptor.service.js → esm2020/src/jwt/jwt-interceptor.service.mjs} +4 -4
- package/{esm2015/src/jwt/jwt-refresh-token-interceptor.service.js → esm2020/src/jwt/jwt-refresh-token-interceptor.service.mjs} +4 -4
- package/{esm2015/src/jwt/jwt-token-response.js → esm2020/src/jwt/jwt-token-response.mjs} +0 -0
- package/{esm2015/src/jwt/jwt.service.js → esm2020/src/jwt/jwt.service.mjs} +4 -4
- package/{esm2015/src/methoddecorator/debounce.js → esm2020/src/methoddecorator/debounce.mjs} +0 -0
- package/{esm2015/src/methoddecorator/limit.js → esm2020/src/methoddecorator/limit.mjs} +0 -0
- package/{esm2015/src/scroll/bottom-hit.directive.js → esm2020/src/scroll/bottom-hit.directive.mjs} +4 -4
- package/{esm2015/src/scroll/scroll.service.js → esm2020/src/scroll/scroll.service.mjs} +4 -4
- package/esm2020/src/util/collection-utils.mjs +27 -0
- package/{esm2015/src/util/number-utils.js → esm2020/src/util/number-utils.mjs} +0 -0
- package/{esm2015/src/util/object-utils.js → esm2020/src/util/object-utils.mjs} +0 -0
- package/{esm2015/src/util/string-utils.js → esm2020/src/util/string-utils.mjs} +0 -0
- package/esm2020/src/util/type-utils.mjs +9 -0
- package/{esm2015/src/visibility/visibility.service.js → esm2020/src/visibility/visibility.service.mjs} +4 -4
- package/fesm2015/dontdrinkandroot-ngx-extensions.mjs +760 -0
- package/fesm2015/dontdrinkandroot-ngx-extensions.mjs.map +1 -0
- package/{fesm2015/dontdrinkandroot-ngx-extensions.js → fesm2020/dontdrinkandroot-ngx-extensions.mjs} +47 -39
- package/fesm2020/dontdrinkandroot-ngx-extensions.mjs.map +1 -0
- package/{dontdrinkandroot-ngx-extensions.d.ts → index.d.ts} +0 -0
- package/package.json +22 -9
- package/public-api.d.ts +1 -0
- package/src/image/lazy-image.directive.d.ts +1 -1
- package/src/scroll/bottom-hit.directive.d.ts +1 -1
- package/src/util/type-utils.d.ts +3 -0
- package/bundles/dontdrinkandroot-ngx-extensions.umd.js +0 -1178
- package/bundles/dontdrinkandroot-ngx-extensions.umd.js.map +0 -1
- package/esm2015/public-api.js +0 -23
- package/esm2015/src/util/collection-utils.js +0 -28
- package/fesm2015/dontdrinkandroot-ngx-extensions.js.map +0 -1
|
@@ -1,1178 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/router'), require('rxjs'), require('rxjs/operators'), require('@angular/common/http')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@dontdrinkandroot/ngx-extensions', ['exports', '@angular/core', '@angular/common', '@angular/router', 'rxjs', 'rxjs/operators', '@angular/common/http'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.dontdrinkandroot = global.dontdrinkandroot || {}, global.dontdrinkandroot["ngx-extensions"] = {}), global.ng.core, global.ng.common, global.ng.router, global.rxjs, global.rxjs.operators, global.ng.common.http));
|
|
5
|
-
})(this, (function (exports, i0, i2, i1, rxjs, operators, i2$1) { '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 i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
26
|
-
var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
|
|
27
|
-
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
|
28
|
-
var i2__namespace$1 = /*#__PURE__*/_interopNamespace(i2$1);
|
|
29
|
-
|
|
30
|
-
/*! *****************************************************************************
|
|
31
|
-
Copyright (c) Microsoft Corporation.
|
|
32
|
-
|
|
33
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
34
|
-
purpose with or without fee is hereby granted.
|
|
35
|
-
|
|
36
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
37
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
38
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
39
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
40
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
41
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
42
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
43
|
-
***************************************************************************** */
|
|
44
|
-
/* global Reflect, Promise */
|
|
45
|
-
var extendStatics = function (d, b) {
|
|
46
|
-
extendStatics = Object.setPrototypeOf ||
|
|
47
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
48
|
-
function (d, b) { for (var p in b)
|
|
49
|
-
if (Object.prototype.hasOwnProperty.call(b, p))
|
|
50
|
-
d[p] = b[p]; };
|
|
51
|
-
return extendStatics(d, b);
|
|
52
|
-
};
|
|
53
|
-
function __extends(d, b) {
|
|
54
|
-
if (typeof b !== "function" && b !== null)
|
|
55
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
56
|
-
extendStatics(d, b);
|
|
57
|
-
function __() { this.constructor = d; }
|
|
58
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
59
|
-
}
|
|
60
|
-
var __assign = function () {
|
|
61
|
-
__assign = Object.assign || function __assign(t) {
|
|
62
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
63
|
-
s = arguments[i];
|
|
64
|
-
for (var p in s)
|
|
65
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
66
|
-
t[p] = s[p];
|
|
67
|
-
}
|
|
68
|
-
return t;
|
|
69
|
-
};
|
|
70
|
-
return __assign.apply(this, arguments);
|
|
71
|
-
};
|
|
72
|
-
function __rest(s, e) {
|
|
73
|
-
var t = {};
|
|
74
|
-
for (var p in s)
|
|
75
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
76
|
-
t[p] = s[p];
|
|
77
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
78
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
79
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
80
|
-
t[p[i]] = s[p[i]];
|
|
81
|
-
}
|
|
82
|
-
return t;
|
|
83
|
-
}
|
|
84
|
-
function __decorate(decorators, target, key, desc) {
|
|
85
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
86
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
87
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
88
|
-
else
|
|
89
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
90
|
-
if (d = decorators[i])
|
|
91
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
92
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
93
|
-
}
|
|
94
|
-
function __param(paramIndex, decorator) {
|
|
95
|
-
return function (target, key) { decorator(target, key, paramIndex); };
|
|
96
|
-
}
|
|
97
|
-
function __metadata(metadataKey, metadataValue) {
|
|
98
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
99
|
-
return Reflect.metadata(metadataKey, metadataValue);
|
|
100
|
-
}
|
|
101
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
102
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
103
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
104
|
-
function fulfilled(value) { try {
|
|
105
|
-
step(generator.next(value));
|
|
106
|
-
}
|
|
107
|
-
catch (e) {
|
|
108
|
-
reject(e);
|
|
109
|
-
} }
|
|
110
|
-
function rejected(value) { try {
|
|
111
|
-
step(generator["throw"](value));
|
|
112
|
-
}
|
|
113
|
-
catch (e) {
|
|
114
|
-
reject(e);
|
|
115
|
-
} }
|
|
116
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
117
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
function __generator(thisArg, body) {
|
|
121
|
-
var _ = { label: 0, sent: function () { if (t[0] & 1)
|
|
122
|
-
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
123
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
|
124
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
125
|
-
function step(op) {
|
|
126
|
-
if (f)
|
|
127
|
-
throw new TypeError("Generator is already executing.");
|
|
128
|
-
while (_)
|
|
129
|
-
try {
|
|
130
|
-
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)
|
|
131
|
-
return t;
|
|
132
|
-
if (y = 0, t)
|
|
133
|
-
op = [op[0] & 2, t.value];
|
|
134
|
-
switch (op[0]) {
|
|
135
|
-
case 0:
|
|
136
|
-
case 1:
|
|
137
|
-
t = op;
|
|
138
|
-
break;
|
|
139
|
-
case 4:
|
|
140
|
-
_.label++;
|
|
141
|
-
return { value: op[1], done: false };
|
|
142
|
-
case 5:
|
|
143
|
-
_.label++;
|
|
144
|
-
y = op[1];
|
|
145
|
-
op = [0];
|
|
146
|
-
continue;
|
|
147
|
-
case 7:
|
|
148
|
-
op = _.ops.pop();
|
|
149
|
-
_.trys.pop();
|
|
150
|
-
continue;
|
|
151
|
-
default:
|
|
152
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
153
|
-
_ = 0;
|
|
154
|
-
continue;
|
|
155
|
-
}
|
|
156
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
|
157
|
-
_.label = op[1];
|
|
158
|
-
break;
|
|
159
|
-
}
|
|
160
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
161
|
-
_.label = t[1];
|
|
162
|
-
t = op;
|
|
163
|
-
break;
|
|
164
|
-
}
|
|
165
|
-
if (t && _.label < t[2]) {
|
|
166
|
-
_.label = t[2];
|
|
167
|
-
_.ops.push(op);
|
|
168
|
-
break;
|
|
169
|
-
}
|
|
170
|
-
if (t[2])
|
|
171
|
-
_.ops.pop();
|
|
172
|
-
_.trys.pop();
|
|
173
|
-
continue;
|
|
174
|
-
}
|
|
175
|
-
op = body.call(thisArg, _);
|
|
176
|
-
}
|
|
177
|
-
catch (e) {
|
|
178
|
-
op = [6, e];
|
|
179
|
-
y = 0;
|
|
180
|
-
}
|
|
181
|
-
finally {
|
|
182
|
-
f = t = 0;
|
|
183
|
-
}
|
|
184
|
-
if (op[0] & 5)
|
|
185
|
-
throw op[1];
|
|
186
|
-
return { value: op[0] ? op[1] : void 0, done: true };
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
|
190
|
-
if (k2 === undefined)
|
|
191
|
-
k2 = k;
|
|
192
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
|
193
|
-
}) : (function (o, m, k, k2) {
|
|
194
|
-
if (k2 === undefined)
|
|
195
|
-
k2 = k;
|
|
196
|
-
o[k2] = m[k];
|
|
197
|
-
});
|
|
198
|
-
function __exportStar(m, o) {
|
|
199
|
-
for (var p in m)
|
|
200
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
|
201
|
-
__createBinding(o, m, p);
|
|
202
|
-
}
|
|
203
|
-
function __values(o) {
|
|
204
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
205
|
-
if (m)
|
|
206
|
-
return m.call(o);
|
|
207
|
-
if (o && typeof o.length === "number")
|
|
208
|
-
return {
|
|
209
|
-
next: function () {
|
|
210
|
-
if (o && i >= o.length)
|
|
211
|
-
o = void 0;
|
|
212
|
-
return { value: o && o[i++], done: !o };
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
216
|
-
}
|
|
217
|
-
function __read(o, n) {
|
|
218
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
219
|
-
if (!m)
|
|
220
|
-
return o;
|
|
221
|
-
var i = m.call(o), r, ar = [], e;
|
|
222
|
-
try {
|
|
223
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
224
|
-
ar.push(r.value);
|
|
225
|
-
}
|
|
226
|
-
catch (error) {
|
|
227
|
-
e = { error: error };
|
|
228
|
-
}
|
|
229
|
-
finally {
|
|
230
|
-
try {
|
|
231
|
-
if (r && !r.done && (m = i["return"]))
|
|
232
|
-
m.call(i);
|
|
233
|
-
}
|
|
234
|
-
finally {
|
|
235
|
-
if (e)
|
|
236
|
-
throw e.error;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
return ar;
|
|
240
|
-
}
|
|
241
|
-
/** @deprecated */
|
|
242
|
-
function __spread() {
|
|
243
|
-
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
244
|
-
ar = ar.concat(__read(arguments[i]));
|
|
245
|
-
return ar;
|
|
246
|
-
}
|
|
247
|
-
/** @deprecated */
|
|
248
|
-
function __spreadArrays() {
|
|
249
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
250
|
-
s += arguments[i].length;
|
|
251
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
252
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
253
|
-
r[k] = a[j];
|
|
254
|
-
return r;
|
|
255
|
-
}
|
|
256
|
-
function __spreadArray(to, from, pack) {
|
|
257
|
-
if (pack || arguments.length === 2)
|
|
258
|
-
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
259
|
-
if (ar || !(i in from)) {
|
|
260
|
-
if (!ar)
|
|
261
|
-
ar = Array.prototype.slice.call(from, 0, i);
|
|
262
|
-
ar[i] = from[i];
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
266
|
-
}
|
|
267
|
-
function __await(v) {
|
|
268
|
-
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
269
|
-
}
|
|
270
|
-
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
271
|
-
if (!Symbol.asyncIterator)
|
|
272
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
273
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
274
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
275
|
-
function verb(n) { if (g[n])
|
|
276
|
-
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
277
|
-
function resume(n, v) { try {
|
|
278
|
-
step(g[n](v));
|
|
279
|
-
}
|
|
280
|
-
catch (e) {
|
|
281
|
-
settle(q[0][3], e);
|
|
282
|
-
} }
|
|
283
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
284
|
-
function fulfill(value) { resume("next", value); }
|
|
285
|
-
function reject(value) { resume("throw", value); }
|
|
286
|
-
function settle(f, v) { if (f(v), q.shift(), q.length)
|
|
287
|
-
resume(q[0][0], q[0][1]); }
|
|
288
|
-
}
|
|
289
|
-
function __asyncDelegator(o) {
|
|
290
|
-
var i, p;
|
|
291
|
-
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
292
|
-
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; }
|
|
293
|
-
}
|
|
294
|
-
function __asyncValues(o) {
|
|
295
|
-
if (!Symbol.asyncIterator)
|
|
296
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
297
|
-
var m = o[Symbol.asyncIterator], i;
|
|
298
|
-
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);
|
|
299
|
-
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); }); }; }
|
|
300
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
301
|
-
}
|
|
302
|
-
function __makeTemplateObject(cooked, raw) {
|
|
303
|
-
if (Object.defineProperty) {
|
|
304
|
-
Object.defineProperty(cooked, "raw", { value: raw });
|
|
305
|
-
}
|
|
306
|
-
else {
|
|
307
|
-
cooked.raw = raw;
|
|
308
|
-
}
|
|
309
|
-
return cooked;
|
|
310
|
-
}
|
|
311
|
-
;
|
|
312
|
-
var __setModuleDefault = Object.create ? (function (o, v) {
|
|
313
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
314
|
-
}) : function (o, v) {
|
|
315
|
-
o["default"] = v;
|
|
316
|
-
};
|
|
317
|
-
function __importStar(mod) {
|
|
318
|
-
if (mod && mod.__esModule)
|
|
319
|
-
return mod;
|
|
320
|
-
var result = {};
|
|
321
|
-
if (mod != null)
|
|
322
|
-
for (var k in mod)
|
|
323
|
-
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
324
|
-
__createBinding(result, mod, k);
|
|
325
|
-
__setModuleDefault(result, mod);
|
|
326
|
-
return result;
|
|
327
|
-
}
|
|
328
|
-
function __importDefault(mod) {
|
|
329
|
-
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
330
|
-
}
|
|
331
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
332
|
-
if (kind === "a" && !f)
|
|
333
|
-
throw new TypeError("Private accessor was defined without a getter");
|
|
334
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
335
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
336
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
337
|
-
}
|
|
338
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
339
|
-
if (kind === "m")
|
|
340
|
-
throw new TypeError("Private method is not writable");
|
|
341
|
-
if (kind === "a" && !f)
|
|
342
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
343
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
344
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
345
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
var NumberUtils = /** @class */ (function () {
|
|
349
|
-
function NumberUtils() {
|
|
350
|
-
}
|
|
351
|
-
NumberUtils.getNextPowerOfTwo = function (value) {
|
|
352
|
-
var target = 2;
|
|
353
|
-
while (target < value) {
|
|
354
|
-
target *= 2;
|
|
355
|
-
}
|
|
356
|
-
return target;
|
|
357
|
-
};
|
|
358
|
-
return NumberUtils;
|
|
359
|
-
}());
|
|
360
|
-
|
|
361
|
-
var StringUtils = /** @class */ (function () {
|
|
362
|
-
function StringUtils() {
|
|
363
|
-
}
|
|
364
|
-
StringUtils.capitalizeFirstLetter = function (text) {
|
|
365
|
-
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
366
|
-
};
|
|
367
|
-
StringUtils.stripTrailingSlash = function (text) {
|
|
368
|
-
var lastChar = text.charAt(text.length - 1);
|
|
369
|
-
if ('/' === lastChar) {
|
|
370
|
-
return text.slice(0, text.length - 1);
|
|
371
|
-
}
|
|
372
|
-
return text;
|
|
373
|
-
};
|
|
374
|
-
StringUtils.updateUrlParameter = function (uri, key, value) {
|
|
375
|
-
// remove the hash part before operating on the uri
|
|
376
|
-
var i = uri.indexOf('#');
|
|
377
|
-
var hash = i === -1 ? '' : uri.substr(i);
|
|
378
|
-
uri = i === -1 ? uri : uri.substr(0, i);
|
|
379
|
-
var re = new RegExp('([?&])' + key + '=.*?(&|$)', 'i');
|
|
380
|
-
var separator = uri.indexOf('?') !== -1 ? '&' : '?';
|
|
381
|
-
if (uri.match(re)) {
|
|
382
|
-
uri = uri.replace(re, '$1' + key + '=' + value + '$2');
|
|
383
|
-
}
|
|
384
|
-
else {
|
|
385
|
-
uri = uri + separator + key + '=' + value;
|
|
386
|
-
}
|
|
387
|
-
return uri + hash; // finally append the hash as well
|
|
388
|
-
};
|
|
389
|
-
StringUtils.createRandomString = function (lengthOfCode, possible) {
|
|
390
|
-
var text = '';
|
|
391
|
-
for (var i = 0; i < lengthOfCode; i++) {
|
|
392
|
-
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
|
393
|
-
}
|
|
394
|
-
return text;
|
|
395
|
-
};
|
|
396
|
-
return StringUtils;
|
|
397
|
-
}());
|
|
398
|
-
|
|
399
|
-
function Debounce(delay) {
|
|
400
|
-
if (delay === void 0) { delay = 250; }
|
|
401
|
-
var timeoutReference = undefined;
|
|
402
|
-
return function (target, propertyKey, descriptor) {
|
|
403
|
-
var original = descriptor.value;
|
|
404
|
-
descriptor.value = function () {
|
|
405
|
-
var _this = this;
|
|
406
|
-
var args = [];
|
|
407
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
408
|
-
args[_i] = arguments[_i];
|
|
409
|
-
}
|
|
410
|
-
if (null != timeoutReference)
|
|
411
|
-
clearTimeout(timeoutReference);
|
|
412
|
-
timeoutReference = setTimeout(function () { return original.apply(_this, args); }, delay);
|
|
413
|
-
};
|
|
414
|
-
return descriptor;
|
|
415
|
-
};
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
function Limit(rate) {
|
|
419
|
-
if (rate === void 0) { rate = 250; }
|
|
420
|
-
var timeoutReference = undefined;
|
|
421
|
-
return function (target, propertyKey, descriptor) {
|
|
422
|
-
var original = descriptor.value;
|
|
423
|
-
descriptor.value = function () {
|
|
424
|
-
var _this = this;
|
|
425
|
-
var args = [];
|
|
426
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
427
|
-
args[_i] = arguments[_i];
|
|
428
|
-
}
|
|
429
|
-
if (null == timeoutReference) {
|
|
430
|
-
timeoutReference = setTimeout(function () {
|
|
431
|
-
original.apply(_this, args);
|
|
432
|
-
timeoutReference = undefined;
|
|
433
|
-
}, rate);
|
|
434
|
-
}
|
|
435
|
-
};
|
|
436
|
-
return descriptor;
|
|
437
|
-
};
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
var LazyImageDirective = /** @class */ (function () {
|
|
441
|
-
function LazyImageDirective(element, changeDetectorRef) {
|
|
442
|
-
this.element = element;
|
|
443
|
-
this.changeDetectorRef = changeDetectorRef;
|
|
444
|
-
this.objectFit = 'contain';
|
|
445
|
-
this.offset = 1000;
|
|
446
|
-
this.hostSrc = 'assets/placeholder.gif';
|
|
447
|
-
this.hostStyleObjectFit = 'contain';
|
|
448
|
-
this.displayed = false;
|
|
449
|
-
this.maxLoadedDimension = null;
|
|
450
|
-
}
|
|
451
|
-
LazyImageDirective.prototype.windowResized = function ($event) {
|
|
452
|
-
this.displayed = false;
|
|
453
|
-
this.check();
|
|
454
|
-
};
|
|
455
|
-
LazyImageDirective.prototype.windowScroll = function ($event) {
|
|
456
|
-
this.check();
|
|
457
|
-
};
|
|
458
|
-
/**
|
|
459
|
-
* @override
|
|
460
|
-
*/
|
|
461
|
-
LazyImageDirective.prototype.ngOnChanges = function (changes) {
|
|
462
|
-
this.displayed = false;
|
|
463
|
-
this.maxLoadedDimension = null;
|
|
464
|
-
this.check();
|
|
465
|
-
};
|
|
466
|
-
LazyImageDirective.prototype.check = function () {
|
|
467
|
-
var _this = this;
|
|
468
|
-
if (this.element.nativeElement.parentElement.offsetWidth > 0) {
|
|
469
|
-
this.doCheck();
|
|
470
|
-
}
|
|
471
|
-
else {
|
|
472
|
-
setTimeout(function () { return _this.doCheck(); }, 1);
|
|
473
|
-
}
|
|
474
|
-
};
|
|
475
|
-
LazyImageDirective.prototype.doCheck = function () {
|
|
476
|
-
if (this.displayed || this.isHidden(this.element.nativeElement)) {
|
|
477
|
-
return;
|
|
478
|
-
}
|
|
479
|
-
if (this.isInsideViewport(this.element.nativeElement, this.offset)) {
|
|
480
|
-
this.displayed = true;
|
|
481
|
-
var dimension = this.getDimension();
|
|
482
|
-
this.hostStyleWidthPx = dimension.width;
|
|
483
|
-
this.hostStyleHeightPx = dimension.height;
|
|
484
|
-
if (this.maxLoadedDimension != null
|
|
485
|
-
&& this.maxLoadedDimension.width >= dimension.width
|
|
486
|
-
&& this.maxLoadedDimension.height >= dimension.height) {
|
|
487
|
-
// console.log('has smaller dimension');
|
|
488
|
-
return;
|
|
489
|
-
}
|
|
490
|
-
this.maxLoadedDimension = dimension;
|
|
491
|
-
var wantedSize = void 0;
|
|
492
|
-
if (this.objectFit === 'cover') {
|
|
493
|
-
wantedSize = NumberUtils.getNextPowerOfTwo(Math.max(dimension.width, dimension.height));
|
|
494
|
-
this.hostStyleObjectFit = 'cover';
|
|
495
|
-
}
|
|
496
|
-
else {
|
|
497
|
-
wantedSize = NumberUtils.getNextPowerOfTwo(Math.min(dimension.width, dimension.height));
|
|
498
|
-
this.hostStyleObjectFit = 'contain';
|
|
499
|
-
}
|
|
500
|
-
this.hostSrc = StringUtils.updateUrlParameter(this.src, 'size', String(wantedSize));
|
|
501
|
-
this.changeDetectorRef.markForCheck();
|
|
502
|
-
}
|
|
503
|
-
};
|
|
504
|
-
LazyImageDirective.prototype.isInsideViewport = function (element, threshold) {
|
|
505
|
-
var ownerDocument = element.ownerDocument;
|
|
506
|
-
var documentTop = window.pageYOffset || ownerDocument.body.scrollTop;
|
|
507
|
-
var documentLeft = window.pageXOffset || ownerDocument.body.scrollLeft;
|
|
508
|
-
var documentWidth = window.innerWidth || (ownerDocument.documentElement.clientWidth || document.body.clientWidth);
|
|
509
|
-
var documentHeight = window.innerHeight || (ownerDocument.documentElement.clientHeight || document.body.clientHeight);
|
|
510
|
-
var topOffset = element.getBoundingClientRect().top + documentTop - ownerDocument.documentElement.clientTop;
|
|
511
|
-
var leftOffset = element.getBoundingClientRect().left + documentLeft - ownerDocument.documentElement.clientLeft;
|
|
512
|
-
var isBelowViewport = documentHeight + documentTop <= topOffset - threshold;
|
|
513
|
-
var isAtRightOfViewport = documentWidth + window.pageXOffset <= leftOffset - threshold;
|
|
514
|
-
var isAboveViewport = documentTop >= topOffset + threshold + element.offsetHeight;
|
|
515
|
-
var isAtLeftOfViewport = documentLeft >= leftOffset + threshold + element.offsetWidth;
|
|
516
|
-
return !isBelowViewport && !isAboveViewport && !isAtRightOfViewport && !isAtLeftOfViewport;
|
|
517
|
-
};
|
|
518
|
-
LazyImageDirective.prototype.getDimension = function () {
|
|
519
|
-
return {
|
|
520
|
-
width: this.element.nativeElement.parentElement.offsetWidth,
|
|
521
|
-
height: this.element.nativeElement.parentElement.offsetHeight,
|
|
522
|
-
};
|
|
523
|
-
};
|
|
524
|
-
LazyImageDirective.prototype.isHidden = function (element) {
|
|
525
|
-
return window.getComputedStyle(element).display === 'none';
|
|
526
|
-
};
|
|
527
|
-
return LazyImageDirective;
|
|
528
|
-
}());
|
|
529
|
-
LazyImageDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: LazyImageDirective, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
530
|
-
LazyImageDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.12", type: LazyImageDirective, selector: "[ddrLazyImage]", inputs: { src: ["ddrLazyImage", "src"], objectFit: "objectFit", offset: "offset" }, host: { listeners: { "window:resize": "windowResized($event)", "window:scroll": "windowScroll($event)" }, properties: { "src": "this.hostSrc", "style.width.px": "this.hostStyleWidthPx", "style.height.px": "this.hostStyleHeightPx", "style.object-fit": "this.hostStyleObjectFit" } }, usesOnChanges: true, ngImport: i0__namespace });
|
|
531
|
-
__decorate([
|
|
532
|
-
Debounce()
|
|
533
|
-
], LazyImageDirective.prototype, "windowResized", null);
|
|
534
|
-
__decorate([
|
|
535
|
-
Limit()
|
|
536
|
-
], LazyImageDirective.prototype, "windowScroll", null);
|
|
537
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: LazyImageDirective, decorators: [{
|
|
538
|
-
type: i0.Directive,
|
|
539
|
-
args: [{ selector: '[ddrLazyImage]' }]
|
|
540
|
-
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { src: [{
|
|
541
|
-
type: i0.Input,
|
|
542
|
-
args: ['ddrLazyImage']
|
|
543
|
-
}], objectFit: [{
|
|
544
|
-
type: i0.Input
|
|
545
|
-
}], offset: [{
|
|
546
|
-
type: i0.Input
|
|
547
|
-
}], hostSrc: [{
|
|
548
|
-
type: i0.HostBinding,
|
|
549
|
-
args: ['src']
|
|
550
|
-
}], hostStyleWidthPx: [{
|
|
551
|
-
type: i0.HostBinding,
|
|
552
|
-
args: ['style.width.px']
|
|
553
|
-
}], hostStyleHeightPx: [{
|
|
554
|
-
type: i0.HostBinding,
|
|
555
|
-
args: ['style.height.px']
|
|
556
|
-
}], hostStyleObjectFit: [{
|
|
557
|
-
type: i0.HostBinding,
|
|
558
|
-
args: ['style.object-fit']
|
|
559
|
-
}], windowResized: [{
|
|
560
|
-
type: i0.HostListener,
|
|
561
|
-
args: ['window:resize', ['$event']]
|
|
562
|
-
}], windowScroll: [{
|
|
563
|
-
type: i0.HostListener,
|
|
564
|
-
args: ['window:scroll', ['$event']]
|
|
565
|
-
}] } });
|
|
566
|
-
|
|
567
|
-
var BottomHitDirective = /** @class */ (function () {
|
|
568
|
-
function BottomHitDirective() {
|
|
569
|
-
this.offset = 1000;
|
|
570
|
-
this.onWindowBottomHit = new i0.EventEmitter();
|
|
571
|
-
this.onElementBottomHit = new i0.EventEmitter();
|
|
572
|
-
}
|
|
573
|
-
BottomHitDirective.prototype.scrolled = function ($event) {
|
|
574
|
-
this.elementScrollEvent($event);
|
|
575
|
-
};
|
|
576
|
-
BottomHitDirective.prototype.windowScrolled = function ($event) {
|
|
577
|
-
this.windowScrollEvent($event);
|
|
578
|
-
};
|
|
579
|
-
BottomHitDirective.prototype.windowScrollEvent = function ($event) {
|
|
580
|
-
var pageHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight);
|
|
581
|
-
var viewportHeight = document.documentElement.clientHeight;
|
|
582
|
-
var scrollPosition = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
|
|
583
|
-
var distanceToBottom = pageHeight - (scrollPosition + viewportHeight);
|
|
584
|
-
if (distanceToBottom < this.offset) {
|
|
585
|
-
this.onWindowBottomHit.emit();
|
|
586
|
-
}
|
|
587
|
-
};
|
|
588
|
-
BottomHitDirective.prototype.elementScrollEvent = function ($event) {
|
|
589
|
-
var target = $event.target;
|
|
590
|
-
var scrollPosition = target.scrollHeight - target.scrollTop;
|
|
591
|
-
var offsetHeight = target.offsetHeight;
|
|
592
|
-
var isReachingBottom = (scrollPosition - offsetHeight) < this.offset;
|
|
593
|
-
if (isReachingBottom) {
|
|
594
|
-
this.onElementBottomHit.emit();
|
|
595
|
-
}
|
|
596
|
-
};
|
|
597
|
-
return BottomHitDirective;
|
|
598
|
-
}());
|
|
599
|
-
BottomHitDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: BottomHitDirective, deps: [], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
600
|
-
BottomHitDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.12", type: BottomHitDirective, selector: "[ddrBottomHit]", outputs: { onWindowBottomHit: "onWindowBottomHit", onElementBottomHit: "onElementBottomHit" }, host: { listeners: { "scroll": "scrolled($event)", "window:scroll": "windowScrolled($event)" } }, ngImport: i0__namespace });
|
|
601
|
-
__decorate([
|
|
602
|
-
Limit()
|
|
603
|
-
], BottomHitDirective.prototype, "scrolled", null);
|
|
604
|
-
__decorate([
|
|
605
|
-
Limit()
|
|
606
|
-
], BottomHitDirective.prototype, "windowScrolled", null);
|
|
607
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: BottomHitDirective, decorators: [{
|
|
608
|
-
type: i0.Directive,
|
|
609
|
-
args: [{
|
|
610
|
-
selector: '[ddrBottomHit]'
|
|
611
|
-
}]
|
|
612
|
-
}], ctorParameters: function () { return []; }, propDecorators: { onWindowBottomHit: [{
|
|
613
|
-
type: i0.Output
|
|
614
|
-
}], onElementBottomHit: [{
|
|
615
|
-
type: i0.Output
|
|
616
|
-
}], scrolled: [{
|
|
617
|
-
type: i0.HostListener,
|
|
618
|
-
args: ['scroll', ['$event']]
|
|
619
|
-
}], windowScrolled: [{
|
|
620
|
-
type: i0.HostListener,
|
|
621
|
-
args: ['window:scroll', ['$event']]
|
|
622
|
-
}] } });
|
|
623
|
-
|
|
624
|
-
var DDR_STORAGE_PREFIX = new i0.InjectionToken('DDR_STORAGE_PREFIX');
|
|
625
|
-
var DDR_JWT_REFRESH_TOKEN_URL = new i0.InjectionToken('DDR_JWT_REFRESH_TOKEN_URL');
|
|
626
|
-
var DDR_LOGIN_PATH = new i0.InjectionToken('DDR_LOGIN_PATH');
|
|
627
|
-
var DdrExtensionsModule = /** @class */ (function () {
|
|
628
|
-
function DdrExtensionsModule() {
|
|
629
|
-
}
|
|
630
|
-
return DdrExtensionsModule;
|
|
631
|
-
}());
|
|
632
|
-
DdrExtensionsModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: DdrExtensionsModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
633
|
-
DdrExtensionsModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: DdrExtensionsModule, declarations: [LazyImageDirective,
|
|
634
|
-
BottomHitDirective], exports: [LazyImageDirective,
|
|
635
|
-
BottomHitDirective] });
|
|
636
|
-
DdrExtensionsModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: DdrExtensionsModule, providers: [
|
|
637
|
-
{
|
|
638
|
-
provide: DDR_LOGIN_PATH,
|
|
639
|
-
useValue: '/login'
|
|
640
|
-
}
|
|
641
|
-
], imports: [[]] });
|
|
642
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: DdrExtensionsModule, decorators: [{
|
|
643
|
-
type: i0.NgModule,
|
|
644
|
-
args: [{
|
|
645
|
-
declarations: [
|
|
646
|
-
LazyImageDirective,
|
|
647
|
-
BottomHitDirective
|
|
648
|
-
],
|
|
649
|
-
imports: [],
|
|
650
|
-
providers: [
|
|
651
|
-
{
|
|
652
|
-
provide: DDR_LOGIN_PATH,
|
|
653
|
-
useValue: '/login'
|
|
654
|
-
}
|
|
655
|
-
],
|
|
656
|
-
exports: [
|
|
657
|
-
LazyImageDirective,
|
|
658
|
-
BottomHitDirective
|
|
659
|
-
]
|
|
660
|
-
}]
|
|
661
|
-
}] });
|
|
662
|
-
|
|
663
|
-
// This service is based on the `ng2-cookies` package which sadly is not a service and does
|
|
664
|
-
var CookieService = /** @class */ (function () {
|
|
665
|
-
function CookieService(document) {
|
|
666
|
-
this.document = document;
|
|
667
|
-
// To avoid issues with server side prerendering, check if `document` is defined.
|
|
668
|
-
this.documentIsAccessible = document !== undefined;
|
|
669
|
-
}
|
|
670
|
-
/**
|
|
671
|
-
* @param name Cookie name
|
|
672
|
-
*/
|
|
673
|
-
CookieService.prototype.check = function (name) {
|
|
674
|
-
if (!this.documentIsAccessible) {
|
|
675
|
-
return false;
|
|
676
|
-
}
|
|
677
|
-
name = encodeURIComponent(name);
|
|
678
|
-
var regExp = this.getCookieRegExp(name);
|
|
679
|
-
return regExp.test(this.document.cookie);
|
|
680
|
-
};
|
|
681
|
-
/**
|
|
682
|
-
* @param name Cookie name
|
|
683
|
-
*/
|
|
684
|
-
CookieService.prototype.get = function (name) {
|
|
685
|
-
if (this.documentIsAccessible && this.check(name)) {
|
|
686
|
-
name = encodeURIComponent(name);
|
|
687
|
-
var regExp = this.getCookieRegExp(name);
|
|
688
|
-
var result = regExp.exec(this.document.cookie);
|
|
689
|
-
if (null == result)
|
|
690
|
-
return '';
|
|
691
|
-
return decodeURIComponent(result[1]);
|
|
692
|
-
}
|
|
693
|
-
else {
|
|
694
|
-
return '';
|
|
695
|
-
}
|
|
696
|
-
};
|
|
697
|
-
CookieService.prototype.getAll = function () {
|
|
698
|
-
if (!this.documentIsAccessible) {
|
|
699
|
-
return {};
|
|
700
|
-
}
|
|
701
|
-
var cookies = {};
|
|
702
|
-
var document = this.document;
|
|
703
|
-
if (document.cookie && document.cookie !== '') {
|
|
704
|
-
var split = document.cookie.split(';');
|
|
705
|
-
for (var i = 0; i < split.length; i += 1) {
|
|
706
|
-
var currentCookie = split[i].split('=');
|
|
707
|
-
currentCookie[0] = currentCookie[0].replace(/^ /, '');
|
|
708
|
-
// @ts-ignore
|
|
709
|
-
cookies[decodeURIComponent(currentCookie[0])] = decodeURIComponent(currentCookie[1]);
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
return cookies;
|
|
713
|
-
};
|
|
714
|
-
/**
|
|
715
|
-
* @param name Cookie name
|
|
716
|
-
* @param value Cookie value
|
|
717
|
-
* @param expires Number of days until the cookies expires or an actual `Date`
|
|
718
|
-
* @param path Cookie path
|
|
719
|
-
* @param domain Cookie domain
|
|
720
|
-
* @param secure Secure flag
|
|
721
|
-
*/
|
|
722
|
-
CookieService.prototype.set = function (name, value, expires, path, domain, secure) {
|
|
723
|
-
if (!this.documentIsAccessible) {
|
|
724
|
-
return;
|
|
725
|
-
}
|
|
726
|
-
var cookieString = encodeURIComponent(name) + '=' + encodeURIComponent(value) + ';';
|
|
727
|
-
if (expires) {
|
|
728
|
-
if (typeof expires === 'number') {
|
|
729
|
-
var dateExpires = new Date(new Date().getTime() + expires * 1000 * 60 * 60 * 24);
|
|
730
|
-
cookieString += 'expires=' + dateExpires.toUTCString() + ';';
|
|
731
|
-
}
|
|
732
|
-
else {
|
|
733
|
-
cookieString += 'expires=' + expires.toUTCString() + ';';
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
if (path) {
|
|
737
|
-
cookieString += 'path=' + path + ';';
|
|
738
|
-
}
|
|
739
|
-
if (domain) {
|
|
740
|
-
cookieString += 'domain=' + domain + ';';
|
|
741
|
-
}
|
|
742
|
-
if (secure) {
|
|
743
|
-
cookieString += 'secure;';
|
|
744
|
-
}
|
|
745
|
-
this.document.cookie = cookieString;
|
|
746
|
-
};
|
|
747
|
-
/**
|
|
748
|
-
* @param name Cookie name
|
|
749
|
-
* @param path Cookie path
|
|
750
|
-
* @param domain Cookie domain
|
|
751
|
-
*/
|
|
752
|
-
CookieService.prototype.delete = function (name, path, domain) {
|
|
753
|
-
if (!this.documentIsAccessible) {
|
|
754
|
-
return;
|
|
755
|
-
}
|
|
756
|
-
this.set(name, '', -1, path, domain);
|
|
757
|
-
};
|
|
758
|
-
/**
|
|
759
|
-
* @param path Cookie path
|
|
760
|
-
* @param domain Cookie domain
|
|
761
|
-
*/
|
|
762
|
-
CookieService.prototype.deleteAll = function (path, domain) {
|
|
763
|
-
if (!this.documentIsAccessible) {
|
|
764
|
-
return;
|
|
765
|
-
}
|
|
766
|
-
var cookies = this.getAll();
|
|
767
|
-
for (var cookieName in cookies) {
|
|
768
|
-
if (cookies.hasOwnProperty(cookieName)) {
|
|
769
|
-
this.delete(cookieName, path, domain);
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
};
|
|
773
|
-
/**
|
|
774
|
-
* @param name Cookie name
|
|
775
|
-
*/
|
|
776
|
-
CookieService.prototype.getCookieRegExp = function (name) {
|
|
777
|
-
var escapedName = name.replace(/([\[\]{}()|=;+?,.*^$])/ig, '\\$1');
|
|
778
|
-
return new RegExp('(?:^' + escapedName + '|;\\s*' + escapedName + ')=(.*?)(?:;|$)', 'g');
|
|
779
|
-
};
|
|
780
|
-
return CookieService;
|
|
781
|
-
}());
|
|
782
|
-
CookieService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CookieService, deps: [{ token: i2.DOCUMENT }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
783
|
-
CookieService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CookieService, providedIn: 'root' });
|
|
784
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CookieService, decorators: [{
|
|
785
|
-
type: i0.Injectable,
|
|
786
|
-
args: [{
|
|
787
|
-
providedIn: 'root'
|
|
788
|
-
}]
|
|
789
|
-
}], ctorParameters: function () {
|
|
790
|
-
return [{ type: Document, decorators: [{
|
|
791
|
-
type: i0.Inject,
|
|
792
|
-
args: [i2.DOCUMENT]
|
|
793
|
-
}] }];
|
|
794
|
-
} });
|
|
795
|
-
|
|
796
|
-
var ObjectUtils = /** @class */ (function () {
|
|
797
|
-
function ObjectUtils() {
|
|
798
|
-
}
|
|
799
|
-
ObjectUtils.deepCopy = function (value) {
|
|
800
|
-
return JSON.parse(JSON.stringify(value));
|
|
801
|
-
};
|
|
802
|
-
ObjectUtils.getProperty = function (o, propertyName) {
|
|
803
|
-
return o[propertyName];
|
|
804
|
-
};
|
|
805
|
-
return ObjectUtils;
|
|
806
|
-
}());
|
|
807
|
-
|
|
808
|
-
var CollectionUtils = /** @class */ (function () {
|
|
809
|
-
function CollectionUtils() {
|
|
810
|
-
}
|
|
811
|
-
/**
|
|
812
|
-
* Maps an array into a Map by a specific property which should be unique.
|
|
813
|
-
*/
|
|
814
|
-
CollectionUtils.mapByProperty = function (entries, property) {
|
|
815
|
-
var e_1, _b;
|
|
816
|
-
var map = new Map();
|
|
817
|
-
try {
|
|
818
|
-
for (var entries_1 = __values(entries), entries_1_1 = entries_1.next(); !entries_1_1.done; entries_1_1 = entries_1.next()) {
|
|
819
|
-
var entry = entries_1_1.value;
|
|
820
|
-
map.set(ObjectUtils.getProperty(entry, property), entry);
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
824
|
-
finally {
|
|
825
|
-
try {
|
|
826
|
-
if (entries_1_1 && !entries_1_1.done && (_b = entries_1.return)) _b.call(entries_1);
|
|
827
|
-
}
|
|
828
|
-
finally { if (e_1) throw e_1.error; }
|
|
829
|
-
}
|
|
830
|
-
return map;
|
|
831
|
-
};
|
|
832
|
-
/**
|
|
833
|
-
* Maps an array into a Map by a specified property and aggregates them into an array.
|
|
834
|
-
*/
|
|
835
|
-
CollectionUtils.mapArrayByProperty = function (entries, property) {
|
|
836
|
-
var e_2, _b;
|
|
837
|
-
var _a;
|
|
838
|
-
var map = new Map();
|
|
839
|
-
try {
|
|
840
|
-
for (var entries_2 = __values(entries), entries_2_1 = entries_2.next(); !entries_2_1.done; entries_2_1 = entries_2.next()) {
|
|
841
|
-
var entry = entries_2_1.value;
|
|
842
|
-
var value = ObjectUtils.getProperty(entry, property);
|
|
843
|
-
var existingEntries = (_a = map.get(value)) !== null && _a !== void 0 ? _a : [];
|
|
844
|
-
existingEntries.push(entry);
|
|
845
|
-
map.set(value, existingEntries);
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
849
|
-
finally {
|
|
850
|
-
try {
|
|
851
|
-
if (entries_2_1 && !entries_2_1.done && (_b = entries_2.return)) _b.call(entries_2);
|
|
852
|
-
}
|
|
853
|
-
finally { if (e_2) throw e_2.error; }
|
|
854
|
-
}
|
|
855
|
-
return map;
|
|
856
|
-
};
|
|
857
|
-
return CollectionUtils;
|
|
858
|
-
}());
|
|
859
|
-
|
|
860
|
-
var ScrollService = /** @class */ (function () {
|
|
861
|
-
function ScrollService(router, viewportScroller) {
|
|
862
|
-
var _this = this;
|
|
863
|
-
this.router = router;
|
|
864
|
-
this.viewportScroller = viewportScroller;
|
|
865
|
-
this.scrollPositionMap = new Map();
|
|
866
|
-
this.router.events
|
|
867
|
-
.subscribe(function (e) {
|
|
868
|
-
if (e instanceof i1.NavigationStart) {
|
|
869
|
-
_this.scrollPositionMap.set(_this.router.url, _this.viewportScroller.getScrollPosition());
|
|
870
|
-
}
|
|
871
|
-
});
|
|
872
|
-
}
|
|
873
|
-
ScrollService.prototype.restore = function () {
|
|
874
|
-
var _this = this;
|
|
875
|
-
var url = this.router.url;
|
|
876
|
-
if (this.scrollPositionMap.has(url)) {
|
|
877
|
-
/* Restore after timeout so rendering was completed */
|
|
878
|
-
setTimeout(function () {
|
|
879
|
-
var scrollPosition = _this.scrollPositionMap.get(url);
|
|
880
|
-
if (null != scrollPosition)
|
|
881
|
-
_this.viewportScroller.scrollToPosition(scrollPosition);
|
|
882
|
-
}, 1);
|
|
883
|
-
}
|
|
884
|
-
};
|
|
885
|
-
return ScrollService;
|
|
886
|
-
}());
|
|
887
|
-
ScrollService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: ScrollService, deps: [{ token: i1__namespace.Router }, { token: i2__namespace.ViewportScroller }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
888
|
-
ScrollService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: ScrollService, providedIn: 'root' });
|
|
889
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: ScrollService, decorators: [{
|
|
890
|
-
type: i0.Injectable,
|
|
891
|
-
args: [{
|
|
892
|
-
providedIn: 'root'
|
|
893
|
-
}]
|
|
894
|
-
}], ctorParameters: function () { return [{ type: i1__namespace.Router }, { type: i2__namespace.ViewportScroller }]; } });
|
|
895
|
-
|
|
896
|
-
var VisibilityService = /** @class */ (function () {
|
|
897
|
-
function VisibilityService() {
|
|
898
|
-
this.visibility$ = rxjs.merge(rxjs.fromEvent(document, 'visibilitychange'), rxjs.fromEvent(window, 'focus'), rxjs.fromEvent(window, 'blur')).pipe(operators.debounceTime(50), operators.startWith(true), operators.map(function () { return document.hasFocus(); }), operators.distinctUntilChanged(), operators.shareReplay(1));
|
|
899
|
-
}
|
|
900
|
-
VisibilityService.prototype.getVisibilityObservable = function () {
|
|
901
|
-
return this.visibility$;
|
|
902
|
-
};
|
|
903
|
-
return VisibilityService;
|
|
904
|
-
}());
|
|
905
|
-
VisibilityService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: VisibilityService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
906
|
-
VisibilityService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: VisibilityService, providedIn: 'root' });
|
|
907
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: VisibilityService, decorators: [{
|
|
908
|
-
type: i0.Injectable,
|
|
909
|
-
args: [{ providedIn: 'root' }]
|
|
910
|
-
}], ctorParameters: function () { return []; } });
|
|
911
|
-
|
|
912
|
-
var WithCredentialsInterceptor = /** @class */ (function () {
|
|
913
|
-
function WithCredentialsInterceptor() {
|
|
914
|
-
}
|
|
915
|
-
/**
|
|
916
|
-
* @override
|
|
917
|
-
*/
|
|
918
|
-
WithCredentialsInterceptor.prototype.intercept = function (req, next) {
|
|
919
|
-
var cloned = req.clone({
|
|
920
|
-
withCredentials: true
|
|
921
|
-
});
|
|
922
|
-
return next.handle(cloned);
|
|
923
|
-
};
|
|
924
|
-
return WithCredentialsInterceptor;
|
|
925
|
-
}());
|
|
926
|
-
WithCredentialsInterceptor.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: WithCredentialsInterceptor, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
927
|
-
WithCredentialsInterceptor.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: WithCredentialsInterceptor });
|
|
928
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: WithCredentialsInterceptor, decorators: [{
|
|
929
|
-
type: i0.Injectable
|
|
930
|
-
}] });
|
|
931
|
-
|
|
932
|
-
var UrlInfo = /** @class */ (function () {
|
|
933
|
-
function UrlInfo(protocol, host, hostname, port, pathname, hash, search) {
|
|
934
|
-
this.protocol = protocol;
|
|
935
|
-
this.host = host;
|
|
936
|
-
this.hostname = hostname;
|
|
937
|
-
this.port = port;
|
|
938
|
-
this.pathname = pathname;
|
|
939
|
-
this.hash = hash;
|
|
940
|
-
this.search = search;
|
|
941
|
-
}
|
|
942
|
-
UrlInfo.parse = function (urlString) {
|
|
943
|
-
var parser = document.createElement('a');
|
|
944
|
-
parser.href = urlString;
|
|
945
|
-
return new UrlInfo(parser.protocol, parser.host, parser.hostname, parser.port === '' ? 80 : +parser.port, parser.pathname, parser.hash, parser.search);
|
|
946
|
-
};
|
|
947
|
-
UrlInfo.prototype.getRoot = function () {
|
|
948
|
-
var root = this.protocol + '//' + this.hostname;
|
|
949
|
-
if (this.port !== 80)
|
|
950
|
-
root += ':' + this.port;
|
|
951
|
-
return root;
|
|
952
|
-
};
|
|
953
|
-
UrlInfo.prototype.getUrl = function () {
|
|
954
|
-
return this.getRoot() + this.pathname;
|
|
955
|
-
};
|
|
956
|
-
return UrlInfo;
|
|
957
|
-
}());
|
|
958
|
-
|
|
959
|
-
var RedirectToLoginInterceptor = /** @class */ (function () {
|
|
960
|
-
function RedirectToLoginInterceptor(router, loginPath) {
|
|
961
|
-
this.router = router;
|
|
962
|
-
this.loginPath = loginPath;
|
|
963
|
-
}
|
|
964
|
-
/**
|
|
965
|
-
* @override
|
|
966
|
-
*/
|
|
967
|
-
RedirectToLoginInterceptor.prototype.intercept = function (req, next) {
|
|
968
|
-
var _this = this;
|
|
969
|
-
return next.handle(req).pipe(operators.catchError(function (err) {
|
|
970
|
-
if (err instanceof i2$1.HttpErrorResponse) {
|
|
971
|
-
if (err.status === 401) {
|
|
972
|
-
_this.router.navigate([_this.loginPath]);
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
return rxjs.throwError(err);
|
|
976
|
-
}));
|
|
977
|
-
};
|
|
978
|
-
return RedirectToLoginInterceptor;
|
|
979
|
-
}());
|
|
980
|
-
RedirectToLoginInterceptor.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: RedirectToLoginInterceptor, deps: [{ token: i1__namespace.Router }, { token: DDR_LOGIN_PATH }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
981
|
-
RedirectToLoginInterceptor.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: RedirectToLoginInterceptor });
|
|
982
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: RedirectToLoginInterceptor, decorators: [{
|
|
983
|
-
type: i0.Injectable
|
|
984
|
-
}], ctorParameters: function () {
|
|
985
|
-
return [{ type: i1__namespace.Router }, { type: undefined, decorators: [{
|
|
986
|
-
type: i0.Inject,
|
|
987
|
-
args: [DDR_LOGIN_PATH]
|
|
988
|
-
}] }];
|
|
989
|
-
} });
|
|
990
|
-
|
|
991
|
-
var JwtService = /** @class */ (function () {
|
|
992
|
-
function JwtService(storagePrefix) {
|
|
993
|
-
this.storagePrefix = storagePrefix;
|
|
994
|
-
/**
|
|
995
|
-
* The current token.
|
|
996
|
-
*/
|
|
997
|
-
this.token = null;
|
|
998
|
-
/**
|
|
999
|
-
* The expiry of the current token.
|
|
1000
|
-
*/
|
|
1001
|
-
this.tokenExpiry = null;
|
|
1002
|
-
}
|
|
1003
|
-
/**
|
|
1004
|
-
* Sets the current token and a refresh token.
|
|
1005
|
-
*/
|
|
1006
|
-
JwtService.prototype.setTokens = function (token, refreshToken) {
|
|
1007
|
-
this.setToken(token);
|
|
1008
|
-
localStorage.setItem(this.getRefreshTokenStorageKey(), refreshToken);
|
|
1009
|
-
};
|
|
1010
|
-
/**
|
|
1011
|
-
* Sets the current token.
|
|
1012
|
-
*/
|
|
1013
|
-
JwtService.prototype.setToken = function (token) {
|
|
1014
|
-
this.token = token;
|
|
1015
|
-
var decodedToken = JSON.parse(atob(token.split('.')[1]));
|
|
1016
|
-
this.tokenExpiry = decodedToken.exp * 1000;
|
|
1017
|
-
console.log('New refresh token, expiry', new Date(this.tokenExpiry));
|
|
1018
|
-
};
|
|
1019
|
-
/**
|
|
1020
|
-
* Gets the current token.
|
|
1021
|
-
*/
|
|
1022
|
-
JwtService.prototype.getToken = function () {
|
|
1023
|
-
return this.token;
|
|
1024
|
-
};
|
|
1025
|
-
/**
|
|
1026
|
-
* Gets the refresh token.
|
|
1027
|
-
*/
|
|
1028
|
-
JwtService.prototype.getRefreshToken = function () {
|
|
1029
|
-
return localStorage.getItem(this.getRefreshTokenStorageKey());
|
|
1030
|
-
};
|
|
1031
|
-
/**
|
|
1032
|
-
* Checks if the current token expired.
|
|
1033
|
-
*/
|
|
1034
|
-
JwtService.prototype.isExpired = function () {
|
|
1035
|
-
var now = new Date().getTime();
|
|
1036
|
-
return null == this.tokenExpiry || this.tokenExpiry < now;
|
|
1037
|
-
};
|
|
1038
|
-
/**
|
|
1039
|
-
* Checks if the current token is about to expire.
|
|
1040
|
-
* @param expiryMs
|
|
1041
|
-
*/
|
|
1042
|
-
JwtService.prototype.isAboutToExpire = function (expiryMs) {
|
|
1043
|
-
if (expiryMs === void 0) { expiryMs = 60000; }
|
|
1044
|
-
var now = new Date().getTime();
|
|
1045
|
-
return null == this.tokenExpiry || this.tokenExpiry - expiryMs < now;
|
|
1046
|
-
};
|
|
1047
|
-
/**
|
|
1048
|
-
* Clears all token information.
|
|
1049
|
-
*/
|
|
1050
|
-
JwtService.prototype.clear = function () {
|
|
1051
|
-
this.token = null;
|
|
1052
|
-
this.tokenExpiry = null;
|
|
1053
|
-
localStorage.removeItem(this.getRefreshTokenStorageKey());
|
|
1054
|
-
};
|
|
1055
|
-
JwtService.prototype.getRefreshTokenStorageKey = function () {
|
|
1056
|
-
return this.storagePrefix + '.jwt.refresh_token';
|
|
1057
|
-
};
|
|
1058
|
-
return JwtService;
|
|
1059
|
-
}());
|
|
1060
|
-
JwtService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: JwtService, deps: [{ token: DDR_STORAGE_PREFIX }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1061
|
-
JwtService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: JwtService, providedIn: 'root' });
|
|
1062
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: JwtService, decorators: [{
|
|
1063
|
-
type: i0.Injectable,
|
|
1064
|
-
args: [{
|
|
1065
|
-
providedIn: 'root'
|
|
1066
|
-
}]
|
|
1067
|
-
}], ctorParameters: function () {
|
|
1068
|
-
return [{ type: undefined, decorators: [{
|
|
1069
|
-
type: i0.Inject,
|
|
1070
|
-
args: [DDR_STORAGE_PREFIX]
|
|
1071
|
-
}] }];
|
|
1072
|
-
} });
|
|
1073
|
-
|
|
1074
|
-
var JwtInterceptor = /** @class */ (function () {
|
|
1075
|
-
function JwtInterceptor(jwtService) {
|
|
1076
|
-
this.jwtService = jwtService;
|
|
1077
|
-
}
|
|
1078
|
-
/**
|
|
1079
|
-
* @override
|
|
1080
|
-
*/
|
|
1081
|
-
JwtInterceptor.prototype.intercept = function (req, next) {
|
|
1082
|
-
var token = this.jwtService.getToken();
|
|
1083
|
-
if (null !== token && !this.jwtService.isExpired()) {
|
|
1084
|
-
req = req.clone({
|
|
1085
|
-
headers: req.headers.set('Authorization', 'Bearer ' + token)
|
|
1086
|
-
});
|
|
1087
|
-
}
|
|
1088
|
-
return next.handle(req);
|
|
1089
|
-
};
|
|
1090
|
-
return JwtInterceptor;
|
|
1091
|
-
}());
|
|
1092
|
-
JwtInterceptor.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: JwtInterceptor, deps: [{ token: JwtService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1093
|
-
JwtInterceptor.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: JwtInterceptor });
|
|
1094
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: JwtInterceptor, decorators: [{
|
|
1095
|
-
type: i0.Injectable
|
|
1096
|
-
}], ctorParameters: function () { return [{ type: JwtService }]; } });
|
|
1097
|
-
|
|
1098
|
-
var JwtRefreshTokenInterceptor = /** @class */ (function () {
|
|
1099
|
-
function JwtRefreshTokenInterceptor(jwtService, httpClient, jwtRefreshTokenUrl) {
|
|
1100
|
-
this.jwtService = jwtService;
|
|
1101
|
-
this.httpClient = httpClient;
|
|
1102
|
-
this.jwtRefreshTokenUrl = jwtRefreshTokenUrl;
|
|
1103
|
-
this.refreshTokenRequest$ = null;
|
|
1104
|
-
}
|
|
1105
|
-
/**
|
|
1106
|
-
* @override
|
|
1107
|
-
*/
|
|
1108
|
-
JwtRefreshTokenInterceptor.prototype.intercept = function (req, next) {
|
|
1109
|
-
if (this.jwtService.isAboutToExpire() && !(req.url === this.jwtRefreshTokenUrl)) {
|
|
1110
|
-
var refreshToken = this.jwtService.getRefreshToken();
|
|
1111
|
-
if (null != refreshToken) {
|
|
1112
|
-
return this.getRefreshTokenRequest(refreshToken).pipe(operators.switchMap(function () { return next.handle(req); }));
|
|
1113
|
-
}
|
|
1114
|
-
}
|
|
1115
|
-
return next.handle(req);
|
|
1116
|
-
};
|
|
1117
|
-
JwtRefreshTokenInterceptor.prototype.getRefreshTokenRequest = function (refreshToken) {
|
|
1118
|
-
var _this = this;
|
|
1119
|
-
if (null == this.refreshTokenRequest$) {
|
|
1120
|
-
this.refreshTokenRequest$ = this.httpClient.post(this.jwtRefreshTokenUrl, { refresh_token: refreshToken }).pipe(operators.map(function (response) {
|
|
1121
|
-
_this.jwtService.setTokens(response.token, response.refresh_token);
|
|
1122
|
-
_this.refreshTokenRequest$ = null;
|
|
1123
|
-
return response;
|
|
1124
|
-
}), operators.catchError(function (error) {
|
|
1125
|
-
_this.jwtService.clear();
|
|
1126
|
-
_this.refreshTokenRequest$ = null;
|
|
1127
|
-
return rxjs.throwError(error);
|
|
1128
|
-
}), operators.shareReplay(1));
|
|
1129
|
-
}
|
|
1130
|
-
return this.refreshTokenRequest$;
|
|
1131
|
-
};
|
|
1132
|
-
return JwtRefreshTokenInterceptor;
|
|
1133
|
-
}());
|
|
1134
|
-
JwtRefreshTokenInterceptor.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: JwtRefreshTokenInterceptor, deps: [{ token: JwtService }, { token: i2__namespace$1.HttpClient }, { token: DDR_JWT_REFRESH_TOKEN_URL }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1135
|
-
JwtRefreshTokenInterceptor.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: JwtRefreshTokenInterceptor });
|
|
1136
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: JwtRefreshTokenInterceptor, decorators: [{
|
|
1137
|
-
type: i0.Injectable
|
|
1138
|
-
}], ctorParameters: function () {
|
|
1139
|
-
return [{ type: JwtService }, { type: i2__namespace$1.HttpClient }, { type: undefined, decorators: [{
|
|
1140
|
-
type: i0.Inject,
|
|
1141
|
-
args: [DDR_JWT_REFRESH_TOKEN_URL]
|
|
1142
|
-
}] }];
|
|
1143
|
-
} });
|
|
1144
|
-
|
|
1145
|
-
/*
|
|
1146
|
-
* Public API Surface of ngx-extensions
|
|
1147
|
-
*/
|
|
1148
|
-
|
|
1149
|
-
/**
|
|
1150
|
-
* Generated bundle index. Do not edit.
|
|
1151
|
-
*/
|
|
1152
|
-
|
|
1153
|
-
exports.BottomHitDirective = BottomHitDirective;
|
|
1154
|
-
exports.CollectionUtils = CollectionUtils;
|
|
1155
|
-
exports.CookieService = CookieService;
|
|
1156
|
-
exports.DDR_JWT_REFRESH_TOKEN_URL = DDR_JWT_REFRESH_TOKEN_URL;
|
|
1157
|
-
exports.DDR_LOGIN_PATH = DDR_LOGIN_PATH;
|
|
1158
|
-
exports.DDR_STORAGE_PREFIX = DDR_STORAGE_PREFIX;
|
|
1159
|
-
exports.DdrExtensionsModule = DdrExtensionsModule;
|
|
1160
|
-
exports.Debounce = Debounce;
|
|
1161
|
-
exports.JwtInterceptor = JwtInterceptor;
|
|
1162
|
-
exports.JwtRefreshTokenInterceptor = JwtRefreshTokenInterceptor;
|
|
1163
|
-
exports.JwtService = JwtService;
|
|
1164
|
-
exports.LazyImageDirective = LazyImageDirective;
|
|
1165
|
-
exports.Limit = Limit;
|
|
1166
|
-
exports.NumberUtils = NumberUtils;
|
|
1167
|
-
exports.ObjectUtils = ObjectUtils;
|
|
1168
|
-
exports.RedirectToLoginInterceptor = RedirectToLoginInterceptor;
|
|
1169
|
-
exports.ScrollService = ScrollService;
|
|
1170
|
-
exports.StringUtils = StringUtils;
|
|
1171
|
-
exports.UrlInfo = UrlInfo;
|
|
1172
|
-
exports.VisibilityService = VisibilityService;
|
|
1173
|
-
exports.WithCredentialsInterceptor = WithCredentialsInterceptor;
|
|
1174
|
-
|
|
1175
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1176
|
-
|
|
1177
|
-
}));
|
|
1178
|
-
//# sourceMappingURL=dontdrinkandroot-ngx-extensions.umd.js.map
|