@esolve/ng-esolve-connect 0.15.2 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/manufacturers/esolve-manufacturer-image-size.type.mjs +2 -0
- package/esm2020/lib/manufacturers/esolve-manufacturer.model.mjs +30 -13
- package/esm2020/lib/manufacturers/esolve-manufacturers.service.mjs +2 -2
- package/esm2020/lib/manufacturers/index.mjs +7 -2
- package/esm2020/lib/media/esolve-media.service.mjs +3 -3
- package/esm2020/lib/news/esolve-news-article-options.interface.mjs +1 -1
- package/esm2020/lib/news/esolve-news-article-record.interface.mjs +1 -1
- package/esm2020/lib/news/esolve-news-article.model.mjs +65 -13
- package/esm2020/lib/news/esolve-news.service.mjs +56 -46
- package/esm2020/lib/news/index.mjs +1 -3
- package/esm2020/lib/ranges/esolve-range.model.mjs +35 -14
- package/esm2020/lib/ranges/esolve-ranges.service.mjs +2 -2
- package/esm2020/lib/shared/assets/esolve-asset-list.type.mjs +2 -0
- package/esm2020/lib/shared/assets/esolve-asset-options.interface.mjs +2 -0
- package/esm2020/lib/shared/assets/esolve-asset-record.interface.mjs +2 -0
- package/esm2020/lib/shared/assets/esolve-asset.model.mjs +58 -0
- package/esm2020/lib/shared/assets/esolve-assets.service.mjs +93 -0
- package/esm2020/lib/shared/assets/index.mjs +11 -2
- package/esm2020/lib/stock/esolve-stock-item-base.model.mjs +5 -5
- package/esm2020/lib/tags/esolve-tag-options.interface.mjs +2 -0
- package/esm2020/lib/tags/esolve-tag-phrase-match-mode.type.mjs +2 -0
- package/esm2020/lib/tags/esolve-tag-record.interface.mjs +1 -1
- package/esm2020/lib/tags/esolve-tag.model.mjs +32 -6
- package/esm2020/lib/tags/esolve-tags.service.mjs +76 -0
- package/esm2020/lib/tags/index.mjs +9 -2
- package/esm2020/lib/topics/esolve-topic.model.mjs +12 -6
- package/esm2020/lib/topics/esolve-topic.service.mjs +2 -2
- package/fesm2015/esolve-ng-esolve-connect.mjs +1778 -1427
- package/fesm2015/esolve-ng-esolve-connect.mjs.map +1 -1
- package/fesm2020/esolve-ng-esolve-connect.mjs +1762 -1423
- package/fesm2020/esolve-ng-esolve-connect.mjs.map +1 -1
- package/lib/manufacturers/esolve-manufacturer-image-size.type.d.ts +1 -0
- package/lib/manufacturers/esolve-manufacturer.model.d.ts +4 -3
- package/lib/manufacturers/index.d.ts +2 -1
- package/lib/news/esolve-news-article-options.interface.d.ts +1 -0
- package/lib/news/esolve-news-article-record.interface.d.ts +8 -4
- package/lib/news/esolve-news-article.model.d.ts +13 -2
- package/lib/news/esolve-news.service.d.ts +2 -1
- package/lib/news/index.d.ts +0 -2
- package/lib/ranges/esolve-range.model.d.ts +2 -2
- package/lib/shared/assets/esolve-asset-list.type.d.ts +3 -0
- package/lib/shared/assets/esolve-asset-options.interface.d.ts +12 -0
- package/lib/shared/assets/esolve-asset-record.interface.d.ts +26 -0
- package/lib/shared/assets/esolve-asset.model.d.ts +28 -0
- package/lib/shared/assets/esolve-assets.service.d.ts +19 -0
- package/lib/shared/assets/index.d.ts +6 -1
- package/lib/tags/esolve-tag-options.interface.d.ts +6 -0
- package/lib/tags/esolve-tag-phrase-match-mode.type.d.ts +1 -0
- package/lib/tags/esolve-tag-record.interface.d.ts +1 -0
- package/lib/tags/esolve-tag.model.d.ts +14 -3
- package/lib/tags/esolve-tags.service.d.ts +22 -0
- package/lib/tags/index.d.ts +4 -1
- package/lib/topics/esolve-topic.model.d.ts +1 -1
- package/package.json +1 -1
- package/esm2020/lib/news/esolve-news-manufacturer-record.interface.mjs +0 -2
- package/esm2020/lib/news/esolve-news-range-record.interface.mjs +0 -2
- package/lib/news/esolve-news-manufacturer-record.interface.d.ts +0 -8
- package/lib/news/esolve-news-range-record.interface.d.ts +0 -9
|
@@ -7,7 +7,7 @@ import * as i1 from 'ngx-cookie-service';
|
|
|
7
7
|
import { CookieService } from 'ngx-cookie-service';
|
|
8
8
|
import { BehaviorSubject, throwError, of, iif } from 'rxjs';
|
|
9
9
|
import * as i1$1 from '@angular/platform-browser';
|
|
10
|
-
import { map,
|
|
10
|
+
import { map, catchError, tap, switchMap } from 'rxjs/operators';
|
|
11
11
|
|
|
12
12
|
const ESOLVE_CONNECT_CONFIG = new InjectionToken('esolve.connect.config');
|
|
13
13
|
|
|
@@ -682,162 +682,289 @@ class EsolveLinkedAsset {
|
|
|
682
682
|
}
|
|
683
683
|
}
|
|
684
684
|
|
|
685
|
-
class
|
|
686
|
-
constructor(
|
|
687
|
-
this.
|
|
688
|
-
this.
|
|
689
|
-
this.
|
|
690
|
-
this.
|
|
691
|
-
this.
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
685
|
+
class EsolveCategoryTreeItem {
|
|
686
|
+
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) {
|
|
687
|
+
this.type = type;
|
|
688
|
+
this.esolve_id = esolve_id;
|
|
689
|
+
this.parent_id = parent_id;
|
|
690
|
+
this.description = description;
|
|
691
|
+
this.sef_description = sef_description;
|
|
692
|
+
this.short_description = short_description;
|
|
693
|
+
this.sort_priority = sort_priority;
|
|
694
|
+
this.active = active;
|
|
695
|
+
this.display_only = display_only;
|
|
696
|
+
this.image_name = image_name;
|
|
697
|
+
this.id = '';
|
|
698
|
+
this.image_path = '';
|
|
699
|
+
if (this.type === 'category') {
|
|
700
|
+
this.id = `<<CAT>>${this.esolve_id}`;
|
|
701
|
+
if (children != null) {
|
|
702
|
+
this.children = children;
|
|
703
|
+
}
|
|
704
|
+
this.image_path = '/images/categories/';
|
|
697
705
|
}
|
|
698
|
-
|
|
699
|
-
|
|
706
|
+
else {
|
|
707
|
+
this.id = `<<SUB>>${this.esolve_id}`;
|
|
708
|
+
this.image_path = '/images/subcategories/';
|
|
700
709
|
}
|
|
701
|
-
if (
|
|
702
|
-
|
|
710
|
+
if (seo_title.trim() === '') {
|
|
711
|
+
seo_title = this.description;
|
|
703
712
|
}
|
|
704
|
-
|
|
705
|
-
.get(`${this.config.api_url}/get-access-token.php`, {
|
|
706
|
-
params,
|
|
707
|
-
headers: new HttpHeaders({
|
|
708
|
-
'Accept-Language': '*',
|
|
709
|
-
}),
|
|
710
|
-
})
|
|
711
|
-
.pipe(tap((responseData) => {
|
|
712
|
-
if ((responseData.type === 'error') ||
|
|
713
|
-
(responseData.type === 'exception')) {
|
|
714
|
-
throw responseData;
|
|
715
|
-
}
|
|
716
|
-
}), catchError(this.handleError), tap((responseData) => {
|
|
717
|
-
this.handleAuthentication(responseData.additional_data);
|
|
718
|
-
}));
|
|
713
|
+
this.seo_details = new EsolveSeoInfo(seo_title, seo_description, seo_keywords);
|
|
719
714
|
}
|
|
720
|
-
|
|
721
|
-
this.
|
|
722
|
-
this.getAccessToken('', '', true).toPromise().then(() => { }, (error) => {
|
|
723
|
-
console.error(error);
|
|
724
|
-
});
|
|
725
|
-
});
|
|
715
|
+
get small_image_src() {
|
|
716
|
+
return this.getImagePath('small');
|
|
726
717
|
}
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
718
|
+
get thumbnail_image_src() {
|
|
719
|
+
return this.getImagePath('thumb');
|
|
720
|
+
}
|
|
721
|
+
get tiny_image_src() {
|
|
722
|
+
return this.getImagePath('tiny');
|
|
723
|
+
}
|
|
724
|
+
getImagePath(image_size) {
|
|
725
|
+
if (this.image_name !== '') {
|
|
726
|
+
return `${this.image_path}${image_size}/${this.image_name}`;
|
|
727
|
+
}
|
|
728
|
+
return '';
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
class EsolveCategoryTreeService {
|
|
733
|
+
constructor(config, http) {
|
|
734
|
+
this.config = config;
|
|
735
|
+
this.http = http;
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* Retrieves the category tree from eSolve instance and coverts it to the correct format.
|
|
739
|
+
*/
|
|
740
|
+
getCategoryTree() {
|
|
734
741
|
return this.http
|
|
735
|
-
.
|
|
736
|
-
headers: {
|
|
737
|
-
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
|
|
738
|
-
},
|
|
739
|
-
responseType: 'json',
|
|
740
|
-
observe: 'body'
|
|
741
|
-
})
|
|
742
|
+
.get(`${this.config.api_url}/get-tree.php`)
|
|
742
743
|
.pipe(map((response) => {
|
|
743
|
-
if (
|
|
744
|
-
(response.responses.length <= 0)) {
|
|
744
|
+
if (response.records === undefined) {
|
|
745
745
|
throw response;
|
|
746
746
|
}
|
|
747
|
-
|
|
748
|
-
if ((login_response.status.state !== 'success') &&
|
|
749
|
-
(login_response.status.state !== 'warning')) {
|
|
750
|
-
throw login_response;
|
|
751
|
-
}
|
|
752
|
-
for (const response_log of login_response.log) {
|
|
753
|
-
if ((response_log.type === 'success') &&
|
|
754
|
-
(response_log.message_code === 'login_success')) {
|
|
755
|
-
const session_data = login_response.session_data;
|
|
756
|
-
const user_id = +login_response.esolve_id;
|
|
757
|
-
const location_id = +session_data.location_id;
|
|
758
|
-
this.session.handleUpdateSession({
|
|
759
|
-
user_id: user_id,
|
|
760
|
-
location_id: location_id
|
|
761
|
-
});
|
|
762
|
-
return user_id;
|
|
763
|
-
}
|
|
764
|
-
}
|
|
765
|
-
throw login_response;
|
|
766
|
-
}), catchError((errorRes) => {
|
|
767
|
-
return this.errorHandler.handleHttpPostError('set-login', errorRes);
|
|
747
|
+
return this.processTree(response.records);
|
|
768
748
|
}));
|
|
769
749
|
}
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
750
|
+
/**
|
|
751
|
+
* Retrieve the details of a category tree item from the eSolve instance and
|
|
752
|
+
* converts it to the correct format.
|
|
753
|
+
*
|
|
754
|
+
* @param options Filter options
|
|
755
|
+
*/
|
|
756
|
+
getCategoryTreeItem(options) {
|
|
757
|
+
let type;
|
|
758
|
+
let esolve_id;
|
|
759
|
+
let sef_description;
|
|
760
|
+
if (options.id) {
|
|
761
|
+
const categoryIdentifier = this.processID(options.id);
|
|
762
|
+
if (categoryIdentifier) {
|
|
763
|
+
type = categoryIdentifier.type;
|
|
764
|
+
esolve_id = categoryIdentifier.esolve_id;
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
else if (options.type) {
|
|
768
|
+
type = options.type;
|
|
769
|
+
if (options.esolve_id) {
|
|
770
|
+
esolve_id = options.esolve_id;
|
|
771
|
+
}
|
|
772
|
+
else if (options.sef_description) {
|
|
773
|
+
sef_description = options.sef_description;
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
if (type && (esolve_id || sef_description)) {
|
|
777
|
+
let params = new HttpParams();
|
|
778
|
+
params = params.set('type', type);
|
|
779
|
+
if (esolve_id) {
|
|
780
|
+
params = params.set('id', esolve_id);
|
|
781
|
+
}
|
|
782
|
+
if (sef_description) {
|
|
783
|
+
params = params.set('sef_description', sef_description);
|
|
784
|
+
}
|
|
785
|
+
return this.http
|
|
786
|
+
.get(`${this.config.api_url}/get-tree-item.php`, { params })
|
|
787
|
+
.pipe(map((response) => {
|
|
788
|
+
if ((response.records === undefined) ||
|
|
789
|
+
(response.records.length <= 0)) {
|
|
790
|
+
throw response;
|
|
791
|
+
}
|
|
792
|
+
return this.processTreeItem(response.records[0]);
|
|
793
|
+
}));
|
|
794
|
+
}
|
|
795
|
+
return throwError('Invalid options');
|
|
774
796
|
}
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
(
|
|
788
|
-
|
|
789
|
-
|
|
797
|
+
/**
|
|
798
|
+
* Processes the eSolve tree records and converts them into the correct format.
|
|
799
|
+
*
|
|
800
|
+
* @param tree_records Records to process
|
|
801
|
+
*/
|
|
802
|
+
processTree(tree_records) {
|
|
803
|
+
const tree_items = [];
|
|
804
|
+
if (tree_records) {
|
|
805
|
+
for (const tree_record of tree_records) {
|
|
806
|
+
let esolve_id = '';
|
|
807
|
+
let parent_id = '';
|
|
808
|
+
let children = [];
|
|
809
|
+
if (tree_record.type === 'category') {
|
|
810
|
+
children = this.processTree(tree_record.children);
|
|
811
|
+
esolve_id = tree_record.menu_id;
|
|
812
|
+
parent_id = tree_record.owner_menu_id;
|
|
813
|
+
}
|
|
814
|
+
else {
|
|
815
|
+
esolve_id = tree_record.id;
|
|
816
|
+
parent_id = tree_record.menu_id;
|
|
817
|
+
}
|
|
818
|
+
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));
|
|
790
819
|
}
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
key: token,
|
|
794
|
-
expires: additional_data.expires,
|
|
795
|
-
expiry_time: additional_data.expiry_time,
|
|
796
|
-
location_id: additional_data.location_id,
|
|
797
|
-
user_id: additional_data.user_id,
|
|
798
|
-
};
|
|
799
|
-
return result;
|
|
800
|
-
}))
|
|
801
|
-
.toPromise();
|
|
820
|
+
}
|
|
821
|
+
return tree_items;
|
|
802
822
|
}
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
return (session) => {
|
|
806
|
-
this.checkAccessToken(session).then((response) => {
|
|
807
|
-
this.handleAuthentication(response);
|
|
808
|
-
}, () => {
|
|
809
|
-
this.logout();
|
|
810
|
-
});
|
|
811
|
-
};
|
|
823
|
+
processTreeItem(record) {
|
|
824
|
+
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.image, record.seo_page_title, record.seo_keywords, record.seo_description);
|
|
812
825
|
}
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
826
|
+
processID(id) {
|
|
827
|
+
let type;
|
|
828
|
+
let esolve_id;
|
|
829
|
+
const type_code_regex = /^\<\<(CAT|SUB)\>\>/g;
|
|
830
|
+
const match_results = id.match(type_code_regex);
|
|
831
|
+
if (match_results) {
|
|
832
|
+
const type_code = match_results[0];
|
|
833
|
+
type = (type_code === '<<CAT>>' ? 'category' : 'subcategory');
|
|
834
|
+
esolve_id = id.replace(type_code_regex, '');
|
|
835
|
+
return {
|
|
836
|
+
type,
|
|
837
|
+
esolve_id
|
|
838
|
+
};
|
|
816
839
|
}
|
|
817
|
-
|
|
840
|
+
return null;
|
|
818
841
|
}
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
842
|
+
}
|
|
843
|
+
EsolveCategoryTreeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveCategoryTreeService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
844
|
+
EsolveCategoryTreeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveCategoryTreeService, providedIn: 'root' });
|
|
845
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveCategoryTreeService, decorators: [{
|
|
846
|
+
type: Injectable,
|
|
847
|
+
args: [{
|
|
848
|
+
providedIn: 'root',
|
|
849
|
+
}]
|
|
850
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
851
|
+
type: Inject,
|
|
852
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
853
|
+
}] }, { type: i1$2.HttpClient }]; } });
|
|
854
|
+
|
|
855
|
+
class EsolveManufacturer {
|
|
856
|
+
constructor(record) {
|
|
857
|
+
this.id = 0;
|
|
858
|
+
this.manufacturer = '';
|
|
859
|
+
this.sef_manufacturer = '';
|
|
860
|
+
this.title = '';
|
|
861
|
+
this.article = '';
|
|
862
|
+
this.sort_priority = 0;
|
|
863
|
+
this.is_active = false;
|
|
864
|
+
this.featured = false;
|
|
865
|
+
this.image_name = '';
|
|
866
|
+
let seo_title = '';
|
|
867
|
+
let seo_keywords = '';
|
|
868
|
+
let seo_description = '';
|
|
869
|
+
if (record) {
|
|
870
|
+
this.id = +(record.id ?? 0);
|
|
871
|
+
this.manufacturer = record.manufacturer ?? '';
|
|
872
|
+
this.sef_manufacturer = record.sef_manufacturer ?? '';
|
|
873
|
+
this.title = record.title ?? '';
|
|
874
|
+
this.article = record.article ?? '';
|
|
875
|
+
this.sort_priority = +(record.sort_priority ?? 0);
|
|
876
|
+
this.image_name = record.image_name ?? '';
|
|
877
|
+
if (record.is_active) {
|
|
878
|
+
this.is_active = !!+record.is_active;
|
|
879
|
+
}
|
|
880
|
+
if (record.featured) {
|
|
881
|
+
this.featured = !!+record.featured;
|
|
882
|
+
}
|
|
828
883
|
}
|
|
829
|
-
if (
|
|
830
|
-
|
|
884
|
+
if (this.title.trim() === '') {
|
|
885
|
+
this.title = this.manufacturer;
|
|
831
886
|
}
|
|
832
|
-
if (
|
|
833
|
-
|
|
887
|
+
if (seo_title.trim() === '') {
|
|
888
|
+
seo_title = this.title;
|
|
834
889
|
}
|
|
835
|
-
|
|
890
|
+
this.seo_details = new EsolveSeoInfo(seo_title, seo_description, seo_keywords);
|
|
891
|
+
}
|
|
892
|
+
get original_image_src() {
|
|
893
|
+
return this.getImagePath('original');
|
|
894
|
+
}
|
|
895
|
+
get small_image_src() {
|
|
896
|
+
return this.getImagePath('small');
|
|
897
|
+
}
|
|
898
|
+
get thumbnail_image_src() {
|
|
899
|
+
return this.getImagePath('thumb');
|
|
900
|
+
}
|
|
901
|
+
get tiny_image_src() {
|
|
902
|
+
return this.getImagePath('tiny');
|
|
903
|
+
}
|
|
904
|
+
getImagePath(image_size) {
|
|
905
|
+
if (this.image_name !== '') {
|
|
906
|
+
return `/images/manufacturers/${image_size}/${this.image_name}`;
|
|
907
|
+
}
|
|
908
|
+
return '';
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
class EsolveManufacturersService {
|
|
913
|
+
constructor(config, http) {
|
|
914
|
+
this.config = config;
|
|
915
|
+
this.http = http;
|
|
916
|
+
}
|
|
917
|
+
getManufacturer(id) {
|
|
918
|
+
const params = new HttpParams({
|
|
919
|
+
fromObject: { manufacturers_id: id }
|
|
920
|
+
});
|
|
921
|
+
return this.getManufacturerSingle(params);
|
|
922
|
+
}
|
|
923
|
+
getManufacturerFromSEF(sef_manufacturer) {
|
|
924
|
+
const params = new HttpParams({
|
|
925
|
+
fromObject: { sef_manufacturer }
|
|
926
|
+
});
|
|
927
|
+
return this.getManufacturerSingle(params);
|
|
928
|
+
}
|
|
929
|
+
getManufacturers(options) {
|
|
930
|
+
let params = new HttpParams();
|
|
931
|
+
if (options?.featured_only) {
|
|
932
|
+
params = params.set('featured_only', options.featured_only);
|
|
933
|
+
}
|
|
934
|
+
return this.getManufacturerRecords(params).pipe(map((records) => {
|
|
935
|
+
const manufacturers = [];
|
|
936
|
+
for (const record of records) {
|
|
937
|
+
manufacturers.push(this.processManufacturer(record));
|
|
938
|
+
}
|
|
939
|
+
return manufacturers;
|
|
940
|
+
}), catchError(() => {
|
|
941
|
+
return of([]);
|
|
942
|
+
}));
|
|
943
|
+
}
|
|
944
|
+
getManufacturerSingle(params) {
|
|
945
|
+
return this.getManufacturerRecords(params).pipe(map((records) => {
|
|
946
|
+
const record = records[0];
|
|
947
|
+
return this.processManufacturer(record);
|
|
948
|
+
}));
|
|
949
|
+
}
|
|
950
|
+
getManufacturerRecords(params) {
|
|
951
|
+
return this.http
|
|
952
|
+
.get(`${this.config.api_url}/get-manufacturers.php`, { params })
|
|
953
|
+
.pipe(map((response) => {
|
|
954
|
+
if ((response.records === undefined) ||
|
|
955
|
+
(response.records.length <= 0)) {
|
|
956
|
+
throw response;
|
|
957
|
+
}
|
|
958
|
+
return response.records;
|
|
959
|
+
}));
|
|
960
|
+
}
|
|
961
|
+
processManufacturer(record) {
|
|
962
|
+
return new EsolveManufacturer(record);
|
|
836
963
|
}
|
|
837
964
|
}
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type:
|
|
965
|
+
EsolveManufacturersService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveManufacturersService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
966
|
+
EsolveManufacturersService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveManufacturersService, providedIn: 'root' });
|
|
967
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveManufacturersService, decorators: [{
|
|
841
968
|
type: Injectable,
|
|
842
969
|
args: [{
|
|
843
970
|
providedIn: 'root',
|
|
@@ -845,270 +972,226 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
845
972
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
846
973
|
type: Inject,
|
|
847
974
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
848
|
-
}] }, { type: i1$2.HttpClient }
|
|
849
|
-
|
|
850
|
-
class EsolveAddress {
|
|
851
|
-
constructor(id, recipient, address_type, pobox, place_name, street_number, street, suburb, city, province, country, postal_code, latitude, longitude) {
|
|
852
|
-
this.id = id;
|
|
853
|
-
this.recipient = recipient;
|
|
854
|
-
this.address_type = address_type;
|
|
855
|
-
this.pobox = pobox;
|
|
856
|
-
this.place_name = place_name;
|
|
857
|
-
this.street_number = street_number;
|
|
858
|
-
this.street = street;
|
|
859
|
-
this.suburb = suburb;
|
|
860
|
-
this.city = city;
|
|
861
|
-
this.province = province;
|
|
862
|
-
this.country = country;
|
|
863
|
-
this.postal_code = postal_code;
|
|
864
|
-
this.latitude = latitude;
|
|
865
|
-
this.longitude = longitude;
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
class EsolveAddressResult extends EsolveResponseResult {
|
|
870
|
-
constructor(response) {
|
|
871
|
-
super(response);
|
|
872
|
-
this.id = response.esolve_id;
|
|
873
|
-
this.address_validated = response.address_validated;
|
|
874
|
-
this.geocode_status = response.geocode_status;
|
|
875
|
-
this.geocode_result = response.geocode_result;
|
|
876
|
-
}
|
|
877
|
-
}
|
|
975
|
+
}] }, { type: i1$2.HttpClient }]; } });
|
|
878
976
|
|
|
879
|
-
|
|
880
|
-
constructor(esolve_id, email, registration_type, title, first_name, last_name, initials, gender, identification_number) {
|
|
881
|
-
this.esolve_id = esolve_id;
|
|
882
|
-
this.email = email;
|
|
883
|
-
this.registration_type = registration_type;
|
|
884
|
-
this.title = title;
|
|
885
|
-
this.first_name = first_name;
|
|
886
|
-
this.last_name = last_name;
|
|
887
|
-
this.initials = initials;
|
|
888
|
-
this.gender = gender;
|
|
889
|
-
this.identification_number = identification_number;
|
|
890
|
-
}
|
|
891
|
-
}
|
|
977
|
+
// Types
|
|
892
978
|
|
|
893
|
-
class
|
|
894
|
-
constructor(
|
|
895
|
-
super(response);
|
|
979
|
+
class EsolveRange {
|
|
980
|
+
constructor(record) {
|
|
896
981
|
this.id = 0;
|
|
897
|
-
this.
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
this.
|
|
904
|
-
this.
|
|
905
|
-
this.
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
982
|
+
this.range = '';
|
|
983
|
+
this.sef_range = '';
|
|
984
|
+
this.manufacturers_id = 0;
|
|
985
|
+
this.title = '';
|
|
986
|
+
this.article = '';
|
|
987
|
+
this.is_active = false;
|
|
988
|
+
this.featured = false;
|
|
989
|
+
this.sort_priority = 0;
|
|
990
|
+
this.image_name = '';
|
|
991
|
+
let seo_title = '';
|
|
992
|
+
let seo_keywords = '';
|
|
993
|
+
let seo_description = '';
|
|
994
|
+
if (record) {
|
|
995
|
+
this.id = +(record.id ?? 0);
|
|
996
|
+
this.range = record.range ?? '';
|
|
997
|
+
this.sef_range = record.sef_range ?? '';
|
|
998
|
+
this.manufacturers_id = +(record.manufacturers_id ?? 0);
|
|
999
|
+
this.title = record.title ?? '';
|
|
1000
|
+
this.article = record.article ?? '';
|
|
1001
|
+
this.sort_priority = +(record.sort_priority ?? 0);
|
|
1002
|
+
this.image_name = record.image_name ?? '';
|
|
1003
|
+
if (record.is_active) {
|
|
1004
|
+
this.is_active = !!+record.is_active;
|
|
1005
|
+
}
|
|
1006
|
+
if (record.featured) {
|
|
1007
|
+
this.featured = !!+record.featured;
|
|
1008
|
+
}
|
|
1009
|
+
seo_title = record.seo_page_title ?? '';
|
|
1010
|
+
seo_keywords = record.seo_keywords ?? '';
|
|
1011
|
+
seo_description = record.seo_description ?? '';
|
|
1012
|
+
}
|
|
1013
|
+
if (this.title.trim() === '') {
|
|
1014
|
+
this.title = this.range;
|
|
1015
|
+
}
|
|
1016
|
+
if (seo_title.trim() === '') {
|
|
1017
|
+
seo_title = this.title;
|
|
1018
|
+
}
|
|
1019
|
+
this.seo_details = new EsolveSeoInfo(seo_title, seo_description, seo_keywords);
|
|
915
1020
|
}
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
class EsolveTransactionAddress {
|
|
919
|
-
constructor(recipient, address_type, address_description, street_number, street, suburb, city, province, country, postal_code, pobox) {
|
|
920
|
-
this.recipient = recipient;
|
|
921
|
-
this.address_type = address_type;
|
|
922
|
-
this.address_description = address_description;
|
|
923
|
-
this.street_number = street_number;
|
|
924
|
-
this.street = street;
|
|
925
|
-
this.suburb = suburb;
|
|
926
|
-
this.city = city;
|
|
927
|
-
this.province = province;
|
|
928
|
-
this.country = country;
|
|
929
|
-
this.postal_code = postal_code;
|
|
930
|
-
this.pobox = pobox;
|
|
1021
|
+
get image_src() {
|
|
1022
|
+
return this.getImagePath();
|
|
931
1023
|
}
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
this.account = account;
|
|
938
|
-
this.company_name = company_name;
|
|
939
|
-
this.branch_code = branch_code;
|
|
940
|
-
this.email = email;
|
|
941
|
-
this.first_name = first_name;
|
|
942
|
-
this.last_name = last_name;
|
|
943
|
-
this.contact_number = contact_number;
|
|
1024
|
+
getImagePath() {
|
|
1025
|
+
if (this.image_name !== '') {
|
|
1026
|
+
return `/images/ranges/${this.image_name}`;
|
|
1027
|
+
}
|
|
1028
|
+
return '';
|
|
944
1029
|
}
|
|
945
1030
|
}
|
|
946
1031
|
|
|
947
|
-
class
|
|
948
|
-
constructor(
|
|
949
|
-
this.
|
|
950
|
-
this.
|
|
951
|
-
this.qty = qty;
|
|
952
|
-
this.discount = discount;
|
|
953
|
-
this.vat_rate = vat_rate;
|
|
954
|
-
this.price = price;
|
|
955
|
-
this.line_total = line_total;
|
|
1032
|
+
class EsolveRangesService {
|
|
1033
|
+
constructor(config, http) {
|
|
1034
|
+
this.config = config;
|
|
1035
|
+
this.http = http;
|
|
956
1036
|
}
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
* Price without tax
|
|
963
|
-
*/
|
|
964
|
-
price,
|
|
965
|
-
/**
|
|
966
|
-
* Price with tax
|
|
967
|
-
*/
|
|
968
|
-
price_with_tax,
|
|
969
|
-
/**
|
|
970
|
-
* Price without tax and with discounts applied if applicable
|
|
971
|
-
*/
|
|
972
|
-
price_discounted,
|
|
973
|
-
/**
|
|
974
|
-
* Price with tax and with discounts applied if applicable
|
|
975
|
-
*/
|
|
976
|
-
price_with_tax_discounted) {
|
|
977
|
-
this.price = price;
|
|
978
|
-
this.price_with_tax = price_with_tax;
|
|
979
|
-
this.price_discounted = price_discounted;
|
|
980
|
-
this.price_with_tax_discounted = price_with_tax_discounted;
|
|
1037
|
+
getRange(id) {
|
|
1038
|
+
const params = new HttpParams({
|
|
1039
|
+
fromObject: { ranges_id: id }
|
|
1040
|
+
});
|
|
1041
|
+
return this.getRangeSingle(params);
|
|
981
1042
|
}
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
this.
|
|
987
|
-
this.suburb = suburb;
|
|
988
|
-
this.city = city;
|
|
989
|
-
this.province = province;
|
|
990
|
-
this.country = country;
|
|
991
|
-
this.postal_code = postal_code;
|
|
992
|
-
this.latitude = latitude;
|
|
993
|
-
this.longitude = longitude;
|
|
1043
|
+
getRangeFromSEF(sef_range) {
|
|
1044
|
+
const params = new HttpParams({
|
|
1045
|
+
fromObject: { sef_range }
|
|
1046
|
+
});
|
|
1047
|
+
return this.getRangeSingle(params);
|
|
994
1048
|
}
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1049
|
+
getRanges(options) {
|
|
1050
|
+
let params = new HttpParams();
|
|
1051
|
+
if (options?.featured_only) {
|
|
1052
|
+
params = params.set('featured_only', options.featured_only);
|
|
1053
|
+
}
|
|
1054
|
+
if (options?.manufacturers_id) {
|
|
1055
|
+
params = params.set('manufacturers_id', options.manufacturers_id);
|
|
1056
|
+
}
|
|
1057
|
+
return this.getRangeRecords(params).pipe(map((records) => {
|
|
1058
|
+
const ranges = [];
|
|
1059
|
+
for (const record of records) {
|
|
1060
|
+
ranges.push(this.processRange(record));
|
|
1061
|
+
}
|
|
1062
|
+
return ranges;
|
|
1063
|
+
}), catchError(() => {
|
|
1064
|
+
return of([]);
|
|
1065
|
+
}));
|
|
1003
1066
|
}
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
this.city = city;
|
|
1010
|
-
this.postal_code = postal_code;
|
|
1067
|
+
getRangeSingle(params) {
|
|
1068
|
+
return this.getRangeRecords(params).pipe(map((records) => {
|
|
1069
|
+
const record = records[0];
|
|
1070
|
+
return this.processRange(record);
|
|
1071
|
+
}));
|
|
1011
1072
|
}
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
this.sunday = sunday;
|
|
1023
|
-
this.public_holiday = public_holiday;
|
|
1024
|
-
this.trading_hours_additional_info = trading_hours_additional_info;
|
|
1073
|
+
getRangeRecords(params) {
|
|
1074
|
+
return this.http
|
|
1075
|
+
.get(`${this.config.api_url}/get-ranges.php`, { params })
|
|
1076
|
+
.pipe(map((response) => {
|
|
1077
|
+
if ((response.records === undefined) ||
|
|
1078
|
+
(response.records.length <= 0)) {
|
|
1079
|
+
throw response;
|
|
1080
|
+
}
|
|
1081
|
+
return response.records;
|
|
1082
|
+
}));
|
|
1025
1083
|
}
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
class EsolveLocationTradingDay {
|
|
1029
|
-
constructor(open, close) {
|
|
1030
|
-
this.open = open;
|
|
1031
|
-
this.close = close;
|
|
1084
|
+
processRange(record) {
|
|
1085
|
+
return new EsolveRange(record);
|
|
1032
1086
|
}
|
|
1033
|
-
}
|
|
1087
|
+
}
|
|
1088
|
+
EsolveRangesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveRangesService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1089
|
+
EsolveRangesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveRangesService, providedIn: 'root' });
|
|
1090
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveRangesService, decorators: [{
|
|
1091
|
+
type: Injectable,
|
|
1092
|
+
args: [{
|
|
1093
|
+
providedIn: 'root',
|
|
1094
|
+
}]
|
|
1095
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1096
|
+
type: Inject,
|
|
1097
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
1098
|
+
}] }, { type: i1$2.HttpClient }]; } });
|
|
1034
1099
|
|
|
1035
|
-
class
|
|
1100
|
+
class EsolveTag {
|
|
1036
1101
|
constructor(record) {
|
|
1037
|
-
this.id =
|
|
1038
|
-
this.
|
|
1039
|
-
this.
|
|
1040
|
-
this.
|
|
1041
|
-
this.
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
this.address = new EsolveLocationAddress(record.street, record.suburb, record.city, record.province, record.country, record.postal_code, +record.latitude, +record.longitude);
|
|
1049
|
-
this.pobox_address = new EsolveLocationPOBoxAddress(record.pobox, record.pobox_city, record.pobox_postal_code);
|
|
1050
|
-
const telnumbers = [];
|
|
1051
|
-
if (record.branch_telnumber.length > 0) {
|
|
1052
|
-
telnumbers.push(record.branch_telnumber);
|
|
1053
|
-
}
|
|
1054
|
-
if (record.branch_telnumber_2.length > 0) {
|
|
1055
|
-
telnumbers.push(record.branch_telnumber_2);
|
|
1102
|
+
this.id = 0;
|
|
1103
|
+
this.phrase = '';
|
|
1104
|
+
this.weight = 0;
|
|
1105
|
+
this.description = '';
|
|
1106
|
+
this.image_name = '';
|
|
1107
|
+
if (record) {
|
|
1108
|
+
this.id = +(record.id ?? 0);
|
|
1109
|
+
this.phrase = record.tag_phrase ?? '';
|
|
1110
|
+
this.weight = +(record.tag_weight ?? 0);
|
|
1111
|
+
this.description = record.description ?? '';
|
|
1112
|
+
this.image_name = record.image_name ?? '';
|
|
1056
1113
|
}
|
|
1057
|
-
|
|
1058
|
-
|
|
1114
|
+
}
|
|
1115
|
+
/**
|
|
1116
|
+
* @deprecated To be removed in the future. Use `EsolveTag.phrase` instead
|
|
1117
|
+
*/
|
|
1118
|
+
get tag_phrase() {
|
|
1119
|
+
return this.phrase;
|
|
1120
|
+
}
|
|
1121
|
+
/**
|
|
1122
|
+
* @deprecated To be removed in the future. Use `EsolveTag.weight` instead
|
|
1123
|
+
*/
|
|
1124
|
+
get tag_weight() {
|
|
1125
|
+
return this.weight;
|
|
1126
|
+
}
|
|
1127
|
+
getImagePath() {
|
|
1128
|
+
if (this.image_name !== '') {
|
|
1129
|
+
return `/images/tags/${this.image_name}`;
|
|
1059
1130
|
}
|
|
1060
|
-
|
|
1061
|
-
const monday = new EsolveLocationTradingDay(record.monday_open_time, record.monday_close_time);
|
|
1062
|
-
const tuesday = new EsolveLocationTradingDay(record.tuesday_open_time, record.tuesday_close_time);
|
|
1063
|
-
const wednesday = new EsolveLocationTradingDay(record.wednesday_open_time, record.wednesday_close_time);
|
|
1064
|
-
const thursday = new EsolveLocationTradingDay(record.thursday_open_time, record.thursday_close_time);
|
|
1065
|
-
const friday = new EsolveLocationTradingDay(record.friday_open_time, record.friday_close_time);
|
|
1066
|
-
const saturday = new EsolveLocationTradingDay(record.saturday_open_time, record.saturday_close_time);
|
|
1067
|
-
const sunday = new EsolveLocationTradingDay(record.sunday_open_time, record.sunday_close_time);
|
|
1068
|
-
const public_holiday = new EsolveLocationTradingDay(record.public_holiday_open_time, record.public_holiday_close_time);
|
|
1069
|
-
this.trading_times = new EsolveLocationTradingTimes(monday, tuesday, wednesday, thursday, friday, saturday, sunday, public_holiday, record.trading_hours_additional_info);
|
|
1131
|
+
return '';
|
|
1070
1132
|
}
|
|
1071
1133
|
}
|
|
1072
1134
|
|
|
1073
|
-
class
|
|
1135
|
+
class EsolveTagsService {
|
|
1074
1136
|
constructor(config, http) {
|
|
1075
1137
|
this.config = config;
|
|
1076
1138
|
this.http = http;
|
|
1077
1139
|
}
|
|
1078
1140
|
/**
|
|
1079
|
-
* Retrieves
|
|
1141
|
+
* Retrieves active topics from the list of topic ID's. Note that inactive or expired
|
|
1142
|
+
* topics will not be retrieved.
|
|
1080
1143
|
*
|
|
1081
|
-
* @
|
|
1144
|
+
* @param options Tag filters
|
|
1082
1145
|
*/
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
.pipe(map((response) => {
|
|
1146
|
+
getTags(options) {
|
|
1147
|
+
const params = this.parseOptions(options);
|
|
1148
|
+
return this.http.get(`${this.config.api_url}/get-tags.php`, { params }).pipe(map(response => {
|
|
1087
1149
|
if (response.records === undefined) {
|
|
1088
1150
|
throw response;
|
|
1089
1151
|
}
|
|
1090
|
-
return this.
|
|
1152
|
+
return this.processTags(response.records);
|
|
1091
1153
|
}));
|
|
1092
1154
|
}
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1155
|
+
parseOptions(options) {
|
|
1156
|
+
let params = new HttpParams();
|
|
1157
|
+
if (options) {
|
|
1158
|
+
if (options.tags_id) {
|
|
1159
|
+
if (Array.isArray(options.tags_id)) {
|
|
1160
|
+
const tag_list = options.tags_id;
|
|
1161
|
+
if (tag_list.length > 0) {
|
|
1162
|
+
params = params.append('tags_id', tag_list.join(','));
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
else {
|
|
1166
|
+
params = params.append('tags_id', options.tags_id);
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
else {
|
|
1170
|
+
if (options.phrase && options.phrase !== '') {
|
|
1171
|
+
params = params.append('phrase', options.phrase);
|
|
1172
|
+
const phrase_match_mode = options.phrase_match_mode;
|
|
1173
|
+
if (phrase_match_mode) {
|
|
1174
|
+
params = params.append('phrase_match_mode', phrase_match_mode);
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
return params;
|
|
1180
|
+
}
|
|
1181
|
+
processTags(records) {
|
|
1182
|
+
const tags = [];
|
|
1101
1183
|
if (records) {
|
|
1102
1184
|
for (const record of records) {
|
|
1103
|
-
|
|
1185
|
+
const tag = new EsolveTag(record);
|
|
1186
|
+
tags.push(tag);
|
|
1104
1187
|
}
|
|
1105
1188
|
}
|
|
1106
|
-
return
|
|
1189
|
+
return tags;
|
|
1107
1190
|
}
|
|
1108
1191
|
}
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type:
|
|
1192
|
+
EsolveTagsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveTagsService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1193
|
+
EsolveTagsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveTagsService, providedIn: 'root' });
|
|
1194
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveTagsService, decorators: [{
|
|
1112
1195
|
type: Injectable,
|
|
1113
1196
|
args: [{
|
|
1114
1197
|
providedIn: 'root',
|
|
@@ -1118,564 +1201,636 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
1118
1201
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
1119
1202
|
}] }, { type: i1$2.HttpClient }]; } });
|
|
1120
1203
|
|
|
1121
|
-
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
class EsolveTransactionPaymentMethod {
|
|
1125
|
-
constructor(id, name, description, integration_type, service_provider) {
|
|
1126
|
-
this.id = id;
|
|
1127
|
-
this.name = name;
|
|
1128
|
-
this.description = description;
|
|
1129
|
-
this.integration_type = integration_type;
|
|
1130
|
-
this.service_provider = service_provider;
|
|
1131
|
-
}
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
class EsolveTransactionShippingMethod {
|
|
1135
|
-
constructor(id, name, delivery_category, location, description, pricing, client_to_collect) {
|
|
1136
|
-
this.id = id;
|
|
1137
|
-
this.name = name;
|
|
1138
|
-
this.delivery_category = delivery_category;
|
|
1139
|
-
this.location = location;
|
|
1140
|
-
this.description = description;
|
|
1141
|
-
this.pricing = pricing;
|
|
1142
|
-
this.client_to_collect = client_to_collect;
|
|
1143
|
-
}
|
|
1144
|
-
}
|
|
1145
|
-
|
|
1146
|
-
class EsolveTransactionUser {
|
|
1147
|
-
constructor(id, email, first_name, last_name, tel_number, cell_number) {
|
|
1148
|
-
this.id = id;
|
|
1149
|
-
this.email = email;
|
|
1150
|
-
this.first_name = first_name;
|
|
1151
|
-
this.last_name = last_name;
|
|
1152
|
-
this.tel_number = tel_number;
|
|
1153
|
-
this.cell_number = cell_number;
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1204
|
+
// Types
|
|
1156
1205
|
|
|
1157
|
-
class
|
|
1206
|
+
class EsolveTopic {
|
|
1158
1207
|
constructor(record) {
|
|
1159
|
-
|
|
1160
|
-
this.
|
|
1161
|
-
this.
|
|
1162
|
-
this.
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
this.expected_date = new Date(+record.expected_date_timestamp * 1000);
|
|
1169
|
-
this.invoice_amount = +record.invoice_amount;
|
|
1170
|
-
this.vat = +record.vat;
|
|
1171
|
-
this.discount = +record.discount;
|
|
1172
|
-
this.total = +record.total;
|
|
1173
|
-
this.shipping_total = +record.shipping_total;
|
|
1174
|
-
this.insurance_total = +record.insurance_total;
|
|
1175
|
-
this.payment = +record.payment;
|
|
1176
|
-
this.payment_reference = record.payment_reference;
|
|
1177
|
-
this.payment_description = record.payment_description;
|
|
1178
|
-
this.gateway_transaction_id = record.gateway_transaction_id;
|
|
1179
|
-
this.address = new EsolveTransactionAddress(record.recipient, record.address_type, record.address_description, record.street_number, record.street, record.suburb, record.city, record.province, record.country, record.postal_code, record.pobox);
|
|
1180
|
-
if (record.user) {
|
|
1181
|
-
this.user = new EsolveTransactionUser(+record.user.id, record.user.email, record.user.firstname, record.user.surname, record.user.telnumber, record.user.cellnumber);
|
|
1182
|
-
}
|
|
1183
|
-
if (record.client) {
|
|
1184
|
-
this.client = new EsolveTransactionClient(+record.client.id, record.client.account, record.client.company_name, record.client.branch_code, record.client.email, record.client.firstname, record.client.surname, record.client.contact_number);
|
|
1185
|
-
}
|
|
1186
|
-
if (record.location_details) {
|
|
1187
|
-
this.location = new EsolveTransactionLocation(record.location_details);
|
|
1188
|
-
}
|
|
1189
|
-
if (record.payment_method_details) {
|
|
1190
|
-
this.payment_method = new EsolveTransactionPaymentMethod(record.payment_method_details.id, record.payment_method_details.paymethod_name, record.payment_method_details.description, record.payment_method_details.integration_type, record.payment_method_details.service_provider);
|
|
1191
|
-
}
|
|
1192
|
-
if (record.shipping_method_details) {
|
|
1193
|
-
this.shipping_method = new EsolveTransactionShippingMethod(+record.shipping_method_details.id, record.shipping_method_details.carrier_name, record.shipping_method_details.delivery_category, record.shipping_method_details.location, record.shipping_method_details.description, record.shipping_method_details.pricing, !!record.shipping_method_details.client_to_collect);
|
|
1194
|
-
}
|
|
1195
|
-
this.parseTransactionItems(record.transaction_items);
|
|
1196
|
-
}
|
|
1197
|
-
parseTransactionItems(record_items) {
|
|
1198
|
-
for (const record_item of record_items) {
|
|
1199
|
-
const price = new EsolveTransactionItemPrice(+record_item.price_exclusive, +record_item.price_inclusive, +record_item.price_exclusive_after_discount, +record_item.price_inclusive_after_discount);
|
|
1200
|
-
const line_total = new EsolveTransactionItemPrice(+record_item.line_total_exclusive, +record_item.line_total_inclusive, +record_item.line_total_exclusive_after_discount, +record_item.line_total_inclusive_after_discount);
|
|
1201
|
-
const item = new EsolveTransactionItem(record_item.code, record_item.name, +record_item.qty, +record_item.discount, +record_item.vat_rate, price, line_total);
|
|
1202
|
-
this.items.push(item);
|
|
1208
|
+
this.id = 0;
|
|
1209
|
+
this.name = '';
|
|
1210
|
+
this.short_description = '';
|
|
1211
|
+
this.sort_priority = 0;
|
|
1212
|
+
if (record) {
|
|
1213
|
+
this.id = +(record.id ?? 0);
|
|
1214
|
+
this.name = record.name ?? '';
|
|
1215
|
+
this.short_description = record.short_description ?? '';
|
|
1216
|
+
this.sort_priority = +(record.sort_priority ?? 0);
|
|
1203
1217
|
}
|
|
1204
1218
|
}
|
|
1205
1219
|
}
|
|
1206
1220
|
|
|
1207
|
-
class
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
class EsolveChangePasswordResult extends EsolveResponseResult {
|
|
1213
|
-
constructor(response) {
|
|
1214
|
-
super(response);
|
|
1215
|
-
this.password_updated = (response.status.state === 'success');
|
|
1221
|
+
class EsolveTopicService {
|
|
1222
|
+
constructor(config, http) {
|
|
1223
|
+
this.config = config;
|
|
1224
|
+
this.http = http;
|
|
1216
1225
|
}
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
+
/**
|
|
1227
|
+
* Retrieves active topics from the list of topic ID's. Note that inactive or expired
|
|
1228
|
+
* topics will not be retrieved.
|
|
1229
|
+
*
|
|
1230
|
+
* @param topic_id_list List of topic ID's that need to be retrieved
|
|
1231
|
+
*/
|
|
1232
|
+
getTopics(topic_id_list = []) {
|
|
1233
|
+
let params = new HttpParams();
|
|
1234
|
+
if (topic_id_list.length > 0) {
|
|
1235
|
+
params = params.append('topic_id', topic_id_list.join(','));
|
|
1236
|
+
}
|
|
1237
|
+
return this.http.get(`${this.config.api_url}/get-topics.php`, { params }).pipe(map(response => {
|
|
1238
|
+
if (response.records === undefined) {
|
|
1239
|
+
throw response;
|
|
1240
|
+
}
|
|
1241
|
+
return this.processTopics(response.records);
|
|
1242
|
+
}));
|
|
1226
1243
|
}
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
this.location_id = response.session_data.location_id;
|
|
1244
|
+
processTopics(records) {
|
|
1245
|
+
const topics = [];
|
|
1246
|
+
if (records) {
|
|
1247
|
+
for (const record of records) {
|
|
1248
|
+
const topic = new EsolveTopic(record);
|
|
1249
|
+
topics.push(topic);
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
return topics;
|
|
1237
1253
|
}
|
|
1238
|
-
}
|
|
1254
|
+
}
|
|
1255
|
+
EsolveTopicService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveTopicService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1256
|
+
EsolveTopicService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveTopicService, providedIn: 'root' });
|
|
1257
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveTopicService, decorators: [{
|
|
1258
|
+
type: Injectable,
|
|
1259
|
+
args: [{
|
|
1260
|
+
providedIn: 'root',
|
|
1261
|
+
}]
|
|
1262
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1263
|
+
type: Inject,
|
|
1264
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
1265
|
+
}] }, { type: i1$2.HttpClient }]; } });
|
|
1239
1266
|
|
|
1240
|
-
class
|
|
1241
|
-
constructor(
|
|
1242
|
-
|
|
1243
|
-
this.
|
|
1267
|
+
class EsolveAsset {
|
|
1268
|
+
constructor(record) {
|
|
1269
|
+
this.id = 0;
|
|
1270
|
+
this.src = '';
|
|
1271
|
+
this.name = '';
|
|
1272
|
+
this.description = '';
|
|
1273
|
+
this.document_number = '';
|
|
1274
|
+
this.document_type = '';
|
|
1275
|
+
this.area_of_application = '';
|
|
1276
|
+
this.asset_category = '';
|
|
1277
|
+
this.asset_sub_category = '';
|
|
1278
|
+
this.sort_priority = 0;
|
|
1279
|
+
this.topics = [];
|
|
1280
|
+
this.tags = [];
|
|
1281
|
+
this.id = +record.id;
|
|
1282
|
+
this.src = record.src;
|
|
1283
|
+
this.name = record.name;
|
|
1284
|
+
this.type = record.type;
|
|
1285
|
+
this.description = record.description;
|
|
1286
|
+
this.document_number = record.document_number ?? '';
|
|
1287
|
+
this.document_type = record.document_type ?? '';
|
|
1288
|
+
this.area_of_application = record.area_of_application ?? '';
|
|
1289
|
+
this.asset_category = record.asset_category ?? '';
|
|
1290
|
+
this.asset_sub_category = record.asset_sub_category ?? '';
|
|
1291
|
+
this.sort_priority = +(record.sort_priority ?? '');
|
|
1292
|
+
if (record.created) {
|
|
1293
|
+
this.created = record.created;
|
|
1294
|
+
}
|
|
1295
|
+
if (record.category) {
|
|
1296
|
+
this.category = new EsolveCategoryTreeItem(record.category.type, record.category.id, record.category.parent_id, record.category.description, record.category.sef_description, record.category.short_description, record.category.sort_priority, record.category.active, record.category.display_only, record.category.image, record.category.seo_page_title, record.category.seo_keywords, record.category.seo_description);
|
|
1297
|
+
}
|
|
1298
|
+
if (record.subcategory) {
|
|
1299
|
+
this.subcategory = new EsolveCategoryTreeItem(record.subcategory.type, record.subcategory.id, record.subcategory.parent_id, record.subcategory.description, record.subcategory.sef_description, record.subcategory.short_description, record.subcategory.sort_priority, record.subcategory.active, record.subcategory.display_only, record.subcategory.image, record.subcategory.seo_page_title, record.subcategory.seo_keywords, record.subcategory.seo_description);
|
|
1300
|
+
}
|
|
1301
|
+
if (record.manufacturer) {
|
|
1302
|
+
this.manufacturer = new EsolveManufacturer(record.manufacturer);
|
|
1303
|
+
}
|
|
1304
|
+
if (record.range) {
|
|
1305
|
+
this.range = new EsolveRange(record.range);
|
|
1306
|
+
}
|
|
1307
|
+
if (record.topics && record.topics.length > 0) {
|
|
1308
|
+
for (const topic of record.topics) {
|
|
1309
|
+
this.topics.push(new EsolveTopic(topic));
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
if (record.tags && record.tags.length > 0) {
|
|
1313
|
+
for (const tag of record.tags) {
|
|
1314
|
+
this.tags.push(new EsolveTag(tag));
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1244
1317
|
}
|
|
1245
1318
|
}
|
|
1246
1319
|
|
|
1247
|
-
class
|
|
1248
|
-
constructor(config, http
|
|
1320
|
+
class EsolveAssetsService {
|
|
1321
|
+
constructor(config, http) {
|
|
1249
1322
|
this.config = config;
|
|
1250
1323
|
this.http = http;
|
|
1251
|
-
this.sessionService = sessionService;
|
|
1252
|
-
this.errorHandler = errorHandler;
|
|
1253
|
-
this.responseHandler = responseHandler;
|
|
1254
|
-
this._user_id = 0;
|
|
1255
|
-
this.sessionService.session.subscribe((session) => {
|
|
1256
|
-
if (session.key !== '') {
|
|
1257
|
-
this.user_id = session.id;
|
|
1258
|
-
}
|
|
1259
|
-
});
|
|
1260
|
-
}
|
|
1261
|
-
get user_id() {
|
|
1262
|
-
return this._user_id;
|
|
1263
|
-
}
|
|
1264
|
-
set user_id(value) {
|
|
1265
|
-
value = ((value > 0) ? value : 0);
|
|
1266
|
-
if (this._user_id !== value) {
|
|
1267
|
-
this._user_id = value;
|
|
1268
|
-
}
|
|
1269
|
-
}
|
|
1270
|
-
updateUserAccount(user_account_data) {
|
|
1271
|
-
const body = {
|
|
1272
|
-
account: user_account_data
|
|
1273
|
-
};
|
|
1274
|
-
return this.http
|
|
1275
|
-
.post(`${this.config.api_url}/set-user-account.php`, body, {
|
|
1276
|
-
headers: {
|
|
1277
|
-
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
|
|
1278
|
-
},
|
|
1279
|
-
responseType: 'json',
|
|
1280
|
-
observe: 'body'
|
|
1281
|
-
})
|
|
1282
|
-
.pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => new EsolveUserAccountResult(response))), catchError((errorRes) => {
|
|
1283
|
-
return this.errorHandler.handleHttpPostError('set-user-account', errorRes);
|
|
1284
|
-
}));
|
|
1285
1324
|
}
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
.pipe(map((response) => {
|
|
1325
|
+
getAsset(id) {
|
|
1326
|
+
const params = new HttpParams({ fromObject: { assets_id: id } });
|
|
1327
|
+
return this.getAssetRecords(params).pipe(map((response) => {
|
|
1290
1328
|
if ((response.records === undefined) ||
|
|
1291
|
-
(response.records.length
|
|
1329
|
+
(response.records.length <= 0)) {
|
|
1292
1330
|
throw response;
|
|
1293
1331
|
}
|
|
1294
1332
|
const record = response.records[0];
|
|
1295
|
-
return this.
|
|
1333
|
+
return this.processAsset(record);
|
|
1296
1334
|
}));
|
|
1297
1335
|
}
|
|
1298
|
-
|
|
1299
|
-
const
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
return
|
|
1336
|
+
getAssets(options) {
|
|
1337
|
+
const params = this.parseOptions(options);
|
|
1338
|
+
return this.getAssetRecords(params).pipe(map((response) => {
|
|
1339
|
+
if (response.records === undefined) {
|
|
1340
|
+
throw response;
|
|
1341
|
+
}
|
|
1342
|
+
const assets = [];
|
|
1343
|
+
for (const record of response.records) {
|
|
1344
|
+
assets.push(this.processAsset(record));
|
|
1345
|
+
}
|
|
1346
|
+
const page = options?.page ?? 0;
|
|
1347
|
+
const rows = options?.rows ?? 0;
|
|
1348
|
+
const total = +response.additional_data.total_records;
|
|
1349
|
+
return new EsolveList(assets, page, rows, total);
|
|
1312
1350
|
}));
|
|
1313
1351
|
}
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
.pipe(map((response) => {
|
|
1322
|
-
if (response.records === undefined) {
|
|
1323
|
-
throw response;
|
|
1324
|
-
}
|
|
1325
|
-
return this.processUserAddress(response.records);
|
|
1326
|
-
}));
|
|
1352
|
+
processAsset(record) {
|
|
1353
|
+
return new EsolveAsset(record);
|
|
1354
|
+
}
|
|
1355
|
+
parseOptions(options) {
|
|
1356
|
+
let params = new HttpParams();
|
|
1357
|
+
if (!options) {
|
|
1358
|
+
return params;
|
|
1327
1359
|
}
|
|
1328
|
-
|
|
1329
|
-
|
|
1360
|
+
if (options.page) {
|
|
1361
|
+
params = params.set('page', options.page);
|
|
1362
|
+
}
|
|
1363
|
+
if (options.rows) {
|
|
1364
|
+
params = params.set('rows', options.rows);
|
|
1365
|
+
}
|
|
1366
|
+
if (options.asset_type) {
|
|
1367
|
+
params = params.set('asset_type', options.asset_type);
|
|
1368
|
+
}
|
|
1369
|
+
if (options.category_id) {
|
|
1370
|
+
params = params.set('category_id', options.category_id);
|
|
1371
|
+
}
|
|
1372
|
+
if (options.subcategory_id) {
|
|
1373
|
+
params = params.set('subcategory_id', options.subcategory_id);
|
|
1374
|
+
}
|
|
1375
|
+
if (options.manufacturers_id) {
|
|
1376
|
+
params = params.set('manufacturers_id', options.manufacturers_id);
|
|
1377
|
+
}
|
|
1378
|
+
if (options.ranges_id) {
|
|
1379
|
+
params = params.set('ranges_id', options.ranges_id);
|
|
1380
|
+
}
|
|
1381
|
+
if (options.asset_category) {
|
|
1382
|
+
params = params.set('asset_category', options.asset_category);
|
|
1330
1383
|
}
|
|
1384
|
+
if (options.asset_sub_category) {
|
|
1385
|
+
params = params.set('asset_sub_category', options.asset_sub_category);
|
|
1386
|
+
}
|
|
1387
|
+
return params;
|
|
1331
1388
|
}
|
|
1332
|
-
|
|
1333
|
-
return this.http
|
|
1334
|
-
.delete(`${this.config.api_url}/delete-address.php`, {
|
|
1335
|
-
params: { id },
|
|
1336
|
-
responseType: 'json',
|
|
1337
|
-
observe: 'body'
|
|
1338
|
-
})
|
|
1339
|
-
.pipe(map((http_response) => {
|
|
1340
|
-
if ((http_response.result === undefined) ||
|
|
1341
|
-
(http_response.result === null) ||
|
|
1342
|
-
(http_response.result.status !== 'success')) {
|
|
1343
|
-
throw http_response;
|
|
1344
|
-
}
|
|
1345
|
-
return new EsolveResult(http_response.result.status, http_response.result.code, http_response.result.message);
|
|
1346
|
-
}), catchError((errorRes) => {
|
|
1347
|
-
return this.errorHandler.handleHttpDeleteError('delete-address', errorRes);
|
|
1348
|
-
}));
|
|
1389
|
+
getAssetRecords(params) {
|
|
1390
|
+
return this.http.get(`${this.config.api_url}/get-assets.php`, { params });
|
|
1349
1391
|
}
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
}));
|
|
1392
|
+
}
|
|
1393
|
+
EsolveAssetsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveAssetsService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1394
|
+
EsolveAssetsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveAssetsService, providedIn: 'root' });
|
|
1395
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveAssetsService, decorators: [{
|
|
1396
|
+
type: Injectable,
|
|
1397
|
+
args: [{
|
|
1398
|
+
providedIn: 'root',
|
|
1399
|
+
}]
|
|
1400
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1401
|
+
type: Inject,
|
|
1402
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
1403
|
+
}] }, { type: i1$2.HttpClient }]; } });
|
|
1404
|
+
|
|
1405
|
+
// Types
|
|
1406
|
+
|
|
1407
|
+
class EsolveAuthService {
|
|
1408
|
+
constructor(config, http, session, errorHandler, cookieService) {
|
|
1409
|
+
this.config = config;
|
|
1410
|
+
this.http = http;
|
|
1411
|
+
this.session = session;
|
|
1412
|
+
this.errorHandler = errorHandler;
|
|
1413
|
+
this.cookieService = cookieService;
|
|
1373
1414
|
}
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
}
|
|
1415
|
+
getAccessToken(email, password, anonymous = false) {
|
|
1416
|
+
let params = new HttpParams();
|
|
1417
|
+
if (anonymous) {
|
|
1418
|
+
params = params.set('anonymous', true);
|
|
1419
|
+
}
|
|
1420
|
+
if (email !== '') {
|
|
1421
|
+
params = params.set('email', email);
|
|
1422
|
+
}
|
|
1423
|
+
if (password !== '') {
|
|
1424
|
+
params = params.set('password', password);
|
|
1425
|
+
}
|
|
1379
1426
|
return this.http
|
|
1380
|
-
.
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
observe: 'body'
|
|
1427
|
+
.get(`${this.config.api_url}/get-access-token.php`, {
|
|
1428
|
+
params,
|
|
1429
|
+
headers: new HttpHeaders({
|
|
1430
|
+
'Accept-Language': '*',
|
|
1431
|
+
}),
|
|
1386
1432
|
})
|
|
1387
|
-
.pipe(
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
}));
|
|
1392
|
-
}
|
|
1393
|
-
sendForgotPasswordRequest(email) {
|
|
1394
|
-
return this.http
|
|
1395
|
-
.get(`${this.config.api_url}/get-forgot-password.php`, { params: { email } })
|
|
1396
|
-
.pipe(map((response) => {
|
|
1397
|
-
if ((response.records === undefined) ||
|
|
1398
|
-
!('reset_link_sent' in response.records)) {
|
|
1399
|
-
throw response;
|
|
1433
|
+
.pipe(tap((responseData) => {
|
|
1434
|
+
if ((responseData.type === 'error') ||
|
|
1435
|
+
(responseData.type === 'exception')) {
|
|
1436
|
+
throw responseData;
|
|
1400
1437
|
}
|
|
1401
|
-
|
|
1438
|
+
}), catchError(this.handleError), tap((responseData) => {
|
|
1439
|
+
this.handleAuthentication(responseData.additional_data);
|
|
1402
1440
|
}));
|
|
1403
1441
|
}
|
|
1404
|
-
|
|
1442
|
+
autoLogin() {
|
|
1443
|
+
this.session.restore(this.handleExpiration(), () => {
|
|
1444
|
+
this.getAccessToken('', '', true).toPromise().then(() => { }, (error) => {
|
|
1445
|
+
console.error(error);
|
|
1446
|
+
});
|
|
1447
|
+
});
|
|
1448
|
+
}
|
|
1449
|
+
login(email, password) {
|
|
1450
|
+
const body = {
|
|
1451
|
+
login: {
|
|
1452
|
+
email,
|
|
1453
|
+
password
|
|
1454
|
+
}
|
|
1455
|
+
};
|
|
1405
1456
|
return this.http
|
|
1406
|
-
.post(`${this.config.api_url}/set-
|
|
1407
|
-
reset_key,
|
|
1408
|
-
password,
|
|
1409
|
-
confirm_password,
|
|
1410
|
-
auto_login
|
|
1411
|
-
}, {
|
|
1457
|
+
.post(`${this.config.api_url}/set-login.php`, body, {
|
|
1412
1458
|
headers: {
|
|
1413
1459
|
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
|
|
1414
1460
|
},
|
|
1415
1461
|
responseType: 'json',
|
|
1416
1462
|
observe: 'body'
|
|
1417
1463
|
})
|
|
1418
|
-
.pipe(map((
|
|
1419
|
-
if (
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
location_id: +response.session_data.location_id,
|
|
1423
|
-
});
|
|
1464
|
+
.pipe(map((response) => {
|
|
1465
|
+
if ((response.responses === undefined) ||
|
|
1466
|
+
(response.responses.length <= 0)) {
|
|
1467
|
+
throw response;
|
|
1424
1468
|
}
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1469
|
+
const login_response = response.responses[0];
|
|
1470
|
+
if ((login_response.status.state !== 'success') &&
|
|
1471
|
+
(login_response.status.state !== 'warning')) {
|
|
1472
|
+
throw login_response;
|
|
1473
|
+
}
|
|
1474
|
+
for (const response_log of login_response.log) {
|
|
1475
|
+
if ((response_log.type === 'success') &&
|
|
1476
|
+
(response_log.message_code === 'login_success')) {
|
|
1477
|
+
const session_data = login_response.session_data;
|
|
1478
|
+
const user_id = +login_response.esolve_id;
|
|
1479
|
+
const location_id = +session_data.location_id;
|
|
1480
|
+
this.session.handleUpdateSession({
|
|
1481
|
+
user_id: user_id,
|
|
1482
|
+
location_id: location_id
|
|
1483
|
+
});
|
|
1484
|
+
return user_id;
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
throw login_response;
|
|
1488
|
+
}), catchError((errorRes) => {
|
|
1489
|
+
return this.errorHandler.handleHttpPostError('set-login', errorRes);
|
|
1428
1490
|
}));
|
|
1429
1491
|
}
|
|
1430
|
-
|
|
1431
|
-
|
|
1492
|
+
logout() {
|
|
1493
|
+
this.session.clearTimer();
|
|
1494
|
+
this.cookieService.delete('_ws_id');
|
|
1495
|
+
return this.getAccessToken('', '', true).toPromise();
|
|
1496
|
+
}
|
|
1497
|
+
checkAccessToken(session) {
|
|
1498
|
+
session = session || this.session.currentSession;
|
|
1499
|
+
const token = session?.key ?? '';
|
|
1432
1500
|
return this.http
|
|
1433
|
-
.
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
observe: 'body',
|
|
1501
|
+
.get(`${this.config.api_url}/get-access-token.php`, {
|
|
1502
|
+
params: { key: token },
|
|
1503
|
+
headers: new HttpHeaders({
|
|
1504
|
+
'Accept-Language': '*'
|
|
1505
|
+
}),
|
|
1439
1506
|
})
|
|
1440
|
-
.pipe(map((
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1507
|
+
.pipe(map((responseData) => {
|
|
1508
|
+
if ((responseData.type === 'error') ||
|
|
1509
|
+
(responseData.type === 'exception') ||
|
|
1510
|
+
(!responseData.additional_data.key_okay)) {
|
|
1511
|
+
throw responseData;
|
|
1512
|
+
}
|
|
1513
|
+
const additional_data = responseData.additional_data;
|
|
1514
|
+
const result = {
|
|
1515
|
+
key: token,
|
|
1516
|
+
expires: additional_data.expires,
|
|
1517
|
+
expiry_time: additional_data.expiry_time,
|
|
1518
|
+
location_id: additional_data.location_id,
|
|
1519
|
+
user_id: additional_data.user_id,
|
|
1520
|
+
};
|
|
1521
|
+
return result;
|
|
1522
|
+
}))
|
|
1523
|
+
.toPromise();
|
|
1444
1524
|
}
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
.
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
}
|
|
1459
|
-
const items = this.processTransactions(response.records);
|
|
1460
|
-
const total = +response.additional_data.total_records ?? 0;
|
|
1461
|
-
const rows = options.rows ?? total;
|
|
1462
|
-
const page = options.page || 1;
|
|
1463
|
-
return new EsolveTransactionList(items, page, rows, total);
|
|
1464
|
-
}));
|
|
1525
|
+
// Handlers
|
|
1526
|
+
handleExpiration() {
|
|
1527
|
+
return (session) => {
|
|
1528
|
+
this.checkAccessToken(session).then((response) => {
|
|
1529
|
+
this.handleAuthentication(response);
|
|
1530
|
+
}, () => {
|
|
1531
|
+
this.logout();
|
|
1532
|
+
});
|
|
1533
|
+
};
|
|
1534
|
+
}
|
|
1535
|
+
handleAuthentication(result) {
|
|
1536
|
+
if (!result.key) {
|
|
1537
|
+
return;
|
|
1465
1538
|
}
|
|
1466
|
-
|
|
1539
|
+
this.session.handleSession(+result.user_id, +result.location_id, result.key, +result.expiry_time, +result.expires, this.handleExpiration());
|
|
1540
|
+
}
|
|
1541
|
+
handleError(errorRes) {
|
|
1542
|
+
const error = {
|
|
1543
|
+
message: 'An unknown error occurred',
|
|
1544
|
+
data: {},
|
|
1545
|
+
};
|
|
1546
|
+
if ((!errorRes.type) ||
|
|
1547
|
+
(!errorRes.service_type) ||
|
|
1548
|
+
(!errorRes.message)) {
|
|
1467
1549
|
return throwError(error);
|
|
1468
1550
|
}
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
try {
|
|
1472
|
-
this.loginGuard();
|
|
1473
|
-
return this.http
|
|
1474
|
-
.get(`${this.config.api_url}/get-transactions.php`, {
|
|
1475
|
-
params: {
|
|
1476
|
-
user_id: this.user_id,
|
|
1477
|
-
transaction_id: id,
|
|
1478
|
-
}
|
|
1479
|
-
})
|
|
1480
|
-
.pipe(map((response) => {
|
|
1481
|
-
if ((response.records === undefined) ||
|
|
1482
|
-
(response.records.length <= 0)) {
|
|
1483
|
-
throw response;
|
|
1484
|
-
}
|
|
1485
|
-
const items = this.processTransactions(response.records);
|
|
1486
|
-
return items[0];
|
|
1487
|
-
}));
|
|
1551
|
+
if (errorRes.message.trim() !== '') {
|
|
1552
|
+
error.message = errorRes.message;
|
|
1488
1553
|
}
|
|
1489
|
-
|
|
1490
|
-
|
|
1554
|
+
if (errorRes.additional_data) {
|
|
1555
|
+
error.data = errorRes.additional_data;
|
|
1491
1556
|
}
|
|
1557
|
+
return throwError(error);
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
EsolveAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveAuthService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }, { token: EsolveSessionService }, { token: EsolveErrorHandlerService }, { token: EsolveCookieService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1561
|
+
EsolveAuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveAuthService, providedIn: 'root' });
|
|
1562
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveAuthService, decorators: [{
|
|
1563
|
+
type: Injectable,
|
|
1564
|
+
args: [{
|
|
1565
|
+
providedIn: 'root',
|
|
1566
|
+
}]
|
|
1567
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1568
|
+
type: Inject,
|
|
1569
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
1570
|
+
}] }, { type: i1$2.HttpClient }, { type: EsolveSessionService }, { type: EsolveErrorHandlerService }, { type: EsolveCookieService }]; } });
|
|
1571
|
+
|
|
1572
|
+
class EsolveAddress {
|
|
1573
|
+
constructor(id, recipient, address_type, pobox, place_name, street_number, street, suburb, city, province, country, postal_code, latitude, longitude) {
|
|
1574
|
+
this.id = id;
|
|
1575
|
+
this.recipient = recipient;
|
|
1576
|
+
this.address_type = address_type;
|
|
1577
|
+
this.pobox = pobox;
|
|
1578
|
+
this.place_name = place_name;
|
|
1579
|
+
this.street_number = street_number;
|
|
1580
|
+
this.street = street;
|
|
1581
|
+
this.suburb = suburb;
|
|
1582
|
+
this.city = city;
|
|
1583
|
+
this.province = province;
|
|
1584
|
+
this.country = country;
|
|
1585
|
+
this.postal_code = postal_code;
|
|
1586
|
+
this.latitude = latitude;
|
|
1587
|
+
this.longitude = longitude;
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1591
|
+
class EsolveAddressResult extends EsolveResponseResult {
|
|
1592
|
+
constructor(response) {
|
|
1593
|
+
super(response);
|
|
1594
|
+
this.id = response.esolve_id;
|
|
1595
|
+
this.address_validated = response.address_validated;
|
|
1596
|
+
this.geocode_status = response.geocode_status;
|
|
1597
|
+
this.geocode_result = response.geocode_result;
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
class EsolveUserAccount {
|
|
1602
|
+
constructor(esolve_id, email, registration_type, title, first_name, last_name, initials, gender, identification_number) {
|
|
1603
|
+
this.esolve_id = esolve_id;
|
|
1604
|
+
this.email = email;
|
|
1605
|
+
this.registration_type = registration_type;
|
|
1606
|
+
this.title = title;
|
|
1607
|
+
this.first_name = first_name;
|
|
1608
|
+
this.last_name = last_name;
|
|
1609
|
+
this.initials = initials;
|
|
1610
|
+
this.gender = gender;
|
|
1611
|
+
this.identification_number = identification_number;
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
class EsolveUserAccountResult extends EsolveResponseResult {
|
|
1616
|
+
constructor(response) {
|
|
1617
|
+
super(response);
|
|
1618
|
+
this.id = 0;
|
|
1619
|
+
this.id = +response.esolve_id;
|
|
1620
|
+
}
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1623
|
+
class EsolveUserAccountBusiness {
|
|
1624
|
+
constructor(name, vat_number, description, type) {
|
|
1625
|
+
this.name = name;
|
|
1626
|
+
this.vat_number = vat_number;
|
|
1627
|
+
this.description = description;
|
|
1628
|
+
this.type = type;
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
class EsolveUserAccountContact {
|
|
1633
|
+
constructor(tel_number, cell_number, fax_number) {
|
|
1634
|
+
this.tel_number = tel_number;
|
|
1635
|
+
this.cell_number = cell_number;
|
|
1636
|
+
this.fax_number = fax_number;
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
class EsolveTransactionAddress {
|
|
1641
|
+
constructor(recipient, address_type, address_description, street_number, street, suburb, city, province, country, postal_code, pobox) {
|
|
1642
|
+
this.recipient = recipient;
|
|
1643
|
+
this.address_type = address_type;
|
|
1644
|
+
this.address_description = address_description;
|
|
1645
|
+
this.street_number = street_number;
|
|
1646
|
+
this.street = street;
|
|
1647
|
+
this.suburb = suburb;
|
|
1648
|
+
this.city = city;
|
|
1649
|
+
this.province = province;
|
|
1650
|
+
this.country = country;
|
|
1651
|
+
this.postal_code = postal_code;
|
|
1652
|
+
this.pobox = pobox;
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
class EsolveTransactionClient {
|
|
1657
|
+
constructor(id, account, company_name, branch_code, email, first_name, last_name, contact_number) {
|
|
1658
|
+
this.id = id;
|
|
1659
|
+
this.account = account;
|
|
1660
|
+
this.company_name = company_name;
|
|
1661
|
+
this.branch_code = branch_code;
|
|
1662
|
+
this.email = email;
|
|
1663
|
+
this.first_name = first_name;
|
|
1664
|
+
this.last_name = last_name;
|
|
1665
|
+
this.contact_number = contact_number;
|
|
1492
1666
|
}
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
class EsolveTransactionItem {
|
|
1670
|
+
constructor(code, name, qty, discount, vat_rate, price, line_total) {
|
|
1671
|
+
this.code = code;
|
|
1672
|
+
this.name = name;
|
|
1673
|
+
this.qty = qty;
|
|
1674
|
+
this.discount = discount;
|
|
1675
|
+
this.vat_rate = vat_rate;
|
|
1676
|
+
this.price = price;
|
|
1677
|
+
this.line_total = line_total;
|
|
1504
1678
|
}
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1681
|
+
class EsolveTransactionItemPrice {
|
|
1682
|
+
constructor(
|
|
1683
|
+
/**
|
|
1684
|
+
* Price without tax
|
|
1685
|
+
*/
|
|
1686
|
+
price,
|
|
1687
|
+
/**
|
|
1688
|
+
* Price with tax
|
|
1689
|
+
*/
|
|
1690
|
+
price_with_tax,
|
|
1691
|
+
/**
|
|
1692
|
+
* Price without tax and with discounts applied if applicable
|
|
1693
|
+
*/
|
|
1694
|
+
price_discounted,
|
|
1695
|
+
/**
|
|
1696
|
+
* Price with tax and with discounts applied if applicable
|
|
1697
|
+
*/
|
|
1698
|
+
price_with_tax_discounted) {
|
|
1699
|
+
this.price = price;
|
|
1700
|
+
this.price_with_tax = price_with_tax;
|
|
1701
|
+
this.price_discounted = price_discounted;
|
|
1702
|
+
this.price_with_tax_discounted = price_with_tax_discounted;
|
|
1517
1703
|
}
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
class EsolveLocationAddress {
|
|
1707
|
+
constructor(street, suburb, city, province, country, postal_code, latitude, longitude) {
|
|
1708
|
+
this.street = street;
|
|
1709
|
+
this.suburb = suburb;
|
|
1710
|
+
this.city = city;
|
|
1711
|
+
this.province = province;
|
|
1712
|
+
this.country = country;
|
|
1713
|
+
this.postal_code = postal_code;
|
|
1714
|
+
this.latitude = latitude;
|
|
1715
|
+
this.longitude = longitude;
|
|
1527
1716
|
}
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
class EsolveLocationContactInfo {
|
|
1720
|
+
constructor(telnumber, cellnumber, email, fax) {
|
|
1721
|
+
this.telnumber = telnumber;
|
|
1722
|
+
this.cellnumber = cellnumber;
|
|
1723
|
+
this.email = email;
|
|
1724
|
+
this.fax = fax;
|
|
1532
1725
|
}
|
|
1533
|
-
}
|
|
1534
|
-
EsolveAccountService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveAccountService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }, { token: EsolveSessionService }, { token: EsolveErrorHandlerService }, { token: EsolveResponseHandlerService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1535
|
-
EsolveAccountService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveAccountService, providedIn: 'root' });
|
|
1536
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveAccountService, decorators: [{
|
|
1537
|
-
type: Injectable,
|
|
1538
|
-
args: [{
|
|
1539
|
-
providedIn: 'root',
|
|
1540
|
-
}]
|
|
1541
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1542
|
-
type: Inject,
|
|
1543
|
-
args: [ESOLVE_CONNECT_CONFIG]
|
|
1544
|
-
}] }, { type: i1$2.HttpClient }, { type: EsolveSessionService }, { type: EsolveErrorHandlerService }, { type: EsolveResponseHandlerService }]; } });
|
|
1726
|
+
}
|
|
1545
1727
|
|
|
1546
|
-
class
|
|
1547
|
-
constructor(
|
|
1548
|
-
this.
|
|
1549
|
-
this.
|
|
1550
|
-
this.
|
|
1551
|
-
this.type = type;
|
|
1552
|
-
this.title = title;
|
|
1553
|
-
this.article = article;
|
|
1554
|
-
this.sort_priority = sort_priority;
|
|
1555
|
-
this.link = link;
|
|
1556
|
-
this.desktop_images = [];
|
|
1557
|
-
this.mobile_images = [];
|
|
1558
|
-
this.sub_images = [];
|
|
1559
|
-
if (images.desktop) {
|
|
1560
|
-
this.desktop_images = images.desktop;
|
|
1561
|
-
}
|
|
1562
|
-
if (images.mobile) {
|
|
1563
|
-
this.mobile_images = images.mobile;
|
|
1564
|
-
}
|
|
1565
|
-
if (images.sub) {
|
|
1566
|
-
this.sub_images = images.sub;
|
|
1567
|
-
}
|
|
1728
|
+
class EsolveLocationPOBoxAddress {
|
|
1729
|
+
constructor(pobox, city, postal_code) {
|
|
1730
|
+
this.pobox = pobox;
|
|
1731
|
+
this.city = city;
|
|
1732
|
+
this.postal_code = postal_code;
|
|
1568
1733
|
}
|
|
1569
1734
|
}
|
|
1570
1735
|
|
|
1571
|
-
class
|
|
1572
|
-
constructor(
|
|
1573
|
-
this.
|
|
1574
|
-
this.
|
|
1575
|
-
this.
|
|
1576
|
-
this.
|
|
1577
|
-
this.
|
|
1578
|
-
this.
|
|
1736
|
+
class EsolveLocationTradingTimes {
|
|
1737
|
+
constructor(monday, tuesday, wednesday, thursday, friday, saturday, sunday, public_holiday, trading_hours_additional_info = '') {
|
|
1738
|
+
this.monday = monday;
|
|
1739
|
+
this.tuesday = tuesday;
|
|
1740
|
+
this.wednesday = wednesday;
|
|
1741
|
+
this.thursday = thursday;
|
|
1742
|
+
this.friday = friday;
|
|
1743
|
+
this.saturday = saturday;
|
|
1744
|
+
this.sunday = sunday;
|
|
1745
|
+
this.public_holiday = public_holiday;
|
|
1746
|
+
this.trading_hours_additional_info = trading_hours_additional_info;
|
|
1579
1747
|
}
|
|
1580
|
-
|
|
1581
|
-
|
|
1748
|
+
}
|
|
1749
|
+
|
|
1750
|
+
class EsolveLocationTradingDay {
|
|
1751
|
+
constructor(open, close) {
|
|
1752
|
+
this.open = open;
|
|
1753
|
+
this.close = close;
|
|
1582
1754
|
}
|
|
1583
1755
|
}
|
|
1584
1756
|
|
|
1585
|
-
class
|
|
1586
|
-
constructor(
|
|
1587
|
-
this.
|
|
1588
|
-
this.
|
|
1589
|
-
this.
|
|
1590
|
-
this.
|
|
1757
|
+
class EsolveLocation {
|
|
1758
|
+
constructor(record) {
|
|
1759
|
+
this.id = +record.id;
|
|
1760
|
+
this.identifier = record.identifier;
|
|
1761
|
+
this.description = record.description;
|
|
1762
|
+
this.head_office = record.head_office;
|
|
1763
|
+
this.erp_identifier = record.erp_identifier;
|
|
1764
|
+
this.external_system_code = record.external_system_code;
|
|
1765
|
+
this.default_location_for_payment_methods = record.default_location_for_payment_methods;
|
|
1766
|
+
this.userid = +record.userid;
|
|
1767
|
+
this.importance = +record.importance;
|
|
1768
|
+
this.active = record.is_active;
|
|
1769
|
+
this.website_url = record.website_url;
|
|
1770
|
+
this.address = new EsolveLocationAddress(record.street, record.suburb, record.city, record.province, record.country, record.postal_code, +record.latitude, +record.longitude);
|
|
1771
|
+
this.pobox_address = new EsolveLocationPOBoxAddress(record.pobox, record.pobox_city, record.pobox_postal_code);
|
|
1772
|
+
const telnumbers = [];
|
|
1773
|
+
if (record.branch_telnumber.length > 0) {
|
|
1774
|
+
telnumbers.push(record.branch_telnumber);
|
|
1775
|
+
}
|
|
1776
|
+
if (record.branch_telnumber_2.length > 0) {
|
|
1777
|
+
telnumbers.push(record.branch_telnumber_2);
|
|
1778
|
+
}
|
|
1779
|
+
if (record.branch_telnumber_3.length > 0) {
|
|
1780
|
+
telnumbers.push(record.branch_telnumber_3);
|
|
1781
|
+
}
|
|
1782
|
+
this.contact_info = new EsolveLocationContactInfo(telnumbers, record.branch_cellnumber, record.branch_email, record.branch_fax);
|
|
1783
|
+
const monday = new EsolveLocationTradingDay(record.monday_open_time, record.monday_close_time);
|
|
1784
|
+
const tuesday = new EsolveLocationTradingDay(record.tuesday_open_time, record.tuesday_close_time);
|
|
1785
|
+
const wednesday = new EsolveLocationTradingDay(record.wednesday_open_time, record.wednesday_close_time);
|
|
1786
|
+
const thursday = new EsolveLocationTradingDay(record.thursday_open_time, record.thursday_close_time);
|
|
1787
|
+
const friday = new EsolveLocationTradingDay(record.friday_open_time, record.friday_close_time);
|
|
1788
|
+
const saturday = new EsolveLocationTradingDay(record.saturday_open_time, record.saturday_close_time);
|
|
1789
|
+
const sunday = new EsolveLocationTradingDay(record.sunday_open_time, record.sunday_close_time);
|
|
1790
|
+
const public_holiday = new EsolveLocationTradingDay(record.public_holiday_open_time, record.public_holiday_close_time);
|
|
1791
|
+
this.trading_times = new EsolveLocationTradingTimes(monday, tuesday, wednesday, thursday, friday, saturday, sunday, public_holiday, record.trading_hours_additional_info);
|
|
1591
1792
|
}
|
|
1592
1793
|
}
|
|
1593
1794
|
|
|
1594
|
-
class
|
|
1795
|
+
class EsolveLocationsService {
|
|
1595
1796
|
constructor(config, http) {
|
|
1596
1797
|
this.config = config;
|
|
1597
1798
|
this.http = http;
|
|
1598
1799
|
}
|
|
1599
1800
|
/**
|
|
1600
|
-
* Retrieves
|
|
1801
|
+
* Retrieves a list of stock locations
|
|
1601
1802
|
*
|
|
1602
|
-
* @returns An
|
|
1803
|
+
* @returns An `Observable` with an array of stock locations
|
|
1603
1804
|
*/
|
|
1604
|
-
|
|
1605
|
-
let params = new HttpParams({
|
|
1606
|
-
fromObject: { enable_date_filter }
|
|
1607
|
-
});
|
|
1608
|
-
if (identifier) {
|
|
1609
|
-
params = params.set('identifier', identifier);
|
|
1610
|
-
}
|
|
1611
|
-
if (banner_display_container) {
|
|
1612
|
-
params = params.set('banner_display_container', banner_display_container);
|
|
1613
|
-
}
|
|
1805
|
+
getStockLocations() {
|
|
1614
1806
|
return this.http
|
|
1615
|
-
.get(`${this.config.api_url}/get-
|
|
1807
|
+
.get(`${this.config.api_url}/get-locations.php`)
|
|
1616
1808
|
.pipe(map((response) => {
|
|
1617
1809
|
if (response.records === undefined) {
|
|
1618
1810
|
throw response;
|
|
1619
1811
|
}
|
|
1620
|
-
return this.
|
|
1812
|
+
return this.processStockLocations(response.records);
|
|
1621
1813
|
}));
|
|
1622
1814
|
}
|
|
1623
|
-
processBannerImageHotspots(hotspot_records) {
|
|
1624
|
-
const hotspots = [];
|
|
1625
|
-
if (hotspot_records.length > 0) {
|
|
1626
|
-
for (const hotspot_record of hotspot_records) {
|
|
1627
|
-
const hotspot = new EsolveBannerImageHotspot(hotspot_record.url, hotspot_record.target, hotspot_record.coords, hotspot_record.coords_string);
|
|
1628
|
-
hotspots.push(hotspot);
|
|
1629
|
-
}
|
|
1630
|
-
}
|
|
1631
|
-
return hotspots;
|
|
1632
|
-
}
|
|
1633
|
-
processBannerImages(image_records, banner_type) {
|
|
1634
|
-
const images = [];
|
|
1635
|
-
if (image_records.length > 0) {
|
|
1636
|
-
for (const image_record of image_records) {
|
|
1637
|
-
const image = new EsolveBannerImage(+image_record.id, image_record.image_type, +image_record.width, +image_record.height, image_record.filename);
|
|
1638
|
-
if ((banner_type === 'hotspot') && (image_record.hotspots)) {
|
|
1639
|
-
const hotspots = this.processBannerImageHotspots(image_record.hotspots);
|
|
1640
|
-
image.hotspots = hotspots;
|
|
1641
|
-
}
|
|
1642
|
-
images.push(image);
|
|
1643
|
-
}
|
|
1644
|
-
}
|
|
1645
|
-
return images;
|
|
1646
|
-
}
|
|
1647
1815
|
/**
|
|
1648
|
-
*
|
|
1649
|
-
*
|
|
1650
|
-
* @
|
|
1816
|
+
* Processes the eSolve stock location records.
|
|
1817
|
+
*
|
|
1818
|
+
* @param records Records to process
|
|
1819
|
+
* @returns An array of processed stock location records
|
|
1651
1820
|
*/
|
|
1652
|
-
|
|
1653
|
-
const
|
|
1654
|
-
if (
|
|
1821
|
+
processStockLocations(records) {
|
|
1822
|
+
const stock_locations = [];
|
|
1823
|
+
if (records) {
|
|
1655
1824
|
for (const record of records) {
|
|
1656
|
-
|
|
1657
|
-
if (record.images.desktop) {
|
|
1658
|
-
image_sets.desktop = this.processBannerImages(record.images.desktop, record.type);
|
|
1659
|
-
}
|
|
1660
|
-
if (record.images.mobile) {
|
|
1661
|
-
image_sets.mobile = this.processBannerImages(record.images.mobile, record.type);
|
|
1662
|
-
}
|
|
1663
|
-
if (record.images.sub) {
|
|
1664
|
-
image_sets.sub = this.processBannerImages(record.images.sub, record.type);
|
|
1665
|
-
}
|
|
1666
|
-
const banner = new EsolveBanner(+record.id, record.banner_display_container, record.identifier, record.type, record.title, record.article, +record.sort_priority, {
|
|
1667
|
-
url: record.link.url,
|
|
1668
|
-
target: record.link.target
|
|
1669
|
-
}, image_sets);
|
|
1670
|
-
banners.push(banner);
|
|
1825
|
+
stock_locations.push(new EsolveLocation(record));
|
|
1671
1826
|
}
|
|
1672
1827
|
}
|
|
1673
|
-
return
|
|
1828
|
+
return stock_locations;
|
|
1674
1829
|
}
|
|
1675
1830
|
}
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type:
|
|
1831
|
+
EsolveLocationsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveLocationsService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1832
|
+
EsolveLocationsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveLocationsService, providedIn: 'root' });
|
|
1833
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveLocationsService, decorators: [{
|
|
1679
1834
|
type: Injectable,
|
|
1680
1835
|
args: [{
|
|
1681
1836
|
providedIn: 'root',
|
|
@@ -1685,253 +1840,422 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
1685
1840
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
1686
1841
|
}] }, { type: i1$2.HttpClient }]; } });
|
|
1687
1842
|
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
class EsolveHeading {
|
|
1691
|
-
constructor(identifier, value) {
|
|
1692
|
-
this.identifier = identifier;
|
|
1693
|
-
this.value = value;
|
|
1694
|
-
}
|
|
1843
|
+
class EsolveTransactionLocation extends EsolveLocation {
|
|
1695
1844
|
}
|
|
1696
1845
|
|
|
1697
|
-
class
|
|
1698
|
-
constructor(
|
|
1699
|
-
this.
|
|
1700
|
-
this.
|
|
1701
|
-
this.
|
|
1702
|
-
this.
|
|
1703
|
-
this.
|
|
1704
|
-
this.topics = topics;
|
|
1705
|
-
if (seo_title.trim() === '') {
|
|
1706
|
-
seo_title = this.title;
|
|
1707
|
-
}
|
|
1708
|
-
this.seo_details = new EsolveSeoInfo(seo_title, seo_description, seo_keywords);
|
|
1846
|
+
class EsolveTransactionPaymentMethod {
|
|
1847
|
+
constructor(id, name, description, integration_type, service_provider) {
|
|
1848
|
+
this.id = id;
|
|
1849
|
+
this.name = name;
|
|
1850
|
+
this.description = description;
|
|
1851
|
+
this.integration_type = integration_type;
|
|
1852
|
+
this.service_provider = service_provider;
|
|
1709
1853
|
}
|
|
1710
1854
|
}
|
|
1711
1855
|
|
|
1712
|
-
class
|
|
1713
|
-
constructor(id,
|
|
1856
|
+
class EsolveTransactionShippingMethod {
|
|
1857
|
+
constructor(id, name, delivery_category, location, description, pricing, client_to_collect) {
|
|
1714
1858
|
this.id = id;
|
|
1715
|
-
this.
|
|
1716
|
-
this.
|
|
1859
|
+
this.name = name;
|
|
1860
|
+
this.delivery_category = delivery_category;
|
|
1861
|
+
this.location = location;
|
|
1717
1862
|
this.description = description;
|
|
1863
|
+
this.pricing = pricing;
|
|
1864
|
+
this.client_to_collect = client_to_collect;
|
|
1718
1865
|
}
|
|
1719
1866
|
}
|
|
1720
1867
|
|
|
1721
|
-
class
|
|
1722
|
-
constructor(id,
|
|
1868
|
+
class EsolveTransactionUser {
|
|
1869
|
+
constructor(id, email, first_name, last_name, tel_number, cell_number) {
|
|
1723
1870
|
this.id = id;
|
|
1724
|
-
this.
|
|
1725
|
-
this.
|
|
1726
|
-
this.
|
|
1871
|
+
this.email = email;
|
|
1872
|
+
this.first_name = first_name;
|
|
1873
|
+
this.last_name = last_name;
|
|
1874
|
+
this.tel_number = tel_number;
|
|
1875
|
+
this.cell_number = cell_number;
|
|
1727
1876
|
}
|
|
1728
1877
|
}
|
|
1729
1878
|
|
|
1730
|
-
class
|
|
1731
|
-
constructor(
|
|
1879
|
+
class EsolveTransaction {
|
|
1880
|
+
constructor(record) {
|
|
1881
|
+
// Transaction Items
|
|
1882
|
+
this.items = [];
|
|
1883
|
+
this.id = +record.id;
|
|
1884
|
+
this.type = record.transaction_type;
|
|
1885
|
+
this.status = record.status;
|
|
1886
|
+
this.loyalty_number = record.loyaltynumber;
|
|
1887
|
+
this.external_order_number = record.external_order_number;
|
|
1888
|
+
this.external_invoice_number = record.external_invoice_number;
|
|
1889
|
+
this.date = new Date(+record.txdate_timestamp * 1000);
|
|
1890
|
+
this.expected_date = new Date(+record.expected_date_timestamp * 1000);
|
|
1891
|
+
this.invoice_amount = +record.invoice_amount;
|
|
1892
|
+
this.vat = +record.vat;
|
|
1893
|
+
this.discount = +record.discount;
|
|
1894
|
+
this.total = +record.total;
|
|
1895
|
+
this.shipping_total = +record.shipping_total;
|
|
1896
|
+
this.insurance_total = +record.insurance_total;
|
|
1897
|
+
this.payment = +record.payment;
|
|
1898
|
+
this.payment_reference = record.payment_reference;
|
|
1899
|
+
this.payment_description = record.payment_description;
|
|
1900
|
+
this.gateway_transaction_id = record.gateway_transaction_id;
|
|
1901
|
+
this.address = new EsolveTransactionAddress(record.recipient, record.address_type, record.address_description, record.street_number, record.street, record.suburb, record.city, record.province, record.country, record.postal_code, record.pobox);
|
|
1902
|
+
if (record.user) {
|
|
1903
|
+
this.user = new EsolveTransactionUser(+record.user.id, record.user.email, record.user.firstname, record.user.surname, record.user.telnumber, record.user.cellnumber);
|
|
1904
|
+
}
|
|
1905
|
+
if (record.client) {
|
|
1906
|
+
this.client = new EsolveTransactionClient(+record.client.id, record.client.account, record.client.company_name, record.client.branch_code, record.client.email, record.client.firstname, record.client.surname, record.client.contact_number);
|
|
1907
|
+
}
|
|
1908
|
+
if (record.location_details) {
|
|
1909
|
+
this.location = new EsolveTransactionLocation(record.location_details);
|
|
1910
|
+
}
|
|
1911
|
+
if (record.payment_method_details) {
|
|
1912
|
+
this.payment_method = new EsolveTransactionPaymentMethod(record.payment_method_details.id, record.payment_method_details.paymethod_name, record.payment_method_details.description, record.payment_method_details.integration_type, record.payment_method_details.service_provider);
|
|
1913
|
+
}
|
|
1914
|
+
if (record.shipping_method_details) {
|
|
1915
|
+
this.shipping_method = new EsolveTransactionShippingMethod(+record.shipping_method_details.id, record.shipping_method_details.carrier_name, record.shipping_method_details.delivery_category, record.shipping_method_details.location, record.shipping_method_details.description, record.shipping_method_details.pricing, !!record.shipping_method_details.client_to_collect);
|
|
1916
|
+
}
|
|
1917
|
+
this.parseTransactionItems(record.transaction_items);
|
|
1918
|
+
}
|
|
1919
|
+
parseTransactionItems(record_items) {
|
|
1920
|
+
for (const record_item of record_items) {
|
|
1921
|
+
const price = new EsolveTransactionItemPrice(+record_item.price_exclusive, +record_item.price_inclusive, +record_item.price_exclusive_after_discount, +record_item.price_inclusive_after_discount);
|
|
1922
|
+
const line_total = new EsolveTransactionItemPrice(+record_item.line_total_exclusive, +record_item.line_total_inclusive, +record_item.line_total_exclusive_after_discount, +record_item.line_total_inclusive_after_discount);
|
|
1923
|
+
const item = new EsolveTransactionItem(record_item.code, record_item.name, +record_item.qty, +record_item.discount, +record_item.vat_rate, price, line_total);
|
|
1924
|
+
this.items.push(item);
|
|
1925
|
+
}
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
|
|
1929
|
+
class EsolveTransactionList extends EsolveList {
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1932
|
+
// Classes
|
|
1933
|
+
|
|
1934
|
+
class EsolveChangePasswordResult extends EsolveResponseResult {
|
|
1935
|
+
constructor(response) {
|
|
1936
|
+
super(response);
|
|
1937
|
+
this.password_updated = (response.status.state === 'success');
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
|
|
1941
|
+
class EsolveResetPasswordResult extends EsolveResponseResult {
|
|
1942
|
+
constructor(response) {
|
|
1943
|
+
super(response);
|
|
1944
|
+
this.id = response.esolve_id;
|
|
1945
|
+
this.reset_success = response.reset_success;
|
|
1946
|
+
this.password_matches_old = response.password_matches_old;
|
|
1947
|
+
this.login_required = response.login_required;
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
|
|
1951
|
+
class EsolveRegistrationResult extends EsolveResponseResult {
|
|
1952
|
+
constructor(response) {
|
|
1953
|
+
super(response);
|
|
1954
|
+
this.user_id = response.esolve_id;
|
|
1955
|
+
this.guest = response.guest;
|
|
1956
|
+
this.auto_login = response.auto_login;
|
|
1957
|
+
this.authentication_required = response.authentication_required;
|
|
1958
|
+
this.location_id = response.session_data.location_id;
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
class EsolveLocationUpdateResult extends EsolveResponseResult {
|
|
1963
|
+
constructor(response) {
|
|
1964
|
+
super(response);
|
|
1965
|
+
this.location_updated = (response.esolve_id > 0);
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1968
|
+
|
|
1969
|
+
class EsolveAccountService {
|
|
1970
|
+
constructor(config, http, sessionService, errorHandler, responseHandler) {
|
|
1732
1971
|
this.config = config;
|
|
1733
1972
|
this.http = http;
|
|
1973
|
+
this.sessionService = sessionService;
|
|
1974
|
+
this.errorHandler = errorHandler;
|
|
1975
|
+
this.responseHandler = responseHandler;
|
|
1976
|
+
this._user_id = 0;
|
|
1977
|
+
this.sessionService.session.subscribe((session) => {
|
|
1978
|
+
if (session.key !== '') {
|
|
1979
|
+
this.user_id = session.id;
|
|
1980
|
+
}
|
|
1981
|
+
});
|
|
1734
1982
|
}
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1983
|
+
get user_id() {
|
|
1984
|
+
return this._user_id;
|
|
1985
|
+
}
|
|
1986
|
+
set user_id(value) {
|
|
1987
|
+
value = ((value > 0) ? value : 0);
|
|
1988
|
+
if (this._user_id !== value) {
|
|
1989
|
+
this._user_id = value;
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
updateUserAccount(user_account_data) {
|
|
1993
|
+
const body = {
|
|
1994
|
+
account: user_account_data
|
|
1995
|
+
};
|
|
1996
|
+
return this.http
|
|
1997
|
+
.post(`${this.config.api_url}/set-user-account.php`, body, {
|
|
1998
|
+
headers: {
|
|
1999
|
+
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
|
|
2000
|
+
},
|
|
2001
|
+
responseType: 'json',
|
|
2002
|
+
observe: 'body'
|
|
2003
|
+
})
|
|
2004
|
+
.pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => new EsolveUserAccountResult(response))), catchError((errorRes) => {
|
|
2005
|
+
return this.errorHandler.handleHttpPostError('set-user-account', errorRes);
|
|
2006
|
+
}));
|
|
2007
|
+
}
|
|
2008
|
+
getUserAccount() {
|
|
2009
|
+
return this.http
|
|
2010
|
+
.get(`${this.config.api_url}/get-account.php`)
|
|
2011
|
+
.pipe(map((response) => {
|
|
2012
|
+
if ((response.records === undefined) ||
|
|
2013
|
+
(response.records.length === 0)) {
|
|
2014
|
+
throw response;
|
|
2015
|
+
}
|
|
2016
|
+
const record = response.records[0];
|
|
2017
|
+
return this.processUserAccount(record);
|
|
2018
|
+
}));
|
|
2019
|
+
}
|
|
2020
|
+
setAddress(address_post_data) {
|
|
2021
|
+
const body = {
|
|
2022
|
+
address: address_post_data
|
|
2023
|
+
};
|
|
2024
|
+
return this.http
|
|
2025
|
+
.post(`${this.config.api_url}/set-address.php`, body, {
|
|
2026
|
+
headers: {
|
|
2027
|
+
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;',
|
|
2028
|
+
},
|
|
2029
|
+
responseType: 'json',
|
|
2030
|
+
observe: 'body',
|
|
2031
|
+
})
|
|
2032
|
+
.pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => new EsolveAddressResult(response))), catchError((errorRes) => {
|
|
2033
|
+
return this.errorHandler.handleHttpPostError('set-registration', errorRes);
|
|
2034
|
+
}));
|
|
2035
|
+
}
|
|
2036
|
+
getAddresses() {
|
|
2037
|
+
try {
|
|
2038
|
+
this.loginGuard();
|
|
2039
|
+
return this.http
|
|
2040
|
+
.get(`${this.config.api_url}/get-addresses.php`, {
|
|
2041
|
+
params: { user_id: this.user_id }
|
|
2042
|
+
})
|
|
2043
|
+
.pipe(map((response) => {
|
|
2044
|
+
if (response.records === undefined) {
|
|
2045
|
+
throw response;
|
|
2046
|
+
}
|
|
2047
|
+
return this.processUserAddress(response.records);
|
|
2048
|
+
}));
|
|
1745
2049
|
}
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
2050
|
+
catch (error) {
|
|
2051
|
+
return throwError(error);
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2054
|
+
deleteAddress(id) {
|
|
2055
|
+
return this.http
|
|
2056
|
+
.delete(`${this.config.api_url}/delete-address.php`, {
|
|
2057
|
+
params: { id },
|
|
2058
|
+
responseType: 'json',
|
|
2059
|
+
observe: 'body'
|
|
2060
|
+
})
|
|
2061
|
+
.pipe(map((http_response) => {
|
|
2062
|
+
if ((http_response.result === undefined) ||
|
|
2063
|
+
(http_response.result === null) ||
|
|
2064
|
+
(http_response.result.status !== 'success')) {
|
|
2065
|
+
throw http_response;
|
|
1749
2066
|
}
|
|
1750
|
-
return
|
|
2067
|
+
return new EsolveResult(http_response.result.status, http_response.result.code, http_response.result.message);
|
|
2068
|
+
}), catchError((errorRes) => {
|
|
2069
|
+
return this.errorHandler.handleHttpDeleteError('delete-address', errorRes);
|
|
1751
2070
|
}));
|
|
1752
2071
|
}
|
|
1753
|
-
|
|
1754
|
-
const
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
2072
|
+
register(user_registration) {
|
|
2073
|
+
const body = {
|
|
2074
|
+
user: user_registration
|
|
2075
|
+
};
|
|
2076
|
+
return this.http
|
|
2077
|
+
.post(`${this.config.api_url}/set-registration.php`, body, {
|
|
2078
|
+
headers: {
|
|
2079
|
+
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
|
|
2080
|
+
},
|
|
2081
|
+
responseType: 'json',
|
|
2082
|
+
observe: 'body'
|
|
2083
|
+
})
|
|
2084
|
+
.pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => {
|
|
2085
|
+
if (response.auto_login) {
|
|
2086
|
+
this.sessionService.handleUpdateSession({
|
|
2087
|
+
user_id: +response.esolve_id,
|
|
2088
|
+
location_id: +response.session_data.location_id,
|
|
2089
|
+
});
|
|
1759
2090
|
}
|
|
1760
|
-
|
|
1761
|
-
|
|
2091
|
+
return new EsolveRegistrationResult(response);
|
|
2092
|
+
})), catchError((errorRes) => {
|
|
2093
|
+
return this.errorHandler.handleHttpPostError('set-registration', errorRes);
|
|
2094
|
+
}));
|
|
1762
2095
|
}
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
2096
|
+
changePassword(password, confirm_password) {
|
|
2097
|
+
const body = {
|
|
2098
|
+
password,
|
|
2099
|
+
confirm_password
|
|
2100
|
+
};
|
|
2101
|
+
return this.http
|
|
2102
|
+
.post(`${this.config.api_url}/set-change-password.php`, body, {
|
|
2103
|
+
headers: {
|
|
2104
|
+
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
|
|
2105
|
+
},
|
|
2106
|
+
responseType: 'json',
|
|
2107
|
+
observe: 'body'
|
|
2108
|
+
})
|
|
2109
|
+
.pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => {
|
|
2110
|
+
return new EsolveChangePasswordResult(response);
|
|
2111
|
+
})), catchError((errorRes) => {
|
|
2112
|
+
return this.errorHandler.handleHttpPostError('set-change-password', errorRes);
|
|
2113
|
+
}));
|
|
1780
2114
|
}
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
*/
|
|
1786
|
-
getMediaArticle(identifier) {
|
|
1787
|
-
const params = new HttpParams({ fromObject: { identifier } });
|
|
1788
|
-
// TODO: Error Handling
|
|
1789
|
-
return this.getMediaRecords(params).pipe(map((response) => {
|
|
2115
|
+
sendForgotPasswordRequest(email) {
|
|
2116
|
+
return this.http
|
|
2117
|
+
.get(`${this.config.api_url}/get-forgot-password.php`, { params: { email } })
|
|
2118
|
+
.pipe(map((response) => {
|
|
1790
2119
|
if ((response.records === undefined) ||
|
|
1791
|
-
(response.records
|
|
1792
|
-
throw response;
|
|
1793
|
-
}
|
|
1794
|
-
const mediaRecord = response.records[0];
|
|
1795
|
-
if (!mediaRecord.active) {
|
|
2120
|
+
!('reset_link_sent' in response.records)) {
|
|
1796
2121
|
throw response;
|
|
1797
2122
|
}
|
|
1798
|
-
return
|
|
2123
|
+
return response.records.reset_link_sent;
|
|
1799
2124
|
}));
|
|
1800
2125
|
}
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
2126
|
+
resetPassword(reset_key, password, confirm_password, auto_login = true) {
|
|
2127
|
+
return this.http
|
|
2128
|
+
.post(`${this.config.api_url}/set-forgot-password.php`, {
|
|
2129
|
+
reset_key,
|
|
2130
|
+
password,
|
|
2131
|
+
confirm_password,
|
|
2132
|
+
auto_login
|
|
2133
|
+
}, {
|
|
2134
|
+
headers: {
|
|
2135
|
+
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
|
|
2136
|
+
},
|
|
2137
|
+
responseType: 'json',
|
|
2138
|
+
observe: 'body'
|
|
2139
|
+
})
|
|
2140
|
+
.pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => {
|
|
2141
|
+
if (!response.login_required) {
|
|
2142
|
+
this.sessionService.handleUpdateSession({
|
|
2143
|
+
user_id: +response.esolve_id,
|
|
2144
|
+
location_id: +response.session_data.location_id,
|
|
2145
|
+
});
|
|
1819
2146
|
}
|
|
1820
|
-
return
|
|
2147
|
+
return new EsolveResetPasswordResult(response);
|
|
2148
|
+
})), catchError((errorRes) => {
|
|
2149
|
+
return this.errorHandler.handleHttpPostError('set-forgot-password', errorRes);
|
|
1821
2150
|
}));
|
|
1822
2151
|
}
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
*
|
|
1826
|
-
* @param identifiers Array of strings representing the eSolve heading identifiers
|
|
1827
|
-
*/
|
|
1828
|
-
getHeadings(identifiers) {
|
|
2152
|
+
updateLocation(location_id) {
|
|
2153
|
+
const body = { location_id };
|
|
1829
2154
|
return this.http
|
|
1830
|
-
.
|
|
1831
|
-
|
|
1832
|
-
|
|
2155
|
+
.post(`${this.config.api_url}/set-session-location.php`, body, {
|
|
2156
|
+
headers: {
|
|
2157
|
+
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
|
|
1833
2158
|
},
|
|
2159
|
+
responseType: 'json',
|
|
2160
|
+
observe: 'body',
|
|
1834
2161
|
})
|
|
1835
|
-
.pipe(map((response) => {
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
for (const heading_record of response.records) {
|
|
1840
|
-
headings.push(this.processHeadingRecord(heading_record));
|
|
1841
|
-
}
|
|
1842
|
-
}
|
|
1843
|
-
return headings;
|
|
1844
|
-
}));
|
|
2162
|
+
.pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => {
|
|
2163
|
+
this.sessionService.handleUpdateSession({ location_id });
|
|
2164
|
+
return new EsolveLocationUpdateResult(response);
|
|
2165
|
+
})));
|
|
1845
2166
|
}
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
2167
|
+
getTransactions(options = {}) {
|
|
2168
|
+
try {
|
|
2169
|
+
this.loginGuard();
|
|
2170
|
+
return this.http
|
|
2171
|
+
.get(`${this.config.api_url}/get-transactions.php`, {
|
|
2172
|
+
params: {
|
|
2173
|
+
user_id: this.user_id,
|
|
2174
|
+
...options,
|
|
2175
|
+
}
|
|
2176
|
+
})
|
|
2177
|
+
.pipe(map((response) => {
|
|
2178
|
+
if (response.records === undefined) {
|
|
2179
|
+
throw response;
|
|
2180
|
+
}
|
|
2181
|
+
const items = this.processTransactions(response.records);
|
|
2182
|
+
const total = +response.additional_data.total_records ?? 0;
|
|
2183
|
+
const rows = options.rows ?? total;
|
|
2184
|
+
const page = options.page || 1;
|
|
2185
|
+
return new EsolveTransactionList(items, page, rows, total);
|
|
2186
|
+
}));
|
|
1858
2187
|
}
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
topics.push(new EsolveTopic(+topic.id, topic.name, topic.short_description, +topic.sort_priority));
|
|
1862
|
-
}
|
|
2188
|
+
catch (error) {
|
|
2189
|
+
return throwError(error);
|
|
1863
2190
|
}
|
|
1864
|
-
return new EsolveMediaArticle(record.identifier, record.title, record.article, record.image_url, tags, topics, record.seo_page_title, record.seo_keywords, record.seo_description);
|
|
1865
|
-
}
|
|
1866
|
-
/**
|
|
1867
|
-
* Processes media heading record
|
|
1868
|
-
*
|
|
1869
|
-
* @param record Record from eSolve instance
|
|
1870
|
-
*/
|
|
1871
|
-
processHeadingRecord(record) {
|
|
1872
|
-
return new EsolveHeading(record.identifier, record.value);
|
|
1873
|
-
}
|
|
1874
|
-
/**
|
|
1875
|
-
* Retrieves media records from eSolve instance.
|
|
1876
|
-
*
|
|
1877
|
-
* @param params HTTP params
|
|
1878
|
-
*/
|
|
1879
|
-
getMediaRecords(params) {
|
|
1880
|
-
return this.http.get(`${this.config.api_url}/get-media.php`, { params });
|
|
1881
2191
|
}
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
2192
|
+
getTransaction(id) {
|
|
2193
|
+
try {
|
|
2194
|
+
this.loginGuard();
|
|
2195
|
+
return this.http
|
|
2196
|
+
.get(`${this.config.api_url}/get-transactions.php`, {
|
|
2197
|
+
params: {
|
|
2198
|
+
user_id: this.user_id,
|
|
2199
|
+
transaction_id: id,
|
|
2200
|
+
}
|
|
2201
|
+
})
|
|
2202
|
+
.pipe(map((response) => {
|
|
2203
|
+
if ((response.records === undefined) ||
|
|
2204
|
+
(response.records.length <= 0)) {
|
|
2205
|
+
throw response;
|
|
2206
|
+
}
|
|
2207
|
+
const items = this.processTransactions(response.records);
|
|
2208
|
+
return items[0];
|
|
2209
|
+
}));
|
|
2210
|
+
}
|
|
2211
|
+
catch (error) {
|
|
2212
|
+
return throwError(error);
|
|
2213
|
+
}
|
|
1901
2214
|
}
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
this.
|
|
1907
|
-
|
|
2215
|
+
processUserAccount(record) {
|
|
2216
|
+
if (!record) {
|
|
2217
|
+
throw new Error('Invalid record');
|
|
2218
|
+
}
|
|
2219
|
+
if (+record.userid !== this._user_id) {
|
|
2220
|
+
throw new Error('Invalid user account retrieved');
|
|
2221
|
+
}
|
|
2222
|
+
const user_account = new EsolveUserAccount(+record.userid, record.email, record.registration_type, record.title, record.firstname, record.surname, record.initials, record.gender, record.idnumber);
|
|
2223
|
+
user_account.contact_details = new EsolveUserAccountContact(record.telnumber, record.cellnumber, record.fax);
|
|
2224
|
+
user_account.business_details = new EsolveUserAccountBusiness(record.busname, record.vatnum, record.busdescript, record.business_type);
|
|
2225
|
+
return user_account;
|
|
1908
2226
|
}
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
return [];
|
|
2227
|
+
processUserAddress(records) {
|
|
2228
|
+
const user_addresses = [];
|
|
2229
|
+
if (!records || (this._user_id === 0)) {
|
|
2230
|
+
return user_addresses;
|
|
2231
|
+
}
|
|
2232
|
+
for (const record of records) {
|
|
2233
|
+
if (+record.userid !== this._user_id) {
|
|
2234
|
+
continue;
|
|
1918
2235
|
}
|
|
1919
|
-
|
|
1920
|
-
}
|
|
2236
|
+
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));
|
|
2237
|
+
}
|
|
2238
|
+
return user_addresses;
|
|
1921
2239
|
}
|
|
1922
|
-
|
|
1923
|
-
const
|
|
1924
|
-
if (
|
|
1925
|
-
for (const
|
|
1926
|
-
|
|
2240
|
+
processTransactions(records) {
|
|
2241
|
+
const transactions = [];
|
|
2242
|
+
if (records) {
|
|
2243
|
+
for (const record of records) {
|
|
2244
|
+
const transaction = new EsolveTransaction(record);
|
|
2245
|
+
transactions.push(transaction);
|
|
1927
2246
|
}
|
|
1928
2247
|
}
|
|
1929
|
-
return
|
|
2248
|
+
return transactions;
|
|
2249
|
+
}
|
|
2250
|
+
loginGuard() {
|
|
2251
|
+
if (this.user_id <= 0) {
|
|
2252
|
+
this.errorHandler.throwError('login_required', 'Login is required');
|
|
2253
|
+
}
|
|
1930
2254
|
}
|
|
1931
2255
|
}
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type:
|
|
2256
|
+
EsolveAccountService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveAccountService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }, { token: EsolveSessionService }, { token: EsolveErrorHandlerService }, { token: EsolveResponseHandlerService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2257
|
+
EsolveAccountService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveAccountService, providedIn: 'root' });
|
|
2258
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveAccountService, decorators: [{
|
|
1935
2259
|
type: Injectable,
|
|
1936
2260
|
args: [{
|
|
1937
2261
|
providedIn: 'root',
|
|
@@ -1939,137 +2263,141 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
1939
2263
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1940
2264
|
type: Inject,
|
|
1941
2265
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
1942
|
-
}] }, { type: i1$2.HttpClient }]; } });
|
|
1943
|
-
|
|
1944
|
-
class EsolveNewsGroup {
|
|
1945
|
-
constructor(id, name, description, sef_name) {
|
|
1946
|
-
this.id = id;
|
|
1947
|
-
this.name = name;
|
|
1948
|
-
this.description = description;
|
|
1949
|
-
this.sef_name = sef_name;
|
|
1950
|
-
}
|
|
1951
|
-
}
|
|
2266
|
+
}] }, { type: i1$2.HttpClient }, { type: EsolveSessionService }, { type: EsolveErrorHandlerService }, { type: EsolveResponseHandlerService }]; } });
|
|
1952
2267
|
|
|
1953
|
-
class
|
|
1954
|
-
constructor(id,
|
|
2268
|
+
class EsolveBanner {
|
|
2269
|
+
constructor(id, banner_display_container, identifier, type, title, article, sort_priority, link, images) {
|
|
1955
2270
|
this.id = id;
|
|
2271
|
+
this.banner_display_container = banner_display_container;
|
|
2272
|
+
this.identifier = identifier;
|
|
2273
|
+
this.type = type;
|
|
1956
2274
|
this.title = title;
|
|
1957
|
-
this.sef_title = sef_title;
|
|
1958
2275
|
this.article = article;
|
|
1959
|
-
this.
|
|
1960
|
-
this.
|
|
1961
|
-
this.
|
|
1962
|
-
this.
|
|
1963
|
-
this.
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
2276
|
+
this.sort_priority = sort_priority;
|
|
2277
|
+
this.link = link;
|
|
2278
|
+
this.desktop_images = [];
|
|
2279
|
+
this.mobile_images = [];
|
|
2280
|
+
this.sub_images = [];
|
|
2281
|
+
if (images.desktop) {
|
|
2282
|
+
this.desktop_images = images.desktop;
|
|
2283
|
+
}
|
|
2284
|
+
if (images.mobile) {
|
|
2285
|
+
this.mobile_images = images.mobile;
|
|
2286
|
+
}
|
|
2287
|
+
if (images.sub) {
|
|
2288
|
+
this.sub_images = images.sub;
|
|
1967
2289
|
}
|
|
1968
|
-
this.seo_details = new EsolveSeoInfo(seo_title, short_description, seo_keywords);
|
|
1969
2290
|
}
|
|
1970
2291
|
}
|
|
1971
2292
|
|
|
1972
|
-
class
|
|
1973
|
-
constructor(
|
|
1974
|
-
this.
|
|
1975
|
-
this.
|
|
1976
|
-
this.
|
|
2293
|
+
class EsolveBannerImage {
|
|
2294
|
+
constructor(id, image_type, width, height, filename, hotspots) {
|
|
2295
|
+
this.id = id;
|
|
2296
|
+
this.image_type = image_type;
|
|
2297
|
+
this.width = width;
|
|
2298
|
+
this.height = height;
|
|
2299
|
+
this.filename = filename;
|
|
2300
|
+
this.hotspots = hotspots;
|
|
2301
|
+
}
|
|
2302
|
+
get src() {
|
|
2303
|
+
return '/images/banners/' + this.filename;
|
|
1977
2304
|
}
|
|
1978
2305
|
}
|
|
1979
2306
|
|
|
1980
|
-
class
|
|
1981
|
-
constructor(
|
|
1982
|
-
this.
|
|
1983
|
-
this.
|
|
1984
|
-
this.
|
|
1985
|
-
this.
|
|
2307
|
+
class EsolveBannerImageHotspot {
|
|
2308
|
+
constructor(url, target, coords, coords_string) {
|
|
2309
|
+
this.url = url;
|
|
2310
|
+
this.target = target;
|
|
2311
|
+
this.coords = coords;
|
|
2312
|
+
this.coords_string = coords_string;
|
|
1986
2313
|
}
|
|
1987
2314
|
}
|
|
1988
2315
|
|
|
1989
|
-
class
|
|
2316
|
+
class EsolveBannerService {
|
|
1990
2317
|
constructor(config, http) {
|
|
1991
2318
|
this.config = config;
|
|
1992
2319
|
this.http = http;
|
|
1993
2320
|
}
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
return this.processNewsArticle(newsRecord);
|
|
2006
|
-
}));
|
|
2007
|
-
}
|
|
2008
|
-
getNewsArticles(options) {
|
|
2009
|
-
let params = new HttpParams();
|
|
2010
|
-
if (options.news_group_id) {
|
|
2011
|
-
params = params.set('news_group_id', options.news_group_id.toString());
|
|
2012
|
-
}
|
|
2013
|
-
else if (options.news_group_sef) {
|
|
2014
|
-
params = params.set('news_group_sef', options.news_group_sef.toString());
|
|
2015
|
-
}
|
|
2016
|
-
if (options.page) {
|
|
2017
|
-
params = params.set('page', options.page.toString());
|
|
2018
|
-
}
|
|
2019
|
-
if (options.rows) {
|
|
2020
|
-
params = params.set('rows', options.rows.toString());
|
|
2021
|
-
}
|
|
2022
|
-
if (options.feature_only) {
|
|
2023
|
-
params = params.set('feature_only', options.feature_only.toString());
|
|
2024
|
-
}
|
|
2025
|
-
if (options.manufacturers_id) {
|
|
2026
|
-
params = params.set('manufacturers_id', options.manufacturers_id.toString());
|
|
2027
|
-
}
|
|
2028
|
-
if (options.ranges_id) {
|
|
2029
|
-
params = params.set('ranges_id', options.ranges_id.toString());
|
|
2030
|
-
}
|
|
2031
|
-
if (options.from_date) {
|
|
2032
|
-
params = params.set('from_date', options.from_date.toString());
|
|
2321
|
+
/**
|
|
2322
|
+
* Retrieves banners records from eSolve instance
|
|
2323
|
+
*
|
|
2324
|
+
* @returns An observable of eSolve banners.
|
|
2325
|
+
*/
|
|
2326
|
+
getBanners(identifier, banner_display_container, enable_date_filter = false) {
|
|
2327
|
+
let params = new HttpParams({
|
|
2328
|
+
fromObject: { enable_date_filter }
|
|
2329
|
+
});
|
|
2330
|
+
if (identifier) {
|
|
2331
|
+
params = params.set('identifier', identifier);
|
|
2033
2332
|
}
|
|
2034
|
-
if (
|
|
2035
|
-
params = params.set('
|
|
2333
|
+
if (banner_display_container) {
|
|
2334
|
+
params = params.set('banner_display_container', banner_display_container);
|
|
2036
2335
|
}
|
|
2037
|
-
return this.getNewsRecords(params).pipe(map(response => {
|
|
2038
|
-
if (response.records === undefined) {
|
|
2039
|
-
throw response;
|
|
2040
|
-
}
|
|
2041
|
-
const newsArticles = [];
|
|
2042
|
-
response.records.forEach(newsArticleRecord => {
|
|
2043
|
-
newsArticles.push(this.processNewsArticle(newsArticleRecord));
|
|
2044
|
-
});
|
|
2045
|
-
return new EsolveNewsArticleList(newsArticles, response.additional_data.total_records, options.page || 0);
|
|
2046
|
-
}));
|
|
2047
|
-
}
|
|
2048
|
-
getNewsGroups() {
|
|
2049
2336
|
return this.http
|
|
2050
|
-
.get(`${this.config.api_url}/get-
|
|
2337
|
+
.get(`${this.config.api_url}/get-banners.php`, { params })
|
|
2051
2338
|
.pipe(map((response) => {
|
|
2052
2339
|
if (response.records === undefined) {
|
|
2053
2340
|
throw response;
|
|
2054
2341
|
}
|
|
2055
|
-
|
|
2056
|
-
response.records.forEach(newsGroupRecord => {
|
|
2057
|
-
newsGroups.push(new EsolveNewsGroup(newsGroupRecord.id, newsGroupRecord.name, newsGroupRecord.description, newsGroupRecord.sef_name));
|
|
2058
|
-
});
|
|
2059
|
-
return newsGroups;
|
|
2342
|
+
return this.processBanners(response.records);
|
|
2060
2343
|
}));
|
|
2061
2344
|
}
|
|
2062
|
-
|
|
2063
|
-
const
|
|
2064
|
-
|
|
2345
|
+
processBannerImageHotspots(hotspot_records) {
|
|
2346
|
+
const hotspots = [];
|
|
2347
|
+
if (hotspot_records.length > 0) {
|
|
2348
|
+
for (const hotspot_record of hotspot_records) {
|
|
2349
|
+
const hotspot = new EsolveBannerImageHotspot(hotspot_record.url, hotspot_record.target, hotspot_record.coords, hotspot_record.coords_string);
|
|
2350
|
+
hotspots.push(hotspot);
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
return hotspots;
|
|
2065
2354
|
}
|
|
2066
|
-
|
|
2067
|
-
|
|
2355
|
+
processBannerImages(image_records, banner_type) {
|
|
2356
|
+
const images = [];
|
|
2357
|
+
if (image_records.length > 0) {
|
|
2358
|
+
for (const image_record of image_records) {
|
|
2359
|
+
const image = new EsolveBannerImage(+image_record.id, image_record.image_type, +image_record.width, +image_record.height, image_record.filename);
|
|
2360
|
+
if ((banner_type === 'hotspot') && (image_record.hotspots)) {
|
|
2361
|
+
const hotspots = this.processBannerImageHotspots(image_record.hotspots);
|
|
2362
|
+
image.hotspots = hotspots;
|
|
2363
|
+
}
|
|
2364
|
+
images.push(image);
|
|
2365
|
+
}
|
|
2366
|
+
}
|
|
2367
|
+
return images;
|
|
2368
|
+
}
|
|
2369
|
+
/**
|
|
2370
|
+
* Process banner records into banner objects
|
|
2371
|
+
* @param records Array of records
|
|
2372
|
+
* @returns List of banners
|
|
2373
|
+
*/
|
|
2374
|
+
processBanners(records) {
|
|
2375
|
+
const banners = [];
|
|
2376
|
+
if ((records) && (records.length > 0)) {
|
|
2377
|
+
for (const record of records) {
|
|
2378
|
+
const image_sets = {};
|
|
2379
|
+
if (record.images.desktop) {
|
|
2380
|
+
image_sets.desktop = this.processBannerImages(record.images.desktop, record.type);
|
|
2381
|
+
}
|
|
2382
|
+
if (record.images.mobile) {
|
|
2383
|
+
image_sets.mobile = this.processBannerImages(record.images.mobile, record.type);
|
|
2384
|
+
}
|
|
2385
|
+
if (record.images.sub) {
|
|
2386
|
+
image_sets.sub = this.processBannerImages(record.images.sub, record.type);
|
|
2387
|
+
}
|
|
2388
|
+
const banner = new EsolveBanner(+record.id, record.banner_display_container, record.identifier, record.type, record.title, record.article, +record.sort_priority, {
|
|
2389
|
+
url: record.link.url,
|
|
2390
|
+
target: record.link.target
|
|
2391
|
+
}, image_sets);
|
|
2392
|
+
banners.push(banner);
|
|
2393
|
+
}
|
|
2394
|
+
}
|
|
2395
|
+
return banners;
|
|
2068
2396
|
}
|
|
2069
2397
|
}
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type:
|
|
2398
|
+
EsolveBannerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveBannerService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2399
|
+
EsolveBannerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveBannerService, providedIn: 'root' });
|
|
2400
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveBannerService, decorators: [{
|
|
2073
2401
|
type: Injectable,
|
|
2074
2402
|
args: [{
|
|
2075
2403
|
providedIn: 'root',
|
|
@@ -2079,280 +2407,189 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
2079
2407
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
2080
2408
|
}] }, { type: i1$2.HttpClient }]; } });
|
|
2081
2409
|
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
this.
|
|
2410
|
+
// Types
|
|
2411
|
+
|
|
2412
|
+
class EsolveHeading {
|
|
2413
|
+
constructor(identifier, value) {
|
|
2414
|
+
this.identifier = identifier;
|
|
2415
|
+
this.value = value;
|
|
2087
2416
|
}
|
|
2088
2417
|
}
|
|
2089
2418
|
|
|
2090
|
-
class
|
|
2091
|
-
constructor(
|
|
2092
|
-
this.
|
|
2093
|
-
this.
|
|
2094
|
-
this.
|
|
2095
|
-
this.
|
|
2096
|
-
this.
|
|
2097
|
-
this.
|
|
2098
|
-
this.sort_priority = sort_priority;
|
|
2099
|
-
this.active = active;
|
|
2100
|
-
this.display_only = display_only;
|
|
2101
|
-
this.image_name = image_name;
|
|
2102
|
-
this.id = '';
|
|
2103
|
-
this.image_path = '';
|
|
2104
|
-
if (this.type === 'category') {
|
|
2105
|
-
this.id = `<<CAT>>${this.esolve_id}`;
|
|
2106
|
-
if (children != null) {
|
|
2107
|
-
this.children = children;
|
|
2108
|
-
}
|
|
2109
|
-
this.image_path = '/images/categories/';
|
|
2110
|
-
}
|
|
2111
|
-
else {
|
|
2112
|
-
this.id = `<<SUB>>${this.esolve_id}`;
|
|
2113
|
-
this.image_path = '/images/subcategories/';
|
|
2114
|
-
}
|
|
2419
|
+
class EsolveMediaArticle {
|
|
2420
|
+
constructor(identifier, title, article, image_url = '', tags = [], topics = [], seo_title = '', seo_keywords = '', seo_description = '') {
|
|
2421
|
+
this.identifier = identifier;
|
|
2422
|
+
this.title = title;
|
|
2423
|
+
this.article = article;
|
|
2424
|
+
this.image_url = image_url;
|
|
2425
|
+
this.tags = tags;
|
|
2426
|
+
this.topics = topics;
|
|
2115
2427
|
if (seo_title.trim() === '') {
|
|
2116
|
-
seo_title = this.
|
|
2428
|
+
seo_title = this.title;
|
|
2117
2429
|
}
|
|
2118
2430
|
this.seo_details = new EsolveSeoInfo(seo_title, seo_description, seo_keywords);
|
|
2119
2431
|
}
|
|
2120
|
-
get small_image_src() {
|
|
2121
|
-
return this.getImagePath('small');
|
|
2122
|
-
}
|
|
2123
|
-
get thumbnail_image_src() {
|
|
2124
|
-
return this.getImagePath('thumb');
|
|
2125
|
-
}
|
|
2126
|
-
get tiny_image_src() {
|
|
2127
|
-
return this.getImagePath('tiny');
|
|
2128
|
-
}
|
|
2129
|
-
getImagePath(image_size) {
|
|
2130
|
-
if (this.image_name !== '') {
|
|
2131
|
-
return `${this.image_path}${image_size}/${this.image_name}`;
|
|
2132
|
-
}
|
|
2133
|
-
return '';
|
|
2134
|
-
}
|
|
2135
2432
|
}
|
|
2136
2433
|
|
|
2137
|
-
class
|
|
2434
|
+
class EsolveMediaService {
|
|
2138
2435
|
constructor(config, http) {
|
|
2139
2436
|
this.config = config;
|
|
2140
2437
|
this.http = http;
|
|
2141
2438
|
}
|
|
2142
2439
|
/**
|
|
2143
|
-
* Retrieves the
|
|
2440
|
+
* Retrieves the media record from the eSolve instance using the identifier
|
|
2441
|
+
*
|
|
2442
|
+
* @param identifier String representing the eSolve media identifier
|
|
2144
2443
|
*/
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
if (response.records === undefined)
|
|
2444
|
+
getMediaArticle(identifier) {
|
|
2445
|
+
const params = new HttpParams({ fromObject: { identifier } });
|
|
2446
|
+
// TODO: Error Handling
|
|
2447
|
+
return this.getMediaRecords(params).pipe(map((response) => {
|
|
2448
|
+
if ((response.records === undefined) ||
|
|
2449
|
+
(response.records.length <= 0)) {
|
|
2150
2450
|
throw response;
|
|
2151
2451
|
}
|
|
2152
|
-
|
|
2452
|
+
const mediaRecord = response.records[0];
|
|
2453
|
+
if (!mediaRecord.active) {
|
|
2454
|
+
throw response;
|
|
2455
|
+
}
|
|
2456
|
+
return this.processMediaRecord(mediaRecord);
|
|
2153
2457
|
}));
|
|
2154
2458
|
}
|
|
2155
2459
|
/**
|
|
2156
|
-
*
|
|
2157
|
-
* converts it to the correct format.
|
|
2460
|
+
* Retrieves a group of media records from the eSolve instance linked to a group
|
|
2158
2461
|
*
|
|
2159
|
-
* @param
|
|
2462
|
+
* @param media_group String representing the eSolve media group
|
|
2160
2463
|
*/
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
const
|
|
2167
|
-
if (
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
type = options.type;
|
|
2174
|
-
if (options.esolve_id) {
|
|
2175
|
-
esolve_id = options.esolve_id;
|
|
2176
|
-
}
|
|
2177
|
-
else if (options.sef_description) {
|
|
2178
|
-
sef_description = options.sef_description;
|
|
2179
|
-
}
|
|
2180
|
-
}
|
|
2181
|
-
if (type && (esolve_id || sef_description)) {
|
|
2182
|
-
let params = new HttpParams();
|
|
2183
|
-
params = params.set('type', type);
|
|
2184
|
-
if (esolve_id) {
|
|
2185
|
-
params = params.set('id', esolve_id);
|
|
2186
|
-
}
|
|
2187
|
-
if (sef_description) {
|
|
2188
|
-
params = params.set('sef_description', sef_description);
|
|
2189
|
-
}
|
|
2190
|
-
return this.http
|
|
2191
|
-
.get(`${this.config.api_url}/get-tree-item.php`, { params })
|
|
2192
|
-
.pipe(map((response) => {
|
|
2193
|
-
if ((response.records === undefined) ||
|
|
2194
|
-
(response.records.length <= 0)) {
|
|
2195
|
-
throw response;
|
|
2464
|
+
getGroupedMediaArticles(media_group) {
|
|
2465
|
+
const params = new HttpParams({
|
|
2466
|
+
fromObject: { media_group_sef: media_group }
|
|
2467
|
+
});
|
|
2468
|
+
return this.getMediaRecords(params).pipe(map((response) => {
|
|
2469
|
+
const mediaArticles = [];
|
|
2470
|
+
if ((response.records !== undefined) &&
|
|
2471
|
+
(response.records.length > 0)) {
|
|
2472
|
+
for (const mediaRecord of response.records) {
|
|
2473
|
+
if (mediaRecord.active) {
|
|
2474
|
+
mediaArticles.push(this.processMediaRecord(mediaRecord));
|
|
2475
|
+
}
|
|
2196
2476
|
}
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
}
|
|
2200
|
-
return throwError('Invalid options');
|
|
2477
|
+
}
|
|
2478
|
+
return mediaArticles;
|
|
2479
|
+
}));
|
|
2201
2480
|
}
|
|
2202
2481
|
/**
|
|
2203
|
-
*
|
|
2482
|
+
* Retrieves the media heading records from the eSolve instance using the identifiers
|
|
2204
2483
|
*
|
|
2205
|
-
* @param
|
|
2484
|
+
* @param identifiers Array of strings representing the eSolve heading identifiers
|
|
2206
2485
|
*/
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
esolve_id = tree_record.id;
|
|
2221
|
-
parent_id = tree_record.menu_id;
|
|
2486
|
+
getHeadings(identifiers) {
|
|
2487
|
+
return this.http
|
|
2488
|
+
.get(`${this.config.api_url}/get-headings.php`, {
|
|
2489
|
+
params: {
|
|
2490
|
+
identifier: identifiers.join(','),
|
|
2491
|
+
},
|
|
2492
|
+
})
|
|
2493
|
+
.pipe(map((response) => {
|
|
2494
|
+
const headings = [];
|
|
2495
|
+
if ((response.records !== undefined) &&
|
|
2496
|
+
(response.records.length > 0)) {
|
|
2497
|
+
for (const heading_record of response.records) {
|
|
2498
|
+
headings.push(this.processHeadingRecord(heading_record));
|
|
2222
2499
|
}
|
|
2223
|
-
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));
|
|
2224
2500
|
}
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
}
|
|
2228
|
-
processTreeItem(record) {
|
|
2229
|
-
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.image, record.seo_page_title, record.seo_keywords, record.seo_description);
|
|
2230
|
-
}
|
|
2231
|
-
processID(id) {
|
|
2232
|
-
let type;
|
|
2233
|
-
let esolve_id;
|
|
2234
|
-
const type_code_regex = /^\<\<(CAT|SUB)\>\>/g;
|
|
2235
|
-
const match_results = id.match(type_code_regex);
|
|
2236
|
-
if (match_results) {
|
|
2237
|
-
const type_code = match_results[0];
|
|
2238
|
-
type = (type_code === '<<CAT>>' ? 'category' : 'subcategory');
|
|
2239
|
-
esolve_id = id.replace(type_code_regex, '');
|
|
2240
|
-
return {
|
|
2241
|
-
type,
|
|
2242
|
-
esolve_id
|
|
2243
|
-
};
|
|
2244
|
-
}
|
|
2245
|
-
return null;
|
|
2501
|
+
return headings;
|
|
2502
|
+
}));
|
|
2246
2503
|
}
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
class EsolveManufacturer {
|
|
2261
|
-
constructor(id, manufacturer, sef_manufacturer, title, article, sort_priority, is_active, featured, image_name, seo_title = '', seo_keywords = '', seo_description = '') {
|
|
2262
|
-
this.id = id;
|
|
2263
|
-
this.manufacturer = manufacturer;
|
|
2264
|
-
this.sef_manufacturer = sef_manufacturer;
|
|
2265
|
-
this.title = title;
|
|
2266
|
-
this.article = article;
|
|
2267
|
-
this.sort_priority = sort_priority;
|
|
2268
|
-
this.is_active = is_active;
|
|
2269
|
-
this.featured = featured;
|
|
2270
|
-
this.image_name = image_name;
|
|
2271
|
-
this.image_path = '/images/manufacturers/';
|
|
2272
|
-
if (this.title.trim() === '') {
|
|
2273
|
-
this.title = this.manufacturer;
|
|
2504
|
+
/**
|
|
2505
|
+
* Processes media article record
|
|
2506
|
+
*
|
|
2507
|
+
* @param record Record from eSolve instance
|
|
2508
|
+
*/
|
|
2509
|
+
processMediaRecord(record) {
|
|
2510
|
+
const tags = [];
|
|
2511
|
+
const topics = [];
|
|
2512
|
+
if ((record.tags) && (record.tags.length > 0)) {
|
|
2513
|
+
for (const tag of record.tags) {
|
|
2514
|
+
tags.push(new EsolveTag(tag));
|
|
2515
|
+
}
|
|
2274
2516
|
}
|
|
2275
|
-
if (
|
|
2276
|
-
|
|
2517
|
+
if ((record.topics) && (record.topics.length > 0)) {
|
|
2518
|
+
for (const topic of record.topics) {
|
|
2519
|
+
topics.push(new EsolveTopic(topic));
|
|
2520
|
+
}
|
|
2277
2521
|
}
|
|
2278
|
-
|
|
2279
|
-
}
|
|
2280
|
-
get original_image_src() {
|
|
2281
|
-
return this.getImagePath('original');
|
|
2282
|
-
}
|
|
2283
|
-
get small_image_src() {
|
|
2284
|
-
return this.getImagePath('small');
|
|
2522
|
+
return new EsolveMediaArticle(record.identifier, record.title, record.article, record.image_url, tags, topics, record.seo_page_title, record.seo_keywords, record.seo_description);
|
|
2285
2523
|
}
|
|
2286
|
-
|
|
2287
|
-
|
|
2524
|
+
/**
|
|
2525
|
+
* Processes media heading record
|
|
2526
|
+
*
|
|
2527
|
+
* @param record Record from eSolve instance
|
|
2528
|
+
*/
|
|
2529
|
+
processHeadingRecord(record) {
|
|
2530
|
+
return new EsolveHeading(record.identifier, record.value);
|
|
2288
2531
|
}
|
|
2289
|
-
|
|
2290
|
-
|
|
2532
|
+
/**
|
|
2533
|
+
* Retrieves media records from eSolve instance.
|
|
2534
|
+
*
|
|
2535
|
+
* @param params HTTP params
|
|
2536
|
+
*/
|
|
2537
|
+
getMediaRecords(params) {
|
|
2538
|
+
return this.http.get(`${this.config.api_url}/get-media.php`, { params });
|
|
2291
2539
|
}
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2540
|
+
}
|
|
2541
|
+
EsolveMediaService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveMediaService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2542
|
+
EsolveMediaService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveMediaService, providedIn: 'root' });
|
|
2543
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveMediaService, decorators: [{
|
|
2544
|
+
type: Injectable,
|
|
2545
|
+
args: [{
|
|
2546
|
+
providedIn: 'root',
|
|
2547
|
+
}]
|
|
2548
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
2549
|
+
type: Inject,
|
|
2550
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
2551
|
+
}] }, { type: i1$2.HttpClient }]; } });
|
|
2552
|
+
|
|
2553
|
+
class EsolveMenuItem {
|
|
2554
|
+
constructor(url, name, target, children = []) {
|
|
2555
|
+
this.url = url;
|
|
2556
|
+
this.name = name;
|
|
2557
|
+
this.target = target;
|
|
2558
|
+
this.children = children;
|
|
2297
2559
|
}
|
|
2298
2560
|
}
|
|
2299
2561
|
|
|
2300
|
-
class
|
|
2562
|
+
class EsolveMenuService {
|
|
2301
2563
|
constructor(config, http) {
|
|
2302
2564
|
this.config = config;
|
|
2303
2565
|
this.http = http;
|
|
2304
2566
|
}
|
|
2305
|
-
|
|
2306
|
-
const params = new HttpParams({
|
|
2307
|
-
fromObject: { manufacturers_id: id }
|
|
2308
|
-
});
|
|
2309
|
-
return this.getManufacturerSingle(params);
|
|
2310
|
-
}
|
|
2311
|
-
getManufacturerFromSEF(sef_manufacturer) {
|
|
2312
|
-
const params = new HttpParams({
|
|
2313
|
-
fromObject: { sef_manufacturer }
|
|
2314
|
-
});
|
|
2315
|
-
return this.getManufacturerSingle(params);
|
|
2316
|
-
}
|
|
2317
|
-
getManufacturers(options) {
|
|
2318
|
-
let params = new HttpParams();
|
|
2319
|
-
if (options?.featured_only) {
|
|
2320
|
-
params = params.set('featured_only', options.featured_only);
|
|
2321
|
-
}
|
|
2322
|
-
return this.getManufacturerRecords(params).pipe(map((records) => {
|
|
2323
|
-
const manufacturers = [];
|
|
2324
|
-
for (const record of records) {
|
|
2325
|
-
manufacturers.push(this.processManufacturer(record));
|
|
2326
|
-
}
|
|
2327
|
-
return manufacturers;
|
|
2328
|
-
}), catchError(() => {
|
|
2329
|
-
return of([]);
|
|
2330
|
-
}));
|
|
2331
|
-
}
|
|
2332
|
-
getManufacturerSingle(params) {
|
|
2333
|
-
return this.getManufacturerRecords(params).pipe(map((records) => {
|
|
2334
|
-
const record = records[0];
|
|
2335
|
-
return this.processManufacturer(record);
|
|
2336
|
-
}));
|
|
2337
|
-
}
|
|
2338
|
-
getManufacturerRecords(params) {
|
|
2567
|
+
getMenuTree(identifier) {
|
|
2339
2568
|
return this.http
|
|
2340
|
-
.get(`${this.config.api_url}/get-
|
|
2569
|
+
.get(`${this.config.api_url}/get-menu-tree.php`, { params: { identifier } })
|
|
2341
2570
|
.pipe(map((response) => {
|
|
2342
|
-
if ((response.records === undefined)
|
|
2343
|
-
(response.records.length <= 0)) {
|
|
2571
|
+
if ((!response) || (response.records === undefined)) {
|
|
2344
2572
|
throw response;
|
|
2345
2573
|
}
|
|
2346
|
-
|
|
2574
|
+
else if (response.records.length === 0) {
|
|
2575
|
+
return [];
|
|
2576
|
+
}
|
|
2577
|
+
return this.handleMenu(response.records);
|
|
2347
2578
|
}));
|
|
2348
2579
|
}
|
|
2349
|
-
|
|
2350
|
-
|
|
2580
|
+
handleMenu(records) {
|
|
2581
|
+
const menu = [];
|
|
2582
|
+
if (typeof records !== 'undefined') {
|
|
2583
|
+
for (const menuTreeRecord of records) {
|
|
2584
|
+
menu.push(new EsolveMenuItem(menuTreeRecord.sef_url, menuTreeRecord.name, menuTreeRecord.target, this.handleMenu(menuTreeRecord.children)));
|
|
2585
|
+
}
|
|
2586
|
+
}
|
|
2587
|
+
return menu;
|
|
2351
2588
|
}
|
|
2352
2589
|
}
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type:
|
|
2590
|
+
EsolveMenuService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveMenuService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2591
|
+
EsolveMenuService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveMenuService, providedIn: 'root' });
|
|
2592
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveMenuService, decorators: [{
|
|
2356
2593
|
type: Injectable,
|
|
2357
2594
|
args: [{
|
|
2358
2595
|
providedIn: 'root',
|
|
@@ -2362,97 +2599,192 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
2362
2599
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
2363
2600
|
}] }, { type: i1$2.HttpClient }]; } });
|
|
2364
2601
|
|
|
2365
|
-
class
|
|
2366
|
-
constructor(id,
|
|
2602
|
+
class EsolveNewsGroup {
|
|
2603
|
+
constructor(id, name, description, sef_name) {
|
|
2367
2604
|
this.id = id;
|
|
2368
|
-
this.
|
|
2369
|
-
this.
|
|
2370
|
-
this.
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
this.
|
|
2377
|
-
this.
|
|
2378
|
-
|
|
2379
|
-
|
|
2605
|
+
this.name = name;
|
|
2606
|
+
this.description = description;
|
|
2607
|
+
this.sef_name = sef_name;
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
|
|
2611
|
+
class EsolveNewsArticleAuthor {
|
|
2612
|
+
constructor(userid, email, firstname, surname) {
|
|
2613
|
+
this.userid = userid;
|
|
2614
|
+
this.email = email;
|
|
2615
|
+
this.firstname = firstname;
|
|
2616
|
+
this.surname = surname;
|
|
2617
|
+
}
|
|
2618
|
+
}
|
|
2619
|
+
|
|
2620
|
+
class EsolveNewsArticle {
|
|
2621
|
+
constructor(record) {
|
|
2622
|
+
this.id = 0;
|
|
2623
|
+
this.title = '';
|
|
2624
|
+
this.sef_title = '';
|
|
2625
|
+
this.article = '';
|
|
2626
|
+
this.short_description = '';
|
|
2627
|
+
this.txdate = '';
|
|
2628
|
+
this.active = false;
|
|
2629
|
+
this.image = '';
|
|
2630
|
+
this.featured = false;
|
|
2631
|
+
this.topics = [];
|
|
2632
|
+
this.tags = [];
|
|
2633
|
+
let seo_title = '';
|
|
2634
|
+
let seo_description = '';
|
|
2635
|
+
let seo_keywords = '';
|
|
2636
|
+
if (record) {
|
|
2637
|
+
this.id = +(record.id ?? 0);
|
|
2638
|
+
this.title = record.title ?? '';
|
|
2639
|
+
this.sef_title = record.sef_title ?? '';
|
|
2640
|
+
this.article = record.article ?? '';
|
|
2641
|
+
this.txdate = record.txdate ?? '';
|
|
2642
|
+
this.image = record.image ?? '';
|
|
2643
|
+
if (record.active) {
|
|
2644
|
+
this.active = !!+record.active;
|
|
2645
|
+
}
|
|
2646
|
+
if (record.featured) {
|
|
2647
|
+
this.featured = !!+record.featured;
|
|
2648
|
+
}
|
|
2649
|
+
seo_title = record.seo_page_title ?? '';
|
|
2650
|
+
seo_description = record.short_description ?? '';
|
|
2651
|
+
seo_keywords = record.seo_keywords ?? '';
|
|
2652
|
+
if (record.news_group) {
|
|
2653
|
+
const group_record = record.news_group;
|
|
2654
|
+
this.group = new EsolveNewsGroup(+group_record.id, group_record.name, group_record.description, group_record.sef_name);
|
|
2655
|
+
}
|
|
2656
|
+
if (record.user) {
|
|
2657
|
+
this.author = new EsolveNewsArticleAuthor(record.user.userid, record.user.email, record.user.firstname, record.user.surname);
|
|
2658
|
+
}
|
|
2659
|
+
if (record.manufacturer) {
|
|
2660
|
+
this.manufacturer = new EsolveManufacturer(record.manufacturer);
|
|
2661
|
+
}
|
|
2662
|
+
if (record.range) {
|
|
2663
|
+
this.range = new EsolveRange(record.range);
|
|
2664
|
+
}
|
|
2665
|
+
if (record.topics && record.topics.length > 0) {
|
|
2666
|
+
const topics = record.topics;
|
|
2667
|
+
for (const topic of topics) {
|
|
2668
|
+
this.topics.push(new EsolveTopic(topic));
|
|
2669
|
+
}
|
|
2670
|
+
}
|
|
2671
|
+
if (record.tags && record.tags.length > 0) {
|
|
2672
|
+
const tags = record.tags;
|
|
2673
|
+
for (const tag of tags) {
|
|
2674
|
+
this.tags.push(new EsolveTag(tag));
|
|
2675
|
+
}
|
|
2676
|
+
}
|
|
2380
2677
|
}
|
|
2381
2678
|
if (seo_title.trim() === '') {
|
|
2382
2679
|
seo_title = this.title;
|
|
2383
2680
|
}
|
|
2384
2681
|
this.seo_details = new EsolveSeoInfo(seo_title, seo_description, seo_keywords);
|
|
2385
2682
|
}
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
return '';
|
|
2683
|
+
}
|
|
2684
|
+
|
|
2685
|
+
class EsolveNewsArticleList {
|
|
2686
|
+
constructor(newsArticles, total, page) {
|
|
2687
|
+
this.newsArticles = newsArticles;
|
|
2688
|
+
this.total = total;
|
|
2689
|
+
this.page = page;
|
|
2394
2690
|
}
|
|
2395
2691
|
}
|
|
2396
2692
|
|
|
2397
|
-
class
|
|
2693
|
+
class EsolveNewsService {
|
|
2398
2694
|
constructor(config, http) {
|
|
2399
2695
|
this.config = config;
|
|
2400
2696
|
this.http = http;
|
|
2401
2697
|
}
|
|
2402
|
-
|
|
2403
|
-
const params = new HttpParams({
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
getRangeFromSEF(sef_range) {
|
|
2409
|
-
const params = new HttpParams({
|
|
2410
|
-
fromObject: { sef_range }
|
|
2411
|
-
});
|
|
2412
|
-
return this.getRangeSingle(params);
|
|
2413
|
-
}
|
|
2414
|
-
getRanges(options) {
|
|
2415
|
-
let params = new HttpParams();
|
|
2416
|
-
if (options?.featured_only) {
|
|
2417
|
-
params = params.set('featured_only', options.featured_only);
|
|
2418
|
-
}
|
|
2419
|
-
if (options?.manufacturers_id) {
|
|
2420
|
-
params = params.set('manufacturers_id', options.manufacturers_id);
|
|
2421
|
-
}
|
|
2422
|
-
return this.getRangeRecords(params).pipe(map((records) => {
|
|
2423
|
-
const ranges = [];
|
|
2424
|
-
for (const record of records) {
|
|
2425
|
-
ranges.push(this.processRange(record));
|
|
2698
|
+
getNewsArticle(identifier) {
|
|
2699
|
+
const params = new HttpParams({ fromObject: { sef_title: identifier } });
|
|
2700
|
+
return this.getNewsRecords(params).pipe(map((response) => {
|
|
2701
|
+
if ((response.records === undefined) ||
|
|
2702
|
+
(response.records.length <= 0)) {
|
|
2703
|
+
throw response;
|
|
2426
2704
|
}
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2705
|
+
const record = response.records[0];
|
|
2706
|
+
if (!record.active) {
|
|
2707
|
+
throw response;
|
|
2708
|
+
}
|
|
2709
|
+
return this.processNewsArticle(record);
|
|
2430
2710
|
}));
|
|
2431
2711
|
}
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2712
|
+
getNewsArticles(options) {
|
|
2713
|
+
const params = this.parseOptions(options);
|
|
2714
|
+
return this.getNewsRecords(params).pipe(map((response) => {
|
|
2715
|
+
if (response.records === undefined) {
|
|
2716
|
+
throw response;
|
|
2717
|
+
}
|
|
2718
|
+
const news_articles = [];
|
|
2719
|
+
for (const record of response.records) {
|
|
2720
|
+
news_articles.push(this.processNewsArticle(record));
|
|
2721
|
+
}
|
|
2722
|
+
const page = options?.page ?? 0;
|
|
2723
|
+
const total_records = +response.additional_data.total_records;
|
|
2724
|
+
return new EsolveNewsArticleList(news_articles, total_records, page);
|
|
2436
2725
|
}));
|
|
2437
2726
|
}
|
|
2438
|
-
|
|
2727
|
+
getNewsGroups() {
|
|
2439
2728
|
return this.http
|
|
2440
|
-
.get(`${this.config.api_url}/get-
|
|
2729
|
+
.get(`${this.config.api_url}/get-news-groups.php`)
|
|
2441
2730
|
.pipe(map((response) => {
|
|
2442
|
-
if (
|
|
2443
|
-
(response.records.length <= 0)) {
|
|
2731
|
+
if (response.records === undefined) {
|
|
2444
2732
|
throw response;
|
|
2445
2733
|
}
|
|
2446
|
-
|
|
2734
|
+
const news_groups = [];
|
|
2735
|
+
for (const record of response.records) {
|
|
2736
|
+
news_groups.push(new EsolveNewsGroup(record.id, record.name, record.description, record.sef_name));
|
|
2737
|
+
}
|
|
2738
|
+
return news_groups;
|
|
2447
2739
|
}));
|
|
2448
2740
|
}
|
|
2449
|
-
|
|
2450
|
-
return new
|
|
2741
|
+
processNewsArticle(record) {
|
|
2742
|
+
return new EsolveNewsArticle(record);
|
|
2743
|
+
}
|
|
2744
|
+
getNewsRecords(params) {
|
|
2745
|
+
return this.http.get(`${this.config.api_url}/get-news.php`, { params });
|
|
2746
|
+
}
|
|
2747
|
+
parseOptions(options) {
|
|
2748
|
+
let params = new HttpParams();
|
|
2749
|
+
if (!options) {
|
|
2750
|
+
return params;
|
|
2751
|
+
}
|
|
2752
|
+
if (options.news_group_id) {
|
|
2753
|
+
params = params.set('news_group_id', options.news_group_id);
|
|
2754
|
+
}
|
|
2755
|
+
else if (options.news_group_sef) {
|
|
2756
|
+
params = params.set('news_group_sef', options.news_group_sef);
|
|
2757
|
+
}
|
|
2758
|
+
if (options.page) {
|
|
2759
|
+
params = params.set('page', options.page);
|
|
2760
|
+
}
|
|
2761
|
+
if (options.rows) {
|
|
2762
|
+
params = params.set('rows', options.rows);
|
|
2763
|
+
}
|
|
2764
|
+
if (options.feature_only) {
|
|
2765
|
+
params = params.set('feature_only', options.feature_only);
|
|
2766
|
+
}
|
|
2767
|
+
if (options.manufacturers_id) {
|
|
2768
|
+
params = params.set('manufacturers_id', options.manufacturers_id);
|
|
2769
|
+
}
|
|
2770
|
+
if (options.ranges_id) {
|
|
2771
|
+
params = params.set('ranges_id', options.ranges_id);
|
|
2772
|
+
}
|
|
2773
|
+
if (options.from_date) {
|
|
2774
|
+
params = params.set('from_date', options.from_date);
|
|
2775
|
+
}
|
|
2776
|
+
if (options.to_date) {
|
|
2777
|
+
params = params.set('to_date', options.to_date);
|
|
2778
|
+
}
|
|
2779
|
+
if (options.search_phrase) {
|
|
2780
|
+
params = params.set('search_phrase', options.search_phrase);
|
|
2781
|
+
}
|
|
2782
|
+
return params;
|
|
2451
2783
|
}
|
|
2452
2784
|
}
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type:
|
|
2785
|
+
EsolveNewsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveNewsService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2786
|
+
EsolveNewsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveNewsService, providedIn: 'root' });
|
|
2787
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveNewsService, decorators: [{
|
|
2456
2788
|
type: Injectable,
|
|
2457
2789
|
args: [{
|
|
2458
2790
|
providedIn: 'root',
|
|
@@ -2462,6 +2794,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
2462
2794
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
2463
2795
|
}] }, { type: i1$2.HttpClient }]; } });
|
|
2464
2796
|
|
|
2797
|
+
class EsolveColour {
|
|
2798
|
+
constructor(record) {
|
|
2799
|
+
this.id = record.id ?? 0;
|
|
2800
|
+
this.colour = record.colour ?? '';
|
|
2801
|
+
this.description = record.description ?? '';
|
|
2802
|
+
}
|
|
2803
|
+
}
|
|
2804
|
+
|
|
2465
2805
|
class EsolveStockBadge {
|
|
2466
2806
|
constructor(id, text, identifier, font_colour, badge_colour, sort_priority) {
|
|
2467
2807
|
this.id = id;
|
|
@@ -2629,12 +2969,12 @@ class EsolveStockItemBase {
|
|
|
2629
2969
|
sell_price_with_tax = +(record.sellprice_inclusive ?? 0);
|
|
2630
2970
|
if ((record.tags) && (record.tags.length > 0)) {
|
|
2631
2971
|
for (const tag of record.tags) {
|
|
2632
|
-
this.tags.push(new EsolveTag(
|
|
2972
|
+
this.tags.push(new EsolveTag(tag));
|
|
2633
2973
|
}
|
|
2634
2974
|
}
|
|
2635
2975
|
if ((record.topics) && (record.topics.length > 0)) {
|
|
2636
2976
|
for (const topic of record.topics) {
|
|
2637
|
-
this.topics.push(new EsolveTopic(
|
|
2977
|
+
this.topics.push(new EsolveTopic(topic));
|
|
2638
2978
|
}
|
|
2639
2979
|
}
|
|
2640
2980
|
if ((record.badges) && (record.badges.length > 0)) {
|
|
@@ -2649,10 +2989,10 @@ class EsolveStockItemBase {
|
|
|
2649
2989
|
this.subcategory = new EsolveCategoryTreeItem(record.subcategory.type, record.subcategory.id, record.subcategory.parent_id, record.subcategory.description, record.subcategory.sef_description, record.subcategory.short_description, record.subcategory.sort_priority, record.subcategory.active, record.subcategory.display_only, record.subcategory.image, record.subcategory.seo_page_title, record.subcategory.seo_keywords, record.subcategory.seo_description);
|
|
2650
2990
|
}
|
|
2651
2991
|
if (record.manufacturer) {
|
|
2652
|
-
this.manufacturer = new EsolveManufacturer(record.manufacturer
|
|
2992
|
+
this.manufacturer = new EsolveManufacturer(record.manufacturer);
|
|
2653
2993
|
}
|
|
2654
2994
|
if (record.range) {
|
|
2655
|
-
this.range = new EsolveRange(record.range
|
|
2995
|
+
this.range = new EsolveRange(record.range);
|
|
2656
2996
|
}
|
|
2657
2997
|
if (record.colours && record.colours.length > 0) {
|
|
2658
2998
|
for (const colour of record.colours) {
|
|
@@ -4042,5 +4382,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
4042
4382
|
* Generated bundle index. Do not edit.
|
|
4043
4383
|
*/
|
|
4044
4384
|
|
|
4045
|
-
export { EsolveAccountService, EsolveAdditionalStockImage, EsolveAddress, EsolveAddressResult, EsolveAuthService, EsolveBankingDetails, EsolveBanner, EsolveBannerImage, EsolveBannerImageHotspot, EsolveBannerService, EsolveCartItem, EsolveCartService, EsolveCartStockItem, EsolveCartTotals, EsolveCategoryTreeItem, EsolveCategoryTreeService, EsolveChangePasswordResult, EsolveCheckoutResult, EsolveColour, EsolveCookieService, EsolveEnquiryResult, EsolveEnquiryService, EsolveErrorHandlerService, EsolveGeocodeAddressResult, EsolveGeocodeCoordsResult, EsolveGeocodeResult, EsolveGeocoderService, EsolveHeading, EsolveHttpError, EsolveLinkedAsset, EsolveLinkedStockItem, EsolveList, EsolveLocation, EsolveLocationAddress, EsolveLocationContactInfo, EsolveLocationPOBoxAddress, EsolveLocationTradingDay, EsolveLocationTradingTimes, EsolveLocationsService, EsolveManufacturer, EsolveManufacturersService, EsolveMediaArticle, EsolveMediaService, EsolveMediaStockItem, EsolveMenuItem, EsolveMenuService, EsolveNewsArticle, EsolveNewsArticleAuthor, EsolveNewsArticleList, EsolveNewsGroup, EsolveNewsService, EsolvePaymentMethod, EsolvePaymentResult, EsolvePaymentService, EsolveRange, EsolveRangesService, EsolveRecipeStockItem, EsolveRegistrationResult, EsolveResetPasswordResult, EsolveResponseHandlerService, EsolveResponseResult, EsolveResult, EsolveSeoInfo, EsolveSeoService, EsolveSession, EsolveSessionService, EsolveShippingCost, EsolveShippingMethod, EsolveShippingService, EsolveShippingTotals, EsolveSpecial, EsolveSpecialImage, EsolveSpecialImageCollection, EsolveSpecialsService, EsolveStockBadge, EsolveStockGroup, EsolveStockGroupItem, EsolveStockImage, EsolveStockImageCollection, EsolveStockItem, EsolveStockItemBase, EsolveStockItemList, EsolveStockLeadTimes, EsolveStockPrice, EsolveStockService, EsolveTag, EsolveTopic, EsolveTopicService, EsolveTransaction, EsolveTransactionAddress, EsolveTransactionClient, EsolveTransactionItem, EsolveTransactionItemPrice, EsolveTransactionList, EsolveTransactionLocation, EsolveTransactionPaymentMethod, EsolveTransactionShippingMethod, EsolveTransactionUser, EsolveUserAccount, EsolveUserAccountBusiness, EsolveUserAccountContact, EsolveUserAccountResult, EsolveVaultItem, EsolveVaultItemResult, NgEsolveConnectModule };
|
|
4046
|
-
//# sourceMappingURL=esolve-ng-esolve-connect.mjs.map
|
|
4385
|
+
export { EsolveAccountService, EsolveAdditionalStockImage, EsolveAddress, EsolveAddressResult, EsolveAsset, EsolveAssetsService, EsolveAuthService, EsolveBankingDetails, EsolveBanner, EsolveBannerImage, EsolveBannerImageHotspot, EsolveBannerService, EsolveCartItem, EsolveCartService, EsolveCartStockItem, EsolveCartTotals, EsolveCategoryTreeItem, EsolveCategoryTreeService, EsolveChangePasswordResult, EsolveCheckoutResult, EsolveColour, EsolveCookieService, EsolveEnquiryResult, EsolveEnquiryService, EsolveErrorHandlerService, EsolveGeocodeAddressResult, EsolveGeocodeCoordsResult, EsolveGeocodeResult, EsolveGeocoderService, EsolveHeading, EsolveHttpError, EsolveLinkedAsset, EsolveLinkedStockItem, EsolveList, EsolveLocation, EsolveLocationAddress, EsolveLocationContactInfo, EsolveLocationPOBoxAddress, EsolveLocationTradingDay, EsolveLocationTradingTimes, EsolveLocationsService, EsolveManufacturer, EsolveManufacturersService, EsolveMediaArticle, EsolveMediaService, EsolveMediaStockItem, EsolveMenuItem, EsolveMenuService, EsolveNewsArticle, EsolveNewsArticleAuthor, EsolveNewsArticleList, EsolveNewsGroup, EsolveNewsService, EsolvePaymentMethod, EsolvePaymentResult, EsolvePaymentService, EsolveRange, EsolveRangesService, EsolveRecipeStockItem, EsolveRegistrationResult, EsolveResetPasswordResult, EsolveResponseHandlerService, EsolveResponseResult, EsolveResult, EsolveSeoInfo, EsolveSeoService, EsolveSession, EsolveSessionService, EsolveShippingCost, EsolveShippingMethod, EsolveShippingService, EsolveShippingTotals, EsolveSpecial, EsolveSpecialImage, EsolveSpecialImageCollection, EsolveSpecialsService, EsolveStockBadge, EsolveStockGroup, EsolveStockGroupItem, EsolveStockImage, EsolveStockImageCollection, EsolveStockItem, EsolveStockItemBase, EsolveStockItemList, EsolveStockLeadTimes, EsolveStockPrice, EsolveStockService, EsolveTag, EsolveTagsService, EsolveTopic, EsolveTopicService, EsolveTransaction, EsolveTransactionAddress, EsolveTransactionClient, EsolveTransactionItem, EsolveTransactionItemPrice, EsolveTransactionList, EsolveTransactionLocation, EsolveTransactionPaymentMethod, EsolveTransactionShippingMethod, EsolveTransactionUser, EsolveUserAccount, EsolveUserAccountBusiness, EsolveUserAccountContact, EsolveUserAccountResult, EsolveVaultItem, EsolveVaultItemResult, NgEsolveConnectModule };
|