@sambath999/localize-token 12.4.11 → 12.4.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/bundles/sambath999-localize-token.umd.js +400 -1125
  2. package/bundles/sambath999-localize-token.umd.js.map +1 -1
  3. package/{localize-logindlg/localize-logindlg.component.d.ts → components/localize-token-login-dialog.component.d.ts} +14 -17
  4. package/esm2015/components/localize-token-login-dialog.component.js +395 -0
  5. package/esm2015/models/localize-token-models.js +2 -0
  6. package/esm2015/models/localize-token.module.js +26 -0
  7. package/esm2015/public-api.js +6 -15
  8. package/esm2015/sambath999-localize-token.js +1 -1
  9. package/esm2015/services/localize-token-configure.service.js +32 -0
  10. package/esm2015/services/localize-token-dialog.service.js +64 -0
  11. package/fesm2015/sambath999-localize-token.js +64 -906
  12. package/fesm2015/sambath999-localize-token.js.map +1 -1
  13. package/{localize-logindlg/localize-logindlg.service.d.ts → models/localize-token-models.d.ts} +1 -10
  14. package/package.json +2 -2
  15. package/public-api.d.ts +5 -13
  16. package/sambath999-localize-token.metadata.json +1 -1
  17. package/services/localize-token-configure.service.d.ts +9 -0
  18. package/services/localize-token-dialog.service.d.ts +10 -0
  19. package/README.md +0 -57
  20. package/esm2015/localize-api-token/localize-api-token.module.js +0 -21
  21. package/esm2015/localize-api-token/localize-api-token.service.js +0 -34
  22. package/esm2015/localize-logindlg/localize-logindlg.component.js +0 -423
  23. package/esm2015/localize-logindlg/localize-logindlg.module.js +0 -28
  24. package/esm2015/localize-logindlg/localize-logindlg.service.js +0 -64
  25. package/esm2015/localize-token/helpers/interfaces.js +0 -19
  26. package/esm2015/localize-token/helpers/localize.api.assets.js +0 -20
  27. package/esm2015/localize-token/helpers/loccalize.api.helper.js +0 -267
  28. package/esm2015/localize-token/localize.api.service.js +0 -242
  29. package/esm2015/localize-token/localize.token.js +0 -60
  30. package/esm2015/localize-token/localize.token.module.js +0 -14
  31. package/esm2015/localize-token/localize.token.service.js +0 -94
  32. package/esm2015/localize-token/localize.token.storage.js +0 -107
  33. package/localize-api-token/localize-api-token.module.d.ts +0 -2
  34. package/localize-api-token/localize-api-token.service.d.ts +0 -12
  35. package/localize-logindlg/localize-logindlg.module.d.ts +0 -2
  36. package/localize-token/helpers/interfaces.d.ts +0 -89
  37. package/localize-token/helpers/localize.api.assets.d.ts +0 -5
  38. package/localize-token/helpers/loccalize.api.helper.d.ts +0 -32
  39. package/localize-token/localize.api.service.d.ts +0 -55
  40. package/localize-token/localize.token.d.ts +0 -55
  41. package/localize-token/localize.token.service.d.ts +0 -36
  42. package/localize-token/localize.token.storage.d.ts +0 -61
  43. /package/{localize-token/localize.token.module.d.ts → models/localize-token.module.d.ts} +0 -0
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('tslib'), require('@angular/common/http'), require('@angular/core'), require('primeng/api'), require('primeng/dynamicdialog'), require('jwt-decode'), require('rxjs'), require('@angular/platform-browser'), require('@angular/common'), require('primeng/toast'), require('primeng/inputtext'), require('primeng/button'), require('@angular/forms')) :
3
- typeof define === 'function' && define.amd ? define('@sambath999/localize-token', ['exports', 'tslib', '@angular/common/http', '@angular/core', 'primeng/api', 'primeng/dynamicdialog', 'jwt-decode', 'rxjs', '@angular/platform-browser', '@angular/common', 'primeng/toast', 'primeng/inputtext', 'primeng/button', '@angular/forms'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.sambath999 = global.sambath999 || {}, global.sambath999["localize-token"] = {}), global.tslib, global.ng.common.http, global.ng.core, global.api, global.dynamicdialog, global.jwt_decode, global.rxjs, global.ng.platformBrowser, global.ng.common, global.toast, global.inputtext, global.button, global.ng.forms));
5
- })(this, (function (exports, tslib, i1, i0, api, dynamicdialog, jwt_decode, rxjs, platformBrowser, common, toast, inputtext, button, forms) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('primeng/api'), require('primeng/dynamicdialog'), require('@angular/platform-browser'), require('@sambath999/localize-api'), require('@angular/common'), require('primeng/toast'), require('primeng/inputtext'), require('primeng/button'), require('@angular/forms')) :
3
+ typeof define === 'function' && define.amd ? define('@sambath999/localize-token', ['exports', '@angular/core', 'primeng/api', 'primeng/dynamicdialog', '@angular/platform-browser', '@sambath999/localize-api', '@angular/common', 'primeng/toast', 'primeng/inputtext', 'primeng/button', '@angular/forms'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.sambath999 = global.sambath999 || {}, global.sambath999["localize-token"] = {}), global.ng.core, global.api, global.dynamicdialog, global.ng.platformBrowser, global.i1, global.ng.common, global.toast, global.inputtext, global.button, global.ng.forms));
5
+ })(this, (function (exports, i0, api, dynamicdialog, platformBrowser, i1, common, toast, inputtext, button, forms) { 'use strict';
6
6
 
7
7
  function _interopNamespace(e) {
8
8
  if (e && e.__esModule) return e;
@@ -22,493 +22,413 @@
22
22
  return Object.freeze(n);
23
23
  }
24
24
 
25
- var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
26
25
  var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
27
- var jwt_decode__namespace = /*#__PURE__*/_interopNamespace(jwt_decode);
26
+ var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
28
27
 
29
- /**
30
- * Assembly of @package ng2-cookies @see https://www.npmjs.com/package/ng2-cookies
31
- *
32
- * Reassembled by
33
- * @author sambath999
34
- * @date_29_09_2021
35
- * Updated from raw parameters to
36
- * @param {ICookieOptions} options and added another newer cookie flag
37
- * @param {string} samesite
38
- * @param {constant} SameSiteTypes, @param {string} strict "strict", @param {string} lax "lax", @param {string} none "none"
39
- *
40
- * @enum
41
- */
42
- var LocalizeTokenStorage = /** @class */ (function () {
43
- function LocalizeTokenStorage(_defaultOptions) {
44
- this.defaultOptions = _defaultOptions !== null && _defaultOptions !== void 0 ? _defaultOptions : this.getDefaultOptions;
45
- }
46
- Object.defineProperty(LocalizeTokenStorage.prototype, "getDefaultOptions", {
47
- get: function () {
48
- var mainDomain = extractMainDomain(window.location.hostname);
49
- return {
50
- path: '/',
51
- domain: mainDomain,
52
- secure: true,
53
- // samesite: SameSiteType.strict,
54
- expires: 1
55
- };
56
- },
57
- enumerable: false,
58
- configurable: true
59
- });
60
- /**
61
- * Checks the existence of a single cookie by it's name
62
- *
63
- * @param {string} name Identification of the cookie
64
- * @returns existence of the cookie
65
- */
66
- LocalizeTokenStorage.prototype.check = function (name) {
67
- if (typeof document === "undefined")
68
- return false;
69
- name = encodeURIComponent(name);
70
- var regexp = new RegExp('(?:^' + name + '|;\\s*' + name + ')=(.*?)(?:;|$)', 'g');
71
- return regexp.test(document.cookie);
72
- };
73
- /**
74
- * Retrieves a single cookie by it's name
75
- *
76
- * @param {string} name Identification of the Cookie
77
- * @returns The Cookie's value
78
- */
79
- LocalizeTokenStorage.prototype.get = function (name) {
80
- if (!this.check(name))
81
- return undefined;
82
- name = encodeURIComponent(name);
83
- var regexp = new RegExp('(?:^' + name + '|;\\s*' + name + ')=(.*?)(?:;|$)', 'g');
84
- var result = regexp.exec(document.cookie);
85
- return result ? decodeURIComponent(result[1]) : undefined;
86
- };
87
- /**
88
- * Retrieves a a list of all cookie avaiable
89
- *
90
- * @returns Object with all Cookies
91
- */
92
- LocalizeTokenStorage.prototype.getAll = function () {
93
- var e_1, _a;
94
- var cookies = {};
95
- if (document.cookie) {
96
- var split = document.cookie.split(';');
97
- try {
98
- for (var split_1 = tslib.__values(split), split_1_1 = split_1.next(); !split_1_1.done; split_1_1 = split_1.next()) {
99
- var s = split_1_1.value;
100
- var currCookie = s.split('=');
101
- currCookie[0] = currCookie[0].trim();
102
- cookies[decodeURIComponent(currCookie[0])] = decodeURIComponent(currCookie[1]);
103
- }
104
- }
105
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
106
- finally {
107
- try {
108
- if (split_1_1 && !split_1_1.done && (_a = split_1.return)) _a.call(split_1);
109
- }
110
- finally { if (e_1) throw e_1.error; }
111
- }
28
+ /*! *****************************************************************************
29
+ Copyright (c) Microsoft Corporation.
30
+
31
+ Permission to use, copy, modify, and/or distribute this software for any
32
+ purpose with or without fee is hereby granted.
33
+
34
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
35
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
36
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
37
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
38
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
39
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
40
+ PERFORMANCE OF THIS SOFTWARE.
41
+ ***************************************************************************** */
42
+ /* global Reflect, Promise */
43
+ var extendStatics = function (d, b) {
44
+ extendStatics = Object.setPrototypeOf ||
45
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
46
+ function (d, b) { for (var p in b)
47
+ if (Object.prototype.hasOwnProperty.call(b, p))
48
+ d[p] = b[p]; };
49
+ return extendStatics(d, b);
50
+ };
51
+ function __extends(d, b) {
52
+ if (typeof b !== "function" && b !== null)
53
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
54
+ extendStatics(d, b);
55
+ function __() { this.constructor = d; }
56
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
57
+ }
58
+ var __assign = function () {
59
+ __assign = Object.assign || function __assign(t) {
60
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
61
+ s = arguments[i];
62
+ for (var p in s)
63
+ if (Object.prototype.hasOwnProperty.call(s, p))
64
+ t[p] = s[p];
112
65
  }
113
- return cookies;
66
+ return t;
114
67
  };
115
- LocalizeTokenStorage.prototype.set = function (name, value, options) {
116
- options !== null && options !== void 0 ? options : (options = this.defaultOptions);
117
- var _a = Object.assign(Object.assign({}, this.defaultOptions), options), expires = _a.expires, path = _a.path, domain = _a.domain, secure = _a.secure, samesite = _a.samesite;
118
- var cookieStr = encodeURIComponent(name) + "=" + encodeURIComponent(value) + ";";
119
- if (expires) {
120
- var dtExpires = typeof expires === 'number' ? new Date(Date.now() + expires * 864e5) : expires;
121
- cookieStr += "expires=" + dtExpires.toUTCString() + ";";
68
+ return __assign.apply(this, arguments);
69
+ };
70
+ function __rest(s, e) {
71
+ var t = {};
72
+ for (var p in s)
73
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
74
+ t[p] = s[p];
75
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
76
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
77
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
78
+ t[p[i]] = s[p[i]];
122
79
  }
123
- cookieStr += path ? "path=" + path + ";" : '';
124
- cookieStr += domain ? "domain=" + domain + ";" : '';
125
- cookieStr += secure ? 'secure;' : '';
126
- cookieStr += samesite ? "samesite=" + samesite + ";" : '';
127
- document.cookie = cookieStr;
128
- };
129
- /**
130
- * Removes specified Cookie
131
- *
132
- * @param {string} name Cookie's identification
133
- * @param {string} path Path relative to the domain where the cookie should be avaiable. Default /
134
- * @param {string} domain Domain where the cookie should be avaiable. Default current domain
135
- */
136
- LocalizeTokenStorage.prototype.delete = function (name, path, domain) {
137
- if (path === void 0) { path = '/'; }
138
- if (domain === void 0) { domain = window.location.hostname; }
139
- this.set(name, '', { path: path, domain: domain, expires: -1 });
140
- };
141
- /**
142
- * Delete all cookie avaiable
143
- */
144
- LocalizeTokenStorage.prototype.deleteAll = function (path, domain) {
145
- var e_2, _a;
146
- var cookies = this.getAll();
147
- try {
148
- for (var _b = tslib.__values(Object.keys(cookies)), _c = _b.next(); !_c.done; _c = _b.next()) {
149
- var cookieName = _c.value;
150
- this.delete(cookieName, path, domain);
151
- }
80
+ return t;
81
+ }
82
+ function __decorate(decorators, target, key, desc) {
83
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
84
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
85
+ r = Reflect.decorate(decorators, target, key, desc);
86
+ else
87
+ for (var i = decorators.length - 1; i >= 0; i--)
88
+ if (d = decorators[i])
89
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
90
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
91
+ }
92
+ function __param(paramIndex, decorator) {
93
+ return function (target, key) { decorator(target, key, paramIndex); };
94
+ }
95
+ function __metadata(metadataKey, metadataValue) {
96
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
97
+ return Reflect.metadata(metadataKey, metadataValue);
98
+ }
99
+ function __awaiter(thisArg, _arguments, P, generator) {
100
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
101
+ return new (P || (P = Promise))(function (resolve, reject) {
102
+ function fulfilled(value) { try {
103
+ step(generator.next(value));
152
104
  }
153
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
154
- finally {
155
- try {
156
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
157
- }
158
- finally { if (e_2) throw e_2.error; }
105
+ catch (e) {
106
+ reject(e);
107
+ } }
108
+ function rejected(value) { try {
109
+ step(generator["throw"](value));
159
110
  }
160
- };
161
- return LocalizeTokenStorage;
162
- }());
163
-
164
- var LocalizeToken = /** @class */ (function () {
165
- function LocalizeToken() {
166
- }
167
- return LocalizeToken;
168
- }());
169
- LocalizeToken.storage = new LocalizeTokenStorage();
170
- LocalizeToken.httpHeaders = {
171
- AUTHORIZATION: 'Authorization',
172
- X_TENANT: 'X-Tenant',
173
- X_REFRESH_TOKEN: 'X-RefreshToken',
174
- CONTENT_TYPE: 'Content-Type',
175
- X_CLIENT: 'X-Client',
176
- X_SECRET: 'X-Secret'
177
- };
178
- /**
179
- * Waits for a specified amount of time.
180
- * @param milliseconds - The milliseconds to wait.
181
- * @param when - The condition to wait for. Default is true.
182
- * @returns - Promise<void>
183
- */
184
- function waitFor(milliseconds, when) {
185
- if (when === void 0) { when = true; }
186
- return tslib.__awaiter(this, void 0, void 0, function () {
187
- return tslib.__generator(this, function (_a) {
188
- switch (_a.label) {
189
- case 0:
190
- if (!when)
191
- return [2 /*return*/];
192
- return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, milliseconds); })];
193
- case 1:
194
- _a.sent();
195
- return [2 /*return*/];
196
- }
197
- });
111
+ catch (e) {
112
+ reject(e);
113
+ } }
114
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
115
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
198
116
  });
199
117
  }
200
- /**
201
- * Waits until the condition is met.
202
- * @param when - The condition to wait for.
203
- * @param intervalNumber - The interval number in milliseconds to check the condition. Default is 50.
204
- */
205
- function waitUntil(when, intervalNumber) {
206
- if (intervalNumber === void 0) { intervalNumber = 50; }
207
- return tslib.__awaiter(this, void 0, void 0, function () {
208
- function isConditionMet() {
209
- return tslib.__awaiter(this, void 0, void 0, function () {
210
- var cond, result, _a;
211
- return tslib.__generator(this, function (_b) {
212
- switch (_b.label) {
213
- case 0:
214
- cond = when();
215
- if (!(cond instanceof Promise)) return [3 /*break*/, 2];
216
- return [4 /*yield*/, cond];
217
- case 1:
218
- _a = _b.sent();
219
- return [3 /*break*/, 3];
220
- case 2:
221
- _a = cond;
222
- _b.label = 3;
223
- case 3:
224
- result = _a;
225
- return [2 /*return*/, result];
226
- }
227
- });
228
- });
229
- }
230
- var _this = this;
231
- return tslib.__generator(this, function (_a) {
232
- switch (_a.label) {
233
- case 0: return [4 /*yield*/, isConditionMet()];
234
- case 1:
235
- if (_a.sent())
236
- return [2 /*return*/];
237
- return [4 /*yield*/, new Promise(function (resolve) {
238
- var interval = setInterval(function () { return tslib.__awaiter(_this, void 0, void 0, function () {
239
- return tslib.__generator(this, function (_a) {
240
- switch (_a.label) {
241
- case 0: return [4 /*yield*/, isConditionMet()];
242
- case 1:
243
- if (_a.sent()) {
244
- clearInterval(interval);
245
- resolve(true);
246
- }
247
- return [2 /*return*/];
248
- }
249
- });
250
- }); }, intervalNumber);
251
- })];
252
- case 2:
253
- _a.sent();
254
- return [2 /*return*/];
118
+ function __generator(thisArg, body) {
119
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
120
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
121
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
122
+ function verb(n) { return function (v) { return step([n, v]); }; }
123
+ function step(op) {
124
+ if (f)
125
+ throw new TypeError("Generator is already executing.");
126
+ while (_)
127
+ try {
128
+ 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)
129
+ return t;
130
+ if (y = 0, t)
131
+ op = [op[0] & 2, t.value];
132
+ switch (op[0]) {
133
+ case 0:
134
+ case 1:
135
+ t = op;
136
+ break;
137
+ case 4:
138
+ _.label++;
139
+ return { value: op[1], done: false };
140
+ case 5:
141
+ _.label++;
142
+ y = op[1];
143
+ op = [0];
144
+ continue;
145
+ case 7:
146
+ op = _.ops.pop();
147
+ _.trys.pop();
148
+ continue;
149
+ default:
150
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
151
+ _ = 0;
152
+ continue;
153
+ }
154
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
155
+ _.label = op[1];
156
+ break;
157
+ }
158
+ if (op[0] === 6 && _.label < t[1]) {
159
+ _.label = t[1];
160
+ t = op;
161
+ break;
162
+ }
163
+ if (t && _.label < t[2]) {
164
+ _.label = t[2];
165
+ _.ops.push(op);
166
+ break;
167
+ }
168
+ if (t[2])
169
+ _.ops.pop();
170
+ _.trys.pop();
171
+ continue;
172
+ }
173
+ op = body.call(thisArg, _);
255
174
  }
256
- });
257
- });
175
+ catch (e) {
176
+ op = [6, e];
177
+ y = 0;
178
+ }
179
+ finally {
180
+ f = t = 0;
181
+ }
182
+ if (op[0] & 5)
183
+ throw op[1];
184
+ return { value: op[0] ? op[1] : void 0, done: true };
185
+ }
258
186
  }
259
- function extractMainDomain(subdomain) {
260
- subdomain !== null && subdomain !== void 0 ? subdomain : (subdomain = window.location.hostname);
261
- var parts = subdomain.split('.');
262
- return parts.length > 2 ? parts.slice(-2).join('.') : subdomain;
263
- }
264
-
265
- var LocalizeTokenService = /** @class */ (function () {
266
- function LocalizeTokenService() {
267
- this.configSubject = new rxjs.BehaviorSubject({});
268
- this.isRevokingTokenSubject = new rxjs.BehaviorSubject(false);
269
- this.defaultConfig = {
270
- mainDomain: extractMainDomain(),
271
- authToken: {
272
- name: 'auth-token',
273
- },
274
- refreshToken: {
275
- name: 'refresh-token',
276
- requestUrl: '/api/token/revoke'
187
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
188
+ if (k2 === undefined)
189
+ k2 = k;
190
+ Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
191
+ }) : (function (o, m, k, k2) {
192
+ if (k2 === undefined)
193
+ k2 = k;
194
+ o[k2] = m[k];
195
+ });
196
+ function __exportStar(m, o) {
197
+ for (var p in m)
198
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
199
+ __createBinding(o, m, p);
200
+ }
201
+ function __values(o) {
202
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
203
+ if (m)
204
+ return m.call(o);
205
+ if (o && typeof o.length === "number")
206
+ return {
207
+ next: function () {
208
+ if (o && i >= o.length)
209
+ o = void 0;
210
+ return { value: o && o[i++], done: !o };
277
211
  }
278
212
  };
279
- this.isInitialized = false;
280
- this.decodeToken = function (token) { return jwt_decode__namespace.jwtDecode(token); };
213
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
214
+ }
215
+ function __read(o, n) {
216
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
217
+ if (!m)
218
+ return o;
219
+ var i = m.call(o), r, ar = [], e;
220
+ try {
221
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
222
+ ar.push(r.value);
281
223
  }
282
- Object.defineProperty(LocalizeTokenService.prototype, "config", {
283
- get: function () {
284
- this.throwIfNotInitialized();
285
- return this.configSubject.value;
286
- },
287
- enumerable: false,
288
- configurable: true
289
- });
290
- LocalizeTokenService.prototype.init = function (config) {
291
- console.log('LocalizeTokenService is initialized.');
292
- this.configSubject.next(Object.assign(Object.assign({}, this.defaultConfig), config));
293
- this.isInitialized = true;
294
- };
295
- LocalizeTokenService.prototype.ngOnDestroy = function () {
296
- // this.configSubject.complete();
297
- // this.isRevokingTokenSubject.complete();
298
- };
299
- Object.defineProperty(LocalizeTokenService.prototype, "authToken", {
300
- get: function () { return this.storageGet(); },
301
- set: function (value) {
302
- var _a;
303
- value
304
- ? this.storageSet(value)
305
- : LocalizeToken.storage.delete((_a = this.config.authToken) === null || _a === void 0 ? void 0 : _a.name);
306
- },
307
- enumerable: false,
308
- configurable: true
309
- });
310
- Object.defineProperty(LocalizeTokenService.prototype, "tenantToken", {
311
- get: function () { var _a; return LocalizeToken.storage.get(((_a = this.config.tenantToken) === null || _a === void 0 ? void 0 : _a.name) || ''); },
312
- enumerable: false,
313
- configurable: true
314
- });
315
- Object.defineProperty(LocalizeTokenService.prototype, "refreshToken", {
316
- get: function () { var _a; return LocalizeToken.storage.get(((_a = this.config.refreshToken) === null || _a === void 0 ? void 0 : _a.name) || ''); },
317
- enumerable: false,
318
- configurable: true
319
- });
320
- Object.defineProperty(LocalizeTokenService.prototype, "accessToken", {
321
- get: function () { var _a; return (_a = this.authToken) === null || _a === void 0 ? void 0 : _a.token; },
322
- set: function (value) {
323
- value && (this.authToken = { token: value, revoke: false });
324
- },
325
- enumerable: false,
326
- configurable: true
327
- });
328
- Object.defineProperty(LocalizeTokenService.prototype, "isRevokingToken", {
329
- get: function () { return this.isRevokingTokenSubject.value; /* this.authToken?.revoke ?? false */ },
330
- set: function (value) {
331
- this.isRevokingTokenSubject.next(value);
332
- this.authToken && (this.authToken = Object.assign(Object.assign({}, this.authToken), { revoke: value }));
333
- },
334
- enumerable: false,
335
- configurable: true
336
- });
337
- Object.defineProperty(LocalizeTokenService.prototype, "clientId", {
338
- get: function () { var _a; return LocalizeToken.storage.get(((_a = this.config.thirdPartyConfig) === null || _a === void 0 ? void 0 : _a.clientId) || ''); },
339
- enumerable: false,
340
- configurable: true
341
- });
342
- Object.defineProperty(LocalizeTokenService.prototype, "clientSecret", {
343
- get: function () { var _a; return LocalizeToken.storage.get(((_a = this.config.thirdPartyConfig) === null || _a === void 0 ? void 0 : _a.clientSecret) || ''); },
344
- enumerable: false,
345
- configurable: true
346
- });
347
- LocalizeTokenService.prototype.storageGet = function () {
348
- var _a;
224
+ catch (error) {
225
+ e = { error: error };
226
+ }
227
+ finally {
349
228
  try {
350
- var encoded = LocalizeToken.storage.get(((_a = this.config.authToken) === null || _a === void 0 ? void 0 : _a.name) || '');
351
- var decoded = atob(encoded || '');
352
- return JSON.parse(decoded);
229
+ if (r && !r.done && (m = i["return"]))
230
+ m.call(i);
353
231
  }
354
- catch (_b) {
355
- return undefined;
232
+ finally {
233
+ if (e)
234
+ throw e.error;
356
235
  }
357
- };
358
- LocalizeTokenService.prototype.storageSet = function (value) {
359
- var _a;
360
- var base64 = btoa(JSON.stringify(value));
361
- LocalizeToken.storage.set(((_a = this.config.authToken) === null || _a === void 0 ? void 0 : _a.name) || '', base64);
362
- };
363
- LocalizeTokenService.prototype.tokensValid = function () {
364
- var _a, _b;
365
- if (!((_a = this.refreshToken) === null || _a === void 0 ? void 0 : _a.length))
366
- return false;
367
- if (this.config.requiredTenant && !((_b = this.tenantToken) === null || _b === void 0 ? void 0 : _b.length))
368
- return false;
369
- return true;
370
- };
371
- Object.defineProperty(LocalizeTokenService.prototype, "decodeRefreshToken", {
372
- get: function () {
373
- var token = this.refreshToken;
374
- return !token ? null : this.decodeToken(token);
375
- },
376
- enumerable: false,
377
- configurable: true
378
- });
379
- LocalizeTokenService.prototype.throwIfNotInitialized = function () {
380
- if (!this.isInitialized) {
381
- throw new Error('LocalizeTokenService is not initialized. Call init() method before using it.');
236
+ }
237
+ return ar;
238
+ }
239
+ /** @deprecated */
240
+ function __spread() {
241
+ for (var ar = [], i = 0; i < arguments.length; i++)
242
+ ar = ar.concat(__read(arguments[i]));
243
+ return ar;
244
+ }
245
+ /** @deprecated */
246
+ function __spreadArrays() {
247
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
248
+ s += arguments[i].length;
249
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
250
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
251
+ r[k] = a[j];
252
+ return r;
253
+ }
254
+ function __spreadArray(to, from, pack) {
255
+ if (pack || arguments.length === 2)
256
+ for (var i = 0, l = from.length, ar; i < l; i++) {
257
+ if (ar || !(i in from)) {
258
+ if (!ar)
259
+ ar = Array.prototype.slice.call(from, 0, i);
260
+ ar[i] = from[i];
261
+ }
382
262
  }
383
- };
384
- return LocalizeTokenService;
385
- }());
386
- LocalizeTokenService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function LocalizeTokenService_Factory() { return new LocalizeTokenService(); }, token: LocalizeTokenService, providedIn: "root" });
387
- LocalizeTokenService.decorators = [
388
- { type: i0.Injectable, args: [{ providedIn: 'root' },] }
389
- ];
263
+ return to.concat(ar || from);
264
+ }
265
+ function __await(v) {
266
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
267
+ }
268
+ function __asyncGenerator(thisArg, _arguments, generator) {
269
+ if (!Symbol.asyncIterator)
270
+ throw new TypeError("Symbol.asyncIterator is not defined.");
271
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
272
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
273
+ function verb(n) { if (g[n])
274
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
275
+ function resume(n, v) { try {
276
+ step(g[n](v));
277
+ }
278
+ catch (e) {
279
+ settle(q[0][3], e);
280
+ } }
281
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
282
+ function fulfill(value) { resume("next", value); }
283
+ function reject(value) { resume("throw", value); }
284
+ function settle(f, v) { if (f(v), q.shift(), q.length)
285
+ resume(q[0][0], q[0][1]); }
286
+ }
287
+ function __asyncDelegator(o) {
288
+ var i, p;
289
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
290
+ 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; }
291
+ }
292
+ function __asyncValues(o) {
293
+ if (!Symbol.asyncIterator)
294
+ throw new TypeError("Symbol.asyncIterator is not defined.");
295
+ var m = o[Symbol.asyncIterator], i;
296
+ 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);
297
+ 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); }); }; }
298
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
299
+ }
300
+ function __makeTemplateObject(cooked, raw) {
301
+ if (Object.defineProperty) {
302
+ Object.defineProperty(cooked, "raw", { value: raw });
303
+ }
304
+ else {
305
+ cooked.raw = raw;
306
+ }
307
+ return cooked;
308
+ }
309
+ ;
310
+ var __setModuleDefault = Object.create ? (function (o, v) {
311
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
312
+ }) : function (o, v) {
313
+ o["default"] = v;
314
+ };
315
+ function __importStar(mod) {
316
+ if (mod && mod.__esModule)
317
+ return mod;
318
+ var result = {};
319
+ if (mod != null)
320
+ for (var k in mod)
321
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
322
+ __createBinding(result, mod, k);
323
+ __setModuleDefault(result, mod);
324
+ return result;
325
+ }
326
+ function __importDefault(mod) {
327
+ return (mod && mod.__esModule) ? mod : { default: mod };
328
+ }
329
+ function __classPrivateFieldGet(receiver, state, kind, f) {
330
+ if (kind === "a" && !f)
331
+ throw new TypeError("Private accessor was defined without a getter");
332
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
333
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
334
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
335
+ }
336
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
337
+ if (kind === "m")
338
+ throw new TypeError("Private method is not writable");
339
+ if (kind === "a" && !f)
340
+ throw new TypeError("Private accessor was defined without a setter");
341
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
342
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
343
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
344
+ }
390
345
 
391
- var LocalizeLogindlgComponent = /** @class */ (function () {
392
- function LocalizeLogindlgComponent(messageService, cdt, dlgRef, dlgConfig, tokenService, httpClient, sanitizer) {
393
- var _this = this;
346
+ var LocalizeTokenLoginDialogComponent = /** @class */ (function () {
347
+ function LocalizeTokenLoginDialogComponent(messageService, cdt, dlgRef, dlgConfig, sanitizer, injector) {
394
348
  this.messageService = messageService;
395
349
  this.cdt = cdt;
396
350
  this.dlgRef = dlgRef;
397
351
  this.dlgConfig = dlgConfig;
398
- this.tokenService = tokenService;
399
- this.httpClient = httpClient;
400
352
  this.sanitizer = sanitizer;
353
+ this.injector = injector;
401
354
  this.messageKey = "$login-dlg";
402
- this.loading = false;
403
- this.success = false;
404
- this.clickLogout = function () { var _a; return (_a = _this.logout) === null || _a === void 0 ? void 0 : _a.call(_this); };
405
- this.decodeToken = this.tokenService.decodeRefreshToken;
406
355
  this.loginConfig = this.dlgConfig.data.loginConfig;
356
+ this.apiLoginService = this.injector.get(i1.LocalizeApiLoginService);
407
357
  this.properties = this.loginConfig.properties;
358
+ this.decodeToken = this.apiLoginService.decodedToken;
359
+ this.logout = this.loginConfig.logoutFunc;
360
+ this.configure();
408
361
  }
409
- Object.defineProperty(LocalizeLogindlgComponent.prototype, "config", {
410
- get: function () { return this.tokenService.config; },
362
+ Object.defineProperty(LocalizeTokenLoginDialogComponent.prototype, "loading", {
363
+ get: function () { return this.apiLoginService.isLoading; },
411
364
  enumerable: false,
412
365
  configurable: true
413
366
  });
414
- LocalizeLogindlgComponent.prototype.ngOnInit = function () {
367
+ Object.defineProperty(LocalizeTokenLoginDialogComponent.prototype, "success", {
368
+ get: function () { return this.apiLoginService.isSuccess; },
369
+ enumerable: false,
370
+ configurable: true
371
+ });
372
+ LocalizeTokenLoginDialogComponent.prototype.configure = function () {
415
373
  var _this = this;
374
+ var _a, _b;
416
375
  this.dlgConfig.closable = false;
417
- this.logout = this.loginConfig.logoutFunc;
418
- this.loginUrl = this.loginConfig.loginUrl;
376
+ this.dlgConfig.dismissableMask = false;
377
+ this.dlgConfig.modal = true;
378
+ this.apiLoginService.configure({
379
+ loginUrl: this.loginConfig.loginUrl,
380
+ onSuccess: this.loginSuccess.bind(this),
381
+ onFailure: function (msg) { return _this.showMessage("error", msg); },
382
+ onError: function (msg) { return _this.showMessage("error", msg); },
383
+ loginFunction: this.loginConfig.loginFunction,
384
+ refreshTokenTtl: this.loginConfig.expire,
385
+ passwordResolver: function () { return _this.password; },
386
+ passwordValidator: (_b = (_a = this.loginConfig.properties) === null || _a === void 0 ? void 0 : _a.passwordValidator) === null || _b === void 0 ? void 0 : _b.bind(this),
387
+ });
388
+ };
389
+ LocalizeTokenLoginDialogComponent.prototype.ngOnInit = function () {
390
+ var _this = this;
419
391
  if (!this.decodeToken) {
420
- this.showMessage("error", "Token is invalid");
392
+ this.showMessage("error", "Invalid Token. Please login again.");
421
393
  setTimeout(function () { var _a; return (_a = _this.logout) === null || _a === void 0 ? void 0 : _a.call(_this); }, 2000);
422
394
  }
423
395
  };
424
- LocalizeLogindlgComponent.prototype.ngAfterViewInit = function () {
396
+ LocalizeTokenLoginDialogComponent.prototype.ngAfterViewInit = function () {
425
397
  this.cdt.detectChanges();
426
398
  };
427
- LocalizeLogindlgComponent.prototype.clickLogin = function () {
428
- var _a, _b, _c;
429
- return tslib.__awaiter(this, void 0, void 0, function () {
430
- var loginRes, cookieOptions;
431
- var _this = this;
432
- return tslib.__generator(this, function (_d) {
433
- switch (_d.label) {
434
- case 0:
435
- if (!this.isValidPassword) {
436
- return [2 /*return*/, this.showMessage("error", "Password is required and must be at least 6 characters")];
437
- }
438
- this.loading = true;
439
- return [4 /*yield*/, this.login()];
399
+ LocalizeTokenLoginDialogComponent.prototype.loginSuccess = function () {
400
+ return __awaiter(this, void 0, void 0, function () {
401
+ return __generator(this, function (_c) {
402
+ switch (_c.label) {
403
+ case 0: return [4 /*yield*/, i1.waitFor(2000)];
440
404
  case 1:
441
- loginRes = _d.sent();
442
- if (!(loginRes === null || loginRes === void 0 ? void 0 : loginRes.status)) {
443
- return [2 /*return*/, this.showMessage("error", (_a = loginRes.message) !== null && _a !== void 0 ? _a : "An error occurred")];
444
- }
445
- this.tokenService.accessToken = loginRes.tokens.accessToken;
446
- cookieOptions = { expires: (_b = this.loginConfig.expire) !== null && _b !== void 0 ? _b : 365 };
447
- LocalizeToken.storage.set(((_c = this.config.refreshToken) === null || _c === void 0 ? void 0 : _c.name) || '', loginRes.tokens.refreshToken, cookieOptions);
448
- this.success = true;
449
- setTimeout(function () {
450
- _this.dlgConfig.dismissableMask = true;
451
- _this.dlgConfig.modal = false;
452
- _this.dlgRef.close(true);
453
- }, 2000);
405
+ _c.sent();
406
+ this.dlgRef.close(true);
454
407
  return [2 /*return*/];
455
408
  }
456
409
  });
457
410
  });
458
411
  };
459
- LocalizeLogindlgComponent.prototype.login = function () {
460
- var _a, _b, _c;
461
- return tslib.__awaiter(this, void 0, void 0, function () {
462
- var e_1;
463
- var _this = this;
464
- return tslib.__generator(this, function (_d) {
465
- switch (_d.label) {
466
- case 0:
467
- if (!((_a = this.loginUrl) === null || _a === void 0 ? void 0 : _a.trim().length)) {
468
- this.showMessage("error", "Login url is required");
469
- throw new Error("Login url is required");
470
- }
471
- _d.label = 1;
412
+ LocalizeTokenLoginDialogComponent.prototype.clickLogin = function () {
413
+ return __awaiter(this, void 0, void 0, function () {
414
+ return __generator(this, function (_c) {
415
+ switch (_c.label) {
416
+ case 0: return [4 /*yield*/, this.apiLoginService.clickLogin()];
472
417
  case 1:
473
- _d.trys.push([1, 5, , 6]);
474
- if (!this.loginConfig.loginFunction) return [3 /*break*/, 3];
475
- console.log("Using custom login function");
476
- return [4 /*yield*/, this.loginConfig.loginFunction((_c = (_b = this.decodeToken) === null || _b === void 0 ? void 0 : _b.email) !== null && _c !== void 0 ? _c : '', this.password.trim(), this.getHeaders())];
477
- case 2: return [2 /*return*/, _d.sent()];
478
- case 3: return [4 /*yield*/, new Promise(function (resolve, reject) { return _this.httpClient.post(_this.loginUrl, { password: _this.password.trim() }, { headers: _this.getHeaders() }).subscribe({ next: resolve, error: reject }); })];
479
- case 4: return [2 /*return*/, _d.sent()];
480
- case 5:
481
- e_1 = _d.sent();
482
- this.showMessage("error", e_1.message);
483
- return [2 /*return*/, null];
484
- case 6: return [2 /*return*/];
418
+ _c.sent();
419
+ return [2 /*return*/];
485
420
  }
486
421
  });
487
422
  });
488
423
  };
489
- LocalizeLogindlgComponent.prototype.getHeaders = function () {
490
- var _d;
491
- var _a, _b;
492
- return _d = {},
493
- _d[LocalizeToken.httpHeaders.X_REFRESH_TOKEN] = (_a = this.tokenService.refreshToken) !== null && _a !== void 0 ? _a : "",
494
- _d[LocalizeToken.httpHeaders.X_TENANT] = (_b = this.tokenService.tenantToken) !== null && _b !== void 0 ? _b : "",
495
- _d;
424
+ LocalizeTokenLoginDialogComponent.prototype.clickLogout = function () {
425
+ var _a;
426
+ (_a = this.logout) === null || _a === void 0 ? void 0 : _a.call(this);
496
427
  };
497
- Object.defineProperty(LocalizeLogindlgComponent.prototype, "isValidPassword", {
498
- get: function () {
499
- this.loading = false;
500
- return this.properties.passwordValidator
501
- ? this.properties.passwordValidator(this.password)
502
- : this.password && this.password.trim().length >= 6 && this.password.trim().length <= 50;
503
- },
504
- enumerable: false,
505
- configurable: true
506
- });
507
- LocalizeLogindlgComponent.prototype.showMessage = function (severity, summary) {
428
+ LocalizeTokenLoginDialogComponent.prototype.showMessage = function (severity, summary) {
508
429
  this.messageService.add({ key: this.messageKey, severity: severity, summary: summary });
509
- this.loading = false;
510
430
  };
511
- Object.defineProperty(LocalizeLogindlgComponent.prototype, "sanitizedTitle", {
431
+ Object.defineProperty(LocalizeTokenLoginDialogComponent.prototype, "sanitizedTitle", {
512
432
  get: function () {
513
433
  var _a;
514
434
  return this.sanitizer.bypassSecurityTrustHtml((_a = this.properties.title) !== null && _a !== void 0 ? _a : '');
@@ -516,9 +436,12 @@
516
436
  enumerable: false,
517
437
  configurable: true
518
438
  });
519
- return LocalizeLogindlgComponent;
439
+ LocalizeTokenLoginDialogComponent.prototype.ngOnDestroy = function () {
440
+ this.apiLoginService.unConfigure();
441
+ };
442
+ return LocalizeTokenLoginDialogComponent;
520
443
  }());
521
- LocalizeLogindlgComponent.decorators = [
444
+ LocalizeTokenLoginDialogComponent.decorators = [
522
445
  { type: i0.Component, args: [{
523
446
  template: "<p-toast key=\"$login-dlg\" position=\"top-center\"></p-toast>\n <div id=\"login-dlg-wrap\">\n <div id=\"login-dlg-header\">\n <div id=\"login-logo\" class=\"p-mb-2\" style=\"background: url('{{properties.logoImage}}') no-repeat\"></div>\n <h3 *ngIf=\"!success\" [innerHTML]=\"sanitizedTitle\"></h3>\n <h3 *ngIf=\"success\" style=\"color:green !important;\">{{properties.loginSuccessMessage}}</h3>\n </div>\n <div id=\"login-dlg-content\">\n <ng-container *ngIf=\"!success\">\n <div *ngIf=\"loading\" class=\"loader-wrap\">\n <div class=\"login-dlg-loader\"></div>\n </div>\n <div class=\"login-dlg-elm\">\n <div class=\"p-inputgroup\">\n <span class=\"p-inputgroup-addon\">\n <i class=\"material-icons-round\">person</i>\n </span>\n <input disabled pInputText type=\"text\" placeholder=\"{{properties.username?.placeHolder}}\" [value]=\"decodeToken?.email\" />\n </div>\n </div>\n \n <div class=\"login-dlg-elm\">\n <div class=\"p-inputgroup\">\n <span class=\"p-inputgroup-addon\">\n <i class=\"material-icons-round\">lock</i>\n </span>\n <input [disabled]=\"loading\" (keydown.enter)=\"clickLogin()\" pInputText type=\"password\" \n placeholder=\"{{properties.password?.placeHolder}}\" [(ngModel)]=\"password\"\n autofocus />\n </div>\n </div>\n <div class=\"login-dlg-elm\">\n <button style=\"width: 100%;\" pButton type=\"button\" label=\"{{properties.loginButton?.placeHolder}}\" (click)=\"clickLogin()\"\n [disabled]=\"!password || loading\"></button>\n </div>\n \n <div class=\"login-dlg-elm login-dlg-suggest\" style=\"display:flex;align-items: center;user-select: none;\">\n <span>{{properties.logoutButton?.message}}</span>\n <button class=\"p-button-text\" pButton type=\"button\" label=\"{{properties.logoutButton?.placeHolder}}\" \n (click)=\"clickLogout()\"></button>\n </div>\n </ng-container>\n \n <ng-container *ngIf=\"success\">\n <div style=\"margin-top:35px;\"></div>\n <div class=\"check-animation-wrap\">\n <div class=\"check-main-container\">\n <div class=\"check-container\">\n <div class=\"check-background\">\n <svg viewBox=\"0 0 65 51\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M7 25L27.3077 44L58.5 7\" stroke=\"white\" stroke-width=\"13\" stroke-linecap=\"round\"\n stroke-linejoin=\"round\"></path>\n </svg>\n </div>\n </div>\n </div>\n </div>\n </ng-container>\n </div>\n </div>",
524
447
  selector: "app-localize-logindlg",
@@ -527,31 +450,30 @@
527
450
  styles: ["\n #login-dlg-wrap {\n width: 100%;\n max-width: 400px;\n margin: 0 auto;\n padding: 30px;\n height: 100%;\n }\n \n .login-dlg-elm {\n margin-top: 1rem;\n }\n\n .login-dlg-elm.login-dlg-suggest {\n display: flex ;\n align-items: center;\n user-select: none;\n border-bottom: solid 1px #ddd;\n border-radius: 5px;\n padding: 5px 10px;\n background: #f9f9f9;\n box-shadow: 1px 5px 10px -12px #000;\n }\n \n #login-dlg-header {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n \n #login-dlg-header h3 {\n font-weight: bold;\n font-size: 0.9rem;\n color: orange;\n text-align: center;\n }\n \n #login-logo {\n height: 55px;\n width: 55px;\n /* background: url(\"/assets/images/logo-300px.png\") no-repeat; */\n background-size: contain !important;\n }\n \n #login-dlg-content .p-inputgroup {\n height: 45px;\n }\n \n #login-dlg-content .p-inputgroup .p-inputgroup-addon {\n height: 45px;\n border-radius: 15px 0 0 15px;\n width: 50px;\n }\n #login-dlg-content *{\n font-size: .9rem;\n /* font-family: 'Lexend', 'Roboto', sans-serif, 'material-icons-round'; */\n }\n \n #login-dlg-content .p-inputgroup .p-inputgroup-addon * {\n font-size: 1rem;\n }\n \n #login-dlg-content .p-inputgroup input {\n height: 45px;\n border-radius: 0 15px 15px 0;\n }\n \n #login-dlg-content button {\n height: 45px;\n border-radius: 15px;\n }\n \n /*check animation block*/\n \n .check-animation-wrap {\n top: 0;\n left: 0;\n position: absolute;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: calc(100% - 200px);\n min-height: 400px;\n }\n \n .check-main-container {\n width: 100%;\n height: 100vh;\n display: flex;\n flex-flow: column;\n justify-content: center;\n align-items: center;\n }\n \n .check-container {\n width: 6.25rem;\n height: 7.5rem;\n display: flex;\n flex-flow: column;\n align-items: center;\n justify-content: space-between;\n }\n \n .check-container .check-background {\n width: 100%;\n height: calc(100% - 1.25rem);\n background: linear-gradient(to bottom right, #5de593, #41d67c);\n box-shadow: 0px 0px 0px 65px rgba(255, 255, 255, 0.25) inset, 0px 0px 0px 65px rgba(255, 255, 255, 0.25) inset;\n transform: scale(0.84);\n border-radius: 50%;\n animation: animateContainer 0.75s ease-out forwards 0.75s;\n display: flex;\n align-items: center;\n justify-content: center;\n opacity: 0;\n }\n \n .check-container .check-background svg {\n width: 65%;\n transform: translateY(0.25rem);\n stroke-dasharray: 80;\n stroke-dashoffset: 80;\n animation: animateCheck 0.35s forwards 1.25s ease-out;\n min-width: auto !important;\n }\n \n .check-container .check-shadow {\n bottom: calc(-15% - 5px);\n left: 0;\n border-radius: 50%;\n background: radial-gradient(closest-side, rgba(73, 218, 131, 1), transparent);\n animation: animateShadow 0.75s ease-out forwards 0.75s;\n }\n \n @keyframes animateContainer {\n 0% {\n opacity: 0;\n transform: scale(0);\n box-shadow: 0px 0px 0px 65px rgba(255, 255, 255, 0.25) inset, 0px 0px 0px 65px rgba(255, 255, 255, 0.25) inset;\n }\n \n 25% {\n opacity: 1;\n transform: scale(0.9);\n box-shadow: 0px 0px 0px 65px rgba(255, 255, 255, 0.25) inset, 0px 0px 0px 65px rgba(255, 255, 255, 0.25) inset;\n }\n \n 43.75% {\n transform: scale(1.15);\n box-shadow: 0px 0px 0px 43.334px rgba(255, 255, 255, 0.25) inset, 0px 0px 0px 65px rgba(255, 255, 255, 0.25) inset;\n }\n \n 62.5% {\n transform: scale(1);\n box-shadow: 0px 0px 0px 0px rgba(255, 255, 255, 0.25) inset, 0px 0px 0px 21.667px rgba(255, 255, 255, 0.25) inset;\n }\n \n 81.25% {\n box-shadow: 0px 0px 0px 0px rgba(255, 255, 255, 0.25) inset, 0px 0px 0px 0px rgba(255, 255, 255, 0.25) inset;\n }\n \n 100% {\n opacity: 1;\n box-shadow: 0px 0px 0px 0px rgba(255, 255, 255, 0.25) inset, 0px 0px 0px 0px rgba(255, 255, 255, 0.25) inset;\n }\n }\n \n @keyframes animateCheck {\n from {\n stroke-dashoffset: 80;\n }\n \n to {\n stroke-dashoffset: 0;\n }\n }\n \n @keyframes animateShadow {\n 0% {\n opacity: 0;\n width: 100%;\n height: 15%;\n }\n \n 25% {\n opacity: 0.25;\n }\n \n 43.75% {\n width: 40%;\n height: 7%;\n opacity: 0.35;\n }\n \n 100% {\n width: 85%;\n height: 15%;\n opacity: 0.25;\n }\n }\n #login-dlg-wrap .loader-wrap {\n display: flex;\n justify-content: center;\n align-items: center;\n height:100%;\n width:100%;\n position: absolute;\n top: 0;\n left: 0;\n z-index: 100;\n background: #ffffff42;\n backdrop-filter: blur(1px);\n }\n\n #login-dlg-wrap .login-dlg-loader {\n border: 15px solid #e7e7e7;\n border-top: 15px solid #52dba1;\n border-radius: 50%;\n width: 100px;\n height: 100px;\n animation: spinloader 2s linear infinite;\n }\n\n #login-dlg-wrap .loader-wrap::before {\n content: \"\";\n position: absolute;\n width: 70px;\n height: 70px;\n transform: translate(-50%, -50%);\n z-index: 1;\n border: 15px solid #e7e7e700;\n border-top: 15px solid #52dba1c9;\n border-radius: 50%;\n animation: spinloader .75s linear infinite;\n }\n\n @keyframes spinloader {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "]
528
451
  },] }
529
452
  ];
530
- LocalizeLogindlgComponent.ctorParameters = function () { return [
453
+ LocalizeTokenLoginDialogComponent.ctorParameters = function () { return [
531
454
  { type: api.MessageService },
532
455
  { type: i0.ChangeDetectorRef },
533
456
  { type: dynamicdialog.DynamicDialogRef },
534
457
  { type: dynamicdialog.DynamicDialogConfig },
535
- { type: LocalizeTokenService },
536
- { type: i1.HttpClient },
537
- { type: platformBrowser.DomSanitizer }
458
+ { type: platformBrowser.DomSanitizer },
459
+ { type: i0.Injector }
538
460
  ]; };
539
461
 
540
- var LocalizeLogindlgService = /** @class */ (function () {
541
- function LocalizeLogindlgService(injector) {
462
+ var LocalizeTokenDialogService = /** @class */ (function () {
463
+ function LocalizeTokenDialogService(injector) {
542
464
  this.injector = injector;
543
465
  }
544
- LocalizeLogindlgService.prototype.openLoginDialog = function (loginConfig, config) {
545
- return tslib.__awaiter(this, void 0, void 0, function () {
466
+ LocalizeTokenDialogService.prototype.openLoginDialog = function (loginConfig, config) {
467
+ return __awaiter(this, void 0, void 0, function () {
546
468
  var dialogService, dialog;
547
- return tslib.__generator(this, function (_b) {
469
+ return __generator(this, function (_b) {
548
470
  switch (_b.label) {
549
471
  case 0:
550
472
  config = this.intercepDialogConfig(config);
551
473
  this.initConfig(loginConfig);
552
474
  config.data = Object.assign(Object.assign({}, (config.data || {})), { loginConfig: loginConfig });
553
475
  dialogService = this.injector.get(dynamicdialog.DialogService);
554
- dialog = dialogService.open(LocalizeLogindlgComponent, config);
476
+ dialog = dialogService.open(LocalizeTokenLoginDialogComponent, config);
555
477
  return [4 /*yield*/, new Promise(function (resolve) { return dialog.onClose.subscribe(function (res) {
556
478
  if (res) {
557
479
  resolve();
@@ -564,7 +486,7 @@
564
486
  });
565
487
  });
566
488
  };
567
- LocalizeLogindlgService.prototype.intercepDialogConfig = function (config) {
489
+ LocalizeTokenDialogService.prototype.intercepDialogConfig = function (config) {
568
490
  config !== null && config !== void 0 ? config : (config = {
569
491
  header: 'Login',
570
492
  style: { 'max-width': '400px', width: '100%', 'height': '650px' },
@@ -578,7 +500,7 @@
578
500
  config.style = Object.assign(Object.assign({}, config.style), { 'border-radius': '20px' });
579
501
  return config;
580
502
  };
581
- LocalizeLogindlgService.prototype.initConfig = function (loginConfig) {
503
+ LocalizeTokenDialogService.prototype.initConfig = function (loginConfig) {
582
504
  var _a;
583
505
  loginConfig !== null && loginConfig !== void 0 ? loginConfig : (loginConfig = {});
584
506
  (_a = loginConfig.properties) !== null && _a !== void 0 ? _a : (loginConfig.properties = {
@@ -594,723 +516,76 @@
594
516
  }
595
517
  });
596
518
  };
597
- return LocalizeLogindlgService;
519
+ return LocalizeTokenDialogService;
598
520
  }());
599
- LocalizeLogindlgService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function LocalizeLogindlgService_Factory() { return new LocalizeLogindlgService(i0__namespace.ɵɵinject(i0__namespace.INJECTOR)); }, token: LocalizeLogindlgService, providedIn: "root" });
600
- LocalizeLogindlgService.decorators = [
521
+ LocalizeTokenDialogService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function LocalizeTokenDialogService_Factory() { return new LocalizeTokenDialogService(i0__namespace.ɵɵinject(i0__namespace.INJECTOR)); }, token: LocalizeTokenDialogService, providedIn: "root" });
522
+ LocalizeTokenDialogService.decorators = [
601
523
  { type: i0.Injectable, args: [{
602
524
  providedIn: 'root'
603
525
  },] }
604
526
  ];
605
- LocalizeLogindlgService.ctorParameters = function () { return [
527
+ LocalizeTokenDialogService.ctorParameters = function () { return [
606
528
  { type: i0.Injector }
607
529
  ]; };
608
530
 
609
- var LocalizeLogindlgModule = /** @class */ (function () {
610
- function LocalizeLogindlgModule() {
531
+ var LocalizeTokenModule = /** @class */ (function () {
532
+ function LocalizeTokenModule() {
611
533
  }
612
- return LocalizeLogindlgModule;
534
+ return LocalizeTokenModule;
613
535
  }());
614
- LocalizeLogindlgModule.decorators = [
536
+ LocalizeTokenModule.decorators = [
615
537
  { type: i0.NgModule, args: [{
616
- declarations: [LocalizeLogindlgComponent],
617
- exports: [LocalizeLogindlgComponent],
538
+ declarations: [LocalizeTokenLoginDialogComponent],
539
+ exports: [LocalizeTokenLoginDialogComponent],
618
540
  imports: [
619
541
  common.CommonModule,
620
542
  toast.ToastModule,
621
543
  inputtext.InputTextModule,
622
- platformBrowser.BrowserModule,
623
544
  forms.FormsModule,
624
545
  button.ButtonModule,
625
546
  ],
626
- providers: [LocalizeLogindlgService],
547
+ providers: [LocalizeTokenDialogService],
627
548
  schemas: [i0.CUSTOM_ELEMENTS_SCHEMA],
628
549
  },] }
629
550
  ];
630
551
 
631
- var LOCALIZE_API_ASSETS = {
632
- network: {
633
- noConnection: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <svg id=\"lze-no-connection\" data-name=\"Layer 2\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 77.29 70.98\">\n <defs>\n <style> .cls-1 { fill: #fff; } .cls-2, .cls-3 { fill: #e30613; } .cls-3 { stroke: #e30613; stroke-miterlimit: 10; stroke-width: .25px; } </style>\n </defs>\n <g id=\"Layer_3\" data-name=\"Layer 3\">\n <g>\n <path class=\"cls-1\" d=\"m73.29,35c-1.2,0-2.33-.53-3.09-1.46-.48-.57-11.23-13.2-31.55-13.2s-31.11,12.66-31.56,13.2c-1.4,1.71-3.92,1.95-5.63.55-1.71-1.4-1.95-3.92-.55-5.63.54-.66,13.47-16.12,37.74-16.12s37.2,15.46,37.74,16.12c1.4,1.71,1.15,4.23-.56,5.62-.71.58-1.61.9-2.53.9Z\"/>\n <path class=\"cls-1\" d=\"m63.96,45.66c-1.19,0-2.32-.53-3.08-1.44-5.79-6.05-13.86-9.39-22.24-9.21-8.38-.18-16.45,3.16-22.24,9.22-1.46,1.65-3.99,1.81-5.64.35-1.57-1.39-1.8-3.77-.52-5.43,7.32-7.89,17.64-12.29,28.4-12.12,10.76-.17,21.08,4.24,28.4,12.12,1.4,1.71,1.15,4.23-.56,5.62-.71.58-1.6.9-2.53.9Z\"/>\n <path class=\"cls-1\" d=\"m53.3,56.32c-1.24,0-2.41-.57-3.16-1.55-5.73-6.35-15.52-6.85-21.87-1.13-.4.36-.77.73-1.13,1.13-1.36,1.73-3.88,2.03-5.61.67-1.71-1.34-2.03-3.8-.73-5.54,8.39-9.85,23.18-11.04,33.03-2.65.95.81,1.84,1.69,2.65,2.65,1.34,1.75,1,4.26-.75,5.6-.7.53-1.55.82-2.43.82Z\"/>\n </g>\n <path class=\"cls-2\" d=\"m47.21,9.45l-4.06,41.36c-.64,5.42-8.39,5.39-9.01,0,0,0-4.06-41.36-4.06-41.36-.46-4.73,2.99-8.94,7.72-9.4,5.33-.58,9.97,4.09,9.4,9.4h0Z\"/>\n <circle class=\"cls-3\" cx=\"38.64\" cy=\"64.79\" r=\"6.07\"/>\n </g>\n </svg>"
634
- }
635
- };
636
-
637
- /**
638
- * Http method options
639
- */
640
- exports.EMethod = void 0;
641
- (function (EMethod) {
642
- EMethod["POST"] = "post";
643
- EMethod["GET"] = "get";
644
- EMethod["PUT"] = "put";
645
- EMethod["DELETE"] = "delete";
646
- EMethod["PATCH"] = "patch";
647
- })(exports.EMethod || (exports.EMethod = {}));
648
- // export interface INormalizedError {
649
- // error: any;
650
- // code: string;
651
- // message: string;
652
- // details?: any;
653
- // status: number;
654
- // }
655
-
656
- var LocalizeApiHelper = /** @class */ (function () {
657
- function LocalizeApiHelper() {
658
- this.defaultRetryOptions = {
659
- connectionError: {
660
- message: 'Connection error occurred. Please wait',
661
- blockScreen: true,
662
- blockScreenZIndex: 10000
663
- }
664
- };
665
- }
666
- LocalizeApiHelper.prototype.performRetry = function (options) {
667
- return tslib.__awaiter(this, void 0, void 0, function () {
668
- var attempts, lastError, consoleCount, styleElement, result, error_1;
669
- return tslib.__generator(this, function (_f) {
670
- switch (_f.label) {
671
- case 0:
672
- attempts = 0;
673
- consoleCount = 0;
674
- // Merge default retry options with provided options
675
- options = Object.assign(Object.assign({}, this.defaultRetryOptions), options);
676
- _f.label = 1;
677
- case 1:
678
- if (!(attempts < options.maxRetries())) return [3 /*break*/, 10];
679
- _f.label = 2;
680
- case 2:
681
- _f.trys.push([2, 4, , 9]);
682
- return [4 /*yield*/, options.callback()];
683
- case 3:
684
- result = _f.sent();
685
- this.removeBlocker(styleElement);
686
- return [2 /*return*/, result];
687
- case 4:
688
- error_1 = _f.sent();
689
- lastError = error_1;
690
- if (consoleCount >= 7) {
691
- console.clear();
692
- consoleCount = 0;
693
- }
694
- if (options.retryUnless && !options.retryUnless(error_1))
695
- throw error_1; // If the error should not be retried, rethrow it
696
- return [4 /*yield*/, this.onConnectionError(options, error_1)];
697
- case 5:
698
- // Handle connection error
699
- styleElement = _f.sent();
700
- if (!options.onError) return [3 /*break*/, 7];
701
- return [4 /*yield*/, this.invokeHook(options.onError.bind(this, error_1))];
702
- case 6:
703
- _f.sent();
704
- _f.label = 7;
705
- case 7:
706
- if (attempts >= options.maxRetries() - 1)
707
- throw error_1;
708
- attempts++;
709
- consoleCount++;
710
- console.warn("Attempt " + attempts + " failed. Retrying...", error_1);
711
- return [4 /*yield*/, waitFor(options.delay)];
712
- case 8:
713
- _f.sent();
714
- return [3 /*break*/, 9];
715
- case 9: return [3 /*break*/, 1];
716
- case 10:
717
- console.warn("Failed after " + options.maxRetries() + " attempts");
718
- throw lastError;
719
- }
720
- });
721
- });
722
- };
723
- LocalizeApiHelper.prototype.performRequestWithRetry = function (options, config, performRequest) {
724
- var _a, _b, _c, _d;
725
- return tslib.__awaiter(this, void 0, void 0, function () {
726
- var retryUnless;
727
- return tslib.__generator(this, function (_f) {
728
- switch (_f.label) {
729
- case 0:
730
- retryUnless = ((_a = config.retryOptions) === null || _a === void 0 ? void 0 : _a.retryFunction)
731
- || this.isConnectionError;
732
- return [4 /*yield*/, this.performRetry({
733
- connectionError: (_b = config.retryOptions) === null || _b === void 0 ? void 0 : _b.onConnectionError,
734
- maxRetries: function () { var _a, _b; return (_b = (_a = config.retryOptions) === null || _a === void 0 ? void 0 : _a.maxRetries) !== null && _b !== void 0 ? _b : 1000; },
735
- delay: (_d = (_c = config.retryOptions) === null || _c === void 0 ? void 0 : _c.delay) !== null && _d !== void 0 ? _d : 500,
736
- callback: function () { return performRequest(options); },
737
- retryUnless: retryUnless,
738
- })];
739
- case 1: return [2 /*return*/, _f.sent()];
740
- }
741
- });
742
- });
743
- };
744
- LocalizeApiHelper.prototype.buildUrl = function (baseUrl, path) {
745
- var normalizedUrl = "" + baseUrl.trim().replace(/\/?$/, '/') + path.trim().replace(/^\//, '');
746
- return normalizedUrl.endsWith('/')
747
- ? normalizedUrl.slice(0, -1)
748
- : normalizedUrl;
749
- };
750
- LocalizeApiHelper.prototype.invokeHook = function (callback) {
751
- return tslib.__awaiter(this, void 0, void 0, function () {
752
- var result;
753
- return tslib.__generator(this, function (_f) {
754
- switch (_f.label) {
755
- case 0:
756
- if (!callback)
757
- return [2 /*return*/];
758
- result = callback();
759
- if (!(result instanceof Promise)) return [3 /*break*/, 2];
760
- return [4 /*yield*/, result];
761
- case 1:
762
- _f.sent();
763
- _f.label = 2;
764
- case 2: return [2 /*return*/];
765
- }
766
- });
767
- });
768
- };
769
- LocalizeApiHelper.prototype.createRequest = function (instance, method, url, body, options, onInvalidResponseBody) {
770
- var request$ = instance.client.request(method, url, Object.assign(Object.assign({}, options), { body: body })).pipe(rxjs.takeUntil(instance.destroy$()), rxjs.map(function (body) { return extractJsonFromResponse(body, onInvalidResponseBody); }), rxjs.catchError(function (error) {
771
- // Convert to a non-observable error to handle in the promise
772
- return rxjs.throwError(function () { return error; });
773
- }));
774
- return request$;
775
- };
776
- LocalizeApiHelper.prototype.defaultRetryFunction = function (error) {
777
- // Don't retry for other errors (like 400, 401, 403, etc.)
778
- if (!this.isConnectionError(error))
779
- throw error;
780
- return true;
781
- };
782
- LocalizeApiHelper.prototype.isConnectionError = function (error) {
783
- var isNetworkError = error.status === 0;
784
- var isServerError = error.status >= 1000 && error.status < 600;
785
- return isNetworkError || isServerError;
786
- };
787
- LocalizeApiHelper.prototype.onConnectionError = function (options, error) {
788
- var _a;
789
- return tslib.__awaiter(this, void 0, void 0, function () {
790
- var styleElement;
791
- return tslib.__generator(this, function (_f) {
792
- switch (_f.label) {
793
- case 0:
794
- if (!options.connectionError)
795
- return [2 /*return*/];
796
- if (!this.isConnectionError(error)) return [3 /*break*/, 2];
797
- styleElement = this.screenBlocker(options, error, true);
798
- return [4 /*yield*/, this.invokeHook((_a = options.connectionError.callback) === null || _a === void 0 ? void 0 : _a.bind(this, error))];
799
- case 1:
800
- _f.sent();
801
- return [2 /*return*/, styleElement];
802
- case 2:
803
- this.screenBlocker(options, error, false);
804
- styleElement === null || styleElement === void 0 ? void 0 : styleElement.remove();
805
- _f.label = 3;
806
- case 3: return [2 /*return*/];
807
- }
808
- });
809
- });
810
- };
811
- LocalizeApiHelper.prototype.screenBlocker = function (optons, error, add) {
812
- if (add === void 0) { add = true; }
813
- var _a, _b, _c, _d, _e;
814
- if (!((_a = optons.connectionError) === null || _a === void 0 ? void 0 : _a.blockScreen))
815
- return;
816
- var message = ((_b = optons.connectionError) === null || _b === void 0 ? void 0 : _b.message)
817
- || 'Connection error occurred. Please wait';
818
- var errorMessage = ((_c = error === null || error === void 0 ? void 0 : error.error) === null || _c === void 0 ? void 0 : _c.message) || 'An error occurred';
819
- var suggestinMessage = ((_d = optons.connectionError) === null || _d === void 0 ? void 0 : _d.suggestionMessage)
820
- || 'Please check your internet connection or the server status.';
821
- var zIndex = ((_e = optons.connectionError) === null || _e === void 0 ? void 0 : _e.blockScreenZIndex) || 10000;
822
- var body = document.body;
823
- var blcokerHtml = "\n <div class=\"lze-blocker\">\n " + LOCALIZE_API_ASSETS.network.noConnection + "\n <div class=\"lze-blocker__message\">\n " + message + "\n <span class=\"lze-blocker__dotting\">\n <span class=\"lze-blocker__dot\"></span>\n <span class=\"lze-blocker__dot\"></span>\n <span class=\"lze-blocker__dot\"></span>\n </span>\n </div>\n <div class=\"lze-blocker__error\">" + errorMessage + "</div>\n <div class=\"lze-blocker__error_suggestion\">" + suggestinMessage + "</div>\n </div>\n ";
824
- var style = "\n div.lze-blocker {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: rgba(0, 0, 0, 0.85) !important;\n z-index: " + zIndex + ";\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n color: #fff !important;\n font-family: Arial, sans-serif;\n text-align: center;\n padding: 20px;\n box-sizing: border-box;\n overflow: hidden;\n user-select: none;\n }\n\n svg#lze-no-connection {\n width: 75px;\n height: 75px;\n margin-bottom: 20px;\n }\n \n div.lze-blocker__message {\n color: #fff !important;\n font-size: 18px !important;\n margin-bottom: 10px;\n }\n \n .lze-blocker__dotting {\n display: inline-block;\n vertical-align: middle;\n }\n span.lze-blocker__dot {\n display: inline-block;\n width: 7px;\n height: 7px;\n background-color: #ffffff !important;\n border-radius: 50%;\n margin-left: 3px;\n opacity: 0.3;\n animation: dotting 1s infinite;\n }\n .lze-blocker__dot:nth-child(1) {\n animation-delay: 0s;\n opacity: 1;\n }\n .lze-blocker__dot:nth-child(2) {\n animation-delay: 0.2s;\n }\n .lze-blocker__dot:nth-child(3) {\n animation-delay: 0.4s;\n }\n\n @keyframes dotting {\n 0%, 80%, 100% { opacity: 0.3; }\n 40% { opacity: 1; }\n }\n\n div.lze-blocker__error {\n color: #f00;\n font-size: 14px !important;\n margin-bottom: 10px;\n text-shadow: 0 0 1px #ff5f5f !important;\n }\n\n div.lze-blocker__error_suggestion {\n color: #ccc !important;\n font-size: 14px !important;\n margin-top: 10px;\n }\n \n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n ";
825
- var styleElement = document.createElement('style');
826
- if (add) {
827
- if (!document.querySelector('.lze-blocker')) {
828
- styleElement.innerHTML = style;
829
- document.head.appendChild(styleElement);
830
- body.insertAdjacentHTML('beforeend', blcokerHtml);
831
- }
832
- }
833
- else {
834
- this.removeBlocker(styleElement);
835
- }
836
- return styleElement;
837
- };
838
- LocalizeApiHelper.prototype.removeBlocker = function (styleElement) {
839
- var blocker = document.querySelector('.lze-blocker');
840
- blocker === null || blocker === void 0 ? void 0 : blocker.remove();
841
- styleElement === null || styleElement === void 0 ? void 0 : styleElement.remove();
842
- };
843
- return LocalizeApiHelper;
844
- }());
845
- function extractJsonFromResponse(body, onError) {
846
- // If already an object, just return
847
- if (typeof body === 'object' && body !== null)
848
- return body;
849
- // If it's a string, try to extract JSON portion
850
- if (typeof body === 'string') {
851
- var firstBrace = body.indexOf('{');
852
- if (firstBrace !== -1) {
853
- var jsonString = body.substring(firstBrace);
854
- try {
855
- return JSON.parse(jsonString);
856
- }
857
- catch (e) {
858
- // If parsing fails, return original string
859
- onError === null || onError === void 0 ? void 0 : onError(body);
860
- return body;
861
- }
862
- }
863
- }
864
- return body;
865
- }
866
- var ApiHelper = new LocalizeApiHelper();
867
-
868
- var SCHEMES = LocalizeToken.httpHeaders;
869
- var LocalizeApiService = /** @class */ (function () {
870
- function LocalizeApiService(httpClient, localizeTokenService) {
871
- var _this = this;
872
- this.httpClient = httpClient;
873
- this.localizeTokenService = localizeTokenService;
874
- this.destroy$ = new rxjs.Subject();
875
- this.configSubject = new rxjs.BehaviorSubject({});
876
- this.isRequestingSubject = new rxjs.BehaviorSubject(false);
877
- this.isResolvingStartupSubject = new rxjs.BehaviorSubject(false);
878
- this.defaultConfig = {
879
- waitEachRequest: { milliseconds: 0 },
880
- enableRequestCancellation: true,
881
- retryOptions: {
882
- maxRetries: 1000,
883
- delay: 1000,
884
- retryFunction: ApiHelper.defaultRetryFunction.bind(this),
885
- },
886
- };
887
- this.apiOptions = {
888
- method: exports.EMethod.GET,
889
- requestBody: null,
890
- };
891
- /**
892
- * A higher-order function that returns a curried function for making API requests.
893
- *
894
- * @param baseUrl - The base URL of the API.
895
- * @returns A curried function that can be used to make API requests.
896
- */
897
- this.func = function (baseUrl) { return function (path, method, reqBody, reqHeaders) {
898
- if (method === void 0) { method = exports.EMethod.GET; }
899
- if (reqBody === void 0) { reqBody = null; }
900
- return _this.request(baseUrl, path, method, reqBody, reqHeaders);
901
- }; };
902
- }
903
- Object.defineProperty(LocalizeApiService.prototype, "isResolvingStartup", {
904
- get: function () { return this.isResolvingStartupSubject.value; },
905
- enumerable: false,
906
- configurable: true
907
- });
908
- Object.defineProperty(LocalizeApiService.prototype, "needTenant", {
909
- get: function () { return this.localizeTokenService.config.tenantToken !== undefined; },
910
- enumerable: false,
911
- configurable: true
912
- });
913
- Object.defineProperty(LocalizeApiService.prototype, "isRequesting", {
914
- get: function () { return this.isRequestingSubject.value; },
915
- enumerable: false,
916
- configurable: true
917
- });
918
- Object.defineProperty(LocalizeApiService.prototype, "isRevokingToken", {
919
- get: function () { return this.localizeTokenService.isRevokingToken; },
920
- set: function (value) { this.localizeTokenService.isRevokingToken = value; },
921
- enumerable: false,
922
- configurable: true
923
- });
924
- Object.defineProperty(LocalizeApiService.prototype, "accessToken", {
925
- get: function () { return this.localizeTokenService.accessToken; },
926
- set: function (value) { this.localizeTokenService.accessToken = value; },
927
- enumerable: false,
928
- configurable: true
929
- });
930
- Object.defineProperty(LocalizeApiService.prototype, "refreshToken", {
931
- get: function () { return this.localizeTokenService.refreshToken; },
932
- enumerable: false,
933
- configurable: true
934
- });
935
- Object.defineProperty(LocalizeApiService.prototype, "tenantToken", {
936
- get: function () { return this.localizeTokenService.tenantToken; },
937
- enumerable: false,
938
- configurable: true
939
- });
940
- Object.defineProperty(LocalizeApiService.prototype, "thirdPartyConfig", {
941
- get: function () { var _a; return (_a = this.localizeTokenService.config) === null || _a === void 0 ? void 0 : _a.thirdPartyConfig; },
942
- enumerable: false,
943
- configurable: true
944
- });
945
- Object.defineProperty(LocalizeApiService.prototype, "config", {
946
- get: function () {
947
- this.validateConfig();
948
- return this.configSubject.value;
949
- },
950
- enumerable: false,
951
- configurable: true
952
- });
953
- /**
954
- * Initialize the API service.
955
- * @param apiConfigs - The API configurations.
956
- */
957
- LocalizeApiService.prototype.init = function (apiConfigs) {
958
- console.log('LocalizeApiService is initialized.');
959
- this.configSubject.next(Object.assign(Object.assign({}, this.defaultConfig), apiConfigs));
960
- };
961
- LocalizeApiService.prototype.cancelPendingRequests = function () {
962
- this.config.enableRequestCancellation
963
- && this.destroy$.next();
964
- };
965
- LocalizeApiService.prototype.ngOnDestroy = function () {
966
- this.destroy$.next();
967
- this.destroy$.complete();
968
- };
969
- LocalizeApiService.prototype.request = function (baseUrl, path, method, reqBody, reqHeaders) {
970
- if (method === void 0) { method = exports.EMethod.GET; }
971
- if (reqBody === void 0) { reqBody = null; }
972
- return tslib.__awaiter(this, void 0, void 0, function () {
973
- var apiOptions, error_1;
974
- var _this = this;
975
- return tslib.__generator(this, function (_e) {
976
- switch (_e.label) {
977
- case 0: return [4 /*yield*/, waitUntil(function () { return !_this.isResolvingStartup; }, 500)];
978
- case 1:
979
- _e.sent();
980
- return [4 /*yield*/, ApiHelper.invokeHook(this.config.onPrepareRequest)];
981
- case 2:
982
- _e.sent();
983
- apiOptions = this.buildApiOptions(baseUrl, path, method, reqBody, reqHeaders);
984
- _e.label = 3;
985
- case 3:
986
- _e.trys.push([3, 6, , 8]);
987
- return [4 /*yield*/, this.toWaitForPreviousRequest()];
988
- case 4:
989
- _e.sent();
990
- return [4 /*yield*/, ApiHelper.performRequestWithRetry(apiOptions, this.config, this.performRequest.bind(this))];
991
- case 5: return [2 /*return*/, _e.sent()];
992
- case 6:
993
- error_1 = _e.sent();
994
- return [4 /*yield*/, this.handleOnRequestError(error_1, apiOptions)];
995
- case 7: return [2 /*return*/, _e.sent()];
996
- case 8: return [2 /*return*/];
997
- }
998
- });
999
- });
1000
- };
1001
- LocalizeApiService.prototype.handleOnRequestError = function (error, options) {
1002
- return tslib.__awaiter(this, void 0, void 0, function () {
1003
- var _this = this;
1004
- return tslib.__generator(this, function (_e) {
1005
- switch (_e.label) {
1006
- case 0:
1007
- if (error.status !== 401)
1008
- throw error;
1009
- return [4 /*yield*/, waitUntil(function () { return !_this.isResolvingStartup; }, 50)];
1010
- case 1:
1011
- _e.sent();
1012
- return [4 /*yield*/, ApiHelper.performRetry({
1013
- maxRetries: function () { return 1000; },
1014
- delay: 10,
1015
- retryUnless: function (error) { return error.status === 401 || ApiHelper.isConnectionError(error); },
1016
- callback: function () { return tslib.__awaiter(_this, void 0, void 0, function () {
1017
- return tslib.__generator(this, function (_e) {
1018
- switch (_e.label) {
1019
- case 0:
1020
- // Handle third party API unauthorized error when request
1021
- this.handleThirdPartyAuthError(error, options.requestUrl);
1022
- // Only handle 401 Unauthorized errors
1023
- return [4 /*yield*/, this.revokeToken()];
1024
- case 1:
1025
- // Only handle 401 Unauthorized errors
1026
- _e.sent();
1027
- return [4 /*yield*/, this.performRequest(options)];
1028
- case 2:
1029
- // Retry the request with the new access token
1030
- return [2 /*return*/, _e.sent()];
1031
- }
1032
- });
1033
- }); }
1034
- })];
1035
- case 2: return [2 /*return*/, _e.sent()];
1036
- }
1037
- });
1038
- });
1039
- };
1040
- LocalizeApiService.prototype.handleThirdPartyAuthError = function (error, requestUrl) {
1041
- var _a, _b, _c;
1042
- if (!((_a = this.thirdPartyConfig) === null || _a === void 0 ? void 0 : _a.isThirdPartyMode))
1043
- return;
1044
- if (error.status === 401) {
1045
- if (this.thirdPartyConfig.lastUnauthorizedUrl === requestUrl) {
1046
- this.thirdPartyConfig.lastUnauthorizedUrl = "";
1047
- throw (_c = (_b = this.config).onException) === null || _c === void 0 ? void 0 : _c.call(_b, Object.assign(Object.assign({}, error), { status: 405, message: "Unauthorized request url " + requestUrl + ". Please contact administrator." }));
1048
- }
1049
- this.thirdPartyConfig.lastUnauthorizedUrl = requestUrl;
1050
- }
1051
- else {
1052
- this.thirdPartyConfig.lastUnauthorizedUrl = "";
1053
- }
1054
- };
1055
- LocalizeApiService.prototype.performRequest = function (options) {
1056
- var _a;
1057
- return tslib.__awaiter(this, void 0, void 0, function () {
1058
- var buildOptions, request$, response;
1059
- var _this = this;
1060
- return tslib.__generator(this, function (_e) {
1061
- switch (_e.label) {
1062
- case 0:
1063
- buildOptions = { headers: this.buildHeaderOptions(options) };
1064
- request$ = ApiHelper.createRequest({
1065
- client: this.httpClient,
1066
- destroy$: function () { return _this.destroy$; }
1067
- }, options.method, options.requestUrl, options.requestBody, buildOptions, (_a = this.config.onResponseBodyInvalid) === null || _a === void 0 ? void 0 : _a.bind(this));
1068
- // Set the isRequesting state to true before making the request
1069
- this.isRequestingSubject.next(true);
1070
- return [4 /*yield*/, new Promise(function (resolve, reject) { return request$.subscribe({ next: resolve, error: reject }); })];
1071
- case 1:
1072
- response = _e.sent();
1073
- // Reset the isRequesting state after the request completes
1074
- this.isRequestingSubject.next(false);
1075
- return [2 /*return*/, response];
1076
- }
1077
- });
1078
- });
1079
- };
1080
- LocalizeApiService.prototype.revokeToken = function () {
1081
- var _a, _b;
1082
- return tslib.__awaiter(this, void 0, void 0, function () {
1083
- var defaultApiOptions, thirdParyApiOptions, apiOptions, revokeToken, error_2;
1084
- return tslib.__generator(this, function (_e) {
1085
- switch (_e.label) {
1086
- case 0:
1087
- _e.trys.push([0, 4, 6, 7]);
1088
- return [4 /*yield*/, this.interceptRevokeToken()];
1089
- case 1:
1090
- if (_e.sent())
1091
- return [2 /*return*/];
1092
- this.isRevokingToken = true;
1093
- defaultApiOptions = Object.assign(Object.assign({}, this.buildApiOptions(((_a = this.localizeTokenService.config.refreshToken) === null || _a === void 0 ? void 0 : _a.requestUrl) || '')), { refreshToken: true });
1094
- thirdParyApiOptions = this.buildThirdPartyApiOption(defaultApiOptions);
1095
- apiOptions = ((_b = this.thirdPartyConfig) === null || _b === void 0 ? void 0 : _b.isThirdPartyMode) ? thirdParyApiOptions : defaultApiOptions;
1096
- return [4 /*yield*/, ApiHelper.performRequestWithRetry(apiOptions, this.config, this.performRequest.bind(this))];
1097
- case 2:
1098
- revokeToken = _e.sent();
1099
- return [4 /*yield*/, this.handleOnTokenRevoked(revokeToken)];
1100
- case 3:
1101
- _e.sent();
1102
- return [3 /*break*/, 7];
1103
- case 4:
1104
- error_2 = _e.sent();
1105
- // Handle the error, log it
1106
- return [4 /*yield*/, ApiHelper.invokeHook(this.config.onAutoLogout)];
1107
- case 5:
1108
- // Handle the error, log it
1109
- _e.sent();
1110
- throw error_2;
1111
- case 6:
1112
- // Reset the revoking token state
1113
- this.isRevokingToken = false;
1114
- return [7 /*endfinally*/];
1115
- case 7: return [2 /*return*/];
1116
- }
1117
- });
1118
- });
1119
- };
1120
- LocalizeApiService.prototype.buildThirdPartyApiOption = function (apiOptions) {
1121
- var _e;
1122
- var _a, _b, _c;
1123
- return Object.assign(Object.assign({}, apiOptions), { requestUrl: ((_a = this.thirdPartyConfig) === null || _a === void 0 ? void 0 : _a.refreshToken.requestUrl) || '', method: ((_b = this.thirdPartyConfig) === null || _b === void 0 ? void 0 : _b.refreshToken.method) || exports.EMethod.GET, requestBody: ((_c = this.thirdPartyConfig) === null || _c === void 0 ? void 0 : _c.refreshToken.body) || {}, headers: Object.assign(Object.assign({}, apiOptions.headers), (_e = {}, _e[SCHEMES.X_SECRET] = "" + this.localizeTokenService.clientSecret, _e)) });
1124
- };
1125
- /** default http request options */
1126
- LocalizeApiService.prototype.buildHeaderOptions = function (options) {
1127
- var _e, _f, _g, _h, _j;
1128
- var _a;
1129
- var headers = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (options.refreshToken && (_e = {}, _e[SCHEMES.X_REFRESH_TOKEN] = "" + this.refreshToken, _e))), (!options.isFormData && (_f = {}, _f[SCHEMES.CONTENT_TYPE] = 'application/json', _f))), (_g = {}, _g[SCHEMES.AUTHORIZATION] = "Bearer " + this.accessToken, _g)), (this.needTenant && (_h = {}, _h[SCHEMES.X_TENANT] = "" + this.tenantToken, _h))), (((_a = this.thirdPartyConfig) === null || _a === void 0 ? void 0 : _a.isThirdPartyMode) && (_j = {}, _j[SCHEMES.X_CLIENT] = "" + this.localizeTokenService.clientId, _j)));
1130
- return new i1.HttpHeaders(Object.assign(Object.assign({}, headers), options.headers));
1131
- };
1132
- LocalizeApiService.prototype.buildApiOptions = function (baseUrl, path, method, requestBody, headers) {
1133
- if (path === void 0) { path = ''; }
1134
- if (method === void 0) { method = exports.EMethod.GET; }
1135
- if (requestBody === void 0) { requestBody = null; }
1136
- var requestUrl = ApiHelper.buildUrl(baseUrl, path);
1137
- var isFormData = requestBody && requestBody instanceof FormData;
1138
- return Object.assign(Object.assign({}, this.apiOptions), { headers: headers, method: method, requestUrl: requestUrl, requestBody: requestBody, isFormData: isFormData });
1139
- };
1140
- LocalizeApiService.prototype.toWaitForPreviousRequest = function () {
1141
- var _a;
1142
- return tslib.__awaiter(this, void 0, void 0, function () {
1143
- var waitMilliseconds;
1144
- var _this = this;
1145
- return tslib.__generator(this, function (_e) {
1146
- switch (_e.label) {
1147
- case 0:
1148
- if (!this.isRevokingToken) return [3 /*break*/, 2];
1149
- return [4 /*yield*/, waitUntil(function () { return !_this.isRevokingToken; })];
1150
- case 1:
1151
- _e.sent();
1152
- _e.label = 2;
1153
- case 2:
1154
- waitMilliseconds = (_a = this.config.waitEachRequest) === null || _a === void 0 ? void 0 : _a.milliseconds;
1155
- if (!(waitMilliseconds && this.isRequesting)) return [3 /*break*/, 4];
1156
- // console.warn(`Request throttling: Another request is in progress. Waiting for ${waitMilliseconds}ms.`);
1157
- return [4 /*yield*/, waitFor(waitMilliseconds, this.isRequesting)];
1158
- case 3:
1159
- // console.warn(`Request throttling: Another request is in progress. Waiting for ${waitMilliseconds}ms.`);
1160
- _e.sent();
1161
- _e.label = 4;
1162
- case 4: return [2 /*return*/];
1163
- }
1164
- });
1165
- });
1166
- };
1167
- LocalizeApiService.prototype.handleOnTokenRevoked = function (response) {
1168
- return tslib.__awaiter(this, void 0, void 0, function () {
1169
- return tslib.__generator(this, function (_e) {
1170
- switch (_e.label) {
1171
- case 0:
1172
- if (!((response === null || response === void 0 ? void 0 : response.status) || (response === null || response === void 0 ? void 0 : response.token))) return [3 /*break*/, 1];
1173
- // If the response is successful, update the access token
1174
- this.accessToken = response.message || response.token; // response.token for third party revoke
1175
- return [3 /*break*/, 3];
1176
- case 1:
1177
- // If the response indicates an error, invoke the onRevokeUnauthorized hook
1178
- console.warn('Token revocation failed, refresh token is expired.', response.message);
1179
- return [4 /*yield*/, ApiHelper.invokeHook(this.config.onRevokeUnauthorized)];
1180
- case 2:
1181
- _e.sent();
1182
- _e.label = 3;
1183
- case 3: return [2 /*return*/];
1184
- }
1185
- });
1186
- });
1187
- };
1188
- LocalizeApiService.prototype.interceptRevokeToken = function () {
1189
- return tslib.__awaiter(this, void 0, void 0, function () {
1190
- var _this = this;
1191
- return tslib.__generator(this, function (_e) {
1192
- switch (_e.label) {
1193
- case 0:
1194
- if (!this.isRevokingToken) return [3 /*break*/, 2];
1195
- console.warn('Token is already being revoked. Waiting for the current operation to complete...');
1196
- return [4 /*yield*/, waitUntil(function () { return !_this.isRevokingToken; })];
1197
- case 1:
1198
- _e.sent();
1199
- return [2 /*return*/, true];
1200
- case 2:
1201
- if (!this.refreshToken) {
1202
- // await ApiHelper.invokeHook(this.apiConfigs.onAutoLogout);
1203
- throw new Error('Refresh token is missing. Please login again.');
1204
- }
1205
- return [2 /*return*/, false];
1206
- }
1207
- });
1208
- });
1209
- };
1210
- LocalizeApiService.prototype.validateConfig = function () {
1211
- var _a, _b, _c, _d;
1212
- if (this.localizeTokenService.config.requiredTenant
1213
- && !((_b = (_a = this.localizeTokenService.config.tenantToken) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.trim().length)) {
1214
- throw Error('Tenant token is required but tenantTokenName is not configured');
1215
- }
1216
- if (!((_d = (_c = this.localizeTokenService.config.refreshToken) === null || _c === void 0 ? void 0 : _c.requestUrl) === null || _d === void 0 ? void 0 : _d.trim().length)) {
1217
- throw Error('Revoke token URL is not configured - token refresh will not work');
1218
- }
1219
- };
1220
- return LocalizeApiService;
1221
- }());
1222
- LocalizeApiService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function LocalizeApiService_Factory() { return new LocalizeApiService(i0__namespace.ɵɵinject(i1__namespace.HttpClient), i0__namespace.ɵɵinject(LocalizeTokenService)); }, token: LocalizeApiService, providedIn: "root" });
1223
- LocalizeApiService.decorators = [
1224
- { type: i0.Injectable, args: [{
1225
- providedIn: 'root'
1226
- },] }
1227
- ];
1228
- LocalizeApiService.ctorParameters = function () { return [
1229
- { type: i1.HttpClient },
1230
- { type: LocalizeTokenService }
1231
- ]; };
1232
-
1233
- var LocalizeTokenModule = /** @class */ (function () {
1234
- function LocalizeTokenModule() {
1235
- }
1236
- return LocalizeTokenModule;
1237
- }());
1238
- LocalizeTokenModule.decorators = [
1239
- { type: i0.NgModule, args: [{
1240
- providers: [
1241
- LocalizeTokenService,
1242
- LocalizeApiService
1243
- ]
1244
- },] }
1245
- ];
1246
-
1247
- var LocalizeApiTokenService = /** @class */ (function () {
1248
- function LocalizeApiTokenService(tokenService, apiService, loginDialogService) {
552
+ var LocalizeTokenConfigureService = /** @class */ (function () {
553
+ function LocalizeTokenConfigureService(tokenService, apiService, loginDialogService) {
1249
554
  this.api = apiService;
1250
555
  this.token = tokenService;
1251
556
  this.loginDialog = loginDialogService;
1252
557
  }
1253
- LocalizeApiTokenService.prototype.initialize = function (tokenConfig, apiConfig) {
1254
- // Initialize the LocalizeTokenService with the provided token configuration
558
+ LocalizeTokenConfigureService.prototype.initialize = function (tokenConfig, apiConfig) {
559
+ // Initialize the LocalizeApiTokenService with the provided token configuration
1255
560
  this.token.init(tokenConfig);
1256
561
  // Initialize the LocalizeApiService with the provided API configuration
1257
562
  this.api.init(apiConfig);
1258
- console.log('LocalizeApiTokenService initialized with token and API configurations.');
563
+ console.log('LocalizeTokenConfigureService initialized with token and API configurations.');
1259
564
  };
1260
- return LocalizeApiTokenService;
565
+ return LocalizeTokenConfigureService;
1261
566
  }());
1262
- LocalizeApiTokenService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function LocalizeApiTokenService_Factory() { return new LocalizeApiTokenService(i0__namespace.ɵɵinject(LocalizeTokenService), i0__namespace.ɵɵinject(LocalizeApiService), i0__namespace.ɵɵinject(LocalizeLogindlgService)); }, token: LocalizeApiTokenService, providedIn: "root" });
1263
- LocalizeApiTokenService.decorators = [
567
+ LocalizeTokenConfigureService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function LocalizeTokenConfigureService_Factory() { return new LocalizeTokenConfigureService(i0__namespace.ɵɵinject(i1__namespace.LocalizeApiTokenService), i0__namespace.ɵɵinject(i1__namespace.LocalizeApiService), i0__namespace.ɵɵinject(LocalizeTokenDialogService)); }, token: LocalizeTokenConfigureService, providedIn: "root" });
568
+ LocalizeTokenConfigureService.decorators = [
1264
569
  { type: i0.Injectable, args: [{
1265
570
  providedIn: 'root'
1266
571
  },] }
1267
572
  ];
1268
- LocalizeApiTokenService.ctorParameters = function () { return [
1269
- { type: LocalizeTokenService },
1270
- { type: LocalizeApiService },
1271
- { type: LocalizeLogindlgService }
573
+ LocalizeTokenConfigureService.ctorParameters = function () { return [
574
+ { type: i1.LocalizeApiTokenService },
575
+ { type: i1.LocalizeApiService },
576
+ { type: LocalizeTokenDialogService }
1272
577
  ]; };
1273
578
 
1274
- var LocalizeApiTokenModule = /** @class */ (function () {
1275
- function LocalizeApiTokenModule() {
1276
- }
1277
- return LocalizeApiTokenModule;
1278
- }());
1279
- LocalizeApiTokenModule.decorators = [
1280
- { type: i0.NgModule, args: [{
1281
- declarations: [],
1282
- imports: [
1283
- common.CommonModule,
1284
- LocalizeTokenModule,
1285
- LocalizeLogindlgModule
1286
- ],
1287
- providers: [
1288
- LocalizeApiTokenService
1289
- ]
1290
- },] }
1291
- ];
1292
-
1293
579
  //#region login dialog
1294
580
 
1295
581
  /**
1296
582
  * Generated bundle index. Do not edit.
1297
583
  */
1298
584
 
1299
- exports.ApiHelper = ApiHelper;
1300
- exports.LOCALIZE_API_ASSETS = LOCALIZE_API_ASSETS;
1301
- exports.LocalizeApiService = LocalizeApiService;
1302
- exports.LocalizeApiTokenModule = LocalizeApiTokenModule;
1303
- exports.LocalizeApiTokenService = LocalizeApiTokenService;
1304
- exports.LocalizeLogindlgComponent = LocalizeLogindlgComponent;
1305
- exports.LocalizeLogindlgModule = LocalizeLogindlgModule;
1306
- exports.LocalizeLogindlgService = LocalizeLogindlgService;
1307
- exports.LocalizeToken = LocalizeToken;
585
+ exports.LocalizeTokenConfigureService = LocalizeTokenConfigureService;
586
+ exports.LocalizeTokenDialogService = LocalizeTokenDialogService;
587
+ exports.LocalizeTokenLoginDialogComponent = LocalizeTokenLoginDialogComponent;
1308
588
  exports.LocalizeTokenModule = LocalizeTokenModule;
1309
- exports.LocalizeTokenService = LocalizeTokenService;
1310
- exports.LocalizeTokenStorage = LocalizeTokenStorage;
1311
- exports.extractMainDomain = extractMainDomain;
1312
- exports.waitFor = waitFor;
1313
- exports.waitUntil = waitUntil;
1314
589
 
1315
590
  Object.defineProperty(exports, '__esModule', { value: true });
1316
591