@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.
@@ -614,10 +614,10 @@ class EsolveHttpError extends Error {
614
614
 
615
615
  class EsolveErrorHandlerService {
616
616
  throwError(code, message) {
617
- throw new EsolveHttpError('error', message, code);
617
+ throw new EsolveHttpError('error', code, message);
618
618
  }
619
619
  emitError(code, message) {
620
- return throwError(() => new EsolveHttpError('error', message, code));
620
+ return throwError(() => new EsolveHttpError('error', code, message));
621
621
  }
622
622
  handleHttpPostError(service_type, errorRes) {
623
623
  if (!(errorRes instanceof HttpErrorResponse) &&
@@ -667,11 +667,11 @@ class EsolveErrorHandlerService {
667
667
  return throwError(() => error_response);
668
668
  }
669
669
  parseException(exception) {
670
- const error = new EsolveHttpError('exception', exception.message || 'Unknown exception has occurred', exception.additional_data.exception_type || 'unknown');
670
+ const error = new EsolveHttpError('exception', exception.additional_data.exception_type || 'unknown', exception.message || 'Unknown exception has occurred');
671
671
  return error;
672
672
  }
673
673
  parseResponseError(exception) {
674
- const error = new EsolveHttpError('error', exception.message || 'Unknown error has occurred', exception.code || 'unknown');
674
+ const error = new EsolveHttpError('error', exception.code || 'unknown', exception.message || 'Unknown error has occurred');
675
675
  return error;
676
676
  }
677
677
  parsePostErrors(response) {
@@ -689,7 +689,7 @@ class EsolveErrorHandlerService {
689
689
  return new EsolveHttpError('error', error_code, message);
690
690
  }
691
691
  parseDeleteError(result) {
692
- return new EsolveHttpError('error', result.message, result.code);
692
+ return new EsolveHttpError('error', result.code, result.message);
693
693
  }
694
694
  }
695
695
  EsolveErrorHandlerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: EsolveErrorHandlerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
@@ -2141,6 +2141,8 @@ class EsolveTransactionItem {
2141
2141
  this.sef_name = '';
2142
2142
  this.image_name = '';
2143
2143
  this.image_last_modified = '';
2144
+ this.pack_description = '';
2145
+ this.pack_size = 0;
2144
2146
  this.qty = 0;
2145
2147
  this.discount = 0;
2146
2148
  this.vat_rate = 0;
@@ -2152,6 +2154,8 @@ class EsolveTransactionItem {
2152
2154
  this.sef_name = record.sef_name ?? '';
2153
2155
  this.image_name = record.image_name ?? '';
2154
2156
  this.image_last_modified = record.image_last_modified ?? '';
2157
+ this.pack_description = record.pack_description ?? '';
2158
+ this.pack_size = +(record.items_in_pack ?? 0);
2155
2159
  this.qty = +(record.qty ?? 0);
2156
2160
  this.discount = +(record.discount ?? 0);
2157
2161
  this.vat_rate = +(record.vat_rate ?? 0);
@@ -2521,42 +2525,18 @@ class EsolveCheckoutResult extends EsolveResponseResult {
2521
2525
  }
2522
2526
  }
2523
2527
 
2524
- class EsolveCartItem {
2525
- 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) {
2526
- this.id = id;
2527
- this.stock_item = stock_item;
2528
- this.qty = qty;
2529
- this.delivery_category = delivery_category;
2530
- this.type = type;
2531
- this.price = price;
2532
- this.discount = discount;
2533
- this.discount_interval = discount_interval;
2534
- this.vat_rate = vat_rate;
2535
- this.allow_quotes = allow_quotes;
2536
- this.allow_orders = allow_orders;
2537
- this.must_collect = must_collect;
2538
- this.requested_assembly = requested_assembly;
2539
- this.price_incl = price_incl;
2540
- this.discount_price = discount_price;
2541
- this.discount_price_incl = discount_price_incl;
2542
- this.discount_total = discount_total;
2543
- this.vat_total = vat_total;
2544
- this.total = total;
2545
- this.total_incl = total_incl;
2546
- }
2547
- }
2548
-
2549
2528
  class EsolveCartStockItem {
2550
- constructor(code, name, sef_name, description, active, items_in_pack, delivery_category, onhand, image_name) {
2551
- this.code = code;
2552
- this.name = name;
2553
- this.sef_name = sef_name;
2554
- this.description = description;
2555
- this.active = active;
2556
- this.items_in_pack = items_in_pack;
2557
- this.delivery_category = delivery_category;
2558
- this.onhand = onhand;
2559
- this.image_name = image_name;
2529
+ constructor(record) {
2530
+ this.code = record.code ?? '';
2531
+ this.name = record.name ?? '';
2532
+ this.sef_name = record.sef_name ?? '';
2533
+ this.description = record.description ?? '';
2534
+ this.delivery_category = record.delivery_category ?? '';
2535
+ this.image_name = record.image_name ?? '';
2536
+ this.pack_description = record.pack_description ?? '';
2537
+ this.pack_size = +(record.items_in_pack ?? 0);
2538
+ this.onhand = +(record.onhand ?? 0);
2539
+ this.active = record.is_active ?? false;
2560
2540
  }
2561
2541
  /**
2562
2542
  * Path to tiny stock image
@@ -2596,6 +2576,31 @@ class EsolveCartStockItem {
2596
2576
  }
2597
2577
  }
2598
2578
 
2579
+ class EsolveCartItem {
2580
+ constructor(record) {
2581
+ this.delivery_category = record.delivery_category ?? '';
2582
+ this.type = record.type ?? '';
2583
+ this.id = +(record.id ?? 0);
2584
+ this.qty = +(record.qty ?? 0);
2585
+ this.price = +(record.price ?? 0);
2586
+ this.discount = +(record.discount ?? 0);
2587
+ this.discount_interval = +(record.discount_interval ?? 0);
2588
+ this.vat_rate = +(record.vat_rate ?? 0);
2589
+ this.price_incl = +(record.price_incl ?? 0);
2590
+ this.discount_price = +(record.discount_price ?? 0);
2591
+ this.discount_price_incl = +(record.discount_price_incl ?? 0);
2592
+ this.discount_total = +(record.discount_total ?? 0);
2593
+ this.vat_total = +(record.vat_total ?? 0);
2594
+ this.total = +(record.line_total ?? 0);
2595
+ this.total_incl = +(record.line_total_incl ?? 0);
2596
+ this.allow_quotes = record.allow_quotes ?? false;
2597
+ this.allow_orders = record.allow_orders ?? false;
2598
+ this.must_collect = record.must_collect ?? false;
2599
+ this.requested_assembly = record.requested_assembly ?? false;
2600
+ this.stock_item = new EsolveCartStockItem(record);
2601
+ }
2602
+ }
2603
+
2599
2604
  /**
2600
2605
  * Totals in cart
2601
2606
  */
@@ -3087,8 +3092,7 @@ class EsolveCartService {
3087
3092
  const cart_items = [];
3088
3093
  if (cart_item_records) {
3089
3094
  for (const cart_item_record of cart_item_records) {
3090
- 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);
3091
- 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));
3095
+ cart_items.push(new EsolveCartItem(cart_item_record));
3092
3096
  }
3093
3097
  }
3094
3098
  return cart_items;
@@ -4051,7 +4055,7 @@ class EsolveStockItemBase {
4051
4055
  /**
4052
4056
  * Number of items in a pack
4053
4057
  */
4054
- this.pack_size = 1;
4058
+ this.pack_size = 0;
4055
4059
  /**
4056
4060
  * Description of the pack
4057
4061
  */
@@ -4137,7 +4141,7 @@ class EsolveStockItemBase {
4137
4141
  this.allow_orders = record.allow_orders ?? true;
4138
4142
  this.amount_in_stock = +(record.onhand ?? 0);
4139
4143
  this.total_recipe_items = +(record.total_recipe_items ?? 0);
4140
- this.pack_size = +(record.items_in_pack ?? 1);
4144
+ this.pack_size = +(record.items_in_pack ?? 0);
4141
4145
  this.pack_description = record.pack_description ?? '';
4142
4146
  this.height = +(record.height ?? 0);
4143
4147
  this.width = +(record.width ?? 0);
@@ -5751,4 +5755,3 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImpor
5751
5755
 
5752
5756
  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 };
5753
5757
  //# sourceMappingURL=esolve-ng-esolve-connect.mjs.map
5754
- //# sourceMappingURL=esolve-ng-esolve-connect.mjs.map