@esolve/ng-esolve-connect 0.30.0 → 0.30.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -619,10 +619,10 @@ class EsolveHttpError extends Error {
619
619
 
620
620
  class EsolveErrorHandlerService {
621
621
  throwError(code, message) {
622
- throw new EsolveHttpError('error', message, code);
622
+ throw new EsolveHttpError('error', code, message);
623
623
  }
624
624
  emitError(code, message) {
625
- return throwError(() => new EsolveHttpError('error', message, code));
625
+ return throwError(() => new EsolveHttpError('error', code, message));
626
626
  }
627
627
  handleHttpPostError(service_type, errorRes) {
628
628
  if (!(errorRes instanceof HttpErrorResponse) &&
@@ -672,11 +672,11 @@ class EsolveErrorHandlerService {
672
672
  return throwError(() => error_response);
673
673
  }
674
674
  parseException(exception) {
675
- const error = new EsolveHttpError('exception', exception.message || 'Unknown exception has occurred', exception.additional_data.exception_type || 'unknown');
675
+ const error = new EsolveHttpError('exception', exception.additional_data.exception_type || 'unknown', exception.message || 'Unknown exception has occurred');
676
676
  return error;
677
677
  }
678
678
  parseResponseError(exception) {
679
- const error = new EsolveHttpError('error', exception.message || 'Unknown error has occurred', exception.code || 'unknown');
679
+ const error = new EsolveHttpError('error', exception.code || 'unknown', exception.message || 'Unknown error has occurred');
680
680
  return error;
681
681
  }
682
682
  parsePostErrors(response) {
@@ -694,7 +694,7 @@ class EsolveErrorHandlerService {
694
694
  return new EsolveHttpError('error', error_code, message);
695
695
  }
696
696
  parseDeleteError(result) {
697
- return new EsolveHttpError('error', result.message, result.code);
697
+ return new EsolveHttpError('error', result.code, result.message);
698
698
  }
699
699
  }
700
700
  EsolveErrorHandlerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: EsolveErrorHandlerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
@@ -2180,12 +2180,14 @@ class EsolveTransactionItemPrice {
2180
2180
 
2181
2181
  class EsolveTransactionItem {
2182
2182
  constructor(record) {
2183
- var _a, _b, _c, _d, _e, _f, _g, _h;
2183
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
2184
2184
  this.code = '';
2185
2185
  this.name = '';
2186
2186
  this.sef_name = '';
2187
2187
  this.image_name = '';
2188
2188
  this.image_last_modified = '';
2189
+ this.pack_description = '';
2190
+ this.pack_size = 0;
2189
2191
  this.qty = 0;
2190
2192
  this.discount = 0;
2191
2193
  this.vat_rate = 0;
@@ -2197,9 +2199,11 @@ class EsolveTransactionItem {
2197
2199
  this.sef_name = (_c = record.sef_name) !== null && _c !== void 0 ? _c : '';
2198
2200
  this.image_name = (_d = record.image_name) !== null && _d !== void 0 ? _d : '';
2199
2201
  this.image_last_modified = (_e = record.image_last_modified) !== null && _e !== void 0 ? _e : '';
2200
- this.qty = +((_f = record.qty) !== null && _f !== void 0 ? _f : 0);
2201
- this.discount = +((_g = record.discount) !== null && _g !== void 0 ? _g : 0);
2202
- this.vat_rate = +((_h = record.vat_rate) !== null && _h !== void 0 ? _h : 0);
2202
+ this.pack_description = (_f = record.pack_description) !== null && _f !== void 0 ? _f : '';
2203
+ this.pack_size = +((_g = record.items_in_pack) !== null && _g !== void 0 ? _g : 0);
2204
+ this.qty = +((_h = record.qty) !== null && _h !== void 0 ? _h : 0);
2205
+ this.discount = +((_j = record.discount) !== null && _j !== void 0 ? _j : 0);
2206
+ this.vat_rate = +((_k = record.vat_rate) !== null && _k !== void 0 ? _k : 0);
2203
2207
  this.price = new EsolveTransactionItemPrice(+record.price_exclusive, +record.price_inclusive, +record.price_exclusive_after_discount, +record.price_inclusive_after_discount);
2204
2208
  this.line_total = new EsolveTransactionItemPrice(+record.line_total_exclusive, +record.line_total_inclusive, +record.line_total_exclusive_after_discount, +record.line_total_inclusive_after_discount);
2205
2209
  }
@@ -2569,42 +2573,19 @@ class EsolveCheckoutResult extends EsolveResponseResult {
2569
2573
  }
2570
2574
  }
2571
2575
 
2572
- class EsolveCartItem {
2573
- constructor(id, stock_item, qty, delivery_category, 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) {
2574
- this.id = id;
2575
- this.stock_item = stock_item;
2576
- this.qty = qty;
2577
- this.delivery_category = delivery_category;
2578
- this.type = type;
2579
- this.price = price;
2580
- this.discount = discount;
2581
- this.discount_interval = discount_interval;
2582
- this.vat_rate = vat_rate;
2583
- this.allow_quotes = allow_quotes;
2584
- this.allow_orders = allow_orders;
2585
- this.must_collect = must_collect;
2586
- this.requested_assembly = requested_assembly;
2587
- this.price_incl = price_incl;
2588
- this.discount_price = discount_price;
2589
- this.discount_price_incl = discount_price_incl;
2590
- this.discount_total = discount_total;
2591
- this.vat_total = vat_total;
2592
- this.total = total;
2593
- this.total_incl = total_incl;
2594
- }
2595
- }
2596
-
2597
2576
  class EsolveCartStockItem {
2598
- constructor(code, name, sef_name, description, active, items_in_pack, delivery_category, onhand, image_name) {
2599
- this.code = code;
2600
- this.name = name;
2601
- this.sef_name = sef_name;
2602
- this.description = description;
2603
- this.active = active;
2604
- this.items_in_pack = items_in_pack;
2605
- this.delivery_category = delivery_category;
2606
- this.onhand = onhand;
2607
- this.image_name = image_name;
2577
+ constructor(record) {
2578
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
2579
+ this.code = (_a = record.code) !== null && _a !== void 0 ? _a : '';
2580
+ this.name = (_b = record.name) !== null && _b !== void 0 ? _b : '';
2581
+ this.sef_name = (_c = record.sef_name) !== null && _c !== void 0 ? _c : '';
2582
+ this.description = (_d = record.description) !== null && _d !== void 0 ? _d : '';
2583
+ this.delivery_category = (_e = record.delivery_category) !== null && _e !== void 0 ? _e : '';
2584
+ this.image_name = (_f = record.image_name) !== null && _f !== void 0 ? _f : '';
2585
+ this.pack_description = (_g = record.pack_description) !== null && _g !== void 0 ? _g : '';
2586
+ this.pack_size = +((_h = record.items_in_pack) !== null && _h !== void 0 ? _h : 0);
2587
+ this.onhand = +((_j = record.onhand) !== null && _j !== void 0 ? _j : 0);
2588
+ this.active = (_k = record.is_active) !== null && _k !== void 0 ? _k : false;
2608
2589
  }
2609
2590
  /**
2610
2591
  * Path to tiny stock image
@@ -2644,6 +2625,32 @@ class EsolveCartStockItem {
2644
2625
  }
2645
2626
  }
2646
2627
 
2628
+ class EsolveCartItem {
2629
+ constructor(record) {
2630
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
2631
+ this.delivery_category = (_a = record.delivery_category) !== null && _a !== void 0 ? _a : '';
2632
+ this.type = (_b = record.type) !== null && _b !== void 0 ? _b : '';
2633
+ this.id = +((_c = record.id) !== null && _c !== void 0 ? _c : 0);
2634
+ this.qty = +((_d = record.qty) !== null && _d !== void 0 ? _d : 0);
2635
+ this.price = +((_e = record.price) !== null && _e !== void 0 ? _e : 0);
2636
+ this.discount = +((_f = record.discount) !== null && _f !== void 0 ? _f : 0);
2637
+ this.discount_interval = +((_g = record.discount_interval) !== null && _g !== void 0 ? _g : 0);
2638
+ this.vat_rate = +((_h = record.vat_rate) !== null && _h !== void 0 ? _h : 0);
2639
+ this.price_incl = +((_j = record.price_incl) !== null && _j !== void 0 ? _j : 0);
2640
+ this.discount_price = +((_k = record.discount_price) !== null && _k !== void 0 ? _k : 0);
2641
+ this.discount_price_incl = +((_l = record.discount_price_incl) !== null && _l !== void 0 ? _l : 0);
2642
+ this.discount_total = +((_m = record.discount_total) !== null && _m !== void 0 ? _m : 0);
2643
+ this.vat_total = +((_o = record.vat_total) !== null && _o !== void 0 ? _o : 0);
2644
+ this.total = +((_p = record.line_total) !== null && _p !== void 0 ? _p : 0);
2645
+ this.total_incl = +((_q = record.line_total_incl) !== null && _q !== void 0 ? _q : 0);
2646
+ this.allow_quotes = (_r = record.allow_quotes) !== null && _r !== void 0 ? _r : false;
2647
+ this.allow_orders = (_s = record.allow_orders) !== null && _s !== void 0 ? _s : false;
2648
+ this.must_collect = (_t = record.must_collect) !== null && _t !== void 0 ? _t : false;
2649
+ this.requested_assembly = (_u = record.requested_assembly) !== null && _u !== void 0 ? _u : false;
2650
+ this.stock_item = new EsolveCartStockItem(record);
2651
+ }
2652
+ }
2653
+
2647
2654
  /**
2648
2655
  * Totals in cart
2649
2656
  */
@@ -3140,8 +3147,7 @@ class EsolveCartService {
3140
3147
  const cart_items = [];
3141
3148
  if (cart_item_records) {
3142
3149
  for (const cart_item_record of cart_item_records) {
3143
- const cart_stock_item = new EsolveCartStockItem(cart_item_record.code, cart_item_record.name, cart_item_record.sef_name, cart_item_record.description, cart_item_record.is_active, +cart_item_record.items_in_pack, cart_item_record.delivery_category, +cart_item_record.onhand, cart_item_record.image_name);
3144
- cart_items.push(new EsolveCartItem(+cart_item_record.id, cart_stock_item, +cart_item_record.qty, cart_item_record.delivery_category, cart_item_record.type, +cart_item_record.price, +cart_item_record.discount, +cart_item_record.discount_interval, cart_item_record.vat_rate, cart_item_record.allow_quotes, cart_item_record.allow_orders, cart_item_record.must_collect, cart_item_record.requested_assembly, +cart_item_record.price_incl, +cart_item_record.discount_price, +cart_item_record.discount_price_incl, +cart_item_record.discount_total, +cart_item_record.vat_total, +cart_item_record.line_total, +cart_item_record.line_total_incl));
3150
+ cart_items.push(new EsolveCartItem(cart_item_record));
3145
3151
  }
3146
3152
  }
3147
3153
  return cart_items;
@@ -4116,7 +4122,7 @@ class EsolveStockItemBase {
4116
4122
  /**
4117
4123
  * Number of items in a pack
4118
4124
  */
4119
- this.pack_size = 1;
4125
+ this.pack_size = 0;
4120
4126
  /**
4121
4127
  * Description of the pack
4122
4128
  */
@@ -4202,7 +4208,7 @@ class EsolveStockItemBase {
4202
4208
  this.allow_orders = (_v = record.allow_orders) !== null && _v !== void 0 ? _v : true;
4203
4209
  this.amount_in_stock = +((_w = record.onhand) !== null && _w !== void 0 ? _w : 0);
4204
4210
  this.total_recipe_items = +((_x = record.total_recipe_items) !== null && _x !== void 0 ? _x : 0);
4205
- this.pack_size = +((_y = record.items_in_pack) !== null && _y !== void 0 ? _y : 1);
4211
+ this.pack_size = +((_y = record.items_in_pack) !== null && _y !== void 0 ? _y : 0);
4206
4212
  this.pack_description = (_z = record.pack_description) !== null && _z !== void 0 ? _z : '';
4207
4213
  this.height = +((_0 = record.height) !== null && _0 !== void 0 ? _0 : 0);
4208
4214
  this.width = +((_1 = record.width) !== null && _1 !== void 0 ? _1 : 0);
@@ -5841,4 +5847,3 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImpor
5841
5847
 
5842
5848
  export { ESOLVE_CONNECT_CONFIG, EsolveAccountConfirmationResult, EsolveAccountService, EsolveAdditionalStockImage, EsolveAddress, EsolveAddressResult, EsolveAsset, EsolveAssetsService, EsolveAuthService, EsolveBankingDetails, EsolveBanner, EsolveBannerImage, EsolveBannerImageHotspot, EsolveBannerService, EsolveCartItem, EsolveCartService, EsolveCartStockItem, EsolveCartTotals, EsolveCategoryTreeItem, EsolveCategoryTreeService, EsolveChangePasswordResult, EsolveCheckoutResult, EsolveColour, EsolveCookieService, EsolveCoupon, EsolveCouponsService, EsolveDependantItem, EsolveEmptyCartResult, EsolveEmptyWishlistResult, EsolveEnquiryResult, EsolveEnquiryService, EsolveErrorHandlerService, esolveFilterFactory as EsolveFilterFactory, EsolveGeocodeAddressResult, EsolveGeocodeCoordsResult, EsolveGeocodeResult, EsolveGeocoderService, EsolveHttpError, EsolveLinkedAsset, EsolveLinkedStockItem, EsolveList, EsolveLocation, EsolveLocationAddress, EsolveLocationContactInfo, EsolveLocationGEO, EsolveLocationPOBoxAddress, EsolveLocationTradingDay, EsolveLocationTradingTimes, EsolveLocationsService, EsolveManufacturer, EsolveManufacturersService, EsolveMediaStockItem, EsolveMenuItem, EsolveMenuService, EsolveMultipleSelectFilter, EsolveNewsArticle, EsolveNewsArticleAuthor, EsolveNewsArticleList, EsolveNewsGroup, EsolveNewsService, EsolvePaymentMethod, EsolvePaymentResult, EsolvePaymentService, EsolveRange, EsolveRangeFilter, EsolveRangesService, EsolveRecipeStockItem, EsolveRegistrationResult, EsolveResetPasswordResult, EsolveResponseHandlerService, EsolveResponseResult, EsolveResult, EsolveSeoInfo, EsolveSeoService, EsolveSession, EsolveSessionService, EsolveShippingCost, EsolveShippingMethod, EsolveShippingService, EsolveShippingTotals, EsolveSingleSelectFilter, EsolveSpecial, EsolveSpecialDates, EsolveSpecialImage, EsolveSpecialImageCollection, EsolveSpecialsService, EsolveStatement, EsolveStatementAgeing, EsolveStatementBalances, EsolveStatementTransaction, EsolveStockBadge, EsolveStockGroup, EsolveStockGroupItem, EsolveStockImage, EsolveStockImageCollection, EsolveStockItem, EsolveStockItemBase, EsolveStockItemList, EsolveStockLeadTimes, EsolveStockPrice, EsolveStockService, EsolveSupplier, EsolveSuppliersService, EsolveTag, EsolveTagsService, EsolveTopic, EsolveTopicService, EsolveTransaction, EsolveTransactionAddress, EsolveTransactionAnalyticsData, EsolveTransactionClient, EsolveTransactionItem, EsolveTransactionItemPrice, EsolveTransactionList, EsolveTransactionLocation, EsolveTransactionPaymentMethod, EsolveTransactionShippingMethod, EsolveTransactionUser, EsolveUserAccount, EsolveUserAccountBusiness, EsolveUserAccountContact, EsolveUserAccountResult, EsolveUserClientAccount, EsolveUserClientAccountBalances, EsolveVaultItem, EsolveVaultItemResult, EsolveWishlistItem, EsolveWishlistService, NgEsolveConnectModule };
5843
5849
  //# sourceMappingURL=esolve-ng-esolve-connect.mjs.map
5844
- //# sourceMappingURL=esolve-ng-esolve-connect.mjs.map