@esolve/ng-esolve-connect 0.6.1 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/{esm2015/esolve-ng-esolve-connect.js → esm2020/esolve-ng-esolve-connect.mjs} +0 -0
  2. package/esm2020/lib/account/esolve-account.service.mjs +161 -0
  3. package/esm2020/lib/account/esolve-address-record.mjs +2 -0
  4. package/esm2020/lib/account/esolve-address-response.mjs +2 -0
  5. package/esm2020/lib/account/esolve-address-result.mjs +11 -0
  6. package/esm2020/lib/account/esolve-address-set-data.mjs +2 -0
  7. package/esm2020/lib/account/esolve-address.mjs +19 -0
  8. package/esm2020/lib/account/esolve-geocode-result.mjs +2 -0
  9. package/esm2020/lib/account/esolve-registration-data.mjs +2 -0
  10. package/esm2020/lib/account/esolve-registration-post-response-item.mjs +2 -0
  11. package/esm2020/lib/account/esolve-registration-result.mjs +11 -0
  12. package/esm2020/lib/account/esolve-user-account-data.mjs +2 -0
  13. package/esm2020/lib/account/esolve-user-account-record.mjs +2 -0
  14. package/esm2020/lib/account/esolve-user-account-result.mjs +9 -0
  15. package/esm2020/lib/account/esolve-user-account.mjs +29 -0
  16. package/{esm2015/lib/auth/esolve-auth-interceptor.service.js → esm2020/lib/auth/esolve-auth-interceptor.service.mjs} +7 -7
  17. package/esm2020/lib/auth/esolve-auth.service.mjs +163 -0
  18. package/{esm2015/lib/banners/esolve-banner-image-hotspot-record.js → esm2020/lib/banners/esolve-banner-image-hotspot-record.mjs} +0 -0
  19. package/{esm2015/lib/banners/esolve-banner-image-hotspot.js → esm2020/lib/banners/esolve-banner-image-hotspot.mjs} +0 -0
  20. package/{esm2015/lib/banners/esolve-banner-image-record.js → esm2020/lib/banners/esolve-banner-image-record.mjs} +0 -0
  21. package/{esm2015/lib/banners/esolve-banner-image.js → esm2020/lib/banners/esolve-banner-image.mjs} +0 -0
  22. package/{esm2015/lib/banners/esolve-banner-record.js → esm2020/lib/banners/esolve-banner-record.mjs} +0 -0
  23. package/{esm2015/lib/banners/esolve-banner-type.js → esm2020/lib/banners/esolve-banner-type.mjs} +0 -0
  24. package/{esm2015/lib/banners/esolve-banner.js → esm2020/lib/banners/esolve-banner.mjs} +0 -0
  25. package/{esm2015/lib/banners/esolve-banner.service.js → esm2020/lib/banners/esolve-banner.service.mjs} +3 -3
  26. package/{esm2015/lib/cart/esolve-cart-item-record.js → esm2020/lib/cart/esolve-cart-item-record.mjs} +0 -0
  27. package/{esm2015/lib/cart/esolve-cart-item-response.js → esm2020/lib/cart/esolve-cart-item-response.mjs} +0 -0
  28. package/{esm2015/lib/cart/esolve-cart-item.js → esm2020/lib/cart/esolve-cart-item.mjs} +0 -0
  29. package/{esm2015/lib/cart/esolve-cart-stock-item.js → esm2020/lib/cart/esolve-cart-stock-item.mjs} +0 -0
  30. package/{esm2015/lib/cart/esolve-cart-totals-record.js → esm2020/lib/cart/esolve-cart-totals-record.mjs} +0 -0
  31. package/{esm2015/lib/cart/esolve-cart-totals.js → esm2020/lib/cart/esolve-cart-totals.mjs} +0 -0
  32. package/esm2020/lib/cart/esolve-cart.service.mjs +172 -0
  33. package/esm2020/lib/cart/esolve-checkout-result.mjs +9 -0
  34. package/{esm2015/lib/cart/esolve-checkout.js → esm2020/lib/cart/esolve-checkout.mjs} +0 -0
  35. package/{esm2015/lib/category-tree/esolve-category-tree-item-record.js → esm2020/lib/category-tree/esolve-category-tree-item-record.mjs} +0 -0
  36. package/{esm2015/lib/category-tree/esolve-category-tree-item.js → esm2020/lib/category-tree/esolve-category-tree-item.mjs} +0 -0
  37. package/{esm2015/lib/category-tree/esolve-category-tree.service.js → esm2020/lib/category-tree/esolve-category-tree.service.mjs} +3 -3
  38. package/{esm2015/lib/esolve-connect.config.js → esm2020/lib/esolve-connect.config.mjs} +0 -0
  39. package/esm2020/lib/locations/esolve-locations.service.mjs +53 -0
  40. package/esm2020/lib/locations/esolve-stock-location-record.mjs +2 -0
  41. package/esm2020/lib/locations/esolve-stock-location.mjs +76 -0
  42. package/{esm2015/lib/media/esolve-media-article.js → esm2020/lib/media/esolve-media-article.mjs} +0 -0
  43. package/{esm2015/lib/media/esolve-media-record.js → esm2020/lib/media/esolve-media-record.mjs} +0 -0
  44. package/{esm2015/lib/media/esolve-media.service.js → esm2020/lib/media/esolve-media.service.mjs} +3 -3
  45. package/{esm2015/lib/menu/esolve-menu-item.js → esm2020/lib/menu/esolve-menu-item.mjs} +0 -0
  46. package/{esm2015/lib/menu/esolve-menu-tree-record.js → esm2020/lib/menu/esolve-menu-tree-record.mjs} +0 -0
  47. package/{esm2015/lib/menu/esolve-menu.service.js → esm2020/lib/menu/esolve-menu.service.mjs} +3 -3
  48. package/{esm2015/lib/news/esolve-news-article-author-record.js → esm2020/lib/news/esolve-news-article-author-record.mjs} +0 -0
  49. package/{esm2015/lib/news/esolve-news-article-author.js → esm2020/lib/news/esolve-news-article-author.mjs} +0 -0
  50. package/{esm2015/lib/news/esolve-news-article-list.js → esm2020/lib/news/esolve-news-article-list.mjs} +0 -0
  51. package/{esm2015/lib/news/esolve-news-article-record.js → esm2020/lib/news/esolve-news-article-record.mjs} +0 -0
  52. package/{esm2015/lib/news/esolve-news-article.js → esm2020/lib/news/esolve-news-article.mjs} +0 -0
  53. package/{esm2015/lib/news/esolve-news-group-record.js → esm2020/lib/news/esolve-news-group-record.mjs} +0 -0
  54. package/{esm2015/lib/news/esolve-news-group.js → esm2020/lib/news/esolve-news-group.mjs} +0 -0
  55. package/{esm2015/lib/news/esolve-news-manufacturer-record.js → esm2020/lib/news/esolve-news-manufacturer-record.mjs} +0 -0
  56. package/{esm2015/lib/news/esolve-news-range-record.js → esm2020/lib/news/esolve-news-range-record.mjs} +0 -0
  57. package/{esm2015/lib/news/esolve-news.service.js → esm2020/lib/news/esolve-news.service.mjs} +3 -3
  58. package/esm2020/lib/ng-esolve-connect.module.mjs +45 -0
  59. package/esm2020/lib/payment/esolve-card-data.mjs +2 -0
  60. package/esm2020/lib/payment/esolve-payment-method-options.mjs +2 -0
  61. package/esm2020/lib/payment/esolve-payment-method-record.mjs +2 -0
  62. package/esm2020/lib/payment/esolve-payment-method.mjs +49 -0
  63. package/esm2020/lib/payment/esolve-payment-response.mjs +2 -0
  64. package/esm2020/lib/payment/esolve-payment-result.mjs +22 -0
  65. package/esm2020/lib/payment/esolve-payment.service.mjs +178 -0
  66. package/esm2020/lib/payment/esolve-vault-item-result.mjs +20 -0
  67. package/esm2020/lib/payment/esolve-vault-item.mjs +19 -0
  68. package/esm2020/lib/payment/esolve-vault-record.mjs +2 -0
  69. package/esm2020/lib/payment/esolve-vault-response.mjs +2 -0
  70. package/esm2020/lib/session/esolve-session.mjs +27 -0
  71. package/esm2020/lib/session/esolve-session.service.mjs +79 -0
  72. package/esm2020/lib/session/esolve-stored-session.mjs +2 -0
  73. package/esm2020/lib/shared/error-handler/esolve-error-handler.service.mjs +58 -0
  74. package/{esm2015/lib/shared/error-handler/esolve-http-error.js → esm2020/lib/shared/error-handler/esolve-http-error.mjs} +0 -0
  75. package/{esm2015/lib/shared/esolve-response.js → esm2020/lib/shared/esolve-response.mjs} +1 -1
  76. package/{esm2015/lib/shared/esolve-url-target.js → esm2020/lib/shared/esolve-url-target.mjs} +0 -0
  77. package/esm2020/lib/shared/response-handler/esolve-response-handler.service.mjs +32 -0
  78. package/esm2020/lib/shared/response-handler/esolve-response-result.mjs +9 -0
  79. package/{esm2015/lib/shared/seo/esolve-seo-info.js → esm2020/lib/shared/seo/esolve-seo-info.mjs} +0 -0
  80. package/{esm2015/lib/shared/seo/esolve-seo.service.js → esm2020/lib/shared/seo/esolve-seo.service.mjs} +3 -3
  81. package/esm2020/lib/shipping/esolve-shipping-cost-record.mjs +2 -0
  82. package/esm2020/lib/shipping/esolve-shipping-cost.mjs +18 -0
  83. package/esm2020/lib/shipping/esolve-shipping-method-options.mjs +2 -0
  84. package/esm2020/lib/shipping/esolve-shipping-method-record.mjs +2 -0
  85. package/esm2020/lib/shipping/esolve-shipping-method.mjs +33 -0
  86. package/esm2020/lib/shipping/esolve-shipping.service.mjs +108 -0
  87. package/{esm2015/lib/stock/esolve-stock-badge-record.js → esm2020/lib/stock/esolve-stock-badge-record.mjs} +0 -0
  88. package/{esm2015/lib/stock/esolve-stock-badge.js → esm2020/lib/stock/esolve-stock-badge.mjs} +0 -0
  89. package/{esm2015/lib/stock/esolve-stock-item-list.js → esm2020/lib/stock/esolve-stock-item-list.mjs} +0 -0
  90. package/{esm2015/lib/stock/esolve-stock-item-options.js → esm2020/lib/stock/esolve-stock-item-options.mjs} +0 -0
  91. package/{esm2015/lib/stock/esolve-stock-item.js → esm2020/lib/stock/esolve-stock-item.mjs} +0 -0
  92. package/{esm2015/lib/stock/esolve-stock-price.js → esm2020/lib/stock/esolve-stock-price.mjs} +0 -0
  93. package/{esm2015/lib/stock/esolve-stock-record.js → esm2020/lib/stock/esolve-stock-record.mjs} +0 -0
  94. package/{esm2015/lib/stock/esolve-stock.service.js → esm2020/lib/stock/esolve-stock.service.mjs} +5 -6
  95. package/{esm2015/lib/tags/esolve-tag-record.js → esm2020/lib/tags/esolve-tag-record.mjs} +0 -0
  96. package/{esm2015/lib/tags/esolve-tag.js → esm2020/lib/tags/esolve-tag.mjs} +0 -0
  97. package/{esm2015/lib/topics/esolve-topic-record.js → esm2020/lib/topics/esolve-topic-record.mjs} +0 -0
  98. package/{esm2015/lib/topics/esolve-topic.js → esm2020/lib/topics/esolve-topic.mjs} +0 -0
  99. package/{esm2015/lib/topics/esolve-topic.service.js → esm2020/lib/topics/esolve-topic.service.mjs} +3 -3
  100. package/esm2020/public-api.mjs +78 -0
  101. package/fesm2015/esolve-ng-esolve-connect.mjs +2651 -0
  102. package/fesm2015/esolve-ng-esolve-connect.mjs.map +1 -0
  103. package/{fesm2015/esolve-ng-esolve-connect.js → fesm2020/esolve-ng-esolve-connect.mjs} +838 -461
  104. package/fesm2020/esolve-ng-esolve-connect.mjs.map +1 -0
  105. package/lib/account/esolve-account.service.d.ts +35 -0
  106. package/lib/{auth → account}/esolve-address-record.d.ts +0 -0
  107. package/lib/account/esolve-address-response.d.ts +8 -0
  108. package/lib/account/esolve-address-result.d.ts +10 -0
  109. package/lib/account/esolve-address-set-data.d.ts +17 -0
  110. package/lib/{auth → account}/esolve-address.d.ts +0 -0
  111. package/lib/account/esolve-geocode-result.d.ts +16 -0
  112. package/lib/{auth → account}/esolve-registration-data.d.ts +0 -0
  113. package/lib/account/esolve-registration-post-response-item.d.ts +7 -0
  114. package/lib/account/esolve-registration-result.d.ts +9 -0
  115. package/lib/account/esolve-user-account-data.d.ts +17 -0
  116. package/lib/account/esolve-user-account-record.d.ts +21 -0
  117. package/lib/account/esolve-user-account-result.d.ts +6 -0
  118. package/lib/account/esolve-user-account.d.ts +29 -0
  119. package/lib/auth/esolve-auth-interceptor.service.d.ts +1 -1
  120. package/lib/auth/esolve-auth.service.d.ts +5 -3
  121. package/lib/cart/esolve-cart.service.d.ts +6 -55
  122. package/lib/cart/esolve-checkout-result.d.ts +6 -0
  123. package/lib/locations/esolve-locations.service.d.ts +23 -0
  124. package/lib/{cart → locations}/esolve-stock-location-record.d.ts +0 -0
  125. package/lib/{cart → locations}/esolve-stock-location.d.ts +0 -0
  126. package/lib/payment/esolve-card-data.d.ts +7 -0
  127. package/lib/payment/esolve-payment-method-options.d.ts +5 -0
  128. package/lib/{cart → payment}/esolve-payment-method-record.d.ts +0 -5
  129. package/lib/{cart → payment}/esolve-payment-method.d.ts +2 -2
  130. package/lib/payment/esolve-payment-response.d.ts +13 -0
  131. package/lib/payment/esolve-payment-result.d.ts +10 -0
  132. package/lib/payment/esolve-payment.service.d.ts +61 -0
  133. package/lib/payment/esolve-vault-item-result.d.ts +10 -0
  134. package/lib/payment/esolve-vault-item.d.ts +10 -0
  135. package/lib/payment/esolve-vault-record.d.ts +11 -0
  136. package/lib/payment/esolve-vault-response.d.ts +9 -0
  137. package/lib/{auth → session}/esolve-session.d.ts +0 -0
  138. package/lib/{auth → session}/esolve-session.service.d.ts +0 -0
  139. package/lib/{auth → session}/esolve-stored-session.d.ts +0 -0
  140. package/lib/shared/error-handler/esolve-error-handler.service.d.ts +1 -1
  141. package/lib/shared/esolve-response.d.ts +5 -5
  142. package/lib/shared/response-handler/esolve-response-handler.service.d.ts +15 -0
  143. package/lib/shared/response-handler/esolve-response-result.d.ts +6 -0
  144. package/lib/{cart → shipping}/esolve-shipping-cost-record.d.ts +0 -5
  145. package/lib/{cart → shipping}/esolve-shipping-cost.d.ts +0 -0
  146. package/lib/shipping/esolve-shipping-method-options.d.ts +4 -0
  147. package/lib/{cart → shipping}/esolve-shipping-method-record.d.ts +0 -4
  148. package/lib/{cart → shipping}/esolve-shipping-method.d.ts +0 -0
  149. package/lib/shipping/esolve-shipping.service.d.ts +37 -0
  150. package/package.json +22 -8
  151. package/public-api.d.ts +24 -9
  152. package/bundles/esolve-ng-esolve-connect.umd.js +0 -3064
  153. package/bundles/esolve-ng-esolve-connect.umd.js.map +0 -1
  154. package/esm2015/lib/auth/esolve-account.service.js +0 -103
  155. package/esm2015/lib/auth/esolve-address-record.js +0 -2
  156. package/esm2015/lib/auth/esolve-address.js +0 -19
  157. package/esm2015/lib/auth/esolve-auth.service.js +0 -163
  158. package/esm2015/lib/auth/esolve-registration-data.js +0 -2
  159. package/esm2015/lib/auth/esolve-session.js +0 -27
  160. package/esm2015/lib/auth/esolve-session.service.js +0 -79
  161. package/esm2015/lib/auth/esolve-stored-session.js +0 -2
  162. package/esm2015/lib/cart/esolve-cart.service.js +0 -326
  163. package/esm2015/lib/cart/esolve-payment-method-record.js +0 -2
  164. package/esm2015/lib/cart/esolve-payment-method.js +0 -49
  165. package/esm2015/lib/cart/esolve-shipping-cost-record.js +0 -2
  166. package/esm2015/lib/cart/esolve-shipping-cost.js +0 -18
  167. package/esm2015/lib/cart/esolve-shipping-method-record.js +0 -2
  168. package/esm2015/lib/cart/esolve-shipping-method.js +0 -33
  169. package/esm2015/lib/cart/esolve-stock-location-record.js +0 -2
  170. package/esm2015/lib/cart/esolve-stock-location.js +0 -76
  171. package/esm2015/lib/ng-esolve-connect.module.js +0 -43
  172. package/esm2015/lib/shared/error-handler/esolve-error-handler.service.js +0 -58
  173. package/esm2015/public-api.js +0 -58
  174. package/fesm2015/esolve-ng-esolve-connect.js.map +0 -1
  175. package/lib/auth/esolve-account.service.d.ts +0 -23
@@ -3,6 +3,8 @@ import { InjectionToken, Injectable, Inject, NgModule } from '@angular/core';
3
3
  import { CommonModule } from '@angular/common';
4
4
  import * as i1$1 from '@angular/common/http';
5
5
  import { HttpParams, HTTP_INTERCEPTORS, HttpClientModule, HttpErrorResponse, HttpHeaders } from '@angular/common/http';
6
+ import * as i4 from 'ngx-cookie-service';
7
+ import { CookieService } from 'ngx-cookie-service';
6
8
  import { BehaviorSubject, throwError, iif, of } from 'rxjs';
7
9
  import * as i1 from '@angular/platform-browser';
8
10
  import { map, tap, catchError, switchMap } from 'rxjs/operators';
@@ -105,9 +107,9 @@ class EsolveSessionService {
105
107
  }
106
108
  }
107
109
  }
108
- EsolveSessionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveSessionService, deps: [{ token: ESOLVE_CONNECT_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable });
109
- EsolveSessionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveSessionService, providedIn: 'root' });
110
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveSessionService, decorators: [{
110
+ EsolveSessionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveSessionService, deps: [{ token: ESOLVE_CONNECT_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable });
111
+ EsolveSessionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveSessionService, providedIn: 'root' });
112
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveSessionService, decorators: [{
111
113
  type: Injectable,
112
114
  args: [{
113
115
  providedIn: 'root'
@@ -125,7 +127,7 @@ class EsolveAuthInterceptorService {
125
127
  intercept(req, next) {
126
128
  if (req.url.startsWith(`${this.config.api_url}/service/`)) {
127
129
  const service_identifier = req.url.replace(`${this.config.api_url}/service/`, '');
128
- const old_parms_keys = req.params.keys();
130
+ const old_params_keys = req.params.keys();
129
131
  const modified_url = req.url;
130
132
  let params = new HttpParams();
131
133
  const session = this.session.currentSession;
@@ -134,7 +136,7 @@ class EsolveAuthInterceptorService {
134
136
  params = params.set('key', session.key);
135
137
  }
136
138
  }
137
- old_parms_keys.forEach(key => {
139
+ old_params_keys.forEach(key => {
138
140
  params = params.set(key, req.params.get(key) || '');
139
141
  });
140
142
  const modified_req = req.clone({
@@ -146,9 +148,9 @@ class EsolveAuthInterceptorService {
146
148
  return next.handle(req);
147
149
  }
148
150
  }
149
- EsolveAuthInterceptorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveAuthInterceptorService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: EsolveSessionService }], target: i0.ɵɵFactoryTarget.Injectable });
150
- EsolveAuthInterceptorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveAuthInterceptorService });
151
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveAuthInterceptorService, decorators: [{
151
+ EsolveAuthInterceptorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAuthInterceptorService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: EsolveSessionService }], target: i0.ɵɵFactoryTarget.Injectable });
152
+ EsolveAuthInterceptorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAuthInterceptorService });
153
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAuthInterceptorService, decorators: [{
152
154
  type: Injectable
153
155
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
154
156
  type: Inject,
@@ -173,14 +175,14 @@ class NgEsolveConnectModule {
173
175
  };
174
176
  }
175
177
  }
176
- NgEsolveConnectModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: NgEsolveConnectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
177
- NgEsolveConnectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: NgEsolveConnectModule, imports: [CommonModule,
178
+ NgEsolveConnectModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: NgEsolveConnectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
179
+ NgEsolveConnectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: NgEsolveConnectModule, imports: [CommonModule,
178
180
  HttpClientModule] });
179
- NgEsolveConnectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: NgEsolveConnectModule, imports: [[
181
+ NgEsolveConnectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: NgEsolveConnectModule, providers: [CookieService], imports: [[
180
182
  CommonModule,
181
183
  HttpClientModule
182
184
  ]] });
183
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: NgEsolveConnectModule, decorators: [{
185
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: NgEsolveConnectModule, decorators: [{
184
186
  type: NgModule,
185
187
  args: [{
186
188
  declarations: [],
@@ -188,6 +190,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImpor
188
190
  CommonModule,
189
191
  HttpClientModule
190
192
  ],
193
+ providers: [CookieService],
191
194
  exports: []
192
195
  }]
193
196
  }] });
@@ -219,7 +222,7 @@ class EsolveErrorHandlerService {
219
222
  }
220
223
  return error;
221
224
  }
222
- handleHttpError(service_type, errorRes) {
225
+ handleHttpPostError(service_type, errorRes) {
223
226
  if (errorRes instanceof HttpErrorResponse) {
224
227
  if (errorRes.status === 500) {
225
228
  const server_error = errorRes.error;
@@ -233,7 +236,7 @@ class EsolveErrorHandlerService {
233
236
  }
234
237
  else {
235
238
  if (errorRes.type !== undefined) {
236
- if (errorRes.type === 'exception') {
239
+ if ((errorRes.type === 'exception') || (errorRes.type === 'error')) {
237
240
  return throwError(this.parseException(errorRes));
238
241
  }
239
242
  }
@@ -244,9 +247,48 @@ class EsolveErrorHandlerService {
244
247
  return throwError(errorRes);
245
248
  }
246
249
  }
247
- EsolveErrorHandlerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveErrorHandlerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
248
- EsolveErrorHandlerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveErrorHandlerService, providedIn: 'root' });
249
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveErrorHandlerService, decorators: [{
250
+ EsolveErrorHandlerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveErrorHandlerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
251
+ EsolveErrorHandlerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveErrorHandlerService, providedIn: 'root' });
252
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveErrorHandlerService, decorators: [{
253
+ type: Injectable,
254
+ args: [{
255
+ providedIn: 'root'
256
+ }]
257
+ }], ctorParameters: function () { return []; } });
258
+
259
+ class EsolveResponseResult {
260
+ constructor(response) {
261
+ this.success_log = [];
262
+ this.error_log = [];
263
+ this.error_log.push(...response.log.filter(log_item => log_item.type === 'error'));
264
+ this.success_log.push(...response.log.filter(log_item => log_item.type === 'success'));
265
+ }
266
+ }
267
+
268
+ class EsolveResponseHandlerService {
269
+ constructor() { }
270
+ /**
271
+ * Parse single HTTP response
272
+ * @param http_response HTTP Response to eSolve service
273
+ * @param resultHandler Function to parse response to a result
274
+ * @returns Parsed result of response
275
+ */
276
+ validateSingleHttpResponse(http_response, resultHandler) {
277
+ if ((http_response.responses === undefined) ||
278
+ (http_response.responses.length <= 0)) {
279
+ throw http_response;
280
+ }
281
+ const response = http_response.responses[0];
282
+ if ((response.status.state === 'error') ||
283
+ (response.status.state === 'none')) {
284
+ throw response;
285
+ }
286
+ return resultHandler(response);
287
+ }
288
+ }
289
+ EsolveResponseHandlerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveResponseHandlerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
290
+ EsolveResponseHandlerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveResponseHandlerService, providedIn: 'root' });
291
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveResponseHandlerService, decorators: [{
250
292
  type: Injectable,
251
293
  args: [{
252
294
  providedIn: 'root'
@@ -361,9 +403,9 @@ class EsolveSeoService {
361
403
  this.setPageKeywordsTags(seoInfo.keywords);
362
404
  }
363
405
  }
364
- EsolveSeoService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveSeoService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1.Title }, { token: i1.Meta }], target: i0.ɵɵFactoryTarget.Injectable });
365
- EsolveSeoService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveSeoService, providedIn: 'root' });
366
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveSeoService, decorators: [{
406
+ EsolveSeoService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveSeoService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1.Title }, { token: i1.Meta }], target: i0.ɵɵFactoryTarget.Injectable });
407
+ EsolveSeoService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveSeoService, providedIn: 'root' });
408
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveSeoService, decorators: [{
367
409
  type: Injectable,
368
410
  args: [{
369
411
  providedIn: 'root'
@@ -373,36 +415,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImpor
373
415
  args: [ESOLVE_CONNECT_CONFIG]
374
416
  }] }, { type: i1.Title }, { type: i1.Meta }]; } });
375
417
 
376
- class EsolveAddress {
377
- constructor(id, recipient, address_type, pobox, place_name, street_number, street, suburb, city, province, country, postal_code, latitude, longitude) {
378
- this.id = id;
379
- this.recipient = recipient;
380
- this.address_type = address_type;
381
- this.pobox = pobox;
382
- this.place_name = place_name;
383
- this.street_number = street_number;
384
- this.street = street;
385
- this.suburb = suburb;
386
- this.city = city;
387
- this.province = province;
388
- this.country = country;
389
- this.postal_code = postal_code;
390
- this.latitude = latitude;
391
- this.longitude = longitude;
392
- }
393
- }
394
-
395
418
  class EsolveAuthService {
396
- constructor(config, http, session, errorHandler) {
419
+ constructor(config, http, session, errorHandler, cookieService) {
397
420
  this.config = config;
398
421
  this.http = http;
399
422
  this.session = session;
400
423
  this.errorHandler = errorHandler;
424
+ this.cookieService = cookieService;
401
425
  }
402
426
  checkAccessToken(session) {
403
- var _a;
404
427
  session = session || this.session.currentSession;
405
- const token = (_a = session === null || session === void 0 ? void 0 : session.key) !== null && _a !== void 0 ? _a : '';
428
+ const token = session?.key ?? '';
406
429
  const params = new HttpParams({
407
430
  fromObject: {
408
431
  key: token,
@@ -491,14 +514,13 @@ class EsolveAuthService {
491
514
  }
492
515
  throw login_response;
493
516
  }), catchError((errorRes) => {
494
- return this.errorHandler.handleHttpError('set-login', errorRes);
517
+ return this.errorHandler.handleHttpPostError('set-login', errorRes);
495
518
  }));
496
519
  }
497
520
  logout() {
498
521
  this.session.clearTimer();
499
- this.getAccessToken('', '', true).toPromise().then(_ => { }, error => {
500
- console.log(error);
501
- });
522
+ this.cookieService.delete('_ws_id');
523
+ return this.getAccessToken('', '', true).toPromise();
502
524
  }
503
525
  // Handlers
504
526
  handleExpiration() {
@@ -534,9 +556,9 @@ class EsolveAuthService {
534
556
  return throwError(error);
535
557
  }
536
558
  }
537
- EsolveAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveAuthService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }, { token: EsolveSessionService }, { token: EsolveErrorHandlerService }], target: i0.ɵɵFactoryTarget.Injectable });
538
- EsolveAuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveAuthService, providedIn: 'root' });
539
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveAuthService, decorators: [{
559
+ EsolveAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAuthService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }, { token: EsolveSessionService }, { token: EsolveErrorHandlerService }, { token: i4.CookieService }], target: i0.ɵɵFactoryTarget.Injectable });
560
+ EsolveAuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAuthService, providedIn: 'root' });
561
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAuthService, decorators: [{
540
562
  type: Injectable,
541
563
  args: [{
542
564
  providedIn: 'root'
@@ -544,14 +566,91 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImpor
544
566
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
545
567
  type: Inject,
546
568
  args: [ESOLVE_CONNECT_CONFIG]
547
- }] }, { type: i1$1.HttpClient }, { type: EsolveSessionService }, { type: EsolveErrorHandlerService }]; } });
569
+ }] }, { type: i1$1.HttpClient }, { type: EsolveSessionService }, { type: EsolveErrorHandlerService }, { type: i4.CookieService }]; } });
570
+
571
+ class EsolveAddress {
572
+ constructor(id, recipient, address_type, pobox, place_name, street_number, street, suburb, city, province, country, postal_code, latitude, longitude) {
573
+ this.id = id;
574
+ this.recipient = recipient;
575
+ this.address_type = address_type;
576
+ this.pobox = pobox;
577
+ this.place_name = place_name;
578
+ this.street_number = street_number;
579
+ this.street = street;
580
+ this.suburb = suburb;
581
+ this.city = city;
582
+ this.province = province;
583
+ this.country = country;
584
+ this.postal_code = postal_code;
585
+ this.latitude = latitude;
586
+ this.longitude = longitude;
587
+ }
588
+ }
589
+
590
+ class EsolveAddressResult extends EsolveResponseResult {
591
+ constructor(response) {
592
+ super(response);
593
+ this.id = response.esolve_id;
594
+ this.address_validated = response.address_validated;
595
+ this.geocode_status = response.geocode_status;
596
+ this.geocode_result = response.geocode_result;
597
+ }
598
+ }
599
+
600
+ class EsolveUserAccount {
601
+ constructor(esolve_id, email, registration_type, title, first_name, last_name, initials, gender, identification_number) {
602
+ this.esolve_id = esolve_id;
603
+ this.email = email;
604
+ this.registration_type = registration_type;
605
+ this.title = title;
606
+ this.first_name = first_name;
607
+ this.last_name = last_name;
608
+ this.initials = initials;
609
+ this.gender = gender;
610
+ this.identification_number = identification_number;
611
+ }
612
+ }
613
+ class EsolveUserAccountBusiness {
614
+ constructor(name, vat_number, description, type) {
615
+ this.name = name;
616
+ this.vat_number = vat_number;
617
+ this.description = description;
618
+ this.type = type;
619
+ }
620
+ }
621
+ class EsolveUserAccountContact {
622
+ constructor(tel_number, cell_number, fax_number) {
623
+ this.tel_number = tel_number;
624
+ this.cell_number = cell_number;
625
+ this.fax_number = fax_number;
626
+ }
627
+ }
628
+
629
+ class EsolveUserAccountResult extends EsolveResponseResult {
630
+ constructor(response) {
631
+ super(response);
632
+ this.id = 0;
633
+ this.id = +response.esolve_id;
634
+ }
635
+ }
636
+
637
+ class EsolveRegistrationResult extends EsolveResponseResult {
638
+ constructor(response) {
639
+ super(response);
640
+ this.user_id = response.esolve_id;
641
+ this.guest = response.guest;
642
+ this.auto_login = response.auto_login;
643
+ this.authentication_required = response.authentication_required;
644
+ }
645
+ }
548
646
 
549
647
  class EsolveAccountService {
550
- constructor(config, http, sessionService, errorHandler) {
648
+ constructor(config, http, sessionService, errorHandler, responseHandler) {
551
649
  this.config = config;
552
650
  this.http = http;
553
651
  this.sessionService = sessionService;
554
652
  this.errorHandler = errorHandler;
653
+ this.responseHandler = responseHandler;
555
654
  this._user_id = 0;
556
655
  this.sessionService.session.subscribe((session) => {
557
656
  if (session.key !== '') {
@@ -568,29 +667,94 @@ class EsolveAccountService {
568
667
  this._user_id = value;
569
668
  }
570
669
  }
670
+ processUserAccount(record) {
671
+ if (!record) {
672
+ throw new Error('Invalid record');
673
+ }
674
+ if (+record.userid !== this._user_id) {
675
+ throw new Error('Invalid user account retrieved');
676
+ }
677
+ const user_account = new EsolveUserAccount(+record.userid, record.email, record.registration_type, record.title, record.firstname, record.surname, record.initials, record.gender, record.idnumber);
678
+ user_account.contact_details = new EsolveUserAccountContact(record.telnumber, record.cellnumber, record.fax);
679
+ user_account.business_details = new EsolveUserAccountBusiness(record.busname, record.vatnum, record.busdescript, record.business_type);
680
+ return user_account;
681
+ }
571
682
  processUserAddress(records) {
572
683
  const user_addresses = [];
573
- if (records && (this._user_id > 0)) {
574
- for (const record of records) {
575
- if (+record.userid === this._user_id) {
576
- 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));
577
- }
684
+ if (!records || (this._user_id === 0)) {
685
+ return user_addresses;
686
+ }
687
+ for (const record of records) {
688
+ if (+record.userid !== this._user_id) {
689
+ continue;
578
690
  }
691
+ 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));
579
692
  }
580
693
  return user_addresses;
581
694
  }
582
- getAddress() {
583
- let params = new HttpParams();
584
- params = params.set('ws_id', this.config.wsid);
585
- params = params.set('user_id', this.user_id.toString());
586
- return iif(() => (this.user_id > 0), this.http.get(`${this.config.api_url}/service/get-addresses.php`, { params }).pipe(map(response => {
695
+ updateUserAccount(user_account_data) {
696
+ const body = {
697
+ account: user_account_data
698
+ };
699
+ return this.http.post(`${this.config.api_url}/service/set-user-account.php`, body, {
700
+ headers: {
701
+ 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
702
+ },
703
+ params: {
704
+ ws_id: this.config.wsid
705
+ },
706
+ responseType: 'json',
707
+ observe: 'body'
708
+ }).pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => new EsolveUserAccountResult(response))), catchError((errorRes) => {
709
+ return this.errorHandler.handleHttpPostError('set-user-account', errorRes);
710
+ }));
711
+ }
712
+ getUserAccount() {
713
+ return this.http.get(`${this.config.api_url}/service/get-account.php`, {
714
+ params: {
715
+ ws_id: this.config.wsid
716
+ }
717
+ }).pipe(map(response => {
718
+ if ((response.records === undefined) ||
719
+ (response.records.length === 0)) {
720
+ throw response;
721
+ }
722
+ const record = response.records[0];
723
+ return this.processUserAccount(record);
724
+ }));
725
+ }
726
+ setAddress(address_post_data) {
727
+ const body = {
728
+ address: address_post_data
729
+ };
730
+ return this.http.post(`${this.config.api_url}/service/set-address.php`, body, {
731
+ headers: {
732
+ 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
733
+ },
734
+ params: {
735
+ ws_id: this.config.wsid
736
+ },
737
+ responseType: 'json',
738
+ observe: 'body'
739
+ }).pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => new EsolveAddressResult(response))), catchError((errorRes) => {
740
+ return this.errorHandler.handleHttpPostError('set-registration', errorRes);
741
+ }));
742
+ }
743
+ getAddresses() {
744
+ if (this.user_id <= 0) {
745
+ return throwError('Log in is required');
746
+ }
747
+ return this.http.get(`${this.config.api_url}/service/get-addresses.php`, {
748
+ params: {
749
+ ws_id: this.config.wsid,
750
+ user_id: this.user_id
751
+ }
752
+ }).pipe(map(response => {
587
753
  if (response.records === undefined) {
588
754
  throw response;
589
755
  }
590
756
  return this.processUserAddress(response.records);
591
- }), catchError((err) => {
592
- return throwError(err);
593
- })), throwError('Log in is required'));
757
+ }));
594
758
  }
595
759
  register(user_registration) {
596
760
  const body = {
@@ -605,31 +769,19 @@ class EsolveAccountService {
605
769
  },
606
770
  responseType: 'json',
607
771
  observe: 'body'
608
- }).pipe(map(response => {
609
- if ((response.responses === undefined) ||
610
- (response.responses.length <= 0)) {
611
- throw response;
772
+ }).pipe(map(http_response => this.responseHandler.validateSingleHttpResponse(http_response, (response) => {
773
+ if (response.auto_login) {
774
+ this.sessionService.handleUpdateSession(response.esolve_id);
612
775
  }
613
- const registration_response = response.responses[0];
614
- if ((registration_response.status.state !== 'success') &&
615
- (registration_response.status.state !== 'warning')) {
616
- throw registration_response;
617
- }
618
- for (const response_log of registration_response.log) {
619
- if ((response_log.type === 'success') && (response_log.message_code === 'registration_success')) {
620
- this.sessionService.handleUpdateSession(registration_response.esolve_id);
621
- return registration_response.esolve_id;
622
- }
623
- }
624
- throw registration_response;
625
- }), catchError((errorRes) => {
626
- return this.errorHandler.handleHttpError('set-registration', errorRes);
776
+ return new EsolveRegistrationResult(response);
777
+ })), catchError((errorRes) => {
778
+ return this.errorHandler.handleHttpPostError('set-registration', errorRes);
627
779
  }));
628
780
  }
629
781
  }
630
- EsolveAccountService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveAccountService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }, { token: EsolveSessionService }, { token: EsolveErrorHandlerService }], target: i0.ɵɵFactoryTarget.Injectable });
631
- EsolveAccountService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveAccountService, providedIn: 'root' });
632
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveAccountService, decorators: [{
782
+ EsolveAccountService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAccountService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }, { token: EsolveSessionService }, { token: EsolveErrorHandlerService }, { token: EsolveResponseHandlerService }], target: i0.ɵɵFactoryTarget.Injectable });
783
+ EsolveAccountService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAccountService, providedIn: 'root' });
784
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAccountService, decorators: [{
633
785
  type: Injectable,
634
786
  args: [{
635
787
  providedIn: 'root'
@@ -637,7 +789,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImpor
637
789
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
638
790
  type: Inject,
639
791
  args: [ESOLVE_CONNECT_CONFIG]
640
- }] }, { type: i1$1.HttpClient }, { type: EsolveSessionService }, { type: EsolveErrorHandlerService }]; } });
792
+ }] }, { type: i1$1.HttpClient }, { type: EsolveSessionService }, { type: EsolveErrorHandlerService }, { type: EsolveResponseHandlerService }]; } });
641
793
 
642
794
  class EsolveMediaArticle {
643
795
  constructor(identifier, title, article, image_url = '', tags = [], topics = [], seo_title = '', seo_keywords = '', seo_description = '') {
@@ -745,9 +897,9 @@ class EsolveMediaService {
745
897
  }));
746
898
  }
747
899
  }
748
- EsolveMediaService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveMediaService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
749
- EsolveMediaService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveMediaService, providedIn: 'root' });
750
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveMediaService, decorators: [{
900
+ EsolveMediaService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMediaService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
901
+ EsolveMediaService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMediaService, providedIn: 'root' });
902
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMediaService, decorators: [{
751
903
  type: Injectable,
752
904
  args: [{
753
905
  providedIn: 'root'
@@ -887,9 +1039,9 @@ class EsolveNewsService {
887
1039
  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);
888
1040
  }
889
1041
  }
890
- EsolveNewsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveNewsService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
891
- EsolveNewsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveNewsService, providedIn: 'root' });
892
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveNewsService, decorators: [{
1042
+ EsolveNewsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveNewsService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1043
+ EsolveNewsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveNewsService, providedIn: 'root' });
1044
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveNewsService, decorators: [{
893
1045
  type: Injectable,
894
1046
  args: [{
895
1047
  providedIn: 'root'
@@ -1030,9 +1182,9 @@ class EsolveBannerService {
1030
1182
  }));
1031
1183
  }
1032
1184
  }
1033
- EsolveBannerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveBannerService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1034
- EsolveBannerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveBannerService, providedIn: 'root' });
1035
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveBannerService, decorators: [{
1185
+ EsolveBannerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveBannerService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1186
+ EsolveBannerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveBannerService, providedIn: 'root' });
1187
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveBannerService, decorators: [{
1036
1188
  type: Injectable,
1037
1189
  args: [{
1038
1190
  providedIn: 'root'
@@ -1080,9 +1232,9 @@ class EsolveMenuService {
1080
1232
  return menu;
1081
1233
  }
1082
1234
  }
1083
- EsolveMenuService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveMenuService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1084
- EsolveMenuService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveMenuService, providedIn: 'root' });
1085
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveMenuService, decorators: [{
1235
+ EsolveMenuService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMenuService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1236
+ EsolveMenuService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMenuService, providedIn: 'root' });
1237
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMenuService, decorators: [{
1086
1238
  type: Injectable,
1087
1239
  args: [{
1088
1240
  providedIn: 'root'
@@ -1130,9 +1282,9 @@ class EsolveTopicService {
1130
1282
  }));
1131
1283
  }
1132
1284
  }
1133
- EsolveTopicService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveTopicService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1134
- EsolveTopicService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveTopicService, providedIn: 'root' });
1135
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveTopicService, decorators: [{
1285
+ EsolveTopicService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveTopicService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1286
+ EsolveTopicService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveTopicService, providedIn: 'root' });
1287
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveTopicService, decorators: [{
1136
1288
  type: Injectable,
1137
1289
  args: [{
1138
1290
  providedIn: 'root'
@@ -1446,7 +1598,6 @@ class EsolveStockService {
1446
1598
  }
1447
1599
  }
1448
1600
  return this.getStockRecords(params).pipe(map(response => {
1449
- var _a;
1450
1601
  if ((response.records === undefined) || (response.records.length <= 0)) {
1451
1602
  throw response;
1452
1603
  }
@@ -1454,13 +1605,13 @@ class EsolveStockService {
1454
1605
  response.records.forEach(stockRecord => {
1455
1606
  stockItems.push(this.processStockItem(stockRecord));
1456
1607
  });
1457
- return new EsolveStockItemList(stockItems, +response.additional_data.total_records, (_a = options.page) !== null && _a !== void 0 ? _a : 0);
1608
+ return new EsolveStockItemList(stockItems, +response.additional_data.total_records, options.page ?? 0);
1458
1609
  }));
1459
1610
  }
1460
1611
  }
1461
- EsolveStockService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveStockService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1462
- EsolveStockService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveStockService, providedIn: 'root' });
1463
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveStockService, decorators: [{
1612
+ EsolveStockService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveStockService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1613
+ EsolveStockService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveStockService, providedIn: 'root' });
1614
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveStockService, decorators: [{
1464
1615
  type: Injectable,
1465
1616
  args: [{
1466
1617
  providedIn: 'root'
@@ -1623,9 +1774,9 @@ class EsolveCategoryTreeService {
1623
1774
  return throwError('Invalid options');
1624
1775
  }
1625
1776
  }
1626
- EsolveCategoryTreeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveCategoryTreeService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1627
- EsolveCategoryTreeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveCategoryTreeService, providedIn: 'root' });
1628
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveCategoryTreeService, decorators: [{
1777
+ EsolveCategoryTreeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCategoryTreeService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1778
+ EsolveCategoryTreeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCategoryTreeService, providedIn: 'root' });
1779
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCategoryTreeService, decorators: [{
1629
1780
  type: Injectable,
1630
1781
  args: [{
1631
1782
  providedIn: 'root'
@@ -1635,82 +1786,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImpor
1635
1786
  args: [ESOLVE_CONNECT_CONFIG]
1636
1787
  }] }, { type: i1$1.HttpClient }]; } });
1637
1788
 
1638
- class EsolveStockLocation {
1639
- constructor(record) {
1640
- this.id = +record.id;
1641
- this.identifier = record.identifier;
1642
- this.description = record.description;
1643
- this.head_office = record.head_office;
1644
- this.erp_identifier = record.erp_identifier;
1645
- this.external_system_code = record.external_system_code;
1646
- this.default_location_for_payment_methods = record.default_location_for_payment_methods;
1647
- this.userid = +record.userid;
1648
- this.importance = +record.importance;
1649
- this.active = record.is_active;
1650
- this.website_url = record.website_url;
1651
- this.address = new EsolveStockLocationAddress(record.street, record.suburb, record.city, record.province, record.country, record.postal_code, +record.latitude, +record.longitude);
1652
- this.pobox_address = new EsolveStockLocationPOBoxAddress(record.pobox, record.pobox_city, record.pobox_postal_code);
1653
- const telnumbers = [];
1654
- if (record.branch_telnumber.length > 0) {
1655
- telnumbers.push(record.branch_telnumber);
1656
- }
1657
- if (record.branch_telnumber_2.length > 0) {
1658
- telnumbers.push(record.branch_telnumber_2);
1659
- }
1660
- if (record.branch_telnumber_3.length > 0) {
1661
- telnumbers.push(record.branch_telnumber_3);
1662
- }
1663
- this.contact_info = new EsolveStockLocationContactInfo(telnumbers, record.branch_cellnumber, record.branch_email, record.branch_fax);
1664
- this.trading_times = new EsolveStockLocationTradingTimes(record.monday_open_time, record.monday_close_time, record.tuesday_open_time, record.tuesday_close_time, record.wednesday_open_time, record.wednesday_close_time, record.thursday_open_time, record.thursday_close_time, record.friday_open_time, record.friday_close_time, record.saturday_open_time, record.saturday_close_time, record.sunday_open_time, record.sunday_close_time, record.public_holiday_open_time, record.public_holiday_close_time, record.trading_hours_additional_in);
1665
- }
1666
- }
1667
- class EsolveStockLocationAddress {
1668
- constructor(street, suburb, city, province, country, postal_code, latitude, longitude) {
1669
- this.street = street;
1670
- this.suburb = suburb;
1671
- this.city = city;
1672
- this.province = province;
1673
- this.country = country;
1674
- this.postal_code = postal_code;
1675
- this.latitude = latitude;
1676
- this.longitude = longitude;
1677
- }
1678
- }
1679
- class EsolveStockLocationPOBoxAddress {
1680
- constructor(pobox, city, postal_code) {
1681
- this.pobox = pobox;
1682
- this.city = city;
1683
- this.postal_code = postal_code;
1684
- }
1685
- }
1686
- class EsolveStockLocationContactInfo {
1687
- constructor(telnumber, cellnumber, email, fax) {
1688
- this.telnumber = telnumber;
1689
- this.cellnumber = cellnumber;
1690
- this.email = email;
1691
- this.fax = fax;
1692
- }
1693
- }
1694
- class EsolveStockLocationTradingTimes {
1695
- constructor(monday_open_time, monday_close_time, tuesday_open_time, tuesday_close_time, wednesday_open_time, wednesday_close_time, thursday_open_time, thursday_close_time, friday_open_time, friday_close_time, saturday_open_time, saturday_close_time, sunday_open_time, sunday_close_time, public_holiday_open_time, public_holiday_close_time, trading_hours_additional_info = '') {
1696
- this.trading_hours_additional_info = trading_hours_additional_info;
1697
- this.monday = new EsolveStockLocationTradingTimesDay(monday_open_time, monday_close_time);
1698
- this.tuesday = new EsolveStockLocationTradingTimesDay(tuesday_open_time, tuesday_close_time);
1699
- this.wednesday = new EsolveStockLocationTradingTimesDay(wednesday_open_time, wednesday_close_time);
1700
- this.thursday = new EsolveStockLocationTradingTimesDay(thursday_open_time, thursday_close_time);
1701
- this.friday = new EsolveStockLocationTradingTimesDay(friday_open_time, friday_close_time);
1702
- this.saturday = new EsolveStockLocationTradingTimesDay(saturday_open_time, saturday_close_time);
1703
- this.sunday = new EsolveStockLocationTradingTimesDay(sunday_open_time, sunday_close_time);
1704
- this.public_holiday = new EsolveStockLocationTradingTimesDay(public_holiday_open_time, public_holiday_close_time);
1705
- }
1706
- }
1707
- class EsolveStockLocationTradingTimesDay {
1708
- constructor(open, close) {
1709
- this.open = open;
1710
- this.close = close;
1711
- }
1712
- }
1713
-
1714
1789
  class EsolveCartItem {
1715
1790
  constructor(id, stock_item, qty, type, price, discount, discount_interval, vat_rate, allow_quotes, allow_orders, must_collect, requested_assembly, price_incl, discount_price, discount_price_incl, discount_total, vat_total, total, total_incl) {
1716
1791
  this.id = id;
@@ -1735,106 +1810,6 @@ class EsolveCartItem {
1735
1810
  }
1736
1811
  }
1737
1812
 
1738
- class EsolveShippingMethod {
1739
- constructor(id, carrier_name, delivery_category, description, location, pricing, link_to_carrier_website, days_to_deliver, shipping_cost_calculation_method, insurance_cost_calculation_method, insurance_cost_percentage, metric_factor, allow_immediate_payment_processing, allow_postal_address, allow_physical_address, client_to_collect, is_default, location_id, use_zones, min_distance, max_distance, shipping_surge_condition, shipping_surge_percentage, sort_priority, shipping_group, shipping_slot_identifier, shipping_slot_delay_hours, image_url) {
1740
- this.id = id;
1741
- this.carrier_name = carrier_name;
1742
- this.delivery_category = delivery_category;
1743
- this.description = description;
1744
- this.location = location;
1745
- this.pricing = pricing;
1746
- this.link_to_carrier_website = link_to_carrier_website;
1747
- this.days_to_deliver = days_to_deliver;
1748
- this.shipping_cost_calculation_method = shipping_cost_calculation_method;
1749
- this.insurance_cost_calculation_method = insurance_cost_calculation_method;
1750
- this.insurance_cost_percentage = insurance_cost_percentage;
1751
- this.metric_factor = metric_factor;
1752
- this.allow_immediate_payment_processing = allow_immediate_payment_processing;
1753
- this.allow_postal_address = allow_postal_address;
1754
- this.allow_physical_address = allow_physical_address;
1755
- this.client_to_collect = client_to_collect;
1756
- this.is_default = is_default;
1757
- this.location_id = location_id;
1758
- this.use_zones = use_zones;
1759
- this.min_distance = min_distance;
1760
- this.max_distance = max_distance;
1761
- this.shipping_surge_condition = shipping_surge_condition;
1762
- this.shipping_surge_percentage = shipping_surge_percentage;
1763
- this.sort_priority = sort_priority;
1764
- this.shipping_group = shipping_group;
1765
- this.shipping_slot_identifier = shipping_slot_identifier;
1766
- this.shipping_slot_delay_hours = shipping_slot_delay_hours;
1767
- this.image_url = image_url;
1768
- }
1769
- }
1770
-
1771
- class EsolvePaymentMethod {
1772
- constructor(record) {
1773
- this.id = +record.id;
1774
- this.location_id = +record.location_id;
1775
- this.paymethod_name = record.paymethod_name;
1776
- this.description = record.description;
1777
- this.display_banking_details = record.display_banking_details;
1778
- this.currency_code = record.currency_code;
1779
- this.terminal_id = record.terminal_id;
1780
- this.terminal_id_secondary = record.terminal_id_secondary;
1781
- this.merchant_id = record.merchant_id;
1782
- this.application_id = record.application_id;
1783
- this.api_username = record.api_username;
1784
- this.api_password = record.api_password;
1785
- this.api_signature = record.api_signature;
1786
- this.is_gateway = record.is_gateway;
1787
- this.must_store_card_details = record.must_store_card_details;
1788
- this.allow_budget = record.allow_budget;
1789
- this.integration_type = record.integration_type;
1790
- this.bank_gateway_id = record.bank_gateway_id;
1791
- this.accepted_card_types = record.accepted_card_types;
1792
- this.post_transactions_to_gateway = record.post_transactions_to_gateway;
1793
- this.three_d_secure_url = record.three_d_secure_url;
1794
- this.gateway_url = record.gateway_url;
1795
- this.generate_token_url = record.generate_token_url;
1796
- this.widget_url = record.widget_url;
1797
- this.successful_url = record.successful_url;
1798
- this.failed_url = record.failed_url;
1799
- this.enable_callback = record.enable_callback;
1800
- this.live = record.live;
1801
- this.default_module_id = +record.default_module_id;
1802
- this.service_provider = record.service_provider;
1803
- this.on_account = record.on_account;
1804
- this.sort_priority = +record.sort_priority;
1805
- this.image_url = record.image_url;
1806
- this.banking_details = new BankingDetails(record.bank_name, record.account_holder, record.account, record.account_type, record.swift_number, record.branch_code);
1807
- }
1808
- }
1809
- class BankingDetails {
1810
- constructor(bank_name, account_holder, account, account_type, swift_number, branch_code) {
1811
- this.bank_name = bank_name;
1812
- this.account_holder = account_holder;
1813
- this.account = account;
1814
- this.account_type = account_type;
1815
- this.swift_number = swift_number;
1816
- this.branch_code = branch_code;
1817
- }
1818
- }
1819
-
1820
- class EsolveShippingCost {
1821
- constructor(
1822
- // Shipping
1823
- shipping_total = 0, shipping_vat = 0, shipping_total_savings = 0,
1824
- // Insurance
1825
- insurance_total = 0, insurance_vat = 0, insurance_total_savings = 0) {
1826
- this.shipping = new EsolveShippingTotals(shipping_total, shipping_vat, shipping_total_savings);
1827
- this.insurance = new EsolveShippingTotals(insurance_total, insurance_vat, insurance_total_savings);
1828
- }
1829
- }
1830
- class EsolveShippingTotals {
1831
- constructor(total, vat, savings) {
1832
- this.total = total;
1833
- this.vat = vat;
1834
- this.savings = savings;
1835
- }
1836
- }
1837
-
1838
1813
  /**
1839
1814
  * Totals in cart
1840
1815
  */
@@ -1874,6 +1849,14 @@ class EsolveCartTotals {
1874
1849
  }
1875
1850
  }
1876
1851
 
1852
+ class EsolveCheckoutResult extends EsolveResponseResult {
1853
+ constructor(response) {
1854
+ super(response);
1855
+ this.id = 0;
1856
+ this.id = +response.esolve_id;
1857
+ }
1858
+ }
1859
+
1877
1860
  class EsolveCartStockItem {
1878
1861
  constructor(code, name, sef_name, description, active, items_in_pack, delivery_category, image_name) {
1879
1862
  this.code = code;
@@ -1918,10 +1901,11 @@ class EsolveCartStockItem {
1918
1901
  }
1919
1902
 
1920
1903
  class EsolveCartService {
1921
- constructor(config, http, errorHandler) {
1904
+ constructor(config, http, errorHandler, responseHandler) {
1922
1905
  this.config = config;
1923
1906
  this.http = http;
1924
1907
  this.errorHandler = errorHandler;
1908
+ this.responseHandler = responseHandler;
1925
1909
  this._cached_tracking = 0;
1926
1910
  }
1927
1911
  /**
@@ -1939,59 +1923,6 @@ class EsolveCartService {
1939
1923
  }
1940
1924
  return cart_items;
1941
1925
  }
1942
- /**
1943
- * Processes the eSolve stock location records.
1944
- * @param records Records to process
1945
- * @returns An array of processed stock location records
1946
- */
1947
- processStockLocations(records) {
1948
- const stock_locations = [];
1949
- if (records) {
1950
- for (const record of records) {
1951
- stock_locations.push(new EsolveStockLocation(record));
1952
- }
1953
- }
1954
- return stock_locations;
1955
- }
1956
- /**
1957
- * Processes the eSolve shipping method records.
1958
- * @param records Records to process
1959
- * @returns An array of processed shipping methods
1960
- */
1961
- processShippingMethods(records) {
1962
- const shipping_methods = [];
1963
- if (records) {
1964
- for (const record of records) {
1965
- const shipping_method = new EsolveShippingMethod(+record.id, record.carrier_name, record.delivery_category, record.description, record.location, record.pricing, record.link_to_carrier_website, +record.days_to_deliver, record.shipping_cost_calculation_method, record.insurance_cost_calculation_method, +record.insurance_cost_percentage, +record.metric_factor, record.allow_immediate_payment_processing, record.allow_postal_address, record.allow_physical_address, record.client_to_collect, record.is_default_shipping_method, +record.location_id, record.use_zones, +record.min_distance, +record.max_distance, +record.shipping_surge_condition, +record.shipping_surge_percentage, +record.sort_priority, record.shipping_group, record.shipping_slot_identifier, +record.shipping_slot_delay_hours, record.image_url);
1966
- shipping_methods.push(shipping_method);
1967
- }
1968
- }
1969
- return shipping_methods;
1970
- }
1971
- /**
1972
- * Processes the eSolve payment method records.
1973
- * @param records Records to process
1974
- * @returns An array of processed payment methods.
1975
- */
1976
- processPaymentMethods(records) {
1977
- const payment_methods = [];
1978
- if (records) {
1979
- for (const record of records) {
1980
- const payment_method = new EsolvePaymentMethod(record);
1981
- payment_methods.push(payment_method);
1982
- }
1983
- }
1984
- return payment_methods;
1985
- }
1986
- /**
1987
- * Processes the eSolve shipping costs record.
1988
- * @param record Data to process
1989
- * @returns Processed shipping costs
1990
- */
1991
- processShippingCost(record) {
1992
- const shipping_cost = new EsolveShippingCost(+record.shipping_total, +record.vat_on_shipping, +record.total_saving_on_shipping, +record.insurance_total, +record.vat_on_insurance, +record.total_saving_on_insurance);
1993
- return shipping_cost;
1994
- }
1995
1926
  /**
1996
1927
  * Processes the eSolve cart totals
1997
1928
  * @param record Data to process
@@ -2006,9 +1937,11 @@ class EsolveCartService {
2006
1937
  * @returns An `Observable` with an array of cart items
2007
1938
  */
2008
1939
  getCart() {
2009
- let params = new HttpParams();
2010
- params = params.set('ws_id', this.config.wsid);
2011
- return this.http.get(`${this.config.api_url}/service/get-cart.php`, { params }).pipe(map(response => {
1940
+ return this.http.get(`${this.config.api_url}/service/get-cart.php`, {
1941
+ params: {
1942
+ ws_id: this.config.wsid
1943
+ }
1944
+ }).pipe(map(response => {
2012
1945
  if (response.records === undefined) {
2013
1946
  throw response;
2014
1947
  }
@@ -2042,110 +1975,16 @@ class EsolveCartService {
2042
1975
  return response.responses;
2043
1976
  }));
2044
1977
  }
2045
- /**
2046
- * Retrieves a list of stock locations
2047
- * @returns An `Observable` with an array of stock locations
2048
- */
2049
- getStockLocations() {
2050
- let params = new HttpParams();
2051
- params = params.set('ws_id', this.config.wsid);
2052
- return this.http.get(`${this.config.api_url}/service/get-locations.php`, { params }).pipe(map(response => {
2053
- if (response.records === undefined) {
2054
- throw response;
2055
- }
2056
- return this.processStockLocations(response.records);
2057
- }));
2058
- }
2059
- /**
2060
- * Retrieves a list of shipping methods
2061
- * @returns An `Observable` with an array of shipping methods
2062
- */
2063
- getShippingMethods(options) {
2064
- let params = new HttpParams();
2065
- params = params.set('ws_id', this.config.wsid);
2066
- if (options) {
2067
- if (typeof options.addresses_id !== 'undefined') {
2068
- params = params.set('addresses_id', options.addresses_id.toString());
2069
- }
2070
- if (typeof options.location_id !== 'undefined') {
2071
- params = params.set('location_id', options.location_id.toString());
2072
- }
2073
- }
2074
- return this.http.get(`${this.config.api_url}/service/get-shipping-methods.php`, { params }).pipe(map(response => {
2075
- if (response.records === undefined) {
2076
- throw response;
2077
- }
2078
- return this.processShippingMethods(response.records);
2079
- }));
2080
- }
2081
- /**
2082
- * Retrieves a list of payment methods
2083
- * @returns An `Observable` with an array of payment methods
2084
- */
2085
- getPaymentMethods(options) {
2086
- let params = new HttpParams();
2087
- params = params.set('ws_id', this.config.wsid);
2088
- if (options) {
2089
- if (typeof options.live !== 'undefined') {
2090
- params = params.set('live', options.live.toString());
2091
- }
2092
- if (typeof options.location_id !== 'undefined') {
2093
- params = params.set('location_id', options.location_id.toString());
2094
- }
2095
- if (typeof options.is_gateway !== 'undefined') {
2096
- params = params.set('is_gateway', options.is_gateway.toString());
2097
- }
2098
- }
2099
- return this.http.get(`${this.config.api_url}/service/get-payment-methods.php`, { params }).pipe(map(response => {
2100
- if (response.records === undefined) {
2101
- throw response;
2102
- }
2103
- return this.processPaymentMethods(response.records);
2104
- }));
2105
- }
2106
- /**
2107
- * Retrieves the shipping costs
2108
- * @param options Shipping cost options
2109
- * @returns An `Observable` with the shipping costs
2110
- */
2111
- getShippingCost(options) {
2112
- let params = new HttpParams();
2113
- params = params.set('ws_id', this.config.wsid);
2114
- if (options) {
2115
- if (typeof options.addresses_id !== 'undefined') {
2116
- params = params.set('addresses_id', options.addresses_id.toString());
2117
- }
2118
- else {
2119
- return throwError(new Error('Address ID is required'));
2120
- }
2121
- if (typeof options.shipping_id !== 'undefined') {
2122
- params = params.set('shipping_id', options.shipping_id.toString());
2123
- }
2124
- else {
2125
- return throwError(new Error('Shipping ID is required'));
2126
- }
2127
- if (typeof options.location_id !== 'undefined') {
2128
- params = params.set('location_id', options.location_id.toString());
2129
- }
2130
- }
2131
- else {
2132
- return throwError(new Error('Options are invalid'));
2133
- }
2134
- return this.http.get(`${this.config.api_url}/service/get-shipping-cost.php`, { params }).pipe(map(response => {
2135
- if (response.records === undefined) {
2136
- throw response;
2137
- }
2138
- return this.processShippingCost(response.records[0]);
2139
- }));
2140
- }
2141
1978
  /**
2142
1979
  * Retrieves the totals of the cart with all the totals calculated
2143
1980
  * @returns An `Observable` with an object containing cart totals
2144
1981
  */
2145
1982
  getTotals() {
2146
- let params = new HttpParams();
2147
- params = params.set('ws_id', this.config.wsid);
2148
- return this.http.get(`${this.config.api_url}/service/get-cart-totals.php`, { params }).pipe(map(response => {
1983
+ return this.http.get(`${this.config.api_url}/service/get-cart-totals.php`, {
1984
+ params: {
1985
+ ws_id: this.config.wsid
1986
+ }
1987
+ }).pipe(map(response => {
2149
1988
  if (response.records === undefined) {
2150
1989
  throw response;
2151
1990
  }
@@ -2157,9 +1996,11 @@ class EsolveCartService {
2157
1996
  * @returns An `Observable` with the cart tracking code
2158
1997
  */
2159
1998
  getTrackingCode() {
2160
- let params = new HttpParams();
2161
- params = params.set('ws_id', this.config.wsid);
2162
- return iif(() => this._cached_tracking > 0, of(this._cached_tracking), this.http.get(`${this.config.api_url}/service/get-checkout-tracking.php`, { params }).pipe(map(response => {
1999
+ return iif(() => this._cached_tracking > 0, of(this._cached_tracking), this.http.get(`${this.config.api_url}/service/get-checkout-tracking.php`, {
2000
+ params: {
2001
+ ws_id: this.config.wsid
2002
+ }
2003
+ }).pipe(map(response => {
2163
2004
  if (response.records === undefined) {
2164
2005
  throw response;
2165
2006
  }
@@ -2201,24 +2042,15 @@ class EsolveCartService {
2201
2042
  },
2202
2043
  responseType: 'json',
2203
2044
  observe: 'body'
2204
- }).pipe(map(response => {
2205
- if ((response.responses === undefined) || (response.responses.length <= 0)) {
2206
- throw response;
2207
- }
2208
- const checkout_result = response.responses[0];
2209
- if (checkout_result.status.state !== 'success') {
2210
- throw checkout_result;
2211
- }
2212
- return checkout_result.esolve_id;
2213
- }), catchError((errorRes) => {
2214
- return this.errorHandler.handleHttpError('set-checkout', errorRes);
2045
+ }).pipe(map(http_response => this.responseHandler.validateSingleHttpResponse(http_response, (response) => new EsolveCheckoutResult(response))), catchError((errorRes) => {
2046
+ return this.errorHandler.handleHttpPostError('set-checkout', errorRes);
2215
2047
  }));
2216
2048
  }));
2217
2049
  }
2218
2050
  }
2219
- EsolveCartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveCartService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }, { token: EsolveErrorHandlerService }], target: i0.ɵɵFactoryTarget.Injectable });
2220
- EsolveCartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveCartService, providedIn: 'root' });
2221
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: EsolveCartService, decorators: [{
2051
+ EsolveCartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCartService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }, { token: EsolveErrorHandlerService }, { token: EsolveResponseHandlerService }], target: i0.ɵɵFactoryTarget.Injectable });
2052
+ EsolveCartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCartService, providedIn: 'root' });
2053
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCartService, decorators: [{
2222
2054
  type: Injectable,
2223
2055
  args: [{
2224
2056
  providedIn: 'root'
@@ -2226,7 +2058,553 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImpor
2226
2058
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
2227
2059
  type: Inject,
2228
2060
  args: [ESOLVE_CONNECT_CONFIG]
2229
- }] }, { type: i1$1.HttpClient }, { type: EsolveErrorHandlerService }]; } });
2061
+ }] }, { type: i1$1.HttpClient }, { type: EsolveErrorHandlerService }, { type: EsolveResponseHandlerService }]; } });
2062
+
2063
+ class EsolveVaultItemResult extends EsolveResponseResult {
2064
+ constructor(response) {
2065
+ super(response);
2066
+ this.id = +response.esolve_id;
2067
+ if (typeof response.token !== 'undefined') {
2068
+ this.token = response.token;
2069
+ }
2070
+ if (typeof response.card_valid !== 'undefined') {
2071
+ this.card_valid = response.card_valid;
2072
+ }
2073
+ if (typeof response.card_details_validated !== 'undefined') {
2074
+ this.card_details_validated = response.card_details_validated;
2075
+ }
2076
+ if (typeof response.gateway_error_message !== 'undefined') {
2077
+ this.gateway_error_message = response.gateway_error_message;
2078
+ }
2079
+ }
2080
+ }
2081
+
2082
+ class EsolveVaultItem {
2083
+ constructor(id, last4, brand, expiry_timestamp) {
2084
+ this.id = id;
2085
+ this.last4 = last4;
2086
+ this.brand = brand;
2087
+ this.expiry = new Date(expiry_timestamp * 1000);
2088
+ }
2089
+ get expiry_month() {
2090
+ const month = this.expiry.getMonth() + 1;
2091
+ return month.toString().padStart(2, '0');
2092
+ }
2093
+ get expiry_year() {
2094
+ return this.expiry.getFullYear();
2095
+ }
2096
+ get masked_number() {
2097
+ return this.last4.padStart(19, '**** ');
2098
+ }
2099
+ }
2100
+
2101
+ class EsolvePaymentResult extends EsolveResponseResult {
2102
+ constructor(response) {
2103
+ super(response);
2104
+ if (typeof response.gateway_error_message !== 'undefined') {
2105
+ this.gateway_error_message = response.gateway_error_message;
2106
+ }
2107
+ if (typeof response.three_d_secure !== 'undefined') {
2108
+ this.three_d_secure = response.three_d_secure;
2109
+ }
2110
+ if (typeof response.redirect_url !== 'undefined') {
2111
+ this.redirect_url = response.redirect_url;
2112
+ }
2113
+ if (typeof response.form_inputs !== 'undefined') {
2114
+ this.form_inputs = response.form_inputs;
2115
+ }
2116
+ if (typeof response.form_html !== 'undefined') {
2117
+ this.form_html = response.form_html;
2118
+ }
2119
+ }
2120
+ }
2121
+
2122
+ class EsolvePaymentMethod {
2123
+ constructor(record) {
2124
+ this.id = +record.id;
2125
+ this.location_id = +record.location_id;
2126
+ this.paymethod_name = record.paymethod_name;
2127
+ this.description = record.description;
2128
+ this.display_banking_details = record.display_banking_details;
2129
+ this.currency_code = record.currency_code;
2130
+ this.terminal_id = record.terminal_id;
2131
+ this.terminal_id_secondary = record.terminal_id_secondary;
2132
+ this.merchant_id = record.merchant_id;
2133
+ this.application_id = record.application_id;
2134
+ this.api_username = record.api_username;
2135
+ this.api_password = record.api_password;
2136
+ this.api_signature = record.api_signature;
2137
+ this.is_gateway = record.is_gateway;
2138
+ this.must_store_card_details = record.must_store_card_details;
2139
+ this.allow_budget = record.allow_budget;
2140
+ this.integration_type = record.integration_type;
2141
+ this.bank_gateway_id = record.bank_gateway_id;
2142
+ this.accepted_card_types = record.accepted_card_types;
2143
+ this.post_transactions_to_gateway = record.post_transactions_to_gateway;
2144
+ this.three_d_secure_url = record.three_d_secure_url;
2145
+ this.gateway_url = record.gateway_url;
2146
+ this.generate_token_url = record.generate_token_url;
2147
+ this.widget_url = record.widget_url;
2148
+ this.successful_url = record.successful_url;
2149
+ this.failed_url = record.failed_url;
2150
+ this.enable_callback = record.enable_callback;
2151
+ this.live = record.live;
2152
+ this.default_module_id = +record.default_module_id;
2153
+ this.service_provider = record.service_provider;
2154
+ this.on_account = record.on_account;
2155
+ this.sort_priority = +record.sort_priority;
2156
+ this.image_url = record.image_url;
2157
+ this.banking_details = new EsolveBankingDetails(record.bank_name, record.account_holder, record.account, record.account_type, record.swift_number, record.branch_code);
2158
+ }
2159
+ }
2160
+ class EsolveBankingDetails {
2161
+ constructor(bank_name, account_holder, account, account_type, swift_number, branch_code) {
2162
+ this.bank_name = bank_name;
2163
+ this.account_holder = account_holder;
2164
+ this.account = account;
2165
+ this.account_type = account_type;
2166
+ this.swift_number = swift_number;
2167
+ this.branch_code = branch_code;
2168
+ }
2169
+ }
2170
+
2171
+ class EsolvePaymentService {
2172
+ constructor(config, http, errorHandler, responseHandler) {
2173
+ this.config = config;
2174
+ this.http = http;
2175
+ this.errorHandler = errorHandler;
2176
+ this.responseHandler = responseHandler;
2177
+ }
2178
+ /**
2179
+ * Processes the eSolve payment method records.
2180
+ * @param records Records to process
2181
+ * @returns An array of processed payment methods.
2182
+ */
2183
+ processPaymentMethods(records) {
2184
+ const payment_methods = [];
2185
+ if (records) {
2186
+ for (const record of records) {
2187
+ const payment_method = new EsolvePaymentMethod(record);
2188
+ payment_methods.push(payment_method);
2189
+ }
2190
+ }
2191
+ return payment_methods;
2192
+ }
2193
+ /**
2194
+ * Processes the eSolve vault records.
2195
+ * @param records Records to process
2196
+ * @returns An array of processed vault items (a.k.a. cards)
2197
+ */
2198
+ processVaultItems(records) {
2199
+ const vault = [];
2200
+ if (records) {
2201
+ for (const record of records) {
2202
+ const vault_item = new EsolveVaultItem(+record.id, record.last4, record.brand, record.expiry_timestamp);
2203
+ vault.push(vault_item);
2204
+ }
2205
+ }
2206
+ return vault;
2207
+ }
2208
+ generateExpiry(card_data) {
2209
+ const month_string = card_data.expiry_month.padStart(2, '0');
2210
+ const year_string = card_data.expiry_year.padStart(4, '0');
2211
+ return `${month_string}${year_string}`;
2212
+ }
2213
+ /**
2214
+ * Retrieves a list of payment methods.
2215
+ * @param options Filter options
2216
+ * @returns An `Observable` with an array of payment methods
2217
+ */
2218
+ getPaymentMethods(options) {
2219
+ let params = new HttpParams();
2220
+ params = params.set('ws_id', this.config.wsid);
2221
+ if (options) {
2222
+ if (typeof options.live !== 'undefined') {
2223
+ params = params.set('live', options.live);
2224
+ }
2225
+ if (typeof options.location_id !== 'undefined') {
2226
+ params = params.set('location_id', options.location_id);
2227
+ }
2228
+ if (typeof options.is_gateway !== 'undefined') {
2229
+ params = params.set('is_gateway', options.is_gateway);
2230
+ }
2231
+ }
2232
+ return this.http.get(`${this.config.api_url}/service/get-payment-methods.php`, { params }).pipe(map(response => {
2233
+ if (response.records === undefined) {
2234
+ throw response;
2235
+ }
2236
+ return this.processPaymentMethods(response.records);
2237
+ }));
2238
+ }
2239
+ /**
2240
+ * Retrieves a list of saved cards from the vault.
2241
+ * @param payment_methods_id eSolve ID of a payment method
2242
+ * @returns An `Observable` with an array of saved bank cards
2243
+ */
2244
+ getVault(payment_methods_id) {
2245
+ let params = new HttpParams();
2246
+ params = params.set('ws_id', this.config.wsid);
2247
+ if (typeof payment_methods_id !== 'undefined') {
2248
+ params = params.set('payment_methods_id', payment_methods_id);
2249
+ }
2250
+ return this.http.get(`${this.config.api_url}/service/get-vault.php`, { params }).pipe(map(response => {
2251
+ if (response.records === undefined) {
2252
+ throw response;
2253
+ }
2254
+ return this.processVaultItems(response.records);
2255
+ }));
2256
+ }
2257
+ /**
2258
+ * Sets a new card in the vault OR updates an existing one.
2259
+ * @param payment_methods_id Selected payment method
2260
+ * @param card_data Information of bank card
2261
+ * @returns An `Observable` with the result of the vault set.
2262
+ */
2263
+ setVaultItem(payment_methods_id, card_data) {
2264
+ const body = {
2265
+ vault: {
2266
+ payment_methods_id,
2267
+ card_number: card_data.card_number,
2268
+ card_name: card_data.name,
2269
+ card_cvv: card_data.cvv,
2270
+ card_expiry: this.generateExpiry(card_data)
2271
+ }
2272
+ };
2273
+ return this.http.post(`${this.config.api_url}/service/set-vault.php`, body, {
2274
+ headers: {
2275
+ 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
2276
+ },
2277
+ params: {
2278
+ ws_id: this.config.wsid
2279
+ },
2280
+ responseType: 'json',
2281
+ observe: 'body'
2282
+ }).pipe(map(http_response => this.responseHandler.validateSingleHttpResponse(http_response, (response) => new EsolveVaultItemResult(response))), catchError((errorRes) => {
2283
+ return this.errorHandler.handleHttpPostError('set-vault', errorRes);
2284
+ }));
2285
+ }
2286
+ /**
2287
+ * Sets the payment for the specified transaction using selected payment method.
2288
+ * @param transaction_id eSolve ID to the transaction
2289
+ * @param payment_methods_id eSolve ID to the selected payment method
2290
+ * @param card ID of selected card from the vault or information to a brand new card
2291
+ * @returns An `Observable` with the result of the payment
2292
+ */
2293
+ setPayment(transaction_id, payment_methods_id, card) {
2294
+ const body = {
2295
+ payment: {
2296
+ cart_id: transaction_id,
2297
+ payment_methods_id
2298
+ }
2299
+ };
2300
+ if (typeof card === 'number') {
2301
+ body.payment.user_vault_id = card;
2302
+ }
2303
+ else {
2304
+ body.card = {
2305
+ card_number: card.card_number,
2306
+ card_name: card.name,
2307
+ card_cvv: card.cvv,
2308
+ card_expiry: this.generateExpiry(card)
2309
+ };
2310
+ }
2311
+ return this.http.post(`${this.config.api_url}/service/set-payment.php`, body, {
2312
+ headers: {
2313
+ 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
2314
+ },
2315
+ params: {
2316
+ ws_id: this.config.wsid
2317
+ },
2318
+ responseType: 'json',
2319
+ observe: 'body'
2320
+ }).pipe(map(http_response => this.responseHandler.validateSingleHttpResponse(http_response, (response) => new EsolvePaymentResult(response))), catchError((errorRes) => {
2321
+ return this.errorHandler.handleHttpPostError('set-payment', errorRes);
2322
+ }));
2323
+ }
2324
+ }
2325
+ EsolvePaymentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolvePaymentService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }, { token: EsolveErrorHandlerService }, { token: EsolveResponseHandlerService }], target: i0.ɵɵFactoryTarget.Injectable });
2326
+ EsolvePaymentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolvePaymentService, providedIn: 'root' });
2327
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolvePaymentService, decorators: [{
2328
+ type: Injectable,
2329
+ args: [{
2330
+ providedIn: 'root'
2331
+ }]
2332
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
2333
+ type: Inject,
2334
+ args: [ESOLVE_CONNECT_CONFIG]
2335
+ }] }, { type: i1$1.HttpClient }, { type: EsolveErrorHandlerService }, { type: EsolveResponseHandlerService }]; } });
2336
+
2337
+ class EsolveShippingMethod {
2338
+ constructor(id, carrier_name, delivery_category, description, location, pricing, link_to_carrier_website, days_to_deliver, shipping_cost_calculation_method, insurance_cost_calculation_method, insurance_cost_percentage, metric_factor, allow_immediate_payment_processing, allow_postal_address, allow_physical_address, client_to_collect, is_default, location_id, use_zones, min_distance, max_distance, shipping_surge_condition, shipping_surge_percentage, sort_priority, shipping_group, shipping_slot_identifier, shipping_slot_delay_hours, image_url) {
2339
+ this.id = id;
2340
+ this.carrier_name = carrier_name;
2341
+ this.delivery_category = delivery_category;
2342
+ this.description = description;
2343
+ this.location = location;
2344
+ this.pricing = pricing;
2345
+ this.link_to_carrier_website = link_to_carrier_website;
2346
+ this.days_to_deliver = days_to_deliver;
2347
+ this.shipping_cost_calculation_method = shipping_cost_calculation_method;
2348
+ this.insurance_cost_calculation_method = insurance_cost_calculation_method;
2349
+ this.insurance_cost_percentage = insurance_cost_percentage;
2350
+ this.metric_factor = metric_factor;
2351
+ this.allow_immediate_payment_processing = allow_immediate_payment_processing;
2352
+ this.allow_postal_address = allow_postal_address;
2353
+ this.allow_physical_address = allow_physical_address;
2354
+ this.client_to_collect = client_to_collect;
2355
+ this.is_default = is_default;
2356
+ this.location_id = location_id;
2357
+ this.use_zones = use_zones;
2358
+ this.min_distance = min_distance;
2359
+ this.max_distance = max_distance;
2360
+ this.shipping_surge_condition = shipping_surge_condition;
2361
+ this.shipping_surge_percentage = shipping_surge_percentage;
2362
+ this.sort_priority = sort_priority;
2363
+ this.shipping_group = shipping_group;
2364
+ this.shipping_slot_identifier = shipping_slot_identifier;
2365
+ this.shipping_slot_delay_hours = shipping_slot_delay_hours;
2366
+ this.image_url = image_url;
2367
+ }
2368
+ }
2369
+
2370
+ class EsolveShippingCost {
2371
+ constructor(
2372
+ // Shipping
2373
+ shipping_total = 0, shipping_vat = 0, shipping_total_savings = 0,
2374
+ // Insurance
2375
+ insurance_total = 0, insurance_vat = 0, insurance_total_savings = 0) {
2376
+ this.shipping = new EsolveShippingTotals(shipping_total, shipping_vat, shipping_total_savings);
2377
+ this.insurance = new EsolveShippingTotals(insurance_total, insurance_vat, insurance_total_savings);
2378
+ }
2379
+ }
2380
+ class EsolveShippingTotals {
2381
+ constructor(total, vat, savings) {
2382
+ this.total = total;
2383
+ this.vat = vat;
2384
+ this.savings = savings;
2385
+ }
2386
+ }
2387
+
2388
+ class EsolveShippingService {
2389
+ constructor(config, http) {
2390
+ this.config = config;
2391
+ this.http = http;
2392
+ }
2393
+ /**
2394
+ * Processes the eSolve shipping method records.
2395
+ * @param records Records to process
2396
+ * @returns An array of processed shipping methods
2397
+ */
2398
+ processShippingMethods(records) {
2399
+ const shipping_methods = [];
2400
+ if (records) {
2401
+ for (const record of records) {
2402
+ const shipping_method = new EsolveShippingMethod(+record.id, record.carrier_name, record.delivery_category, record.description, record.location, record.pricing, record.link_to_carrier_website, +record.days_to_deliver, record.shipping_cost_calculation_method, record.insurance_cost_calculation_method, +record.insurance_cost_percentage, +record.metric_factor, record.allow_immediate_payment_processing, record.allow_postal_address, record.allow_physical_address, record.client_to_collect, record.is_default_shipping_method, +record.location_id, record.use_zones, +record.min_distance, +record.max_distance, +record.shipping_surge_condition, +record.shipping_surge_percentage, +record.sort_priority, record.shipping_group, record.shipping_slot_identifier, +record.shipping_slot_delay_hours, record.image_url);
2403
+ shipping_methods.push(shipping_method);
2404
+ }
2405
+ }
2406
+ return shipping_methods;
2407
+ }
2408
+ /**
2409
+ * Processes the eSolve shipping costs record.
2410
+ * @param record Data to process
2411
+ * @returns Processed shipping costs
2412
+ */
2413
+ processShippingCost(record) {
2414
+ const shipping_cost = new EsolveShippingCost(+record.shipping_total, +record.vat_on_shipping, +record.total_saving_on_shipping, +record.insurance_total, +record.vat_on_insurance, +record.total_saving_on_insurance);
2415
+ return shipping_cost;
2416
+ }
2417
+ /**
2418
+ * Retrieves a list of shipping methods
2419
+ * @returns An `Observable` with an array of shipping methods
2420
+ */
2421
+ getShippingMethods(options) {
2422
+ let params = new HttpParams();
2423
+ params = params.set('ws_id', this.config.wsid);
2424
+ if (options) {
2425
+ if (typeof options.addresses_id !== 'undefined') {
2426
+ params = params.set('addresses_id', options.addresses_id);
2427
+ }
2428
+ if (typeof options.location_id !== 'undefined') {
2429
+ params = params.set('location_id', options.location_id);
2430
+ }
2431
+ }
2432
+ return this.http.get(`${this.config.api_url}/service/get-shipping-methods.php`, { params }).pipe(map(response => {
2433
+ if (response.records === undefined) {
2434
+ throw response;
2435
+ }
2436
+ return this.processShippingMethods(response.records);
2437
+ }));
2438
+ }
2439
+ /**
2440
+ * Retrieves the shipping costs
2441
+ * @param options Shipping cost options
2442
+ * @returns An `Observable` with the shipping costs
2443
+ */
2444
+ getShippingCost(shipping_id, addresses_id, location_id) {
2445
+ try {
2446
+ let params = new HttpParams();
2447
+ params = params.set('ws_id', this.config.wsid);
2448
+ if (typeof shipping_id !== 'undefined') {
2449
+ params = params.set('shipping_id', shipping_id);
2450
+ }
2451
+ else {
2452
+ throw new Error('Shipping ID is required');
2453
+ }
2454
+ if (typeof addresses_id !== 'undefined') {
2455
+ params = params.set('addresses_id', addresses_id);
2456
+ }
2457
+ else {
2458
+ throw new Error('Address ID is required');
2459
+ }
2460
+ if (typeof location_id !== 'undefined') {
2461
+ params = params.set('location_id', location_id);
2462
+ }
2463
+ return this.http.get(`${this.config.api_url}/service/get-shipping-cost.php`, { params }).pipe(map(response => {
2464
+ if (response.records === undefined) {
2465
+ throw response;
2466
+ }
2467
+ return this.processShippingCost(response.records[0]);
2468
+ }));
2469
+ }
2470
+ catch (err) {
2471
+ return throwError(err);
2472
+ }
2473
+ }
2474
+ }
2475
+ EsolveShippingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveShippingService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
2476
+ EsolveShippingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveShippingService, providedIn: 'root' });
2477
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveShippingService, decorators: [{
2478
+ type: Injectable,
2479
+ args: [{
2480
+ providedIn: 'root'
2481
+ }]
2482
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
2483
+ type: Inject,
2484
+ args: [ESOLVE_CONNECT_CONFIG]
2485
+ }] }, { type: i1$1.HttpClient }]; } });
2486
+
2487
+ class EsolveStockLocation {
2488
+ constructor(record) {
2489
+ this.id = +record.id;
2490
+ this.identifier = record.identifier;
2491
+ this.description = record.description;
2492
+ this.head_office = record.head_office;
2493
+ this.erp_identifier = record.erp_identifier;
2494
+ this.external_system_code = record.external_system_code;
2495
+ this.default_location_for_payment_methods = record.default_location_for_payment_methods;
2496
+ this.userid = +record.userid;
2497
+ this.importance = +record.importance;
2498
+ this.active = record.is_active;
2499
+ this.website_url = record.website_url;
2500
+ this.address = new EsolveStockLocationAddress(record.street, record.suburb, record.city, record.province, record.country, record.postal_code, +record.latitude, +record.longitude);
2501
+ this.pobox_address = new EsolveStockLocationPOBoxAddress(record.pobox, record.pobox_city, record.pobox_postal_code);
2502
+ const telnumbers = [];
2503
+ if (record.branch_telnumber.length > 0) {
2504
+ telnumbers.push(record.branch_telnumber);
2505
+ }
2506
+ if (record.branch_telnumber_2.length > 0) {
2507
+ telnumbers.push(record.branch_telnumber_2);
2508
+ }
2509
+ if (record.branch_telnumber_3.length > 0) {
2510
+ telnumbers.push(record.branch_telnumber_3);
2511
+ }
2512
+ this.contact_info = new EsolveStockLocationContactInfo(telnumbers, record.branch_cellnumber, record.branch_email, record.branch_fax);
2513
+ this.trading_times = new EsolveStockLocationTradingTimes(record.monday_open_time, record.monday_close_time, record.tuesday_open_time, record.tuesday_close_time, record.wednesday_open_time, record.wednesday_close_time, record.thursday_open_time, record.thursday_close_time, record.friday_open_time, record.friday_close_time, record.saturday_open_time, record.saturday_close_time, record.sunday_open_time, record.sunday_close_time, record.public_holiday_open_time, record.public_holiday_close_time, record.trading_hours_additional_in);
2514
+ }
2515
+ }
2516
+ class EsolveStockLocationAddress {
2517
+ constructor(street, suburb, city, province, country, postal_code, latitude, longitude) {
2518
+ this.street = street;
2519
+ this.suburb = suburb;
2520
+ this.city = city;
2521
+ this.province = province;
2522
+ this.country = country;
2523
+ this.postal_code = postal_code;
2524
+ this.latitude = latitude;
2525
+ this.longitude = longitude;
2526
+ }
2527
+ }
2528
+ class EsolveStockLocationPOBoxAddress {
2529
+ constructor(pobox, city, postal_code) {
2530
+ this.pobox = pobox;
2531
+ this.city = city;
2532
+ this.postal_code = postal_code;
2533
+ }
2534
+ }
2535
+ class EsolveStockLocationContactInfo {
2536
+ constructor(telnumber, cellnumber, email, fax) {
2537
+ this.telnumber = telnumber;
2538
+ this.cellnumber = cellnumber;
2539
+ this.email = email;
2540
+ this.fax = fax;
2541
+ }
2542
+ }
2543
+ class EsolveStockLocationTradingTimes {
2544
+ constructor(monday_open_time, monday_close_time, tuesday_open_time, tuesday_close_time, wednesday_open_time, wednesday_close_time, thursday_open_time, thursday_close_time, friday_open_time, friday_close_time, saturday_open_time, saturday_close_time, sunday_open_time, sunday_close_time, public_holiday_open_time, public_holiday_close_time, trading_hours_additional_info = '') {
2545
+ this.trading_hours_additional_info = trading_hours_additional_info;
2546
+ this.monday = new EsolveStockLocationTradingTimesDay(monday_open_time, monday_close_time);
2547
+ this.tuesday = new EsolveStockLocationTradingTimesDay(tuesday_open_time, tuesday_close_time);
2548
+ this.wednesday = new EsolveStockLocationTradingTimesDay(wednesday_open_time, wednesday_close_time);
2549
+ this.thursday = new EsolveStockLocationTradingTimesDay(thursday_open_time, thursday_close_time);
2550
+ this.friday = new EsolveStockLocationTradingTimesDay(friday_open_time, friday_close_time);
2551
+ this.saturday = new EsolveStockLocationTradingTimesDay(saturday_open_time, saturday_close_time);
2552
+ this.sunday = new EsolveStockLocationTradingTimesDay(sunday_open_time, sunday_close_time);
2553
+ this.public_holiday = new EsolveStockLocationTradingTimesDay(public_holiday_open_time, public_holiday_close_time);
2554
+ }
2555
+ }
2556
+ class EsolveStockLocationTradingTimesDay {
2557
+ constructor(open, close) {
2558
+ this.open = open;
2559
+ this.close = close;
2560
+ }
2561
+ }
2562
+
2563
+ class EsolveLocationsService {
2564
+ constructor(config, http) {
2565
+ this.config = config;
2566
+ this.http = http;
2567
+ }
2568
+ /**
2569
+ * Processes the eSolve stock location records.
2570
+ * @param records Records to process
2571
+ * @returns An array of processed stock location records
2572
+ */
2573
+ processStockLocations(records) {
2574
+ const stock_locations = [];
2575
+ if (records) {
2576
+ for (const record of records) {
2577
+ stock_locations.push(new EsolveStockLocation(record));
2578
+ }
2579
+ }
2580
+ return stock_locations;
2581
+ }
2582
+ /**
2583
+ * Retrieves a list of stock locations
2584
+ * @returns An `Observable` with an array of stock locations
2585
+ */
2586
+ getStockLocations() {
2587
+ let params = new HttpParams();
2588
+ params = params.set('ws_id', this.config.wsid);
2589
+ return this.http.get(`${this.config.api_url}/service/get-locations.php`, { params }).pipe(map(response => {
2590
+ if (response.records === undefined) {
2591
+ throw response;
2592
+ }
2593
+ return this.processStockLocations(response.records);
2594
+ }));
2595
+ }
2596
+ }
2597
+ EsolveLocationsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveLocationsService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
2598
+ EsolveLocationsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveLocationsService, providedIn: 'root' });
2599
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveLocationsService, decorators: [{
2600
+ type: Injectable,
2601
+ args: [{
2602
+ providedIn: 'root'
2603
+ }]
2604
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
2605
+ type: Inject,
2606
+ args: [ESOLVE_CONNECT_CONFIG]
2607
+ }] }, { type: i1$1.HttpClient }]; } });
2230
2608
 
2231
2609
  /*
2232
2610
  * Public API Surface of ng-esolve-connect
@@ -2236,5 +2614,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImpor
2236
2614
  * Generated bundle index. Do not edit.
2237
2615
  */
2238
2616
 
2239
- export { BankingDetails, EsolveAccountService, EsolveAddress, EsolveAuthService, EsolveBanner, EsolveBannerImage, EsolveBannerImageHotspot, EsolveBannerService, EsolveCartItem, EsolveCartService, EsolveCartTotals, EsolveCategoryTreeItem, EsolveCategoryTreeService, EsolveErrorHandlerService, EsolveHttpError, EsolveMediaArticle, EsolveMediaService, EsolveMenuItem, EsolveMenuService, EsolveNewsArticle, EsolveNewsArticleAuthor, EsolveNewsArticleList, EsolveNewsGroup, EsolveNewsService, EsolvePaymentMethod, EsolveSEOInfo, EsolveSeoService, EsolveSession, EsolveSessionService, EsolveShippingCost, EsolveShippingMethod, EsolveStockBadge, EsolveStockItem, EsolveStockItemList, EsolveStockLocation, EsolveStockPrice, EsolveStockService, EsolveTag, EsolveTopic, EsolveTopicService, NgEsolveConnectModule };
2240
- //# sourceMappingURL=esolve-ng-esolve-connect.js.map
2617
+ export { EsolveAccountService, EsolveAddress, EsolveAddressResult, EsolveAuthService, EsolveBankingDetails, EsolveBanner, EsolveBannerImage, EsolveBannerImageHotspot, EsolveBannerService, EsolveCartItem, EsolveCartService, EsolveCartTotals, EsolveCategoryTreeItem, EsolveCategoryTreeService, EsolveCheckoutResult, EsolveErrorHandlerService, EsolveHttpError, EsolveLocationsService, EsolveMediaArticle, EsolveMediaService, EsolveMenuItem, EsolveMenuService, EsolveNewsArticle, EsolveNewsArticleAuthor, EsolveNewsArticleList, EsolveNewsGroup, EsolveNewsService, EsolvePaymentMethod, EsolvePaymentResult, EsolvePaymentService, EsolveRegistrationResult, EsolveResponseHandlerService, EsolveResponseResult, EsolveSEOInfo, EsolveSeoService, EsolveSession, EsolveSessionService, EsolveShippingCost, EsolveShippingMethod, EsolveShippingService, EsolveStockBadge, EsolveStockItem, EsolveStockItemList, EsolveStockLocation, EsolveStockPrice, EsolveStockService, EsolveTag, EsolveTopic, EsolveTopicService, EsolveUserAccount, EsolveUserAccountBusiness, EsolveUserAccountContact, EsolveUserAccountResult, EsolveVaultItem, EsolveVaultItemResult, NgEsolveConnectModule };