@esolve/ng-esolve-connect 0.6.1 → 0.7.3
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/{esm2015/esolve-ng-esolve-connect.js → esm2020/esolve-ng-esolve-connect.mjs} +0 -0
- package/esm2020/lib/account/esolve-account.service.mjs +161 -0
- package/esm2020/lib/account/esolve-address-record.mjs +2 -0
- package/esm2020/lib/account/esolve-address-response.mjs +2 -0
- package/esm2020/lib/account/esolve-address-result.mjs +11 -0
- package/esm2020/lib/account/esolve-address-set-data.mjs +2 -0
- package/esm2020/lib/account/esolve-address.mjs +19 -0
- package/esm2020/lib/account/esolve-geocode-result.mjs +2 -0
- package/esm2020/lib/account/esolve-registration-data.mjs +2 -0
- package/esm2020/lib/account/esolve-registration-post-response-item.mjs +2 -0
- package/esm2020/lib/account/esolve-registration-result.mjs +11 -0
- package/esm2020/lib/account/esolve-user-account-data.mjs +2 -0
- package/esm2020/lib/account/esolve-user-account-record.mjs +2 -0
- package/esm2020/lib/account/esolve-user-account-result.mjs +9 -0
- package/esm2020/lib/account/esolve-user-account.mjs +29 -0
- package/{esm2015/lib/auth/esolve-auth-interceptor.service.js → esm2020/lib/auth/esolve-auth-interceptor.service.mjs} +7 -7
- package/esm2020/lib/auth/esolve-auth.service.mjs +163 -0
- package/{esm2015/lib/banners/esolve-banner-image-hotspot-record.js → esm2020/lib/banners/esolve-banner-image-hotspot-record.mjs} +0 -0
- package/{esm2015/lib/banners/esolve-banner-image-hotspot.js → esm2020/lib/banners/esolve-banner-image-hotspot.mjs} +0 -0
- package/{esm2015/lib/banners/esolve-banner-image-record.js → esm2020/lib/banners/esolve-banner-image-record.mjs} +0 -0
- package/{esm2015/lib/banners/esolve-banner-image.js → esm2020/lib/banners/esolve-banner-image.mjs} +0 -0
- package/{esm2015/lib/banners/esolve-banner-record.js → esm2020/lib/banners/esolve-banner-record.mjs} +0 -0
- package/{esm2015/lib/banners/esolve-banner-type.js → esm2020/lib/banners/esolve-banner-type.mjs} +0 -0
- package/{esm2015/lib/banners/esolve-banner.js → esm2020/lib/banners/esolve-banner.mjs} +0 -0
- package/{esm2015/lib/banners/esolve-banner.service.js → esm2020/lib/banners/esolve-banner.service.mjs} +3 -3
- package/{esm2015/lib/cart/esolve-cart-item-record.js → esm2020/lib/cart/esolve-cart-item-record.mjs} +0 -0
- package/{esm2015/lib/cart/esolve-cart-item-response.js → esm2020/lib/cart/esolve-cart-item-response.mjs} +0 -0
- package/{esm2015/lib/cart/esolve-cart-item.js → esm2020/lib/cart/esolve-cart-item.mjs} +0 -0
- package/{esm2015/lib/cart/esolve-cart-stock-item.js → esm2020/lib/cart/esolve-cart-stock-item.mjs} +0 -0
- package/{esm2015/lib/cart/esolve-cart-totals-record.js → esm2020/lib/cart/esolve-cart-totals-record.mjs} +0 -0
- package/{esm2015/lib/cart/esolve-cart-totals.js → esm2020/lib/cart/esolve-cart-totals.mjs} +0 -0
- package/esm2020/lib/cart/esolve-cart.service.mjs +172 -0
- package/esm2020/lib/cart/esolve-checkout-result.mjs +9 -0
- package/{esm2015/lib/cart/esolve-checkout.js → esm2020/lib/cart/esolve-checkout.mjs} +0 -0
- package/{esm2015/lib/category-tree/esolve-category-tree-item-record.js → esm2020/lib/category-tree/esolve-category-tree-item-record.mjs} +0 -0
- package/{esm2015/lib/category-tree/esolve-category-tree-item.js → esm2020/lib/category-tree/esolve-category-tree-item.mjs} +0 -0
- package/{esm2015/lib/category-tree/esolve-category-tree.service.js → esm2020/lib/category-tree/esolve-category-tree.service.mjs} +3 -3
- package/{esm2015/lib/esolve-connect.config.js → esm2020/lib/esolve-connect.config.mjs} +0 -0
- package/esm2020/lib/locations/esolve-locations.service.mjs +53 -0
- package/esm2020/lib/locations/esolve-stock-location-record.mjs +2 -0
- package/esm2020/lib/locations/esolve-stock-location.mjs +76 -0
- package/{esm2015/lib/media/esolve-media-article.js → esm2020/lib/media/esolve-media-article.mjs} +0 -0
- package/{esm2015/lib/media/esolve-media-record.js → esm2020/lib/media/esolve-media-record.mjs} +0 -0
- package/{esm2015/lib/media/esolve-media.service.js → esm2020/lib/media/esolve-media.service.mjs} +3 -3
- package/{esm2015/lib/menu/esolve-menu-item.js → esm2020/lib/menu/esolve-menu-item.mjs} +0 -0
- package/{esm2015/lib/menu/esolve-menu-tree-record.js → esm2020/lib/menu/esolve-menu-tree-record.mjs} +0 -0
- package/{esm2015/lib/menu/esolve-menu.service.js → esm2020/lib/menu/esolve-menu.service.mjs} +3 -3
- package/{esm2015/lib/news/esolve-news-article-author-record.js → esm2020/lib/news/esolve-news-article-author-record.mjs} +0 -0
- package/{esm2015/lib/news/esolve-news-article-author.js → esm2020/lib/news/esolve-news-article-author.mjs} +0 -0
- package/{esm2015/lib/news/esolve-news-article-list.js → esm2020/lib/news/esolve-news-article-list.mjs} +0 -0
- package/{esm2015/lib/news/esolve-news-article-record.js → esm2020/lib/news/esolve-news-article-record.mjs} +0 -0
- package/{esm2015/lib/news/esolve-news-article.js → esm2020/lib/news/esolve-news-article.mjs} +0 -0
- package/{esm2015/lib/news/esolve-news-group-record.js → esm2020/lib/news/esolve-news-group-record.mjs} +0 -0
- package/{esm2015/lib/news/esolve-news-group.js → esm2020/lib/news/esolve-news-group.mjs} +0 -0
- package/{esm2015/lib/news/esolve-news-manufacturer-record.js → esm2020/lib/news/esolve-news-manufacturer-record.mjs} +0 -0
- package/{esm2015/lib/news/esolve-news-range-record.js → esm2020/lib/news/esolve-news-range-record.mjs} +0 -0
- package/{esm2015/lib/news/esolve-news.service.js → esm2020/lib/news/esolve-news.service.mjs} +3 -3
- package/esm2020/lib/ng-esolve-connect.module.mjs +45 -0
- package/esm2020/lib/payment/esolve-card-data.mjs +2 -0
- package/esm2020/lib/payment/esolve-payment-method-options.mjs +2 -0
- package/esm2020/lib/payment/esolve-payment-method-record.mjs +2 -0
- package/esm2020/lib/payment/esolve-payment-method.mjs +49 -0
- package/esm2020/lib/payment/esolve-payment-response.mjs +2 -0
- package/esm2020/lib/payment/esolve-payment-result.mjs +22 -0
- package/esm2020/lib/payment/esolve-payment.service.mjs +178 -0
- package/esm2020/lib/payment/esolve-vault-item-result.mjs +20 -0
- package/esm2020/lib/payment/esolve-vault-item.mjs +19 -0
- package/esm2020/lib/payment/esolve-vault-record.mjs +2 -0
- package/esm2020/lib/payment/esolve-vault-response.mjs +2 -0
- package/esm2020/lib/session/esolve-session.mjs +27 -0
- package/esm2020/lib/session/esolve-session.service.mjs +79 -0
- package/esm2020/lib/session/esolve-stored-session.mjs +2 -0
- package/esm2020/lib/shared/error-handler/esolve-error-handler.service.mjs +58 -0
- package/{esm2015/lib/shared/error-handler/esolve-http-error.js → esm2020/lib/shared/error-handler/esolve-http-error.mjs} +0 -0
- package/{esm2015/lib/shared/esolve-response.js → esm2020/lib/shared/esolve-response.mjs} +1 -1
- package/{esm2015/lib/shared/esolve-url-target.js → esm2020/lib/shared/esolve-url-target.mjs} +0 -0
- package/esm2020/lib/shared/response-handler/esolve-response-handler.service.mjs +32 -0
- package/esm2020/lib/shared/response-handler/esolve-response-result.mjs +9 -0
- package/{esm2015/lib/shared/seo/esolve-seo-info.js → esm2020/lib/shared/seo/esolve-seo-info.mjs} +0 -0
- package/{esm2015/lib/shared/seo/esolve-seo.service.js → esm2020/lib/shared/seo/esolve-seo.service.mjs} +3 -3
- package/esm2020/lib/shipping/esolve-shipping-cost-record.mjs +2 -0
- package/esm2020/lib/shipping/esolve-shipping-cost.mjs +18 -0
- package/esm2020/lib/shipping/esolve-shipping-method-options.mjs +2 -0
- package/esm2020/lib/shipping/esolve-shipping-method-record.mjs +2 -0
- package/esm2020/lib/shipping/esolve-shipping-method.mjs +33 -0
- package/esm2020/lib/shipping/esolve-shipping.service.mjs +108 -0
- package/{esm2015/lib/stock/esolve-stock-badge-record.js → esm2020/lib/stock/esolve-stock-badge-record.mjs} +0 -0
- package/{esm2015/lib/stock/esolve-stock-badge.js → esm2020/lib/stock/esolve-stock-badge.mjs} +0 -0
- package/{esm2015/lib/stock/esolve-stock-item-list.js → esm2020/lib/stock/esolve-stock-item-list.mjs} +0 -0
- package/{esm2015/lib/stock/esolve-stock-item-options.js → esm2020/lib/stock/esolve-stock-item-options.mjs} +0 -0
- package/{esm2015/lib/stock/esolve-stock-item.js → esm2020/lib/stock/esolve-stock-item.mjs} +0 -0
- package/{esm2015/lib/stock/esolve-stock-price.js → esm2020/lib/stock/esolve-stock-price.mjs} +0 -0
- package/{esm2015/lib/stock/esolve-stock-record.js → esm2020/lib/stock/esolve-stock-record.mjs} +0 -0
- package/{esm2015/lib/stock/esolve-stock.service.js → esm2020/lib/stock/esolve-stock.service.mjs} +5 -6
- package/{esm2015/lib/tags/esolve-tag-record.js → esm2020/lib/tags/esolve-tag-record.mjs} +0 -0
- package/{esm2015/lib/tags/esolve-tag.js → esm2020/lib/tags/esolve-tag.mjs} +0 -0
- package/{esm2015/lib/topics/esolve-topic-record.js → esm2020/lib/topics/esolve-topic-record.mjs} +0 -0
- package/{esm2015/lib/topics/esolve-topic.js → esm2020/lib/topics/esolve-topic.mjs} +0 -0
- package/{esm2015/lib/topics/esolve-topic.service.js → esm2020/lib/topics/esolve-topic.service.mjs} +3 -3
- package/esm2020/public-api.mjs +78 -0
- package/fesm2015/esolve-ng-esolve-connect.mjs +2651 -0
- package/fesm2015/esolve-ng-esolve-connect.mjs.map +1 -0
- package/{fesm2015/esolve-ng-esolve-connect.js → fesm2020/esolve-ng-esolve-connect.mjs} +838 -461
- package/fesm2020/esolve-ng-esolve-connect.mjs.map +1 -0
- package/lib/account/esolve-account.service.d.ts +35 -0
- package/lib/{auth → account}/esolve-address-record.d.ts +0 -0
- package/lib/account/esolve-address-response.d.ts +8 -0
- package/lib/account/esolve-address-result.d.ts +10 -0
- package/lib/account/esolve-address-set-data.d.ts +17 -0
- package/lib/{auth → account}/esolve-address.d.ts +0 -0
- package/lib/account/esolve-geocode-result.d.ts +16 -0
- package/lib/{auth → account}/esolve-registration-data.d.ts +0 -0
- package/lib/account/esolve-registration-post-response-item.d.ts +7 -0
- package/lib/account/esolve-registration-result.d.ts +9 -0
- package/lib/account/esolve-user-account-data.d.ts +17 -0
- package/lib/account/esolve-user-account-record.d.ts +21 -0
- package/lib/account/esolve-user-account-result.d.ts +6 -0
- package/lib/account/esolve-user-account.d.ts +29 -0
- package/lib/auth/esolve-auth-interceptor.service.d.ts +1 -1
- package/lib/auth/esolve-auth.service.d.ts +5 -3
- package/lib/cart/esolve-cart.service.d.ts +6 -55
- package/lib/cart/esolve-checkout-result.d.ts +6 -0
- package/lib/locations/esolve-locations.service.d.ts +23 -0
- package/lib/{cart → locations}/esolve-stock-location-record.d.ts +0 -0
- package/lib/{cart → locations}/esolve-stock-location.d.ts +0 -0
- package/lib/payment/esolve-card-data.d.ts +7 -0
- package/lib/payment/esolve-payment-method-options.d.ts +5 -0
- package/lib/{cart → payment}/esolve-payment-method-record.d.ts +0 -5
- package/lib/{cart → payment}/esolve-payment-method.d.ts +2 -2
- package/lib/payment/esolve-payment-response.d.ts +13 -0
- package/lib/payment/esolve-payment-result.d.ts +10 -0
- package/lib/payment/esolve-payment.service.d.ts +61 -0
- package/lib/payment/esolve-vault-item-result.d.ts +10 -0
- package/lib/payment/esolve-vault-item.d.ts +10 -0
- package/lib/payment/esolve-vault-record.d.ts +11 -0
- package/lib/payment/esolve-vault-response.d.ts +9 -0
- package/lib/{auth → session}/esolve-session.d.ts +0 -0
- package/lib/{auth → session}/esolve-session.service.d.ts +0 -0
- package/lib/{auth → session}/esolve-stored-session.d.ts +0 -0
- package/lib/shared/error-handler/esolve-error-handler.service.d.ts +1 -1
- package/lib/shared/esolve-response.d.ts +5 -5
- package/lib/shared/response-handler/esolve-response-handler.service.d.ts +15 -0
- package/lib/shared/response-handler/esolve-response-result.d.ts +6 -0
- package/lib/{cart → shipping}/esolve-shipping-cost-record.d.ts +0 -5
- package/lib/{cart → shipping}/esolve-shipping-cost.d.ts +0 -0
- package/lib/shipping/esolve-shipping-method-options.d.ts +4 -0
- package/lib/{cart → shipping}/esolve-shipping-method-record.d.ts +0 -4
- package/lib/{cart → shipping}/esolve-shipping-method.d.ts +0 -0
- package/lib/shipping/esolve-shipping.service.d.ts +37 -0
- package/package.json +22 -8
- package/public-api.d.ts +24 -9
- package/bundles/esolve-ng-esolve-connect.umd.js +0 -3064
- package/bundles/esolve-ng-esolve-connect.umd.js.map +0 -1
- package/esm2015/lib/auth/esolve-account.service.js +0 -103
- package/esm2015/lib/auth/esolve-address-record.js +0 -2
- package/esm2015/lib/auth/esolve-address.js +0 -19
- package/esm2015/lib/auth/esolve-auth.service.js +0 -163
- package/esm2015/lib/auth/esolve-registration-data.js +0 -2
- package/esm2015/lib/auth/esolve-session.js +0 -27
- package/esm2015/lib/auth/esolve-session.service.js +0 -79
- package/esm2015/lib/auth/esolve-stored-session.js +0 -2
- package/esm2015/lib/cart/esolve-cart.service.js +0 -326
- package/esm2015/lib/cart/esolve-payment-method-record.js +0 -2
- package/esm2015/lib/cart/esolve-payment-method.js +0 -49
- package/esm2015/lib/cart/esolve-shipping-cost-record.js +0 -2
- package/esm2015/lib/cart/esolve-shipping-cost.js +0 -18
- package/esm2015/lib/cart/esolve-shipping-method-record.js +0 -2
- package/esm2015/lib/cart/esolve-shipping-method.js +0 -33
- package/esm2015/lib/cart/esolve-stock-location-record.js +0 -2
- package/esm2015/lib/cart/esolve-stock-location.js +0 -76
- package/esm2015/lib/ng-esolve-connect.module.js +0 -43
- package/esm2015/lib/shared/error-handler/esolve-error-handler.service.js +0 -58
- package/esm2015/public-api.js +0 -58
- package/fesm2015/esolve-ng-esolve-connect.js.map +0 -1
- package/lib/auth/esolve-account.service.d.ts +0 -23
|
@@ -0,0 +1,2651 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, Injectable, Inject, NgModule } from '@angular/core';
|
|
3
|
+
import { CommonModule } from '@angular/common';
|
|
4
|
+
import * as i1$1 from '@angular/common/http';
|
|
5
|
+
import { HttpParams, HTTP_INTERCEPTORS, HttpClientModule, HttpErrorResponse, HttpHeaders } from '@angular/common/http';
|
|
6
|
+
import * as i4 from 'ngx-cookie-service';
|
|
7
|
+
import { CookieService } from 'ngx-cookie-service';
|
|
8
|
+
import { BehaviorSubject, throwError, iif, of } from 'rxjs';
|
|
9
|
+
import * as i1 from '@angular/platform-browser';
|
|
10
|
+
import { map, tap, catchError, switchMap } from 'rxjs/operators';
|
|
11
|
+
|
|
12
|
+
const ESOLVE_CONNECT_CONFIG = new InjectionToken('esolve.connect.config');
|
|
13
|
+
// For future development
|
|
14
|
+
// export const GLOBAL_CONFIG = {
|
|
15
|
+
// images_url: '',
|
|
16
|
+
// media_path: '/media',
|
|
17
|
+
// stock_path: '/stock',
|
|
18
|
+
// banner_path: '/banners'
|
|
19
|
+
// };
|
|
20
|
+
|
|
21
|
+
class EsolveSession {
|
|
22
|
+
constructor(id = -1, _key = '', _key_expiration_date) {
|
|
23
|
+
this.id = id;
|
|
24
|
+
this._key = _key;
|
|
25
|
+
this._key_expiration_date = _key_expiration_date;
|
|
26
|
+
}
|
|
27
|
+
get key() {
|
|
28
|
+
return this._key;
|
|
29
|
+
}
|
|
30
|
+
get expired() {
|
|
31
|
+
const current_date = new Date();
|
|
32
|
+
return ((this._key_expiration_date === undefined) ||
|
|
33
|
+
(current_date >= this._key_expiration_date));
|
|
34
|
+
}
|
|
35
|
+
get authenticated() {
|
|
36
|
+
return (this.id > 0);
|
|
37
|
+
}
|
|
38
|
+
get valid() {
|
|
39
|
+
return ((this._key !== '') &&
|
|
40
|
+
(this._key_expiration_date !== undefined) &&
|
|
41
|
+
(this.id >= 0));
|
|
42
|
+
}
|
|
43
|
+
updateUser(user_id) {
|
|
44
|
+
this.id = user_id;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
class EsolveSessionService {
|
|
49
|
+
constructor(config) {
|
|
50
|
+
this.config = config;
|
|
51
|
+
this.storage_key = 'ngEslvUserSession';
|
|
52
|
+
this.setStorageKey();
|
|
53
|
+
this._session = new BehaviorSubject(new EsolveSession(0, ''));
|
|
54
|
+
this.session = this._session.asObservable();
|
|
55
|
+
}
|
|
56
|
+
get currentSession() {
|
|
57
|
+
return this._session.value;
|
|
58
|
+
}
|
|
59
|
+
setStorageKey() {
|
|
60
|
+
if ((typeof this.config.user_session_storage_key === 'string') &&
|
|
61
|
+
(this.config.user_session_storage_key !== '')) {
|
|
62
|
+
this.storage_key = this.config.user_session_storage_key;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
startTimer(callback, duration) {
|
|
66
|
+
this.key_expiration_timer = setTimeout(callback, duration);
|
|
67
|
+
}
|
|
68
|
+
clearTimer() {
|
|
69
|
+
if (this.key_expiration_timer) {
|
|
70
|
+
clearTimeout(this.key_expiration_timer);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
restore(expirationCallback, invalidSessionCallback) {
|
|
74
|
+
if (!this.currentSession.valid) {
|
|
75
|
+
const stored_session_json = localStorage.getItem(this.storage_key);
|
|
76
|
+
const stored_session = (stored_session_json ? JSON.parse(stored_session_json) : null);
|
|
77
|
+
if (!stored_session) {
|
|
78
|
+
invalidSessionCallback();
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const expiration_date = new Date(stored_session._key_expiration_date);
|
|
82
|
+
const loaded_session = new EsolveSession(stored_session.id, stored_session._key, expiration_date);
|
|
83
|
+
if (!loaded_session.expired) {
|
|
84
|
+
this._session.next(loaded_session);
|
|
85
|
+
const expiration_duration = expiration_date.getTime() - new Date().getTime();
|
|
86
|
+
this.startTimer(expirationCallback, expiration_duration);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
expirationCallback(loaded_session);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
handleSession(user_id, key, expiry_time, expires, expirationCallback) {
|
|
94
|
+
const expiration_date = new Date(expiry_time * 1000);
|
|
95
|
+
const session = new EsolveSession(user_id, key, expiration_date);
|
|
96
|
+
localStorage.setItem(this.storage_key, JSON.stringify(session));
|
|
97
|
+
this._session.next(session);
|
|
98
|
+
this.startTimer(expirationCallback, expires * 1000);
|
|
99
|
+
}
|
|
100
|
+
handleUpdateSession(user_id, callback) {
|
|
101
|
+
const current_session = this.currentSession;
|
|
102
|
+
current_session.updateUser(user_id);
|
|
103
|
+
localStorage.setItem(this.storage_key, JSON.stringify(current_session));
|
|
104
|
+
this._session.next(current_session);
|
|
105
|
+
if (typeof callback === 'function') {
|
|
106
|
+
callback();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
EsolveSessionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveSessionService, deps: [{ token: ESOLVE_CONNECT_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
111
|
+
EsolveSessionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveSessionService, providedIn: 'root' });
|
|
112
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveSessionService, decorators: [{
|
|
113
|
+
type: Injectable,
|
|
114
|
+
args: [{
|
|
115
|
+
providedIn: 'root'
|
|
116
|
+
}]
|
|
117
|
+
}], ctorParameters: function () {
|
|
118
|
+
return [{ type: undefined, decorators: [{
|
|
119
|
+
type: Inject,
|
|
120
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
121
|
+
}] }];
|
|
122
|
+
} });
|
|
123
|
+
|
|
124
|
+
class EsolveAuthInterceptorService {
|
|
125
|
+
constructor(config, session) {
|
|
126
|
+
this.config = config;
|
|
127
|
+
this.session = session;
|
|
128
|
+
}
|
|
129
|
+
intercept(req, next) {
|
|
130
|
+
if (req.url.startsWith(`${this.config.api_url}/service/`)) {
|
|
131
|
+
const service_identifier = req.url.replace(`${this.config.api_url}/service/`, '');
|
|
132
|
+
const old_params_keys = req.params.keys();
|
|
133
|
+
const modified_url = req.url;
|
|
134
|
+
let params = new HttpParams();
|
|
135
|
+
const session = this.session.currentSession;
|
|
136
|
+
if (session.valid) {
|
|
137
|
+
if (service_identifier !== 'get-access-token.php') {
|
|
138
|
+
params = params.set('key', session.key);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
old_params_keys.forEach(key => {
|
|
142
|
+
params = params.set(key, req.params.get(key) || '');
|
|
143
|
+
});
|
|
144
|
+
const modified_req = req.clone({
|
|
145
|
+
url: modified_url,
|
|
146
|
+
params
|
|
147
|
+
});
|
|
148
|
+
return next.handle(modified_req);
|
|
149
|
+
}
|
|
150
|
+
return next.handle(req);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
EsolveAuthInterceptorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAuthInterceptorService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: EsolveSessionService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
154
|
+
EsolveAuthInterceptorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAuthInterceptorService });
|
|
155
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAuthInterceptorService, decorators: [{
|
|
156
|
+
type: Injectable
|
|
157
|
+
}], ctorParameters: function () {
|
|
158
|
+
return [{ type: undefined, decorators: [{
|
|
159
|
+
type: Inject,
|
|
160
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
161
|
+
}] }, { type: EsolveSessionService }];
|
|
162
|
+
} });
|
|
163
|
+
|
|
164
|
+
class NgEsolveConnectModule {
|
|
165
|
+
static forRoot(config) {
|
|
166
|
+
return {
|
|
167
|
+
ngModule: NgEsolveConnectModule,
|
|
168
|
+
providers: [
|
|
169
|
+
{
|
|
170
|
+
provide: ESOLVE_CONNECT_CONFIG,
|
|
171
|
+
useValue: config
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
provide: HTTP_INTERCEPTORS,
|
|
175
|
+
useClass: EsolveAuthInterceptorService,
|
|
176
|
+
multi: true
|
|
177
|
+
}
|
|
178
|
+
]
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
NgEsolveConnectModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: NgEsolveConnectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
183
|
+
NgEsolveConnectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: NgEsolveConnectModule, imports: [CommonModule,
|
|
184
|
+
HttpClientModule] });
|
|
185
|
+
NgEsolveConnectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: NgEsolveConnectModule, providers: [CookieService], imports: [[
|
|
186
|
+
CommonModule,
|
|
187
|
+
HttpClientModule
|
|
188
|
+
]] });
|
|
189
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: NgEsolveConnectModule, decorators: [{
|
|
190
|
+
type: NgModule,
|
|
191
|
+
args: [{
|
|
192
|
+
declarations: [],
|
|
193
|
+
imports: [
|
|
194
|
+
CommonModule,
|
|
195
|
+
HttpClientModule
|
|
196
|
+
],
|
|
197
|
+
providers: [CookieService],
|
|
198
|
+
exports: []
|
|
199
|
+
}]
|
|
200
|
+
}] });
|
|
201
|
+
|
|
202
|
+
class EsolveHttpError {
|
|
203
|
+
constructor(type, message, error_code) {
|
|
204
|
+
this.type = type;
|
|
205
|
+
this.message = message;
|
|
206
|
+
this.error_code = error_code;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
class EsolveErrorHandlerService {
|
|
211
|
+
constructor() { }
|
|
212
|
+
parseException(exception) {
|
|
213
|
+
const error = new EsolveHttpError('exception', exception.message || 'Unknown exception has occurred', exception.additional_data.exception_type || 'unknown');
|
|
214
|
+
return error;
|
|
215
|
+
}
|
|
216
|
+
parseErrors(response) {
|
|
217
|
+
const error = new EsolveHttpError('error', 'Unknown error has occurred', 'unknown');
|
|
218
|
+
if ((response.status.state === 'none') && (response.log.length > 0)) {
|
|
219
|
+
error.error_code = 'no_response';
|
|
220
|
+
error.message = 'Response was provided';
|
|
221
|
+
}
|
|
222
|
+
else if (response.status.state === 'error') {
|
|
223
|
+
const login_error_log = response.log[0];
|
|
224
|
+
error.error_code = login_error_log.message_code;
|
|
225
|
+
error.message = login_error_log.message;
|
|
226
|
+
}
|
|
227
|
+
return error;
|
|
228
|
+
}
|
|
229
|
+
handleHttpPostError(service_type, errorRes) {
|
|
230
|
+
if (errorRes instanceof HttpErrorResponse) {
|
|
231
|
+
if (errorRes.status === 500) {
|
|
232
|
+
const server_error = errorRes.error;
|
|
233
|
+
if ((server_error.service_type === service_type) ||
|
|
234
|
+
(server_error.type !== undefined) ||
|
|
235
|
+
(server_error.message !== undefined) ||
|
|
236
|
+
(server_error.additional_data !== undefined)) {
|
|
237
|
+
return throwError(this.parseException(server_error));
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
if (errorRes.type !== undefined) {
|
|
243
|
+
if ((errorRes.type === 'exception') || (errorRes.type === 'error')) {
|
|
244
|
+
return throwError(this.parseException(errorRes));
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
else if (errorRes.transaction_type !== undefined) {
|
|
248
|
+
return throwError(this.parseErrors(errorRes));
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return throwError(errorRes);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
EsolveErrorHandlerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveErrorHandlerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
255
|
+
EsolveErrorHandlerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveErrorHandlerService, providedIn: 'root' });
|
|
256
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveErrorHandlerService, decorators: [{
|
|
257
|
+
type: Injectable,
|
|
258
|
+
args: [{
|
|
259
|
+
providedIn: 'root'
|
|
260
|
+
}]
|
|
261
|
+
}], ctorParameters: function () { return []; } });
|
|
262
|
+
|
|
263
|
+
class EsolveResponseResult {
|
|
264
|
+
constructor(response) {
|
|
265
|
+
this.success_log = [];
|
|
266
|
+
this.error_log = [];
|
|
267
|
+
this.error_log.push(...response.log.filter(log_item => log_item.type === 'error'));
|
|
268
|
+
this.success_log.push(...response.log.filter(log_item => log_item.type === 'success'));
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
class EsolveResponseHandlerService {
|
|
273
|
+
constructor() { }
|
|
274
|
+
/**
|
|
275
|
+
* Parse single HTTP response
|
|
276
|
+
* @param http_response HTTP Response to eSolve service
|
|
277
|
+
* @param resultHandler Function to parse response to a result
|
|
278
|
+
* @returns Parsed result of response
|
|
279
|
+
*/
|
|
280
|
+
validateSingleHttpResponse(http_response, resultHandler) {
|
|
281
|
+
if ((http_response.responses === undefined) ||
|
|
282
|
+
(http_response.responses.length <= 0)) {
|
|
283
|
+
throw http_response;
|
|
284
|
+
}
|
|
285
|
+
const response = http_response.responses[0];
|
|
286
|
+
if ((response.status.state === 'error') ||
|
|
287
|
+
(response.status.state === 'none')) {
|
|
288
|
+
throw response;
|
|
289
|
+
}
|
|
290
|
+
return resultHandler(response);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
EsolveResponseHandlerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveResponseHandlerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
294
|
+
EsolveResponseHandlerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveResponseHandlerService, providedIn: 'root' });
|
|
295
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveResponseHandlerService, decorators: [{
|
|
296
|
+
type: Injectable,
|
|
297
|
+
args: [{
|
|
298
|
+
providedIn: 'root'
|
|
299
|
+
}]
|
|
300
|
+
}], ctorParameters: function () { return []; } });
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Search Engine Optimization information.
|
|
304
|
+
*/
|
|
305
|
+
class EsolveSEOInfo {
|
|
306
|
+
constructor(title = '', description = '', keywords = '') {
|
|
307
|
+
this.title = title;
|
|
308
|
+
this.description = description;
|
|
309
|
+
this.keywords = keywords;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
class EsolveSeoService {
|
|
314
|
+
constructor(config, title, meta) {
|
|
315
|
+
this.config = config;
|
|
316
|
+
this.title = title;
|
|
317
|
+
this.meta = meta;
|
|
318
|
+
this.title_prefix = '';
|
|
319
|
+
this.title_suffix = '';
|
|
320
|
+
this.title_separator = '|';
|
|
321
|
+
this.default_seo_title = '';
|
|
322
|
+
this.default_seo_description = '';
|
|
323
|
+
this.default_seo_keywords = '';
|
|
324
|
+
this.init();
|
|
325
|
+
}
|
|
326
|
+
init() {
|
|
327
|
+
if (typeof this.config.title_prefix !== 'undefined') {
|
|
328
|
+
this.title_prefix = this.config.title_prefix;
|
|
329
|
+
}
|
|
330
|
+
if (typeof this.config.title_suffix !== 'undefined') {
|
|
331
|
+
this.title_suffix = this.config.title_suffix;
|
|
332
|
+
}
|
|
333
|
+
if (typeof this.config.title_separator !== 'undefined') {
|
|
334
|
+
this.title_separator = this.config.title_separator;
|
|
335
|
+
}
|
|
336
|
+
if (typeof this.config.default_seo_title !== 'undefined') {
|
|
337
|
+
this.default_seo_title = this.config.default_seo_title;
|
|
338
|
+
}
|
|
339
|
+
if (typeof this.config.default_seo_description !== 'undefined') {
|
|
340
|
+
this.default_seo_description = this.config.default_seo_description;
|
|
341
|
+
}
|
|
342
|
+
if (typeof this.config.default_seo_keywords !== 'undefined') {
|
|
343
|
+
this.default_seo_keywords = this.config.default_seo_keywords;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
setPageTitleTags(title) {
|
|
347
|
+
this.title.setTitle(title);
|
|
348
|
+
this.meta.updateTag({ property: 'og:title', content: title });
|
|
349
|
+
}
|
|
350
|
+
setPageDescriptionTags(description) {
|
|
351
|
+
this.meta.updateTag({ name: 'description', content: description });
|
|
352
|
+
this.meta.updateTag({ property: 'og:description', content: description });
|
|
353
|
+
}
|
|
354
|
+
setPageKeywordsTags(keywords) {
|
|
355
|
+
this.meta.updateTag({ name: 'keywords', content: keywords });
|
|
356
|
+
}
|
|
357
|
+
validateAndSanitizeSeoInfo(seoInfo) {
|
|
358
|
+
const pageSeo = new EsolveSEOInfo(this.default_seo_title, this.default_seo_description, this.default_seo_keywords);
|
|
359
|
+
if (seoInfo.description.trim() !== '') {
|
|
360
|
+
pageSeo.description = seoInfo.description;
|
|
361
|
+
}
|
|
362
|
+
if (seoInfo.title.trim() !== '') {
|
|
363
|
+
const titlePartsArray = [];
|
|
364
|
+
if (this.title_prefix !== '') {
|
|
365
|
+
titlePartsArray.push(this.title_prefix);
|
|
366
|
+
if (this.title_separator !== '') {
|
|
367
|
+
titlePartsArray.push(this.title_separator);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
titlePartsArray.push(seoInfo.title);
|
|
371
|
+
if (this.title_suffix !== '') {
|
|
372
|
+
if (this.title_separator !== '') {
|
|
373
|
+
titlePartsArray.push(this.title_separator);
|
|
374
|
+
}
|
|
375
|
+
titlePartsArray.push(this.title_suffix);
|
|
376
|
+
}
|
|
377
|
+
pageSeo.title = titlePartsArray.join(' ');
|
|
378
|
+
if (seoInfo.keywords.trim() === '') {
|
|
379
|
+
const clean_title = seoInfo.title.replace(/[^a-zA-Z0-9\. ]+/gi, '').trim();
|
|
380
|
+
const keywords = clean_title.split(' ');
|
|
381
|
+
const clean_keywords = [];
|
|
382
|
+
for (let keyword of keywords) {
|
|
383
|
+
keyword = keyword.trim();
|
|
384
|
+
if (keyword.length > 2) {
|
|
385
|
+
keyword = keyword.toLocaleLowerCase();
|
|
386
|
+
if (!clean_keywords.includes(keyword)) {
|
|
387
|
+
clean_keywords.push(keyword);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
seoInfo.keywords = clean_keywords.join(',');
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
if (seoInfo.keywords.trim() !== '') {
|
|
395
|
+
pageSeo.keywords = seoInfo.keywords;
|
|
396
|
+
}
|
|
397
|
+
return pageSeo;
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Sets SEO tags for page
|
|
401
|
+
* @param seoInfo SEO object
|
|
402
|
+
*/
|
|
403
|
+
setTags(seoInfo) {
|
|
404
|
+
seoInfo = this.validateAndSanitizeSeoInfo(seoInfo);
|
|
405
|
+
this.setPageTitleTags(seoInfo.title);
|
|
406
|
+
this.setPageDescriptionTags(seoInfo.description);
|
|
407
|
+
this.setPageKeywordsTags(seoInfo.keywords);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
EsolveSeoService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveSeoService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1.Title }, { token: i1.Meta }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
411
|
+
EsolveSeoService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveSeoService, providedIn: 'root' });
|
|
412
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveSeoService, decorators: [{
|
|
413
|
+
type: Injectable,
|
|
414
|
+
args: [{
|
|
415
|
+
providedIn: 'root'
|
|
416
|
+
}]
|
|
417
|
+
}], ctorParameters: function () {
|
|
418
|
+
return [{ type: undefined, decorators: [{
|
|
419
|
+
type: Inject,
|
|
420
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
421
|
+
}] }, { type: i1.Title }, { type: i1.Meta }];
|
|
422
|
+
} });
|
|
423
|
+
|
|
424
|
+
class EsolveAuthService {
|
|
425
|
+
constructor(config, http, session, errorHandler, cookieService) {
|
|
426
|
+
this.config = config;
|
|
427
|
+
this.http = http;
|
|
428
|
+
this.session = session;
|
|
429
|
+
this.errorHandler = errorHandler;
|
|
430
|
+
this.cookieService = cookieService;
|
|
431
|
+
}
|
|
432
|
+
checkAccessToken(session) {
|
|
433
|
+
var _a;
|
|
434
|
+
session = session || this.session.currentSession;
|
|
435
|
+
const token = (_a = session === null || session === void 0 ? void 0 : session.key) !== null && _a !== void 0 ? _a : '';
|
|
436
|
+
const params = new HttpParams({
|
|
437
|
+
fromObject: {
|
|
438
|
+
key: token,
|
|
439
|
+
ws_id: this.config.wsid
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
return this.http.get(`${this.config.api_url}/service/get-access-token.php`, {
|
|
443
|
+
params,
|
|
444
|
+
headers: new HttpHeaders({
|
|
445
|
+
'Accept-Language': '*'
|
|
446
|
+
})
|
|
447
|
+
}).pipe(map(responseData => {
|
|
448
|
+
if ((responseData.type === 'error') ||
|
|
449
|
+
(responseData.type === 'exception') ||
|
|
450
|
+
(!responseData.additional_data.key_okay)) {
|
|
451
|
+
throw responseData;
|
|
452
|
+
}
|
|
453
|
+
responseData.additional_data.key = token;
|
|
454
|
+
return responseData;
|
|
455
|
+
})).toPromise();
|
|
456
|
+
}
|
|
457
|
+
getAccessToken(email, password, anonymous = false) {
|
|
458
|
+
let params = new HttpParams();
|
|
459
|
+
if (anonymous) {
|
|
460
|
+
params = params.set('anonymous', '1');
|
|
461
|
+
}
|
|
462
|
+
if (email !== '') {
|
|
463
|
+
params = params.set('email', email);
|
|
464
|
+
}
|
|
465
|
+
if (password !== '') {
|
|
466
|
+
params = params.set('password', password);
|
|
467
|
+
}
|
|
468
|
+
params = params.set('ws_id', this.config.wsid);
|
|
469
|
+
return this.http.get(`${this.config.api_url}/service/get-access-token.php`, {
|
|
470
|
+
params,
|
|
471
|
+
headers: new HttpHeaders({
|
|
472
|
+
'Accept-Language': '*'
|
|
473
|
+
})
|
|
474
|
+
}).pipe(tap(responseData => {
|
|
475
|
+
if ((responseData.type === 'error') ||
|
|
476
|
+
(responseData.type === 'exception')) {
|
|
477
|
+
throw responseData;
|
|
478
|
+
}
|
|
479
|
+
}), catchError(this.handleError), tap(responseData => {
|
|
480
|
+
this.handleAuthentication(responseData);
|
|
481
|
+
}));
|
|
482
|
+
}
|
|
483
|
+
autoLogin() {
|
|
484
|
+
this.session.restore(this.handleExpiration(), () => {
|
|
485
|
+
this.getAccessToken('', '', true).toPromise().then(_ => { }, error => {
|
|
486
|
+
console.log(error);
|
|
487
|
+
});
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
login(email, password) {
|
|
491
|
+
const body = {
|
|
492
|
+
login: {
|
|
493
|
+
email,
|
|
494
|
+
password
|
|
495
|
+
}
|
|
496
|
+
};
|
|
497
|
+
return this.http.post(`${this.config.api_url}/service/set-login.php`, body, {
|
|
498
|
+
headers: {
|
|
499
|
+
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
|
|
500
|
+
},
|
|
501
|
+
params: {
|
|
502
|
+
ws_id: this.config.wsid
|
|
503
|
+
},
|
|
504
|
+
responseType: 'json',
|
|
505
|
+
observe: 'body'
|
|
506
|
+
}).pipe(map(response => {
|
|
507
|
+
if ((response.responses === undefined) ||
|
|
508
|
+
(response.responses.length <= 0)) {
|
|
509
|
+
throw response;
|
|
510
|
+
}
|
|
511
|
+
const login_response = response.responses[0];
|
|
512
|
+
if ((login_response.status.state !== 'success') &&
|
|
513
|
+
(login_response.status.state !== 'warning')) {
|
|
514
|
+
throw login_response;
|
|
515
|
+
}
|
|
516
|
+
for (const response_log of login_response.log) {
|
|
517
|
+
if ((response_log.type === 'success') && (response_log.message_code === 'login_success')) {
|
|
518
|
+
this.session.handleUpdateSession(login_response.esolve_id);
|
|
519
|
+
return login_response.esolve_id;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
throw login_response;
|
|
523
|
+
}), catchError((errorRes) => {
|
|
524
|
+
return this.errorHandler.handleHttpPostError('set-login', errorRes);
|
|
525
|
+
}));
|
|
526
|
+
}
|
|
527
|
+
logout() {
|
|
528
|
+
this.session.clearTimer();
|
|
529
|
+
this.cookieService.delete('_ws_id');
|
|
530
|
+
return this.getAccessToken('', '', true).toPromise();
|
|
531
|
+
}
|
|
532
|
+
// Handlers
|
|
533
|
+
handleExpiration() {
|
|
534
|
+
return (session) => {
|
|
535
|
+
this.checkAccessToken(session).then((response) => {
|
|
536
|
+
this.handleAuthentication(response);
|
|
537
|
+
}, () => {
|
|
538
|
+
this.logout();
|
|
539
|
+
});
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
handleAuthentication(responseData) {
|
|
543
|
+
if (responseData.additional_data.key) {
|
|
544
|
+
this.session.handleSession(responseData.additional_data.user_id, responseData.additional_data.key, +responseData.additional_data.expiry_time, +responseData.additional_data.expires, this.handleExpiration());
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
handleError(errorRes) {
|
|
548
|
+
const error = {
|
|
549
|
+
message: 'An unknown error occurred',
|
|
550
|
+
data: {}
|
|
551
|
+
};
|
|
552
|
+
if ((!errorRes.type) ||
|
|
553
|
+
(!errorRes.service_type) ||
|
|
554
|
+
(!errorRes.message)) {
|
|
555
|
+
return throwError(error);
|
|
556
|
+
}
|
|
557
|
+
if (errorRes.message.trim() !== '') {
|
|
558
|
+
error.message = errorRes.message;
|
|
559
|
+
}
|
|
560
|
+
if (errorRes.additional_data) {
|
|
561
|
+
error.data = errorRes.additional_data;
|
|
562
|
+
}
|
|
563
|
+
return throwError(error);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
EsolveAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAuthService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }, { token: EsolveSessionService }, { token: EsolveErrorHandlerService }, { token: i4.CookieService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
567
|
+
EsolveAuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAuthService, providedIn: 'root' });
|
|
568
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAuthService, decorators: [{
|
|
569
|
+
type: Injectable,
|
|
570
|
+
args: [{
|
|
571
|
+
providedIn: 'root'
|
|
572
|
+
}]
|
|
573
|
+
}], ctorParameters: function () {
|
|
574
|
+
return [{ type: undefined, decorators: [{
|
|
575
|
+
type: Inject,
|
|
576
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
577
|
+
}] }, { type: i1$1.HttpClient }, { type: EsolveSessionService }, { type: EsolveErrorHandlerService }, { type: i4.CookieService }];
|
|
578
|
+
} });
|
|
579
|
+
|
|
580
|
+
class EsolveAddress {
|
|
581
|
+
constructor(id, recipient, address_type, pobox, place_name, street_number, street, suburb, city, province, country, postal_code, latitude, longitude) {
|
|
582
|
+
this.id = id;
|
|
583
|
+
this.recipient = recipient;
|
|
584
|
+
this.address_type = address_type;
|
|
585
|
+
this.pobox = pobox;
|
|
586
|
+
this.place_name = place_name;
|
|
587
|
+
this.street_number = street_number;
|
|
588
|
+
this.street = street;
|
|
589
|
+
this.suburb = suburb;
|
|
590
|
+
this.city = city;
|
|
591
|
+
this.province = province;
|
|
592
|
+
this.country = country;
|
|
593
|
+
this.postal_code = postal_code;
|
|
594
|
+
this.latitude = latitude;
|
|
595
|
+
this.longitude = longitude;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
class EsolveAddressResult extends EsolveResponseResult {
|
|
600
|
+
constructor(response) {
|
|
601
|
+
super(response);
|
|
602
|
+
this.id = response.esolve_id;
|
|
603
|
+
this.address_validated = response.address_validated;
|
|
604
|
+
this.geocode_status = response.geocode_status;
|
|
605
|
+
this.geocode_result = response.geocode_result;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
class EsolveUserAccount {
|
|
610
|
+
constructor(esolve_id, email, registration_type, title, first_name, last_name, initials, gender, identification_number) {
|
|
611
|
+
this.esolve_id = esolve_id;
|
|
612
|
+
this.email = email;
|
|
613
|
+
this.registration_type = registration_type;
|
|
614
|
+
this.title = title;
|
|
615
|
+
this.first_name = first_name;
|
|
616
|
+
this.last_name = last_name;
|
|
617
|
+
this.initials = initials;
|
|
618
|
+
this.gender = gender;
|
|
619
|
+
this.identification_number = identification_number;
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
class EsolveUserAccountBusiness {
|
|
623
|
+
constructor(name, vat_number, description, type) {
|
|
624
|
+
this.name = name;
|
|
625
|
+
this.vat_number = vat_number;
|
|
626
|
+
this.description = description;
|
|
627
|
+
this.type = type;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
class EsolveUserAccountContact {
|
|
631
|
+
constructor(tel_number, cell_number, fax_number) {
|
|
632
|
+
this.tel_number = tel_number;
|
|
633
|
+
this.cell_number = cell_number;
|
|
634
|
+
this.fax_number = fax_number;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
class EsolveUserAccountResult extends EsolveResponseResult {
|
|
639
|
+
constructor(response) {
|
|
640
|
+
super(response);
|
|
641
|
+
this.id = 0;
|
|
642
|
+
this.id = +response.esolve_id;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
class EsolveRegistrationResult extends EsolveResponseResult {
|
|
647
|
+
constructor(response) {
|
|
648
|
+
super(response);
|
|
649
|
+
this.user_id = response.esolve_id;
|
|
650
|
+
this.guest = response.guest;
|
|
651
|
+
this.auto_login = response.auto_login;
|
|
652
|
+
this.authentication_required = response.authentication_required;
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
class EsolveAccountService {
|
|
657
|
+
constructor(config, http, sessionService, errorHandler, responseHandler) {
|
|
658
|
+
this.config = config;
|
|
659
|
+
this.http = http;
|
|
660
|
+
this.sessionService = sessionService;
|
|
661
|
+
this.errorHandler = errorHandler;
|
|
662
|
+
this.responseHandler = responseHandler;
|
|
663
|
+
this._user_id = 0;
|
|
664
|
+
this.sessionService.session.subscribe((session) => {
|
|
665
|
+
if (session.key !== '') {
|
|
666
|
+
this.user_id = session.id;
|
|
667
|
+
}
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
get user_id() {
|
|
671
|
+
return this._user_id;
|
|
672
|
+
}
|
|
673
|
+
set user_id(value) {
|
|
674
|
+
value = ((value > 0) ? value : 0);
|
|
675
|
+
if (this._user_id !== value) {
|
|
676
|
+
this._user_id = value;
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
processUserAccount(record) {
|
|
680
|
+
if (!record) {
|
|
681
|
+
throw new Error('Invalid record');
|
|
682
|
+
}
|
|
683
|
+
if (+record.userid !== this._user_id) {
|
|
684
|
+
throw new Error('Invalid user account retrieved');
|
|
685
|
+
}
|
|
686
|
+
const user_account = new EsolveUserAccount(+record.userid, record.email, record.registration_type, record.title, record.firstname, record.surname, record.initials, record.gender, record.idnumber);
|
|
687
|
+
user_account.contact_details = new EsolveUserAccountContact(record.telnumber, record.cellnumber, record.fax);
|
|
688
|
+
user_account.business_details = new EsolveUserAccountBusiness(record.busname, record.vatnum, record.busdescript, record.business_type);
|
|
689
|
+
return user_account;
|
|
690
|
+
}
|
|
691
|
+
processUserAddress(records) {
|
|
692
|
+
const user_addresses = [];
|
|
693
|
+
if (!records || (this._user_id === 0)) {
|
|
694
|
+
return user_addresses;
|
|
695
|
+
}
|
|
696
|
+
for (const record of records) {
|
|
697
|
+
if (+record.userid !== this._user_id) {
|
|
698
|
+
continue;
|
|
699
|
+
}
|
|
700
|
+
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));
|
|
701
|
+
}
|
|
702
|
+
return user_addresses;
|
|
703
|
+
}
|
|
704
|
+
updateUserAccount(user_account_data) {
|
|
705
|
+
const body = {
|
|
706
|
+
account: user_account_data
|
|
707
|
+
};
|
|
708
|
+
return this.http.post(`${this.config.api_url}/service/set-user-account.php`, body, {
|
|
709
|
+
headers: {
|
|
710
|
+
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
|
|
711
|
+
},
|
|
712
|
+
params: {
|
|
713
|
+
ws_id: this.config.wsid
|
|
714
|
+
},
|
|
715
|
+
responseType: 'json',
|
|
716
|
+
observe: 'body'
|
|
717
|
+
}).pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => new EsolveUserAccountResult(response))), catchError((errorRes) => {
|
|
718
|
+
return this.errorHandler.handleHttpPostError('set-user-account', errorRes);
|
|
719
|
+
}));
|
|
720
|
+
}
|
|
721
|
+
getUserAccount() {
|
|
722
|
+
return this.http.get(`${this.config.api_url}/service/get-account.php`, {
|
|
723
|
+
params: {
|
|
724
|
+
ws_id: this.config.wsid
|
|
725
|
+
}
|
|
726
|
+
}).pipe(map(response => {
|
|
727
|
+
if ((response.records === undefined) ||
|
|
728
|
+
(response.records.length === 0)) {
|
|
729
|
+
throw response;
|
|
730
|
+
}
|
|
731
|
+
const record = response.records[0];
|
|
732
|
+
return this.processUserAccount(record);
|
|
733
|
+
}));
|
|
734
|
+
}
|
|
735
|
+
setAddress(address_post_data) {
|
|
736
|
+
const body = {
|
|
737
|
+
address: address_post_data
|
|
738
|
+
};
|
|
739
|
+
return this.http.post(`${this.config.api_url}/service/set-address.php`, body, {
|
|
740
|
+
headers: {
|
|
741
|
+
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
|
|
742
|
+
},
|
|
743
|
+
params: {
|
|
744
|
+
ws_id: this.config.wsid
|
|
745
|
+
},
|
|
746
|
+
responseType: 'json',
|
|
747
|
+
observe: 'body'
|
|
748
|
+
}).pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => new EsolveAddressResult(response))), catchError((errorRes) => {
|
|
749
|
+
return this.errorHandler.handleHttpPostError('set-registration', errorRes);
|
|
750
|
+
}));
|
|
751
|
+
}
|
|
752
|
+
getAddresses() {
|
|
753
|
+
if (this.user_id <= 0) {
|
|
754
|
+
return throwError('Log in is required');
|
|
755
|
+
}
|
|
756
|
+
return this.http.get(`${this.config.api_url}/service/get-addresses.php`, {
|
|
757
|
+
params: {
|
|
758
|
+
ws_id: this.config.wsid,
|
|
759
|
+
user_id: this.user_id
|
|
760
|
+
}
|
|
761
|
+
}).pipe(map(response => {
|
|
762
|
+
if (response.records === undefined) {
|
|
763
|
+
throw response;
|
|
764
|
+
}
|
|
765
|
+
return this.processUserAddress(response.records);
|
|
766
|
+
}));
|
|
767
|
+
}
|
|
768
|
+
register(user_registration) {
|
|
769
|
+
const body = {
|
|
770
|
+
user: user_registration
|
|
771
|
+
};
|
|
772
|
+
return this.http.post(`${this.config.api_url}/service/set-registration.php`, body, {
|
|
773
|
+
headers: {
|
|
774
|
+
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
|
|
775
|
+
},
|
|
776
|
+
params: {
|
|
777
|
+
ws_id: this.config.wsid
|
|
778
|
+
},
|
|
779
|
+
responseType: 'json',
|
|
780
|
+
observe: 'body'
|
|
781
|
+
}).pipe(map(http_response => this.responseHandler.validateSingleHttpResponse(http_response, (response) => {
|
|
782
|
+
if (response.auto_login) {
|
|
783
|
+
this.sessionService.handleUpdateSession(response.esolve_id);
|
|
784
|
+
}
|
|
785
|
+
return new EsolveRegistrationResult(response);
|
|
786
|
+
})), catchError((errorRes) => {
|
|
787
|
+
return this.errorHandler.handleHttpPostError('set-registration', errorRes);
|
|
788
|
+
}));
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
EsolveAccountService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAccountService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }, { token: EsolveSessionService }, { token: EsolveErrorHandlerService }, { token: EsolveResponseHandlerService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
792
|
+
EsolveAccountService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAccountService, providedIn: 'root' });
|
|
793
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAccountService, decorators: [{
|
|
794
|
+
type: Injectable,
|
|
795
|
+
args: [{
|
|
796
|
+
providedIn: 'root'
|
|
797
|
+
}]
|
|
798
|
+
}], ctorParameters: function () {
|
|
799
|
+
return [{ type: undefined, decorators: [{
|
|
800
|
+
type: Inject,
|
|
801
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
802
|
+
}] }, { type: i1$1.HttpClient }, { type: EsolveSessionService }, { type: EsolveErrorHandlerService }, { type: EsolveResponseHandlerService }];
|
|
803
|
+
} });
|
|
804
|
+
|
|
805
|
+
class EsolveMediaArticle {
|
|
806
|
+
constructor(identifier, title, article, image_url = '', tags = [], topics = [], seo_title = '', seo_keywords = '', seo_description = '') {
|
|
807
|
+
this.identifier = identifier;
|
|
808
|
+
this.title = title;
|
|
809
|
+
this.article = article;
|
|
810
|
+
this.image_url = image_url;
|
|
811
|
+
this.tags = tags;
|
|
812
|
+
this.topics = topics;
|
|
813
|
+
if (seo_title.trim() === '') {
|
|
814
|
+
seo_title = this.title;
|
|
815
|
+
}
|
|
816
|
+
this.seo_details = new EsolveSEOInfo(seo_title, seo_description, seo_keywords);
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
class EsolveTag {
|
|
821
|
+
constructor(id, tag_phrase, tag_weight, description) {
|
|
822
|
+
this.id = id;
|
|
823
|
+
this.tag_phrase = tag_phrase;
|
|
824
|
+
this.tag_weight = tag_weight;
|
|
825
|
+
this.description = description;
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
class EsolveTopic {
|
|
830
|
+
constructor(id, name, short_description, sort_priority) {
|
|
831
|
+
this.id = id;
|
|
832
|
+
this.name = name;
|
|
833
|
+
this.short_description = short_description;
|
|
834
|
+
this.sort_priority = sort_priority;
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
class EsolveMediaService {
|
|
839
|
+
constructor(config, http) {
|
|
840
|
+
this.config = config;
|
|
841
|
+
this.http = http;
|
|
842
|
+
}
|
|
843
|
+
processMediaRecord(record) {
|
|
844
|
+
const tags = [];
|
|
845
|
+
const topics = [];
|
|
846
|
+
if ((record.tags) && (record.tags.length > 0)) {
|
|
847
|
+
for (const tag of record.tags) {
|
|
848
|
+
tags.push(new EsolveTag(+tag.id, tag.tag_phrase, +tag.tag_weight, tag.description));
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
if ((record.topics) && (record.topics.length > 0)) {
|
|
852
|
+
for (const topic of record.topics) {
|
|
853
|
+
topics.push(new EsolveTopic(+topic.id, topic.name, topic.short_description, +topic.sort_priority));
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
return new EsolveMediaArticle(record.identifier, record.title, record.article, record.image_url, tags, topics, record.seo_page_title, record.seo_keywords, record.seo_description);
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* Retrieves media records from eSolve instance.
|
|
860
|
+
* @param params Header params
|
|
861
|
+
*/
|
|
862
|
+
getMediaRecords(params) {
|
|
863
|
+
params = params.set('ws_id', this.config.wsid);
|
|
864
|
+
return this.http.get(`${this.config.api_url}/service/get-media.php`, { params });
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* Retrieves the media record from the eSolve instance using the identifier.
|
|
868
|
+
* @param identifier String representing the eSolve media indentifier
|
|
869
|
+
*/
|
|
870
|
+
getMediaArticle(identifier) {
|
|
871
|
+
const params = new HttpParams({
|
|
872
|
+
fromObject: {
|
|
873
|
+
identifier
|
|
874
|
+
}
|
|
875
|
+
});
|
|
876
|
+
// TODO: Error Handling
|
|
877
|
+
return this.getMediaRecords(params).pipe(map(response => {
|
|
878
|
+
if ((response.records === undefined) || (response.records.length <= 0)) {
|
|
879
|
+
throw response;
|
|
880
|
+
}
|
|
881
|
+
const mediaRecord = response.records[0];
|
|
882
|
+
if (!mediaRecord.active) {
|
|
883
|
+
throw response;
|
|
884
|
+
}
|
|
885
|
+
return this.processMediaRecord(mediaRecord);
|
|
886
|
+
}));
|
|
887
|
+
}
|
|
888
|
+
/**
|
|
889
|
+
* Retrieves a group of media records from the eSolve instance linked to a group.
|
|
890
|
+
* @param media_group String representing the eSolve media group
|
|
891
|
+
*/
|
|
892
|
+
getGroupedMediaArticles(media_group) {
|
|
893
|
+
const params = new HttpParams({
|
|
894
|
+
fromObject: {
|
|
895
|
+
media_group_sef: media_group
|
|
896
|
+
}
|
|
897
|
+
});
|
|
898
|
+
return this.getMediaRecords(params).pipe(map(response => {
|
|
899
|
+
const mediaArticles = [];
|
|
900
|
+
if ((response.records !== undefined) && (response.records.length > 0)) {
|
|
901
|
+
for (const mediaRecord of response.records) {
|
|
902
|
+
if (mediaRecord.active) {
|
|
903
|
+
mediaArticles.push(this.processMediaRecord(mediaRecord));
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
return mediaArticles;
|
|
908
|
+
}));
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
EsolveMediaService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMediaService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
912
|
+
EsolveMediaService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMediaService, providedIn: 'root' });
|
|
913
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMediaService, decorators: [{
|
|
914
|
+
type: Injectable,
|
|
915
|
+
args: [{
|
|
916
|
+
providedIn: 'root'
|
|
917
|
+
}]
|
|
918
|
+
}], ctorParameters: function () {
|
|
919
|
+
return [{ type: undefined, decorators: [{
|
|
920
|
+
type: Inject,
|
|
921
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
922
|
+
}] }, { type: i1$1.HttpClient }];
|
|
923
|
+
} });
|
|
924
|
+
|
|
925
|
+
class EsolveNewsArticle {
|
|
926
|
+
constructor(id, title, sef_title, article, short_description, txdate, active, image, featured, author, seo_title = '', seo_keywords = '') {
|
|
927
|
+
this.id = id;
|
|
928
|
+
this.title = title;
|
|
929
|
+
this.sef_title = sef_title;
|
|
930
|
+
this.article = article;
|
|
931
|
+
this.short_description = short_description;
|
|
932
|
+
this.txdate = txdate;
|
|
933
|
+
this.active = active;
|
|
934
|
+
this.image = image;
|
|
935
|
+
this.featured = featured;
|
|
936
|
+
this.author = author;
|
|
937
|
+
if (seo_title.trim() === '') {
|
|
938
|
+
seo_title = this.title;
|
|
939
|
+
}
|
|
940
|
+
this.seo_details = new EsolveSEOInfo(seo_title, short_description, seo_keywords);
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
class EsolveNewsGroup {
|
|
945
|
+
constructor(id, name, description, sef_name) {
|
|
946
|
+
this.id = id;
|
|
947
|
+
this.name = name;
|
|
948
|
+
this.description = description;
|
|
949
|
+
this.sef_name = sef_name;
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
class EsolveNewsArticleList {
|
|
954
|
+
constructor(newsArticles, total, page) {
|
|
955
|
+
this.newsArticles = newsArticles;
|
|
956
|
+
this.total = total;
|
|
957
|
+
this.page = page;
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
class EsolveNewsArticleAuthor {
|
|
962
|
+
constructor(userid, email, firstname, surname) {
|
|
963
|
+
this.userid = userid;
|
|
964
|
+
this.email = email;
|
|
965
|
+
this.firstname = firstname;
|
|
966
|
+
this.surname = surname;
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
class EsolveNewsService {
|
|
971
|
+
constructor(config, http) {
|
|
972
|
+
this.config = config;
|
|
973
|
+
this.http = http;
|
|
974
|
+
}
|
|
975
|
+
getNewsRecords(params) {
|
|
976
|
+
params = params.set('ws_id', this.config.wsid);
|
|
977
|
+
return this.http.get(`${this.config.api_url}/service/get-news.php`, { params });
|
|
978
|
+
}
|
|
979
|
+
getNewsArticle(identifier) {
|
|
980
|
+
const params = new HttpParams({
|
|
981
|
+
fromObject: {
|
|
982
|
+
sef_title: identifier
|
|
983
|
+
}
|
|
984
|
+
});
|
|
985
|
+
return this.getNewsRecords(params).pipe(map(response => {
|
|
986
|
+
if ((response.records === undefined) || (response.records.length <= 0)) {
|
|
987
|
+
throw response;
|
|
988
|
+
}
|
|
989
|
+
const newsRecord = response.records[0];
|
|
990
|
+
if (!newsRecord.active) {
|
|
991
|
+
throw response;
|
|
992
|
+
}
|
|
993
|
+
return this.processNewsArticle(newsRecord);
|
|
994
|
+
}));
|
|
995
|
+
}
|
|
996
|
+
getNewsArticles(options) {
|
|
997
|
+
let params = new HttpParams();
|
|
998
|
+
if (options.news_group_id) {
|
|
999
|
+
params = params.set('news_group_id', options.news_group_id.toString());
|
|
1000
|
+
}
|
|
1001
|
+
else if (options.news_group_sef) {
|
|
1002
|
+
params = params.set('news_group_sef', options.news_group_sef.toString());
|
|
1003
|
+
}
|
|
1004
|
+
if (options.page) {
|
|
1005
|
+
params = params.set('page', options.page.toString());
|
|
1006
|
+
}
|
|
1007
|
+
if (options.rows) {
|
|
1008
|
+
params = params.set('rows', options.rows.toString());
|
|
1009
|
+
}
|
|
1010
|
+
if (options.feature_only) {
|
|
1011
|
+
params = params.set('feature_only', options.feature_only.toString());
|
|
1012
|
+
}
|
|
1013
|
+
if (options.manufacturers_id) {
|
|
1014
|
+
params = params.set('manufacturers_id', options.manufacturers_id.toString());
|
|
1015
|
+
}
|
|
1016
|
+
if (options.ranges_id) {
|
|
1017
|
+
params = params.set('ranges_id', options.ranges_id.toString());
|
|
1018
|
+
}
|
|
1019
|
+
if (options.from_date) {
|
|
1020
|
+
params = params.set('from_date', options.from_date.toString());
|
|
1021
|
+
}
|
|
1022
|
+
if (options.to_date) {
|
|
1023
|
+
params = params.set('to_date', options.to_date.toString());
|
|
1024
|
+
}
|
|
1025
|
+
return this.getNewsRecords(params).pipe(map(response => {
|
|
1026
|
+
if (response.records === undefined) {
|
|
1027
|
+
throw response;
|
|
1028
|
+
}
|
|
1029
|
+
const newsArticles = [];
|
|
1030
|
+
response.records.forEach(newsArticleRecord => {
|
|
1031
|
+
newsArticles.push(this.processNewsArticle(newsArticleRecord));
|
|
1032
|
+
});
|
|
1033
|
+
return new EsolveNewsArticleList(newsArticles, response.additional_data.total_records, options.page || 0);
|
|
1034
|
+
}));
|
|
1035
|
+
}
|
|
1036
|
+
getNewsGroups() {
|
|
1037
|
+
let params = new HttpParams();
|
|
1038
|
+
params = params.set('ws_id', this.config.wsid);
|
|
1039
|
+
return this.http.get(`${this.config.api_url}/service/get-news-groups.php`, { params }).pipe(map(response => {
|
|
1040
|
+
if (response.records === undefined) {
|
|
1041
|
+
throw response;
|
|
1042
|
+
}
|
|
1043
|
+
const newsGroups = [];
|
|
1044
|
+
response.records.forEach(newsGroupRecord => {
|
|
1045
|
+
newsGroups.push(new EsolveNewsGroup(newsGroupRecord.id, newsGroupRecord.name, newsGroupRecord.description, newsGroupRecord.sef_name));
|
|
1046
|
+
});
|
|
1047
|
+
return newsGroups;
|
|
1048
|
+
}));
|
|
1049
|
+
}
|
|
1050
|
+
processNewsArticle(newsRecord) {
|
|
1051
|
+
const author = new EsolveNewsArticleAuthor(newsRecord.user.userid, newsRecord.user.email, newsRecord.user.firstname, newsRecord.user.surname);
|
|
1052
|
+
return new EsolveNewsArticle(newsRecord.id, newsRecord.title, newsRecord.sef_title, newsRecord.article, newsRecord.short_description, newsRecord.txdate, newsRecord.active, newsRecord.image, newsRecord.featured, author, newsRecord.seo_page_title, newsRecord.seo_keywords);
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
EsolveNewsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveNewsService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1056
|
+
EsolveNewsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveNewsService, providedIn: 'root' });
|
|
1057
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveNewsService, decorators: [{
|
|
1058
|
+
type: Injectable,
|
|
1059
|
+
args: [{
|
|
1060
|
+
providedIn: 'root'
|
|
1061
|
+
}]
|
|
1062
|
+
}], ctorParameters: function () {
|
|
1063
|
+
return [{ type: undefined, decorators: [{
|
|
1064
|
+
type: Inject,
|
|
1065
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
1066
|
+
}] }, { type: i1$1.HttpClient }];
|
|
1067
|
+
} });
|
|
1068
|
+
|
|
1069
|
+
class EsolveBanner {
|
|
1070
|
+
constructor(id, banner_display_container, identifier, type, title, article, sort_priority, link, images) {
|
|
1071
|
+
this.id = id;
|
|
1072
|
+
this.banner_display_container = banner_display_container;
|
|
1073
|
+
this.identifier = identifier;
|
|
1074
|
+
this.type = type;
|
|
1075
|
+
this.title = title;
|
|
1076
|
+
this.article = article;
|
|
1077
|
+
this.sort_priority = sort_priority;
|
|
1078
|
+
this.link = link;
|
|
1079
|
+
this.desktop_images = [];
|
|
1080
|
+
this.mobile_images = [];
|
|
1081
|
+
this.sub_images = [];
|
|
1082
|
+
if (images.desktop) {
|
|
1083
|
+
this.desktop_images = images.desktop;
|
|
1084
|
+
}
|
|
1085
|
+
if (images.mobile) {
|
|
1086
|
+
this.mobile_images = images.mobile;
|
|
1087
|
+
}
|
|
1088
|
+
if (images.sub) {
|
|
1089
|
+
this.sub_images = images.sub;
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
class EsolveBannerImage {
|
|
1095
|
+
constructor(id, image_type, width, height, filename, hotspots) {
|
|
1096
|
+
this.id = id;
|
|
1097
|
+
this.image_type = image_type;
|
|
1098
|
+
this.width = width;
|
|
1099
|
+
this.height = height;
|
|
1100
|
+
this.filename = filename;
|
|
1101
|
+
this.hotspots = hotspots;
|
|
1102
|
+
}
|
|
1103
|
+
get src() {
|
|
1104
|
+
return '/images/banners/' + this.filename;
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
class EsolveBannerImageHotspot {
|
|
1109
|
+
constructor(url, target, coords, coords_string) {
|
|
1110
|
+
this.url = url;
|
|
1111
|
+
this.target = target;
|
|
1112
|
+
this.coords = coords;
|
|
1113
|
+
this.coords_string = coords_string;
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
class EsolveBannerService {
|
|
1118
|
+
constructor(config, http) {
|
|
1119
|
+
this.config = config;
|
|
1120
|
+
this.http = http;
|
|
1121
|
+
}
|
|
1122
|
+
processBannerImageHotspots(hotspot_records) {
|
|
1123
|
+
const hotspots = [];
|
|
1124
|
+
if (hotspot_records.length > 0) {
|
|
1125
|
+
for (const hotspot_record of hotspot_records) {
|
|
1126
|
+
const hotspot = new EsolveBannerImageHotspot(hotspot_record.url, hotspot_record.target, hotspot_record.coords, hotspot_record.coords_string);
|
|
1127
|
+
hotspots.push(hotspot);
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
return hotspots;
|
|
1131
|
+
}
|
|
1132
|
+
processBannerImages(image_records, banner_type) {
|
|
1133
|
+
const images = [];
|
|
1134
|
+
if (image_records.length > 0) {
|
|
1135
|
+
for (const image_record of image_records) {
|
|
1136
|
+
const image = new EsolveBannerImage(+image_record.id, image_record.image_type, +image_record.width, +image_record.height, image_record.filename);
|
|
1137
|
+
if ((banner_type === 'hotspot') && (image_record.hotspots)) {
|
|
1138
|
+
const hotspots = this.processBannerImageHotspots(image_record.hotspots);
|
|
1139
|
+
image.hotspots = hotspots;
|
|
1140
|
+
}
|
|
1141
|
+
images.push(image);
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
return images;
|
|
1145
|
+
}
|
|
1146
|
+
/**
|
|
1147
|
+
* Process banner records into banner objects
|
|
1148
|
+
* @param records Array of records
|
|
1149
|
+
* @returns List of banners
|
|
1150
|
+
*/
|
|
1151
|
+
processBanners(records) {
|
|
1152
|
+
const banners = [];
|
|
1153
|
+
if ((records) && (records.length > 0)) {
|
|
1154
|
+
for (const record of records) {
|
|
1155
|
+
const image_sets = {};
|
|
1156
|
+
if (record.images.desktop) {
|
|
1157
|
+
image_sets.desktop = this.processBannerImages(record.images.desktop, record.type);
|
|
1158
|
+
}
|
|
1159
|
+
if (record.images.mobile) {
|
|
1160
|
+
image_sets.mobile = this.processBannerImages(record.images.mobile, record.type);
|
|
1161
|
+
}
|
|
1162
|
+
if (record.images.sub) {
|
|
1163
|
+
image_sets.sub = this.processBannerImages(record.images.sub, record.type);
|
|
1164
|
+
}
|
|
1165
|
+
const banner = new EsolveBanner(+record.id, record.banner_display_container, record.identifier, record.type, record.title, record.article, +record.sort_priority, {
|
|
1166
|
+
url: record.link.url,
|
|
1167
|
+
target: record.link.target
|
|
1168
|
+
}, image_sets);
|
|
1169
|
+
banners.push(banner);
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
return banners;
|
|
1173
|
+
}
|
|
1174
|
+
/**
|
|
1175
|
+
* Retrieves banners records from eSolve instance
|
|
1176
|
+
*
|
|
1177
|
+
* @returns An observable of eSolve banners.
|
|
1178
|
+
*/
|
|
1179
|
+
getBanners(identifier, banner_display_container, enable_date_filter = false) {
|
|
1180
|
+
let params = new HttpParams({
|
|
1181
|
+
fromObject: {
|
|
1182
|
+
ws_id: this.config.wsid,
|
|
1183
|
+
enable_date_filter
|
|
1184
|
+
}
|
|
1185
|
+
});
|
|
1186
|
+
if (identifier) {
|
|
1187
|
+
params = params.set('identifier', identifier);
|
|
1188
|
+
}
|
|
1189
|
+
if (banner_display_container) {
|
|
1190
|
+
params = params.set('banner_display_container', banner_display_container);
|
|
1191
|
+
}
|
|
1192
|
+
return this.http.get(`${this.config.api_url}/service/get-banners.php`, { params }).pipe(map(response => {
|
|
1193
|
+
if (response.records === undefined) {
|
|
1194
|
+
throw response;
|
|
1195
|
+
}
|
|
1196
|
+
return this.processBanners(response.records);
|
|
1197
|
+
}));
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
EsolveBannerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveBannerService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1201
|
+
EsolveBannerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveBannerService, providedIn: 'root' });
|
|
1202
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveBannerService, decorators: [{
|
|
1203
|
+
type: Injectable,
|
|
1204
|
+
args: [{
|
|
1205
|
+
providedIn: 'root'
|
|
1206
|
+
}]
|
|
1207
|
+
}], ctorParameters: function () {
|
|
1208
|
+
return [{ type: undefined, decorators: [{
|
|
1209
|
+
type: Inject,
|
|
1210
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
1211
|
+
}] }, { type: i1$1.HttpClient }];
|
|
1212
|
+
} });
|
|
1213
|
+
|
|
1214
|
+
class EsolveMenuItem {
|
|
1215
|
+
constructor(url, name, target, children = []) {
|
|
1216
|
+
this.url = url;
|
|
1217
|
+
this.name = name;
|
|
1218
|
+
this.target = target;
|
|
1219
|
+
this.children = children;
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
class EsolveMenuService {
|
|
1224
|
+
constructor(config, http) {
|
|
1225
|
+
this.config = config;
|
|
1226
|
+
this.http = http;
|
|
1227
|
+
}
|
|
1228
|
+
getMenuTree(identifier) {
|
|
1229
|
+
let menuParams = new HttpParams();
|
|
1230
|
+
menuParams = menuParams.set('identifier', identifier);
|
|
1231
|
+
menuParams = menuParams.set('ws_id', this.config.wsid);
|
|
1232
|
+
return this.http.get(`${this.config.api_url}/service/get-menu-tree.php`, { params: menuParams }).pipe(map(response => {
|
|
1233
|
+
if ((!response) || (response.records === undefined)) {
|
|
1234
|
+
throw response;
|
|
1235
|
+
}
|
|
1236
|
+
else if (response.records.length === 0) {
|
|
1237
|
+
return [];
|
|
1238
|
+
}
|
|
1239
|
+
return this.handleMenu(response.records);
|
|
1240
|
+
}));
|
|
1241
|
+
}
|
|
1242
|
+
handleMenu(records) {
|
|
1243
|
+
const menu = [];
|
|
1244
|
+
if (typeof records !== 'undefined') {
|
|
1245
|
+
for (const menuTreeRecord of records) {
|
|
1246
|
+
menu.push(new EsolveMenuItem(menuTreeRecord.sef_url, menuTreeRecord.name, menuTreeRecord.target, this.handleMenu(menuTreeRecord.children)));
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
return menu;
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
EsolveMenuService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMenuService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1253
|
+
EsolveMenuService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMenuService, providedIn: 'root' });
|
|
1254
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMenuService, decorators: [{
|
|
1255
|
+
type: Injectable,
|
|
1256
|
+
args: [{
|
|
1257
|
+
providedIn: 'root'
|
|
1258
|
+
}]
|
|
1259
|
+
}], ctorParameters: function () {
|
|
1260
|
+
return [{ type: undefined, decorators: [{
|
|
1261
|
+
type: Inject,
|
|
1262
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
1263
|
+
}] }, { type: i1$1.HttpClient }];
|
|
1264
|
+
} });
|
|
1265
|
+
|
|
1266
|
+
class EsolveTopicService {
|
|
1267
|
+
constructor(config, http) {
|
|
1268
|
+
this.config = config;
|
|
1269
|
+
this.http = http;
|
|
1270
|
+
}
|
|
1271
|
+
processTopics(records) {
|
|
1272
|
+
const topics = [];
|
|
1273
|
+
if (records) {
|
|
1274
|
+
for (const record of records) {
|
|
1275
|
+
const topic = new EsolveTopic(+record.id, record.name, record.short_description, +record.sort_priority);
|
|
1276
|
+
topics.push(topic);
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
return topics;
|
|
1280
|
+
}
|
|
1281
|
+
/**
|
|
1282
|
+
* Retrieves active topics from the list of topic ID's. Note that inactive or expired
|
|
1283
|
+
* topics will not be retrieved.
|
|
1284
|
+
*
|
|
1285
|
+
* @param topic_id_list List of topic ID's that need to be retrieved
|
|
1286
|
+
*/
|
|
1287
|
+
getTopics(topic_id_list = []) {
|
|
1288
|
+
let params = new HttpParams({
|
|
1289
|
+
fromObject: {
|
|
1290
|
+
ws_id: this.config.wsid
|
|
1291
|
+
}
|
|
1292
|
+
});
|
|
1293
|
+
if (topic_id_list.length > 0) {
|
|
1294
|
+
params = params.append('topic_id', topic_id_list.join(','));
|
|
1295
|
+
}
|
|
1296
|
+
return this.http.get(`${this.config.api_url}/service/get-topics.php`, { params }).pipe(map(response => {
|
|
1297
|
+
if (response.records === undefined) {
|
|
1298
|
+
throw response;
|
|
1299
|
+
}
|
|
1300
|
+
return this.processTopics(response.records);
|
|
1301
|
+
}));
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
EsolveTopicService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveTopicService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1305
|
+
EsolveTopicService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveTopicService, providedIn: 'root' });
|
|
1306
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveTopicService, decorators: [{
|
|
1307
|
+
type: Injectable,
|
|
1308
|
+
args: [{
|
|
1309
|
+
providedIn: 'root'
|
|
1310
|
+
}]
|
|
1311
|
+
}], ctorParameters: function () {
|
|
1312
|
+
return [{ type: undefined, decorators: [{
|
|
1313
|
+
type: Inject,
|
|
1314
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
1315
|
+
}] }, { type: i1$1.HttpClient }];
|
|
1316
|
+
} });
|
|
1317
|
+
|
|
1318
|
+
class EsolveStockBadge {
|
|
1319
|
+
constructor(id, text, identifier, font_colour, badge_colour, sort_priority) {
|
|
1320
|
+
this.id = id;
|
|
1321
|
+
this.text = text;
|
|
1322
|
+
this.identifier = identifier;
|
|
1323
|
+
this.font_colour = font_colour;
|
|
1324
|
+
this.badge_colour = badge_colour;
|
|
1325
|
+
this.sort_priority = sort_priority;
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
/**
|
|
1330
|
+
* Price of eSolve stock item
|
|
1331
|
+
*/
|
|
1332
|
+
class EsolveStockPrice {
|
|
1333
|
+
/**
|
|
1334
|
+
* Create stock price instance
|
|
1335
|
+
* @param base_price Price without tax
|
|
1336
|
+
* @param base_price_with_tax Price with tax
|
|
1337
|
+
* @param sell_price Price without tax and with discounts applied if appilcable
|
|
1338
|
+
* @param sell_price_with_tax Price with tax and with discounts applied if appilcable
|
|
1339
|
+
*/
|
|
1340
|
+
constructor(
|
|
1341
|
+
/**
|
|
1342
|
+
* Price without tax
|
|
1343
|
+
*/
|
|
1344
|
+
base_price,
|
|
1345
|
+
/**
|
|
1346
|
+
* Price with tax
|
|
1347
|
+
*/
|
|
1348
|
+
base_price_with_tax,
|
|
1349
|
+
/**
|
|
1350
|
+
* Price without tax and with discounts applied if appilcable
|
|
1351
|
+
*/
|
|
1352
|
+
sell_price,
|
|
1353
|
+
/**
|
|
1354
|
+
* Price with tax and with discounts applied if appilcable
|
|
1355
|
+
*/
|
|
1356
|
+
sell_price_with_tax) {
|
|
1357
|
+
this.base_price = base_price;
|
|
1358
|
+
this.base_price_with_tax = base_price_with_tax;
|
|
1359
|
+
this.sell_price = sell_price;
|
|
1360
|
+
this.sell_price_with_tax = sell_price_with_tax;
|
|
1361
|
+
if ((this.base_price === 0) && (this.sell_price > 0)) {
|
|
1362
|
+
this.base_price = this.sell_price;
|
|
1363
|
+
this.base_price_with_tax = this.sell_price_with_tax;
|
|
1364
|
+
}
|
|
1365
|
+
else if ((this.base_price > 0) && (this.sell_price === 0)) {
|
|
1366
|
+
this.sell_price = this.base_price;
|
|
1367
|
+
this.sell_price_with_tax = this.base_price_with_tax;
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
/**
|
|
1373
|
+
* Stock Item object. It can be a service or a product (physical and/or digital).
|
|
1374
|
+
*/
|
|
1375
|
+
class EsolveStockItem {
|
|
1376
|
+
/**
|
|
1377
|
+
* Constructs an instance of EsolveStockItem
|
|
1378
|
+
*
|
|
1379
|
+
* @param id eSolve Generated ID
|
|
1380
|
+
* @param code Code identifying the stock item
|
|
1381
|
+
* @param name Name of the stock item
|
|
1382
|
+
* @param sef_name Search engine friendly name
|
|
1383
|
+
* @param description Short description of stock item
|
|
1384
|
+
* @param active Active state
|
|
1385
|
+
* @param featured Featured state
|
|
1386
|
+
* @param image_name Image filename
|
|
1387
|
+
* @param price Default price
|
|
1388
|
+
* @param tags Linked tags
|
|
1389
|
+
* @param topics Linked topics
|
|
1390
|
+
* @param seo_title SEO page title
|
|
1391
|
+
* @param seo_keywords SEO page keywords
|
|
1392
|
+
*/
|
|
1393
|
+
constructor(
|
|
1394
|
+
/**
|
|
1395
|
+
* eSolve Generated ID
|
|
1396
|
+
*/
|
|
1397
|
+
id,
|
|
1398
|
+
/**
|
|
1399
|
+
* Code identifying the stock item
|
|
1400
|
+
*/
|
|
1401
|
+
code,
|
|
1402
|
+
/**
|
|
1403
|
+
* Name of the stock item
|
|
1404
|
+
*/
|
|
1405
|
+
name,
|
|
1406
|
+
/**
|
|
1407
|
+
* Search engine friendly name
|
|
1408
|
+
*/
|
|
1409
|
+
sef_name,
|
|
1410
|
+
/**
|
|
1411
|
+
* Short description of stock item
|
|
1412
|
+
*/
|
|
1413
|
+
description,
|
|
1414
|
+
/**
|
|
1415
|
+
* Active state
|
|
1416
|
+
*/
|
|
1417
|
+
active,
|
|
1418
|
+
/**
|
|
1419
|
+
* Featured state
|
|
1420
|
+
*/
|
|
1421
|
+
featured,
|
|
1422
|
+
/**
|
|
1423
|
+
* Image filename
|
|
1424
|
+
*/
|
|
1425
|
+
image_name,
|
|
1426
|
+
/**
|
|
1427
|
+
* Default price
|
|
1428
|
+
*/
|
|
1429
|
+
price,
|
|
1430
|
+
/**
|
|
1431
|
+
* Linked tags
|
|
1432
|
+
*/
|
|
1433
|
+
tags,
|
|
1434
|
+
/**
|
|
1435
|
+
* Linked topics
|
|
1436
|
+
*/
|
|
1437
|
+
topics,
|
|
1438
|
+
/**
|
|
1439
|
+
* Stock badges
|
|
1440
|
+
*/
|
|
1441
|
+
badges,
|
|
1442
|
+
/**
|
|
1443
|
+
* ID of default category linked to the stock item
|
|
1444
|
+
*/
|
|
1445
|
+
category_id,
|
|
1446
|
+
/**
|
|
1447
|
+
* ID of default subcategory linked to the stock item
|
|
1448
|
+
*/
|
|
1449
|
+
subcategory_id, seo_title = '', seo_keywords = '') {
|
|
1450
|
+
this.id = id;
|
|
1451
|
+
this.code = code;
|
|
1452
|
+
this.name = name;
|
|
1453
|
+
this.sef_name = sef_name;
|
|
1454
|
+
this.description = description;
|
|
1455
|
+
this.active = active;
|
|
1456
|
+
this.featured = featured;
|
|
1457
|
+
this.image_name = image_name;
|
|
1458
|
+
this.price = price;
|
|
1459
|
+
this.tags = tags;
|
|
1460
|
+
this.topics = topics;
|
|
1461
|
+
this.badges = badges;
|
|
1462
|
+
this.category_id = category_id;
|
|
1463
|
+
this.subcategory_id = subcategory_id;
|
|
1464
|
+
if (seo_title.trim() === '') {
|
|
1465
|
+
seo_title = this.name;
|
|
1466
|
+
}
|
|
1467
|
+
this.seo_details = new EsolveSEOInfo(seo_title, description, seo_keywords);
|
|
1468
|
+
}
|
|
1469
|
+
/**
|
|
1470
|
+
* Path to tiny stock image
|
|
1471
|
+
*/
|
|
1472
|
+
get tiny_image_src() {
|
|
1473
|
+
return '/images/' + (this.image_name ? 'stock/tiny/' + this.image_name : 'no_image.jpg');
|
|
1474
|
+
}
|
|
1475
|
+
/**
|
|
1476
|
+
* Path to thumbnail stock image
|
|
1477
|
+
*/
|
|
1478
|
+
get thumbnail_image_src() {
|
|
1479
|
+
return '/images/' + (this.image_name ? 'stock/thumb/' + this.image_name : 'no_image.jpg');
|
|
1480
|
+
}
|
|
1481
|
+
/**
|
|
1482
|
+
* Path to small stock image
|
|
1483
|
+
*/
|
|
1484
|
+
get small_image_src() {
|
|
1485
|
+
return '/images/' + (this.image_name ? 'stock/small/' + this.image_name : 'no_image.jpg');
|
|
1486
|
+
}
|
|
1487
|
+
/**
|
|
1488
|
+
* Path to big stock image
|
|
1489
|
+
*/
|
|
1490
|
+
get big_image_src() {
|
|
1491
|
+
return '/images/' + (this.image_name ? 'stock/big/' + this.image_name : 'no_image.jpg');
|
|
1492
|
+
}
|
|
1493
|
+
/**
|
|
1494
|
+
* Path to original stock image
|
|
1495
|
+
*/
|
|
1496
|
+
get original_image_src() {
|
|
1497
|
+
return '/images/' + (this.image_name ? 'stock/original/' + this.image_name : 'no_image.jpg');
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
/**
|
|
1502
|
+
* Stock item object list
|
|
1503
|
+
*/
|
|
1504
|
+
class EsolveStockItemList {
|
|
1505
|
+
constructor(stock_items, total, page) {
|
|
1506
|
+
this.stock_items = stock_items;
|
|
1507
|
+
this.total = total;
|
|
1508
|
+
this.page = page;
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
class EsolveStockService {
|
|
1513
|
+
constructor(config, http) {
|
|
1514
|
+
this.config = config;
|
|
1515
|
+
this.http = http;
|
|
1516
|
+
}
|
|
1517
|
+
/**
|
|
1518
|
+
* Processes the eSolve stock item record and converts it to StockItem object.
|
|
1519
|
+
* @param record eSolve stock item record
|
|
1520
|
+
*/
|
|
1521
|
+
processStockItem(record) {
|
|
1522
|
+
const tags = [];
|
|
1523
|
+
const topics = [];
|
|
1524
|
+
const badges = [];
|
|
1525
|
+
if ((record.tags) && (record.tags.length > 0)) {
|
|
1526
|
+
for (const tag of record.tags) {
|
|
1527
|
+
tags.push(new EsolveTag(+tag.id, tag.tag_phrase, +tag.tag_weight, tag.description));
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
if ((record.topics) && (record.topics.length > 0)) {
|
|
1531
|
+
for (const topic of record.topics) {
|
|
1532
|
+
topics.push(new EsolveTopic(+topic.id, topic.name, topic.short_description, +topic.sort_priority));
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
if ((record.badges) && (record.badges.length > 0)) {
|
|
1536
|
+
for (const badge of record.badges) {
|
|
1537
|
+
badges.push(new EsolveStockBadge(+badge.id, badge.text, badge.identifier, badge.font_colour, badge.badge_colour, +badge.sort_priority));
|
|
1538
|
+
}
|
|
1539
|
+
}
|
|
1540
|
+
const price = new EsolveStockPrice(record.regular_sellprice, record.regular_sellprice_inclusive, record.sellprice, record.sellprice_inclusive);
|
|
1541
|
+
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);
|
|
1542
|
+
}
|
|
1543
|
+
/**
|
|
1544
|
+
* Retrieves stock records from HTTP params.
|
|
1545
|
+
* @param params HTTP client parameters
|
|
1546
|
+
*/
|
|
1547
|
+
getStockRecords(params) {
|
|
1548
|
+
params = params.set('ws_id', this.config.wsid);
|
|
1549
|
+
return this.http.get(`${this.config.api_url}/service/get-items.php`, { params });
|
|
1550
|
+
}
|
|
1551
|
+
/**
|
|
1552
|
+
* Retrieves the stock record from the eSolve instance using the code.
|
|
1553
|
+
* @param code eSolve stock code
|
|
1554
|
+
*/
|
|
1555
|
+
getStockItem(code) {
|
|
1556
|
+
const params = new HttpParams({
|
|
1557
|
+
fromObject: {
|
|
1558
|
+
code
|
|
1559
|
+
}
|
|
1560
|
+
});
|
|
1561
|
+
return this.getStockRecords(params).pipe(map(response => {
|
|
1562
|
+
if ((response.records === undefined) || (response.records.length <= 0)) {
|
|
1563
|
+
throw response;
|
|
1564
|
+
}
|
|
1565
|
+
const stockRecord = response.records[0];
|
|
1566
|
+
return this.processStockItem(stockRecord);
|
|
1567
|
+
}));
|
|
1568
|
+
}
|
|
1569
|
+
/**
|
|
1570
|
+
* Retrieves the stock record from the eSolve instance using the SEF name.
|
|
1571
|
+
* @param sef_name SEF name of the stock item
|
|
1572
|
+
*/
|
|
1573
|
+
getStockItemFromSEF(sef_name) {
|
|
1574
|
+
const params = new HttpParams({
|
|
1575
|
+
fromObject: {
|
|
1576
|
+
sef_name
|
|
1577
|
+
}
|
|
1578
|
+
});
|
|
1579
|
+
return this.getStockRecords(params).pipe(map(response => {
|
|
1580
|
+
if ((response.records === undefined) || (response.records.length <= 0)) {
|
|
1581
|
+
throw response;
|
|
1582
|
+
}
|
|
1583
|
+
const stockRecord = response.records[0];
|
|
1584
|
+
return this.processStockItem(stockRecord);
|
|
1585
|
+
}));
|
|
1586
|
+
}
|
|
1587
|
+
/**
|
|
1588
|
+
* Retrieves list of stock from the eSolve instance using info provided
|
|
1589
|
+
* @param options Stock filter options
|
|
1590
|
+
*/
|
|
1591
|
+
getStockItems(options) {
|
|
1592
|
+
let params = new HttpParams();
|
|
1593
|
+
if (options.page) {
|
|
1594
|
+
params = params.set('page', options.page);
|
|
1595
|
+
}
|
|
1596
|
+
if (options.rows) {
|
|
1597
|
+
params = params.set('rows', options.rows);
|
|
1598
|
+
}
|
|
1599
|
+
if (options.display_only) {
|
|
1600
|
+
params = params.set('display_only', options.display_only);
|
|
1601
|
+
}
|
|
1602
|
+
if (options.is_active) {
|
|
1603
|
+
params = params.set('is_active', options.is_active);
|
|
1604
|
+
}
|
|
1605
|
+
if (options.category_id) {
|
|
1606
|
+
params = params.set('category_id', options.category_id);
|
|
1607
|
+
}
|
|
1608
|
+
if (options.subcategory_id) {
|
|
1609
|
+
params = params.set('subcategory_id', options.subcategory_id);
|
|
1610
|
+
}
|
|
1611
|
+
if (options.tag_id_list) {
|
|
1612
|
+
if (options.tag_id_list.length > 0) {
|
|
1613
|
+
params = params.set('tag_id', options.tag_id_list.join(','));
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
if (options.topic_id_list) {
|
|
1617
|
+
if (options.topic_id_list.length > 0) {
|
|
1618
|
+
params = params.set('topic_id', options.topic_id_list.join(','));
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
return this.getStockRecords(params).pipe(map(response => {
|
|
1622
|
+
var _a;
|
|
1623
|
+
if ((response.records === undefined) || (response.records.length <= 0)) {
|
|
1624
|
+
throw response;
|
|
1625
|
+
}
|
|
1626
|
+
const stockItems = [];
|
|
1627
|
+
response.records.forEach(stockRecord => {
|
|
1628
|
+
stockItems.push(this.processStockItem(stockRecord));
|
|
1629
|
+
});
|
|
1630
|
+
return new EsolveStockItemList(stockItems, +response.additional_data.total_records, (_a = options.page) !== null && _a !== void 0 ? _a : 0);
|
|
1631
|
+
}));
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
EsolveStockService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveStockService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1635
|
+
EsolveStockService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveStockService, providedIn: 'root' });
|
|
1636
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveStockService, decorators: [{
|
|
1637
|
+
type: Injectable,
|
|
1638
|
+
args: [{
|
|
1639
|
+
providedIn: 'root'
|
|
1640
|
+
}]
|
|
1641
|
+
}], ctorParameters: function () {
|
|
1642
|
+
return [{ type: undefined, decorators: [{
|
|
1643
|
+
type: Inject,
|
|
1644
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
1645
|
+
}] }, { type: i1$1.HttpClient }];
|
|
1646
|
+
} });
|
|
1647
|
+
|
|
1648
|
+
class EsolveCategoryTreeItem {
|
|
1649
|
+
constructor(type, esolve_id, parent_id, description, sef_description, short_description, sort_priority, active, display_only, image_name, seo_title, seo_keywords, seo_description, children) {
|
|
1650
|
+
this.type = type;
|
|
1651
|
+
this.esolve_id = esolve_id;
|
|
1652
|
+
this.parent_id = parent_id;
|
|
1653
|
+
this.description = description;
|
|
1654
|
+
this.sef_description = sef_description;
|
|
1655
|
+
this.short_description = short_description;
|
|
1656
|
+
this.sort_priority = sort_priority;
|
|
1657
|
+
this.active = active;
|
|
1658
|
+
this.display_only = display_only;
|
|
1659
|
+
this.image_name = image_name;
|
|
1660
|
+
this.image_path = '';
|
|
1661
|
+
this.id = '';
|
|
1662
|
+
if (this.type === 'category') {
|
|
1663
|
+
this.id = `<<CAT>>${this.esolve_id}`;
|
|
1664
|
+
if (children != null) {
|
|
1665
|
+
this.children = children;
|
|
1666
|
+
}
|
|
1667
|
+
this.image_path = '/images/categories/';
|
|
1668
|
+
}
|
|
1669
|
+
else {
|
|
1670
|
+
this.id = `<<SUB>>${this.esolve_id}`;
|
|
1671
|
+
this.image_path = '/images/subcategories/';
|
|
1672
|
+
}
|
|
1673
|
+
if (seo_title.trim() === '') {
|
|
1674
|
+
seo_title = this.description;
|
|
1675
|
+
}
|
|
1676
|
+
this.seo_details = new EsolveSEOInfo(seo_title, seo_description, seo_keywords);
|
|
1677
|
+
}
|
|
1678
|
+
generateImagePath(image_size) {
|
|
1679
|
+
if (this.image_name !== '') {
|
|
1680
|
+
return `${this.image_path}${image_size}/${this.image_name}`;
|
|
1681
|
+
}
|
|
1682
|
+
return '';
|
|
1683
|
+
}
|
|
1684
|
+
get small_image_src() {
|
|
1685
|
+
return this.generateImagePath('small');
|
|
1686
|
+
}
|
|
1687
|
+
get thumbnail_image_src() {
|
|
1688
|
+
return this.generateImagePath('thumb');
|
|
1689
|
+
}
|
|
1690
|
+
get tiny_image_src() {
|
|
1691
|
+
return this.generateImagePath('tiny');
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1695
|
+
class EsolveCategoryTreeService {
|
|
1696
|
+
constructor(config, http) {
|
|
1697
|
+
this.config = config;
|
|
1698
|
+
this.http = http;
|
|
1699
|
+
}
|
|
1700
|
+
/**
|
|
1701
|
+
* Processes the eSolve tree records and converts them into the correct format.
|
|
1702
|
+
* @param tree_records Records to process
|
|
1703
|
+
*/
|
|
1704
|
+
processTree(tree_records) {
|
|
1705
|
+
const tree_items = [];
|
|
1706
|
+
if (tree_records) {
|
|
1707
|
+
for (const tree_record of tree_records) {
|
|
1708
|
+
let esolve_id = '';
|
|
1709
|
+
let parent_id = '';
|
|
1710
|
+
let children = [];
|
|
1711
|
+
if (tree_record.type === 'category') {
|
|
1712
|
+
children = this.processTree(tree_record.children);
|
|
1713
|
+
esolve_id = tree_record.menu_id;
|
|
1714
|
+
parent_id = tree_record.owner_menu_id;
|
|
1715
|
+
}
|
|
1716
|
+
else {
|
|
1717
|
+
esolve_id = tree_record.id;
|
|
1718
|
+
parent_id = tree_record.menu_id;
|
|
1719
|
+
}
|
|
1720
|
+
tree_items.push(new EsolveCategoryTreeItem(tree_record.type, esolve_id, parent_id, tree_record.description, tree_record.sef_description, tree_record.seo_description, tree_record.sort_priority, tree_record.active, tree_record.display_only, tree_record.image, tree_record.seo_page_title, tree_record.seo_keywords, tree_record.short_description, children));
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
return tree_items;
|
|
1724
|
+
}
|
|
1725
|
+
processTreeItem(record) {
|
|
1726
|
+
return new EsolveCategoryTreeItem(record.type, record.id, record.parent_id, record.description, record.sef_description, record.short_description, record.sort_priority, record.active, record.display_only, '', record.seo_page_title, record.seo_keywords, record.seo_description);
|
|
1727
|
+
}
|
|
1728
|
+
processID(id) {
|
|
1729
|
+
let type;
|
|
1730
|
+
let esolve_id;
|
|
1731
|
+
const type_code_regex = /^\<\<(CAT|SUB)\>\>/g;
|
|
1732
|
+
const match_results = id.match(type_code_regex);
|
|
1733
|
+
if (match_results) {
|
|
1734
|
+
const type_code = match_results[0];
|
|
1735
|
+
type = (type_code === '<<CAT>>' ? 'category' : 'subcategory');
|
|
1736
|
+
esolve_id = id.replace(type_code_regex, '');
|
|
1737
|
+
return {
|
|
1738
|
+
type,
|
|
1739
|
+
esolve_id
|
|
1740
|
+
};
|
|
1741
|
+
}
|
|
1742
|
+
return null;
|
|
1743
|
+
}
|
|
1744
|
+
/**
|
|
1745
|
+
* Retrieves the category tree from eSolve instance and coverts it to the correct format.
|
|
1746
|
+
*/
|
|
1747
|
+
getCategoryTree() {
|
|
1748
|
+
let params = new HttpParams();
|
|
1749
|
+
params = params.set('ws_id', this.config.wsid);
|
|
1750
|
+
return this.http.get(`${this.config.api_url}/service/get-tree.php`, { params }).pipe(map(response => {
|
|
1751
|
+
if (response.records === undefined) {
|
|
1752
|
+
throw response;
|
|
1753
|
+
}
|
|
1754
|
+
return this.processTree(response.records);
|
|
1755
|
+
}));
|
|
1756
|
+
}
|
|
1757
|
+
/**
|
|
1758
|
+
* Retrieve the details of a category tree item from the eSolve instance and converts it to the correct format.
|
|
1759
|
+
* @param options Filter options
|
|
1760
|
+
*/
|
|
1761
|
+
getCategoryTreeItem(options) {
|
|
1762
|
+
let type;
|
|
1763
|
+
let esolve_id;
|
|
1764
|
+
let sef_description;
|
|
1765
|
+
if (options.id) {
|
|
1766
|
+
const categoryIdentifier = this.processID(options.id);
|
|
1767
|
+
if (categoryIdentifier) {
|
|
1768
|
+
type = categoryIdentifier.type;
|
|
1769
|
+
esolve_id = categoryIdentifier.esolve_id;
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
else if (options.type) {
|
|
1773
|
+
type = options.type;
|
|
1774
|
+
if (options.esolve_id) {
|
|
1775
|
+
esolve_id = options.esolve_id;
|
|
1776
|
+
}
|
|
1777
|
+
else if (options.sef_description) {
|
|
1778
|
+
sef_description = options.sef_description;
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
if (type && (esolve_id || sef_description)) {
|
|
1782
|
+
let params = new HttpParams();
|
|
1783
|
+
params = params.set('ws_id', this.config.wsid.toString());
|
|
1784
|
+
params = params.set('type', type.toString());
|
|
1785
|
+
if (esolve_id) {
|
|
1786
|
+
params = params.set('id', esolve_id.toString());
|
|
1787
|
+
}
|
|
1788
|
+
if (sef_description) {
|
|
1789
|
+
params = params.set('sef_description', sef_description.toString());
|
|
1790
|
+
}
|
|
1791
|
+
return this.http.get(`${this.config.api_url}/service/get-tree-item.php`, { params }).pipe(map(response => {
|
|
1792
|
+
if ((response.records === undefined) || (response.records.length <= 0)) {
|
|
1793
|
+
throw response;
|
|
1794
|
+
}
|
|
1795
|
+
return this.processTreeItem(response.records[0]);
|
|
1796
|
+
}));
|
|
1797
|
+
}
|
|
1798
|
+
return throwError('Invalid options');
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
EsolveCategoryTreeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCategoryTreeService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1802
|
+
EsolveCategoryTreeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCategoryTreeService, providedIn: 'root' });
|
|
1803
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCategoryTreeService, decorators: [{
|
|
1804
|
+
type: Injectable,
|
|
1805
|
+
args: [{
|
|
1806
|
+
providedIn: 'root'
|
|
1807
|
+
}]
|
|
1808
|
+
}], ctorParameters: function () {
|
|
1809
|
+
return [{ type: undefined, decorators: [{
|
|
1810
|
+
type: Inject,
|
|
1811
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
1812
|
+
}] }, { type: i1$1.HttpClient }];
|
|
1813
|
+
} });
|
|
1814
|
+
|
|
1815
|
+
class EsolveCartItem {
|
|
1816
|
+
constructor(id, stock_item, qty, type, price, discount, discount_interval, vat_rate, allow_quotes, allow_orders, must_collect, requested_assembly, price_incl, discount_price, discount_price_incl, discount_total, vat_total, total, total_incl) {
|
|
1817
|
+
this.id = id;
|
|
1818
|
+
this.stock_item = stock_item;
|
|
1819
|
+
this.qty = qty;
|
|
1820
|
+
this.type = type;
|
|
1821
|
+
this.price = price;
|
|
1822
|
+
this.discount = discount;
|
|
1823
|
+
this.discount_interval = discount_interval;
|
|
1824
|
+
this.vat_rate = vat_rate;
|
|
1825
|
+
this.allow_quotes = allow_quotes;
|
|
1826
|
+
this.allow_orders = allow_orders;
|
|
1827
|
+
this.must_collect = must_collect;
|
|
1828
|
+
this.requested_assembly = requested_assembly;
|
|
1829
|
+
this.price_incl = price_incl;
|
|
1830
|
+
this.discount_price = discount_price;
|
|
1831
|
+
this.discount_price_incl = discount_price_incl;
|
|
1832
|
+
this.discount_total = discount_total;
|
|
1833
|
+
this.vat_total = vat_total;
|
|
1834
|
+
this.total = total;
|
|
1835
|
+
this.total_incl = total_incl;
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
/**
|
|
1840
|
+
* Totals in cart
|
|
1841
|
+
*/
|
|
1842
|
+
class EsolveCartTotals {
|
|
1843
|
+
constructor(
|
|
1844
|
+
/**
|
|
1845
|
+
* Number of unique records in cart
|
|
1846
|
+
*/
|
|
1847
|
+
records = 0,
|
|
1848
|
+
/**
|
|
1849
|
+
* Total quantity of all items in a cart
|
|
1850
|
+
*/
|
|
1851
|
+
items = 0,
|
|
1852
|
+
/**
|
|
1853
|
+
* Total in cart before discount and VAT is added
|
|
1854
|
+
*/
|
|
1855
|
+
sub_total = 0,
|
|
1856
|
+
/**
|
|
1857
|
+
* Total VAT of all the items in the cart
|
|
1858
|
+
*/
|
|
1859
|
+
vat_total = 0,
|
|
1860
|
+
/**
|
|
1861
|
+
* Total discount of all the item in the cart
|
|
1862
|
+
*/
|
|
1863
|
+
discount_total = 0) {
|
|
1864
|
+
this.records = records;
|
|
1865
|
+
this.items = items;
|
|
1866
|
+
this.sub_total = sub_total;
|
|
1867
|
+
this.vat_total = vat_total;
|
|
1868
|
+
this.discount_total = discount_total;
|
|
1869
|
+
}
|
|
1870
|
+
/**
|
|
1871
|
+
* Grand total of cart which includes discount and VAT (NOTE: shipping and insurance is not included)
|
|
1872
|
+
*/
|
|
1873
|
+
get total() {
|
|
1874
|
+
return this.sub_total + this.vat_total - this.discount_total;
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
class EsolveCheckoutResult extends EsolveResponseResult {
|
|
1879
|
+
constructor(response) {
|
|
1880
|
+
super(response);
|
|
1881
|
+
this.id = 0;
|
|
1882
|
+
this.id = +response.esolve_id;
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
|
|
1886
|
+
class EsolveCartStockItem {
|
|
1887
|
+
constructor(code, name, sef_name, description, active, items_in_pack, delivery_category, image_name) {
|
|
1888
|
+
this.code = code;
|
|
1889
|
+
this.name = name;
|
|
1890
|
+
this.sef_name = sef_name;
|
|
1891
|
+
this.description = description;
|
|
1892
|
+
this.active = active;
|
|
1893
|
+
this.items_in_pack = items_in_pack;
|
|
1894
|
+
this.delivery_category = delivery_category;
|
|
1895
|
+
this.image_name = image_name;
|
|
1896
|
+
}
|
|
1897
|
+
/**
|
|
1898
|
+
* Path to tiny stock image
|
|
1899
|
+
*/
|
|
1900
|
+
get tiny_image_src() {
|
|
1901
|
+
return '/images/' + (this.image_name ? 'stock/tiny/' + this.image_name : 'no_image.jpg');
|
|
1902
|
+
}
|
|
1903
|
+
/**
|
|
1904
|
+
* Path to thumbnail stock image
|
|
1905
|
+
*/
|
|
1906
|
+
get thumbnail_image_src() {
|
|
1907
|
+
return '/images/' + (this.image_name ? 'stock/thumb/' + this.image_name : 'no_image.jpg');
|
|
1908
|
+
}
|
|
1909
|
+
/**
|
|
1910
|
+
* Path to small stock image
|
|
1911
|
+
*/
|
|
1912
|
+
get small_image_src() {
|
|
1913
|
+
return '/images/' + (this.image_name ? 'stock/small/' + this.image_name : 'no_image.jpg');
|
|
1914
|
+
}
|
|
1915
|
+
/**
|
|
1916
|
+
* Path to big stock image
|
|
1917
|
+
*/
|
|
1918
|
+
get big_image_src() {
|
|
1919
|
+
return '/images/' + (this.image_name ? 'stock/big/' + this.image_name : 'no_image.jpg');
|
|
1920
|
+
}
|
|
1921
|
+
/**
|
|
1922
|
+
* Path to original stock image
|
|
1923
|
+
*/
|
|
1924
|
+
get original_image_src() {
|
|
1925
|
+
return 'images/' + (this.image_name ? 'stock/original/' + this.image_name : 'no_image.jpg');
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
|
|
1929
|
+
class EsolveCartService {
|
|
1930
|
+
constructor(config, http, errorHandler, responseHandler) {
|
|
1931
|
+
this.config = config;
|
|
1932
|
+
this.http = http;
|
|
1933
|
+
this.errorHandler = errorHandler;
|
|
1934
|
+
this.responseHandler = responseHandler;
|
|
1935
|
+
this._cached_tracking = 0;
|
|
1936
|
+
}
|
|
1937
|
+
/**
|
|
1938
|
+
* Processes the eSolve tree records.
|
|
1939
|
+
* @param cart_item_records Records to process
|
|
1940
|
+
* @returns An array of processed cart items
|
|
1941
|
+
*/
|
|
1942
|
+
processCart(cart_item_records) {
|
|
1943
|
+
const cart_items = [];
|
|
1944
|
+
if (cart_item_records) {
|
|
1945
|
+
for (const cart_item_record of cart_item_records) {
|
|
1946
|
+
const cart_stock_item = new EsolveCartStockItem(cart_item_record.code, cart_item_record.name, cart_item_record.sef_name, cart_item_record.description, cart_item_record.is_active, +cart_item_record.items_in_pack, cart_item_record.delivery_category, cart_item_record.image_name);
|
|
1947
|
+
cart_items.push(new EsolveCartItem(+cart_item_record.id, cart_stock_item, +cart_item_record.qty, cart_item_record.type, +cart_item_record.price, +cart_item_record.discount, +cart_item_record.discount_interval, cart_item_record.vat_rate, cart_item_record.allow_quotes, cart_item_record.allow_orders, cart_item_record.must_collect, cart_item_record.requested_assembly, +cart_item_record.price_incl, +cart_item_record.discount_price, +cart_item_record.discount_price_incl, +cart_item_record.discount_total, +cart_item_record.vat_total, +cart_item_record.line_total, +cart_item_record.line_total_incl));
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
return cart_items;
|
|
1951
|
+
}
|
|
1952
|
+
/**
|
|
1953
|
+
* Processes the eSolve cart totals
|
|
1954
|
+
* @param record Data to process
|
|
1955
|
+
* @returns Processed cart totals
|
|
1956
|
+
*/
|
|
1957
|
+
processCartTotals(record) {
|
|
1958
|
+
const cart_totals = new EsolveCartTotals(+record.records, +record.items, +record.total, +record.vat, +record.discount);
|
|
1959
|
+
return cart_totals;
|
|
1960
|
+
}
|
|
1961
|
+
/**
|
|
1962
|
+
* Retrieves the current cart
|
|
1963
|
+
* @returns An `Observable` with an array of cart items
|
|
1964
|
+
*/
|
|
1965
|
+
getCart() {
|
|
1966
|
+
return this.http.get(`${this.config.api_url}/service/get-cart.php`, {
|
|
1967
|
+
params: {
|
|
1968
|
+
ws_id: this.config.wsid
|
|
1969
|
+
}
|
|
1970
|
+
}).pipe(map(response => {
|
|
1971
|
+
if (response.records === undefined) {
|
|
1972
|
+
throw response;
|
|
1973
|
+
}
|
|
1974
|
+
return this.processCart(response.records);
|
|
1975
|
+
}));
|
|
1976
|
+
}
|
|
1977
|
+
/**
|
|
1978
|
+
* Updates the cart by preforming various actions, such as adding, editing or removing items from the cart.
|
|
1979
|
+
* @param items An array of options to update the cart
|
|
1980
|
+
* @param action The default action to preform
|
|
1981
|
+
* @returns An `Observable` with an array of responses that gives feedback on the requested changes
|
|
1982
|
+
*/
|
|
1983
|
+
setCart(items, action = 'add') {
|
|
1984
|
+
const body = {
|
|
1985
|
+
items,
|
|
1986
|
+
action
|
|
1987
|
+
};
|
|
1988
|
+
return this.http.post(`${this.config.api_url}/service/set-cart-item.php`, body, {
|
|
1989
|
+
headers: {
|
|
1990
|
+
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
|
|
1991
|
+
},
|
|
1992
|
+
params: {
|
|
1993
|
+
ws_id: this.config.wsid
|
|
1994
|
+
},
|
|
1995
|
+
responseType: 'json',
|
|
1996
|
+
observe: 'body'
|
|
1997
|
+
}).pipe(map(response => {
|
|
1998
|
+
if (response.responses === undefined) {
|
|
1999
|
+
throw response;
|
|
2000
|
+
}
|
|
2001
|
+
return response.responses;
|
|
2002
|
+
}));
|
|
2003
|
+
}
|
|
2004
|
+
/**
|
|
2005
|
+
* Retrieves the totals of the cart with all the totals calculated
|
|
2006
|
+
* @returns An `Observable` with an object containing cart totals
|
|
2007
|
+
*/
|
|
2008
|
+
getTotals() {
|
|
2009
|
+
return this.http.get(`${this.config.api_url}/service/get-cart-totals.php`, {
|
|
2010
|
+
params: {
|
|
2011
|
+
ws_id: this.config.wsid
|
|
2012
|
+
}
|
|
2013
|
+
}).pipe(map(response => {
|
|
2014
|
+
if (response.records === undefined) {
|
|
2015
|
+
throw response;
|
|
2016
|
+
}
|
|
2017
|
+
return this.processCartTotals(response.records);
|
|
2018
|
+
}));
|
|
2019
|
+
}
|
|
2020
|
+
/**
|
|
2021
|
+
* Retrieves a tracking code for the cart
|
|
2022
|
+
* @returns An `Observable` with the cart tracking code
|
|
2023
|
+
*/
|
|
2024
|
+
getTrackingCode() {
|
|
2025
|
+
return iif(() => this._cached_tracking > 0, of(this._cached_tracking), this.http.get(`${this.config.api_url}/service/get-checkout-tracking.php`, {
|
|
2026
|
+
params: {
|
|
2027
|
+
ws_id: this.config.wsid
|
|
2028
|
+
}
|
|
2029
|
+
}).pipe(map(response => {
|
|
2030
|
+
if (response.records === undefined) {
|
|
2031
|
+
throw response;
|
|
2032
|
+
}
|
|
2033
|
+
this._cached_tracking = response.records.tracking;
|
|
2034
|
+
return response.records.tracking;
|
|
2035
|
+
})));
|
|
2036
|
+
}
|
|
2037
|
+
/**
|
|
2038
|
+
* Initiates checkout of the cart items
|
|
2039
|
+
* @param type The cart type that needs to be checked out
|
|
2040
|
+
* @param addresses_id The ID of the delivery address
|
|
2041
|
+
* @param shipping_id The ID of the shipping method
|
|
2042
|
+
* @param payment_method_id The ID of the selected payment method
|
|
2043
|
+
* @param location_id The ID of the selected branch from with shipping needs to be calculated
|
|
2044
|
+
* @param comments Additional comments on the cart
|
|
2045
|
+
* @returns An `Observable` with the transaction ID
|
|
2046
|
+
*/
|
|
2047
|
+
checkout(type, addresses_id, shipping_id, payment_method_id = 0, location_id = 0, comments = '') {
|
|
2048
|
+
const body = {
|
|
2049
|
+
type,
|
|
2050
|
+
addresses_id,
|
|
2051
|
+
shipping_id,
|
|
2052
|
+
payment_method_id,
|
|
2053
|
+
location_id,
|
|
2054
|
+
comments,
|
|
2055
|
+
tracking: 0
|
|
2056
|
+
};
|
|
2057
|
+
return this.getTrackingCode().pipe(switchMap((tracking) => {
|
|
2058
|
+
if (tracking <= 0) {
|
|
2059
|
+
throw tracking;
|
|
2060
|
+
}
|
|
2061
|
+
body.tracking = tracking;
|
|
2062
|
+
return this.http.post(`${this.config.api_url}/service/set-checkout.php`, body, {
|
|
2063
|
+
headers: {
|
|
2064
|
+
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
|
|
2065
|
+
},
|
|
2066
|
+
params: {
|
|
2067
|
+
ws_id: this.config.wsid
|
|
2068
|
+
},
|
|
2069
|
+
responseType: 'json',
|
|
2070
|
+
observe: 'body'
|
|
2071
|
+
}).pipe(map(http_response => this.responseHandler.validateSingleHttpResponse(http_response, (response) => new EsolveCheckoutResult(response))), catchError((errorRes) => {
|
|
2072
|
+
return this.errorHandler.handleHttpPostError('set-checkout', errorRes);
|
|
2073
|
+
}));
|
|
2074
|
+
}));
|
|
2075
|
+
}
|
|
2076
|
+
}
|
|
2077
|
+
EsolveCartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCartService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }, { token: EsolveErrorHandlerService }, { token: EsolveResponseHandlerService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2078
|
+
EsolveCartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCartService, providedIn: 'root' });
|
|
2079
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCartService, decorators: [{
|
|
2080
|
+
type: Injectable,
|
|
2081
|
+
args: [{
|
|
2082
|
+
providedIn: 'root'
|
|
2083
|
+
}]
|
|
2084
|
+
}], ctorParameters: function () {
|
|
2085
|
+
return [{ type: undefined, decorators: [{
|
|
2086
|
+
type: Inject,
|
|
2087
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
2088
|
+
}] }, { type: i1$1.HttpClient }, { type: EsolveErrorHandlerService }, { type: EsolveResponseHandlerService }];
|
|
2089
|
+
} });
|
|
2090
|
+
|
|
2091
|
+
class EsolveVaultItemResult extends EsolveResponseResult {
|
|
2092
|
+
constructor(response) {
|
|
2093
|
+
super(response);
|
|
2094
|
+
this.id = +response.esolve_id;
|
|
2095
|
+
if (typeof response.token !== 'undefined') {
|
|
2096
|
+
this.token = response.token;
|
|
2097
|
+
}
|
|
2098
|
+
if (typeof response.card_valid !== 'undefined') {
|
|
2099
|
+
this.card_valid = response.card_valid;
|
|
2100
|
+
}
|
|
2101
|
+
if (typeof response.card_details_validated !== 'undefined') {
|
|
2102
|
+
this.card_details_validated = response.card_details_validated;
|
|
2103
|
+
}
|
|
2104
|
+
if (typeof response.gateway_error_message !== 'undefined') {
|
|
2105
|
+
this.gateway_error_message = response.gateway_error_message;
|
|
2106
|
+
}
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
2109
|
+
|
|
2110
|
+
class EsolveVaultItem {
|
|
2111
|
+
constructor(id, last4, brand, expiry_timestamp) {
|
|
2112
|
+
this.id = id;
|
|
2113
|
+
this.last4 = last4;
|
|
2114
|
+
this.brand = brand;
|
|
2115
|
+
this.expiry = new Date(expiry_timestamp * 1000);
|
|
2116
|
+
}
|
|
2117
|
+
get expiry_month() {
|
|
2118
|
+
const month = this.expiry.getMonth() + 1;
|
|
2119
|
+
return month.toString().padStart(2, '0');
|
|
2120
|
+
}
|
|
2121
|
+
get expiry_year() {
|
|
2122
|
+
return this.expiry.getFullYear();
|
|
2123
|
+
}
|
|
2124
|
+
get masked_number() {
|
|
2125
|
+
return this.last4.padStart(19, '**** ');
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
2128
|
+
|
|
2129
|
+
class EsolvePaymentResult extends EsolveResponseResult {
|
|
2130
|
+
constructor(response) {
|
|
2131
|
+
super(response);
|
|
2132
|
+
if (typeof response.gateway_error_message !== 'undefined') {
|
|
2133
|
+
this.gateway_error_message = response.gateway_error_message;
|
|
2134
|
+
}
|
|
2135
|
+
if (typeof response.three_d_secure !== 'undefined') {
|
|
2136
|
+
this.three_d_secure = response.three_d_secure;
|
|
2137
|
+
}
|
|
2138
|
+
if (typeof response.redirect_url !== 'undefined') {
|
|
2139
|
+
this.redirect_url = response.redirect_url;
|
|
2140
|
+
}
|
|
2141
|
+
if (typeof response.form_inputs !== 'undefined') {
|
|
2142
|
+
this.form_inputs = response.form_inputs;
|
|
2143
|
+
}
|
|
2144
|
+
if (typeof response.form_html !== 'undefined') {
|
|
2145
|
+
this.form_html = response.form_html;
|
|
2146
|
+
}
|
|
2147
|
+
}
|
|
2148
|
+
}
|
|
2149
|
+
|
|
2150
|
+
class EsolvePaymentMethod {
|
|
2151
|
+
constructor(record) {
|
|
2152
|
+
this.id = +record.id;
|
|
2153
|
+
this.location_id = +record.location_id;
|
|
2154
|
+
this.paymethod_name = record.paymethod_name;
|
|
2155
|
+
this.description = record.description;
|
|
2156
|
+
this.display_banking_details = record.display_banking_details;
|
|
2157
|
+
this.currency_code = record.currency_code;
|
|
2158
|
+
this.terminal_id = record.terminal_id;
|
|
2159
|
+
this.terminal_id_secondary = record.terminal_id_secondary;
|
|
2160
|
+
this.merchant_id = record.merchant_id;
|
|
2161
|
+
this.application_id = record.application_id;
|
|
2162
|
+
this.api_username = record.api_username;
|
|
2163
|
+
this.api_password = record.api_password;
|
|
2164
|
+
this.api_signature = record.api_signature;
|
|
2165
|
+
this.is_gateway = record.is_gateway;
|
|
2166
|
+
this.must_store_card_details = record.must_store_card_details;
|
|
2167
|
+
this.allow_budget = record.allow_budget;
|
|
2168
|
+
this.integration_type = record.integration_type;
|
|
2169
|
+
this.bank_gateway_id = record.bank_gateway_id;
|
|
2170
|
+
this.accepted_card_types = record.accepted_card_types;
|
|
2171
|
+
this.post_transactions_to_gateway = record.post_transactions_to_gateway;
|
|
2172
|
+
this.three_d_secure_url = record.three_d_secure_url;
|
|
2173
|
+
this.gateway_url = record.gateway_url;
|
|
2174
|
+
this.generate_token_url = record.generate_token_url;
|
|
2175
|
+
this.widget_url = record.widget_url;
|
|
2176
|
+
this.successful_url = record.successful_url;
|
|
2177
|
+
this.failed_url = record.failed_url;
|
|
2178
|
+
this.enable_callback = record.enable_callback;
|
|
2179
|
+
this.live = record.live;
|
|
2180
|
+
this.default_module_id = +record.default_module_id;
|
|
2181
|
+
this.service_provider = record.service_provider;
|
|
2182
|
+
this.on_account = record.on_account;
|
|
2183
|
+
this.sort_priority = +record.sort_priority;
|
|
2184
|
+
this.image_url = record.image_url;
|
|
2185
|
+
this.banking_details = new EsolveBankingDetails(record.bank_name, record.account_holder, record.account, record.account_type, record.swift_number, record.branch_code);
|
|
2186
|
+
}
|
|
2187
|
+
}
|
|
2188
|
+
class EsolveBankingDetails {
|
|
2189
|
+
constructor(bank_name, account_holder, account, account_type, swift_number, branch_code) {
|
|
2190
|
+
this.bank_name = bank_name;
|
|
2191
|
+
this.account_holder = account_holder;
|
|
2192
|
+
this.account = account;
|
|
2193
|
+
this.account_type = account_type;
|
|
2194
|
+
this.swift_number = swift_number;
|
|
2195
|
+
this.branch_code = branch_code;
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
|
|
2199
|
+
class EsolvePaymentService {
|
|
2200
|
+
constructor(config, http, errorHandler, responseHandler) {
|
|
2201
|
+
this.config = config;
|
|
2202
|
+
this.http = http;
|
|
2203
|
+
this.errorHandler = errorHandler;
|
|
2204
|
+
this.responseHandler = responseHandler;
|
|
2205
|
+
}
|
|
2206
|
+
/**
|
|
2207
|
+
* Processes the eSolve payment method records.
|
|
2208
|
+
* @param records Records to process
|
|
2209
|
+
* @returns An array of processed payment methods.
|
|
2210
|
+
*/
|
|
2211
|
+
processPaymentMethods(records) {
|
|
2212
|
+
const payment_methods = [];
|
|
2213
|
+
if (records) {
|
|
2214
|
+
for (const record of records) {
|
|
2215
|
+
const payment_method = new EsolvePaymentMethod(record);
|
|
2216
|
+
payment_methods.push(payment_method);
|
|
2217
|
+
}
|
|
2218
|
+
}
|
|
2219
|
+
return payment_methods;
|
|
2220
|
+
}
|
|
2221
|
+
/**
|
|
2222
|
+
* Processes the eSolve vault records.
|
|
2223
|
+
* @param records Records to process
|
|
2224
|
+
* @returns An array of processed vault items (a.k.a. cards)
|
|
2225
|
+
*/
|
|
2226
|
+
processVaultItems(records) {
|
|
2227
|
+
const vault = [];
|
|
2228
|
+
if (records) {
|
|
2229
|
+
for (const record of records) {
|
|
2230
|
+
const vault_item = new EsolveVaultItem(+record.id, record.last4, record.brand, record.expiry_timestamp);
|
|
2231
|
+
vault.push(vault_item);
|
|
2232
|
+
}
|
|
2233
|
+
}
|
|
2234
|
+
return vault;
|
|
2235
|
+
}
|
|
2236
|
+
generateExpiry(card_data) {
|
|
2237
|
+
const month_string = card_data.expiry_month.padStart(2, '0');
|
|
2238
|
+
const year_string = card_data.expiry_year.padStart(4, '0');
|
|
2239
|
+
return `${month_string}${year_string}`;
|
|
2240
|
+
}
|
|
2241
|
+
/**
|
|
2242
|
+
* Retrieves a list of payment methods.
|
|
2243
|
+
* @param options Filter options
|
|
2244
|
+
* @returns An `Observable` with an array of payment methods
|
|
2245
|
+
*/
|
|
2246
|
+
getPaymentMethods(options) {
|
|
2247
|
+
let params = new HttpParams();
|
|
2248
|
+
params = params.set('ws_id', this.config.wsid);
|
|
2249
|
+
if (options) {
|
|
2250
|
+
if (typeof options.live !== 'undefined') {
|
|
2251
|
+
params = params.set('live', options.live);
|
|
2252
|
+
}
|
|
2253
|
+
if (typeof options.location_id !== 'undefined') {
|
|
2254
|
+
params = params.set('location_id', options.location_id);
|
|
2255
|
+
}
|
|
2256
|
+
if (typeof options.is_gateway !== 'undefined') {
|
|
2257
|
+
params = params.set('is_gateway', options.is_gateway);
|
|
2258
|
+
}
|
|
2259
|
+
}
|
|
2260
|
+
return this.http.get(`${this.config.api_url}/service/get-payment-methods.php`, { params }).pipe(map(response => {
|
|
2261
|
+
if (response.records === undefined) {
|
|
2262
|
+
throw response;
|
|
2263
|
+
}
|
|
2264
|
+
return this.processPaymentMethods(response.records);
|
|
2265
|
+
}));
|
|
2266
|
+
}
|
|
2267
|
+
/**
|
|
2268
|
+
* Retrieves a list of saved cards from the vault.
|
|
2269
|
+
* @param payment_methods_id eSolve ID of a payment method
|
|
2270
|
+
* @returns An `Observable` with an array of saved bank cards
|
|
2271
|
+
*/
|
|
2272
|
+
getVault(payment_methods_id) {
|
|
2273
|
+
let params = new HttpParams();
|
|
2274
|
+
params = params.set('ws_id', this.config.wsid);
|
|
2275
|
+
if (typeof payment_methods_id !== 'undefined') {
|
|
2276
|
+
params = params.set('payment_methods_id', payment_methods_id);
|
|
2277
|
+
}
|
|
2278
|
+
return this.http.get(`${this.config.api_url}/service/get-vault.php`, { params }).pipe(map(response => {
|
|
2279
|
+
if (response.records === undefined) {
|
|
2280
|
+
throw response;
|
|
2281
|
+
}
|
|
2282
|
+
return this.processVaultItems(response.records);
|
|
2283
|
+
}));
|
|
2284
|
+
}
|
|
2285
|
+
/**
|
|
2286
|
+
* Sets a new card in the vault OR updates an existing one.
|
|
2287
|
+
* @param payment_methods_id Selected payment method
|
|
2288
|
+
* @param card_data Information of bank card
|
|
2289
|
+
* @returns An `Observable` with the result of the vault set.
|
|
2290
|
+
*/
|
|
2291
|
+
setVaultItem(payment_methods_id, card_data) {
|
|
2292
|
+
const body = {
|
|
2293
|
+
vault: {
|
|
2294
|
+
payment_methods_id,
|
|
2295
|
+
card_number: card_data.card_number,
|
|
2296
|
+
card_name: card_data.name,
|
|
2297
|
+
card_cvv: card_data.cvv,
|
|
2298
|
+
card_expiry: this.generateExpiry(card_data)
|
|
2299
|
+
}
|
|
2300
|
+
};
|
|
2301
|
+
return this.http.post(`${this.config.api_url}/service/set-vault.php`, body, {
|
|
2302
|
+
headers: {
|
|
2303
|
+
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
|
|
2304
|
+
},
|
|
2305
|
+
params: {
|
|
2306
|
+
ws_id: this.config.wsid
|
|
2307
|
+
},
|
|
2308
|
+
responseType: 'json',
|
|
2309
|
+
observe: 'body'
|
|
2310
|
+
}).pipe(map(http_response => this.responseHandler.validateSingleHttpResponse(http_response, (response) => new EsolveVaultItemResult(response))), catchError((errorRes) => {
|
|
2311
|
+
return this.errorHandler.handleHttpPostError('set-vault', errorRes);
|
|
2312
|
+
}));
|
|
2313
|
+
}
|
|
2314
|
+
/**
|
|
2315
|
+
* Sets the payment for the specified transaction using selected payment method.
|
|
2316
|
+
* @param transaction_id eSolve ID to the transaction
|
|
2317
|
+
* @param payment_methods_id eSolve ID to the selected payment method
|
|
2318
|
+
* @param card ID of selected card from the vault or information to a brand new card
|
|
2319
|
+
* @returns An `Observable` with the result of the payment
|
|
2320
|
+
*/
|
|
2321
|
+
setPayment(transaction_id, payment_methods_id, card) {
|
|
2322
|
+
const body = {
|
|
2323
|
+
payment: {
|
|
2324
|
+
cart_id: transaction_id,
|
|
2325
|
+
payment_methods_id
|
|
2326
|
+
}
|
|
2327
|
+
};
|
|
2328
|
+
if (typeof card === 'number') {
|
|
2329
|
+
body.payment.user_vault_id = card;
|
|
2330
|
+
}
|
|
2331
|
+
else {
|
|
2332
|
+
body.card = {
|
|
2333
|
+
card_number: card.card_number,
|
|
2334
|
+
card_name: card.name,
|
|
2335
|
+
card_cvv: card.cvv,
|
|
2336
|
+
card_expiry: this.generateExpiry(card)
|
|
2337
|
+
};
|
|
2338
|
+
}
|
|
2339
|
+
return this.http.post(`${this.config.api_url}/service/set-payment.php`, body, {
|
|
2340
|
+
headers: {
|
|
2341
|
+
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
|
|
2342
|
+
},
|
|
2343
|
+
params: {
|
|
2344
|
+
ws_id: this.config.wsid
|
|
2345
|
+
},
|
|
2346
|
+
responseType: 'json',
|
|
2347
|
+
observe: 'body'
|
|
2348
|
+
}).pipe(map(http_response => this.responseHandler.validateSingleHttpResponse(http_response, (response) => new EsolvePaymentResult(response))), catchError((errorRes) => {
|
|
2349
|
+
return this.errorHandler.handleHttpPostError('set-payment', errorRes);
|
|
2350
|
+
}));
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
EsolvePaymentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolvePaymentService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }, { token: EsolveErrorHandlerService }, { token: EsolveResponseHandlerService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2354
|
+
EsolvePaymentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolvePaymentService, providedIn: 'root' });
|
|
2355
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolvePaymentService, decorators: [{
|
|
2356
|
+
type: Injectable,
|
|
2357
|
+
args: [{
|
|
2358
|
+
providedIn: 'root'
|
|
2359
|
+
}]
|
|
2360
|
+
}], ctorParameters: function () {
|
|
2361
|
+
return [{ type: undefined, decorators: [{
|
|
2362
|
+
type: Inject,
|
|
2363
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
2364
|
+
}] }, { type: i1$1.HttpClient }, { type: EsolveErrorHandlerService }, { type: EsolveResponseHandlerService }];
|
|
2365
|
+
} });
|
|
2366
|
+
|
|
2367
|
+
class EsolveShippingMethod {
|
|
2368
|
+
constructor(id, carrier_name, delivery_category, description, location, pricing, link_to_carrier_website, days_to_deliver, shipping_cost_calculation_method, insurance_cost_calculation_method, insurance_cost_percentage, metric_factor, allow_immediate_payment_processing, allow_postal_address, allow_physical_address, client_to_collect, is_default, location_id, use_zones, min_distance, max_distance, shipping_surge_condition, shipping_surge_percentage, sort_priority, shipping_group, shipping_slot_identifier, shipping_slot_delay_hours, image_url) {
|
|
2369
|
+
this.id = id;
|
|
2370
|
+
this.carrier_name = carrier_name;
|
|
2371
|
+
this.delivery_category = delivery_category;
|
|
2372
|
+
this.description = description;
|
|
2373
|
+
this.location = location;
|
|
2374
|
+
this.pricing = pricing;
|
|
2375
|
+
this.link_to_carrier_website = link_to_carrier_website;
|
|
2376
|
+
this.days_to_deliver = days_to_deliver;
|
|
2377
|
+
this.shipping_cost_calculation_method = shipping_cost_calculation_method;
|
|
2378
|
+
this.insurance_cost_calculation_method = insurance_cost_calculation_method;
|
|
2379
|
+
this.insurance_cost_percentage = insurance_cost_percentage;
|
|
2380
|
+
this.metric_factor = metric_factor;
|
|
2381
|
+
this.allow_immediate_payment_processing = allow_immediate_payment_processing;
|
|
2382
|
+
this.allow_postal_address = allow_postal_address;
|
|
2383
|
+
this.allow_physical_address = allow_physical_address;
|
|
2384
|
+
this.client_to_collect = client_to_collect;
|
|
2385
|
+
this.is_default = is_default;
|
|
2386
|
+
this.location_id = location_id;
|
|
2387
|
+
this.use_zones = use_zones;
|
|
2388
|
+
this.min_distance = min_distance;
|
|
2389
|
+
this.max_distance = max_distance;
|
|
2390
|
+
this.shipping_surge_condition = shipping_surge_condition;
|
|
2391
|
+
this.shipping_surge_percentage = shipping_surge_percentage;
|
|
2392
|
+
this.sort_priority = sort_priority;
|
|
2393
|
+
this.shipping_group = shipping_group;
|
|
2394
|
+
this.shipping_slot_identifier = shipping_slot_identifier;
|
|
2395
|
+
this.shipping_slot_delay_hours = shipping_slot_delay_hours;
|
|
2396
|
+
this.image_url = image_url;
|
|
2397
|
+
}
|
|
2398
|
+
}
|
|
2399
|
+
|
|
2400
|
+
class EsolveShippingCost {
|
|
2401
|
+
constructor(
|
|
2402
|
+
// Shipping
|
|
2403
|
+
shipping_total = 0, shipping_vat = 0, shipping_total_savings = 0,
|
|
2404
|
+
// Insurance
|
|
2405
|
+
insurance_total = 0, insurance_vat = 0, insurance_total_savings = 0) {
|
|
2406
|
+
this.shipping = new EsolveShippingTotals(shipping_total, shipping_vat, shipping_total_savings);
|
|
2407
|
+
this.insurance = new EsolveShippingTotals(insurance_total, insurance_vat, insurance_total_savings);
|
|
2408
|
+
}
|
|
2409
|
+
}
|
|
2410
|
+
class EsolveShippingTotals {
|
|
2411
|
+
constructor(total, vat, savings) {
|
|
2412
|
+
this.total = total;
|
|
2413
|
+
this.vat = vat;
|
|
2414
|
+
this.savings = savings;
|
|
2415
|
+
}
|
|
2416
|
+
}
|
|
2417
|
+
|
|
2418
|
+
class EsolveShippingService {
|
|
2419
|
+
constructor(config, http) {
|
|
2420
|
+
this.config = config;
|
|
2421
|
+
this.http = http;
|
|
2422
|
+
}
|
|
2423
|
+
/**
|
|
2424
|
+
* Processes the eSolve shipping method records.
|
|
2425
|
+
* @param records Records to process
|
|
2426
|
+
* @returns An array of processed shipping methods
|
|
2427
|
+
*/
|
|
2428
|
+
processShippingMethods(records) {
|
|
2429
|
+
const shipping_methods = [];
|
|
2430
|
+
if (records) {
|
|
2431
|
+
for (const record of records) {
|
|
2432
|
+
const shipping_method = new EsolveShippingMethod(+record.id, record.carrier_name, record.delivery_category, record.description, record.location, record.pricing, record.link_to_carrier_website, +record.days_to_deliver, record.shipping_cost_calculation_method, record.insurance_cost_calculation_method, +record.insurance_cost_percentage, +record.metric_factor, record.allow_immediate_payment_processing, record.allow_postal_address, record.allow_physical_address, record.client_to_collect, record.is_default_shipping_method, +record.location_id, record.use_zones, +record.min_distance, +record.max_distance, +record.shipping_surge_condition, +record.shipping_surge_percentage, +record.sort_priority, record.shipping_group, record.shipping_slot_identifier, +record.shipping_slot_delay_hours, record.image_url);
|
|
2433
|
+
shipping_methods.push(shipping_method);
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
return shipping_methods;
|
|
2437
|
+
}
|
|
2438
|
+
/**
|
|
2439
|
+
* Processes the eSolve shipping costs record.
|
|
2440
|
+
* @param record Data to process
|
|
2441
|
+
* @returns Processed shipping costs
|
|
2442
|
+
*/
|
|
2443
|
+
processShippingCost(record) {
|
|
2444
|
+
const shipping_cost = new EsolveShippingCost(+record.shipping_total, +record.vat_on_shipping, +record.total_saving_on_shipping, +record.insurance_total, +record.vat_on_insurance, +record.total_saving_on_insurance);
|
|
2445
|
+
return shipping_cost;
|
|
2446
|
+
}
|
|
2447
|
+
/**
|
|
2448
|
+
* Retrieves a list of shipping methods
|
|
2449
|
+
* @returns An `Observable` with an array of shipping methods
|
|
2450
|
+
*/
|
|
2451
|
+
getShippingMethods(options) {
|
|
2452
|
+
let params = new HttpParams();
|
|
2453
|
+
params = params.set('ws_id', this.config.wsid);
|
|
2454
|
+
if (options) {
|
|
2455
|
+
if (typeof options.addresses_id !== 'undefined') {
|
|
2456
|
+
params = params.set('addresses_id', options.addresses_id);
|
|
2457
|
+
}
|
|
2458
|
+
if (typeof options.location_id !== 'undefined') {
|
|
2459
|
+
params = params.set('location_id', options.location_id);
|
|
2460
|
+
}
|
|
2461
|
+
}
|
|
2462
|
+
return this.http.get(`${this.config.api_url}/service/get-shipping-methods.php`, { params }).pipe(map(response => {
|
|
2463
|
+
if (response.records === undefined) {
|
|
2464
|
+
throw response;
|
|
2465
|
+
}
|
|
2466
|
+
return this.processShippingMethods(response.records);
|
|
2467
|
+
}));
|
|
2468
|
+
}
|
|
2469
|
+
/**
|
|
2470
|
+
* Retrieves the shipping costs
|
|
2471
|
+
* @param options Shipping cost options
|
|
2472
|
+
* @returns An `Observable` with the shipping costs
|
|
2473
|
+
*/
|
|
2474
|
+
getShippingCost(shipping_id, addresses_id, location_id) {
|
|
2475
|
+
try {
|
|
2476
|
+
let params = new HttpParams();
|
|
2477
|
+
params = params.set('ws_id', this.config.wsid);
|
|
2478
|
+
if (typeof shipping_id !== 'undefined') {
|
|
2479
|
+
params = params.set('shipping_id', shipping_id);
|
|
2480
|
+
}
|
|
2481
|
+
else {
|
|
2482
|
+
throw new Error('Shipping ID is required');
|
|
2483
|
+
}
|
|
2484
|
+
if (typeof addresses_id !== 'undefined') {
|
|
2485
|
+
params = params.set('addresses_id', addresses_id);
|
|
2486
|
+
}
|
|
2487
|
+
else {
|
|
2488
|
+
throw new Error('Address ID is required');
|
|
2489
|
+
}
|
|
2490
|
+
if (typeof location_id !== 'undefined') {
|
|
2491
|
+
params = params.set('location_id', location_id);
|
|
2492
|
+
}
|
|
2493
|
+
return this.http.get(`${this.config.api_url}/service/get-shipping-cost.php`, { params }).pipe(map(response => {
|
|
2494
|
+
if (response.records === undefined) {
|
|
2495
|
+
throw response;
|
|
2496
|
+
}
|
|
2497
|
+
return this.processShippingCost(response.records[0]);
|
|
2498
|
+
}));
|
|
2499
|
+
}
|
|
2500
|
+
catch (err) {
|
|
2501
|
+
return throwError(err);
|
|
2502
|
+
}
|
|
2503
|
+
}
|
|
2504
|
+
}
|
|
2505
|
+
EsolveShippingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveShippingService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2506
|
+
EsolveShippingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveShippingService, providedIn: 'root' });
|
|
2507
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveShippingService, decorators: [{
|
|
2508
|
+
type: Injectable,
|
|
2509
|
+
args: [{
|
|
2510
|
+
providedIn: 'root'
|
|
2511
|
+
}]
|
|
2512
|
+
}], ctorParameters: function () {
|
|
2513
|
+
return [{ type: undefined, decorators: [{
|
|
2514
|
+
type: Inject,
|
|
2515
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
2516
|
+
}] }, { type: i1$1.HttpClient }];
|
|
2517
|
+
} });
|
|
2518
|
+
|
|
2519
|
+
class EsolveStockLocation {
|
|
2520
|
+
constructor(record) {
|
|
2521
|
+
this.id = +record.id;
|
|
2522
|
+
this.identifier = record.identifier;
|
|
2523
|
+
this.description = record.description;
|
|
2524
|
+
this.head_office = record.head_office;
|
|
2525
|
+
this.erp_identifier = record.erp_identifier;
|
|
2526
|
+
this.external_system_code = record.external_system_code;
|
|
2527
|
+
this.default_location_for_payment_methods = record.default_location_for_payment_methods;
|
|
2528
|
+
this.userid = +record.userid;
|
|
2529
|
+
this.importance = +record.importance;
|
|
2530
|
+
this.active = record.is_active;
|
|
2531
|
+
this.website_url = record.website_url;
|
|
2532
|
+
this.address = new EsolveStockLocationAddress(record.street, record.suburb, record.city, record.province, record.country, record.postal_code, +record.latitude, +record.longitude);
|
|
2533
|
+
this.pobox_address = new EsolveStockLocationPOBoxAddress(record.pobox, record.pobox_city, record.pobox_postal_code);
|
|
2534
|
+
const telnumbers = [];
|
|
2535
|
+
if (record.branch_telnumber.length > 0) {
|
|
2536
|
+
telnumbers.push(record.branch_telnumber);
|
|
2537
|
+
}
|
|
2538
|
+
if (record.branch_telnumber_2.length > 0) {
|
|
2539
|
+
telnumbers.push(record.branch_telnumber_2);
|
|
2540
|
+
}
|
|
2541
|
+
if (record.branch_telnumber_3.length > 0) {
|
|
2542
|
+
telnumbers.push(record.branch_telnumber_3);
|
|
2543
|
+
}
|
|
2544
|
+
this.contact_info = new EsolveStockLocationContactInfo(telnumbers, record.branch_cellnumber, record.branch_email, record.branch_fax);
|
|
2545
|
+
this.trading_times = new EsolveStockLocationTradingTimes(record.monday_open_time, record.monday_close_time, record.tuesday_open_time, record.tuesday_close_time, record.wednesday_open_time, record.wednesday_close_time, record.thursday_open_time, record.thursday_close_time, record.friday_open_time, record.friday_close_time, record.saturday_open_time, record.saturday_close_time, record.sunday_open_time, record.sunday_close_time, record.public_holiday_open_time, record.public_holiday_close_time, record.trading_hours_additional_in);
|
|
2546
|
+
}
|
|
2547
|
+
}
|
|
2548
|
+
class EsolveStockLocationAddress {
|
|
2549
|
+
constructor(street, suburb, city, province, country, postal_code, latitude, longitude) {
|
|
2550
|
+
this.street = street;
|
|
2551
|
+
this.suburb = suburb;
|
|
2552
|
+
this.city = city;
|
|
2553
|
+
this.province = province;
|
|
2554
|
+
this.country = country;
|
|
2555
|
+
this.postal_code = postal_code;
|
|
2556
|
+
this.latitude = latitude;
|
|
2557
|
+
this.longitude = longitude;
|
|
2558
|
+
}
|
|
2559
|
+
}
|
|
2560
|
+
class EsolveStockLocationPOBoxAddress {
|
|
2561
|
+
constructor(pobox, city, postal_code) {
|
|
2562
|
+
this.pobox = pobox;
|
|
2563
|
+
this.city = city;
|
|
2564
|
+
this.postal_code = postal_code;
|
|
2565
|
+
}
|
|
2566
|
+
}
|
|
2567
|
+
class EsolveStockLocationContactInfo {
|
|
2568
|
+
constructor(telnumber, cellnumber, email, fax) {
|
|
2569
|
+
this.telnumber = telnumber;
|
|
2570
|
+
this.cellnumber = cellnumber;
|
|
2571
|
+
this.email = email;
|
|
2572
|
+
this.fax = fax;
|
|
2573
|
+
}
|
|
2574
|
+
}
|
|
2575
|
+
class EsolveStockLocationTradingTimes {
|
|
2576
|
+
constructor(monday_open_time, monday_close_time, tuesday_open_time, tuesday_close_time, wednesday_open_time, wednesday_close_time, thursday_open_time, thursday_close_time, friday_open_time, friday_close_time, saturday_open_time, saturday_close_time, sunday_open_time, sunday_close_time, public_holiday_open_time, public_holiday_close_time, trading_hours_additional_info = '') {
|
|
2577
|
+
this.trading_hours_additional_info = trading_hours_additional_info;
|
|
2578
|
+
this.monday = new EsolveStockLocationTradingTimesDay(monday_open_time, monday_close_time);
|
|
2579
|
+
this.tuesday = new EsolveStockLocationTradingTimesDay(tuesday_open_time, tuesday_close_time);
|
|
2580
|
+
this.wednesday = new EsolveStockLocationTradingTimesDay(wednesday_open_time, wednesday_close_time);
|
|
2581
|
+
this.thursday = new EsolveStockLocationTradingTimesDay(thursday_open_time, thursday_close_time);
|
|
2582
|
+
this.friday = new EsolveStockLocationTradingTimesDay(friday_open_time, friday_close_time);
|
|
2583
|
+
this.saturday = new EsolveStockLocationTradingTimesDay(saturday_open_time, saturday_close_time);
|
|
2584
|
+
this.sunday = new EsolveStockLocationTradingTimesDay(sunday_open_time, sunday_close_time);
|
|
2585
|
+
this.public_holiday = new EsolveStockLocationTradingTimesDay(public_holiday_open_time, public_holiday_close_time);
|
|
2586
|
+
}
|
|
2587
|
+
}
|
|
2588
|
+
class EsolveStockLocationTradingTimesDay {
|
|
2589
|
+
constructor(open, close) {
|
|
2590
|
+
this.open = open;
|
|
2591
|
+
this.close = close;
|
|
2592
|
+
}
|
|
2593
|
+
}
|
|
2594
|
+
|
|
2595
|
+
class EsolveLocationsService {
|
|
2596
|
+
constructor(config, http) {
|
|
2597
|
+
this.config = config;
|
|
2598
|
+
this.http = http;
|
|
2599
|
+
}
|
|
2600
|
+
/**
|
|
2601
|
+
* Processes the eSolve stock location records.
|
|
2602
|
+
* @param records Records to process
|
|
2603
|
+
* @returns An array of processed stock location records
|
|
2604
|
+
*/
|
|
2605
|
+
processStockLocations(records) {
|
|
2606
|
+
const stock_locations = [];
|
|
2607
|
+
if (records) {
|
|
2608
|
+
for (const record of records) {
|
|
2609
|
+
stock_locations.push(new EsolveStockLocation(record));
|
|
2610
|
+
}
|
|
2611
|
+
}
|
|
2612
|
+
return stock_locations;
|
|
2613
|
+
}
|
|
2614
|
+
/**
|
|
2615
|
+
* Retrieves a list of stock locations
|
|
2616
|
+
* @returns An `Observable` with an array of stock locations
|
|
2617
|
+
*/
|
|
2618
|
+
getStockLocations() {
|
|
2619
|
+
let params = new HttpParams();
|
|
2620
|
+
params = params.set('ws_id', this.config.wsid);
|
|
2621
|
+
return this.http.get(`${this.config.api_url}/service/get-locations.php`, { params }).pipe(map(response => {
|
|
2622
|
+
if (response.records === undefined) {
|
|
2623
|
+
throw response;
|
|
2624
|
+
}
|
|
2625
|
+
return this.processStockLocations(response.records);
|
|
2626
|
+
}));
|
|
2627
|
+
}
|
|
2628
|
+
}
|
|
2629
|
+
EsolveLocationsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveLocationsService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2630
|
+
EsolveLocationsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveLocationsService, providedIn: 'root' });
|
|
2631
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveLocationsService, decorators: [{
|
|
2632
|
+
type: Injectable,
|
|
2633
|
+
args: [{
|
|
2634
|
+
providedIn: 'root'
|
|
2635
|
+
}]
|
|
2636
|
+
}], ctorParameters: function () {
|
|
2637
|
+
return [{ type: undefined, decorators: [{
|
|
2638
|
+
type: Inject,
|
|
2639
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
2640
|
+
}] }, { type: i1$1.HttpClient }];
|
|
2641
|
+
} });
|
|
2642
|
+
|
|
2643
|
+
/*
|
|
2644
|
+
* Public API Surface of ng-esolve-connect
|
|
2645
|
+
*/
|
|
2646
|
+
|
|
2647
|
+
/**
|
|
2648
|
+
* Generated bundle index. Do not edit.
|
|
2649
|
+
*/
|
|
2650
|
+
|
|
2651
|
+
export { EsolveAccountService, EsolveAddress, EsolveAddressResult, EsolveAuthService, EsolveBankingDetails, EsolveBanner, EsolveBannerImage, EsolveBannerImageHotspot, EsolveBannerService, EsolveCartItem, EsolveCartService, EsolveCartTotals, EsolveCategoryTreeItem, EsolveCategoryTreeService, EsolveCheckoutResult, EsolveErrorHandlerService, EsolveHttpError, EsolveLocationsService, EsolveMediaArticle, EsolveMediaService, EsolveMenuItem, EsolveMenuService, EsolveNewsArticle, EsolveNewsArticleAuthor, EsolveNewsArticleList, EsolveNewsGroup, EsolveNewsService, EsolvePaymentMethod, EsolvePaymentResult, EsolvePaymentService, EsolveRegistrationResult, EsolveResponseHandlerService, EsolveResponseResult, EsolveSEOInfo, EsolveSeoService, EsolveSession, EsolveSessionService, EsolveShippingCost, EsolveShippingMethod, EsolveShippingService, EsolveStockBadge, EsolveStockItem, EsolveStockItemList, EsolveStockLocation, EsolveStockPrice, EsolveStockService, EsolveTag, EsolveTopic, EsolveTopicService, EsolveUserAccount, EsolveUserAccountBusiness, EsolveUserAccountContact, EsolveUserAccountResult, EsolveVaultItem, EsolveVaultItemResult, NgEsolveConnectModule };
|