@esolve/ng-esolve-connect 0.29.2 → 0.29.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/auth/esolve-auth.service.mjs +4 -2
- package/esm2020/lib/session/esolve-session.service.mjs +24 -10
- package/esm2020/lib/shared/cookie/esolve-cookie.service.mjs +8 -4
- package/esm2020/lib/stock/esolve-stock.service.mjs +2 -1
- package/esm2020/lib/stock/interfaces/esolve-stock-filter-options.interface.mjs +1 -1
- package/fesm2015/esolve-ng-esolve-connect.mjs +35 -14
- package/fesm2015/esolve-ng-esolve-connect.mjs.map +1 -1
- package/fesm2020/esolve-ng-esolve-connect.mjs +34 -13
- package/fesm2020/esolve-ng-esolve-connect.mjs.map +1 -1
- package/lib/session/esolve-session.service.d.ts +3 -1
- package/lib/shared/cookie/esolve-cookie.service.d.ts +1 -1
- package/lib/stock/interfaces/esolve-stock-filter-options.interface.d.ts +1 -0
- package/package.json +1 -1
|
@@ -71,7 +71,9 @@ class EsolveCookieService {
|
|
|
71
71
|
const server_cookies = (_a = this.request.headers.cookie) !== null && _a !== void 0 ? _a : '';
|
|
72
72
|
const regExp = this.getCookieRegExp(name);
|
|
73
73
|
const result = regExp.exec(server_cookies);
|
|
74
|
-
return result && result[1]
|
|
74
|
+
return result && result[1]
|
|
75
|
+
? this.safeDecodeURIComponent(result[1])
|
|
76
|
+
: '';
|
|
75
77
|
}
|
|
76
78
|
set(name, value, expires, path, domain, secure) {
|
|
77
79
|
if (this.is_browser) {
|
|
@@ -99,7 +101,9 @@ class EsolveCookieService {
|
|
|
99
101
|
* @link https://github.com/stevermeister/ngx-cookie-service/blob/bcb6ac203487c487fcd126896bffaa14981c709c/projects/ngx-cookie-service/src/lib/cookie.service.ts#L31
|
|
100
102
|
*/
|
|
101
103
|
getCookieRegExp(name) {
|
|
102
|
-
const escapedName = name.replace(
|
|
104
|
+
const escapedName = name.replace(
|
|
105
|
+
// eslint-disable-next-line no-useless-escape
|
|
106
|
+
/([\[\]\{\}\(\)\|\=\;\+\?\,\.\*\^\$])/gi, '\\$1');
|
|
103
107
|
return new RegExp('(?:^' + escapedName + '|;\\s*' + escapedName + ')=(.*?)(?:;|$)', 'g');
|
|
104
108
|
}
|
|
105
109
|
/**
|
|
@@ -129,7 +133,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImpor
|
|
|
129
133
|
providedIn: 'root',
|
|
130
134
|
}]
|
|
131
135
|
}], ctorParameters: function () {
|
|
132
|
-
return [{ type: i1.CookieService }, { type:
|
|
136
|
+
return [{ type: i1.CookieService }, { type: undefined, decorators: [{
|
|
133
137
|
type: Inject,
|
|
134
138
|
args: [PLATFORM_ID]
|
|
135
139
|
}] }, { type: undefined, decorators: [{
|
|
@@ -169,8 +173,8 @@ class EsolveSessionService {
|
|
|
169
173
|
return;
|
|
170
174
|
}
|
|
171
175
|
let json_data = this.cookieService.get(this.storage_key);
|
|
172
|
-
if (json_data === ''
|
|
173
|
-
|
|
176
|
+
if (json_data === '') {
|
|
177
|
+
const local_store_data = this.getBackup();
|
|
174
178
|
if (local_store_data) {
|
|
175
179
|
json_data = local_store_data;
|
|
176
180
|
}
|
|
@@ -196,9 +200,7 @@ class EsolveSessionService {
|
|
|
196
200
|
const session = new EsolveSession(user_id, location_id, key, expiration_date);
|
|
197
201
|
const json_data = JSON.stringify(session);
|
|
198
202
|
this.cookieService.set(this.storage_key, json_data, expiration_date, '/');
|
|
199
|
-
|
|
200
|
-
localStorage.setItem(this.storage_key, json_data);
|
|
201
|
-
}
|
|
203
|
+
this.setBackup(json_data);
|
|
202
204
|
this._session.next(session);
|
|
203
205
|
this.startTimer(expirationCallback, expires * 1000);
|
|
204
206
|
}
|
|
@@ -212,9 +214,7 @@ class EsolveSessionService {
|
|
|
212
214
|
}
|
|
213
215
|
const json_data = JSON.stringify(current_session);
|
|
214
216
|
this.cookieService.set(this.storage_key, json_data, current_session.expiration_date, '/');
|
|
215
|
-
|
|
216
|
-
localStorage.setItem(this.storage_key, json_data);
|
|
217
|
-
}
|
|
217
|
+
this.setBackup(json_data);
|
|
218
218
|
this._session.next(current_session);
|
|
219
219
|
if (typeof callback === 'function') {
|
|
220
220
|
callback();
|
|
@@ -231,6 +231,24 @@ class EsolveSessionService {
|
|
|
231
231
|
this.key_expiration_timer = setTimeout(callback, duration);
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
|
+
getBackup() {
|
|
235
|
+
if (!this.is_browser) {
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
238
|
+
if (!localStorage) {
|
|
239
|
+
return null;
|
|
240
|
+
}
|
|
241
|
+
return localStorage.getItem(this.storage_key);
|
|
242
|
+
}
|
|
243
|
+
setBackup(data) {
|
|
244
|
+
if (!this.is_browser) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
if (!localStorage) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
localStorage.setItem(this.storage_key, data);
|
|
251
|
+
}
|
|
234
252
|
}
|
|
235
253
|
EsolveSessionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: EsolveSessionService, deps: [{ token: PLATFORM_ID }, { token: ESOLVE_CONNECT_CONFIG }, { token: EsolveCookieService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
236
254
|
EsolveSessionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: EsolveSessionService, providedIn: 'root' });
|
|
@@ -240,7 +258,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImpor
|
|
|
240
258
|
providedIn: 'root',
|
|
241
259
|
}]
|
|
242
260
|
}], ctorParameters: function () {
|
|
243
|
-
return [{ type:
|
|
261
|
+
return [{ type: undefined, decorators: [{
|
|
244
262
|
type: Inject,
|
|
245
263
|
args: [PLATFORM_ID]
|
|
246
264
|
}] }, { type: undefined, decorators: [{
|
|
@@ -1723,7 +1741,9 @@ class EsolveAuthService {
|
|
|
1723
1741
|
}
|
|
1724
1742
|
autoLogin() {
|
|
1725
1743
|
this.session.restore(this.handleExpiration(), () => {
|
|
1726
|
-
firstValueFrom(this.getAccessToken('', '', true)).then(() => {
|
|
1744
|
+
firstValueFrom(this.getAccessToken('', '', true)).then(() => {
|
|
1745
|
+
// empty
|
|
1746
|
+
}, (error) => {
|
|
1727
1747
|
console.error(error);
|
|
1728
1748
|
});
|
|
1729
1749
|
});
|
|
@@ -4634,13 +4654,14 @@ class EsolveStockService {
|
|
|
4634
4654
|
}));
|
|
4635
4655
|
}
|
|
4636
4656
|
getStockFilters(options) {
|
|
4637
|
-
var _a, _b, _c, _d;
|
|
4657
|
+
var _a, _b, _c, _d, _e;
|
|
4638
4658
|
let params = new HttpParams({
|
|
4639
4659
|
fromObject: {
|
|
4640
4660
|
category_id: (_a = options.category_id) !== null && _a !== void 0 ? _a : '',
|
|
4641
4661
|
subcategory_id: (_b = options.subcategory_id) !== null && _b !== void 0 ? _b : 0,
|
|
4642
4662
|
ranges_id: (_c = options.ranges_id) !== null && _c !== void 0 ? _c : 0,
|
|
4643
4663
|
manufacturers_id: (_d = options.manufacturers_id) !== null && _d !== void 0 ? _d : 0,
|
|
4664
|
+
specials_id: (_e = options.specials_id) !== null && _e !== void 0 ? _e : 0,
|
|
4644
4665
|
fields: options.fields.join(','),
|
|
4645
4666
|
},
|
|
4646
4667
|
});
|