idosell 0.4.12 → 0.4.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/changelog.md CHANGED
@@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [0.4.12] - 2025-10-15
8
+ ## [0.4.13] - 2025-10-15
9
9
  ### Changed
10
10
  - Updated to v7.2
11
11
  - Added utils
@@ -1,8 +1,8 @@
1
1
  import type { PagableGateway, AppendableGateway, Gateway, DateLike, JSObject } from "./app.d.ts"
2
2
  import type { GetClientsBalanceResponse, BooleanStatusResponse, GetClientsResponse, PostClientsResponse, PutClientsResponse, SearchClientsCrmResponse, GetClientsDeliveryAddressResponse, PostClientsDeliveryAddressResponse, PutClientsDeliveryAddressResponse, VouchersResponse, PutVouchersResponse, SearchClientsGiftcardsResponse, GetClientsGiftcardsTypesResponse, GetClientsMembershipCardsResponse, PutClientsMembershipCardsResponse, SearchClientsNewsletterEmailResponse, SearchClientsNewsletterSmsResponse, GetClientsPayerAddressResponse, PostClientsPayerAddressResponse, PutClientsPayerAddressResponse, GetClientsPricelistsClientsResponse, PutClientsPricelistsClientsResponse, GetClientsPricelistsResponse, PostClientsPricelistsResponse, GetClientsPricelistsProductsResponse, PutClientsPricelistsProductsResponse, GetClientsPricesActiveCardResponse, GetClientsPricesDiscountGroupsResponse, GetClientsPricesDiscountsResponse, PutClientsPricesDiscountsResponse, GetClientsProfitPointsResponse, GetClientsProvinceListResponse, GetClientsTagsResponse, PostClientsTagsResponse, PutClientsTagsResponse, GetConfigVariablesResponse, PutConfigVariablesResponse, GetCouriersAssignedToShippingProfilesResponse, GetCouriersResponse, GetCouriersPickupPointsResponse, PutCouriersPickupPointsResponse, GetCpaCampaignResponse, CmsCampaignResponse, CmsResponse, GetCpaResponse, GetDeliveriesProfilesResponse, GetDeliveriesRegionsResponse, PostDeliveriesRegionsResponse, GetDiscountsGroupsClientsResponse, GetDiscountsGroupsResponse, PostDiscountsGroupsResponse, GetEntriesResponse, PostEntriesResponse, GetEntriesPagesToDisplayResponse, GetEntriesSourcesResponse, GetMenuResponse, PostMenuResponse, PutMenuResponse, PutMenuSortResponse, GetOrdersAnalyticsResponse, GetOrdersAuctionDetailsResponse, PutOrdersCourierResponse, PostOrdersDocumentsCreateResponse, GetOrdersDocumentsResponse, PostOrdersDocumentsResponse, GetOrdersHandlerResponse, GetOrdersHistoryResponse, GetOrdersImagesResponse, PostOrdersImagesResponse, GetOrdersLabelsResponse, SearchOrdersOpinionsResponse, GetOrdersOpinionsRateResponse, SearchOrdersResponse, PostOrdersResponse, PutOrdersResponse, GetOrdersPackagesResponse, PutOrdersPackagesResponse, PutOrdersProductsSerialNumbersResponse, PutOrdersProfitMarginResponse, GetOrdersProfitabilityResponse, GetOrdersStatusesResponse, GetOrdersWarehouseResponse, PostPackagesLabelsResponse, PutPackagesResponse, SearchPackagesResponse, GetPaymentsFormsResponse, GetPaymentsResponse, PostPaymentsResponse, GetPaymentsProfilesResponse, PostPaymentsRepaymentResponse, GetProductsSKUbyBarcodeResponse, PutProductsAttachmentsResponse, GetProductsAuctionsResponse, GetProductsBrandsResponse, PutProductsBrandsResponse, GetProductsCategoriesResponse, PutProductsCategoriesResponse, SearchProductsCategoriesIdosellResponse, GetProductsCodeExistenceResponse, SearchProductsDeliveryTimeResponse, GetProductsDescriptionsResponse, ProductIdentResponse, PutProductsGroupsSettingsResponse, GetProductsIdBySizecodeResponse, PutProductsImagesResponse, GetProductsMarketingPromotionResponse, PostProductsMarketingPromotionResponse, PutProductsMarketingPromotionResponse, GetProductsMarketingZonesResponse, PutProductsMarketingZonesResponse, GetProductsOmnibusPricesResponse, GetProductsOpinionsResponse, PostProductsOpinionsResponse, GetProductsOpinionsRateResponse, PutProductsParametersResponse, SearchProductsParametersResponse, SearchProductsResponse, PostProductsResponse, PutProductsResponse, GetProductsQuestionsResponse, GetProductsReservationsResponse, GetProductsSeriesResponse, PutProductsSeriesResponse, GetProductsSizesResponse, PutProductsSizesResponse, PutProductsStockQuantityResponse, GetProductsStocksResponse, PutProductsStocksResponse, GetProductsStrikethroughPricesResponse, PutProductsSupplierCodeResponse, PutProductsSupplierProductDataResponse, GetResponsibilityEntitiesResponse, PutResponsibilityEntitiesResponse, GetReturnsResponse, PostReturnsResponse, PutReturnsResponse, PutReturnsSerialNumberResponse, GetRmaResponse, PutRmaResponse, GetRmaStatusesResponse, GetShopsCurrenciesResponse, GetShopsLanguagesResponse, GetSizechartsResponse, PutSizechartsResponse, GetSizesResponse, PutSizesResponse, GetSnippetsCampaignResponse, GetSnippetsCookiesResponse, GetSnippetsResponse, GetSystemConfigResponse, GetSystemCurrenciesResponse, PutSystemCurrenciesResponse, GetSystemProcessesAutomationResponse, GetSystemServerLoadResponse, GetSystemServerTimeResponse, GetSystemShopsDataResponse, GetSystemUnitsResponse, PutSystemUnitsResponse, GetSystemUsersResponse, GetVouchersTypesResponse, GetVouchersResponse, GetWarrantiesCountTotalResponse, PutWarrantiesLanguageDataResponse, GetWarrantiesResponse, PutWarrantiesResponse, GetWmsLocationsResponse, GetWmsStocksdocumentsDocumentsResponse, PostWmsStocksdocumentsDocumentsResponse, PutWmsStocksdocumentsDocumentsResponse, GetWmsStocksdocumentsOpenedDocumentsResponse, GetWmsStocksdocumentsProductsResponse, PutWmsStocksdocumentsProductsResponse, GetWmsSuppliersResponse, PutWmsSuppliersResponse } from "./responses.d.ts"
3
3
  import type * as RequestParams from "./reqparams.d.ts";
4
- import * as ENUMS from "./enums";
5
- import utils from "./utils";
4
+ import utils from "./utils.d";
5
+ import * as ENUMS from "./enums.d";
6
6
 
7
7
  export interface GetClientsBalanceRequest extends PagableGateway<GetClientsBalanceRequest, GetClientsBalanceResponse> {
8
8
  /** Customer Id */
package/dist/utils.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { SearchProductsResponse } from "./responses.d.ts"
2
2
 
3
- export enum ProductQuantityKey {
3
+ export enum QunatityType {
4
4
  ProductSizeQuantityOwnStock = "productSizeQuantityOwnStock",
5
5
  ProductSizeQuantityOutsideStock = "productSizeQuantityOutsideStock",
6
6
  ProductSizeQuantityAllStocks = "productSizeQuantityAllStocks",
@@ -14,16 +14,18 @@ export type IdosellProduct = SearchProductsResponse['results'][0];
14
14
 
15
15
  export type GetIaICodeFunction = (productId: number|string, sizeId: string) => string;
16
16
 
17
- export type SumProductQuantitiesFunction = (productStocksData: IdosellProduct['productStocksData'], stockType?: ProductQuantityKey) => number;
17
+ export type SumProductQuantitiesFunction = (productStocksData: IdosellProduct['productStocksData'], stockType?: QunatityType) => number;
18
18
 
19
- export type MapSizeQuantitesFunction = (product: IdosellProduct, stockType?: ProductQuantityKey) => Record<string,number>;
19
+ export type MapSizeQuantitesFunction = (product: IdosellProduct, stockType?: QunatityType) => Record<string,number>;
20
20
 
21
21
  export type MapProductCodesFunction = (product: IdosellProduct, codeType?: 'productSizeCodeExternal'|'productSizeCodeProducer'|'sizePanelName') => Record<string,string>;
22
22
 
23
- declare const _default: {
24
- getIaiCode: GetIaICodeFunction;
25
- sumProductQuantities: SumProductQuantitiesFunction;
26
- mapSizeQuantites: MapSizeQuantitesFunction;
27
- mapProductCodes: MapProductCodesFunction;
28
- };
29
- export default _default;
23
+ declare namespace utils {
24
+ const QUANTITY_TYPE_ENUM: typeof QunatityType;
25
+ const getIaiCode: GetIaICodeFunction;
26
+ const sumProductQuantities: SumProductQuantitiesFunction;
27
+ const mapSizeQuantites: MapSizeQuantitesFunction;
28
+ const mapProductCodes: MapProductCodesFunction;
29
+ }
30
+
31
+ export default utils;
package/dist/utils.js CHANGED
@@ -1,23 +1,23 @@
1
- export var ProductQuantityKey;
2
- (function (ProductQuantityKey) {
3
- ProductQuantityKey["ProductSizeQuantityOwnStock"] = "productSizeQuantityOwnStock";
4
- ProductQuantityKey["ProductSizeQuantityOutsideStock"] = "productSizeQuantityOutsideStock";
5
- ProductQuantityKey["ProductSizeQuantityAllStocks"] = "productSizeQuantityAllStocks";
6
- ProductQuantityKey["ProductStocksQuantities"] = "productStocksQuantities";
7
- ProductQuantityKey["ProductOrdersUnfinishedQuantities"] = "productOrdersUnfinishedQuantities";
8
- ProductQuantityKey["ProductSizesDeliveries"] = "productSizesDeliveries";
9
- ProductQuantityKey["ProductSizesDispositionsInAuctions"] = "productSizesDispositionsInAuctions";
10
- })(ProductQuantityKey || (ProductQuantityKey = {}));
1
+ export var QunatityType;
2
+ (function (QunatityType) {
3
+ QunatityType["ProductSizeQuantityOwnStock"] = "productSizeQuantityOwnStock";
4
+ QunatityType["ProductSizeQuantityOutsideStock"] = "productSizeQuantityOutsideStock";
5
+ QunatityType["ProductSizeQuantityAllStocks"] = "productSizeQuantityAllStocks";
6
+ QunatityType["ProductStocksQuantities"] = "productStocksQuantities";
7
+ QunatityType["ProductOrdersUnfinishedQuantities"] = "productOrdersUnfinishedQuantities";
8
+ QunatityType["ProductSizesDeliveries"] = "productSizesDeliveries";
9
+ QunatityType["ProductSizesDispositionsInAuctions"] = "productSizesDispositionsInAuctions";
10
+ })(QunatityType || (QunatityType = {}));
11
11
  const productQuantityPathMap = {
12
12
  // ----- Product Dispositions -----
13
- [ProductQuantityKey.ProductSizeQuantityOwnStock]: ["productSizesDispositions", "productSizesDispositionsInSales", "productSizeQuantityOwnStock"],
14
- [ProductQuantityKey.ProductSizeQuantityOutsideStock]: ["productSizesDispositions", "productSizesDispositionsInSales", "productSizeQuantityOutsideStock"],
15
- [ProductQuantityKey.ProductSizeQuantityAllStocks]: ["productSizesDispositions", "productSizesDispositionsInSales", "productSizeQuantityAllStocks"],
16
- [ProductQuantityKey.ProductSizesDispositionsInAuctions]: ["productSizesDispositions", "productSizesDispositionsInAuctions", "productSizeQuantity"],
13
+ [QunatityType.ProductSizeQuantityOwnStock]: ["productSizesDispositions", "productSizesDispositionsInSales", "productSizeQuantityOwnStock"],
14
+ [QunatityType.ProductSizeQuantityOutsideStock]: ["productSizesDispositions", "productSizesDispositionsInSales", "productSizeQuantityOutsideStock"],
15
+ [QunatityType.ProductSizeQuantityAllStocks]: ["productSizesDispositions", "productSizesDispositionsInSales", "productSizeQuantityAllStocks"],
16
+ [QunatityType.ProductSizesDispositionsInAuctions]: ["productSizesDispositions", "productSizesDispositionsInAuctions", "productSizeQuantity"],
17
17
  // ----- Stocks & related quantities -----
18
- [ProductQuantityKey.ProductStocksQuantities]: ["productStocksQuantities", "productSizeQuantity"],
19
- [ProductQuantityKey.ProductOrdersUnfinishedQuantities]: ["productOrdersUnfinishedQuantities", "productSizeQuantity"],
20
- [ProductQuantityKey.ProductSizesDeliveries]: ["productSizesDeliveries", "productSizeQuantity"],
18
+ [QunatityType.ProductStocksQuantities]: ["productStocksQuantities", "productSizeQuantity"],
19
+ [QunatityType.ProductOrdersUnfinishedQuantities]: ["productOrdersUnfinishedQuantities", "productSizeQuantity"],
20
+ [QunatityType.ProductSizesDeliveries]: ["productSizesDeliveries", "productSizeQuantity"],
21
21
  };
22
22
  const getProductSizeArrayNode = (productStocksData, key) => {
23
23
  const pathNode = productQuantityPathMap[key];
@@ -46,7 +46,7 @@ const getProductSizeArray = (productStocksData, path) => {
46
46
  }
47
47
  return [];
48
48
  };
49
- const sumProductQuantities = (productStocksData, stockType = ProductQuantityKey.ProductSizeQuantityOwnStock) => {
49
+ const sumProductQuantities = (productStocksData, stockType = QunatityType.ProductSizeQuantityOwnStock) => {
50
50
  const { arr, node } = getProductSizeArrayNode(productStocksData, stockType);
51
51
  return arr.reduce((total, item) => {
52
52
  const value = item[node];
@@ -56,9 +56,11 @@ const sumProductQuantities = (productStocksData, stockType = ProductQuantityKey.
56
56
  }, 0);
57
57
  };
58
58
  const getIaiCode = (productId, sizeId) => {
59
+ if (sizeId === 'uniw')
60
+ return productId.toString();
59
61
  return [productId, sizeId].join('-');
60
62
  };
61
- const mapSizeQuantites = (product, stockType = ProductQuantityKey.ProductSizeQuantityOwnStock) => {
63
+ const mapSizeQuantites = (product, stockType = QunatityType.ProductSizeQuantityOwnStock) => {
62
64
  const obj = {};
63
65
  if (!product.productStocksData)
64
66
  return obj;
@@ -89,6 +91,7 @@ const mapProductCodes = (product, codeType = 'productSizeCodeProducer') => {
89
91
  return obj;
90
92
  };
91
93
  export default {
94
+ QUANTITY_TYPE_ENUM: QunatityType,
92
95
  getIaiCode,
93
96
  sumProductQuantities,
94
97
  mapSizeQuantites,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "idosell",
3
- "version": "0.4.12",
3
+ "version": "0.4.13",
4
4
  "description": "Idosell 3 REST connector",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/gateways.d.ts",