@esolve/ng-esolve-connect 0.5.0 → 0.6.2
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 +528 -465
- package/bundles/esolve-ng-esolve-connect.umd.js.map +1 -1
- package/esm2015/lib/auth/esolve-account.service.js +55 -7
- package/esm2015/lib/auth/esolve-auth-interceptor.service.js +3 -3
- 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-registration-post-response-item.js +2 -0
- package/esm2015/lib/auth/esolve-registration-result.js +9 -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 -1
- 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/lib/stock/esolve-stock-item.js +13 -3
- package/esm2015/lib/stock/esolve-stock-record.js +1 -1
- package/esm2015/lib/stock/esolve-stock.service.js +2 -2
- package/esm2015/public-api.js +6 -1
- package/fesm2015/esolve-ng-esolve-connect.js +257 -214
- package/fesm2015/esolve-ng-esolve-connect.js.map +1 -1
- package/lib/auth/esolve-account.service.d.ts +8 -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-registration-post-response-item.d.ts +6 -0
- package/lib/auth/esolve-registration-result.d.ts +7 -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/shared/error-handler/esolve-error-handler.service.d.ts +11 -0
- package/lib/shared/error-handler/esolve-http-error.d.ts +6 -0
- package/lib/stock/esolve-stock-item.d.ts +17 -1
- package/lib/stock/esolve-stock-record.d.ts +7 -1
- package/package.json +1 -1
- package/public-api.d.ts +5 -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,10 +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
|
-
var ESOLVE_CONNECT_CONFIG = new i0.InjectionToken('esolve.connect.config');
|
|
31
|
+
var ESOLVE_CONNECT_CONFIG = new i0.InjectionToken('esolve.connect.config');
|
|
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
|
+
// };
|
|
32
39
|
|
|
33
40
|
var EsolveSession = /** @class */ (function () {
|
|
34
41
|
function EsolveSession(id, _key, _key_expiration_date) {
|
|
@@ -76,6 +83,247 @@
|
|
|
76
83
|
return EsolveSession;
|
|
77
84
|
}());
|
|
78
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_params_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_params_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
|
+
|
|
79
327
|
/*! *****************************************************************************
|
|
80
328
|
Copyright (c) Microsoft Corporation.
|
|
81
329
|
|
|
@@ -332,340 +580,67 @@
|
|
|
332
580
|
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
333
581
|
function fulfill(value) { resume("next", value); }
|
|
334
582
|
function reject(value) { resume("throw", value); }
|
|
335
|
-
function settle(f, v) { if (f(v), q.shift(), q.length)
|
|
336
|
-
resume(q[0][0], q[0][1]); }
|
|
337
|
-
}
|
|
338
|
-
function __asyncDelegator(o) {
|
|
339
|
-
var i, p;
|
|
340
|
-
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
341
|
-
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; }
|
|
342
|
-
}
|
|
343
|
-
function __asyncValues(o) {
|
|
344
|
-
if (!Symbol.asyncIterator)
|
|
345
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
346
|
-
var m = o[Symbol.asyncIterator], i;
|
|
347
|
-
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);
|
|
348
|
-
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); }); }; }
|
|
349
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
350
|
-
}
|
|
351
|
-
function __makeTemplateObject(cooked, raw) {
|
|
352
|
-
if (Object.defineProperty) {
|
|
353
|
-
Object.defineProperty(cooked, "raw", { value: raw });
|
|
354
|
-
}
|
|
355
|
-
else {
|
|
356
|
-
cooked.raw = raw;
|
|
357
|
-
}
|
|
358
|
-
return cooked;
|
|
359
|
-
}
|
|
360
|
-
;
|
|
361
|
-
var __setModuleDefault = Object.create ? (function (o, v) {
|
|
362
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
363
|
-
}) : function (o, v) {
|
|
364
|
-
o["default"] = v;
|
|
365
|
-
};
|
|
366
|
-
function __importStar(mod) {
|
|
367
|
-
if (mod && mod.__esModule)
|
|
368
|
-
return mod;
|
|
369
|
-
var result = {};
|
|
370
|
-
if (mod != null)
|
|
371
|
-
for (var k in mod)
|
|
372
|
-
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
373
|
-
__createBinding(result, mod, k);
|
|
374
|
-
__setModuleDefault(result, mod);
|
|
375
|
-
return result;
|
|
376
|
-
}
|
|
377
|
-
function __importDefault(mod) {
|
|
378
|
-
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
379
|
-
}
|
|
380
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
381
|
-
if (kind === "a" && !f)
|
|
382
|
-
throw new TypeError("Private accessor was defined without a getter");
|
|
383
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
384
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
385
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
386
|
-
}
|
|
387
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
388
|
-
if (kind === "m")
|
|
389
|
-
throw new TypeError("Private method is not writable");
|
|
390
|
-
if (kind === "a" && !f)
|
|
391
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
392
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
393
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
394
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
var EsolveAddress = /** @class */ (function () {
|
|
398
|
-
function EsolveAddress(id, recipient, address_type, pobox, place_name, street_number, street, suburb, city, province, country, postal_code, latitude, longitude) {
|
|
399
|
-
this.id = id;
|
|
400
|
-
this.recipient = recipient;
|
|
401
|
-
this.address_type = address_type;
|
|
402
|
-
this.pobox = pobox;
|
|
403
|
-
this.place_name = place_name;
|
|
404
|
-
this.street_number = street_number;
|
|
405
|
-
this.street = street;
|
|
406
|
-
this.suburb = suburb;
|
|
407
|
-
this.city = city;
|
|
408
|
-
this.province = province;
|
|
409
|
-
this.country = country;
|
|
410
|
-
this.postal_code = postal_code;
|
|
411
|
-
this.latitude = latitude;
|
|
412
|
-
this.longitude = longitude;
|
|
413
|
-
}
|
|
414
|
-
return EsolveAddress;
|
|
415
|
-
}());
|
|
416
|
-
|
|
417
|
-
var EsolveAccountService = /** @class */ (function () {
|
|
418
|
-
function EsolveAccountService(config, http) {
|
|
419
|
-
this.config = config;
|
|
420
|
-
this.http = http;
|
|
421
|
-
this._user_id = 0;
|
|
422
|
-
}
|
|
423
|
-
Object.defineProperty(EsolveAccountService.prototype, "user_id", {
|
|
424
|
-
get: function () {
|
|
425
|
-
return this._user_id;
|
|
426
|
-
},
|
|
427
|
-
set: function (value) {
|
|
428
|
-
value = ((value > 0) ? value : 0);
|
|
429
|
-
if (this._user_id !== value) {
|
|
430
|
-
this._user_id = value;
|
|
431
|
-
}
|
|
432
|
-
},
|
|
433
|
-
enumerable: false,
|
|
434
|
-
configurable: true
|
|
435
|
-
});
|
|
436
|
-
EsolveAccountService.prototype.processUserAddress = function (records) {
|
|
437
|
-
var e_1, _a;
|
|
438
|
-
var user_addesses = [];
|
|
439
|
-
if (records && (this._user_id > 0)) {
|
|
440
|
-
try {
|
|
441
|
-
for (var records_1 = __values(records), records_1_1 = records_1.next(); !records_1_1.done; records_1_1 = records_1.next()) {
|
|
442
|
-
var record = records_1_1.value;
|
|
443
|
-
if (+record.userid === this._user_id) {
|
|
444
|
-
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));
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
449
|
-
finally {
|
|
450
|
-
try {
|
|
451
|
-
if (records_1_1 && !records_1_1.done && (_a = records_1.return)) _a.call(records_1);
|
|
452
|
-
}
|
|
453
|
-
finally { if (e_1) throw e_1.error; }
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
return user_addesses;
|
|
457
|
-
};
|
|
458
|
-
EsolveAccountService.prototype.getAddress = function () {
|
|
459
|
-
var _this = this;
|
|
460
|
-
var params = new i1.HttpParams();
|
|
461
|
-
params = params.set('ws_id', this.config.wsid);
|
|
462
|
-
params = params.set('user_id', this.user_id.toString());
|
|
463
|
-
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) {
|
|
464
|
-
if (response.records === undefined) {
|
|
465
|
-
throw response;
|
|
466
|
-
}
|
|
467
|
-
return _this.processUserAddress(response.records);
|
|
468
|
-
}), operators.catchError(function (err) {
|
|
469
|
-
return rxjs.throwError(err);
|
|
470
|
-
})), rxjs.throwError('Log in is required'));
|
|
471
|
-
};
|
|
472
|
-
return EsolveAccountService;
|
|
473
|
-
}());
|
|
474
|
-
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 });
|
|
475
|
-
EsolveAccountService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAccountService, providedIn: 'root' });
|
|
476
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAccountService, decorators: [{
|
|
477
|
-
type: i0.Injectable,
|
|
478
|
-
args: [{
|
|
479
|
-
providedIn: 'root'
|
|
480
|
-
}]
|
|
481
|
-
}], ctorParameters: function () {
|
|
482
|
-
return [{ type: undefined, decorators: [{
|
|
483
|
-
type: i0.Inject,
|
|
484
|
-
args: [ESOLVE_CONNECT_CONFIG]
|
|
485
|
-
}] }, { type: i1__namespace.HttpClient }];
|
|
486
|
-
} });
|
|
487
|
-
|
|
488
|
-
var EsolveSessionService = /** @class */ (function () {
|
|
489
|
-
function EsolveSessionService(config, account) {
|
|
490
|
-
this.config = config;
|
|
491
|
-
this.storage_key = 'ngEslvUserSession';
|
|
492
|
-
this.setStorageKey();
|
|
493
|
-
this._session = new rxjs.BehaviorSubject(new EsolveSession(0, ''));
|
|
494
|
-
this.session = this._session.asObservable();
|
|
495
|
-
this._session.subscribe(function (session) {
|
|
496
|
-
if (session.key !== '') {
|
|
497
|
-
account.user_id = session.id;
|
|
498
|
-
}
|
|
499
|
-
});
|
|
500
|
-
}
|
|
501
|
-
Object.defineProperty(EsolveSessionService.prototype, "currentSession", {
|
|
502
|
-
get: function () {
|
|
503
|
-
return this._session.value;
|
|
504
|
-
},
|
|
505
|
-
enumerable: false,
|
|
506
|
-
configurable: true
|
|
507
|
-
});
|
|
508
|
-
EsolveSessionService.prototype.setStorageKey = function () {
|
|
509
|
-
if ((typeof this.config.user_session_storage_key === 'string') &&
|
|
510
|
-
(this.config.user_session_storage_key !== '')) {
|
|
511
|
-
this.storage_key = this.config.user_session_storage_key;
|
|
512
|
-
}
|
|
513
|
-
};
|
|
514
|
-
EsolveSessionService.prototype.startTimer = function (callback, duration) {
|
|
515
|
-
this.key_expiration_timer = setTimeout(callback, duration);
|
|
516
|
-
};
|
|
517
|
-
EsolveSessionService.prototype.clearTimer = function () {
|
|
518
|
-
if (this.key_expiration_timer) {
|
|
519
|
-
clearTimeout(this.key_expiration_timer);
|
|
520
|
-
}
|
|
521
|
-
};
|
|
522
|
-
EsolveSessionService.prototype.restore = function (expirationCallback, invalidSessionCallback) {
|
|
523
|
-
if (!this.currentSession.valid) {
|
|
524
|
-
var stored_session_json = localStorage.getItem(this.storage_key);
|
|
525
|
-
var stored_session = (stored_session_json ? JSON.parse(stored_session_json) : null);
|
|
526
|
-
if (!stored_session) {
|
|
527
|
-
invalidSessionCallback();
|
|
528
|
-
return;
|
|
529
|
-
}
|
|
530
|
-
var expiration_date = new Date(stored_session._key_expiration_date);
|
|
531
|
-
var loaded_session = new EsolveSession(stored_session.id, stored_session._key, expiration_date);
|
|
532
|
-
if (!loaded_session.expired) {
|
|
533
|
-
this._session.next(loaded_session);
|
|
534
|
-
var expiration_duration = expiration_date.getTime() - new Date().getTime();
|
|
535
|
-
this.startTimer(expirationCallback, expiration_duration);
|
|
536
|
-
}
|
|
537
|
-
else {
|
|
538
|
-
expirationCallback(loaded_session);
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
};
|
|
542
|
-
EsolveSessionService.prototype.handleSession = function (user_id, key, expiry_time, expires, expirationCallback) {
|
|
543
|
-
var expiration_date = new Date(expiry_time * 1000);
|
|
544
|
-
var session = new EsolveSession(user_id, key, expiration_date);
|
|
545
|
-
localStorage.setItem(this.storage_key, JSON.stringify(session));
|
|
546
|
-
this._session.next(session);
|
|
547
|
-
this.startTimer(expirationCallback, expires * 1000);
|
|
548
|
-
};
|
|
549
|
-
EsolveSessionService.prototype.handleUpdateSession = function (user_id, callback) {
|
|
550
|
-
var current_session = this.currentSession;
|
|
551
|
-
current_session.updateUser(user_id);
|
|
552
|
-
localStorage.setItem(this.storage_key, JSON.stringify(current_session));
|
|
553
|
-
this._session.next(current_session);
|
|
554
|
-
if (typeof callback === 'function') {
|
|
555
|
-
callback();
|
|
556
|
-
}
|
|
557
|
-
};
|
|
558
|
-
return EsolveSessionService;
|
|
559
|
-
}());
|
|
560
|
-
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 });
|
|
561
|
-
EsolveSessionService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveSessionService, providedIn: 'root' });
|
|
562
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveSessionService, decorators: [{
|
|
563
|
-
type: i0.Injectable,
|
|
564
|
-
args: [{
|
|
565
|
-
providedIn: 'root'
|
|
566
|
-
}]
|
|
567
|
-
}], ctorParameters: function () {
|
|
568
|
-
return [{ type: undefined, decorators: [{
|
|
569
|
-
type: i0.Inject,
|
|
570
|
-
args: [ESOLVE_CONNECT_CONFIG]
|
|
571
|
-
}] }, { type: EsolveAccountService }];
|
|
572
|
-
} });
|
|
573
|
-
|
|
574
|
-
var EsolveAuthInterceptorService = /** @class */ (function () {
|
|
575
|
-
function EsolveAuthInterceptorService(config, session) {
|
|
576
|
-
this.config = config;
|
|
577
|
-
this.session = session;
|
|
578
|
-
}
|
|
579
|
-
EsolveAuthInterceptorService.prototype.intercept = function (req, next) {
|
|
580
|
-
if (req.url.startsWith(this.config.api_url + "/service/")) {
|
|
581
|
-
var service_identifier = req.url.replace(this.config.api_url + "/service/", '');
|
|
582
|
-
var old_parms_keys = req.params.keys();
|
|
583
|
-
var modified_url = req.url;
|
|
584
|
-
var params_1 = new i1.HttpParams();
|
|
585
|
-
var session = this.session.currentSession;
|
|
586
|
-
if (session.valid) {
|
|
587
|
-
if (service_identifier !== 'get-access-token.php') {
|
|
588
|
-
params_1 = params_1.set('key', session.key);
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
old_parms_keys.forEach(function (key) {
|
|
592
|
-
params_1 = params_1.set(key, req.params.get(key) || '');
|
|
593
|
-
});
|
|
594
|
-
var modified_req = req.clone({
|
|
595
|
-
url: modified_url,
|
|
596
|
-
params: params_1
|
|
597
|
-
});
|
|
598
|
-
return next.handle(modified_req);
|
|
599
|
-
}
|
|
600
|
-
return next.handle(req);
|
|
601
|
-
};
|
|
602
|
-
return EsolveAuthInterceptorService;
|
|
603
|
-
}());
|
|
604
|
-
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 });
|
|
605
|
-
EsolveAuthInterceptorService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAuthInterceptorService });
|
|
606
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAuthInterceptorService, decorators: [{
|
|
607
|
-
type: i0.Injectable
|
|
608
|
-
}], ctorParameters: function () {
|
|
609
|
-
return [{ type: undefined, decorators: [{
|
|
610
|
-
type: i0.Inject,
|
|
611
|
-
args: [ESOLVE_CONNECT_CONFIG]
|
|
612
|
-
}] }, { type: EsolveSessionService }];
|
|
613
|
-
} });
|
|
614
|
-
|
|
615
|
-
var NgEsolveConnectModule = /** @class */ (function () {
|
|
616
|
-
function NgEsolveConnectModule() {
|
|
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 });
|
|
617
602
|
}
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
ngModule: NgEsolveConnectModule,
|
|
621
|
-
providers: [
|
|
622
|
-
{
|
|
623
|
-
provide: ESOLVE_CONNECT_CONFIG,
|
|
624
|
-
useValue: config
|
|
625
|
-
},
|
|
626
|
-
{
|
|
627
|
-
provide: i1.HTTP_INTERCEPTORS,
|
|
628
|
-
useClass: EsolveAuthInterceptorService,
|
|
629
|
-
multi: true
|
|
630
|
-
}
|
|
631
|
-
]
|
|
632
|
-
};
|
|
633
|
-
};
|
|
634
|
-
return NgEsolveConnectModule;
|
|
635
|
-
}());
|
|
636
|
-
NgEsolveConnectModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: NgEsolveConnectModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
637
|
-
NgEsolveConnectModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: NgEsolveConnectModule, imports: [common.CommonModule,
|
|
638
|
-
i1.HttpClientModule] });
|
|
639
|
-
NgEsolveConnectModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: NgEsolveConnectModule, imports: [[
|
|
640
|
-
common.CommonModule,
|
|
641
|
-
i1.HttpClientModule
|
|
642
|
-
]] });
|
|
643
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: NgEsolveConnectModule, decorators: [{
|
|
644
|
-
type: i0.NgModule,
|
|
645
|
-
args: [{
|
|
646
|
-
declarations: [],
|
|
647
|
-
imports: [
|
|
648
|
-
common.CommonModule,
|
|
649
|
-
i1.HttpClientModule
|
|
650
|
-
],
|
|
651
|
-
exports: []
|
|
652
|
-
}]
|
|
653
|
-
}] });
|
|
654
|
-
|
|
655
|
-
/**
|
|
656
|
-
* Search Engine Optimization information.
|
|
657
|
-
*/
|
|
658
|
-
var EsolveSEOInfo = /** @class */ (function () {
|
|
659
|
-
function EsolveSEOInfo(title, description, keywords) {
|
|
660
|
-
if (title === void 0) { title = ''; }
|
|
661
|
-
if (description === void 0) { description = ''; }
|
|
662
|
-
if (keywords === void 0) { keywords = ''; }
|
|
663
|
-
this.title = title;
|
|
664
|
-
this.description = description;
|
|
665
|
-
this.keywords = keywords;
|
|
603
|
+
else {
|
|
604
|
+
cooked.raw = raw;
|
|
666
605
|
}
|
|
667
|
-
return
|
|
668
|
-
}
|
|
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
|
+
}
|
|
669
644
|
|
|
670
645
|
var EsolveSeoService = /** @class */ (function () {
|
|
671
646
|
function EsolveSeoService(config, title, meta) {
|
|
@@ -776,7 +751,7 @@
|
|
|
776
751
|
};
|
|
777
752
|
return EsolveSeoService;
|
|
778
753
|
}());
|
|
779
|
-
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 });
|
|
780
755
|
EsolveSeoService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveSeoService, providedIn: 'root' });
|
|
781
756
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveSeoService, decorators: [{
|
|
782
757
|
type: i0.Injectable,
|
|
@@ -787,14 +762,45 @@
|
|
|
787
762
|
return [{ type: undefined, decorators: [{
|
|
788
763
|
type: i0.Inject,
|
|
789
764
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
790
|
-
}] }, { type: i1__namespace
|
|
765
|
+
}] }, { type: i1__namespace.Title }, { type: i1__namespace.Meta }];
|
|
791
766
|
} });
|
|
792
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
|
+
|
|
788
|
+
var EsolveRegistrationResult = /** @class */ (function () {
|
|
789
|
+
function EsolveRegistrationResult(user_id, guest, authentication_required, auto_login) {
|
|
790
|
+
this.user_id = user_id;
|
|
791
|
+
this.guest = guest;
|
|
792
|
+
this.authentication_required = authentication_required;
|
|
793
|
+
this.auto_login = auto_login;
|
|
794
|
+
}
|
|
795
|
+
return EsolveRegistrationResult;
|
|
796
|
+
}());
|
|
797
|
+
|
|
793
798
|
var EsolveAuthService = /** @class */ (function () {
|
|
794
|
-
function EsolveAuthService(config, http, session) {
|
|
799
|
+
function EsolveAuthService(config, http, session, errorHandler) {
|
|
795
800
|
this.config = config;
|
|
796
801
|
this.http = http;
|
|
797
802
|
this.session = session;
|
|
803
|
+
this.errorHandler = errorHandler;
|
|
798
804
|
}
|
|
799
805
|
EsolveAuthService.prototype.checkAccessToken = function (session) {
|
|
800
806
|
var _a;
|
|
@@ -812,7 +818,9 @@
|
|
|
812
818
|
'Accept-Language': '*'
|
|
813
819
|
})
|
|
814
820
|
}).pipe(operators.map(function (responseData) {
|
|
815
|
-
if ((responseData.type === 'error') ||
|
|
821
|
+
if ((responseData.type === 'error') ||
|
|
822
|
+
(responseData.type === 'exception') ||
|
|
823
|
+
(!responseData.additional_data.key_okay)) {
|
|
816
824
|
throw responseData;
|
|
817
825
|
}
|
|
818
826
|
responseData.additional_data.key = token;
|
|
@@ -839,7 +847,8 @@
|
|
|
839
847
|
'Accept-Language': '*'
|
|
840
848
|
})
|
|
841
849
|
}).pipe(operators.tap(function (responseData) {
|
|
842
|
-
if ((responseData.type === 'error') ||
|
|
850
|
+
if ((responseData.type === 'error') ||
|
|
851
|
+
(responseData.type === 'exception')) {
|
|
843
852
|
throw responseData;
|
|
844
853
|
}
|
|
845
854
|
}), operators.catchError(this.handleError), operators.tap(function (responseData) {
|
|
@@ -873,11 +882,13 @@
|
|
|
873
882
|
observe: 'body'
|
|
874
883
|
}).pipe(operators.map(function (response) {
|
|
875
884
|
var e_1, _b;
|
|
876
|
-
if ((response.responses === undefined) ||
|
|
885
|
+
if ((response.responses === undefined) ||
|
|
886
|
+
(response.responses.length <= 0)) {
|
|
877
887
|
throw response;
|
|
878
888
|
}
|
|
879
889
|
var login_response = response.responses[0];
|
|
880
|
-
if ((login_response.status.state !== 'success') &&
|
|
890
|
+
if ((login_response.status.state !== 'success') &&
|
|
891
|
+
(login_response.status.state !== 'warning')) {
|
|
881
892
|
throw login_response;
|
|
882
893
|
}
|
|
883
894
|
try {
|
|
@@ -898,54 +909,7 @@
|
|
|
898
909
|
}
|
|
899
910
|
throw login_response;
|
|
900
911
|
}), operators.catchError(function (errorRes) {
|
|
901
|
-
|
|
902
|
-
var exception_type = exception.additional_data.exception_type;
|
|
903
|
-
var error = {
|
|
904
|
-
type: 'exception',
|
|
905
|
-
message: exception.message || '',
|
|
906
|
-
error_code: exception_type || 'unknown'
|
|
907
|
-
};
|
|
908
|
-
return error;
|
|
909
|
-
};
|
|
910
|
-
var parseLoginErrors = function (login_response) {
|
|
911
|
-
var error = {
|
|
912
|
-
type: 'error',
|
|
913
|
-
message: 'Unknown error has occured',
|
|
914
|
-
error_code: 'unknown'
|
|
915
|
-
};
|
|
916
|
-
if ((login_response.status.state === 'none') && (login_response.log.length > 0)) {
|
|
917
|
-
error.error_code = 'no_response';
|
|
918
|
-
error.message = 'Response was provided';
|
|
919
|
-
}
|
|
920
|
-
else if (login_response.status.state === 'error') {
|
|
921
|
-
var login_error_log = login_response.log[0];
|
|
922
|
-
error.error_code = login_error_log.message_code;
|
|
923
|
-
error.message = login_error_log.message;
|
|
924
|
-
}
|
|
925
|
-
return error;
|
|
926
|
-
};
|
|
927
|
-
if (errorRes instanceof i1.HttpErrorResponse) {
|
|
928
|
-
if (errorRes.status === 500) {
|
|
929
|
-
var server_error = errorRes.error;
|
|
930
|
-
if ((server_error.service_type === 'set-login') ||
|
|
931
|
-
(server_error.type !== undefined) ||
|
|
932
|
-
(server_error.message !== undefined) ||
|
|
933
|
-
(server_error.additional_data !== undefined)) {
|
|
934
|
-
return rxjs.throwError(parseException(server_error));
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
else {
|
|
939
|
-
if (errorRes.type !== undefined) {
|
|
940
|
-
if (errorRes.type === 'exception') {
|
|
941
|
-
return rxjs.throwError(parseException(errorRes));
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
else if (errorRes.transaction_type === 'Login') {
|
|
945
|
-
return rxjs.throwError(parseLoginErrors(errorRes));
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
return rxjs.throwError(errorRes);
|
|
912
|
+
return _this.errorHandler.handleHttpError('set-login', errorRes);
|
|
949
913
|
}));
|
|
950
914
|
};
|
|
951
915
|
EsolveAuthService.prototype.logout = function () {
|
|
@@ -954,6 +918,7 @@
|
|
|
954
918
|
console.log(error);
|
|
955
919
|
});
|
|
956
920
|
};
|
|
921
|
+
// Handlers
|
|
957
922
|
EsolveAuthService.prototype.handleExpiration = function () {
|
|
958
923
|
var _this = this;
|
|
959
924
|
return function (session) {
|
|
@@ -974,7 +939,9 @@
|
|
|
974
939
|
message: 'An unknown error occurred',
|
|
975
940
|
data: {}
|
|
976
941
|
};
|
|
977
|
-
if ((!errorRes.type) ||
|
|
942
|
+
if ((!errorRes.type) ||
|
|
943
|
+
(!errorRes.service_type) ||
|
|
944
|
+
(!errorRes.message)) {
|
|
978
945
|
return rxjs.throwError(error);
|
|
979
946
|
}
|
|
980
947
|
if (errorRes.message.trim() !== '') {
|
|
@@ -987,7 +954,7 @@
|
|
|
987
954
|
};
|
|
988
955
|
return EsolveAuthService;
|
|
989
956
|
}());
|
|
990
|
-
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 });
|
|
957
|
+
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 });
|
|
991
958
|
EsolveAuthService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAuthService, providedIn: 'root' });
|
|
992
959
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAuthService, decorators: [{
|
|
993
960
|
type: i0.Injectable,
|
|
@@ -998,7 +965,136 @@
|
|
|
998
965
|
return [{ type: undefined, decorators: [{
|
|
999
966
|
type: i0.Inject,
|
|
1000
967
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
1001
|
-
}] }, { type: i1__namespace.HttpClient }, { type: EsolveSessionService }];
|
|
968
|
+
}] }, { type: i1__namespace$1.HttpClient }, { type: EsolveSessionService }, { type: EsolveErrorHandlerService }];
|
|
969
|
+
} });
|
|
970
|
+
|
|
971
|
+
var EsolveAccountService = /** @class */ (function () {
|
|
972
|
+
function EsolveAccountService(config, http, sessionService, errorHandler) {
|
|
973
|
+
var _this = this;
|
|
974
|
+
this.config = config;
|
|
975
|
+
this.http = http;
|
|
976
|
+
this.sessionService = sessionService;
|
|
977
|
+
this.errorHandler = errorHandler;
|
|
978
|
+
this._user_id = 0;
|
|
979
|
+
this.sessionService.session.subscribe(function (session) {
|
|
980
|
+
if (session.key !== '') {
|
|
981
|
+
_this.user_id = session.id;
|
|
982
|
+
}
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
Object.defineProperty(EsolveAccountService.prototype, "user_id", {
|
|
986
|
+
get: function () {
|
|
987
|
+
return this._user_id;
|
|
988
|
+
},
|
|
989
|
+
set: function (value) {
|
|
990
|
+
value = ((value > 0) ? value : 0);
|
|
991
|
+
if (this._user_id !== value) {
|
|
992
|
+
this._user_id = value;
|
|
993
|
+
}
|
|
994
|
+
},
|
|
995
|
+
enumerable: false,
|
|
996
|
+
configurable: true
|
|
997
|
+
});
|
|
998
|
+
EsolveAccountService.prototype.processUserAddress = function (records) {
|
|
999
|
+
var e_1, _a;
|
|
1000
|
+
var user_addresses = [];
|
|
1001
|
+
if (records && (this._user_id > 0)) {
|
|
1002
|
+
try {
|
|
1003
|
+
for (var records_1 = __values(records), records_1_1 = records_1.next(); !records_1_1.done; records_1_1 = records_1.next()) {
|
|
1004
|
+
var record = records_1_1.value;
|
|
1005
|
+
if (+record.userid === this._user_id) {
|
|
1006
|
+
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));
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1011
|
+
finally {
|
|
1012
|
+
try {
|
|
1013
|
+
if (records_1_1 && !records_1_1.done && (_a = records_1.return)) _a.call(records_1);
|
|
1014
|
+
}
|
|
1015
|
+
finally { if (e_1) throw e_1.error; }
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
return user_addresses;
|
|
1019
|
+
};
|
|
1020
|
+
EsolveAccountService.prototype.getAddress = function () {
|
|
1021
|
+
var _this = this;
|
|
1022
|
+
var params = new i1.HttpParams();
|
|
1023
|
+
params = params.set('ws_id', this.config.wsid);
|
|
1024
|
+
params = params.set('user_id', this.user_id.toString());
|
|
1025
|
+
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) {
|
|
1026
|
+
if (response.records === undefined) {
|
|
1027
|
+
throw response;
|
|
1028
|
+
}
|
|
1029
|
+
return _this.processUserAddress(response.records);
|
|
1030
|
+
}), operators.catchError(function (err) {
|
|
1031
|
+
return rxjs.throwError(err);
|
|
1032
|
+
})), rxjs.throwError('Log in is required'));
|
|
1033
|
+
};
|
|
1034
|
+
EsolveAccountService.prototype.register = function (user_registration) {
|
|
1035
|
+
var _this = this;
|
|
1036
|
+
var body = {
|
|
1037
|
+
user: user_registration
|
|
1038
|
+
};
|
|
1039
|
+
return this.http.post(this.config.api_url + "/service/set-registration.php", body, {
|
|
1040
|
+
headers: {
|
|
1041
|
+
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
|
|
1042
|
+
},
|
|
1043
|
+
params: {
|
|
1044
|
+
ws_id: this.config.wsid
|
|
1045
|
+
},
|
|
1046
|
+
responseType: 'json',
|
|
1047
|
+
observe: 'body'
|
|
1048
|
+
}).pipe(operators.map(function (response) {
|
|
1049
|
+
var e_2, _a;
|
|
1050
|
+
if ((response.responses === undefined) ||
|
|
1051
|
+
(response.responses.length <= 0)) {
|
|
1052
|
+
throw response;
|
|
1053
|
+
}
|
|
1054
|
+
var registration_response = response.responses[0];
|
|
1055
|
+
if ((registration_response.status.state !== 'success') &&
|
|
1056
|
+
(registration_response.status.state !== 'warning')) {
|
|
1057
|
+
throw registration_response;
|
|
1058
|
+
}
|
|
1059
|
+
try {
|
|
1060
|
+
for (var _b = __values(registration_response.log), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1061
|
+
var response_log = _c.value;
|
|
1062
|
+
if ((response_log.type === 'success') && (response_log.message_code === 'registration_success')) {
|
|
1063
|
+
var user_id = 0;
|
|
1064
|
+
if (registration_response.auto_login) {
|
|
1065
|
+
user_id = registration_response.esolve_id;
|
|
1066
|
+
_this.sessionService.handleUpdateSession(user_id);
|
|
1067
|
+
}
|
|
1068
|
+
return new EsolveRegistrationResult(user_id, registration_response.guest, registration_response.authentication_required, registration_response.auto_login);
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1073
|
+
finally {
|
|
1074
|
+
try {
|
|
1075
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1076
|
+
}
|
|
1077
|
+
finally { if (e_2) throw e_2.error; }
|
|
1078
|
+
}
|
|
1079
|
+
throw registration_response;
|
|
1080
|
+
}), operators.catchError(function (errorRes) {
|
|
1081
|
+
return _this.errorHandler.handleHttpError('set-registration', errorRes);
|
|
1082
|
+
}));
|
|
1083
|
+
};
|
|
1084
|
+
return EsolveAccountService;
|
|
1085
|
+
}());
|
|
1086
|
+
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 });
|
|
1087
|
+
EsolveAccountService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAccountService, providedIn: 'root' });
|
|
1088
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAccountService, decorators: [{
|
|
1089
|
+
type: i0.Injectable,
|
|
1090
|
+
args: [{
|
|
1091
|
+
providedIn: 'root'
|
|
1092
|
+
}]
|
|
1093
|
+
}], ctorParameters: function () {
|
|
1094
|
+
return [{ type: undefined, decorators: [{
|
|
1095
|
+
type: i0.Inject,
|
|
1096
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
1097
|
+
}] }, { type: i1__namespace$1.HttpClient }, { type: EsolveSessionService }, { type: EsolveErrorHandlerService }];
|
|
1002
1098
|
} });
|
|
1003
1099
|
|
|
1004
1100
|
var EsolveMediaArticle = /** @class */ (function () {
|
|
@@ -1151,7 +1247,7 @@
|
|
|
1151
1247
|
};
|
|
1152
1248
|
return EsolveMediaService;
|
|
1153
1249
|
}());
|
|
1154
|
-
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 });
|
|
1250
|
+
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 });
|
|
1155
1251
|
EsolveMediaService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveMediaService, providedIn: 'root' });
|
|
1156
1252
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveMediaService, decorators: [{
|
|
1157
1253
|
type: i0.Injectable,
|
|
@@ -1162,7 +1258,7 @@
|
|
|
1162
1258
|
return [{ type: undefined, decorators: [{
|
|
1163
1259
|
type: i0.Inject,
|
|
1164
1260
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
1165
|
-
}] }, { type: i1__namespace.HttpClient }];
|
|
1261
|
+
}] }, { type: i1__namespace$1.HttpClient }];
|
|
1166
1262
|
} });
|
|
1167
1263
|
|
|
1168
1264
|
var EsolveNewsArticle = /** @class */ (function () {
|
|
@@ -1304,7 +1400,7 @@
|
|
|
1304
1400
|
};
|
|
1305
1401
|
return EsolveNewsService;
|
|
1306
1402
|
}());
|
|
1307
|
-
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 });
|
|
1403
|
+
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 });
|
|
1308
1404
|
EsolveNewsService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveNewsService, providedIn: 'root' });
|
|
1309
1405
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveNewsService, decorators: [{
|
|
1310
1406
|
type: i0.Injectable,
|
|
@@ -1315,7 +1411,7 @@
|
|
|
1315
1411
|
return [{ type: undefined, decorators: [{
|
|
1316
1412
|
type: i0.Inject,
|
|
1317
1413
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
1318
|
-
}] }, { type: i1__namespace.HttpClient }];
|
|
1414
|
+
}] }, { type: i1__namespace$1.HttpClient }];
|
|
1319
1415
|
} });
|
|
1320
1416
|
|
|
1321
1417
|
var EsolveBanner = /** @class */ (function () {
|
|
@@ -1492,7 +1588,7 @@
|
|
|
1492
1588
|
};
|
|
1493
1589
|
return EsolveBannerService;
|
|
1494
1590
|
}());
|
|
1495
|
-
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 });
|
|
1591
|
+
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 });
|
|
1496
1592
|
EsolveBannerService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveBannerService, providedIn: 'root' });
|
|
1497
1593
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveBannerService, decorators: [{
|
|
1498
1594
|
type: i0.Injectable,
|
|
@@ -1503,7 +1599,7 @@
|
|
|
1503
1599
|
return [{ type: undefined, decorators: [{
|
|
1504
1600
|
type: i0.Inject,
|
|
1505
1601
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
1506
|
-
}] }, { type: i1__namespace.HttpClient }];
|
|
1602
|
+
}] }, { type: i1__namespace$1.HttpClient }];
|
|
1507
1603
|
} });
|
|
1508
1604
|
|
|
1509
1605
|
var EsolveMenuItem = /** @class */ (function () {
|
|
@@ -1559,7 +1655,7 @@
|
|
|
1559
1655
|
};
|
|
1560
1656
|
return EsolveMenuService;
|
|
1561
1657
|
}());
|
|
1562
|
-
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 });
|
|
1658
|
+
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 });
|
|
1563
1659
|
EsolveMenuService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveMenuService, providedIn: 'root' });
|
|
1564
1660
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveMenuService, decorators: [{
|
|
1565
1661
|
type: i0.Injectable,
|
|
@@ -1570,7 +1666,7 @@
|
|
|
1570
1666
|
return [{ type: undefined, decorators: [{
|
|
1571
1667
|
type: i0.Inject,
|
|
1572
1668
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
1573
|
-
}] }, { type: i1__namespace.HttpClient }];
|
|
1669
|
+
}] }, { type: i1__namespace$1.HttpClient }];
|
|
1574
1670
|
} });
|
|
1575
1671
|
|
|
1576
1672
|
var EsolveTopicService = /** @class */ (function () {
|
|
@@ -1625,7 +1721,7 @@
|
|
|
1625
1721
|
};
|
|
1626
1722
|
return EsolveTopicService;
|
|
1627
1723
|
}());
|
|
1628
|
-
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 });
|
|
1724
|
+
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 });
|
|
1629
1725
|
EsolveTopicService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveTopicService, providedIn: 'root' });
|
|
1630
1726
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveTopicService, decorators: [{
|
|
1631
1727
|
type: i0.Injectable,
|
|
@@ -1636,7 +1732,7 @@
|
|
|
1636
1732
|
return [{ type: undefined, decorators: [{
|
|
1637
1733
|
type: i0.Inject,
|
|
1638
1734
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
1639
|
-
}] }, { type: i1__namespace.HttpClient }];
|
|
1735
|
+
}] }, { type: i1__namespace$1.HttpClient }];
|
|
1640
1736
|
} });
|
|
1641
1737
|
|
|
1642
1738
|
var EsolveStockBadge = /** @class */ (function () {
|
|
@@ -1764,7 +1860,15 @@
|
|
|
1764
1860
|
/**
|
|
1765
1861
|
* Stock badges
|
|
1766
1862
|
*/
|
|
1767
|
-
badges,
|
|
1863
|
+
badges,
|
|
1864
|
+
/**
|
|
1865
|
+
* ID of default category linked to the stock item
|
|
1866
|
+
*/
|
|
1867
|
+
category_id,
|
|
1868
|
+
/**
|
|
1869
|
+
* ID of default subcategory linked to the stock item
|
|
1870
|
+
*/
|
|
1871
|
+
subcategory_id, seo_title, seo_keywords) {
|
|
1768
1872
|
if (seo_title === void 0) { seo_title = ''; }
|
|
1769
1873
|
if (seo_keywords === void 0) { seo_keywords = ''; }
|
|
1770
1874
|
this.id = id;
|
|
@@ -1779,6 +1883,8 @@
|
|
|
1779
1883
|
this.tags = tags;
|
|
1780
1884
|
this.topics = topics;
|
|
1781
1885
|
this.badges = badges;
|
|
1886
|
+
this.category_id = category_id;
|
|
1887
|
+
this.subcategory_id = subcategory_id;
|
|
1782
1888
|
if (seo_title.trim() === '') {
|
|
1783
1889
|
seo_title = this.name;
|
|
1784
1890
|
}
|
|
@@ -1829,7 +1935,7 @@
|
|
|
1829
1935
|
* Path to original stock image
|
|
1830
1936
|
*/
|
|
1831
1937
|
get: function () {
|
|
1832
|
-
return 'images/' + (this.image_name ? 'stock/original/' + this.image_name : 'no_image.jpg');
|
|
1938
|
+
return '/images/' + (this.image_name ? 'stock/original/' + this.image_name : 'no_image.jpg');
|
|
1833
1939
|
},
|
|
1834
1940
|
enumerable: false,
|
|
1835
1941
|
configurable: true
|
|
@@ -1909,7 +2015,7 @@
|
|
|
1909
2015
|
}
|
|
1910
2016
|
}
|
|
1911
2017
|
var price = new EsolveStockPrice(record.regular_sellprice, record.regular_sellprice_inclusive, record.sellprice, record.sellprice_inclusive);
|
|
1912
|
-
return new EsolveStockItem(+record.id, record.code, record.name, record.sef_name, record.description, !!+record.is_active, !!+record.is_featured, record.image_name, price, tags, topics, badges, record.seo_page_title, record.seo_keywords);
|
|
2018
|
+
return new EsolveStockItem(+record.id, record.code, record.name, record.sef_name, record.description, !!+record.is_active, !!+record.is_featured, record.image_name, price, tags, topics, badges, record.category_id, +record.subcategory_id, record.seo_page_title, record.seo_keywords);
|
|
1913
2019
|
};
|
|
1914
2020
|
/**
|
|
1915
2021
|
* Retrieves stock records from HTTP params.
|
|
@@ -2006,7 +2112,7 @@
|
|
|
2006
2112
|
};
|
|
2007
2113
|
return EsolveStockService;
|
|
2008
2114
|
}());
|
|
2009
|
-
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 });
|
|
2115
|
+
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 });
|
|
2010
2116
|
EsolveStockService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveStockService, providedIn: 'root' });
|
|
2011
2117
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveStockService, decorators: [{
|
|
2012
2118
|
type: i0.Injectable,
|
|
@@ -2017,7 +2123,7 @@
|
|
|
2017
2123
|
return [{ type: undefined, decorators: [{
|
|
2018
2124
|
type: i0.Inject,
|
|
2019
2125
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
2020
|
-
}] }, { type: i1__namespace.HttpClient }];
|
|
2126
|
+
}] }, { type: i1__namespace$1.HttpClient }];
|
|
2021
2127
|
} });
|
|
2022
2128
|
|
|
2023
2129
|
var EsolveCategoryTreeItem = /** @class */ (function () {
|
|
@@ -2200,7 +2306,7 @@
|
|
|
2200
2306
|
};
|
|
2201
2307
|
return EsolveCategoryTreeService;
|
|
2202
2308
|
}());
|
|
2203
|
-
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 });
|
|
2309
|
+
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 });
|
|
2204
2310
|
EsolveCategoryTreeService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveCategoryTreeService, providedIn: 'root' });
|
|
2205
2311
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveCategoryTreeService, decorators: [{
|
|
2206
2312
|
type: i0.Injectable,
|
|
@@ -2211,7 +2317,7 @@
|
|
|
2211
2317
|
return [{ type: undefined, decorators: [{
|
|
2212
2318
|
type: i0.Inject,
|
|
2213
2319
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
2214
|
-
}] }, { type: i1__namespace.HttpClient }];
|
|
2320
|
+
}] }, { type: i1__namespace$1.HttpClient }];
|
|
2215
2321
|
} });
|
|
2216
2322
|
|
|
2217
2323
|
var EsolveStockLocation = /** @class */ (function () {
|
|
@@ -2547,9 +2653,10 @@
|
|
|
2547
2653
|
}());
|
|
2548
2654
|
|
|
2549
2655
|
var EsolveCartService = /** @class */ (function () {
|
|
2550
|
-
function EsolveCartService(config, http) {
|
|
2656
|
+
function EsolveCartService(config, http, errorHandler) {
|
|
2551
2657
|
this.config = config;
|
|
2552
2658
|
this.http = http;
|
|
2659
|
+
this.errorHandler = errorHandler;
|
|
2553
2660
|
this._cached_tracking = 0;
|
|
2554
2661
|
}
|
|
2555
2662
|
/**
|
|
@@ -2895,60 +3002,13 @@
|
|
|
2895
3002
|
}
|
|
2896
3003
|
return checkout_result.esolve_id;
|
|
2897
3004
|
}), operators.catchError(function (errorRes) {
|
|
2898
|
-
|
|
2899
|
-
var exception_type = exception.additional_data.exception_type;
|
|
2900
|
-
var error = {
|
|
2901
|
-
type: 'exception',
|
|
2902
|
-
message: exception.message || '',
|
|
2903
|
-
error_code: exception_type || 'unknown'
|
|
2904
|
-
};
|
|
2905
|
-
return error;
|
|
2906
|
-
};
|
|
2907
|
-
var parseCheckoutErrors = function (response) {
|
|
2908
|
-
var error = {
|
|
2909
|
-
type: 'error',
|
|
2910
|
-
message: 'Unknown error has occured',
|
|
2911
|
-
error_code: 'unknown'
|
|
2912
|
-
};
|
|
2913
|
-
if ((response.status.state === 'none') || (response.log.length === 0)) {
|
|
2914
|
-
error.error_code = 'no_response';
|
|
2915
|
-
error.message = 'Response was provided';
|
|
2916
|
-
}
|
|
2917
|
-
else if (response.status.state === 'error') {
|
|
2918
|
-
var error_log = response.log[0];
|
|
2919
|
-
error.error_code = error_log.message_code;
|
|
2920
|
-
error.message = error_log.message;
|
|
2921
|
-
}
|
|
2922
|
-
return error;
|
|
2923
|
-
};
|
|
2924
|
-
if (errorRes instanceof i1.HttpErrorResponse) {
|
|
2925
|
-
if (errorRes.status === 500) {
|
|
2926
|
-
var server_error = errorRes.error;
|
|
2927
|
-
if ((server_error.service_type === 'set-checkout') ||
|
|
2928
|
-
(server_error.type !== undefined) ||
|
|
2929
|
-
(server_error.message !== undefined) ||
|
|
2930
|
-
(server_error.additional_data !== undefined)) {
|
|
2931
|
-
return rxjs.throwError(parseException(server_error));
|
|
2932
|
-
}
|
|
2933
|
-
}
|
|
2934
|
-
}
|
|
2935
|
-
else {
|
|
2936
|
-
if (errorRes.type !== undefined) {
|
|
2937
|
-
if (errorRes.type === 'exception') {
|
|
2938
|
-
return rxjs.throwError(parseException(errorRes));
|
|
2939
|
-
}
|
|
2940
|
-
}
|
|
2941
|
-
else if (errorRes.transaction_type !== undefined) {
|
|
2942
|
-
return rxjs.throwError(parseCheckoutErrors(errorRes));
|
|
2943
|
-
}
|
|
2944
|
-
}
|
|
2945
|
-
return rxjs.throwError(errorRes);
|
|
3005
|
+
return _this.errorHandler.handleHttpError('set-checkout', errorRes);
|
|
2946
3006
|
}));
|
|
2947
3007
|
}));
|
|
2948
3008
|
};
|
|
2949
3009
|
return EsolveCartService;
|
|
2950
3010
|
}());
|
|
2951
|
-
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 });
|
|
3011
|
+
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 });
|
|
2952
3012
|
EsolveCartService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveCartService, providedIn: 'root' });
|
|
2953
3013
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveCartService, decorators: [{
|
|
2954
3014
|
type: i0.Injectable,
|
|
@@ -2959,7 +3019,7 @@
|
|
|
2959
3019
|
return [{ type: undefined, decorators: [{
|
|
2960
3020
|
type: i0.Inject,
|
|
2961
3021
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
2962
|
-
}] }, { type: i1__namespace.HttpClient }];
|
|
3022
|
+
}] }, { type: i1__namespace$1.HttpClient }, { type: EsolveErrorHandlerService }];
|
|
2963
3023
|
} });
|
|
2964
3024
|
|
|
2965
3025
|
/*
|
|
@@ -2983,6 +3043,8 @@
|
|
|
2983
3043
|
exports.EsolveCartTotals = EsolveCartTotals;
|
|
2984
3044
|
exports.EsolveCategoryTreeItem = EsolveCategoryTreeItem;
|
|
2985
3045
|
exports.EsolveCategoryTreeService = EsolveCategoryTreeService;
|
|
3046
|
+
exports.EsolveErrorHandlerService = EsolveErrorHandlerService;
|
|
3047
|
+
exports.EsolveHttpError = EsolveHttpError;
|
|
2986
3048
|
exports.EsolveMediaArticle = EsolveMediaArticle;
|
|
2987
3049
|
exports.EsolveMediaService = EsolveMediaService;
|
|
2988
3050
|
exports.EsolveMenuItem = EsolveMenuItem;
|
|
@@ -2993,6 +3055,7 @@
|
|
|
2993
3055
|
exports.EsolveNewsGroup = EsolveNewsGroup;
|
|
2994
3056
|
exports.EsolveNewsService = EsolveNewsService;
|
|
2995
3057
|
exports.EsolvePaymentMethod = EsolvePaymentMethod;
|
|
3058
|
+
exports.EsolveRegistrationResult = EsolveRegistrationResult;
|
|
2996
3059
|
exports.EsolveSEOInfo = EsolveSEOInfo;
|
|
2997
3060
|
exports.EsolveSeoService = EsolveSeoService;
|
|
2998
3061
|
exports.EsolveSession = EsolveSession;
|