@sambath999/localize-token 12.4.9 → 12.4.12

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 +436 -1062
  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} +15 -6
  4. package/esm2015/components/localize-token-login-dialog.component.js +474 -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 +93 -850
  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} +0 -9
  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 -238
  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 -92
  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 -88
  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 -56
  41. package/localize-token/localize.token.service.d.ts +0 -34
  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/common/http'), 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/common/http', '@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.common.http, 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, http, 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,388 +22,386 @@
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
- LocalizeTokenService.prototype.storageGet = function () {
338
- var _a;
224
+ catch (error) {
225
+ e = { error: error };
226
+ }
227
+ finally {
339
228
  try {
340
- var encoded = LocalizeToken.storage.get(((_a = this.config.authToken) === null || _a === void 0 ? void 0 : _a.name) || '');
341
- var decoded = atob(encoded || '');
342
- return JSON.parse(decoded);
229
+ if (r && !r.done && (m = i["return"]))
230
+ m.call(i);
343
231
  }
344
- catch (_b) {
345
- return undefined;
232
+ finally {
233
+ if (e)
234
+ throw e.error;
346
235
  }
347
- };
348
- LocalizeTokenService.prototype.storageSet = function (value) {
349
- var _a;
350
- var base64 = btoa(JSON.stringify(value));
351
- LocalizeToken.storage.set(((_a = this.config.authToken) === null || _a === void 0 ? void 0 : _a.name) || '', base64);
352
- };
353
- LocalizeTokenService.prototype.tokensValid = function () {
354
- var _a, _b;
355
- if (!((_a = this.refreshToken) === null || _a === void 0 ? void 0 : _a.length))
356
- return false;
357
- if (this.config.requiredTenant && !((_b = this.tenantToken) === null || _b === void 0 ? void 0 : _b.length))
358
- return false;
359
- return true;
360
- };
361
- Object.defineProperty(LocalizeTokenService.prototype, "decodeRefreshToken", {
362
- get: function () {
363
- var token = this.refreshToken;
364
- return !token ? null : this.decodeToken(token);
365
- },
366
- enumerable: false,
367
- configurable: true
368
- });
369
- LocalizeTokenService.prototype.throwIfNotInitialized = function () {
370
- if (!this.isInitialized) {
371
- 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
+ }
372
262
  }
373
- };
374
- return LocalizeTokenService;
375
- }());
376
- LocalizeTokenService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function LocalizeTokenService_Factory() { return new LocalizeTokenService(); }, token: LocalizeTokenService, providedIn: "root" });
377
- LocalizeTokenService.decorators = [
378
- { type: i0.Injectable, args: [{ providedIn: 'root' },] }
379
- ];
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
+ }
380
345
 
381
- var LocalizeLogindlgComponent = /** @class */ (function () {
382
- function LocalizeLogindlgComponent(messageService, cdt, dlgRef, dlgConfig, tokenService, httpClient, sanitizer) {
346
+ var ELoginState;
347
+ (function (ELoginState) {
348
+ ELoginState[ELoginState["Requesting"] = 0] = "Requesting";
349
+ ELoginState[ELoginState["Success"] = 1] = "Success";
350
+ ELoginState[ELoginState["Error"] = 2] = "Error";
351
+ })(ELoginState || (ELoginState = {}));
352
+ var LocalizeTokenLoginDialogComponent = /** @class */ (function () {
353
+ function LocalizeTokenLoginDialogComponent(messageService, cdt, dlgRef, dlgConfig, httpClient, sanitizer, injector) {
383
354
  var _this = this;
384
355
  this.messageService = messageService;
385
356
  this.cdt = cdt;
386
357
  this.dlgRef = dlgRef;
387
358
  this.dlgConfig = dlgConfig;
388
- this.tokenService = tokenService;
389
359
  this.httpClient = httpClient;
390
360
  this.sanitizer = sanitizer;
361
+ this.injector = injector;
391
362
  this.messageKey = "$login-dlg";
392
363
  this.loading = false;
393
364
  this.success = false;
365
+ this.loginBroadcastChannel = "bc-localize-login";
366
+ this.sourceId = Date.now() + "-" + Math.random().toString(36).slice(2);
394
367
  this.clickLogout = function () { var _a; return (_a = _this.logout) === null || _a === void 0 ? void 0 : _a.call(_this); };
368
+ this.tokenService = this.injector.get(i1.LocalizeApiTokenService);
369
+ this.broadcastService = this.injector.get(i1.LocalizeApiBroadcastService);
370
+ this.apiService = this.injector.get(i1.LocalizeApiService);
395
371
  this.decodeToken = this.tokenService.decodeRefreshToken;
396
372
  this.loginConfig = this.dlgConfig.data.loginConfig;
397
373
  this.properties = this.loginConfig.properties;
374
+ this.removeLoginListener = this.broadcastService.listen(this.loginBroadcastChannel, function (payload) {
375
+ var _a;
376
+ if (!payload || payload.sourceId === _this.sourceId) {
377
+ console.warn('Ignoring login state message with invalid payload or from same source', payload);
378
+ return;
379
+ }
380
+ switch (payload.state) {
381
+ case ELoginState.Requesting:
382
+ _this.loading = true;
383
+ _this.success = false;
384
+ break;
385
+ case ELoginState.Success:
386
+ _this.apiService.clearRequiredLoginStateAfterLogin();
387
+ _this.loginSuccess();
388
+ break;
389
+ case ELoginState.Error:
390
+ _this.showMessage("error", (_a = payload.message) !== null && _a !== void 0 ? _a : "Login failed");
391
+ break;
392
+ }
393
+ });
398
394
  }
399
- Object.defineProperty(LocalizeLogindlgComponent.prototype, "config", {
395
+ Object.defineProperty(LocalizeTokenLoginDialogComponent.prototype, "config", {
400
396
  get: function () { return this.tokenService.config; },
401
397
  enumerable: false,
402
398
  configurable: true
403
399
  });
404
- LocalizeLogindlgComponent.prototype.ngOnInit = function () {
400
+ LocalizeTokenLoginDialogComponent.prototype.ngOnInit = function () {
405
401
  var _this = this;
406
402
  this.dlgConfig.closable = false;
403
+ this.dlgConfig.dismissableMask = false;
404
+ this.dlgConfig.modal = true;
407
405
  this.logout = this.loginConfig.logoutFunc;
408
406
  this.loginUrl = this.loginConfig.loginUrl;
409
407
  if (!this.decodeToken) {
@@ -411,47 +409,71 @@
411
409
  setTimeout(function () { var _a; return (_a = _this.logout) === null || _a === void 0 ? void 0 : _a.call(_this); }, 2000);
412
410
  }
413
411
  };
414
- LocalizeLogindlgComponent.prototype.ngAfterViewInit = function () {
412
+ LocalizeTokenLoginDialogComponent.prototype.ngAfterViewInit = function () {
415
413
  this.cdt.detectChanges();
416
414
  };
417
- LocalizeLogindlgComponent.prototype.clickLogin = function () {
415
+ LocalizeTokenLoginDialogComponent.prototype.loginSuccess = function () {
416
+ return __awaiter(this, void 0, void 0, function () {
417
+ return __generator(this, function (_d) {
418
+ switch (_d.label) {
419
+ case 0:
420
+ this.success = true;
421
+ return [4 /*yield*/, i1.waitFor(2000)];
422
+ case 1:
423
+ _d.sent();
424
+ this.dlgRef.close(true);
425
+ return [2 /*return*/];
426
+ }
427
+ });
428
+ });
429
+ };
430
+ LocalizeTokenLoginDialogComponent.prototype.clickLogin = function () {
418
431
  var _a, _b, _c;
419
- return tslib.__awaiter(this, void 0, void 0, function () {
420
- var loginRes, cookieOptions;
421
- var _this = this;
422
- return tslib.__generator(this, function (_d) {
432
+ return __awaiter(this, void 0, void 0, function () {
433
+ var loginRes, message, cookieOptions;
434
+ return __generator(this, function (_d) {
423
435
  switch (_d.label) {
424
436
  case 0:
425
437
  if (!this.isValidPassword) {
426
438
  return [2 /*return*/, this.showMessage("error", "Password is required and must be at least 6 characters")];
427
439
  }
440
+ this.publishLoginState(ELoginState.Requesting);
441
+ return [4 /*yield*/, i1.waitFor(300)];
442
+ case 1:
443
+ _d.sent();
428
444
  this.loading = true;
429
445
  return [4 /*yield*/, this.login()];
430
- case 1:
446
+ case 2:
431
447
  loginRes = _d.sent();
432
448
  if (!(loginRes === null || loginRes === void 0 ? void 0 : loginRes.status)) {
433
- return [2 /*return*/, this.showMessage("error", (_a = loginRes.message) !== null && _a !== void 0 ? _a : "An error occurred")];
449
+ message = (_a = loginRes === null || loginRes === void 0 ? void 0 : loginRes.message) !== null && _a !== void 0 ? _a : "An error occurred";
450
+ this.publishLoginState(ELoginState.Error, message);
451
+ return [2 /*return*/, this.showMessage("error", message)];
434
452
  }
435
453
  this.tokenService.accessToken = loginRes.tokens.accessToken;
436
454
  cookieOptions = { expires: (_b = this.loginConfig.expire) !== null && _b !== void 0 ? _b : 365 };
437
- LocalizeToken.storage.set(((_c = this.config.refreshToken) === null || _c === void 0 ? void 0 : _c.name) || '', loginRes.tokens.refreshToken, cookieOptions);
438
- this.success = true;
439
- setTimeout(function () {
440
- _this.dlgConfig.dismissableMask = true;
441
- _this.dlgConfig.modal = false;
442
- _this.dlgRef.close(true);
443
- }, 2000);
455
+ i1.LocalizeApiToken.storage.set(((_c = this.config.refreshToken) === null || _c === void 0 ? void 0 : _c.name) || '', loginRes.tokens.refreshToken, cookieOptions);
456
+ this.apiService.clearRequiredLoginStateAfterLogin();
457
+ this.publishLoginState(ELoginState.Success);
458
+ this.loginSuccess();
444
459
  return [2 /*return*/];
445
460
  }
446
461
  });
447
462
  });
448
463
  };
449
- LocalizeLogindlgComponent.prototype.login = function () {
464
+ LocalizeTokenLoginDialogComponent.prototype.publishLoginState = function (state, message) {
465
+ this.broadcastService.publish(this.loginBroadcastChannel, {
466
+ state: state,
467
+ sourceId: this.sourceId,
468
+ message: message,
469
+ });
470
+ };
471
+ LocalizeTokenLoginDialogComponent.prototype.login = function () {
450
472
  var _a, _b, _c;
451
- return tslib.__awaiter(this, void 0, void 0, function () {
473
+ return __awaiter(this, void 0, void 0, function () {
452
474
  var e_1;
453
475
  var _this = this;
454
- return tslib.__generator(this, function (_d) {
476
+ return __generator(this, function (_d) {
455
477
  switch (_d.label) {
456
478
  case 0:
457
479
  if (!((_a = this.loginUrl) === null || _a === void 0 ? void 0 : _a.trim().length)) {
@@ -476,15 +498,15 @@
476
498
  });
477
499
  });
478
500
  };
479
- LocalizeLogindlgComponent.prototype.getHeaders = function () {
501
+ LocalizeTokenLoginDialogComponent.prototype.getHeaders = function () {
480
502
  var _d;
481
503
  var _a, _b;
482
504
  return _d = {},
483
- _d[LocalizeToken.httpHeaders.X_REFRESH_TOKEN] = (_a = this.tokenService.refreshToken) !== null && _a !== void 0 ? _a : "",
484
- _d[LocalizeToken.httpHeaders.X_TENANT] = (_b = this.tokenService.tenantToken) !== null && _b !== void 0 ? _b : "",
505
+ _d[i1.LocalizeApiToken.httpHeaders.X_REFRESH_TOKEN] = (_a = this.tokenService.refreshToken) !== null && _a !== void 0 ? _a : "",
506
+ _d[i1.LocalizeApiToken.httpHeaders.X_TENANT] = (_b = this.tokenService.tenantToken) !== null && _b !== void 0 ? _b : "",
485
507
  _d;
486
508
  };
487
- Object.defineProperty(LocalizeLogindlgComponent.prototype, "isValidPassword", {
509
+ Object.defineProperty(LocalizeTokenLoginDialogComponent.prototype, "isValidPassword", {
488
510
  get: function () {
489
511
  this.loading = false;
490
512
  return this.properties.passwordValidator
@@ -494,11 +516,11 @@
494
516
  enumerable: false,
495
517
  configurable: true
496
518
  });
497
- LocalizeLogindlgComponent.prototype.showMessage = function (severity, summary) {
519
+ LocalizeTokenLoginDialogComponent.prototype.showMessage = function (severity, summary) {
498
520
  this.messageService.add({ key: this.messageKey, severity: severity, summary: summary });
499
521
  this.loading = false;
500
522
  };
501
- Object.defineProperty(LocalizeLogindlgComponent.prototype, "sanitizedTitle", {
523
+ Object.defineProperty(LocalizeTokenLoginDialogComponent.prototype, "sanitizedTitle", {
502
524
  get: function () {
503
525
  var _a;
504
526
  return this.sanitizer.bypassSecurityTrustHtml((_a = this.properties.title) !== null && _a !== void 0 ? _a : '');
@@ -506,9 +528,13 @@
506
528
  enumerable: false,
507
529
  configurable: true
508
530
  });
509
- return LocalizeLogindlgComponent;
531
+ LocalizeTokenLoginDialogComponent.prototype.ngOnDestroy = function () {
532
+ var _a;
533
+ (_a = this.removeLoginListener) === null || _a === void 0 ? void 0 : _a.call(this);
534
+ };
535
+ return LocalizeTokenLoginDialogComponent;
510
536
  }());
511
- LocalizeLogindlgComponent.decorators = [
537
+ LocalizeTokenLoginDialogComponent.decorators = [
512
538
  { type: i0.Component, args: [{
513
539
  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>",
514
540
  selector: "app-localize-logindlg",
@@ -517,31 +543,31 @@
517
543
  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 "]
518
544
  },] }
519
545
  ];
520
- LocalizeLogindlgComponent.ctorParameters = function () { return [
546
+ LocalizeTokenLoginDialogComponent.ctorParameters = function () { return [
521
547
  { type: api.MessageService },
522
548
  { type: i0.ChangeDetectorRef },
523
549
  { type: dynamicdialog.DynamicDialogRef },
524
550
  { type: dynamicdialog.DynamicDialogConfig },
525
- { type: LocalizeTokenService },
526
- { type: i1.HttpClient },
527
- { type: platformBrowser.DomSanitizer }
551
+ { type: http.HttpClient },
552
+ { type: platformBrowser.DomSanitizer },
553
+ { type: i0.Injector }
528
554
  ]; };
529
555
 
530
- var LocalizeLogindlgService = /** @class */ (function () {
531
- function LocalizeLogindlgService(injector) {
556
+ var LocalizeTokenDialogService = /** @class */ (function () {
557
+ function LocalizeTokenDialogService(injector) {
532
558
  this.injector = injector;
533
559
  }
534
- LocalizeLogindlgService.prototype.openLoginDialog = function (loginConfig, config) {
535
- return tslib.__awaiter(this, void 0, void 0, function () {
560
+ LocalizeTokenDialogService.prototype.openLoginDialog = function (loginConfig, config) {
561
+ return __awaiter(this, void 0, void 0, function () {
536
562
  var dialogService, dialog;
537
- return tslib.__generator(this, function (_b) {
563
+ return __generator(this, function (_b) {
538
564
  switch (_b.label) {
539
565
  case 0:
540
566
  config = this.intercepDialogConfig(config);
541
567
  this.initConfig(loginConfig);
542
568
  config.data = Object.assign(Object.assign({}, (config.data || {})), { loginConfig: loginConfig });
543
569
  dialogService = this.injector.get(dynamicdialog.DialogService);
544
- dialog = dialogService.open(LocalizeLogindlgComponent, config);
570
+ dialog = dialogService.open(LocalizeTokenLoginDialogComponent, config);
545
571
  return [4 /*yield*/, new Promise(function (resolve) { return dialog.onClose.subscribe(function (res) {
546
572
  if (res) {
547
573
  resolve();
@@ -554,7 +580,7 @@
554
580
  });
555
581
  });
556
582
  };
557
- LocalizeLogindlgService.prototype.intercepDialogConfig = function (config) {
583
+ LocalizeTokenDialogService.prototype.intercepDialogConfig = function (config) {
558
584
  config !== null && config !== void 0 ? config : (config = {
559
585
  header: 'Login',
560
586
  style: { 'max-width': '400px', width: '100%', 'height': '650px' },
@@ -568,7 +594,7 @@
568
594
  config.style = Object.assign(Object.assign({}, config.style), { 'border-radius': '20px' });
569
595
  return config;
570
596
  };
571
- LocalizeLogindlgService.prototype.initConfig = function (loginConfig) {
597
+ LocalizeTokenDialogService.prototype.initConfig = function (loginConfig) {
572
598
  var _a;
573
599
  loginConfig !== null && loginConfig !== void 0 ? loginConfig : (loginConfig = {});
574
600
  (_a = loginConfig.properties) !== null && _a !== void 0 ? _a : (loginConfig.properties = {
@@ -584,728 +610,76 @@
584
610
  }
585
611
  });
586
612
  };
587
- return LocalizeLogindlgService;
613
+ return LocalizeTokenDialogService;
588
614
  }());
589
- LocalizeLogindlgService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function LocalizeLogindlgService_Factory() { return new LocalizeLogindlgService(i0__namespace.ɵɵinject(i0__namespace.INJECTOR)); }, token: LocalizeLogindlgService, providedIn: "root" });
590
- LocalizeLogindlgService.decorators = [
615
+ LocalizeTokenDialogService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function LocalizeTokenDialogService_Factory() { return new LocalizeTokenDialogService(i0__namespace.ɵɵinject(i0__namespace.INJECTOR)); }, token: LocalizeTokenDialogService, providedIn: "root" });
616
+ LocalizeTokenDialogService.decorators = [
591
617
  { type: i0.Injectable, args: [{
592
618
  providedIn: 'root'
593
619
  },] }
594
620
  ];
595
- LocalizeLogindlgService.ctorParameters = function () { return [
621
+ LocalizeTokenDialogService.ctorParameters = function () { return [
596
622
  { type: i0.Injector }
597
623
  ]; };
598
624
 
599
- var LocalizeLogindlgModule = /** @class */ (function () {
600
- function LocalizeLogindlgModule() {
625
+ var LocalizeTokenModule = /** @class */ (function () {
626
+ function LocalizeTokenModule() {
601
627
  }
602
- return LocalizeLogindlgModule;
628
+ return LocalizeTokenModule;
603
629
  }());
604
- LocalizeLogindlgModule.decorators = [
630
+ LocalizeTokenModule.decorators = [
605
631
  { type: i0.NgModule, args: [{
606
- declarations: [LocalizeLogindlgComponent],
607
- exports: [LocalizeLogindlgComponent],
632
+ declarations: [LocalizeTokenLoginDialogComponent],
633
+ exports: [LocalizeTokenLoginDialogComponent],
608
634
  imports: [
609
635
  common.CommonModule,
610
636
  toast.ToastModule,
611
637
  inputtext.InputTextModule,
612
- platformBrowser.BrowserModule,
613
638
  forms.FormsModule,
614
639
  button.ButtonModule,
615
640
  ],
616
- providers: [LocalizeLogindlgService],
641
+ providers: [LocalizeTokenDialogService],
617
642
  schemas: [i0.CUSTOM_ELEMENTS_SCHEMA],
618
643
  },] }
619
644
  ];
620
645
 
621
- var LOCALIZE_API_ASSETS = {
622
- network: {
623
- 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>"
624
- }
625
- };
626
-
627
- /**
628
- * Http method options
629
- */
630
- exports.EMethod = void 0;
631
- (function (EMethod) {
632
- EMethod["POST"] = "post";
633
- EMethod["GET"] = "get";
634
- EMethod["PUT"] = "put";
635
- EMethod["DELETE"] = "delete";
636
- EMethod["PATCH"] = "patch";
637
- })(exports.EMethod || (exports.EMethod = {}));
638
- // export interface INormalizedError {
639
- // error: any;
640
- // code: string;
641
- // message: string;
642
- // details?: any;
643
- // status: number;
644
- // }
645
-
646
- var LocalizeApiHelper = /** @class */ (function () {
647
- function LocalizeApiHelper() {
648
- this.defaultRetryOptions = {
649
- connectionError: {
650
- message: 'Connection error occurred. Please wait',
651
- blockScreen: true,
652
- blockScreenZIndex: 10000
653
- }
654
- };
655
- }
656
- LocalizeApiHelper.prototype.performRetry = function (options) {
657
- return tslib.__awaiter(this, void 0, void 0, function () {
658
- var attempts, lastError, consoleCount, styleElement, result, error_1;
659
- return tslib.__generator(this, function (_f) {
660
- switch (_f.label) {
661
- case 0:
662
- attempts = 0;
663
- consoleCount = 0;
664
- // Merge default retry options with provided options
665
- options = Object.assign(Object.assign({}, this.defaultRetryOptions), options);
666
- _f.label = 1;
667
- case 1:
668
- if (!(attempts < options.maxRetries())) return [3 /*break*/, 10];
669
- _f.label = 2;
670
- case 2:
671
- _f.trys.push([2, 4, , 9]);
672
- return [4 /*yield*/, options.callback()];
673
- case 3:
674
- result = _f.sent();
675
- this.removeBlocker(styleElement);
676
- return [2 /*return*/, result];
677
- case 4:
678
- error_1 = _f.sent();
679
- lastError = error_1;
680
- if (consoleCount >= 7) {
681
- console.clear();
682
- consoleCount = 0;
683
- }
684
- if (options.retryUnless && !options.retryUnless(error_1))
685
- throw error_1; // If the error should not be retried, rethrow it
686
- return [4 /*yield*/, this.onConnectionError(options, error_1)];
687
- case 5:
688
- // Handle connection error
689
- styleElement = _f.sent();
690
- if (!options.onError) return [3 /*break*/, 7];
691
- return [4 /*yield*/, this.invokeHook(options.onError.bind(this, error_1))];
692
- case 6:
693
- _f.sent();
694
- _f.label = 7;
695
- case 7:
696
- if (attempts >= options.maxRetries() - 1)
697
- throw error_1;
698
- attempts++;
699
- consoleCount++;
700
- console.warn("Attempt " + attempts + " failed. Retrying...", error_1);
701
- return [4 /*yield*/, waitFor(options.delay)];
702
- case 8:
703
- _f.sent();
704
- return [3 /*break*/, 9];
705
- case 9: return [3 /*break*/, 1];
706
- case 10:
707
- console.warn("Failed after " + options.maxRetries() + " attempts");
708
- throw lastError;
709
- }
710
- });
711
- });
712
- };
713
- LocalizeApiHelper.prototype.performRequestWithRetry = function (options, config, performRequest) {
714
- var _a, _b, _c, _d;
715
- return tslib.__awaiter(this, void 0, void 0, function () {
716
- var retryUnless;
717
- return tslib.__generator(this, function (_f) {
718
- switch (_f.label) {
719
- case 0:
720
- retryUnless = ((_a = config.retryOptions) === null || _a === void 0 ? void 0 : _a.retryFunction)
721
- || this.isConnectionError;
722
- return [4 /*yield*/, this.performRetry({
723
- connectionError: (_b = config.retryOptions) === null || _b === void 0 ? void 0 : _b.onConnectionError,
724
- maxRetries: function () { var _a, _b; return (_b = (_a = config.retryOptions) === null || _a === void 0 ? void 0 : _a.maxRetries) !== null && _b !== void 0 ? _b : 1000; },
725
- delay: (_d = (_c = config.retryOptions) === null || _c === void 0 ? void 0 : _c.delay) !== null && _d !== void 0 ? _d : 500,
726
- callback: function () { return performRequest(options); },
727
- retryUnless: retryUnless,
728
- })];
729
- case 1: return [2 /*return*/, _f.sent()];
730
- }
731
- });
732
- });
733
- };
734
- LocalizeApiHelper.prototype.buildUrl = function (baseUrl, path) {
735
- var normalizedUrl = "" + baseUrl.trim().replace(/\/?$/, '/') + path.trim().replace(/^\//, '');
736
- return normalizedUrl.endsWith('/')
737
- ? normalizedUrl.slice(0, -1)
738
- : normalizedUrl;
739
- };
740
- LocalizeApiHelper.prototype.invokeHook = function (callback) {
741
- return tslib.__awaiter(this, void 0, void 0, function () {
742
- var result;
743
- return tslib.__generator(this, function (_f) {
744
- switch (_f.label) {
745
- case 0:
746
- if (!callback)
747
- return [2 /*return*/];
748
- result = callback();
749
- if (!(result instanceof Promise)) return [3 /*break*/, 2];
750
- return [4 /*yield*/, result];
751
- case 1:
752
- _f.sent();
753
- _f.label = 2;
754
- case 2: return [2 /*return*/];
755
- }
756
- });
757
- });
758
- };
759
- LocalizeApiHelper.prototype.createRequest = function (instance, method, url, body, options, onInvalidResponseBody) {
760
- 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) {
761
- // Convert to a non-observable error to handle in the promise
762
- return rxjs.throwError(function () { return error; });
763
- }));
764
- return request$;
765
- };
766
- LocalizeApiHelper.prototype.defaultRetryFunction = function (error) {
767
- // Don't retry for other errors (like 400, 401, 403, etc.)
768
- if (!this.isConnectionError(error))
769
- throw error;
770
- return true;
771
- };
772
- LocalizeApiHelper.prototype.isConnectionError = function (error) {
773
- var isNetworkError = error.status === 0;
774
- var isServerError = error.status >= 1000 && error.status < 600;
775
- return isNetworkError || isServerError;
776
- };
777
- LocalizeApiHelper.prototype.onConnectionError = function (options, error) {
778
- var _a;
779
- return tslib.__awaiter(this, void 0, void 0, function () {
780
- var styleElement;
781
- return tslib.__generator(this, function (_f) {
782
- switch (_f.label) {
783
- case 0:
784
- if (!options.connectionError)
785
- return [2 /*return*/];
786
- if (!this.isConnectionError(error)) return [3 /*break*/, 2];
787
- styleElement = this.screenBlocker(options, error, true);
788
- return [4 /*yield*/, this.invokeHook((_a = options.connectionError.callback) === null || _a === void 0 ? void 0 : _a.bind(this, error))];
789
- case 1:
790
- _f.sent();
791
- return [2 /*return*/, styleElement];
792
- case 2:
793
- this.screenBlocker(options, error, false);
794
- styleElement === null || styleElement === void 0 ? void 0 : styleElement.remove();
795
- _f.label = 3;
796
- case 3: return [2 /*return*/];
797
- }
798
- });
799
- });
800
- };
801
- LocalizeApiHelper.prototype.screenBlocker = function (optons, error, add) {
802
- if (add === void 0) { add = true; }
803
- var _a, _b, _c, _d, _e;
804
- if (!((_a = optons.connectionError) === null || _a === void 0 ? void 0 : _a.blockScreen))
805
- return;
806
- var message = ((_b = optons.connectionError) === null || _b === void 0 ? void 0 : _b.message)
807
- || 'Connection error occurred. Please wait';
808
- var errorMessage = ((_c = error === null || error === void 0 ? void 0 : error.error) === null || _c === void 0 ? void 0 : _c.message) || 'An error occurred';
809
- var suggestinMessage = ((_d = optons.connectionError) === null || _d === void 0 ? void 0 : _d.suggestionMessage)
810
- || 'Please check your internet connection or the server status.';
811
- var zIndex = ((_e = optons.connectionError) === null || _e === void 0 ? void 0 : _e.blockScreenZIndex) || 10000;
812
- var body = document.body;
813
- 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 ";
814
- 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 ";
815
- var styleElement = document.createElement('style');
816
- if (add) {
817
- if (!document.querySelector('.lze-blocker')) {
818
- styleElement.innerHTML = style;
819
- document.head.appendChild(styleElement);
820
- body.insertAdjacentHTML('beforeend', blcokerHtml);
821
- }
822
- }
823
- else {
824
- this.removeBlocker(styleElement);
825
- }
826
- return styleElement;
827
- };
828
- LocalizeApiHelper.prototype.removeBlocker = function (styleElement) {
829
- var blocker = document.querySelector('.lze-blocker');
830
- blocker === null || blocker === void 0 ? void 0 : blocker.remove();
831
- styleElement === null || styleElement === void 0 ? void 0 : styleElement.remove();
832
- };
833
- return LocalizeApiHelper;
834
- }());
835
- function extractJsonFromResponse(body, onError) {
836
- // If already an object, just return
837
- if (typeof body === 'object' && body !== null)
838
- return body;
839
- // If it's a string, try to extract JSON portion
840
- if (typeof body === 'string') {
841
- var firstBrace = body.indexOf('{');
842
- if (firstBrace !== -1) {
843
- var jsonString = body.substring(firstBrace);
844
- try {
845
- return JSON.parse(jsonString);
846
- }
847
- catch (e) {
848
- // If parsing fails, return original string
849
- onError === null || onError === void 0 ? void 0 : onError(body);
850
- return body;
851
- }
852
- }
853
- }
854
- return body;
855
- }
856
- var ApiHelper = new LocalizeApiHelper();
857
-
858
- var SCHEMES = LocalizeToken.httpHeaders;
859
- var LocalizeApiService = /** @class */ (function () {
860
- function LocalizeApiService(httpClient, localizeTokenService) {
861
- var _this = this;
862
- this.httpClient = httpClient;
863
- this.localizeTokenService = localizeTokenService;
864
- this.destroy$ = new rxjs.Subject();
865
- this.configSubject = new rxjs.BehaviorSubject({});
866
- this.isRequestingSubject = new rxjs.BehaviorSubject(false);
867
- this.isResolvingStartupSubject = new rxjs.BehaviorSubject(false);
868
- this.defaultConfig = {
869
- waitEachRequest: { milliseconds: 0 },
870
- enableRequestCancellation: true,
871
- retryOptions: {
872
- maxRetries: 1000,
873
- delay: 1000,
874
- retryFunction: ApiHelper.defaultRetryFunction.bind(this),
875
- },
876
- };
877
- this.apiOptions = {
878
- method: exports.EMethod.GET,
879
- requestBody: null,
880
- };
881
- /**
882
- * A higher-order function that returns a curried function for making API requests.
883
- *
884
- * @param baseUrl - The base URL of the API.
885
- * @returns A curried function that can be used to make API requests.
886
- */
887
- this.func = function (baseUrl) { return function (path, method, reqBody, reqHeaders) {
888
- if (method === void 0) { method = exports.EMethod.GET; }
889
- if (reqBody === void 0) { reqBody = null; }
890
- return _this.request(baseUrl, path, method, reqBody, reqHeaders);
891
- }; };
892
- }
893
- Object.defineProperty(LocalizeApiService.prototype, "isResolvingStartup", {
894
- get: function () { return this.isResolvingStartupSubject.value; },
895
- enumerable: false,
896
- configurable: true
897
- });
898
- Object.defineProperty(LocalizeApiService.prototype, "needTenant", {
899
- get: function () { return this.localizeTokenService.config.tenantToken !== undefined; },
900
- enumerable: false,
901
- configurable: true
902
- });
903
- Object.defineProperty(LocalizeApiService.prototype, "isRequesting", {
904
- get: function () { return this.isRequestingSubject.value; },
905
- enumerable: false,
906
- configurable: true
907
- });
908
- Object.defineProperty(LocalizeApiService.prototype, "isRevokingToken", {
909
- get: function () { return this.localizeTokenService.isRevokingToken; },
910
- set: function (value) { this.localizeTokenService.isRevokingToken = value; },
911
- enumerable: false,
912
- configurable: true
913
- });
914
- Object.defineProperty(LocalizeApiService.prototype, "accessToken", {
915
- get: function () { return this.localizeTokenService.accessToken; },
916
- set: function (value) { this.localizeTokenService.accessToken = value; },
917
- enumerable: false,
918
- configurable: true
919
- });
920
- Object.defineProperty(LocalizeApiService.prototype, "refreshToken", {
921
- get: function () { return this.localizeTokenService.refreshToken; },
922
- enumerable: false,
923
- configurable: true
924
- });
925
- Object.defineProperty(LocalizeApiService.prototype, "tenantToken", {
926
- get: function () { return this.localizeTokenService.tenantToken; },
927
- enumerable: false,
928
- configurable: true
929
- });
930
- Object.defineProperty(LocalizeApiService.prototype, "isThirdPartyMode", {
931
- get: function () { return this.localizeTokenService.config.isThirdPartyMode; },
932
- enumerable: false,
933
- configurable: true
934
- });
935
- Object.defineProperty(LocalizeApiService.prototype, "clientId", {
936
- get: function () { var _a; return (_a = this.localizeTokenService.config.thirdPartyConfig) === null || _a === void 0 ? void 0 : _a.clientId; },
937
- enumerable: false,
938
- configurable: true
939
- });
940
- Object.defineProperty(LocalizeApiService.prototype, "clientSecret", {
941
- get: function () { var _a; return (_a = this.localizeTokenService.config.thirdPartyConfig) === null || _a === void 0 ? void 0 : _a.clientSecret; },
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
- // Only handle 401 Unauthorized errors
1021
- return [4 /*yield*/, this.revokeToken()];
1022
- case 1:
1023
- // Only handle 401 Unauthorized errors
1024
- _e.sent();
1025
- return [4 /*yield*/, this.performRequest(options)];
1026
- case 2:
1027
- // Retry the request with the new access token
1028
- return [2 /*return*/, _e.sent()];
1029
- }
1030
- });
1031
- }); }
1032
- })];
1033
- case 2: return [2 /*return*/, _e.sent()];
1034
- }
1035
- });
1036
- });
1037
- };
1038
- LocalizeApiService.prototype.performRequest = function (options) {
1039
- var _a;
1040
- return tslib.__awaiter(this, void 0, void 0, function () {
1041
- var buildOptions, request$, response;
1042
- var _this = this;
1043
- return tslib.__generator(this, function (_e) {
1044
- switch (_e.label) {
1045
- case 0:
1046
- buildOptions = { headers: this.buildHeaderOptions(options) };
1047
- request$ = ApiHelper.createRequest({
1048
- client: this.httpClient,
1049
- destroy$: function () { return _this.destroy$; }
1050
- }, options.method, options.requestUrl, options.requestBody, buildOptions, (_a = this.config.onResponseBodyInvalid) === null || _a === void 0 ? void 0 : _a.bind(this));
1051
- // Set the isRequesting state to true before making the request
1052
- this.isRequestingSubject.next(true);
1053
- return [4 /*yield*/, new Promise(function (resolve, reject) { return request$.subscribe({ next: resolve, error: reject }); })];
1054
- case 1:
1055
- response = _e.sent();
1056
- // Reset the isRequesting state after the request completes
1057
- this.isRequestingSubject.next(false);
1058
- return [2 /*return*/, response];
1059
- }
1060
- });
1061
- });
1062
- };
1063
- LocalizeApiService.prototype.revokeToken = function () {
1064
- var _a;
1065
- return tslib.__awaiter(this, void 0, void 0, function () {
1066
- var apiOptions, thirdPartyConfig, clientSecret, revokeToken, error_2;
1067
- var _e;
1068
- return tslib.__generator(this, function (_f) {
1069
- switch (_f.label) {
1070
- case 0:
1071
- _f.trys.push([0, 4, 6, 7]);
1072
- return [4 /*yield*/, this.interceptRevokeToken()];
1073
- case 1:
1074
- if (_f.sent())
1075
- return [2 /*return*/];
1076
- this.isRevokingToken = true;
1077
- apiOptions = Object.assign(Object.assign({}, this.buildApiOptions(((_a = this.localizeTokenService.config.refreshToken) === null || _a === void 0 ? void 0 : _a.requestUrl) || '')), { refreshToken: true });
1078
- // If in third party mode, use the third party token refresh endpoint and options
1079
- if (this.isThirdPartyMode) {
1080
- thirdPartyConfig = this.localizeTokenService.config.thirdPartyConfig;
1081
- if (thirdPartyConfig) {
1082
- // Add the request URL, method and body
1083
- apiOptions.requestUrl = thirdPartyConfig.refreshTokenUrl;
1084
- apiOptions.method = (thirdPartyConfig === null || thirdPartyConfig === void 0 ? void 0 : thirdPartyConfig.method) || exports.EMethod.GET;
1085
- apiOptions.requestBody = (thirdPartyConfig === null || thirdPartyConfig === void 0 ? void 0 : thirdPartyConfig.body) || {};
1086
- clientSecret = (_e = {}, _e[SCHEMES.X_SECRET] = "" + this.clientSecret, _e);
1087
- apiOptions.headers = Object.assign(Object.assign({}, apiOptions.headers), clientSecret);
1088
- }
1089
- }
1090
- return [4 /*yield*/, ApiHelper.performRequestWithRetry(apiOptions, this.config, this.performRequest.bind(this))];
1091
- case 2:
1092
- revokeToken = _f.sent();
1093
- return [4 /*yield*/, this.handleOnTokenRevoked(revokeToken)];
1094
- case 3:
1095
- _f.sent();
1096
- return [3 /*break*/, 7];
1097
- case 4:
1098
- error_2 = _f.sent();
1099
- // Handle the error, log it
1100
- return [4 /*yield*/, ApiHelper.invokeHook(this.config.onAutoLogout)];
1101
- case 5:
1102
- // Handle the error, log it
1103
- _f.sent();
1104
- throw error_2;
1105
- case 6:
1106
- // Reset the revoking token state
1107
- this.isRevokingToken = false;
1108
- return [7 /*endfinally*/];
1109
- case 7: return [2 /*return*/];
1110
- }
1111
- });
1112
- });
1113
- };
1114
- LocalizeApiService.prototype.apiOptionsForThirdParty = function () {
1115
- };
1116
- /** default http request options */
1117
- LocalizeApiService.prototype.buildHeaderOptions = function (options) {
1118
- var _e, _f, _g, _h, _j;
1119
- 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))), (this.isThirdPartyMode && (_j = {}, _j[SCHEMES.X_CLIENT] = "" + this.clientId, _j)));
1120
- return new i1.HttpHeaders(Object.assign(Object.assign({}, headers), options.headers));
1121
- };
1122
- LocalizeApiService.prototype.buildApiOptions = function (baseUrl, path, method, requestBody, headers) {
1123
- if (path === void 0) { path = ''; }
1124
- if (method === void 0) { method = exports.EMethod.GET; }
1125
- if (requestBody === void 0) { requestBody = null; }
1126
- var requestUrl = ApiHelper.buildUrl(baseUrl, path);
1127
- var isFormData = requestBody && requestBody instanceof FormData;
1128
- return Object.assign(Object.assign({}, this.apiOptions), { headers: headers, method: method, requestUrl: requestUrl, requestBody: requestBody, isFormData: isFormData });
1129
- };
1130
- LocalizeApiService.prototype.toWaitForPreviousRequest = function () {
1131
- var _a;
1132
- return tslib.__awaiter(this, void 0, void 0, function () {
1133
- var waitMilliseconds;
1134
- var _this = this;
1135
- return tslib.__generator(this, function (_e) {
1136
- switch (_e.label) {
1137
- case 0:
1138
- if (!this.isRevokingToken) return [3 /*break*/, 2];
1139
- return [4 /*yield*/, waitUntil(function () { return !_this.isRevokingToken; })];
1140
- case 1:
1141
- _e.sent();
1142
- _e.label = 2;
1143
- case 2:
1144
- waitMilliseconds = (_a = this.config.waitEachRequest) === null || _a === void 0 ? void 0 : _a.milliseconds;
1145
- if (!(waitMilliseconds && this.isRequesting)) return [3 /*break*/, 4];
1146
- // console.warn(`Request throttling: Another request is in progress. Waiting for ${waitMilliseconds}ms.`);
1147
- return [4 /*yield*/, waitFor(waitMilliseconds, this.isRequesting)];
1148
- case 3:
1149
- // console.warn(`Request throttling: Another request is in progress. Waiting for ${waitMilliseconds}ms.`);
1150
- _e.sent();
1151
- _e.label = 4;
1152
- case 4: return [2 /*return*/];
1153
- }
1154
- });
1155
- });
1156
- };
1157
- LocalizeApiService.prototype.handleOnTokenRevoked = function (response) {
1158
- return tslib.__awaiter(this, void 0, void 0, function () {
1159
- return tslib.__generator(this, function (_e) {
1160
- switch (_e.label) {
1161
- case 0:
1162
- if (!(this.isThirdPartyMode && (response === null || response === void 0 ? void 0 : response.token))) return [3 /*break*/, 1];
1163
- // If request third party token refresh, the new access token will be in response.token.
1164
- this.accessToken = response.token;
1165
- return [3 /*break*/, 4];
1166
- case 1:
1167
- if (!(response === null || response === void 0 ? void 0 : response.status)) return [3 /*break*/, 2];
1168
- // If the response is successful, update the access token
1169
- this.accessToken = response.message;
1170
- return [3 /*break*/, 4];
1171
- case 2:
1172
- // If the response indicates an error, invoke the onRevokeUnauthorized hook
1173
- console.warn('Token revocation failed, refresh token is expired.', response.message);
1174
- return [4 /*yield*/, ApiHelper.invokeHook(this.config.onRevokeUnauthorized)];
1175
- case 3:
1176
- _e.sent();
1177
- _e.label = 4;
1178
- case 4: return [2 /*return*/];
1179
- }
1180
- });
1181
- });
1182
- };
1183
- LocalizeApiService.prototype.interceptRevokeToken = function () {
1184
- return tslib.__awaiter(this, void 0, void 0, function () {
1185
- var _this = this;
1186
- return tslib.__generator(this, function (_e) {
1187
- switch (_e.label) {
1188
- case 0:
1189
- if (!this.isRevokingToken) return [3 /*break*/, 2];
1190
- console.warn('Token is already being revoked. Waiting for the current operation to complete...');
1191
- return [4 /*yield*/, waitUntil(function () { return !_this.isRevokingToken; })];
1192
- case 1:
1193
- _e.sent();
1194
- return [2 /*return*/, true];
1195
- case 2:
1196
- if (!this.refreshToken) {
1197
- // await ApiHelper.invokeHook(this.apiConfigs.onAutoLogout);
1198
- throw new Error('Refresh token is missing. Please login again.');
1199
- }
1200
- return [2 /*return*/, false];
1201
- }
1202
- });
1203
- });
1204
- };
1205
- LocalizeApiService.prototype.validateConfig = function () {
1206
- var _a, _b, _c, _d;
1207
- if (this.localizeTokenService.config.requiredTenant
1208
- && !((_b = (_a = this.localizeTokenService.config.tenantToken) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.trim().length)) {
1209
- throw Error('Tenant token is required but tenantTokenName is not configured');
1210
- }
1211
- if (!((_d = (_c = this.localizeTokenService.config.refreshToken) === null || _c === void 0 ? void 0 : _c.requestUrl) === null || _d === void 0 ? void 0 : _d.trim().length)) {
1212
- throw Error('Revoke token URL is not configured - token refresh will not work');
1213
- }
1214
- };
1215
- return LocalizeApiService;
1216
- }());
1217
- 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" });
1218
- LocalizeApiService.decorators = [
1219
- { type: i0.Injectable, args: [{
1220
- providedIn: 'root'
1221
- },] }
1222
- ];
1223
- LocalizeApiService.ctorParameters = function () { return [
1224
- { type: i1.HttpClient },
1225
- { type: LocalizeTokenService }
1226
- ]; };
1227
-
1228
- var LocalizeTokenModule = /** @class */ (function () {
1229
- function LocalizeTokenModule() {
1230
- }
1231
- return LocalizeTokenModule;
1232
- }());
1233
- LocalizeTokenModule.decorators = [
1234
- { type: i0.NgModule, args: [{
1235
- providers: [
1236
- LocalizeTokenService,
1237
- LocalizeApiService
1238
- ]
1239
- },] }
1240
- ];
1241
-
1242
- var LocalizeApiTokenService = /** @class */ (function () {
1243
- function LocalizeApiTokenService(tokenService, apiService, loginDialogService) {
646
+ var LocalizeTokenConfigureService = /** @class */ (function () {
647
+ function LocalizeTokenConfigureService(tokenService, apiService, loginDialogService) {
1244
648
  this.api = apiService;
1245
649
  this.token = tokenService;
1246
650
  this.loginDialog = loginDialogService;
1247
651
  }
1248
- LocalizeApiTokenService.prototype.initialize = function (tokenConfig, apiConfig) {
1249
- // Initialize the LocalizeTokenService with the provided token configuration
652
+ LocalizeTokenConfigureService.prototype.initialize = function (tokenConfig, apiConfig) {
653
+ // Initialize the LocalizeApiTokenService with the provided token configuration
1250
654
  this.token.init(tokenConfig);
1251
655
  // Initialize the LocalizeApiService with the provided API configuration
1252
656
  this.api.init(apiConfig);
1253
- console.log('LocalizeApiTokenService initialized with token and API configurations.');
657
+ console.log('LocalizeTokenConfigureService initialized with token and API configurations.');
1254
658
  };
1255
- return LocalizeApiTokenService;
659
+ return LocalizeTokenConfigureService;
1256
660
  }());
1257
- 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" });
1258
- LocalizeApiTokenService.decorators = [
661
+ 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" });
662
+ LocalizeTokenConfigureService.decorators = [
1259
663
  { type: i0.Injectable, args: [{
1260
664
  providedIn: 'root'
1261
665
  },] }
1262
666
  ];
1263
- LocalizeApiTokenService.ctorParameters = function () { return [
1264
- { type: LocalizeTokenService },
1265
- { type: LocalizeApiService },
1266
- { type: LocalizeLogindlgService }
667
+ LocalizeTokenConfigureService.ctorParameters = function () { return [
668
+ { type: i1.LocalizeApiTokenService },
669
+ { type: i1.LocalizeApiService },
670
+ { type: LocalizeTokenDialogService }
1267
671
  ]; };
1268
672
 
1269
- var LocalizeApiTokenModule = /** @class */ (function () {
1270
- function LocalizeApiTokenModule() {
1271
- }
1272
- return LocalizeApiTokenModule;
1273
- }());
1274
- LocalizeApiTokenModule.decorators = [
1275
- { type: i0.NgModule, args: [{
1276
- declarations: [],
1277
- imports: [
1278
- common.CommonModule,
1279
- LocalizeTokenModule,
1280
- LocalizeLogindlgModule
1281
- ],
1282
- providers: [
1283
- LocalizeApiTokenService
1284
- ]
1285
- },] }
1286
- ];
1287
-
1288
673
  //#region login dialog
1289
674
 
1290
675
  /**
1291
676
  * Generated bundle index. Do not edit.
1292
677
  */
1293
678
 
1294
- exports.ApiHelper = ApiHelper;
1295
- exports.LOCALIZE_API_ASSETS = LOCALIZE_API_ASSETS;
1296
- exports.LocalizeApiService = LocalizeApiService;
1297
- exports.LocalizeApiTokenModule = LocalizeApiTokenModule;
1298
- exports.LocalizeApiTokenService = LocalizeApiTokenService;
1299
- exports.LocalizeLogindlgComponent = LocalizeLogindlgComponent;
1300
- exports.LocalizeLogindlgModule = LocalizeLogindlgModule;
1301
- exports.LocalizeLogindlgService = LocalizeLogindlgService;
1302
- exports.LocalizeToken = LocalizeToken;
679
+ exports.LocalizeTokenConfigureService = LocalizeTokenConfigureService;
680
+ exports.LocalizeTokenDialogService = LocalizeTokenDialogService;
681
+ exports.LocalizeTokenLoginDialogComponent = LocalizeTokenLoginDialogComponent;
1303
682
  exports.LocalizeTokenModule = LocalizeTokenModule;
1304
- exports.LocalizeTokenService = LocalizeTokenService;
1305
- exports.LocalizeTokenStorage = LocalizeTokenStorage;
1306
- exports.extractMainDomain = extractMainDomain;
1307
- exports.waitFor = waitFor;
1308
- exports.waitUntil = waitUntil;
1309
683
 
1310
684
  Object.defineProperty(exports, '__esModule', { value: true });
1311
685