@esolve/ng-esolve-connect 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/esolve-ng-esolve-connect.umd.js +508 -476
- package/bundles/esolve-ng-esolve-connect.umd.js.map +1 -1
- package/esm2015/lib/auth/esolve-account.service.js +50 -7
- package/esm2015/lib/auth/esolve-auth.service.js +21 -58
- package/esm2015/lib/auth/esolve-registration-data.js +2 -0
- package/esm2015/lib/auth/esolve-session.service.js +4 -10
- package/esm2015/lib/cart/esolve-cart-item-record.js +1 -1
- package/esm2015/lib/cart/esolve-cart-item-response.js +2 -0
- package/esm2015/lib/cart/esolve-cart.service.js +8 -53
- package/esm2015/lib/esolve-connect.config.js +8 -7
- package/esm2015/lib/shared/error-handler/esolve-error-handler.service.js +58 -0
- package/esm2015/lib/shared/error-handler/esolve-http-error.js +8 -0
- package/esm2015/public-api.js +5 -1
- package/fesm2015/esolve-ng-esolve-connect.js +228 -214
- package/fesm2015/esolve-ng-esolve-connect.js.map +1 -1
- package/lib/auth/esolve-account.service.d.ts +7 -1
- package/lib/auth/esolve-auth.service.d.ts +3 -1
- package/lib/auth/esolve-registration-data.d.ts +12 -0
- package/lib/auth/esolve-session.service.d.ts +1 -2
- package/lib/cart/esolve-cart-item-record.d.ts +0 -5
- package/lib/cart/esolve-cart-item-response.d.ts +5 -0
- package/lib/cart/esolve-cart.service.d.ts +4 -2
- package/lib/esolve-connect.config.d.ts +0 -6
- package/lib/shared/error-handler/esolve-error-handler.service.d.ts +11 -0
- package/lib/shared/error-handler/esolve-http-error.d.ts +6 -0
- package/package.json +1 -1
- package/public-api.d.ts +4 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/common/http'), require('rxjs'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@esolve/ng-esolve-connect', ['exports', '@angular/core', '@angular/common', '@angular/common/http', 'rxjs', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.esolve = global.esolve || {}, global.esolve['ng-esolve-connect'] = {}), global.ng.core, global.ng.common, global.ng.common.http, global.rxjs, global.
|
|
5
|
-
}(this, (function (exports, i0, common, i1, rxjs,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/common/http'), require('rxjs'), require('@angular/platform-browser'), require('rxjs/operators')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@esolve/ng-esolve-connect', ['exports', '@angular/core', '@angular/common', '@angular/common/http', 'rxjs', '@angular/platform-browser', 'rxjs/operators'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.esolve = global.esolve || {}, global.esolve['ng-esolve-connect'] = {}), global.ng.core, global.ng.common, global.ng.common.http, global.rxjs, global.ng.platformBrowser, global.rxjs.operators));
|
|
5
|
+
}(this, (function (exports, i0, common, i1, rxjs, i1$1, operators) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopNamespace(e) {
|
|
8
8
|
if (e && e.__esModule) return e;
|
|
@@ -25,16 +25,17 @@
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
28
|
-
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
|
29
|
-
var i1__namespace
|
|
28
|
+
var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1);
|
|
29
|
+
var i1__namespace = /*#__PURE__*/_interopNamespace(i1$1);
|
|
30
30
|
|
|
31
31
|
var ESOLVE_CONNECT_CONFIG = new i0.InjectionToken('esolve.connect.config');
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
// For future development
|
|
33
|
+
// export const GLOBAL_CONFIG = {
|
|
34
|
+
// images_url: '',
|
|
35
|
+
// media_path: '/media',
|
|
36
|
+
// stock_path: '/stock',
|
|
37
|
+
// banner_path: '/banners'
|
|
38
|
+
// };
|
|
38
39
|
|
|
39
40
|
var EsolveSession = /** @class */ (function () {
|
|
40
41
|
function EsolveSession(id, _key, _key_expiration_date) {
|
|
@@ -82,6 +83,247 @@
|
|
|
82
83
|
return EsolveSession;
|
|
83
84
|
}());
|
|
84
85
|
|
|
86
|
+
var EsolveSessionService = /** @class */ (function () {
|
|
87
|
+
function EsolveSessionService(config) {
|
|
88
|
+
this.config = config;
|
|
89
|
+
this.storage_key = 'ngEslvUserSession';
|
|
90
|
+
this.setStorageKey();
|
|
91
|
+
this._session = new rxjs.BehaviorSubject(new EsolveSession(0, ''));
|
|
92
|
+
this.session = this._session.asObservable();
|
|
93
|
+
}
|
|
94
|
+
Object.defineProperty(EsolveSessionService.prototype, "currentSession", {
|
|
95
|
+
get: function () {
|
|
96
|
+
return this._session.value;
|
|
97
|
+
},
|
|
98
|
+
enumerable: false,
|
|
99
|
+
configurable: true
|
|
100
|
+
});
|
|
101
|
+
EsolveSessionService.prototype.setStorageKey = function () {
|
|
102
|
+
if ((typeof this.config.user_session_storage_key === 'string') &&
|
|
103
|
+
(this.config.user_session_storage_key !== '')) {
|
|
104
|
+
this.storage_key = this.config.user_session_storage_key;
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
EsolveSessionService.prototype.startTimer = function (callback, duration) {
|
|
108
|
+
this.key_expiration_timer = setTimeout(callback, duration);
|
|
109
|
+
};
|
|
110
|
+
EsolveSessionService.prototype.clearTimer = function () {
|
|
111
|
+
if (this.key_expiration_timer) {
|
|
112
|
+
clearTimeout(this.key_expiration_timer);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
EsolveSessionService.prototype.restore = function (expirationCallback, invalidSessionCallback) {
|
|
116
|
+
if (!this.currentSession.valid) {
|
|
117
|
+
var stored_session_json = localStorage.getItem(this.storage_key);
|
|
118
|
+
var stored_session = (stored_session_json ? JSON.parse(stored_session_json) : null);
|
|
119
|
+
if (!stored_session) {
|
|
120
|
+
invalidSessionCallback();
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
var expiration_date = new Date(stored_session._key_expiration_date);
|
|
124
|
+
var loaded_session = new EsolveSession(stored_session.id, stored_session._key, expiration_date);
|
|
125
|
+
if (!loaded_session.expired) {
|
|
126
|
+
this._session.next(loaded_session);
|
|
127
|
+
var expiration_duration = expiration_date.getTime() - new Date().getTime();
|
|
128
|
+
this.startTimer(expirationCallback, expiration_duration);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
expirationCallback(loaded_session);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
EsolveSessionService.prototype.handleSession = function (user_id, key, expiry_time, expires, expirationCallback) {
|
|
136
|
+
var expiration_date = new Date(expiry_time * 1000);
|
|
137
|
+
var session = new EsolveSession(user_id, key, expiration_date);
|
|
138
|
+
localStorage.setItem(this.storage_key, JSON.stringify(session));
|
|
139
|
+
this._session.next(session);
|
|
140
|
+
this.startTimer(expirationCallback, expires * 1000);
|
|
141
|
+
};
|
|
142
|
+
EsolveSessionService.prototype.handleUpdateSession = function (user_id, callback) {
|
|
143
|
+
var current_session = this.currentSession;
|
|
144
|
+
current_session.updateUser(user_id);
|
|
145
|
+
localStorage.setItem(this.storage_key, JSON.stringify(current_session));
|
|
146
|
+
this._session.next(current_session);
|
|
147
|
+
if (typeof callback === 'function') {
|
|
148
|
+
callback();
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
return EsolveSessionService;
|
|
152
|
+
}());
|
|
153
|
+
EsolveSessionService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveSessionService, deps: [{ token: ESOLVE_CONNECT_CONFIG }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
154
|
+
EsolveSessionService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveSessionService, providedIn: 'root' });
|
|
155
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveSessionService, decorators: [{
|
|
156
|
+
type: i0.Injectable,
|
|
157
|
+
args: [{
|
|
158
|
+
providedIn: 'root'
|
|
159
|
+
}]
|
|
160
|
+
}], ctorParameters: function () {
|
|
161
|
+
return [{ type: undefined, decorators: [{
|
|
162
|
+
type: i0.Inject,
|
|
163
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
164
|
+
}] }];
|
|
165
|
+
} });
|
|
166
|
+
|
|
167
|
+
var EsolveAuthInterceptorService = /** @class */ (function () {
|
|
168
|
+
function EsolveAuthInterceptorService(config, session) {
|
|
169
|
+
this.config = config;
|
|
170
|
+
this.session = session;
|
|
171
|
+
}
|
|
172
|
+
EsolveAuthInterceptorService.prototype.intercept = function (req, next) {
|
|
173
|
+
if (req.url.startsWith(this.config.api_url + "/service/")) {
|
|
174
|
+
var service_identifier = req.url.replace(this.config.api_url + "/service/", '');
|
|
175
|
+
var old_parms_keys = req.params.keys();
|
|
176
|
+
var modified_url = req.url;
|
|
177
|
+
var params_1 = new i1.HttpParams();
|
|
178
|
+
var session = this.session.currentSession;
|
|
179
|
+
if (session.valid) {
|
|
180
|
+
if (service_identifier !== 'get-access-token.php') {
|
|
181
|
+
params_1 = params_1.set('key', session.key);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
old_parms_keys.forEach(function (key) {
|
|
185
|
+
params_1 = params_1.set(key, req.params.get(key) || '');
|
|
186
|
+
});
|
|
187
|
+
var modified_req = req.clone({
|
|
188
|
+
url: modified_url,
|
|
189
|
+
params: params_1
|
|
190
|
+
});
|
|
191
|
+
return next.handle(modified_req);
|
|
192
|
+
}
|
|
193
|
+
return next.handle(req);
|
|
194
|
+
};
|
|
195
|
+
return EsolveAuthInterceptorService;
|
|
196
|
+
}());
|
|
197
|
+
EsolveAuthInterceptorService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAuthInterceptorService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: EsolveSessionService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
198
|
+
EsolveAuthInterceptorService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAuthInterceptorService });
|
|
199
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAuthInterceptorService, decorators: [{
|
|
200
|
+
type: i0.Injectable
|
|
201
|
+
}], ctorParameters: function () {
|
|
202
|
+
return [{ type: undefined, decorators: [{
|
|
203
|
+
type: i0.Inject,
|
|
204
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
205
|
+
}] }, { type: EsolveSessionService }];
|
|
206
|
+
} });
|
|
207
|
+
|
|
208
|
+
var NgEsolveConnectModule = /** @class */ (function () {
|
|
209
|
+
function NgEsolveConnectModule() {
|
|
210
|
+
}
|
|
211
|
+
NgEsolveConnectModule.forRoot = function (config) {
|
|
212
|
+
return {
|
|
213
|
+
ngModule: NgEsolveConnectModule,
|
|
214
|
+
providers: [
|
|
215
|
+
{
|
|
216
|
+
provide: ESOLVE_CONNECT_CONFIG,
|
|
217
|
+
useValue: config
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
provide: i1.HTTP_INTERCEPTORS,
|
|
221
|
+
useClass: EsolveAuthInterceptorService,
|
|
222
|
+
multi: true
|
|
223
|
+
}
|
|
224
|
+
]
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
return NgEsolveConnectModule;
|
|
228
|
+
}());
|
|
229
|
+
NgEsolveConnectModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: NgEsolveConnectModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
230
|
+
NgEsolveConnectModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: NgEsolveConnectModule, imports: [common.CommonModule,
|
|
231
|
+
i1.HttpClientModule] });
|
|
232
|
+
NgEsolveConnectModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: NgEsolveConnectModule, imports: [[
|
|
233
|
+
common.CommonModule,
|
|
234
|
+
i1.HttpClientModule
|
|
235
|
+
]] });
|
|
236
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: NgEsolveConnectModule, decorators: [{
|
|
237
|
+
type: i0.NgModule,
|
|
238
|
+
args: [{
|
|
239
|
+
declarations: [],
|
|
240
|
+
imports: [
|
|
241
|
+
common.CommonModule,
|
|
242
|
+
i1.HttpClientModule
|
|
243
|
+
],
|
|
244
|
+
exports: []
|
|
245
|
+
}]
|
|
246
|
+
}] });
|
|
247
|
+
|
|
248
|
+
var EsolveHttpError = /** @class */ (function () {
|
|
249
|
+
function EsolveHttpError(type, message, error_code) {
|
|
250
|
+
this.type = type;
|
|
251
|
+
this.message = message;
|
|
252
|
+
this.error_code = error_code;
|
|
253
|
+
}
|
|
254
|
+
return EsolveHttpError;
|
|
255
|
+
}());
|
|
256
|
+
|
|
257
|
+
var EsolveErrorHandlerService = /** @class */ (function () {
|
|
258
|
+
function EsolveErrorHandlerService() {
|
|
259
|
+
}
|
|
260
|
+
EsolveErrorHandlerService.prototype.parseException = function (exception) {
|
|
261
|
+
var error = new EsolveHttpError('exception', exception.message || 'Unknown exception has occurred', exception.additional_data.exception_type || 'unknown');
|
|
262
|
+
return error;
|
|
263
|
+
};
|
|
264
|
+
EsolveErrorHandlerService.prototype.parseErrors = function (response) {
|
|
265
|
+
var error = new EsolveHttpError('error', 'Unknown error has occurred', 'unknown');
|
|
266
|
+
if ((response.status.state === 'none') && (response.log.length > 0)) {
|
|
267
|
+
error.error_code = 'no_response';
|
|
268
|
+
error.message = 'Response was provided';
|
|
269
|
+
}
|
|
270
|
+
else if (response.status.state === 'error') {
|
|
271
|
+
var login_error_log = response.log[0];
|
|
272
|
+
error.error_code = login_error_log.message_code;
|
|
273
|
+
error.message = login_error_log.message;
|
|
274
|
+
}
|
|
275
|
+
return error;
|
|
276
|
+
};
|
|
277
|
+
EsolveErrorHandlerService.prototype.handleHttpError = function (service_type, errorRes) {
|
|
278
|
+
if (errorRes instanceof i1.HttpErrorResponse) {
|
|
279
|
+
if (errorRes.status === 500) {
|
|
280
|
+
var server_error = errorRes.error;
|
|
281
|
+
if ((server_error.service_type === service_type) ||
|
|
282
|
+
(server_error.type !== undefined) ||
|
|
283
|
+
(server_error.message !== undefined) ||
|
|
284
|
+
(server_error.additional_data !== undefined)) {
|
|
285
|
+
return rxjs.throwError(this.parseException(server_error));
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
if (errorRes.type !== undefined) {
|
|
291
|
+
if (errorRes.type === 'exception') {
|
|
292
|
+
return rxjs.throwError(this.parseException(errorRes));
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
else if (errorRes.transaction_type !== undefined) {
|
|
296
|
+
return rxjs.throwError(this.parseErrors(errorRes));
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return rxjs.throwError(errorRes);
|
|
300
|
+
};
|
|
301
|
+
return EsolveErrorHandlerService;
|
|
302
|
+
}());
|
|
303
|
+
EsolveErrorHandlerService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveErrorHandlerService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
304
|
+
EsolveErrorHandlerService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveErrorHandlerService, providedIn: 'root' });
|
|
305
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveErrorHandlerService, decorators: [{
|
|
306
|
+
type: i0.Injectable,
|
|
307
|
+
args: [{
|
|
308
|
+
providedIn: 'root'
|
|
309
|
+
}]
|
|
310
|
+
}], ctorParameters: function () { return []; } });
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Search Engine Optimization information.
|
|
314
|
+
*/
|
|
315
|
+
var EsolveSEOInfo = /** @class */ (function () {
|
|
316
|
+
function EsolveSEOInfo(title, description, keywords) {
|
|
317
|
+
if (title === void 0) { title = ''; }
|
|
318
|
+
if (description === void 0) { description = ''; }
|
|
319
|
+
if (keywords === void 0) { keywords = ''; }
|
|
320
|
+
this.title = title;
|
|
321
|
+
this.description = description;
|
|
322
|
+
this.keywords = keywords;
|
|
323
|
+
}
|
|
324
|
+
return EsolveSEOInfo;
|
|
325
|
+
}());
|
|
326
|
+
|
|
85
327
|
/*! *****************************************************************************
|
|
86
328
|
Copyright (c) Microsoft Corporation.
|
|
87
329
|
|
|
@@ -329,349 +571,76 @@
|
|
|
329
571
|
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
330
572
|
function verb(n) { if (g[n])
|
|
331
573
|
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
332
|
-
function resume(n, v) { try {
|
|
333
|
-
step(g[n](v));
|
|
334
|
-
}
|
|
335
|
-
catch (e) {
|
|
336
|
-
settle(q[0][3], e);
|
|
337
|
-
} }
|
|
338
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
339
|
-
function fulfill(value) { resume("next", value); }
|
|
340
|
-
function reject(value) { resume("throw", value); }
|
|
341
|
-
function settle(f, v) { if (f(v), q.shift(), q.length)
|
|
342
|
-
resume(q[0][0], q[0][1]); }
|
|
343
|
-
}
|
|
344
|
-
function __asyncDelegator(o) {
|
|
345
|
-
var i, p;
|
|
346
|
-
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
347
|
-
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; }
|
|
348
|
-
}
|
|
349
|
-
function __asyncValues(o) {
|
|
350
|
-
if (!Symbol.asyncIterator)
|
|
351
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
352
|
-
var m = o[Symbol.asyncIterator], i;
|
|
353
|
-
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);
|
|
354
|
-
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); }); }; }
|
|
355
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
356
|
-
}
|
|
357
|
-
function __makeTemplateObject(cooked, raw) {
|
|
358
|
-
if (Object.defineProperty) {
|
|
359
|
-
Object.defineProperty(cooked, "raw", { value: raw });
|
|
360
|
-
}
|
|
361
|
-
else {
|
|
362
|
-
cooked.raw = raw;
|
|
363
|
-
}
|
|
364
|
-
return cooked;
|
|
365
|
-
}
|
|
366
|
-
;
|
|
367
|
-
var __setModuleDefault = Object.create ? (function (o, v) {
|
|
368
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
369
|
-
}) : function (o, v) {
|
|
370
|
-
o["default"] = v;
|
|
371
|
-
};
|
|
372
|
-
function __importStar(mod) {
|
|
373
|
-
if (mod && mod.__esModule)
|
|
374
|
-
return mod;
|
|
375
|
-
var result = {};
|
|
376
|
-
if (mod != null)
|
|
377
|
-
for (var k in mod)
|
|
378
|
-
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
379
|
-
__createBinding(result, mod, k);
|
|
380
|
-
__setModuleDefault(result, mod);
|
|
381
|
-
return result;
|
|
382
|
-
}
|
|
383
|
-
function __importDefault(mod) {
|
|
384
|
-
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
385
|
-
}
|
|
386
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
387
|
-
if (kind === "a" && !f)
|
|
388
|
-
throw new TypeError("Private accessor was defined without a getter");
|
|
389
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
390
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
391
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
392
|
-
}
|
|
393
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
394
|
-
if (kind === "m")
|
|
395
|
-
throw new TypeError("Private method is not writable");
|
|
396
|
-
if (kind === "a" && !f)
|
|
397
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
398
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
399
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
400
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
var EsolveAddress = /** @class */ (function () {
|
|
404
|
-
function EsolveAddress(id, recipient, address_type, pobox, place_name, street_number, street, suburb, city, province, country, postal_code, latitude, longitude) {
|
|
405
|
-
this.id = id;
|
|
406
|
-
this.recipient = recipient;
|
|
407
|
-
this.address_type = address_type;
|
|
408
|
-
this.pobox = pobox;
|
|
409
|
-
this.place_name = place_name;
|
|
410
|
-
this.street_number = street_number;
|
|
411
|
-
this.street = street;
|
|
412
|
-
this.suburb = suburb;
|
|
413
|
-
this.city = city;
|
|
414
|
-
this.province = province;
|
|
415
|
-
this.country = country;
|
|
416
|
-
this.postal_code = postal_code;
|
|
417
|
-
this.latitude = latitude;
|
|
418
|
-
this.longitude = longitude;
|
|
419
|
-
}
|
|
420
|
-
return EsolveAddress;
|
|
421
|
-
}());
|
|
422
|
-
|
|
423
|
-
var EsolveAccountService = /** @class */ (function () {
|
|
424
|
-
function EsolveAccountService(config, http) {
|
|
425
|
-
this.config = config;
|
|
426
|
-
this.http = http;
|
|
427
|
-
this._user_id = 0;
|
|
428
|
-
}
|
|
429
|
-
Object.defineProperty(EsolveAccountService.prototype, "user_id", {
|
|
430
|
-
get: function () {
|
|
431
|
-
return this._user_id;
|
|
432
|
-
},
|
|
433
|
-
set: function (value) {
|
|
434
|
-
value = ((value > 0) ? value : 0);
|
|
435
|
-
if (this._user_id !== value) {
|
|
436
|
-
this._user_id = value;
|
|
437
|
-
}
|
|
438
|
-
},
|
|
439
|
-
enumerable: false,
|
|
440
|
-
configurable: true
|
|
441
|
-
});
|
|
442
|
-
EsolveAccountService.prototype.processUserAddress = function (records) {
|
|
443
|
-
var e_1, _a;
|
|
444
|
-
var user_addesses = [];
|
|
445
|
-
if (records && (this._user_id > 0)) {
|
|
446
|
-
try {
|
|
447
|
-
for (var records_1 = __values(records), records_1_1 = records_1.next(); !records_1_1.done; records_1_1 = records_1.next()) {
|
|
448
|
-
var record = records_1_1.value;
|
|
449
|
-
if (+record.userid === this._user_id) {
|
|
450
|
-
user_addesses.push(new EsolveAddress(+record.id, record.recipient, record.address_type, record.pobox, record.place_name, record.street_number, record.street, record.suburb, record.city, record.province, record.country, record.postal_code, +record.latitude, +record.longitude));
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
455
|
-
finally {
|
|
456
|
-
try {
|
|
457
|
-
if (records_1_1 && !records_1_1.done && (_a = records_1.return)) _a.call(records_1);
|
|
458
|
-
}
|
|
459
|
-
finally { if (e_1) throw e_1.error; }
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
return user_addesses;
|
|
463
|
-
};
|
|
464
|
-
EsolveAccountService.prototype.getAddress = function () {
|
|
465
|
-
var _this = this;
|
|
466
|
-
var params = new i1.HttpParams();
|
|
467
|
-
params = params.set('ws_id', this.config.wsid);
|
|
468
|
-
params = params.set('user_id', this.user_id.toString());
|
|
469
|
-
return rxjs.iif(function () { return (_this.user_id > 0); }, this.http.get(this.config.api_url + "/service/get-addresses.php", { params: params }).pipe(operators.map(function (response) {
|
|
470
|
-
if (response.records === undefined) {
|
|
471
|
-
throw response;
|
|
472
|
-
}
|
|
473
|
-
return _this.processUserAddress(response.records);
|
|
474
|
-
}), operators.catchError(function (err) {
|
|
475
|
-
return rxjs.throwError(err);
|
|
476
|
-
})), rxjs.throwError('Log in is required'));
|
|
477
|
-
};
|
|
478
|
-
return EsolveAccountService;
|
|
479
|
-
}());
|
|
480
|
-
EsolveAccountService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAccountService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
481
|
-
EsolveAccountService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAccountService, providedIn: 'root' });
|
|
482
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAccountService, decorators: [{
|
|
483
|
-
type: i0.Injectable,
|
|
484
|
-
args: [{
|
|
485
|
-
providedIn: 'root'
|
|
486
|
-
}]
|
|
487
|
-
}], ctorParameters: function () {
|
|
488
|
-
return [{ type: undefined, decorators: [{
|
|
489
|
-
type: i0.Inject,
|
|
490
|
-
args: [ESOLVE_CONNECT_CONFIG]
|
|
491
|
-
}] }, { type: i1__namespace.HttpClient }];
|
|
492
|
-
} });
|
|
493
|
-
|
|
494
|
-
var EsolveSessionService = /** @class */ (function () {
|
|
495
|
-
function EsolveSessionService(config, account) {
|
|
496
|
-
this.config = config;
|
|
497
|
-
this.storage_key = 'ngEslvUserSession';
|
|
498
|
-
this.setStorageKey();
|
|
499
|
-
this._session = new rxjs.BehaviorSubject(new EsolveSession(0, ''));
|
|
500
|
-
this.session = this._session.asObservable();
|
|
501
|
-
this._session.subscribe(function (session) {
|
|
502
|
-
if (session.key !== '') {
|
|
503
|
-
account.user_id = session.id;
|
|
504
|
-
}
|
|
505
|
-
});
|
|
506
|
-
}
|
|
507
|
-
Object.defineProperty(EsolveSessionService.prototype, "currentSession", {
|
|
508
|
-
get: function () {
|
|
509
|
-
return this._session.value;
|
|
510
|
-
},
|
|
511
|
-
enumerable: false,
|
|
512
|
-
configurable: true
|
|
513
|
-
});
|
|
514
|
-
EsolveSessionService.prototype.setStorageKey = function () {
|
|
515
|
-
if ((typeof this.config.user_session_storage_key === 'string') &&
|
|
516
|
-
(this.config.user_session_storage_key !== '')) {
|
|
517
|
-
this.storage_key = this.config.user_session_storage_key;
|
|
518
|
-
}
|
|
519
|
-
};
|
|
520
|
-
EsolveSessionService.prototype.startTimer = function (callback, duration) {
|
|
521
|
-
this.key_expiration_timer = setTimeout(callback, duration);
|
|
522
|
-
};
|
|
523
|
-
EsolveSessionService.prototype.clearTimer = function () {
|
|
524
|
-
if (this.key_expiration_timer) {
|
|
525
|
-
clearTimeout(this.key_expiration_timer);
|
|
526
|
-
}
|
|
527
|
-
};
|
|
528
|
-
EsolveSessionService.prototype.restore = function (expirationCallback, invalidSessionCallback) {
|
|
529
|
-
if (!this.currentSession.valid) {
|
|
530
|
-
var stored_session_json = localStorage.getItem(this.storage_key);
|
|
531
|
-
var stored_session = (stored_session_json ? JSON.parse(stored_session_json) : null);
|
|
532
|
-
if (!stored_session) {
|
|
533
|
-
invalidSessionCallback();
|
|
534
|
-
return;
|
|
535
|
-
}
|
|
536
|
-
var expiration_date = new Date(stored_session._key_expiration_date);
|
|
537
|
-
var loaded_session = new EsolveSession(stored_session.id, stored_session._key, expiration_date);
|
|
538
|
-
if (!loaded_session.expired) {
|
|
539
|
-
this._session.next(loaded_session);
|
|
540
|
-
var expiration_duration = expiration_date.getTime() - new Date().getTime();
|
|
541
|
-
this.startTimer(expirationCallback, expiration_duration);
|
|
542
|
-
}
|
|
543
|
-
else {
|
|
544
|
-
expirationCallback(loaded_session);
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
};
|
|
548
|
-
EsolveSessionService.prototype.handleSession = function (user_id, key, expiry_time, expires, expirationCallback) {
|
|
549
|
-
var expiration_date = new Date(expiry_time * 1000);
|
|
550
|
-
var session = new EsolveSession(user_id, key, expiration_date);
|
|
551
|
-
localStorage.setItem(this.storage_key, JSON.stringify(session));
|
|
552
|
-
this._session.next(session);
|
|
553
|
-
this.startTimer(expirationCallback, expires * 1000);
|
|
554
|
-
};
|
|
555
|
-
EsolveSessionService.prototype.handleUpdateSession = function (user_id, callback) {
|
|
556
|
-
var current_session = this.currentSession;
|
|
557
|
-
current_session.updateUser(user_id);
|
|
558
|
-
localStorage.setItem(this.storage_key, JSON.stringify(current_session));
|
|
559
|
-
this._session.next(current_session);
|
|
560
|
-
if (typeof callback === 'function') {
|
|
561
|
-
callback();
|
|
562
|
-
}
|
|
563
|
-
};
|
|
564
|
-
return EsolveSessionService;
|
|
565
|
-
}());
|
|
566
|
-
EsolveSessionService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveSessionService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: EsolveAccountService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
567
|
-
EsolveSessionService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveSessionService, providedIn: 'root' });
|
|
568
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveSessionService, decorators: [{
|
|
569
|
-
type: i0.Injectable,
|
|
570
|
-
args: [{
|
|
571
|
-
providedIn: 'root'
|
|
572
|
-
}]
|
|
573
|
-
}], ctorParameters: function () {
|
|
574
|
-
return [{ type: undefined, decorators: [{
|
|
575
|
-
type: i0.Inject,
|
|
576
|
-
args: [ESOLVE_CONNECT_CONFIG]
|
|
577
|
-
}] }, { type: EsolveAccountService }];
|
|
578
|
-
} });
|
|
579
|
-
|
|
580
|
-
var EsolveAuthInterceptorService = /** @class */ (function () {
|
|
581
|
-
function EsolveAuthInterceptorService(config, session) {
|
|
582
|
-
this.config = config;
|
|
583
|
-
this.session = session;
|
|
584
|
-
}
|
|
585
|
-
EsolveAuthInterceptorService.prototype.intercept = function (req, next) {
|
|
586
|
-
if (req.url.startsWith(this.config.api_url + "/service/")) {
|
|
587
|
-
var service_identifier = req.url.replace(this.config.api_url + "/service/", '');
|
|
588
|
-
var old_parms_keys = req.params.keys();
|
|
589
|
-
var modified_url = req.url;
|
|
590
|
-
var params_1 = new i1.HttpParams();
|
|
591
|
-
var session = this.session.currentSession;
|
|
592
|
-
if (session.valid) {
|
|
593
|
-
if (service_identifier !== 'get-access-token.php') {
|
|
594
|
-
params_1 = params_1.set('key', session.key);
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
old_parms_keys.forEach(function (key) {
|
|
598
|
-
params_1 = params_1.set(key, req.params.get(key) || '');
|
|
599
|
-
});
|
|
600
|
-
var modified_req = req.clone({
|
|
601
|
-
url: modified_url,
|
|
602
|
-
params: params_1
|
|
603
|
-
});
|
|
604
|
-
return next.handle(modified_req);
|
|
605
|
-
}
|
|
606
|
-
return next.handle(req);
|
|
607
|
-
};
|
|
608
|
-
return EsolveAuthInterceptorService;
|
|
609
|
-
}());
|
|
610
|
-
EsolveAuthInterceptorService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAuthInterceptorService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: EsolveSessionService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
611
|
-
EsolveAuthInterceptorService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAuthInterceptorService });
|
|
612
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAuthInterceptorService, decorators: [{
|
|
613
|
-
type: i0.Injectable
|
|
614
|
-
}], ctorParameters: function () {
|
|
615
|
-
return [{ type: undefined, decorators: [{
|
|
616
|
-
type: i0.Inject,
|
|
617
|
-
args: [ESOLVE_CONNECT_CONFIG]
|
|
618
|
-
}] }, { type: EsolveSessionService }];
|
|
619
|
-
} });
|
|
620
|
-
|
|
621
|
-
var NgEsolveConnectModule = /** @class */ (function () {
|
|
622
|
-
function NgEsolveConnectModule() {
|
|
574
|
+
function resume(n, v) { try {
|
|
575
|
+
step(g[n](v));
|
|
623
576
|
}
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: NgEsolveConnectModule, decorators: [{
|
|
650
|
-
type: i0.NgModule,
|
|
651
|
-
args: [{
|
|
652
|
-
declarations: [],
|
|
653
|
-
imports: [
|
|
654
|
-
common.CommonModule,
|
|
655
|
-
i1.HttpClientModule
|
|
656
|
-
],
|
|
657
|
-
exports: []
|
|
658
|
-
}]
|
|
659
|
-
}] });
|
|
660
|
-
|
|
661
|
-
/**
|
|
662
|
-
* Search Engine Optimization information.
|
|
663
|
-
*/
|
|
664
|
-
var EsolveSEOInfo = /** @class */ (function () {
|
|
665
|
-
function EsolveSEOInfo(title, description, keywords) {
|
|
666
|
-
if (title === void 0) { title = ''; }
|
|
667
|
-
if (description === void 0) { description = ''; }
|
|
668
|
-
if (keywords === void 0) { keywords = ''; }
|
|
669
|
-
this.title = title;
|
|
670
|
-
this.description = description;
|
|
671
|
-
this.keywords = keywords;
|
|
577
|
+
catch (e) {
|
|
578
|
+
settle(q[0][3], e);
|
|
579
|
+
} }
|
|
580
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
581
|
+
function fulfill(value) { resume("next", value); }
|
|
582
|
+
function reject(value) { resume("throw", value); }
|
|
583
|
+
function settle(f, v) { if (f(v), q.shift(), q.length)
|
|
584
|
+
resume(q[0][0], q[0][1]); }
|
|
585
|
+
}
|
|
586
|
+
function __asyncDelegator(o) {
|
|
587
|
+
var i, p;
|
|
588
|
+
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
589
|
+
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; }
|
|
590
|
+
}
|
|
591
|
+
function __asyncValues(o) {
|
|
592
|
+
if (!Symbol.asyncIterator)
|
|
593
|
+
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
594
|
+
var m = o[Symbol.asyncIterator], i;
|
|
595
|
+
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);
|
|
596
|
+
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); }); }; }
|
|
597
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
598
|
+
}
|
|
599
|
+
function __makeTemplateObject(cooked, raw) {
|
|
600
|
+
if (Object.defineProperty) {
|
|
601
|
+
Object.defineProperty(cooked, "raw", { value: raw });
|
|
672
602
|
}
|
|
673
|
-
|
|
674
|
-
|
|
603
|
+
else {
|
|
604
|
+
cooked.raw = raw;
|
|
605
|
+
}
|
|
606
|
+
return cooked;
|
|
607
|
+
}
|
|
608
|
+
;
|
|
609
|
+
var __setModuleDefault = Object.create ? (function (o, v) {
|
|
610
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
611
|
+
}) : function (o, v) {
|
|
612
|
+
o["default"] = v;
|
|
613
|
+
};
|
|
614
|
+
function __importStar(mod) {
|
|
615
|
+
if (mod && mod.__esModule)
|
|
616
|
+
return mod;
|
|
617
|
+
var result = {};
|
|
618
|
+
if (mod != null)
|
|
619
|
+
for (var k in mod)
|
|
620
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
621
|
+
__createBinding(result, mod, k);
|
|
622
|
+
__setModuleDefault(result, mod);
|
|
623
|
+
return result;
|
|
624
|
+
}
|
|
625
|
+
function __importDefault(mod) {
|
|
626
|
+
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
627
|
+
}
|
|
628
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
629
|
+
if (kind === "a" && !f)
|
|
630
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
631
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
632
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
633
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
634
|
+
}
|
|
635
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
636
|
+
if (kind === "m")
|
|
637
|
+
throw new TypeError("Private method is not writable");
|
|
638
|
+
if (kind === "a" && !f)
|
|
639
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
640
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
641
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
642
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
643
|
+
}
|
|
675
644
|
|
|
676
645
|
var EsolveSeoService = /** @class */ (function () {
|
|
677
646
|
function EsolveSeoService(config, title, meta) {
|
|
@@ -782,7 +751,7 @@
|
|
|
782
751
|
};
|
|
783
752
|
return EsolveSeoService;
|
|
784
753
|
}());
|
|
785
|
-
EsolveSeoService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveSeoService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace
|
|
754
|
+
EsolveSeoService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveSeoService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace.Title }, { token: i1__namespace.Meta }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
786
755
|
EsolveSeoService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveSeoService, providedIn: 'root' });
|
|
787
756
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveSeoService, decorators: [{
|
|
788
757
|
type: i0.Injectable,
|
|
@@ -793,14 +762,35 @@
|
|
|
793
762
|
return [{ type: undefined, decorators: [{
|
|
794
763
|
type: i0.Inject,
|
|
795
764
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
796
|
-
}] }, { type: i1__namespace
|
|
765
|
+
}] }, { type: i1__namespace.Title }, { type: i1__namespace.Meta }];
|
|
797
766
|
} });
|
|
798
767
|
|
|
768
|
+
var EsolveAddress = /** @class */ (function () {
|
|
769
|
+
function EsolveAddress(id, recipient, address_type, pobox, place_name, street_number, street, suburb, city, province, country, postal_code, latitude, longitude) {
|
|
770
|
+
this.id = id;
|
|
771
|
+
this.recipient = recipient;
|
|
772
|
+
this.address_type = address_type;
|
|
773
|
+
this.pobox = pobox;
|
|
774
|
+
this.place_name = place_name;
|
|
775
|
+
this.street_number = street_number;
|
|
776
|
+
this.street = street;
|
|
777
|
+
this.suburb = suburb;
|
|
778
|
+
this.city = city;
|
|
779
|
+
this.province = province;
|
|
780
|
+
this.country = country;
|
|
781
|
+
this.postal_code = postal_code;
|
|
782
|
+
this.latitude = latitude;
|
|
783
|
+
this.longitude = longitude;
|
|
784
|
+
}
|
|
785
|
+
return EsolveAddress;
|
|
786
|
+
}());
|
|
787
|
+
|
|
799
788
|
var EsolveAuthService = /** @class */ (function () {
|
|
800
|
-
function EsolveAuthService(config, http, session) {
|
|
789
|
+
function EsolveAuthService(config, http, session, errorHandler) {
|
|
801
790
|
this.config = config;
|
|
802
791
|
this.http = http;
|
|
803
792
|
this.session = session;
|
|
793
|
+
this.errorHandler = errorHandler;
|
|
804
794
|
}
|
|
805
795
|
EsolveAuthService.prototype.checkAccessToken = function (session) {
|
|
806
796
|
var _a;
|
|
@@ -818,7 +808,9 @@
|
|
|
818
808
|
'Accept-Language': '*'
|
|
819
809
|
})
|
|
820
810
|
}).pipe(operators.map(function (responseData) {
|
|
821
|
-
if ((responseData.type === 'error') ||
|
|
811
|
+
if ((responseData.type === 'error') ||
|
|
812
|
+
(responseData.type === 'exception') ||
|
|
813
|
+
(!responseData.additional_data.key_okay)) {
|
|
822
814
|
throw responseData;
|
|
823
815
|
}
|
|
824
816
|
responseData.additional_data.key = token;
|
|
@@ -845,7 +837,8 @@
|
|
|
845
837
|
'Accept-Language': '*'
|
|
846
838
|
})
|
|
847
839
|
}).pipe(operators.tap(function (responseData) {
|
|
848
|
-
if ((responseData.type === 'error') ||
|
|
840
|
+
if ((responseData.type === 'error') ||
|
|
841
|
+
(responseData.type === 'exception')) {
|
|
849
842
|
throw responseData;
|
|
850
843
|
}
|
|
851
844
|
}), operators.catchError(this.handleError), operators.tap(function (responseData) {
|
|
@@ -879,11 +872,13 @@
|
|
|
879
872
|
observe: 'body'
|
|
880
873
|
}).pipe(operators.map(function (response) {
|
|
881
874
|
var e_1, _b;
|
|
882
|
-
if ((response.responses === undefined) ||
|
|
875
|
+
if ((response.responses === undefined) ||
|
|
876
|
+
(response.responses.length <= 0)) {
|
|
883
877
|
throw response;
|
|
884
878
|
}
|
|
885
879
|
var login_response = response.responses[0];
|
|
886
|
-
if ((login_response.status.state !== 'success') &&
|
|
880
|
+
if ((login_response.status.state !== 'success') &&
|
|
881
|
+
(login_response.status.state !== 'warning')) {
|
|
887
882
|
throw login_response;
|
|
888
883
|
}
|
|
889
884
|
try {
|
|
@@ -904,54 +899,7 @@
|
|
|
904
899
|
}
|
|
905
900
|
throw login_response;
|
|
906
901
|
}), operators.catchError(function (errorRes) {
|
|
907
|
-
|
|
908
|
-
var exception_type = exception.additional_data.exception_type;
|
|
909
|
-
var error = {
|
|
910
|
-
type: 'exception',
|
|
911
|
-
message: exception.message || '',
|
|
912
|
-
error_code: exception_type || 'unknown'
|
|
913
|
-
};
|
|
914
|
-
return error;
|
|
915
|
-
};
|
|
916
|
-
var parseLoginErrors = function (login_response) {
|
|
917
|
-
var error = {
|
|
918
|
-
type: 'error',
|
|
919
|
-
message: 'Unknown error has occured',
|
|
920
|
-
error_code: 'unknown'
|
|
921
|
-
};
|
|
922
|
-
if ((login_response.status.state === 'none') && (login_response.log.length > 0)) {
|
|
923
|
-
error.error_code = 'no_response';
|
|
924
|
-
error.message = 'Response was provided';
|
|
925
|
-
}
|
|
926
|
-
else if (login_response.status.state === 'error') {
|
|
927
|
-
var login_error_log = login_response.log[0];
|
|
928
|
-
error.error_code = login_error_log.message_code;
|
|
929
|
-
error.message = login_error_log.message;
|
|
930
|
-
}
|
|
931
|
-
return error;
|
|
932
|
-
};
|
|
933
|
-
if (errorRes instanceof i1.HttpErrorResponse) {
|
|
934
|
-
if (errorRes.status === 500) {
|
|
935
|
-
var server_error = errorRes.error;
|
|
936
|
-
if ((server_error.service_type === 'set-login') ||
|
|
937
|
-
(server_error.type !== undefined) ||
|
|
938
|
-
(server_error.message !== undefined) ||
|
|
939
|
-
(server_error.additional_data !== undefined)) {
|
|
940
|
-
return rxjs.throwError(parseException(server_error));
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
else {
|
|
945
|
-
if (errorRes.type !== undefined) {
|
|
946
|
-
if (errorRes.type === 'exception') {
|
|
947
|
-
return rxjs.throwError(parseException(errorRes));
|
|
948
|
-
}
|
|
949
|
-
}
|
|
950
|
-
else if (errorRes.transaction_type === 'Login') {
|
|
951
|
-
return rxjs.throwError(parseLoginErrors(errorRes));
|
|
952
|
-
}
|
|
953
|
-
}
|
|
954
|
-
return rxjs.throwError(errorRes);
|
|
902
|
+
return _this.errorHandler.handleHttpError('set-login', errorRes);
|
|
955
903
|
}));
|
|
956
904
|
};
|
|
957
905
|
EsolveAuthService.prototype.logout = function () {
|
|
@@ -960,6 +908,7 @@
|
|
|
960
908
|
console.log(error);
|
|
961
909
|
});
|
|
962
910
|
};
|
|
911
|
+
// Handlers
|
|
963
912
|
EsolveAuthService.prototype.handleExpiration = function () {
|
|
964
913
|
var _this = this;
|
|
965
914
|
return function (session) {
|
|
@@ -980,7 +929,9 @@
|
|
|
980
929
|
message: 'An unknown error occurred',
|
|
981
930
|
data: {}
|
|
982
931
|
};
|
|
983
|
-
if ((!errorRes.type) ||
|
|
932
|
+
if ((!errorRes.type) ||
|
|
933
|
+
(!errorRes.service_type) ||
|
|
934
|
+
(!errorRes.message)) {
|
|
984
935
|
return rxjs.throwError(error);
|
|
985
936
|
}
|
|
986
937
|
if (errorRes.message.trim() !== '') {
|
|
@@ -993,7 +944,7 @@
|
|
|
993
944
|
};
|
|
994
945
|
return EsolveAuthService;
|
|
995
946
|
}());
|
|
996
|
-
EsolveAuthService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAuthService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace.HttpClient }, { token: EsolveSessionService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
947
|
+
EsolveAuthService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAuthService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace$1.HttpClient }, { token: EsolveSessionService }, { token: EsolveErrorHandlerService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
997
948
|
EsolveAuthService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAuthService, providedIn: 'root' });
|
|
998
949
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAuthService, decorators: [{
|
|
999
950
|
type: i0.Injectable,
|
|
@@ -1004,7 +955,132 @@
|
|
|
1004
955
|
return [{ type: undefined, decorators: [{
|
|
1005
956
|
type: i0.Inject,
|
|
1006
957
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
1007
|
-
}] }, { type: i1__namespace.HttpClient }, { type: EsolveSessionService }];
|
|
958
|
+
}] }, { type: i1__namespace$1.HttpClient }, { type: EsolveSessionService }, { type: EsolveErrorHandlerService }];
|
|
959
|
+
} });
|
|
960
|
+
|
|
961
|
+
var EsolveAccountService = /** @class */ (function () {
|
|
962
|
+
function EsolveAccountService(config, http, sessionService, errorHandler) {
|
|
963
|
+
var _this = this;
|
|
964
|
+
this.config = config;
|
|
965
|
+
this.http = http;
|
|
966
|
+
this.sessionService = sessionService;
|
|
967
|
+
this.errorHandler = errorHandler;
|
|
968
|
+
this._user_id = 0;
|
|
969
|
+
this.sessionService.session.subscribe(function (session) {
|
|
970
|
+
if (session.key !== '') {
|
|
971
|
+
_this.user_id = session.id;
|
|
972
|
+
}
|
|
973
|
+
});
|
|
974
|
+
}
|
|
975
|
+
Object.defineProperty(EsolveAccountService.prototype, "user_id", {
|
|
976
|
+
get: function () {
|
|
977
|
+
return this._user_id;
|
|
978
|
+
},
|
|
979
|
+
set: function (value) {
|
|
980
|
+
value = ((value > 0) ? value : 0);
|
|
981
|
+
if (this._user_id !== value) {
|
|
982
|
+
this._user_id = value;
|
|
983
|
+
}
|
|
984
|
+
},
|
|
985
|
+
enumerable: false,
|
|
986
|
+
configurable: true
|
|
987
|
+
});
|
|
988
|
+
EsolveAccountService.prototype.processUserAddress = function (records) {
|
|
989
|
+
var e_1, _a;
|
|
990
|
+
var user_addresses = [];
|
|
991
|
+
if (records && (this._user_id > 0)) {
|
|
992
|
+
try {
|
|
993
|
+
for (var records_1 = __values(records), records_1_1 = records_1.next(); !records_1_1.done; records_1_1 = records_1.next()) {
|
|
994
|
+
var record = records_1_1.value;
|
|
995
|
+
if (+record.userid === this._user_id) {
|
|
996
|
+
user_addresses.push(new EsolveAddress(+record.id, record.recipient, record.address_type, record.pobox, record.place_name, record.street_number, record.street, record.suburb, record.city, record.province, record.country, record.postal_code, +record.latitude, +record.longitude));
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1001
|
+
finally {
|
|
1002
|
+
try {
|
|
1003
|
+
if (records_1_1 && !records_1_1.done && (_a = records_1.return)) _a.call(records_1);
|
|
1004
|
+
}
|
|
1005
|
+
finally { if (e_1) throw e_1.error; }
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
return user_addresses;
|
|
1009
|
+
};
|
|
1010
|
+
EsolveAccountService.prototype.getAddress = function () {
|
|
1011
|
+
var _this = this;
|
|
1012
|
+
var params = new i1.HttpParams();
|
|
1013
|
+
params = params.set('ws_id', this.config.wsid);
|
|
1014
|
+
params = params.set('user_id', this.user_id.toString());
|
|
1015
|
+
return rxjs.iif(function () { return (_this.user_id > 0); }, this.http.get(this.config.api_url + "/service/get-addresses.php", { params: params }).pipe(operators.map(function (response) {
|
|
1016
|
+
if (response.records === undefined) {
|
|
1017
|
+
throw response;
|
|
1018
|
+
}
|
|
1019
|
+
return _this.processUserAddress(response.records);
|
|
1020
|
+
}), operators.catchError(function (err) {
|
|
1021
|
+
return rxjs.throwError(err);
|
|
1022
|
+
})), rxjs.throwError('Log in is required'));
|
|
1023
|
+
};
|
|
1024
|
+
EsolveAccountService.prototype.registration = function (user_registration) {
|
|
1025
|
+
var _this = this;
|
|
1026
|
+
var body = {
|
|
1027
|
+
user: user_registration
|
|
1028
|
+
};
|
|
1029
|
+
return this.http.post(this.config.api_url + "/service/set-registration.php", body, {
|
|
1030
|
+
headers: {
|
|
1031
|
+
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
|
|
1032
|
+
},
|
|
1033
|
+
params: {
|
|
1034
|
+
ws_id: this.config.wsid
|
|
1035
|
+
},
|
|
1036
|
+
responseType: 'json',
|
|
1037
|
+
observe: 'body'
|
|
1038
|
+
}).pipe(operators.map(function (response) {
|
|
1039
|
+
var e_2, _a;
|
|
1040
|
+
if ((response.responses === undefined) ||
|
|
1041
|
+
(response.responses.length <= 0)) {
|
|
1042
|
+
throw response;
|
|
1043
|
+
}
|
|
1044
|
+
var registration_response = response.responses[0];
|
|
1045
|
+
if ((registration_response.status.state !== 'success') &&
|
|
1046
|
+
(registration_response.status.state !== 'warning')) {
|
|
1047
|
+
throw registration_response;
|
|
1048
|
+
}
|
|
1049
|
+
try {
|
|
1050
|
+
for (var _b = __values(registration_response.log), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1051
|
+
var response_log = _c.value;
|
|
1052
|
+
if ((response_log.type === 'success') && (response_log.message_code === 'registration_success')) {
|
|
1053
|
+
_this.sessionService.handleUpdateSession(registration_response.esolve_id);
|
|
1054
|
+
return registration_response.esolve_id;
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1059
|
+
finally {
|
|
1060
|
+
try {
|
|
1061
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1062
|
+
}
|
|
1063
|
+
finally { if (e_2) throw e_2.error; }
|
|
1064
|
+
}
|
|
1065
|
+
throw registration_response;
|
|
1066
|
+
}), operators.catchError(function (errorRes) {
|
|
1067
|
+
return _this.errorHandler.handleHttpError('set-registration', errorRes);
|
|
1068
|
+
}));
|
|
1069
|
+
};
|
|
1070
|
+
return EsolveAccountService;
|
|
1071
|
+
}());
|
|
1072
|
+
EsolveAccountService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAccountService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace$1.HttpClient }, { token: EsolveSessionService }, { token: EsolveErrorHandlerService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1073
|
+
EsolveAccountService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAccountService, providedIn: 'root' });
|
|
1074
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAccountService, decorators: [{
|
|
1075
|
+
type: i0.Injectable,
|
|
1076
|
+
args: [{
|
|
1077
|
+
providedIn: 'root'
|
|
1078
|
+
}]
|
|
1079
|
+
}], ctorParameters: function () {
|
|
1080
|
+
return [{ type: undefined, decorators: [{
|
|
1081
|
+
type: i0.Inject,
|
|
1082
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
1083
|
+
}] }, { type: i1__namespace$1.HttpClient }, { type: EsolveSessionService }, { type: EsolveErrorHandlerService }];
|
|
1008
1084
|
} });
|
|
1009
1085
|
|
|
1010
1086
|
var EsolveMediaArticle = /** @class */ (function () {
|
|
@@ -1157,7 +1233,7 @@
|
|
|
1157
1233
|
};
|
|
1158
1234
|
return EsolveMediaService;
|
|
1159
1235
|
}());
|
|
1160
|
-
EsolveMediaService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveMediaService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1236
|
+
EsolveMediaService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveMediaService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace$1.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1161
1237
|
EsolveMediaService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveMediaService, providedIn: 'root' });
|
|
1162
1238
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveMediaService, decorators: [{
|
|
1163
1239
|
type: i0.Injectable,
|
|
@@ -1168,7 +1244,7 @@
|
|
|
1168
1244
|
return [{ type: undefined, decorators: [{
|
|
1169
1245
|
type: i0.Inject,
|
|
1170
1246
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
1171
|
-
}] }, { type: i1__namespace.HttpClient }];
|
|
1247
|
+
}] }, { type: i1__namespace$1.HttpClient }];
|
|
1172
1248
|
} });
|
|
1173
1249
|
|
|
1174
1250
|
var EsolveNewsArticle = /** @class */ (function () {
|
|
@@ -1310,7 +1386,7 @@
|
|
|
1310
1386
|
};
|
|
1311
1387
|
return EsolveNewsService;
|
|
1312
1388
|
}());
|
|
1313
|
-
EsolveNewsService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveNewsService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1389
|
+
EsolveNewsService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveNewsService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace$1.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1314
1390
|
EsolveNewsService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveNewsService, providedIn: 'root' });
|
|
1315
1391
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveNewsService, decorators: [{
|
|
1316
1392
|
type: i0.Injectable,
|
|
@@ -1321,7 +1397,7 @@
|
|
|
1321
1397
|
return [{ type: undefined, decorators: [{
|
|
1322
1398
|
type: i0.Inject,
|
|
1323
1399
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
1324
|
-
}] }, { type: i1__namespace.HttpClient }];
|
|
1400
|
+
}] }, { type: i1__namespace$1.HttpClient }];
|
|
1325
1401
|
} });
|
|
1326
1402
|
|
|
1327
1403
|
var EsolveBanner = /** @class */ (function () {
|
|
@@ -1498,7 +1574,7 @@
|
|
|
1498
1574
|
};
|
|
1499
1575
|
return EsolveBannerService;
|
|
1500
1576
|
}());
|
|
1501
|
-
EsolveBannerService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveBannerService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1577
|
+
EsolveBannerService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveBannerService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace$1.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1502
1578
|
EsolveBannerService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveBannerService, providedIn: 'root' });
|
|
1503
1579
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveBannerService, decorators: [{
|
|
1504
1580
|
type: i0.Injectable,
|
|
@@ -1509,7 +1585,7 @@
|
|
|
1509
1585
|
return [{ type: undefined, decorators: [{
|
|
1510
1586
|
type: i0.Inject,
|
|
1511
1587
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
1512
|
-
}] }, { type: i1__namespace.HttpClient }];
|
|
1588
|
+
}] }, { type: i1__namespace$1.HttpClient }];
|
|
1513
1589
|
} });
|
|
1514
1590
|
|
|
1515
1591
|
var EsolveMenuItem = /** @class */ (function () {
|
|
@@ -1565,7 +1641,7 @@
|
|
|
1565
1641
|
};
|
|
1566
1642
|
return EsolveMenuService;
|
|
1567
1643
|
}());
|
|
1568
|
-
EsolveMenuService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveMenuService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1644
|
+
EsolveMenuService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveMenuService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace$1.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1569
1645
|
EsolveMenuService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveMenuService, providedIn: 'root' });
|
|
1570
1646
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveMenuService, decorators: [{
|
|
1571
1647
|
type: i0.Injectable,
|
|
@@ -1576,7 +1652,7 @@
|
|
|
1576
1652
|
return [{ type: undefined, decorators: [{
|
|
1577
1653
|
type: i0.Inject,
|
|
1578
1654
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
1579
|
-
}] }, { type: i1__namespace.HttpClient }];
|
|
1655
|
+
}] }, { type: i1__namespace$1.HttpClient }];
|
|
1580
1656
|
} });
|
|
1581
1657
|
|
|
1582
1658
|
var EsolveTopicService = /** @class */ (function () {
|
|
@@ -1631,7 +1707,7 @@
|
|
|
1631
1707
|
};
|
|
1632
1708
|
return EsolveTopicService;
|
|
1633
1709
|
}());
|
|
1634
|
-
EsolveTopicService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveTopicService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1710
|
+
EsolveTopicService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveTopicService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace$1.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1635
1711
|
EsolveTopicService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveTopicService, providedIn: 'root' });
|
|
1636
1712
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveTopicService, decorators: [{
|
|
1637
1713
|
type: i0.Injectable,
|
|
@@ -1642,7 +1718,7 @@
|
|
|
1642
1718
|
return [{ type: undefined, decorators: [{
|
|
1643
1719
|
type: i0.Inject,
|
|
1644
1720
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
1645
|
-
}] }, { type: i1__namespace.HttpClient }];
|
|
1721
|
+
}] }, { type: i1__namespace$1.HttpClient }];
|
|
1646
1722
|
} });
|
|
1647
1723
|
|
|
1648
1724
|
var EsolveStockBadge = /** @class */ (function () {
|
|
@@ -2022,7 +2098,7 @@
|
|
|
2022
2098
|
};
|
|
2023
2099
|
return EsolveStockService;
|
|
2024
2100
|
}());
|
|
2025
|
-
EsolveStockService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveStockService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
2101
|
+
EsolveStockService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveStockService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace$1.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
2026
2102
|
EsolveStockService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveStockService, providedIn: 'root' });
|
|
2027
2103
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveStockService, decorators: [{
|
|
2028
2104
|
type: i0.Injectable,
|
|
@@ -2033,7 +2109,7 @@
|
|
|
2033
2109
|
return [{ type: undefined, decorators: [{
|
|
2034
2110
|
type: i0.Inject,
|
|
2035
2111
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
2036
|
-
}] }, { type: i1__namespace.HttpClient }];
|
|
2112
|
+
}] }, { type: i1__namespace$1.HttpClient }];
|
|
2037
2113
|
} });
|
|
2038
2114
|
|
|
2039
2115
|
var EsolveCategoryTreeItem = /** @class */ (function () {
|
|
@@ -2216,7 +2292,7 @@
|
|
|
2216
2292
|
};
|
|
2217
2293
|
return EsolveCategoryTreeService;
|
|
2218
2294
|
}());
|
|
2219
|
-
EsolveCategoryTreeService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveCategoryTreeService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
2295
|
+
EsolveCategoryTreeService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveCategoryTreeService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace$1.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
2220
2296
|
EsolveCategoryTreeService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveCategoryTreeService, providedIn: 'root' });
|
|
2221
2297
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveCategoryTreeService, decorators: [{
|
|
2222
2298
|
type: i0.Injectable,
|
|
@@ -2227,7 +2303,7 @@
|
|
|
2227
2303
|
return [{ type: undefined, decorators: [{
|
|
2228
2304
|
type: i0.Inject,
|
|
2229
2305
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
2230
|
-
}] }, { type: i1__namespace.HttpClient }];
|
|
2306
|
+
}] }, { type: i1__namespace$1.HttpClient }];
|
|
2231
2307
|
} });
|
|
2232
2308
|
|
|
2233
2309
|
var EsolveStockLocation = /** @class */ (function () {
|
|
@@ -2563,9 +2639,10 @@
|
|
|
2563
2639
|
}());
|
|
2564
2640
|
|
|
2565
2641
|
var EsolveCartService = /** @class */ (function () {
|
|
2566
|
-
function EsolveCartService(config, http) {
|
|
2642
|
+
function EsolveCartService(config, http, errorHandler) {
|
|
2567
2643
|
this.config = config;
|
|
2568
2644
|
this.http = http;
|
|
2645
|
+
this.errorHandler = errorHandler;
|
|
2569
2646
|
this._cached_tracking = 0;
|
|
2570
2647
|
}
|
|
2571
2648
|
/**
|
|
@@ -2911,60 +2988,13 @@
|
|
|
2911
2988
|
}
|
|
2912
2989
|
return checkout_result.esolve_id;
|
|
2913
2990
|
}), operators.catchError(function (errorRes) {
|
|
2914
|
-
|
|
2915
|
-
var exception_type = exception.additional_data.exception_type;
|
|
2916
|
-
var error = {
|
|
2917
|
-
type: 'exception',
|
|
2918
|
-
message: exception.message || '',
|
|
2919
|
-
error_code: exception_type || 'unknown'
|
|
2920
|
-
};
|
|
2921
|
-
return error;
|
|
2922
|
-
};
|
|
2923
|
-
var parseCheckoutErrors = function (response) {
|
|
2924
|
-
var error = {
|
|
2925
|
-
type: 'error',
|
|
2926
|
-
message: 'Unknown error has occured',
|
|
2927
|
-
error_code: 'unknown'
|
|
2928
|
-
};
|
|
2929
|
-
if ((response.status.state === 'none') || (response.log.length === 0)) {
|
|
2930
|
-
error.error_code = 'no_response';
|
|
2931
|
-
error.message = 'Response was provided';
|
|
2932
|
-
}
|
|
2933
|
-
else if (response.status.state === 'error') {
|
|
2934
|
-
var error_log = response.log[0];
|
|
2935
|
-
error.error_code = error_log.message_code;
|
|
2936
|
-
error.message = error_log.message;
|
|
2937
|
-
}
|
|
2938
|
-
return error;
|
|
2939
|
-
};
|
|
2940
|
-
if (errorRes instanceof i1.HttpErrorResponse) {
|
|
2941
|
-
if (errorRes.status === 500) {
|
|
2942
|
-
var server_error = errorRes.error;
|
|
2943
|
-
if ((server_error.service_type === 'set-checkout') ||
|
|
2944
|
-
(server_error.type !== undefined) ||
|
|
2945
|
-
(server_error.message !== undefined) ||
|
|
2946
|
-
(server_error.additional_data !== undefined)) {
|
|
2947
|
-
return rxjs.throwError(parseException(server_error));
|
|
2948
|
-
}
|
|
2949
|
-
}
|
|
2950
|
-
}
|
|
2951
|
-
else {
|
|
2952
|
-
if (errorRes.type !== undefined) {
|
|
2953
|
-
if (errorRes.type === 'exception') {
|
|
2954
|
-
return rxjs.throwError(parseException(errorRes));
|
|
2955
|
-
}
|
|
2956
|
-
}
|
|
2957
|
-
else if (errorRes.transaction_type !== undefined) {
|
|
2958
|
-
return rxjs.throwError(parseCheckoutErrors(errorRes));
|
|
2959
|
-
}
|
|
2960
|
-
}
|
|
2961
|
-
return rxjs.throwError(errorRes);
|
|
2991
|
+
return _this.errorHandler.handleHttpError('set-checkout', errorRes);
|
|
2962
2992
|
}));
|
|
2963
2993
|
}));
|
|
2964
2994
|
};
|
|
2965
2995
|
return EsolveCartService;
|
|
2966
2996
|
}());
|
|
2967
|
-
EsolveCartService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveCartService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
2997
|
+
EsolveCartService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveCartService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace$1.HttpClient }, { token: EsolveErrorHandlerService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
2968
2998
|
EsolveCartService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveCartService, providedIn: 'root' });
|
|
2969
2999
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveCartService, decorators: [{
|
|
2970
3000
|
type: i0.Injectable,
|
|
@@ -2975,7 +3005,7 @@
|
|
|
2975
3005
|
return [{ type: undefined, decorators: [{
|
|
2976
3006
|
type: i0.Inject,
|
|
2977
3007
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
2978
|
-
}] }, { type: i1__namespace.HttpClient }];
|
|
3008
|
+
}] }, { type: i1__namespace$1.HttpClient }, { type: EsolveErrorHandlerService }];
|
|
2979
3009
|
} });
|
|
2980
3010
|
|
|
2981
3011
|
/*
|
|
@@ -2999,6 +3029,8 @@
|
|
|
2999
3029
|
exports.EsolveCartTotals = EsolveCartTotals;
|
|
3000
3030
|
exports.EsolveCategoryTreeItem = EsolveCategoryTreeItem;
|
|
3001
3031
|
exports.EsolveCategoryTreeService = EsolveCategoryTreeService;
|
|
3032
|
+
exports.EsolveErrorHandlerService = EsolveErrorHandlerService;
|
|
3033
|
+
exports.EsolveHttpError = EsolveHttpError;
|
|
3002
3034
|
exports.EsolveMediaArticle = EsolveMediaArticle;
|
|
3003
3035
|
exports.EsolveMediaService = EsolveMediaService;
|
|
3004
3036
|
exports.EsolveMenuItem = EsolveMenuItem;
|