@viu/emporix-sdk 2.5.0 → 2.7.0

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 (46) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/availability.d.cts +1 -1
  3. package/dist/availability.d.ts +1 -1
  4. package/dist/cart.d.cts +1 -1
  5. package/dist/cart.d.ts +1 -1
  6. package/dist/category.cjs +49 -8
  7. package/dist/category.cjs.map +1 -1
  8. package/dist/category.d.cts +25 -4
  9. package/dist/category.d.ts +25 -4
  10. package/dist/category.js +1 -1
  11. package/dist/checkout.d.cts +1 -1
  12. package/dist/checkout.d.ts +1 -1
  13. package/dist/{chunk-4BJUCCKJ.js → chunk-AUVJ5V47.js} +51 -10
  14. package/dist/chunk-AUVJ5V47.js.map +1 -0
  15. package/dist/companies.d.cts +1 -1
  16. package/dist/companies.d.ts +1 -1
  17. package/dist/contacts.d.cts +1 -1
  18. package/dist/contacts.d.ts +1 -1
  19. package/dist/{context-CgUWXqEt.d.cts → context-DJDTlhLW.d.cts} +30 -1
  20. package/dist/{context-CgUWXqEt.d.ts → context-DJDTlhLW.d.ts} +30 -1
  21. package/dist/customer-groups.d.cts +1 -1
  22. package/dist/customer-groups.d.ts +1 -1
  23. package/dist/customer.d.cts +1 -1
  24. package/dist/customer.d.ts +1 -1
  25. package/dist/index.cjs +97 -11
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.cts +11 -3
  28. package/dist/index.d.ts +11 -3
  29. package/dist/index.js +50 -6
  30. package/dist/index.js.map +1 -1
  31. package/dist/locations.d.cts +1 -1
  32. package/dist/locations.d.ts +1 -1
  33. package/dist/media.d.cts +1 -1
  34. package/dist/media.d.ts +1 -1
  35. package/dist/orders.d.cts +1 -1
  36. package/dist/orders.d.ts +1 -1
  37. package/dist/payment.d.cts +1 -1
  38. package/dist/payment.d.ts +1 -1
  39. package/dist/price.d.cts +1 -1
  40. package/dist/price.d.ts +1 -1
  41. package/dist/product.d.cts +1 -1
  42. package/dist/product.d.ts +1 -1
  43. package/dist/segment.d.cts +1 -1
  44. package/dist/segment.d.ts +1 -1
  45. package/package.json +1 -1
  46. package/dist/chunk-4BJUCCKJ.js.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as ClientContext, b as AuthContext, P as PaginatedItems, T as TokenProvider, l as ResolvedConfig, E as EmporixConfig, h as LogLevel, m as ServiceName } from './context-CgUWXqEt.cjs';
2
- export { A as AnonymousSession, a as AnonymousSessionStore, c as AuthKind, D as DEFAULT_HOST, d as DefaultTokenProvider, H as HttpClient, e as HttpClientOptions, L as LEVEL, f as LevelResolver, g as LogFields, i as Logger, j as LoggerConfig, k as LoggerObjectConfig, R as RequestOptions, S as ServiceCredentials, n as StorefrontCredentials, o as auth, p as createConsoleLogger, q as createNoopLogger, r as iterateAll, s as redact, t as resolveToken, v as validateConfig } from './context-CgUWXqEt.cjs';
1
+ import { C as ClientContext, b as AuthContext, P as PaginatedItems, T as TokenProvider, n as ResolvedConfig, E as EmporixConfig, j as LogLevel, o as ServiceName, e as CustomerTokenRefresher } from './context-DJDTlhLW.cjs';
2
+ export { A as AnonymousSession, a as AnonymousSessionStore, c as AuthKind, d as CustomerRefreshRegistry, D as DEFAULT_HOST, f as DefaultTokenProvider, H as HttpClient, g as HttpClientOptions, L as LEVEL, h as LevelResolver, i as LogFields, k as Logger, l as LoggerConfig, m as LoggerObjectConfig, R as RequestOptions, S as ServiceCredentials, p as StorefrontCredentials, q as auth, r as createConsoleLogger, s as createNoopLogger, t as iterateAll, u as redact, v as resolveToken, w as validateConfig } from './context-DJDTlhLW.cjs';
3
3
  import { CustomerService } from './customer.cjs';
4
4
  export { Address, AddressCreateInput, AddressUpdateInput, Customer, CustomerSession, CustomerSignupInput, CustomerUpdateInput, PasswordChangeInput, PasswordResetConfirmInput, PasswordResetRequestInput } from './customer.cjs';
5
5
  import { ProductService } from './product.cjs';
@@ -7108,6 +7108,7 @@ declare class EmporixClient {
7108
7108
  */
7109
7109
  readonly config: ResolvedConfig;
7110
7110
  private readonly resolver;
7111
+ private readonly customerRefresh;
7111
7112
  constructor(config: EmporixConfig);
7112
7113
  /** Sets the runtime log level globally or for one service. */
7113
7114
  setLogLevel(level: LogLevel, opts?: {
@@ -7116,6 +7117,13 @@ declare class EmporixClient {
7116
7117
  }): void;
7117
7118
  /** Returns the effective log level for a service. */
7118
7119
  getLogLevel(service: ServiceName): LogLevel;
7120
+ /**
7121
+ * Registers (or clears with `null`) a customer-token refresher. When set, a
7122
+ * `customer`-kind 401 triggers one refresh-and-retry. Off by default — the
7123
+ * customer token stays caller-owned. The React `EmporixProvider` wires this
7124
+ * automatically via `autoRefreshCustomerToken`.
7125
+ */
7126
+ setCustomerTokenRefresher(refresher: CustomerTokenRefresher | null): void;
7119
7127
  }
7120
7128
 
7121
- export { type AddedPoints, type AdminCustomer, type AdminCustomerAddress, type AdminCustomerAddressInput, type AdminCustomerAddressList, type AdminCustomerAddressUpdate, type AdminCustomerCreated, type AdminCustomerInput, type AdminCustomerList, type AdminCustomerPatch, type AdminCustomerSearchQuery, type AdminCustomerUpdate, type Agent, type AgentInput, type AgentPatchOp, type AgentSearchQuery, AiService, type Approval, type ApprovalCreated, type ApprovalInput, type ApprovalList, type ApprovalPatch, type ApprovalPermittedInput, type ApprovalPermittedResult, ApprovalService, type ApprovalUsersQuery, type ApprovalUsersResult, type Assignee, AuthContext, AvailabilityService, type BatchNextIdEntry, type Brand, type BrandInput, type BrandList, BrandService, type BrandUpdate, CartService, type Catalog, type CatalogCreated, type CatalogInput, type CatalogList, type CatalogPatch, CatalogService, type CatalogUpdate, CategoryService, type CgRelation, type CgRelationList, type ChatRequest, type ChatResponse, CheckoutService, ClientConfigService, type ClientConfiguration, ClientContext, CompaniesService, type CompletionMessage, type CompletionRequest, type CompletionResponse, type Configuration$1 as Configuration, type ConfigurationDraft, ContactsService, type ConversionFactorInput, type ConversionFactorResult, type ConvertUnitInput, type ConvertUnitResult, type Country, type CountryList, CountryService, type CountryUpdate, type Coupon$1 as Coupon, type CouponCreated, type CouponInput, type CouponList, CouponService, type CouponUpdate, type Currency, type CurrencyCreated, type CurrencyInput, type CurrencyList, CurrencyService, type CurrencyUpdate, type CustomEntity, type CustomEntityDraft, type CustomInstance, type CustomInstanceDraft, CustomerAdminService, CustomerGroupsService, CustomerService, type CustomerSummaryBatch, type DeleteAgentOptions, type DeleteConfigOptions, type DeliveryCreated, type DeliveryCycleInput, type DeliverySlot, type DeliverySlotList, type DeliveryTime$1 as DeliveryTime, type DeliveryTimeInput, type DeliveryTimeList, type DeliveryTimeUpdate, type DeliveryWindow$2 as DeliveryWindow, type DeliveryWindowList, type DeliveryWindowValidation, EmporixAuthError, EmporixClient, EmporixConfig, EmporixError, EmporixForbiddenError, EmporixInsufficientScopeError, EmporixNotFoundError, EmporixServerError, EmporixValidationError, type ExchangeRate, type ExchangeRateCreated, type ExchangeRateInput, type ExchangeRateList, type ExchangeRateUpdate, type Fee$1 as Fee, type FeeDraft, FeeService, type FindSiteInput, type IndexConfig, type IndexConfigCreated, type IndexPublicConfig, IndexingService, type InstanceSearchBody, type ItemFee, type ItemFeeDraft, type ItemFeeSearch, type JobIdResponse, type Label, type LabelInput, type LabelList, LabelService, type LabelUpdate, type ListConfigOptions, type ListCustomEntitiesOptions, type ListFeesQuery, type ListInstancesQuery, type ListSchemasQuery, LocationsService, LogLevel, MediaService, type MetadataFilter, type MinimumFee, type NewPointsEntry, type NextIdCommandRequest, type NextIdOptions, type NextIdResponse, type NextIdsBatchRequest, type NextIdsBatchResponse, type OrderCycleList, type OrderEntryEventCreate, type OrderStatusChange, OrdersService, type PackagingProductsChange, type PackingEvent, type PackingEventList, PaginatedItems, PaymentGatewayService, type PickOrder, type PickOrderList, type PickPackAck, PickPackService, type PointsSummary, PriceService, ProductService, type QuoteInput, type QuoteResult, type QuoteSlotInput, RagIndexerService, type RagType, type RecalculationJob, type RecalculationJobCreated, type RecalculationJobInput, type RedeemCouponResult, type RedeemMyPointsInput, type RedeemOption, type RedeemOptionList, type RedeemedPoints, type Redemption, type RedemptionCreated, type RedemptionInput, type ReferralCoupon, type Region, type RegionList, type ReindexInput, ResolvedConfig, type ResourceCreated, type Return, type ReturnCreated, type ReturnInput, type ReturnList, type ReturnPatch, type ReturnUpdate, ReturnsService, RewardPointsService, SalesOrdersService, type Schema, type SchemaAttribute, type SchemaDraft, SchemaService, type SchemaTypeName, type SchemaUpdate, SegmentService, SepaExportService, type SepaJob, type SepaJobCreated, type SepaJobInput, type SequenceSchema, type SequenceSchemaCreate, SequentialIdService, ServiceName, type SessionContext, type SessionContextPatch, SessionContextService, type SetItemFeesOptions, type ShippingGroup, type ShippingGroupList, type ShippingMethod, type ShippingMethodList, type ShippingPatch, ShippingService, type ShoppingList, type ShoppingListDraft, type ShoppingListItem, ShoppingListService, type Site$1 as Site, type SiteList, SiteService, type TaxCalculationInput, type TaxCalculationRequest, type TaxCalculationResult, type TaxClass, type TaxConfig, type TaxConfigCreated, type TaxCreation as TaxConfigInput, type TaxUpdate as TaxConfigUpdate, type TaxLocation, TaxService, TenantConfigService, type TextRequest, type TextResponse, TokenProvider, type Unit, type UnitCreated, UnitHandlingService, type UnitInput, type UnitUpdate, type Vendor, type VendorCreated, type VendorInput, type VendorList, type VendorLocation, type VendorLocationInput, type VendorLocationList, type VendorLocationUpdate, type VendorSearchQuery, VendorService, type VendorUpdate, type WebhookConfig, type WebhookConfigCreated, type WebhookConfigDraft, type WebhookConfigPatch, type WebhookDashboardAccess, WebhookService, type WebhookStatistics, type WebhookStatisticsQuery, type WebhookSubscription, type WebhookSubscriptionUpdateItem, type WebhookSubscriptionUpdateResultItem, type Zone, type ZoneList, errorFromResponse };
7129
+ export { type AddedPoints, type AdminCustomer, type AdminCustomerAddress, type AdminCustomerAddressInput, type AdminCustomerAddressList, type AdminCustomerAddressUpdate, type AdminCustomerCreated, type AdminCustomerInput, type AdminCustomerList, type AdminCustomerPatch, type AdminCustomerSearchQuery, type AdminCustomerUpdate, type Agent, type AgentInput, type AgentPatchOp, type AgentSearchQuery, AiService, type Approval, type ApprovalCreated, type ApprovalInput, type ApprovalList, type ApprovalPatch, type ApprovalPermittedInput, type ApprovalPermittedResult, ApprovalService, type ApprovalUsersQuery, type ApprovalUsersResult, type Assignee, AuthContext, AvailabilityService, type BatchNextIdEntry, type Brand, type BrandInput, type BrandList, BrandService, type BrandUpdate, CartService, type Catalog, type CatalogCreated, type CatalogInput, type CatalogList, type CatalogPatch, CatalogService, type CatalogUpdate, CategoryService, type CgRelation, type CgRelationList, type ChatRequest, type ChatResponse, CheckoutService, ClientConfigService, type ClientConfiguration, ClientContext, CompaniesService, type CompletionMessage, type CompletionRequest, type CompletionResponse, type Configuration$1 as Configuration, type ConfigurationDraft, ContactsService, type ConversionFactorInput, type ConversionFactorResult, type ConvertUnitInput, type ConvertUnitResult, type Country, type CountryList, CountryService, type CountryUpdate, type Coupon$1 as Coupon, type CouponCreated, type CouponInput, type CouponList, CouponService, type CouponUpdate, type Currency, type CurrencyCreated, type CurrencyInput, type CurrencyList, CurrencyService, type CurrencyUpdate, type CustomEntity, type CustomEntityDraft, type CustomInstance, type CustomInstanceDraft, CustomerAdminService, CustomerGroupsService, CustomerService, type CustomerSummaryBatch, CustomerTokenRefresher, type DeleteAgentOptions, type DeleteConfigOptions, type DeliveryCreated, type DeliveryCycleInput, type DeliverySlot, type DeliverySlotList, type DeliveryTime$1 as DeliveryTime, type DeliveryTimeInput, type DeliveryTimeList, type DeliveryTimeUpdate, type DeliveryWindow$2 as DeliveryWindow, type DeliveryWindowList, type DeliveryWindowValidation, EmporixAuthError, EmporixClient, EmporixConfig, EmporixError, EmporixForbiddenError, EmporixInsufficientScopeError, EmporixNotFoundError, EmporixServerError, EmporixValidationError, type ExchangeRate, type ExchangeRateCreated, type ExchangeRateInput, type ExchangeRateList, type ExchangeRateUpdate, type Fee$1 as Fee, type FeeDraft, FeeService, type FindSiteInput, type IndexConfig, type IndexConfigCreated, type IndexPublicConfig, IndexingService, type InstanceSearchBody, type ItemFee, type ItemFeeDraft, type ItemFeeSearch, type JobIdResponse, type Label, type LabelInput, type LabelList, LabelService, type LabelUpdate, type ListConfigOptions, type ListCustomEntitiesOptions, type ListFeesQuery, type ListInstancesQuery, type ListSchemasQuery, LocationsService, LogLevel, MediaService, type MetadataFilter, type MinimumFee, type NewPointsEntry, type NextIdCommandRequest, type NextIdOptions, type NextIdResponse, type NextIdsBatchRequest, type NextIdsBatchResponse, type OrderCycleList, type OrderEntryEventCreate, type OrderStatusChange, OrdersService, type PackagingProductsChange, type PackingEvent, type PackingEventList, PaginatedItems, PaymentGatewayService, type PickOrder, type PickOrderList, type PickPackAck, PickPackService, type PointsSummary, PriceService, ProductService, type QuoteInput, type QuoteResult, type QuoteSlotInput, RagIndexerService, type RagType, type RecalculationJob, type RecalculationJobCreated, type RecalculationJobInput, type RedeemCouponResult, type RedeemMyPointsInput, type RedeemOption, type RedeemOptionList, type RedeemedPoints, type Redemption, type RedemptionCreated, type RedemptionInput, type ReferralCoupon, type Region, type RegionList, type ReindexInput, ResolvedConfig, type ResourceCreated, type Return, type ReturnCreated, type ReturnInput, type ReturnList, type ReturnPatch, type ReturnUpdate, ReturnsService, RewardPointsService, SalesOrdersService, type Schema, type SchemaAttribute, type SchemaDraft, SchemaService, type SchemaTypeName, type SchemaUpdate, SegmentService, SepaExportService, type SepaJob, type SepaJobCreated, type SepaJobInput, type SequenceSchema, type SequenceSchemaCreate, SequentialIdService, ServiceName, type SessionContext, type SessionContextPatch, SessionContextService, type SetItemFeesOptions, type ShippingGroup, type ShippingGroupList, type ShippingMethod, type ShippingMethodList, type ShippingPatch, ShippingService, type ShoppingList, type ShoppingListDraft, type ShoppingListItem, ShoppingListService, type Site$1 as Site, type SiteList, SiteService, type TaxCalculationInput, type TaxCalculationRequest, type TaxCalculationResult, type TaxClass, type TaxConfig, type TaxConfigCreated, type TaxCreation as TaxConfigInput, type TaxUpdate as TaxConfigUpdate, type TaxLocation, TaxService, TenantConfigService, type TextRequest, type TextResponse, TokenProvider, type Unit, type UnitCreated, UnitHandlingService, type UnitInput, type UnitUpdate, type Vendor, type VendorCreated, type VendorInput, type VendorList, type VendorLocation, type VendorLocationInput, type VendorLocationList, type VendorLocationUpdate, type VendorSearchQuery, VendorService, type VendorUpdate, type WebhookConfig, type WebhookConfigCreated, type WebhookConfigDraft, type WebhookConfigPatch, type WebhookDashboardAccess, WebhookService, type WebhookStatistics, type WebhookStatisticsQuery, type WebhookSubscription, type WebhookSubscriptionUpdateItem, type WebhookSubscriptionUpdateResultItem, type Zone, type ZoneList, errorFromResponse };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as ClientContext, b as AuthContext, P as PaginatedItems, T as TokenProvider, l as ResolvedConfig, E as EmporixConfig, h as LogLevel, m as ServiceName } from './context-CgUWXqEt.js';
2
- export { A as AnonymousSession, a as AnonymousSessionStore, c as AuthKind, D as DEFAULT_HOST, d as DefaultTokenProvider, H as HttpClient, e as HttpClientOptions, L as LEVEL, f as LevelResolver, g as LogFields, i as Logger, j as LoggerConfig, k as LoggerObjectConfig, R as RequestOptions, S as ServiceCredentials, n as StorefrontCredentials, o as auth, p as createConsoleLogger, q as createNoopLogger, r as iterateAll, s as redact, t as resolveToken, v as validateConfig } from './context-CgUWXqEt.js';
1
+ import { C as ClientContext, b as AuthContext, P as PaginatedItems, T as TokenProvider, n as ResolvedConfig, E as EmporixConfig, j as LogLevel, o as ServiceName, e as CustomerTokenRefresher } from './context-DJDTlhLW.js';
2
+ export { A as AnonymousSession, a as AnonymousSessionStore, c as AuthKind, d as CustomerRefreshRegistry, D as DEFAULT_HOST, f as DefaultTokenProvider, H as HttpClient, g as HttpClientOptions, L as LEVEL, h as LevelResolver, i as LogFields, k as Logger, l as LoggerConfig, m as LoggerObjectConfig, R as RequestOptions, S as ServiceCredentials, p as StorefrontCredentials, q as auth, r as createConsoleLogger, s as createNoopLogger, t as iterateAll, u as redact, v as resolveToken, w as validateConfig } from './context-DJDTlhLW.js';
3
3
  import { CustomerService } from './customer.js';
4
4
  export { Address, AddressCreateInput, AddressUpdateInput, Customer, CustomerSession, CustomerSignupInput, CustomerUpdateInput, PasswordChangeInput, PasswordResetConfirmInput, PasswordResetRequestInput } from './customer.js';
5
5
  import { ProductService } from './product.js';
@@ -7108,6 +7108,7 @@ declare class EmporixClient {
7108
7108
  */
7109
7109
  readonly config: ResolvedConfig;
7110
7110
  private readonly resolver;
7111
+ private readonly customerRefresh;
7111
7112
  constructor(config: EmporixConfig);
7112
7113
  /** Sets the runtime log level globally or for one service. */
7113
7114
  setLogLevel(level: LogLevel, opts?: {
@@ -7116,6 +7117,13 @@ declare class EmporixClient {
7116
7117
  }): void;
7117
7118
  /** Returns the effective log level for a service. */
7118
7119
  getLogLevel(service: ServiceName): LogLevel;
7120
+ /**
7121
+ * Registers (or clears with `null`) a customer-token refresher. When set, a
7122
+ * `customer`-kind 401 triggers one refresh-and-retry. Off by default — the
7123
+ * customer token stays caller-owned. The React `EmporixProvider` wires this
7124
+ * automatically via `autoRefreshCustomerToken`.
7125
+ */
7126
+ setCustomerTokenRefresher(refresher: CustomerTokenRefresher | null): void;
7119
7127
  }
7120
7128
 
7121
- export { type AddedPoints, type AdminCustomer, type AdminCustomerAddress, type AdminCustomerAddressInput, type AdminCustomerAddressList, type AdminCustomerAddressUpdate, type AdminCustomerCreated, type AdminCustomerInput, type AdminCustomerList, type AdminCustomerPatch, type AdminCustomerSearchQuery, type AdminCustomerUpdate, type Agent, type AgentInput, type AgentPatchOp, type AgentSearchQuery, AiService, type Approval, type ApprovalCreated, type ApprovalInput, type ApprovalList, type ApprovalPatch, type ApprovalPermittedInput, type ApprovalPermittedResult, ApprovalService, type ApprovalUsersQuery, type ApprovalUsersResult, type Assignee, AuthContext, AvailabilityService, type BatchNextIdEntry, type Brand, type BrandInput, type BrandList, BrandService, type BrandUpdate, CartService, type Catalog, type CatalogCreated, type CatalogInput, type CatalogList, type CatalogPatch, CatalogService, type CatalogUpdate, CategoryService, type CgRelation, type CgRelationList, type ChatRequest, type ChatResponse, CheckoutService, ClientConfigService, type ClientConfiguration, ClientContext, CompaniesService, type CompletionMessage, type CompletionRequest, type CompletionResponse, type Configuration$1 as Configuration, type ConfigurationDraft, ContactsService, type ConversionFactorInput, type ConversionFactorResult, type ConvertUnitInput, type ConvertUnitResult, type Country, type CountryList, CountryService, type CountryUpdate, type Coupon$1 as Coupon, type CouponCreated, type CouponInput, type CouponList, CouponService, type CouponUpdate, type Currency, type CurrencyCreated, type CurrencyInput, type CurrencyList, CurrencyService, type CurrencyUpdate, type CustomEntity, type CustomEntityDraft, type CustomInstance, type CustomInstanceDraft, CustomerAdminService, CustomerGroupsService, CustomerService, type CustomerSummaryBatch, type DeleteAgentOptions, type DeleteConfigOptions, type DeliveryCreated, type DeliveryCycleInput, type DeliverySlot, type DeliverySlotList, type DeliveryTime$1 as DeliveryTime, type DeliveryTimeInput, type DeliveryTimeList, type DeliveryTimeUpdate, type DeliveryWindow$2 as DeliveryWindow, type DeliveryWindowList, type DeliveryWindowValidation, EmporixAuthError, EmporixClient, EmporixConfig, EmporixError, EmporixForbiddenError, EmporixInsufficientScopeError, EmporixNotFoundError, EmporixServerError, EmporixValidationError, type ExchangeRate, type ExchangeRateCreated, type ExchangeRateInput, type ExchangeRateList, type ExchangeRateUpdate, type Fee$1 as Fee, type FeeDraft, FeeService, type FindSiteInput, type IndexConfig, type IndexConfigCreated, type IndexPublicConfig, IndexingService, type InstanceSearchBody, type ItemFee, type ItemFeeDraft, type ItemFeeSearch, type JobIdResponse, type Label, type LabelInput, type LabelList, LabelService, type LabelUpdate, type ListConfigOptions, type ListCustomEntitiesOptions, type ListFeesQuery, type ListInstancesQuery, type ListSchemasQuery, LocationsService, LogLevel, MediaService, type MetadataFilter, type MinimumFee, type NewPointsEntry, type NextIdCommandRequest, type NextIdOptions, type NextIdResponse, type NextIdsBatchRequest, type NextIdsBatchResponse, type OrderCycleList, type OrderEntryEventCreate, type OrderStatusChange, OrdersService, type PackagingProductsChange, type PackingEvent, type PackingEventList, PaginatedItems, PaymentGatewayService, type PickOrder, type PickOrderList, type PickPackAck, PickPackService, type PointsSummary, PriceService, ProductService, type QuoteInput, type QuoteResult, type QuoteSlotInput, RagIndexerService, type RagType, type RecalculationJob, type RecalculationJobCreated, type RecalculationJobInput, type RedeemCouponResult, type RedeemMyPointsInput, type RedeemOption, type RedeemOptionList, type RedeemedPoints, type Redemption, type RedemptionCreated, type RedemptionInput, type ReferralCoupon, type Region, type RegionList, type ReindexInput, ResolvedConfig, type ResourceCreated, type Return, type ReturnCreated, type ReturnInput, type ReturnList, type ReturnPatch, type ReturnUpdate, ReturnsService, RewardPointsService, SalesOrdersService, type Schema, type SchemaAttribute, type SchemaDraft, SchemaService, type SchemaTypeName, type SchemaUpdate, SegmentService, SepaExportService, type SepaJob, type SepaJobCreated, type SepaJobInput, type SequenceSchema, type SequenceSchemaCreate, SequentialIdService, ServiceName, type SessionContext, type SessionContextPatch, SessionContextService, type SetItemFeesOptions, type ShippingGroup, type ShippingGroupList, type ShippingMethod, type ShippingMethodList, type ShippingPatch, ShippingService, type ShoppingList, type ShoppingListDraft, type ShoppingListItem, ShoppingListService, type Site$1 as Site, type SiteList, SiteService, type TaxCalculationInput, type TaxCalculationRequest, type TaxCalculationResult, type TaxClass, type TaxConfig, type TaxConfigCreated, type TaxCreation as TaxConfigInput, type TaxUpdate as TaxConfigUpdate, type TaxLocation, TaxService, TenantConfigService, type TextRequest, type TextResponse, TokenProvider, type Unit, type UnitCreated, UnitHandlingService, type UnitInput, type UnitUpdate, type Vendor, type VendorCreated, type VendorInput, type VendorList, type VendorLocation, type VendorLocationInput, type VendorLocationList, type VendorLocationUpdate, type VendorSearchQuery, VendorService, type VendorUpdate, type WebhookConfig, type WebhookConfigCreated, type WebhookConfigDraft, type WebhookConfigPatch, type WebhookDashboardAccess, WebhookService, type WebhookStatistics, type WebhookStatisticsQuery, type WebhookSubscription, type WebhookSubscriptionUpdateItem, type WebhookSubscriptionUpdateResultItem, type Zone, type ZoneList, errorFromResponse };
7129
+ export { type AddedPoints, type AdminCustomer, type AdminCustomerAddress, type AdminCustomerAddressInput, type AdminCustomerAddressList, type AdminCustomerAddressUpdate, type AdminCustomerCreated, type AdminCustomerInput, type AdminCustomerList, type AdminCustomerPatch, type AdminCustomerSearchQuery, type AdminCustomerUpdate, type Agent, type AgentInput, type AgentPatchOp, type AgentSearchQuery, AiService, type Approval, type ApprovalCreated, type ApprovalInput, type ApprovalList, type ApprovalPatch, type ApprovalPermittedInput, type ApprovalPermittedResult, ApprovalService, type ApprovalUsersQuery, type ApprovalUsersResult, type Assignee, AuthContext, AvailabilityService, type BatchNextIdEntry, type Brand, type BrandInput, type BrandList, BrandService, type BrandUpdate, CartService, type Catalog, type CatalogCreated, type CatalogInput, type CatalogList, type CatalogPatch, CatalogService, type CatalogUpdate, CategoryService, type CgRelation, type CgRelationList, type ChatRequest, type ChatResponse, CheckoutService, ClientConfigService, type ClientConfiguration, ClientContext, CompaniesService, type CompletionMessage, type CompletionRequest, type CompletionResponse, type Configuration$1 as Configuration, type ConfigurationDraft, ContactsService, type ConversionFactorInput, type ConversionFactorResult, type ConvertUnitInput, type ConvertUnitResult, type Country, type CountryList, CountryService, type CountryUpdate, type Coupon$1 as Coupon, type CouponCreated, type CouponInput, type CouponList, CouponService, type CouponUpdate, type Currency, type CurrencyCreated, type CurrencyInput, type CurrencyList, CurrencyService, type CurrencyUpdate, type CustomEntity, type CustomEntityDraft, type CustomInstance, type CustomInstanceDraft, CustomerAdminService, CustomerGroupsService, CustomerService, type CustomerSummaryBatch, CustomerTokenRefresher, type DeleteAgentOptions, type DeleteConfigOptions, type DeliveryCreated, type DeliveryCycleInput, type DeliverySlot, type DeliverySlotList, type DeliveryTime$1 as DeliveryTime, type DeliveryTimeInput, type DeliveryTimeList, type DeliveryTimeUpdate, type DeliveryWindow$2 as DeliveryWindow, type DeliveryWindowList, type DeliveryWindowValidation, EmporixAuthError, EmporixClient, EmporixConfig, EmporixError, EmporixForbiddenError, EmporixInsufficientScopeError, EmporixNotFoundError, EmporixServerError, EmporixValidationError, type ExchangeRate, type ExchangeRateCreated, type ExchangeRateInput, type ExchangeRateList, type ExchangeRateUpdate, type Fee$1 as Fee, type FeeDraft, FeeService, type FindSiteInput, type IndexConfig, type IndexConfigCreated, type IndexPublicConfig, IndexingService, type InstanceSearchBody, type ItemFee, type ItemFeeDraft, type ItemFeeSearch, type JobIdResponse, type Label, type LabelInput, type LabelList, LabelService, type LabelUpdate, type ListConfigOptions, type ListCustomEntitiesOptions, type ListFeesQuery, type ListInstancesQuery, type ListSchemasQuery, LocationsService, LogLevel, MediaService, type MetadataFilter, type MinimumFee, type NewPointsEntry, type NextIdCommandRequest, type NextIdOptions, type NextIdResponse, type NextIdsBatchRequest, type NextIdsBatchResponse, type OrderCycleList, type OrderEntryEventCreate, type OrderStatusChange, OrdersService, type PackagingProductsChange, type PackingEvent, type PackingEventList, PaginatedItems, PaymentGatewayService, type PickOrder, type PickOrderList, type PickPackAck, PickPackService, type PointsSummary, PriceService, ProductService, type QuoteInput, type QuoteResult, type QuoteSlotInput, RagIndexerService, type RagType, type RecalculationJob, type RecalculationJobCreated, type RecalculationJobInput, type RedeemCouponResult, type RedeemMyPointsInput, type RedeemOption, type RedeemOptionList, type RedeemedPoints, type Redemption, type RedemptionCreated, type RedemptionInput, type ReferralCoupon, type Region, type RegionList, type ReindexInput, ResolvedConfig, type ResourceCreated, type Return, type ReturnCreated, type ReturnInput, type ReturnList, type ReturnPatch, type ReturnUpdate, ReturnsService, RewardPointsService, SalesOrdersService, type Schema, type SchemaAttribute, type SchemaDraft, SchemaService, type SchemaTypeName, type SchemaUpdate, SegmentService, SepaExportService, type SepaJob, type SepaJobCreated, type SepaJobInput, type SequenceSchema, type SequenceSchemaCreate, SequentialIdService, ServiceName, type SessionContext, type SessionContextPatch, SessionContextService, type SetItemFeesOptions, type ShippingGroup, type ShippingGroupList, type ShippingMethod, type ShippingMethodList, type ShippingPatch, ShippingService, type ShoppingList, type ShoppingListDraft, type ShoppingListItem, ShoppingListService, type Site$1 as Site, type SiteList, SiteService, type TaxCalculationInput, type TaxCalculationRequest, type TaxCalculationResult, type TaxClass, type TaxConfig, type TaxConfigCreated, type TaxCreation as TaxConfigInput, type TaxUpdate as TaxConfigUpdate, type TaxLocation, TaxService, TenantConfigService, type TextRequest, type TextResponse, TokenProvider, type Unit, type UnitCreated, UnitHandlingService, type UnitInput, type UnitUpdate, type Vendor, type VendorCreated, type VendorInput, type VendorList, type VendorLocation, type VendorLocationInput, type VendorLocationList, type VendorLocationUpdate, type VendorSearchQuery, VendorService, type VendorUpdate, type WebhookConfig, type WebhookConfigCreated, type WebhookConfigDraft, type WebhookConfigPatch, type WebhookDashboardAccess, WebhookService, type WebhookStatistics, type WebhookStatisticsQuery, type WebhookSubscription, type WebhookSubscriptionUpdateItem, type WebhookSubscriptionUpdateResultItem, type Zone, type ZoneList, errorFromResponse };
package/dist/index.js CHANGED
@@ -16,8 +16,8 @@ import { AvailabilityService } from './chunk-XMEP74BU.js';
16
16
  export { AvailabilityService } from './chunk-XMEP74BU.js';
17
17
  import { CartService } from './chunk-IEZHGU7F.js';
18
18
  export { CartService } from './chunk-IEZHGU7F.js';
19
- import { CategoryService } from './chunk-4BJUCCKJ.js';
20
- export { CategoryService } from './chunk-4BJUCCKJ.js';
19
+ import { CategoryService } from './chunk-AUVJ5V47.js';
20
+ export { CategoryService } from './chunk-AUVJ5V47.js';
21
21
  export { iterateAll } from './chunk-GWJ2U2CP.js';
22
22
  import { CheckoutService } from './chunk-OMYVOOSX.js';
23
23
  export { CheckoutService } from './chunk-OMYVOOSX.js';
@@ -316,6 +316,26 @@ async function resolveToken(ctx, provider) {
316
316
  return ctx.token;
317
317
  }
318
318
  }
319
+ var CustomerRefreshRegistry = class {
320
+ refresher = null;
321
+ inflight = null;
322
+ set(refresher) {
323
+ this.refresher = refresher;
324
+ }
325
+ get enabled() {
326
+ return this.refresher !== null;
327
+ }
328
+ /** Concurrent callers share one in-flight refresh. */
329
+ refresh(expiredToken) {
330
+ if (!this.refresher) return Promise.resolve(null);
331
+ if (this.inflight) return this.inflight;
332
+ const p = Promise.resolve(this.refresher.refresh(expiredToken)).finally(() => {
333
+ this.inflight = null;
334
+ });
335
+ this.inflight = p;
336
+ return p;
337
+ }
338
+ };
319
339
  var DefaultTokenProvider = class {
320
340
  constructor(cfg) {
321
341
  this.cfg = cfg;
@@ -517,8 +537,10 @@ var HttpClient = class {
517
537
  const sdkManaged = o.auth.kind === "service" || o.auth.kind === "anonymous";
518
538
  const maxAttempts = this.opts.retry.maxAttempts;
519
539
  let reauthed = false;
540
+ let customerToken = o.auth.kind === "customer" ? o.auth.token : void 0;
541
+ let customerReauthed = false;
520
542
  for (let attempt = 1; ; attempt++) {
521
- const token = await resolveToken(o.auth, this.opts.provider);
543
+ const token = customerToken ?? await resolveToken(o.auth, this.opts.provider);
522
544
  log.debug("http request", {
523
545
  authKind: o.auth.kind,
524
546
  method: o.method,
@@ -570,6 +592,15 @@ var HttpClient = class {
570
592
  log.warn("sdk-managed 401, re-authing once", { authKind: o.auth.kind });
571
593
  continue;
572
594
  }
595
+ if (o.auth.kind === "customer" && !customerReauthed && this.opts.customerRefresh?.enabled) {
596
+ customerReauthed = true;
597
+ const fresh = await this.opts.customerRefresh.refresh(customerToken);
598
+ if (fresh) {
599
+ customerToken = fresh;
600
+ log.warn("customer 401, refreshed once", { authKind: o.auth.kind });
601
+ continue;
602
+ }
603
+ }
573
604
  throw errorFromResponse(res.status, `${o.method} ${o.path} \u2192 401`, parsed);
574
605
  }
575
606
  const retryable = res.status >= 500 || res.status === 429;
@@ -3409,7 +3440,7 @@ var ApprovalService = class {
3409
3440
  };
3410
3441
 
3411
3442
  // package.json
3412
- var version = "2.5.0";
3443
+ var version = "2.7.0";
3413
3444
 
3414
3445
  // src/version.ts
3415
3446
  var SDK_VERSION = version;
@@ -3476,6 +3507,7 @@ var EmporixClient = class {
3476
3507
  */
3477
3508
  config;
3478
3509
  resolver;
3510
+ customerRefresh;
3479
3511
  constructor(config) {
3480
3512
  const cfg = validateConfig(config);
3481
3513
  this.tenant = cfg.tenant;
@@ -3497,6 +3529,8 @@ var EmporixClient = class {
3497
3529
  });
3498
3530
  const tokenProvider = cfg.tokenProvider ?? new DefaultTokenProvider(cfg);
3499
3531
  this.tokenProvider = tokenProvider;
3532
+ const customerRefresh = new CustomerRefreshRegistry();
3533
+ this.customerRefresh = customerRefresh;
3500
3534
  const mk = (service) => ({
3501
3535
  tenant: cfg.tenant,
3502
3536
  tokenProvider,
@@ -3506,7 +3540,8 @@ var EmporixClient = class {
3506
3540
  provider: tokenProvider,
3507
3541
  logger: root.child({ service: "http" }),
3508
3542
  retry: cfg.retry,
3509
- timeouts: cfg.timeouts
3543
+ timeouts: cfg.timeouts,
3544
+ customerRefresh
3510
3545
  })
3511
3546
  });
3512
3547
  this.customers = new CustomerService(mk("customer"));
@@ -3565,8 +3600,17 @@ var EmporixClient = class {
3565
3600
  getLogLevel(service) {
3566
3601
  return this.resolver.get(service);
3567
3602
  }
3603
+ /**
3604
+ * Registers (or clears with `null`) a customer-token refresher. When set, a
3605
+ * `customer`-kind 401 triggers one refresh-and-retry. Off by default — the
3606
+ * customer token stays caller-owned. The React `EmporixProvider` wires this
3607
+ * automatically via `autoRefreshCustomerToken`.
3608
+ */
3609
+ setCustomerTokenRefresher(refresher) {
3610
+ this.customerRefresh.set(refresher);
3611
+ }
3568
3612
  };
3569
3613
 
3570
- export { AiService, ApprovalService, BrandService, CatalogService, ClientConfigService, CountryService, CouponService, CurrencyService, CustomerAdminService, DEFAULT_HOST, DefaultTokenProvider, EmporixClient, FeeService, HttpClient, IndexingService, LEVEL, LabelService, LevelResolver, PickPackService, RagIndexerService, ReturnsService, RewardPointsService, SchemaService, SepaExportService, SequentialIdService, SessionContextService, ShippingService, ShoppingListService, SiteService, TaxService, TenantConfigService, UnitHandlingService, VendorService, WebhookService, auth, createConsoleLogger, createNoopLogger, redact, resolveToken, validateConfig };
3614
+ export { AiService, ApprovalService, BrandService, CatalogService, ClientConfigService, CountryService, CouponService, CurrencyService, CustomerAdminService, CustomerRefreshRegistry, DEFAULT_HOST, DefaultTokenProvider, EmporixClient, FeeService, HttpClient, IndexingService, LEVEL, LabelService, LevelResolver, PickPackService, RagIndexerService, ReturnsService, RewardPointsService, SchemaService, SepaExportService, SequentialIdService, SessionContextService, ShippingService, ShoppingListService, SiteService, TaxService, TenantConfigService, UnitHandlingService, VendorService, WebhookService, auth, createConsoleLogger, createNoopLogger, redact, resolveToken, validateConfig };
3571
3615
  //# sourceMappingURL=index.js.map
3572
3616
  //# sourceMappingURL=index.js.map