@viu/emporix-sdk 2.10.0 → 2.12.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.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
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-BBKOwNW6.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-BBKOwNW6.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-CD7F_LHT.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-CD7F_LHT.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';
@@ -788,6 +788,31 @@ declare class FeeService {
788
788
  deleteProductFees(productId: string, auth?: AuthContext): Promise<void>;
789
789
  }
790
790
 
791
+ /** Options for {@link CloudFunctionsService.invoke}. */
792
+ interface InvokeCloudFunctionOptions<TReq = unknown> {
793
+ /** HTTP method. Default: "POST" (the canonical invoke). */
794
+ method?: "GET" | "POST" | "PUT" | "DELETE";
795
+ /** Optional sub-path the function exposes (leading slash optional). */
796
+ path?: string;
797
+ /** Request body (arbitrary JSON). */
798
+ body?: TReq;
799
+ /** Query-string params. */
800
+ query?: Record<string, string | number | undefined>;
801
+ /** Extra request headers (Content-Type: application/json is the default). */
802
+ headers?: Record<string, string>;
803
+ }
804
+ /**
805
+ * Invokes Emporix-hosted cloud functions. Request/response shapes are
806
+ * caller-defined (generic) — there is no schema. Auth may be service,
807
+ * customer, anonymous, or raw; the default is anonymous.
808
+ */
809
+ declare class CloudFunctionsService {
810
+ private readonly ctx;
811
+ constructor(ctx: ClientContext);
812
+ private base;
813
+ invoke<TRes = unknown, TReq = unknown>(functionId: string, options?: InvokeCloudFunctionOptions<TReq>, authCtx?: AuthContext): Promise<TRes>;
814
+ }
815
+
791
816
  type AbstractWebhookConfig = {
792
817
  /**
793
818
  * Indicates whether a given configuration is active. Only one configuration can be active.
@@ -7072,6 +7097,7 @@ declare class EmporixClient {
7072
7097
  readonly ragIndexer: RagIndexerService;
7073
7098
  readonly sequentialIds: SequentialIdService;
7074
7099
  readonly fees: FeeService;
7100
+ readonly cloudFunctions: CloudFunctionsService;
7075
7101
  readonly webhooks: WebhookService;
7076
7102
  readonly schemas: SchemaService;
7077
7103
  readonly ai: AiService;
@@ -7109,6 +7135,7 @@ declare class EmporixClient {
7109
7135
  readonly config: ResolvedConfig;
7110
7136
  private readonly resolver;
7111
7137
  private readonly customerRefresh;
7138
+ private readonly requestContext;
7112
7139
  constructor(config: EmporixConfig);
7113
7140
  /**
7114
7141
  * Re-binds the storefront price context (currency / siteCode / targetLocation)
@@ -7116,11 +7143,15 @@ declare class EmporixClient {
7116
7143
  * next request re-mints a token bound to the new context. Use this to switch
7117
7144
  * currency at runtime. Carts are currency-bound — clear the cart after a
7118
7145
  * currency change (the React `setCurrency` does this for you).
7146
+ *
7147
+ * Also sets the storefront `language` (an `Accept-Language` header on every
7148
+ * read); a language-only change does NOT re-mint the token.
7119
7149
  */
7120
7150
  setStorefrontContext(ctx: {
7121
7151
  currency?: string;
7122
7152
  siteCode?: string;
7123
7153
  targetLocation?: string;
7154
+ language?: string;
7124
7155
  }): void;
7125
7156
  /** Sets the runtime log level globally or for one service. */
7126
7157
  setLogLevel(level: LogLevel, opts?: {
@@ -7146,4 +7177,4 @@ declare class EmporixClient {
7146
7177
  */
7147
7178
  declare function productIdFromYrn(yrn: string | undefined): string;
7148
7179
 
7149
- 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, productIdFromYrn };
7180
+ 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, CloudFunctionsService, 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 InvokeCloudFunctionOptions, 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, productIdFromYrn };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
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-BBKOwNW6.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-BBKOwNW6.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-CD7F_LHT.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-CD7F_LHT.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';
@@ -788,6 +788,31 @@ declare class FeeService {
788
788
  deleteProductFees(productId: string, auth?: AuthContext): Promise<void>;
789
789
  }
790
790
 
791
+ /** Options for {@link CloudFunctionsService.invoke}. */
792
+ interface InvokeCloudFunctionOptions<TReq = unknown> {
793
+ /** HTTP method. Default: "POST" (the canonical invoke). */
794
+ method?: "GET" | "POST" | "PUT" | "DELETE";
795
+ /** Optional sub-path the function exposes (leading slash optional). */
796
+ path?: string;
797
+ /** Request body (arbitrary JSON). */
798
+ body?: TReq;
799
+ /** Query-string params. */
800
+ query?: Record<string, string | number | undefined>;
801
+ /** Extra request headers (Content-Type: application/json is the default). */
802
+ headers?: Record<string, string>;
803
+ }
804
+ /**
805
+ * Invokes Emporix-hosted cloud functions. Request/response shapes are
806
+ * caller-defined (generic) — there is no schema. Auth may be service,
807
+ * customer, anonymous, or raw; the default is anonymous.
808
+ */
809
+ declare class CloudFunctionsService {
810
+ private readonly ctx;
811
+ constructor(ctx: ClientContext);
812
+ private base;
813
+ invoke<TRes = unknown, TReq = unknown>(functionId: string, options?: InvokeCloudFunctionOptions<TReq>, authCtx?: AuthContext): Promise<TRes>;
814
+ }
815
+
791
816
  type AbstractWebhookConfig = {
792
817
  /**
793
818
  * Indicates whether a given configuration is active. Only one configuration can be active.
@@ -7072,6 +7097,7 @@ declare class EmporixClient {
7072
7097
  readonly ragIndexer: RagIndexerService;
7073
7098
  readonly sequentialIds: SequentialIdService;
7074
7099
  readonly fees: FeeService;
7100
+ readonly cloudFunctions: CloudFunctionsService;
7075
7101
  readonly webhooks: WebhookService;
7076
7102
  readonly schemas: SchemaService;
7077
7103
  readonly ai: AiService;
@@ -7109,6 +7135,7 @@ declare class EmporixClient {
7109
7135
  readonly config: ResolvedConfig;
7110
7136
  private readonly resolver;
7111
7137
  private readonly customerRefresh;
7138
+ private readonly requestContext;
7112
7139
  constructor(config: EmporixConfig);
7113
7140
  /**
7114
7141
  * Re-binds the storefront price context (currency / siteCode / targetLocation)
@@ -7116,11 +7143,15 @@ declare class EmporixClient {
7116
7143
  * next request re-mints a token bound to the new context. Use this to switch
7117
7144
  * currency at runtime. Carts are currency-bound — clear the cart after a
7118
7145
  * currency change (the React `setCurrency` does this for you).
7146
+ *
7147
+ * Also sets the storefront `language` (an `Accept-Language` header on every
7148
+ * read); a language-only change does NOT re-mint the token.
7119
7149
  */
7120
7150
  setStorefrontContext(ctx: {
7121
7151
  currency?: string;
7122
7152
  siteCode?: string;
7123
7153
  targetLocation?: string;
7154
+ language?: string;
7124
7155
  }): void;
7125
7156
  /** Sets the runtime log level globally or for one service. */
7126
7157
  setLogLevel(level: LogLevel, opts?: {
@@ -7146,4 +7177,4 @@ declare class EmporixClient {
7146
7177
  */
7147
7178
  declare function productIdFromYrn(yrn: string | undefined): string;
7148
7179
 
7149
- 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, productIdFromYrn };
7180
+ 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, CloudFunctionsService, 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 InvokeCloudFunctionOptions, 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, productIdFromYrn };
package/dist/index.js CHANGED
@@ -533,6 +533,16 @@ var HttpClient = class {
533
533
  }
534
534
  opts;
535
535
  sleep;
536
+ buildHeaders(o, token, isFormData) {
537
+ return {
538
+ ...this.opts.requestContext?.language ? { "Accept-Language": this.opts.requestContext.language } : {},
539
+ ...o.headers ?? {},
540
+ Authorization: `Bearer ${token}`,
541
+ // JSON bodies: set Content-Type. FormData bodies: let `fetch`
542
+ // emit `multipart/form-data; boundary=...` itself.
543
+ ...o.body !== void 0 && !isFormData ? { "Content-Type": "application/json" } : {}
544
+ };
545
+ }
536
546
  async request(o) {
537
547
  const requestId = `req-${++requestSeq}`;
538
548
  const log = this.opts.logger.child({ requestId });
@@ -561,13 +571,7 @@ var HttpClient = class {
561
571
  const isFormData = typeof FormData !== "undefined" && o.body instanceof FormData;
562
572
  const init = {
563
573
  method: o.method,
564
- headers: {
565
- ...o.headers ?? {},
566
- Authorization: `Bearer ${token}`,
567
- // JSON bodies: set Content-Type. FormData bodies: let `fetch`
568
- // emit `multipart/form-data; boundary=...` itself.
569
- ...o.body !== void 0 && !isFormData ? { "Content-Type": "application/json" } : {}
570
- },
574
+ headers: this.buildHeaders(o, token, isFormData),
571
575
  signal: controller.signal
572
576
  };
573
577
  if (o.body !== void 0) {
@@ -655,11 +659,7 @@ var HttpClient = class {
655
659
  const isFormData = typeof FormData !== "undefined" && o.body instanceof FormData;
656
660
  const init = {
657
661
  method: o.method,
658
- headers: {
659
- ...o.headers ?? {},
660
- Authorization: `Bearer ${token}`,
661
- ...o.body !== void 0 && !isFormData ? { "Content-Type": "application/json" } : {}
662
- },
662
+ headers: this.buildHeaders(o, token, isFormData),
663
663
  signal: controller.signal,
664
664
  ...extra?.redirect ? { redirect: extra.redirect } : {}
665
665
  };
@@ -1274,6 +1274,28 @@ var FeeService = class {
1274
1274
  }
1275
1275
  };
1276
1276
 
1277
+ // src/services/cloud-functions.ts
1278
+ var CloudFunctionsService = class {
1279
+ constructor(ctx) {
1280
+ this.ctx = ctx;
1281
+ }
1282
+ ctx;
1283
+ base() {
1284
+ return `/cloud-functions/${this.ctx.tenant}/functions`;
1285
+ }
1286
+ async invoke(functionId, options = {}, authCtx = auth.anonymous()) {
1287
+ const sub = options.path ? `/${options.path.replace(/^\//, "")}` : "";
1288
+ return this.ctx.http.request({
1289
+ method: options.method ?? "POST",
1290
+ path: `${this.base()}/${functionId}${sub}`,
1291
+ auth: authCtx,
1292
+ ...options.body !== void 0 ? { body: options.body } : {},
1293
+ ...options.query ? { query: options.query } : {},
1294
+ ...options.headers ? { headers: options.headers } : {}
1295
+ });
1296
+ }
1297
+ };
1298
+
1277
1299
  // src/services/webhook.ts
1278
1300
  var SERVICE6 = { kind: "service" };
1279
1301
  var WebhookService = class {
@@ -3446,7 +3468,7 @@ var ApprovalService = class {
3446
3468
  };
3447
3469
 
3448
3470
  // package.json
3449
- var version = "2.10.0";
3471
+ var version = "2.12.0";
3450
3472
 
3451
3473
  // src/version.ts
3452
3474
  var SDK_VERSION = version;
@@ -3477,6 +3499,7 @@ var EmporixClient = class {
3477
3499
  ragIndexer;
3478
3500
  sequentialIds;
3479
3501
  fees;
3502
+ cloudFunctions;
3480
3503
  webhooks;
3481
3504
  schemas;
3482
3505
  ai;
@@ -3514,6 +3537,7 @@ var EmporixClient = class {
3514
3537
  config;
3515
3538
  resolver;
3516
3539
  customerRefresh;
3540
+ requestContext;
3517
3541
  constructor(config) {
3518
3542
  const cfg = validateConfig(config);
3519
3543
  this.tenant = cfg.tenant;
@@ -3537,6 +3561,8 @@ var EmporixClient = class {
3537
3561
  this.tokenProvider = tokenProvider;
3538
3562
  const customerRefresh = new CustomerRefreshRegistry();
3539
3563
  this.customerRefresh = customerRefresh;
3564
+ this.requestContext = { language: cfg.credentials.storefront?.context?.language };
3565
+ const requestContext = this.requestContext;
3540
3566
  const mk = (service) => ({
3541
3567
  tenant: cfg.tenant,
3542
3568
  tokenProvider,
@@ -3547,7 +3573,8 @@ var EmporixClient = class {
3547
3573
  logger: root.child({ service: "http" }),
3548
3574
  retry: cfg.retry,
3549
3575
  timeouts: cfg.timeouts,
3550
- customerRefresh
3576
+ customerRefresh,
3577
+ requestContext
3551
3578
  })
3552
3579
  });
3553
3580
  this.customers = new CustomerService(mk("customer"));
@@ -3577,6 +3604,7 @@ var EmporixClient = class {
3577
3604
  this.ragIndexer = new RagIndexerService(mk("ai-rag-indexer"));
3578
3605
  this.sequentialIds = new SequentialIdService(mk("sequential-id"));
3579
3606
  this.fees = new FeeService(mk("fee"));
3607
+ this.cloudFunctions = new CloudFunctionsService(mk("cloud-functions"));
3580
3608
  this.webhooks = new WebhookService(mk("webhook"));
3581
3609
  this.schemas = new SchemaService(mk("schema"));
3582
3610
  this.ai = new AiService(mk("ai"));
@@ -3604,9 +3632,18 @@ var EmporixClient = class {
3604
3632
  * next request re-mints a token bound to the new context. Use this to switch
3605
3633
  * currency at runtime. Carts are currency-bound — clear the cart after a
3606
3634
  * currency change (the React `setCurrency` does this for you).
3635
+ *
3636
+ * Also sets the storefront `language` (an `Accept-Language` header on every
3637
+ * read); a language-only change does NOT re-mint the token.
3607
3638
  */
3608
3639
  setStorefrontContext(ctx) {
3609
- this.tokenProvider.setAnonymousContext?.(ctx);
3640
+ if (ctx.language !== void 0) {
3641
+ this.requestContext.language = ctx.language || void 0;
3642
+ }
3643
+ const { language: _language, ...priceContext } = ctx;
3644
+ if (Object.keys(priceContext).length > 0) {
3645
+ this.tokenProvider.setAnonymousContext?.(priceContext);
3646
+ }
3610
3647
  }
3611
3648
  /** Sets the runtime log level globally or for one service. */
3612
3649
  setLogLevel(level, opts = {}) {
@@ -3634,6 +3671,6 @@ function productIdFromYrn(yrn) {
3634
3671
  return semi >= 0 ? yrn.slice(semi + 1) : "";
3635
3672
  }
3636
3673
 
3637
- 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, productIdFromYrn, redact, resolveToken, validateConfig };
3674
+ export { AiService, ApprovalService, BrandService, CatalogService, ClientConfigService, CloudFunctionsService, 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, productIdFromYrn, redact, resolveToken, validateConfig };
3638
3675
  //# sourceMappingURL=index.js.map
3639
3676
  //# sourceMappingURL=index.js.map