@commercengine/pos 0.4.3 → 0.4.5

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/README.md CHANGED
@@ -577,9 +577,9 @@ If you're migrating from the storefront SDK:
577
577
  ### Updated Initialization
578
578
  ```typescript
579
579
  // Old (storefront)
580
- const storefront = new StorefrontSDK({
581
- storeId: 'your-store-id'
582
- // apiKey was optional
580
+ const storefront = createStorefront({
581
+ storeId: 'your-store-id',
582
+ apiKey: 'your-api-key'
583
583
  });
584
584
 
585
585
  // New (POS)
@@ -619,4 +619,4 @@ pnpm run check-exports
619
619
 
620
620
  ## Support
621
621
 
622
- For issues, questions, or feature requests, please contact the Commerce Engine team or check the main repository documentation.
622
+ For issues, questions, or feature requests, please contact the Commerce Engine team or check the main repository documentation.
@@ -1072,6 +1072,12 @@ interface components {
1072
1072
  url_zoom?: string;
1073
1073
  file_id?: string; /** @enum {unknown} */
1074
1074
  file_type?: "image";
1075
+ }; /** SalesChannel */
1076
+ SalesChannel: {
1077
+ id: string;
1078
+ name: $Read<string>; /** @enum {string} */
1079
+ kind: "storefront" | "marketplace";
1080
+ active: $Read<boolean>;
1075
1081
  }; /** Shipment */
1076
1082
  Shipment: components["schemas"]["ShipmentInfo"] & {
1077
1083
  shipment_items?: components["schemas"]["ShipmentItem"][];
@@ -1242,7 +1248,8 @@ interface components {
1242
1248
  can_collect: boolean; /** @description this field will be always true for warehouse_type = retail-store. */
1243
1249
  is_checkout_point: boolean;
1244
1250
  accepts_returns: boolean;
1245
- opening_hours?: components["schemas"]["OpeningHours"];
1251
+ opening_hours?: components["schemas"]["OpeningHours"]; /** @description channels associated with the warehouse */
1252
+ channels?: $Read<components["schemas"]["SalesChannel"][]>;
1246
1253
  }; /** WarehouseBasicDetail */
1247
1254
  WarehouseBasicDetail: {
1248
1255
  id?: string;
@@ -1880,6 +1887,7 @@ type Pagination = Readable<components['schemas']['Pagination']>;
1880
1887
  type PartialCollectAndDelivery = Readable<components['schemas']['PartialCollectAndDelivery']>;
1881
1888
  type PaymentStatus = Readable<components['schemas']['PaymentStatus']>;
1882
1889
  type ProductImage = Readable<components['schemas']['ProductImage']>;
1890
+ type SalesChannel = Readable<components['schemas']['SalesChannel']>;
1883
1891
  type Shipment = Readable<components['schemas']['Shipment']>;
1884
1892
  type ShipmentAction = Readable<components['schemas']['ShipmentAction']>;
1885
1893
  type ShipmentActivity = Readable<components['schemas']['ShipmentActivity']>;
@@ -1955,4 +1963,4 @@ type PosUpdateShipmentContent = PosUpdateShipmentResponse['content'];
1955
1963
  type PosUpdateShipmentPathParams = paths['/pos/shipping/shipments/{reference_number}/manual-update']['put']['parameters']['path'];
1956
1964
  type PosUpdateShipmentBody = Writable<NonNullable<paths['/pos/shipping/shipments/{reference_number}/manual-update']['put']['requestBody']>['content']['application/json']>;
1957
1965
  //#endregion
1958
- export { AppliedCoupon, AppliedPromotion, BankTransfer, BusinessInfo, CardPayment, CheckInventoryResponse, CollectInStoreFulfillment, Customer, CustomerAddress, CustomerDetail, CustomerInfo, CustomerLoyalty, CustomerSegment, CustomerStatus, DeliveryFulfillment, FulfillmentItem, FulfillmentPreference, InventoryAction, InventoryActivity, InventoryDetail, InventoryStatus, Invoice, InvoiceDetail, InvoiceItem, ItemWiseInventory, KycStatus, LotBatchWiseInventory, LoyaltyPointPayment, NetbankingPayment, NotificationChannelPreferences, NotificationPreferences, OpeningHours, Order, OrderAction, OrderActivity, OrderDetail, OrderItem, OrderList, OrderPayment, OrderPaymentInfo, OrderReceiptJsonFormat, OrderShipment, OrderShipmentDetail, OrderStatus, Pagination, PartialCollectAndDelivery, PaymentStatus, PosCheckOrderInventoryContent, PosCheckOrderInventoryPathParams, PosCheckOrderInventoryResponse, PosGetCustomerDetailContent, PosGetCustomerDetailPathParams, PosGetCustomerDetailResponse, PosGetOrderDetailContent, PosGetOrderDetailPathParams, PosGetOrderDetailResponse, PosGetOrderInvoiceContent, PosGetOrderInvoicePathParams, PosGetOrderInvoiceQuery, PosGetOrderInvoiceResponse, PosGetOrderReceiptContent, PosGetOrderReceiptPathParams, PosGetOrderReceiptQuery, PosGetOrderReceiptResponse, PosGetShipmentActivitiesContent, PosGetShipmentActivitiesPathParams, PosGetShipmentActivitiesResponse, PosGetShipmentDetailContent, PosGetShipmentDetailPathParams, PosGetShipmentDetailResponse, PosGetShipmentInvoiceContent, PosGetShipmentInvoicePathParams, PosGetShipmentInvoiceQuery, PosGetShipmentInvoiceResponse, PosListCustomersContent, PosListCustomersQuery, PosListCustomersResponse, PosListInventoryActivityContent, PosListInventoryActivityQuery, PosListInventoryActivityResponse, PosListInventoryContent, PosListInventoryDetailContent, PosListInventoryDetailQuery, PosListInventoryDetailResponse, PosListInventoryQuery, PosListInventoryResponse, PosListOrderActivityContent, PosListOrderActivityPathParams, PosListOrderActivityResponse, PosListOrderShipmentsContent, PosListOrderShipmentsPathParams, PosListOrderShipmentsResponse, PosListOrdersContent, PosListOrdersQuery, PosListOrdersResponse, PosListShipmentsContent, PosListShipmentsQuery, PosListShipmentsResponse, PosRefundShortfallBody, PosRefundShortfallPathParams, PosRefundShortfallResponse, PosUpdateShipmentBody, PosUpdateShipmentContent, PosUpdateShipmentPathParams, PosUpdateShipmentResponse, ProductImage, type Readable, Shipment, ShipmentAction, ShipmentActivity, ShipmentBox, ShipmentDetail, ShipmentInfo, ShipmentItem, ShipmentList, ShipmentPackaging, ShipmentProgression, ShipmentStatus, UpiPayment, WalletPayment, Warehouse, WarehouseBasicDetail, WarehouseWiseInventory, type Writable, type components, type operations, type paths };
1966
+ export type { AppliedCoupon, AppliedPromotion, BankTransfer, BusinessInfo, CardPayment, CheckInventoryResponse, CollectInStoreFulfillment, Customer, CustomerAddress, CustomerDetail, CustomerInfo, CustomerLoyalty, CustomerSegment, CustomerStatus, DeliveryFulfillment, FulfillmentItem, FulfillmentPreference, InventoryAction, InventoryActivity, InventoryDetail, InventoryStatus, Invoice, InvoiceDetail, InvoiceItem, ItemWiseInventory, KycStatus, LotBatchWiseInventory, LoyaltyPointPayment, NetbankingPayment, NotificationChannelPreferences, NotificationPreferences, OpeningHours, Order, OrderAction, OrderActivity, OrderDetail, OrderItem, OrderList, OrderPayment, OrderPaymentInfo, OrderReceiptJsonFormat, OrderShipment, OrderShipmentDetail, OrderStatus, Pagination, PartialCollectAndDelivery, PaymentStatus, PosCheckOrderInventoryContent, PosCheckOrderInventoryPathParams, PosCheckOrderInventoryResponse, PosGetCustomerDetailContent, PosGetCustomerDetailPathParams, PosGetCustomerDetailResponse, PosGetOrderDetailContent, PosGetOrderDetailPathParams, PosGetOrderDetailResponse, PosGetOrderInvoiceContent, PosGetOrderInvoicePathParams, PosGetOrderInvoiceQuery, PosGetOrderInvoiceResponse, PosGetOrderReceiptContent, PosGetOrderReceiptPathParams, PosGetOrderReceiptQuery, PosGetOrderReceiptResponse, PosGetShipmentActivitiesContent, PosGetShipmentActivitiesPathParams, PosGetShipmentActivitiesResponse, PosGetShipmentDetailContent, PosGetShipmentDetailPathParams, PosGetShipmentDetailResponse, PosGetShipmentInvoiceContent, PosGetShipmentInvoicePathParams, PosGetShipmentInvoiceQuery, PosGetShipmentInvoiceResponse, PosListCustomersContent, PosListCustomersQuery, PosListCustomersResponse, PosListInventoryActivityContent, PosListInventoryActivityQuery, PosListInventoryActivityResponse, PosListInventoryContent, PosListInventoryDetailContent, PosListInventoryDetailQuery, PosListInventoryDetailResponse, PosListInventoryQuery, PosListInventoryResponse, PosListOrderActivityContent, PosListOrderActivityPathParams, PosListOrderActivityResponse, PosListOrderShipmentsContent, PosListOrderShipmentsPathParams, PosListOrderShipmentsResponse, PosListOrdersContent, PosListOrdersQuery, PosListOrdersResponse, PosListShipmentsContent, PosListShipmentsQuery, PosListShipmentsResponse, PosRefundShortfallBody, PosRefundShortfallPathParams, PosRefundShortfallResponse, PosUpdateShipmentBody, PosUpdateShipmentContent, PosUpdateShipmentPathParams, PosUpdateShipmentResponse, ProductImage, Readable, SalesChannel, Shipment, ShipmentAction, ShipmentActivity, ShipmentBox, ShipmentDetail, ShipmentInfo, ShipmentItem, ShipmentList, ShipmentPackaging, ShipmentProgression, ShipmentStatus, UpiPayment, WalletPayment, Warehouse, WarehouseBasicDetail, WarehouseWiseInventory, Writable, components, operations, paths };
@@ -1 +1 @@
1
- export { };
1
+ export {};
package/dist/index.d.mts CHANGED
@@ -1627,6 +1627,11 @@ interface components {
1627
1627
  type: "multi-select"; /** @description For multi-select attributes */
1628
1628
  value: string[];
1629
1629
  };
1630
+ /**
1631
+ * NachPayment
1632
+ * @description NACH mandate payment via LotusPay.
1633
+ */
1634
+ NachPayment: components["schemas"]["PaymentInfo"];
1630
1635
  /**
1631
1636
  * NetbankingPayment
1632
1637
  * @description Payments using payment gateway netbanking option.
@@ -1736,7 +1741,7 @@ interface components {
1736
1741
  * @description payment mode for refund.
1737
1742
  * @enum {string}
1738
1743
  */
1739
- payment_mode?: "original-payment-mode" | "bank-transfer";
1744
+ payment_mode?: "original-payment-mode" | "bank-transfer" | "nach-mandate";
1740
1745
  };
1741
1746
  feedback?: string | null;
1742
1747
  }; /** OrderDetail */
@@ -1793,7 +1798,7 @@ interface components {
1793
1798
  * OrderPayment
1794
1799
  * @description Order Payment
1795
1800
  */
1796
- OrderPayment: components["schemas"]["CardPayment"] | components["schemas"]["NetbankingPayment"] | components["schemas"]["UpiPayment"] | components["schemas"]["WalletPayment"] | components["schemas"]["BankTransfer"];
1801
+ OrderPayment: components["schemas"]["CardPayment"] | components["schemas"]["NetbankingPayment"] | components["schemas"]["UpiPayment"] | components["schemas"]["WalletPayment"] | components["schemas"]["BankTransfer"] | components["schemas"]["NachPayment"];
1797
1802
  /**
1798
1803
  * OrderRefund
1799
1804
  * @description Order refund model
@@ -1803,7 +1808,7 @@ interface components {
1803
1808
  refund_amount?: number; /** Format: date-time */
1804
1809
  refund_date?: string; /** @enum {string} */
1805
1810
  status?: "pending" | "approved" | "success" | "failed"; /** @enum {string} */
1806
- payment_mode?: "PaymentGateway" | "ClubAI" | "BankTransfer";
1811
+ payment_mode?: "original-payment-mode" | "loyalty-point" | "bank-transfer" | "nach-mandate";
1807
1812
  payment_method?: string;
1808
1813
  payment_reference_number?: string;
1809
1814
  bank_account_number?: string;
@@ -2124,22 +2129,9 @@ interface components {
2124
2129
  * Format: date-time
2125
2130
  * @description The ISO 8601 date-time for when review was first submitted or last modified by the original submitter.
2126
2131
  */
2127
- review_date?: $Read$1<string>;
2128
- images?: {
2129
- blur_url?: string;
2130
- thumbnail_url?: string;
2131
- standard_url?: string;
2132
- }[];
2133
- videos?: {
2134
- cover_image_url?: string;
2135
- video_preview_url?: string;
2136
- playback?: {
2137
- hls?: string;
2138
- dash?: string;
2139
- }; /** @description seconds */
2140
- duration?: string; /** @description bytes */
2141
- size?: string;
2142
- }[];
2132
+ review_date?: $Read$1<string>; /** @description Product review images ordered by display priority. */
2133
+ images?: components["schemas"]["ProductImage"][];
2134
+ videos?: components["schemas"]["ProductVideo"][];
2143
2135
  /**
2144
2136
  * Format: date-time
2145
2137
  * @description The ISO 8601 date-time for when review is created.
@@ -2372,6 +2364,7 @@ interface components {
2372
2364
  is_default: $Read$1<boolean>; /** @description This object contains multiple dynamic keys. Each key is a string derived from the attribute key, and the value is an object of the type `AssociatedOption`. */
2373
2365
  associated_options: components["schemas"]["AssociatedOption"];
2374
2366
  images: components["schemas"]["ProductImage"][];
2367
+ videos: components["schemas"]["ProductVideo"][];
2375
2368
  pricing: components["schemas"]["ProductPricing"];
2376
2369
  subscription: components["schemas"]["ProductSubscription"][];
2377
2370
  promotion: components["schemas"]["ProductPromotion"];
@@ -2392,7 +2385,6 @@ interface components {
2392
2385
  variant_options: components["schemas"]["VariantOption"][];
2393
2386
  product_attributes: components["schemas"]["ProductAttribute"][];
2394
2387
  variant_attributes: components["schemas"]["ProductAttribute"][];
2395
- videos: components["schemas"]["ProductVideo"][];
2396
2388
  shipping: components["schemas"]["ProductShipping"];
2397
2389
  seo: components["schemas"]["Seo"];
2398
2390
  metadata: {
@@ -5361,6 +5353,12 @@ interface components$1 {
5361
5353
  url_zoom?: string;
5362
5354
  file_id?: string; /** @enum {unknown} */
5363
5355
  file_type?: "image";
5356
+ }; /** SalesChannel */
5357
+ SalesChannel: {
5358
+ id: string;
5359
+ name: $Read<string>; /** @enum {string} */
5360
+ kind: "storefront" | "marketplace";
5361
+ active: $Read<boolean>;
5364
5362
  }; /** Shipment */
5365
5363
  Shipment: components$1["schemas"]["ShipmentInfo"] & {
5366
5364
  shipment_items?: components$1["schemas"]["ShipmentItem"][];
@@ -5531,7 +5529,8 @@ interface components$1 {
5531
5529
  can_collect: boolean; /** @description this field will be always true for warehouse_type = retail-store. */
5532
5530
  is_checkout_point: boolean;
5533
5531
  accepts_returns: boolean;
5534
- opening_hours?: components$1["schemas"]["OpeningHours"];
5532
+ opening_hours?: components$1["schemas"]["OpeningHours"]; /** @description channels associated with the warehouse */
5533
+ channels?: $Read<components$1["schemas"]["SalesChannel"][]>;
5535
5534
  }; /** WarehouseBasicDetail */
5536
5535
  WarehouseBasicDetail: {
5537
5536
  id?: string;
@@ -6352,7 +6351,6 @@ declare class ResponseUtils {
6352
6351
  */
6353
6352
  declare class DebugLogger {
6354
6353
  private logger;
6355
- private responseTextCache;
6356
6354
  constructor(logger?: DebugLoggerFn);
6357
6355
  /**
6358
6356
  * Log debug information about API request
@@ -6367,11 +6365,13 @@ declare class DebugLogger {
6367
6365
  */
6368
6366
  logError(message: string, error: any): void;
6369
6367
  /**
6370
- * Get cached response text for a URL (if available)
6368
+ * Compatibility shim retained for older internal callers.
6369
+ * Response bodies are no longer cached by the debug logger.
6371
6370
  */
6372
- getCachedResponseText(url: string): string | null;
6371
+ getCachedResponseText(_url: string): string | null;
6373
6372
  /**
6374
- * Clear cached response texts
6373
+ * Compatibility shim retained for older internal callers.
6374
+ * Response bodies are no longer cached by the debug logger.
6375
6375
  */
6376
6376
  clearCache(): void;
6377
6377
  info(message: string, data?: any): void;
@@ -6404,6 +6404,20 @@ declare function createTimeoutMiddleware(timeoutMs: number): {
6404
6404
  }: {
6405
6405
  request: Request;
6406
6406
  }) => Promise<Request>;
6407
+ onResponse: ({
6408
+ request,
6409
+ response
6410
+ }: {
6411
+ request: Request;
6412
+ response: Response;
6413
+ }) => Promise<Response>;
6414
+ onError: ({
6415
+ request,
6416
+ error
6417
+ }: {
6418
+ request: Request;
6419
+ error: unknown;
6420
+ }) => Promise<never>;
6407
6421
  }; //#endregion
6408
6422
  //#region src/middleware/headers.d.ts
6409
6423
  /**
@@ -6591,6 +6605,7 @@ type InapplicablePromotion = Readable<components['schemas']['InapplicablePromoti
6591
6605
  type Item = Readable<components['schemas']['Item']>;
6592
6606
  type LotBatchDetail = Readable<components['schemas']['LotBatchDetail']>;
6593
6607
  type MultiSelectAttribute = Readable<components['schemas']['MultiSelectAttribute']>;
6608
+ type NachPayment = Readable<components['schemas']['NachPayment']>;
6594
6609
  type NetbankingPayment = Readable<components['schemas']['NetbankingPayment']>;
6595
6610
  type NumberAttribute = Readable<components['schemas']['NumberAttribute']>;
6596
6611
  type Order = Readable<components['schemas']['Order']>;
@@ -8819,5 +8834,5 @@ declare class PosSDK {
8819
8834
  getTenantId(): Promise<string | null>;
8820
8835
  }
8821
8836
  //#endregion
8822
- export { AcceleratedRewardCouponPromotion, AcceleratedRewardRule, AdditionalProductDetails, ApiErrorResponse, ApiResult, ApplicableCoupon, ApplicablePromotion, AppliedCoupon, AppliedPromotion, AssociatedOption, AutoScaleBasedOnAmount, AutoScaleBasedOnQuantity, BankTransfer, BaseAPIClient, BaseSDKOptions, BooleanAttribute, BrowserTokenStorage, BuyXGetYCouponPromotion, BuyXGetYRule, BuyXGetYRuleBasedOnAmount, BuyXGetYRuleBasedOnQuantity, CardPayment, Cart, CartBasedFulfillmentOptionInput, CartItem, CartShipment, Category, ClaimPosDeviceContent, ClaimPosDevicePathParams, ClaimPosDeviceResponse, CollectInStore, CollectInStoreAddress, CollectInStoreFulfillment, CollectInStoreFulfillmentInput, ColorAttribute, ColorOption, Coupon, CouponPromotionCommonDetail, CouponType, CreatePosOrderBody, CreatePosOrderContent, CreatePosOrderResponse, Currency, CustomSlabsBasedOnAmount, CustomSlabsBasedOnQuantity, CustomerAddress, CustomerAddressInput, DateAttribute, DebugLogger, DebugLoggerFn, DeliveryFulfillment, DeliveryFulfillmentInput, DeliveryOption, DiscountBasedPromotion, DiscountCouponPromotion, DiscountRule, Environment, FixedAmountDiscountRule, FixedPriceCouponPromotion, FixedPricePromotion, FixedPriceRule, FixedPriceRuleBasedAmount, FixedPriceRuleBasedQuantity, FreeGoodCouponPromotion, FreeGoodsPromotion, FreeGoodsRule, FreeShipingCouponPromotion, FulfillmentItem, FulfillmentItemInput, FulfillmentPreference, FulfillmentPreferenceInput, GetPosFulfillmentOptionsBody, GetPosFulfillmentOptionsContent, GetPosFulfillmentOptionsResponse, GetPosUserContent, GetPosUserPathParams, GetPosUserResponse, HeaderConfig, InapplicableCoupon, InapplicablePromotion, Item, ListPosDevicesContent, ListPosDevicesResponse, ListPosLocationsContent, ListPosLocationsResponse, LoginPosDeviceWithEmailBody, LoginPosDeviceWithEmailContent, LoginPosDeviceWithEmailHeaderParams, LoginPosDeviceWithEmailResponse, LoginPosDeviceWithPhoneBody, LoginPosDeviceWithPhoneContent, LoginPosDeviceWithPhoneHeaderParams, LoginPosDeviceWithPhoneResponse, LoginPosDeviceWithWhatsappBody, LoginPosDeviceWithWhatsappContent, LoginPosDeviceWithWhatsappHeaderParams, LoginPosDeviceWithWhatsappResponse, LogoutFromPosDeviceResponse, LotBatchDetail, MemoryTokenStorage, MultiSelectAttribute, NetbankingPayment, NumberAttribute, Order, OrderDetail, OrderItem, OrderPayment, OrderRefund, OrderShipment, Pagination, PairPosDeviceBody, PairPosDeviceContent, PairPosDeviceResponse, PartialCollectAndDelivery, PartialCollectAndDeliveryInput, PayWithCardInput, PayWithCashInput, PayWithUpiInput, PaymentInfo, PercentageDiscountRule, PosAPIClient, PosApplyCouponBody, PosApplyCouponContent, PosApplyCouponPathParams, PosApplyCouponResponse, PosClient, PosCreateCartAddressBody, PosCreateCartAddressContent, PosCreateCartAddressPathParams, PosCreateCartAddressResponse, PosCreateCartBody, PosCreateCartContent, PosCreateCartResponse, PosDeleteCartPathParams, PosDeleteCartResponse, PosDevice, PosDeviceClaimedUser, PosEvaluateCouponsContent, PosEvaluateCouponsPathParams, PosEvaluateCouponsResponse, PosEvaluatePromotionsContent, PosEvaluatePromotionsPathParams, PosEvaluatePromotionsResponse, PosGetCartContent, PosGetCartPathParams, PosGetCartResponse, PosGetPaymentStatusContent, PosGetPaymentStatusPathParams, PosGetPaymentStatusResponse, PosGetProductDetailContent, PosGetProductDetailHeaderParams, PosGetProductDetailPathParams, PosGetProductDetailQuery, PosGetProductDetailResponse, PosGetUserCartContent, PosGetUserCartPathParams, PosGetUserCartResponse, PosGetVariantDetailContent, PosGetVariantDetailHeaderParams, PosGetVariantDetailPathParams, PosGetVariantDetailQuery, PosGetVariantDetailResponse, PosListCategoriesContent, PosListCategoriesQuery, PosListCategoriesResponse, PosListCouponsContent, PosListCouponsHeaderParams, PosListCouponsResponse, PosListCrosssellProductsContent, PosListCrosssellProductsHeaderParams, PosListCrosssellProductsQuery, PosListCrosssellProductsResponse, PosListProductReviewsContent, PosListProductReviewsPathParams, PosListProductReviewsQuery, PosListProductReviewsResponse, PosListProductVariantsContent, PosListProductVariantsHeaderParams, PosListProductVariantsPathParams, PosListProductVariantsQuery, PosListProductVariantsResponse, PosListProductsContent, PosListProductsHeaderParams, PosListProductsQuery, PosListProductsResponse, PosListPromotionsContent, PosListPromotionsHeaderParams, PosListPromotionsResponse, PosListSimilarProductsContent, PosListSimilarProductsHeaderParams, PosListSimilarProductsQuery, PosListSimilarProductsResponse, PosListSkusContent, PosListSkusHeaderParams, PosListSkusQuery, PosListSkusResponse, PosListUpsellProductsContent, PosListUpsellProductsHeaderParams, PosListUpsellProductsQuery, PosListUpsellProductsResponse, PosLocation, PosRedeemCreditBalanceBody, PosRedeemCreditBalanceContent, PosRedeemCreditBalancePathParams, PosRedeemCreditBalanceResponse, PosRedeemLoyaltyPointsBody, PosRedeemLoyaltyPointsContent, PosRedeemLoyaltyPointsPathParams, PosRedeemLoyaltyPointsResponse, PosRemoveCouponContent, PosRemoveCouponPathParams, PosRemoveCouponResponse, PosRemoveCreditBalanceContent, PosRemoveCreditBalancePathParams, PosRemoveCreditBalanceResponse, PosRemoveLoyaltyPointsContent, PosRemoveLoyaltyPointsPathParams, PosRemoveLoyaltyPointsResponse, PosSDK, PosSDK as default, PosSDKOptions, PosSearchProductsBody, PosSearchProductsContent, PosSearchProductsHeaderParams, PosSearchProductsResponse, PosUpdateCartBody, PosUpdateCartContent, PosUpdateCartPathParams, PosUpdateCartResponse, PosUpdateCustomerWithEmailInput, PosUpdateCustomerWithIdInput, PosUpdateCustomerWithPhoneInput, PosUpdateFulfillmentPreferenceBody, PosUpdateFulfillmentPreferenceContent, PosUpdateFulfillmentPreferencePathParams, PosUpdateFulfillmentPreferenceResponse, PosUser, Product, ProductAttribute, ProductBundleItem, ProductCategory, ProductDetail, ProductImage, ProductPricing, ProductPromotion, ProductReview, ProductShipping, ProductSubscription, ProductVideo, Promotion, PromotionType, type Readable, RefreshPosAccessTokenBody, RefreshPosAccessTokenContent, RefreshPosAccessTokenResponse, ResponseUtils, SearchProductInput, SellerInfo, Seo, ShipmentItem, ShipmentStatus, SingleSelectAttribute, SingleSelectOption, SupportedDefaultHeaders, TextAttribute, type TokenStorage, UnclaimPosDeviceContent, UnclaimPosDevicePathParams, UnclaimPosDeviceResponse, UpdateCartItemInput, UpdatePosCartCustomerBody, UpdatePosCartCustomerContent, UpdatePosCartCustomerPathParams, UpdatePosCartCustomerResponse, UpiPayment, type UserInfo, Variant, VariantDetail, VariantOption, VerifyPosLoginOtpBody, VerifyPosLoginOtpContent, VerifyPosLoginOtpResponse, VolumeBasedCouponPromotion, VolumeBasedPromotion, VolumeBasedRule, WalletPayment, type Writable, type components, createDebugMiddleware, createTimeoutMiddleware, executeRequest, extractRequestBody, getPathnameFromUrl, mergeAndTransformHeaders, mergeHeaders, type operations, type paths, transformHeaders };
8837
+ export { type AcceleratedRewardCouponPromotion, type AcceleratedRewardRule, type AdditionalProductDetails, type ApiErrorResponse, type ApiResult, type ApplicableCoupon, type ApplicablePromotion, type AppliedCoupon, type AppliedPromotion, type AssociatedOption, type AutoScaleBasedOnAmount, type AutoScaleBasedOnQuantity, type BankTransfer, type BaseAPIClient, type BaseSDKOptions, type BooleanAttribute, BrowserTokenStorage, type BuyXGetYCouponPromotion, type BuyXGetYRule, type BuyXGetYRuleBasedOnAmount, type BuyXGetYRuleBasedOnQuantity, type CardPayment, type Cart, type CartBasedFulfillmentOptionInput, type CartItem, type CartShipment, type Category, type ClaimPosDeviceContent, type ClaimPosDevicePathParams, type ClaimPosDeviceResponse, type CollectInStore, type CollectInStoreAddress, type CollectInStoreFulfillment, type CollectInStoreFulfillmentInput, type ColorAttribute, type ColorOption, type Coupon, type CouponPromotionCommonDetail, type CouponType, type CreatePosOrderBody, type CreatePosOrderContent, type CreatePosOrderResponse, type Currency, type CustomSlabsBasedOnAmount, type CustomSlabsBasedOnQuantity, type CustomerAddress, type CustomerAddressInput, type DateAttribute, type DebugLogger, type DebugLoggerFn, type DeliveryFulfillment, type DeliveryFulfillmentInput, type DeliveryOption, type DiscountBasedPromotion, type DiscountCouponPromotion, type DiscountRule, Environment, type FixedAmountDiscountRule, type FixedPriceCouponPromotion, type FixedPricePromotion, type FixedPriceRule, type FixedPriceRuleBasedAmount, type FixedPriceRuleBasedQuantity, type FreeGoodCouponPromotion, type FreeGoodsPromotion, type FreeGoodsRule, type FreeShipingCouponPromotion, type FulfillmentItem, type FulfillmentItemInput, type FulfillmentPreference, type FulfillmentPreferenceInput, type GetPosFulfillmentOptionsBody, type GetPosFulfillmentOptionsContent, type GetPosFulfillmentOptionsResponse, type GetPosUserContent, type GetPosUserPathParams, type GetPosUserResponse, type HeaderConfig, type InapplicableCoupon, type InapplicablePromotion, type Item, type ListPosDevicesContent, type ListPosDevicesResponse, type ListPosLocationsContent, type ListPosLocationsResponse, type LoginPosDeviceWithEmailBody, type LoginPosDeviceWithEmailContent, type LoginPosDeviceWithEmailHeaderParams, type LoginPosDeviceWithEmailResponse, type LoginPosDeviceWithPhoneBody, type LoginPosDeviceWithPhoneContent, type LoginPosDeviceWithPhoneHeaderParams, type LoginPosDeviceWithPhoneResponse, type LoginPosDeviceWithWhatsappBody, type LoginPosDeviceWithWhatsappContent, type LoginPosDeviceWithWhatsappHeaderParams, type LoginPosDeviceWithWhatsappResponse, type LogoutFromPosDeviceResponse, type LotBatchDetail, MemoryTokenStorage, type MultiSelectAttribute, type NachPayment, type NetbankingPayment, type NumberAttribute, type Order, type OrderDetail, type OrderItem, type OrderPayment, type OrderRefund, type OrderShipment, type Pagination, type PairPosDeviceBody, type PairPosDeviceContent, type PairPosDeviceResponse, type PartialCollectAndDelivery, type PartialCollectAndDeliveryInput, type PayWithCardInput, type PayWithCashInput, type PayWithUpiInput, type PaymentInfo, type PercentageDiscountRule, PosAPIClient, type PosApplyCouponBody, type PosApplyCouponContent, type PosApplyCouponPathParams, type PosApplyCouponResponse, PosClient, type PosCreateCartAddressBody, type PosCreateCartAddressContent, type PosCreateCartAddressPathParams, type PosCreateCartAddressResponse, type PosCreateCartBody, type PosCreateCartContent, type PosCreateCartResponse, type PosDeleteCartPathParams, type PosDeleteCartResponse, type PosDevice, type PosDeviceClaimedUser, type PosEvaluateCouponsContent, type PosEvaluateCouponsPathParams, type PosEvaluateCouponsResponse, type PosEvaluatePromotionsContent, type PosEvaluatePromotionsPathParams, type PosEvaluatePromotionsResponse, type PosGetCartContent, type PosGetCartPathParams, type PosGetCartResponse, type PosGetPaymentStatusContent, type PosGetPaymentStatusPathParams, type PosGetPaymentStatusResponse, type PosGetProductDetailContent, type PosGetProductDetailHeaderParams, type PosGetProductDetailPathParams, type PosGetProductDetailQuery, type PosGetProductDetailResponse, type PosGetUserCartContent, type PosGetUserCartPathParams, type PosGetUserCartResponse, type PosGetVariantDetailContent, type PosGetVariantDetailHeaderParams, type PosGetVariantDetailPathParams, type PosGetVariantDetailQuery, type PosGetVariantDetailResponse, type PosListCategoriesContent, type PosListCategoriesQuery, type PosListCategoriesResponse, type PosListCouponsContent, type PosListCouponsHeaderParams, type PosListCouponsResponse, type PosListCrosssellProductsContent, type PosListCrosssellProductsHeaderParams, type PosListCrosssellProductsQuery, type PosListCrosssellProductsResponse, type PosListProductReviewsContent, type PosListProductReviewsPathParams, type PosListProductReviewsQuery, type PosListProductReviewsResponse, type PosListProductVariantsContent, type PosListProductVariantsHeaderParams, type PosListProductVariantsPathParams, type PosListProductVariantsQuery, type PosListProductVariantsResponse, type PosListProductsContent, type PosListProductsHeaderParams, type PosListProductsQuery, type PosListProductsResponse, type PosListPromotionsContent, type PosListPromotionsHeaderParams, type PosListPromotionsResponse, type PosListSimilarProductsContent, type PosListSimilarProductsHeaderParams, type PosListSimilarProductsQuery, type PosListSimilarProductsResponse, type PosListSkusContent, type PosListSkusHeaderParams, type PosListSkusQuery, type PosListSkusResponse, type PosListUpsellProductsContent, type PosListUpsellProductsHeaderParams, type PosListUpsellProductsQuery, type PosListUpsellProductsResponse, type PosLocation, type PosRedeemCreditBalanceBody, type PosRedeemCreditBalanceContent, type PosRedeemCreditBalancePathParams, type PosRedeemCreditBalanceResponse, type PosRedeemLoyaltyPointsBody, type PosRedeemLoyaltyPointsContent, type PosRedeemLoyaltyPointsPathParams, type PosRedeemLoyaltyPointsResponse, type PosRemoveCouponContent, type PosRemoveCouponPathParams, type PosRemoveCouponResponse, type PosRemoveCreditBalanceContent, type PosRemoveCreditBalancePathParams, type PosRemoveCreditBalanceResponse, type PosRemoveLoyaltyPointsContent, type PosRemoveLoyaltyPointsPathParams, type PosRemoveLoyaltyPointsResponse, PosSDK, PosSDK as default, PosSDKOptions, type PosSearchProductsBody, type PosSearchProductsContent, type PosSearchProductsHeaderParams, type PosSearchProductsResponse, type PosUpdateCartBody, type PosUpdateCartContent, type PosUpdateCartPathParams, type PosUpdateCartResponse, type PosUpdateCustomerWithEmailInput, type PosUpdateCustomerWithIdInput, type PosUpdateCustomerWithPhoneInput, type PosUpdateFulfillmentPreferenceBody, type PosUpdateFulfillmentPreferenceContent, type PosUpdateFulfillmentPreferencePathParams, type PosUpdateFulfillmentPreferenceResponse, type PosUser, type Product, type ProductAttribute, type ProductBundleItem, type ProductCategory, type ProductDetail, type ProductImage, type ProductPricing, type ProductPromotion, type ProductReview, type ProductShipping, type ProductSubscription, type ProductVideo, type Promotion, type PromotionType, type Readable, type RefreshPosAccessTokenBody, type RefreshPosAccessTokenContent, type RefreshPosAccessTokenResponse, ResponseUtils, type SearchProductInput, type SellerInfo, type Seo, type ShipmentItem, type ShipmentStatus, type SingleSelectAttribute, type SingleSelectOption, SupportedDefaultHeaders, type TextAttribute, type TokenStorage, type UnclaimPosDeviceContent, type UnclaimPosDevicePathParams, type UnclaimPosDeviceResponse, type UpdateCartItemInput, type UpdatePosCartCustomerBody, type UpdatePosCartCustomerContent, type UpdatePosCartCustomerPathParams, type UpdatePosCartCustomerResponse, type UpiPayment, type UserInfo, type Variant, type VariantDetail, type VariantOption, type VerifyPosLoginOtpBody, type VerifyPosLoginOtpContent, type VerifyPosLoginOtpResponse, type VolumeBasedCouponPromotion, type VolumeBasedPromotion, type VolumeBasedRule, type WalletPayment, type Writable, type components, type createDebugMiddleware, type createTimeoutMiddleware, type executeRequest, type extractRequestBody, type getPathnameFromUrl, type mergeAndTransformHeaders, type mergeHeaders, type operations, type paths, type transformHeaders };
8823
8838
  //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -1,5 +1,4 @@
1
1
  import createClient from "openapi-fetch";
2
-
3
2
  //#region ../sdk-core/dist/index.mjs
4
3
  /**
5
4
  * Response utilities for debugging and working with Response objects
@@ -75,7 +74,6 @@ var ResponseUtils = class {
75
74
  */
76
75
  var DebugLogger = class {
77
76
  logger;
78
- responseTextCache = /* @__PURE__ */ new Map();
79
77
  constructor(logger) {
80
78
  this.logger = logger || ((level, message, data) => {
81
79
  console.log(`[${level.toUpperCase()}]`, message);
@@ -98,7 +96,6 @@ var DebugLogger = class {
98
96
  * Log debug information about API response
99
97
  */
100
98
  async logResponse(response, responseBody) {
101
- if (responseBody && typeof responseBody === "string") this.responseTextCache.set(response.url, responseBody);
102
99
  this.logger("info", "API Response Debug Info", {
103
100
  url: response.url,
104
101
  status: response.status,
@@ -122,17 +119,17 @@ var DebugLogger = class {
122
119
  this.logger("error", message, error);
123
120
  }
124
121
  /**
125
- * Get cached response text for a URL (if available)
122
+ * Compatibility shim retained for older internal callers.
123
+ * Response bodies are no longer cached by the debug logger.
126
124
  */
127
- getCachedResponseText(url) {
128
- return this.responseTextCache.get(url) || null;
125
+ getCachedResponseText(_url) {
126
+ return null;
129
127
  }
130
128
  /**
131
- * Clear cached response texts
129
+ * Compatibility shim retained for older internal callers.
130
+ * Response bodies are no longer cached by the debug logger.
132
131
  */
133
- clearCache() {
134
- this.responseTextCache.clear();
135
- }
132
+ clearCache() {}
136
133
  info(message, data) {
137
134
  this.logger("info", message, data);
138
135
  }
@@ -218,14 +215,33 @@ function createDebugMiddleware(logger) {
218
215
  * @returns Middleware object with onRequest handler
219
216
  */
220
217
  function createTimeoutMiddleware(timeoutMs) {
221
- return { onRequest: async ({ request }) => {
222
- const controller = new AbortController();
223
- const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
224
- if (request.signal) request.signal.addEventListener("abort", () => controller.abort());
225
- const newRequest = new Request(request, { signal: controller.signal });
226
- controller.signal.addEventListener("abort", () => clearTimeout(timeoutId));
227
- return newRequest;
228
- } };
218
+ const timeouts = /* @__PURE__ */ new WeakMap();
219
+ const clearRequestTimeout = (signal) => {
220
+ const timeoutId = timeouts.get(signal);
221
+ if (timeoutId) {
222
+ clearTimeout(timeoutId);
223
+ timeouts.delete(signal);
224
+ }
225
+ };
226
+ return {
227
+ onRequest: async ({ request }) => {
228
+ const controller = new AbortController();
229
+ const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
230
+ if (request.signal) request.signal.addEventListener("abort", () => controller.abort(), { once: true });
231
+ const newRequest = new Request(request, { signal: controller.signal });
232
+ timeouts.set(newRequest.signal, timeoutId);
233
+ controller.signal.addEventListener("abort", () => clearRequestTimeout(newRequest.signal), { once: true });
234
+ return newRequest;
235
+ },
236
+ onResponse: async ({ request, response }) => {
237
+ clearRequestTimeout(request.signal);
238
+ return response;
239
+ },
240
+ onError: async ({ request, error }) => {
241
+ clearRequestTimeout(request.signal);
242
+ throw error;
243
+ }
244
+ };
229
245
  }
230
246
  /**
231
247
  * Transform headers using a transformation mapping
@@ -291,8 +307,8 @@ async function executeRequest(apiCall) {
291
307
  };
292
308
  } catch (err) {
293
309
  const mockResponse = new Response(null, {
294
- status: 0,
295
- statusText: "Network Error"
310
+ status: 503,
311
+ statusText: "Service Unavailable"
296
312
  });
297
313
  return {
298
314
  data: null,
@@ -410,7 +426,6 @@ function getPathnameFromUrl(url) {
410
426
  return url.split("?")[0] || url;
411
427
  }
412
428
  }
413
-
414
429
  //#endregion
415
430
  //#region src/lib/utils/jwt.ts
416
431
  /**
@@ -554,7 +569,6 @@ function getRoleFromToken(token) {
554
569
  function getTenantIdFromToken(token) {
555
570
  return extractUserInfoFromToken(token)?.tenantId || null;
556
571
  }
557
-
558
572
  //#endregion
559
573
  //#region src/lib/utils/auth.ts
560
574
  /**
@@ -591,7 +605,6 @@ function isTokenReturningEndpoint(pathname) {
591
605
  function isLogoutEndpoint(pathname) {
592
606
  return pathname.includes("/pos/auth/logout") || pathname.includes("/pos/logout");
593
607
  }
594
-
595
608
  //#endregion
596
609
  //#region src/lib/middleware/auth.ts
597
610
  /**
@@ -803,7 +816,6 @@ function createDefaultPosAuthMiddleware(options) {
803
816
  onTokensCleared: options.onTokensCleared
804
817
  });
805
818
  }
806
-
807
819
  //#endregion
808
820
  //#region src/lib/utils/url.ts
809
821
  /**
@@ -823,13 +835,11 @@ let Environment = /* @__PURE__ */ function(Environment) {
823
835
  */
824
836
  function buildPosURL(config) {
825
837
  if (config.baseUrl) return config.baseUrl.replace(/\/$/, "");
826
- switch (config.environment || Environment.Production) {
827
- case Environment.Staging: return `https://staging.api.commercengine.io/api/v1/${config.storeId}/storefront`;
828
- case Environment.Production:
838
+ switch (config.environment || "production") {
839
+ case "staging": return `https://staging.api.commercengine.io/api/v1/${config.storeId}/storefront`;
829
840
  default: return `https://prod.api.commercengine.io/api/v1/${config.storeId}/storefront`;
830
841
  }
831
842
  }
832
-
833
843
  //#endregion
834
844
  //#region src/lib/client.ts
835
845
  /**
@@ -1003,7 +1013,6 @@ var PosAPIClient = class PosAPIClient extends BaseAPIClient {
1003
1013
  return this.client;
1004
1014
  }
1005
1015
  };
1006
-
1007
1016
  //#endregion
1008
1017
  //#region src/lib/pos.ts
1009
1018
  /**
@@ -2944,7 +2953,6 @@ var PosClient = class extends PosAPIClient {
2944
2953
  }));
2945
2954
  }
2946
2955
  };
2947
-
2948
2956
  //#endregion
2949
2957
  //#region src/index.ts
2950
2958
  /**
@@ -2962,7 +2970,7 @@ var PosSDK = class {
2962
2970
  * @param options - Configuration options for the SDK
2963
2971
  */
2964
2972
  constructor(options) {
2965
- this.pos = new PosClient({
2973
+ const config = {
2966
2974
  storeId: options.storeId,
2967
2975
  environment: options.environment,
2968
2976
  baseUrl: options.baseUrl,
@@ -2976,7 +2984,8 @@ var PosSDK = class {
2976
2984
  defaultHeaders: options.defaultHeaders,
2977
2985
  debug: options.debug,
2978
2986
  logger: options.logger
2979
- });
2987
+ };
2988
+ this.pos = new PosClient(config);
2980
2989
  }
2981
2990
  /**
2982
2991
  * Set authentication tokens for the client
@@ -3103,7 +3112,7 @@ var PosSDK = class {
3103
3112
  return getTenantIdFromToken(token);
3104
3113
  }
3105
3114
  };
3106
-
3107
3115
  //#endregion
3108
3116
  export { BrowserTokenStorage, Environment, MemoryTokenStorage, PosAPIClient, PosClient, PosSDK, PosSDK as default, ResponseUtils };
3117
+
3109
3118
  //# sourceMappingURL=index.mjs.map