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