@viu/emporix-sdk 2.9.0 → 2.10.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 +18 -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-BBKOwNW6.d.cts} +16 -0
- package/dist/{context-DJDTlhLW.d.ts → context-BBKOwNW6.d.ts} +16 -0
- 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 +18 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -2
- package/dist/index.d.ts +14 -2
- package/dist/index.js +18 -2
- 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-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';
|
|
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';
|
|
@@ -7110,6 +7110,18 @@ declare class EmporixClient {
|
|
|
7110
7110
|
private readonly resolver;
|
|
7111
7111
|
private readonly customerRefresh;
|
|
7112
7112
|
constructor(config: EmporixConfig);
|
|
7113
|
+
/**
|
|
7114
|
+
* Re-binds the storefront price context (currency / siteCode / targetLocation)
|
|
7115
|
+
* for anonymous pricing and invalidates the current anonymous session, so the
|
|
7116
|
+
* next request re-mints a token bound to the new context. Use this to switch
|
|
7117
|
+
* currency at runtime. Carts are currency-bound — clear the cart after a
|
|
7118
|
+
* currency change (the React `setCurrency` does this for you).
|
|
7119
|
+
*/
|
|
7120
|
+
setStorefrontContext(ctx: {
|
|
7121
|
+
currency?: string;
|
|
7122
|
+
siteCode?: string;
|
|
7123
|
+
targetLocation?: string;
|
|
7124
|
+
}): void;
|
|
7113
7125
|
/** Sets the runtime log level globally or for one service. */
|
|
7114
7126
|
setLogLevel(level: LogLevel, opts?: {
|
|
7115
7127
|
service?: ServiceName;
|
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-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';
|
|
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';
|
|
@@ -7110,6 +7110,18 @@ declare class EmporixClient {
|
|
|
7110
7110
|
private readonly resolver;
|
|
7111
7111
|
private readonly customerRefresh;
|
|
7112
7112
|
constructor(config: EmporixConfig);
|
|
7113
|
+
/**
|
|
7114
|
+
* Re-binds the storefront price context (currency / siteCode / targetLocation)
|
|
7115
|
+
* for anonymous pricing and invalidates the current anonymous session, so the
|
|
7116
|
+
* next request re-mints a token bound to the new context. Use this to switch
|
|
7117
|
+
* currency at runtime. Carts are currency-bound — clear the cart after a
|
|
7118
|
+
* currency change (the React `setCurrency` does this for you).
|
|
7119
|
+
*/
|
|
7120
|
+
setStorefrontContext(ctx: {
|
|
7121
|
+
currency?: string;
|
|
7122
|
+
siteCode?: string;
|
|
7123
|
+
targetLocation?: string;
|
|
7124
|
+
}): void;
|
|
7113
7125
|
/** Sets the runtime log level globally or for one service. */
|
|
7114
7126
|
setLogLevel(level: LogLevel, opts?: {
|
|
7115
7127
|
service?: ServiceName;
|
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);
|
|
@@ -3440,7 +3446,7 @@ var ApprovalService = class {
|
|
|
3440
3446
|
};
|
|
3441
3447
|
|
|
3442
3448
|
// package.json
|
|
3443
|
-
var version = "2.
|
|
3449
|
+
var version = "2.10.0";
|
|
3444
3450
|
|
|
3445
3451
|
// src/version.ts
|
|
3446
3452
|
var SDK_VERSION = version;
|
|
@@ -3592,6 +3598,16 @@ var EmporixClient = class {
|
|
|
3592
3598
|
this.customerAdmin = new CustomerAdminService(mk("customer-admin"));
|
|
3593
3599
|
this.approvals = new ApprovalService(mk("approval"));
|
|
3594
3600
|
}
|
|
3601
|
+
/**
|
|
3602
|
+
* Re-binds the storefront price context (currency / siteCode / targetLocation)
|
|
3603
|
+
* for anonymous pricing and invalidates the current anonymous session, so the
|
|
3604
|
+
* next request re-mints a token bound to the new context. Use this to switch
|
|
3605
|
+
* currency at runtime. Carts are currency-bound — clear the cart after a
|
|
3606
|
+
* currency change (the React `setCurrency` does this for you).
|
|
3607
|
+
*/
|
|
3608
|
+
setStorefrontContext(ctx) {
|
|
3609
|
+
this.tokenProvider.setAnonymousContext?.(ctx);
|
|
3610
|
+
}
|
|
3595
3611
|
/** Sets the runtime log level globally or for one service. */
|
|
3596
3612
|
setLogLevel(level, opts = {}) {
|
|
3597
3613
|
this.resolver.set(level, opts.service, opts.force ?? false);
|