@viu/emporix-sdk 2.9.0 → 2.11.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/CHANGELOG.md +32 -0
- package/dist/availability.d.cts +1 -1
- package/dist/availability.d.ts +1 -1
- package/dist/cart.d.cts +1 -1
- package/dist/cart.d.ts +1 -1
- package/dist/category.d.cts +1 -1
- package/dist/category.d.ts +1 -1
- package/dist/checkout.d.cts +1 -1
- package/dist/checkout.d.ts +1 -1
- package/dist/companies.d.cts +1 -1
- package/dist/companies.d.ts +1 -1
- package/dist/contacts.d.cts +1 -1
- package/dist/contacts.d.ts +1 -1
- package/dist/{context-DJDTlhLW.d.cts → context-CmShWI_R.d.cts} +17 -1
- package/dist/{context-DJDTlhLW.d.ts → context-CmShWI_R.d.ts} +17 -1
- package/dist/customer-groups.d.cts +1 -1
- package/dist/customer-groups.d.ts +1 -1
- package/dist/customer.d.cts +1 -1
- package/dist/customer.d.ts +1 -1
- package/dist/index.cjs +43 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -3
- package/dist/index.d.ts +41 -3
- package/dist/index.js +43 -3
- package/dist/index.js.map +1 -1
- package/dist/locations.d.cts +1 -1
- package/dist/locations.d.ts +1 -1
- package/dist/media.d.cts +1 -1
- package/dist/media.d.ts +1 -1
- package/dist/orders.d.cts +1 -1
- package/dist/orders.d.ts +1 -1
- package/dist/payment.d.cts +1 -1
- package/dist/payment.d.ts +1 -1
- package/dist/price.d.cts +1 -1
- package/dist/price.d.ts +1 -1
- package/dist/product.d.cts +1 -1
- package/dist/product.d.ts +1 -1
- package/dist/segment.d.cts +1 -1
- package/dist/segment.d.ts +1 -1
- package/package.json +1 -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, n as ResolvedConfig, E as EmporixConfig, j as LogLevel, o as ServiceName, e as CustomerTokenRefresher } from './context-
|
|
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-
|
|
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-CmShWI_R.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-CmShWI_R.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;
|
|
@@ -7110,6 +7136,18 @@ declare class EmporixClient {
|
|
|
7110
7136
|
private readonly resolver;
|
|
7111
7137
|
private readonly customerRefresh;
|
|
7112
7138
|
constructor(config: EmporixConfig);
|
|
7139
|
+
/**
|
|
7140
|
+
* Re-binds the storefront price context (currency / siteCode / targetLocation)
|
|
7141
|
+
* for anonymous pricing and invalidates the current anonymous session, so the
|
|
7142
|
+
* next request re-mints a token bound to the new context. Use this to switch
|
|
7143
|
+
* currency at runtime. Carts are currency-bound — clear the cart after a
|
|
7144
|
+
* currency change (the React `setCurrency` does this for you).
|
|
7145
|
+
*/
|
|
7146
|
+
setStorefrontContext(ctx: {
|
|
7147
|
+
currency?: string;
|
|
7148
|
+
siteCode?: string;
|
|
7149
|
+
targetLocation?: string;
|
|
7150
|
+
}): void;
|
|
7113
7151
|
/** Sets the runtime log level globally or for one service. */
|
|
7114
7152
|
setLogLevel(level: LogLevel, opts?: {
|
|
7115
7153
|
service?: ServiceName;
|
|
@@ -7134,4 +7172,4 @@ declare class EmporixClient {
|
|
|
7134
7172
|
*/
|
|
7135
7173
|
declare function productIdFromYrn(yrn: string | undefined): string;
|
|
7136
7174
|
|
|
7137
|
-
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 };
|
|
7175
|
+
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-
|
|
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-
|
|
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-CmShWI_R.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-CmShWI_R.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;
|
|
@@ -7110,6 +7136,18 @@ declare class EmporixClient {
|
|
|
7110
7136
|
private readonly resolver;
|
|
7111
7137
|
private readonly customerRefresh;
|
|
7112
7138
|
constructor(config: EmporixConfig);
|
|
7139
|
+
/**
|
|
7140
|
+
* Re-binds the storefront price context (currency / siteCode / targetLocation)
|
|
7141
|
+
* for anonymous pricing and invalidates the current anonymous session, so the
|
|
7142
|
+
* next request re-mints a token bound to the new context. Use this to switch
|
|
7143
|
+
* currency at runtime. Carts are currency-bound — clear the cart after a
|
|
7144
|
+
* currency change (the React `setCurrency` does this for you).
|
|
7145
|
+
*/
|
|
7146
|
+
setStorefrontContext(ctx: {
|
|
7147
|
+
currency?: string;
|
|
7148
|
+
siteCode?: string;
|
|
7149
|
+
targetLocation?: string;
|
|
7150
|
+
}): void;
|
|
7113
7151
|
/** Sets the runtime log level globally or for one service. */
|
|
7114
7152
|
setLogLevel(level: LogLevel, opts?: {
|
|
7115
7153
|
service?: ServiceName;
|
|
@@ -7134,4 +7172,4 @@ declare class EmporixClient {
|
|
|
7134
7172
|
*/
|
|
7135
7173
|
declare function productIdFromYrn(yrn: string | undefined): string;
|
|
7136
7174
|
|
|
7137
|
-
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 };
|
|
7175
|
+
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
|
@@ -346,6 +346,7 @@ var DefaultTokenProvider = class {
|
|
|
346
346
|
anon;
|
|
347
347
|
anonLock;
|
|
348
348
|
anonStore;
|
|
349
|
+
contextOverride;
|
|
349
350
|
refreshListeners = /* @__PURE__ */ new Set();
|
|
350
351
|
onRefresh(listener) {
|
|
351
352
|
this.refreshListeners.add(listener);
|
|
@@ -458,6 +459,11 @@ var DefaultTokenProvider = class {
|
|
|
458
459
|
this.anon = void 0;
|
|
459
460
|
this.anonStore?.write(null);
|
|
460
461
|
}
|
|
462
|
+
setAnonymousContext(ctx) {
|
|
463
|
+
const base = this.contextOverride ?? this.cfg.credentials.storefront?.context ?? {};
|
|
464
|
+
this.contextOverride = { ...base, ...ctx };
|
|
465
|
+
this.invalidateAnonymous();
|
|
466
|
+
}
|
|
461
467
|
/** Force a stale access token while keeping the refresh token + sessionId. */
|
|
462
468
|
expireAnonymous() {
|
|
463
469
|
if (this.anon) this.anon = { ...this.anon, expiresAt: 0 };
|
|
@@ -474,7 +480,7 @@ var DefaultTokenProvider = class {
|
|
|
474
480
|
const url = new URL(`${this.cfg.host}/customerlogin/auth/anonymous/${mode}`);
|
|
475
481
|
url.searchParams.set("tenant", this.cfg.tenant);
|
|
476
482
|
url.searchParams.set("client_id", sf.clientId);
|
|
477
|
-
const c = sf.context;
|
|
483
|
+
const c = this.contextOverride ?? sf.context;
|
|
478
484
|
if (c?.currency) url.searchParams.set("currency", c.currency);
|
|
479
485
|
if (c?.siteCode) url.searchParams.set("siteCode", c.siteCode);
|
|
480
486
|
if (c?.targetLocation) url.searchParams.set("targetLocation", c.targetLocation);
|
|
@@ -1268,6 +1274,28 @@ var FeeService = class {
|
|
|
1268
1274
|
}
|
|
1269
1275
|
};
|
|
1270
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
|
+
|
|
1271
1299
|
// src/services/webhook.ts
|
|
1272
1300
|
var SERVICE6 = { kind: "service" };
|
|
1273
1301
|
var WebhookService = class {
|
|
@@ -3440,7 +3468,7 @@ var ApprovalService = class {
|
|
|
3440
3468
|
};
|
|
3441
3469
|
|
|
3442
3470
|
// package.json
|
|
3443
|
-
var version = "2.
|
|
3471
|
+
var version = "2.11.0";
|
|
3444
3472
|
|
|
3445
3473
|
// src/version.ts
|
|
3446
3474
|
var SDK_VERSION = version;
|
|
@@ -3471,6 +3499,7 @@ var EmporixClient = class {
|
|
|
3471
3499
|
ragIndexer;
|
|
3472
3500
|
sequentialIds;
|
|
3473
3501
|
fees;
|
|
3502
|
+
cloudFunctions;
|
|
3474
3503
|
webhooks;
|
|
3475
3504
|
schemas;
|
|
3476
3505
|
ai;
|
|
@@ -3571,6 +3600,7 @@ var EmporixClient = class {
|
|
|
3571
3600
|
this.ragIndexer = new RagIndexerService(mk("ai-rag-indexer"));
|
|
3572
3601
|
this.sequentialIds = new SequentialIdService(mk("sequential-id"));
|
|
3573
3602
|
this.fees = new FeeService(mk("fee"));
|
|
3603
|
+
this.cloudFunctions = new CloudFunctionsService(mk("cloud-functions"));
|
|
3574
3604
|
this.webhooks = new WebhookService(mk("webhook"));
|
|
3575
3605
|
this.schemas = new SchemaService(mk("schema"));
|
|
3576
3606
|
this.ai = new AiService(mk("ai"));
|
|
@@ -3592,6 +3622,16 @@ var EmporixClient = class {
|
|
|
3592
3622
|
this.customerAdmin = new CustomerAdminService(mk("customer-admin"));
|
|
3593
3623
|
this.approvals = new ApprovalService(mk("approval"));
|
|
3594
3624
|
}
|
|
3625
|
+
/**
|
|
3626
|
+
* Re-binds the storefront price context (currency / siteCode / targetLocation)
|
|
3627
|
+
* for anonymous pricing and invalidates the current anonymous session, so the
|
|
3628
|
+
* next request re-mints a token bound to the new context. Use this to switch
|
|
3629
|
+
* currency at runtime. Carts are currency-bound — clear the cart after a
|
|
3630
|
+
* currency change (the React `setCurrency` does this for you).
|
|
3631
|
+
*/
|
|
3632
|
+
setStorefrontContext(ctx) {
|
|
3633
|
+
this.tokenProvider.setAnonymousContext?.(ctx);
|
|
3634
|
+
}
|
|
3595
3635
|
/** Sets the runtime log level globally or for one service. */
|
|
3596
3636
|
setLogLevel(level, opts = {}) {
|
|
3597
3637
|
this.resolver.set(level, opts.service, opts.force ?? false);
|
|
@@ -3618,6 +3658,6 @@ function productIdFromYrn(yrn) {
|
|
|
3618
3658
|
return semi >= 0 ? yrn.slice(semi + 1) : "";
|
|
3619
3659
|
}
|
|
3620
3660
|
|
|
3621
|
-
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 };
|
|
3661
|
+
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 };
|
|
3622
3662
|
//# sourceMappingURL=index.js.map
|
|
3623
3663
|
//# sourceMappingURL=index.js.map
|