@viu/emporix-sdk 2.8.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 +82 -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/{chunk-5JHTZBOC.js → chunk-B4UOYJKW.js} +12 -2
- package/dist/chunk-B4UOYJKW.js.map +1 -0
- package/dist/{chunk-SCI7D74B.js → chunk-BK25FDTH.js} +17 -5
- package/dist/chunk-BK25FDTH.js.map +1 -0
- package/dist/{chunk-B56JZNI7.js → chunk-HAEVK6IS.js} +6 -3
- package/dist/chunk-HAEVK6IS.js.map +1 -0
- package/dist/{chunk-6UNFMCHZ.js → chunk-KVBCTXVH.js} +2 -2
- package/dist/chunk-KVBCTXVH.js.map +1 -0
- package/dist/{chunk-NM7VDXBR.js → chunk-LGLFJL3S.js} +6 -3
- package/dist/chunk-LGLFJL3S.js.map +1 -0
- package/dist/chunk-LGOC5XOI.js +40 -0
- package/dist/chunk-LGOC5XOI.js.map +1 -0
- package/dist/{chunk-RXVVFNYN.js → chunk-MM6JF3Z7.js} +6 -3
- package/dist/chunk-MM6JF3Z7.js.map +1 -0
- package/dist/companies.cjs +4 -1
- package/dist/companies.cjs.map +1 -1
- package/dist/companies.d.cts +8 -5
- package/dist/companies.d.ts +8 -5
- package/dist/companies.js +1 -1
- package/dist/contacts.cjs +4 -1
- package/dist/contacts.cjs.map +1 -1
- package/dist/contacts.d.cts +7 -5
- package/dist/contacts.d.ts +7 -5
- package/dist/contacts.js +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.cjs +17 -0
- package/dist/customer-groups.cjs.map +1 -1
- package/dist/customer-groups.d.cts +95 -22
- package/dist/customer-groups.d.ts +95 -22
- package/dist/customer-groups.js +1 -1
- package/dist/customer.d.cts +1 -1
- package/dist/customer.d.ts +1 -1
- package/dist/index.cjs +80 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -7
- package/dist/index.d.ts +27 -7
- package/dist/index.js +40 -17
- package/dist/index.js.map +1 -1
- package/dist/locations.cjs +4 -1
- package/dist/locations.cjs.map +1 -1
- package/dist/locations.d.cts +8 -5
- package/dist/locations.d.ts +8 -5
- package/dist/locations.js +1 -1
- package/dist/media.d.cts +1 -1
- package/dist/media.d.ts +1 -1
- package/dist/orders.cjs.map +1 -1
- package/dist/orders.d.cts +1727 -81
- package/dist/orders.d.ts +1727 -81
- package/dist/orders.js +1 -1
- package/dist/payment.d.cts +1 -1
- package/dist/payment.d.ts +1 -1
- package/dist/price.cjs +15 -3
- package/dist/price.cjs.map +1 -1
- package/dist/price.d.cts +24 -5
- package/dist/price.d.ts +24 -5
- package/dist/price.js +1 -1
- package/dist/product.cjs +10 -0
- package/dist/product.cjs.map +1 -1
- package/dist/product.d.cts +11 -1
- package/dist/product.d.ts +11 -1
- package/dist/product.js +1 -1
- package/dist/segment.d.cts +1 -1
- package/dist/segment.d.ts +1 -1
- package/dist/types.gen-C_wOXYZB.d.cts +455 -0
- package/dist/types.gen-C_wOXYZB.d.ts +455 -0
- package/package.json +1 -1
- package/dist/chunk-5JHTZBOC.js.map +0 -1
- package/dist/chunk-6UNFMCHZ.js.map +0 -1
- package/dist/chunk-B56JZNI7.js.map +0 -1
- package/dist/chunk-NM7VDXBR.js.map +0 -1
- package/dist/chunk-RXVVFNYN.js.map +0 -1
- package/dist/chunk-SCI7D74B.js.map +0 -1
- package/dist/chunk-SKX7KCMH.js +0 -23
- package/dist/chunk-SKX7KCMH.js.map +0 -1
- package/dist/types.gen-D1QuqPLs.d.cts +0 -166
- package/dist/types.gen-D1QuqPLs.d.ts +0 -166
package/dist/contacts.d.cts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { C as ClientContext, b as AuthContext } from './context-
|
|
2
|
-
import { C as ContactAssignment, a as ContactAssignmentCreate,
|
|
3
|
-
export { b as ContactAssignmentType } from './types.gen-D1QuqPLs.cjs';
|
|
1
|
+
import { C as ClientContext, b as AuthContext } from './context-BBKOwNW6.cjs';
|
|
2
|
+
import { C as ContactAssignment, a as ContactAssignmentCreate, b as ContactAssignmentUpdate } from './types.gen-C_wOXYZB.cjs';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* Manages contact assignments linking customers to legal entities.
|
|
@@ -19,8 +18,11 @@ declare class ContactsService {
|
|
|
19
18
|
assign(input: ContactAssignmentCreate, auth: AuthContext): Promise<{
|
|
20
19
|
id: string;
|
|
21
20
|
}>;
|
|
22
|
-
/**
|
|
23
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Patches a contact assignment. PATCH endpoint, so the body is a partial of
|
|
23
|
+
* the generated `ContactAssignmentUpdate` shape.
|
|
24
|
+
*/
|
|
25
|
+
update(contactAssignmentId: string, patch: Partial<ContactAssignmentUpdate>, auth: AuthContext): Promise<ContactAssignment>;
|
|
24
26
|
/** Deletes a contact assignment. */
|
|
25
27
|
unassign(contactAssignmentId: string, auth: AuthContext): Promise<void>;
|
|
26
28
|
}
|
package/dist/contacts.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { C as ClientContext, b as AuthContext } from './context-
|
|
2
|
-
import { C as ContactAssignment, a as ContactAssignmentCreate,
|
|
3
|
-
export { b as ContactAssignmentType } from './types.gen-D1QuqPLs.js';
|
|
1
|
+
import { C as ClientContext, b as AuthContext } from './context-BBKOwNW6.js';
|
|
2
|
+
import { C as ContactAssignment, a as ContactAssignmentCreate, b as ContactAssignmentUpdate } from './types.gen-C_wOXYZB.js';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* Manages contact assignments linking customers to legal entities.
|
|
@@ -19,8 +18,11 @@ declare class ContactsService {
|
|
|
19
18
|
assign(input: ContactAssignmentCreate, auth: AuthContext): Promise<{
|
|
20
19
|
id: string;
|
|
21
20
|
}>;
|
|
22
|
-
/**
|
|
23
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Patches a contact assignment. PATCH endpoint, so the body is a partial of
|
|
23
|
+
* the generated `ContactAssignmentUpdate` shape.
|
|
24
|
+
*/
|
|
25
|
+
update(contactAssignmentId: string, patch: Partial<ContactAssignmentUpdate>, auth: AuthContext): Promise<ContactAssignment>;
|
|
24
26
|
/** Deletes a contact assignment. */
|
|
25
27
|
unassign(contactAssignmentId: string, auth: AuthContext): Promise<void>;
|
|
26
28
|
}
|
package/dist/contacts.js
CHANGED
|
@@ -222,6 +222,16 @@ interface TokenProvider {
|
|
|
222
222
|
* replaces the previous adapter.
|
|
223
223
|
*/
|
|
224
224
|
attachAnonymousStore?(store: AnonymousSessionStore): void;
|
|
225
|
+
/**
|
|
226
|
+
* Override the storefront context (currency/site/country) used for the next
|
|
227
|
+
* anonymous login, then invalidate the current anonymous session so it
|
|
228
|
+
* re-mints with the new context. No-op for providers without anon support.
|
|
229
|
+
*/
|
|
230
|
+
setAnonymousContext?(ctx: {
|
|
231
|
+
currency?: string;
|
|
232
|
+
siteCode?: string;
|
|
233
|
+
targetLocation?: string;
|
|
234
|
+
}): void;
|
|
225
235
|
/**
|
|
226
236
|
* Subscribe to token-refresh events. Optional — implementations may no-op.
|
|
227
237
|
* Returns an unsubscribe function. `DefaultTokenProvider` emits for the
|
|
@@ -267,6 +277,7 @@ declare class DefaultTokenProvider implements TokenProvider {
|
|
|
267
277
|
private anon;
|
|
268
278
|
private anonLock;
|
|
269
279
|
private anonStore?;
|
|
280
|
+
private contextOverride;
|
|
270
281
|
private readonly refreshListeners;
|
|
271
282
|
constructor(cfg: ResolvedConfig);
|
|
272
283
|
onRefresh(listener: (event: {
|
|
@@ -285,6 +296,11 @@ declare class DefaultTokenProvider implements TokenProvider {
|
|
|
285
296
|
/** Refreshes the anonymous session, preserving its sessionId. */
|
|
286
297
|
refreshAnonymous(): Promise<AnonymousSession>;
|
|
287
298
|
invalidateAnonymous(): void;
|
|
299
|
+
setAnonymousContext(ctx: {
|
|
300
|
+
currency?: string;
|
|
301
|
+
siteCode?: string;
|
|
302
|
+
targetLocation?: string;
|
|
303
|
+
}): void;
|
|
288
304
|
/** Force a stale access token while keeping the refresh token + sessionId. */
|
|
289
305
|
expireAnonymous(): void;
|
|
290
306
|
private stripExpiry;
|
|
@@ -222,6 +222,16 @@ interface TokenProvider {
|
|
|
222
222
|
* replaces the previous adapter.
|
|
223
223
|
*/
|
|
224
224
|
attachAnonymousStore?(store: AnonymousSessionStore): void;
|
|
225
|
+
/**
|
|
226
|
+
* Override the storefront context (currency/site/country) used for the next
|
|
227
|
+
* anonymous login, then invalidate the current anonymous session so it
|
|
228
|
+
* re-mints with the new context. No-op for providers without anon support.
|
|
229
|
+
*/
|
|
230
|
+
setAnonymousContext?(ctx: {
|
|
231
|
+
currency?: string;
|
|
232
|
+
siteCode?: string;
|
|
233
|
+
targetLocation?: string;
|
|
234
|
+
}): void;
|
|
225
235
|
/**
|
|
226
236
|
* Subscribe to token-refresh events. Optional — implementations may no-op.
|
|
227
237
|
* Returns an unsubscribe function. `DefaultTokenProvider` emits for the
|
|
@@ -267,6 +277,7 @@ declare class DefaultTokenProvider implements TokenProvider {
|
|
|
267
277
|
private anon;
|
|
268
278
|
private anonLock;
|
|
269
279
|
private anonStore?;
|
|
280
|
+
private contextOverride;
|
|
270
281
|
private readonly refreshListeners;
|
|
271
282
|
constructor(cfg: ResolvedConfig);
|
|
272
283
|
onRefresh(listener: (event: {
|
|
@@ -285,6 +296,11 @@ declare class DefaultTokenProvider implements TokenProvider {
|
|
|
285
296
|
/** Refreshes the anonymous session, preserving its sessionId. */
|
|
286
297
|
refreshAnonymous(): Promise<AnonymousSession>;
|
|
287
298
|
invalidateAnonymous(): void;
|
|
299
|
+
setAnonymousContext(ctx: {
|
|
300
|
+
currency?: string;
|
|
301
|
+
siteCode?: string;
|
|
302
|
+
targetLocation?: string;
|
|
303
|
+
}): void;
|
|
288
304
|
/** Force a stale access token while keeping the refresh token + sessionId. */
|
|
289
305
|
expireAnonymous(): void;
|
|
290
306
|
private stripExpiry;
|
package/dist/customer-groups.cjs
CHANGED
|
@@ -18,6 +18,23 @@ var CustomerGroupsService = class {
|
|
|
18
18
|
auth
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
+
/** Adds a user (customer or employee) to a group. */
|
|
22
|
+
async addMember(groupId, member, auth) {
|
|
23
|
+
return this.ctx.http.request({
|
|
24
|
+
method: "POST",
|
|
25
|
+
path: `${this.base()}/${groupId}/users`,
|
|
26
|
+
auth,
|
|
27
|
+
body: member
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/** Removes a user from a group. */
|
|
31
|
+
async removeMember(groupId, userId, auth) {
|
|
32
|
+
await this.ctx.http.request({
|
|
33
|
+
method: "DELETE",
|
|
34
|
+
path: `${this.base()}/${groupId}/users/${userId}`,
|
|
35
|
+
auth
|
|
36
|
+
});
|
|
37
|
+
}
|
|
21
38
|
};
|
|
22
39
|
|
|
23
40
|
exports.CustomerGroupsService = CustomerGroupsService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/services/customer-groups.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"sources":["../src/services/customer-groups.ts"],"names":[],"mappings":";;;AAeO,IAAM,wBAAN,MAA4B;AAAA,EACjC,YAA6B,GAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,GAAA,GAAA,GAAA;AAAA,EAAqB;AAAA,EAArB,GAAA;AAAA,EAErB,IAAA,GAAe;AACrB,IAAA,OAAO,CAAA,KAAA,EAAQ,IAAA,CAAK,GAAA,CAAI,MAAM,CAAA,OAAA,CAAA;AAAA,EAChC;AAAA;AAAA,EAGA,MAAM,cAAA,CAAe,aAAA,EAAuB,IAAA,EAAmD;AAC7F,IAAA,OAAO,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAA+B;AAAA,MAClD,MAAA,EAAQ,KAAA;AAAA,MACR,IAAA,EAAM,KAAK,IAAA,EAAK;AAAA,MAChB,KAAA,EAAO,EAAE,mBAAA,EAAqB,aAAA,EAAc;AAAA,MAC5C;AAAA,KACD,CAAA;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,SAAA,CACJ,OAAA,EACA,MAAA,EACA,IAAA,EACyB;AACzB,IAAA,OAAO,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAAwB;AAAA,MAC3C,MAAA,EAAQ,MAAA;AAAA,MACR,MAAM,CAAA,EAAG,IAAA,CAAK,IAAA,EAAM,IAAI,OAAO,CAAA,MAAA,CAAA;AAAA,MAC/B,IAAA;AAAA,MACA,IAAA,EAAM;AAAA,KACP,CAAA;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,YAAA,CAAa,OAAA,EAAiB,MAAA,EAAgB,IAAA,EAAkC;AACpF,IAAA,MAAM,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAAc;AAAA,MAChC,MAAA,EAAQ,QAAA;AAAA,MACR,IAAA,EAAM,GAAG,IAAA,CAAK,IAAA,EAAM,CAAA,CAAA,EAAI,OAAO,UAAU,MAAM,CAAA,CAAA;AAAA,MAC/C;AAAA,KACD,CAAA;AAAA,EACH;AACF","file":"customer-groups.cjs","sourcesContent":["import type { ClientContext } from \"../core/context\";\nimport type { AuthContext } from \"../core/auth\";\nimport type {\n GroupsQueryDocument,\n AssignmentCreateRequest,\n} from \"../generated/iam\";\n\n/**\n * Access to IAM customer groups for a legal entity.\n *\n * `listForCompany` requires `iam.group_read`; the member mutations\n * (`addMember`/`removeMember`) require `iam.group_manage` — typically only\n * granted to Admin-group customers; a 403 surfaces as\n * `EmporixInsufficientScopeError`.\n */\nexport class CustomerGroupsService {\n constructor(private readonly ctx: ClientContext) {}\n\n private base(): string {\n return `/iam/${this.ctx.tenant}/groups`;\n }\n\n /** Lists customer groups belonging to one legal entity. */\n async listForCompany(legalEntityId: string, auth: AuthContext): Promise<GroupsQueryDocument[]> {\n return this.ctx.http.request<GroupsQueryDocument[]>({\n method: \"GET\",\n path: this.base(),\n query: { \"b2b.legalEntityId\": legalEntityId },\n auth,\n });\n }\n\n /** Adds a user (customer or employee) to a group. */\n async addMember(\n groupId: string,\n member: AssignmentCreateRequest,\n auth: AuthContext,\n ): Promise<{ id: string }> {\n return this.ctx.http.request<{ id: string }>({\n method: \"POST\",\n path: `${this.base()}/${groupId}/users`,\n auth,\n body: member,\n });\n }\n\n /** Removes a user from a group. */\n async removeMember(groupId: string, userId: string, auth: AuthContext): Promise<void> {\n await this.ctx.http.request<void>({\n method: \"DELETE\",\n path: `${this.base()}/${groupId}/users/${userId}`,\n auth,\n });\n }\n}\n"]}
|
|
@@ -1,36 +1,109 @@
|
|
|
1
|
-
import { C as ClientContext, b as AuthContext } from './context-
|
|
1
|
+
import { C as ClientContext, b as AuthContext } from './context-BBKOwNW6.cjs';
|
|
2
2
|
|
|
3
|
+
type AssignmentCreateRequest = {
|
|
4
|
+
/**
|
|
5
|
+
* User unique identifier generated when the user is created. Might be customer ID or Management Dashboard user ID.
|
|
6
|
+
*/
|
|
7
|
+
userId: string;
|
|
8
|
+
/**
|
|
9
|
+
* Assignment type, possible values: CUSTOMER, EMPLOYEE
|
|
10
|
+
*/
|
|
11
|
+
userType?: 'CUSTOMER' | 'EMPLOYEE';
|
|
12
|
+
};
|
|
3
13
|
/**
|
|
4
|
-
*
|
|
5
|
-
* B2B foundation reads. The Emporix IAM API exposes groups keyed by
|
|
6
|
-
* `b2b.legalEntityId`. Membership-mutation endpoints exist on the server
|
|
7
|
-
* but their exact path/body shape is not in the current SDK input set —
|
|
8
|
-
* `customer-groups.ts` ships read-only here; mutations follow in a small
|
|
9
|
-
* follow-up plan once the API reference is confirmed.
|
|
14
|
+
* Group metadata.
|
|
10
15
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
type GroupsMetadataQueryDocument = {
|
|
17
|
+
/**
|
|
18
|
+
* Group document version.
|
|
19
|
+
*/
|
|
20
|
+
version: number;
|
|
21
|
+
/**
|
|
22
|
+
* Timestamp indicating when the group was created.
|
|
23
|
+
*/
|
|
24
|
+
createdAt: string;
|
|
25
|
+
/**
|
|
26
|
+
* Timestamp indicating when the group was last modified.
|
|
27
|
+
*/
|
|
28
|
+
modifiedAt?: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Definition of groups
|
|
32
|
+
*/
|
|
33
|
+
type GroupsQueryDocument = {
|
|
34
|
+
/**
|
|
35
|
+
* Group unique identifier generated when the group is created.
|
|
36
|
+
*/
|
|
37
|
+
id?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Localized group name in the form of a map of translations.
|
|
40
|
+
*/
|
|
41
|
+
name?: {
|
|
42
|
+
[key: string]: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Localized group description in the form of a map of translations.
|
|
46
|
+
*/
|
|
47
|
+
description?: {
|
|
48
|
+
[key: string]: string;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* An identifier of a vendor to whom the group belongs. Can only be set during creation and is immutable thereafter. A group with vendorId can only be assigned to users of type `EMPLOYEE`
|
|
52
|
+
*/
|
|
53
|
+
readonly vendorId?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Access control unique identifiers associated with this group.
|
|
56
|
+
*/
|
|
57
|
+
accessControls?: Array<string>;
|
|
58
|
+
/**
|
|
59
|
+
* Template unique identifiers associated with this group.
|
|
60
|
+
*/
|
|
61
|
+
templates?: Array<string>;
|
|
62
|
+
code?: string;
|
|
63
|
+
/**
|
|
64
|
+
* The group type determines if the group can consist of users of the `CUSTOMER` or the `EMPLOYEE` type.
|
|
65
|
+
*/
|
|
66
|
+
userType?: string;
|
|
67
|
+
/**
|
|
68
|
+
* additional properties for B2B
|
|
69
|
+
*/
|
|
70
|
+
b2b?: {
|
|
71
|
+
/**
|
|
72
|
+
* identifier of the assigned legal entity
|
|
73
|
+
*/
|
|
74
|
+
legalEntityId?: string;
|
|
75
|
+
};
|
|
76
|
+
restrictions?: Restrictions;
|
|
77
|
+
/**
|
|
78
|
+
* Custom group attributes that need to be included directly in the `mixins` object.
|
|
79
|
+
*/
|
|
80
|
+
mixins?: {
|
|
81
|
+
[key: string]: string;
|
|
82
|
+
};
|
|
83
|
+
metadata?: GroupsMetadataQueryDocument;
|
|
84
|
+
};
|
|
85
|
+
type Restrictions = Array<string>;
|
|
20
86
|
|
|
21
87
|
/**
|
|
22
|
-
*
|
|
88
|
+
* Access to IAM customer groups for a legal entity.
|
|
23
89
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
90
|
+
* `listForCompany` requires `iam.group_read`; the member mutations
|
|
91
|
+
* (`addMember`/`removeMember`) require `iam.group_manage` — typically only
|
|
92
|
+
* granted to Admin-group customers; a 403 surfaces as
|
|
93
|
+
* `EmporixInsufficientScopeError`.
|
|
27
94
|
*/
|
|
28
95
|
declare class CustomerGroupsService {
|
|
29
96
|
private readonly ctx;
|
|
30
97
|
constructor(ctx: ClientContext);
|
|
31
98
|
private base;
|
|
32
99
|
/** Lists customer groups belonging to one legal entity. */
|
|
33
|
-
listForCompany(legalEntityId: string, auth: AuthContext): Promise<
|
|
100
|
+
listForCompany(legalEntityId: string, auth: AuthContext): Promise<GroupsQueryDocument[]>;
|
|
101
|
+
/** Adds a user (customer or employee) to a group. */
|
|
102
|
+
addMember(groupId: string, member: AssignmentCreateRequest, auth: AuthContext): Promise<{
|
|
103
|
+
id: string;
|
|
104
|
+
}>;
|
|
105
|
+
/** Removes a user from a group. */
|
|
106
|
+
removeMember(groupId: string, userId: string, auth: AuthContext): Promise<void>;
|
|
34
107
|
}
|
|
35
108
|
|
|
36
|
-
export { CustomerGroupsService, type IamGroup, type
|
|
109
|
+
export { CustomerGroupsService, type GroupsQueryDocument as IamGroup, type AssignmentCreateRequest as IamGroupMemberAssignment };
|
|
@@ -1,36 +1,109 @@
|
|
|
1
|
-
import { C as ClientContext, b as AuthContext } from './context-
|
|
1
|
+
import { C as ClientContext, b as AuthContext } from './context-BBKOwNW6.js';
|
|
2
2
|
|
|
3
|
+
type AssignmentCreateRequest = {
|
|
4
|
+
/**
|
|
5
|
+
* User unique identifier generated when the user is created. Might be customer ID or Management Dashboard user ID.
|
|
6
|
+
*/
|
|
7
|
+
userId: string;
|
|
8
|
+
/**
|
|
9
|
+
* Assignment type, possible values: CUSTOMER, EMPLOYEE
|
|
10
|
+
*/
|
|
11
|
+
userType?: 'CUSTOMER' | 'EMPLOYEE';
|
|
12
|
+
};
|
|
3
13
|
/**
|
|
4
|
-
*
|
|
5
|
-
* B2B foundation reads. The Emporix IAM API exposes groups keyed by
|
|
6
|
-
* `b2b.legalEntityId`. Membership-mutation endpoints exist on the server
|
|
7
|
-
* but their exact path/body shape is not in the current SDK input set —
|
|
8
|
-
* `customer-groups.ts` ships read-only here; mutations follow in a small
|
|
9
|
-
* follow-up plan once the API reference is confirmed.
|
|
14
|
+
* Group metadata.
|
|
10
15
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
type GroupsMetadataQueryDocument = {
|
|
17
|
+
/**
|
|
18
|
+
* Group document version.
|
|
19
|
+
*/
|
|
20
|
+
version: number;
|
|
21
|
+
/**
|
|
22
|
+
* Timestamp indicating when the group was created.
|
|
23
|
+
*/
|
|
24
|
+
createdAt: string;
|
|
25
|
+
/**
|
|
26
|
+
* Timestamp indicating when the group was last modified.
|
|
27
|
+
*/
|
|
28
|
+
modifiedAt?: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Definition of groups
|
|
32
|
+
*/
|
|
33
|
+
type GroupsQueryDocument = {
|
|
34
|
+
/**
|
|
35
|
+
* Group unique identifier generated when the group is created.
|
|
36
|
+
*/
|
|
37
|
+
id?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Localized group name in the form of a map of translations.
|
|
40
|
+
*/
|
|
41
|
+
name?: {
|
|
42
|
+
[key: string]: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Localized group description in the form of a map of translations.
|
|
46
|
+
*/
|
|
47
|
+
description?: {
|
|
48
|
+
[key: string]: string;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* An identifier of a vendor to whom the group belongs. Can only be set during creation and is immutable thereafter. A group with vendorId can only be assigned to users of type `EMPLOYEE`
|
|
52
|
+
*/
|
|
53
|
+
readonly vendorId?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Access control unique identifiers associated with this group.
|
|
56
|
+
*/
|
|
57
|
+
accessControls?: Array<string>;
|
|
58
|
+
/**
|
|
59
|
+
* Template unique identifiers associated with this group.
|
|
60
|
+
*/
|
|
61
|
+
templates?: Array<string>;
|
|
62
|
+
code?: string;
|
|
63
|
+
/**
|
|
64
|
+
* The group type determines if the group can consist of users of the `CUSTOMER` or the `EMPLOYEE` type.
|
|
65
|
+
*/
|
|
66
|
+
userType?: string;
|
|
67
|
+
/**
|
|
68
|
+
* additional properties for B2B
|
|
69
|
+
*/
|
|
70
|
+
b2b?: {
|
|
71
|
+
/**
|
|
72
|
+
* identifier of the assigned legal entity
|
|
73
|
+
*/
|
|
74
|
+
legalEntityId?: string;
|
|
75
|
+
};
|
|
76
|
+
restrictions?: Restrictions;
|
|
77
|
+
/**
|
|
78
|
+
* Custom group attributes that need to be included directly in the `mixins` object.
|
|
79
|
+
*/
|
|
80
|
+
mixins?: {
|
|
81
|
+
[key: string]: string;
|
|
82
|
+
};
|
|
83
|
+
metadata?: GroupsMetadataQueryDocument;
|
|
84
|
+
};
|
|
85
|
+
type Restrictions = Array<string>;
|
|
20
86
|
|
|
21
87
|
/**
|
|
22
|
-
*
|
|
88
|
+
* Access to IAM customer groups for a legal entity.
|
|
23
89
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
90
|
+
* `listForCompany` requires `iam.group_read`; the member mutations
|
|
91
|
+
* (`addMember`/`removeMember`) require `iam.group_manage` — typically only
|
|
92
|
+
* granted to Admin-group customers; a 403 surfaces as
|
|
93
|
+
* `EmporixInsufficientScopeError`.
|
|
27
94
|
*/
|
|
28
95
|
declare class CustomerGroupsService {
|
|
29
96
|
private readonly ctx;
|
|
30
97
|
constructor(ctx: ClientContext);
|
|
31
98
|
private base;
|
|
32
99
|
/** Lists customer groups belonging to one legal entity. */
|
|
33
|
-
listForCompany(legalEntityId: string, auth: AuthContext): Promise<
|
|
100
|
+
listForCompany(legalEntityId: string, auth: AuthContext): Promise<GroupsQueryDocument[]>;
|
|
101
|
+
/** Adds a user (customer or employee) to a group. */
|
|
102
|
+
addMember(groupId: string, member: AssignmentCreateRequest, auth: AuthContext): Promise<{
|
|
103
|
+
id: string;
|
|
104
|
+
}>;
|
|
105
|
+
/** Removes a user from a group. */
|
|
106
|
+
removeMember(groupId: string, userId: string, auth: AuthContext): Promise<void>;
|
|
34
107
|
}
|
|
35
108
|
|
|
36
|
-
export { CustomerGroupsService, type IamGroup, type
|
|
109
|
+
export { CustomerGroupsService, type GroupsQueryDocument as IamGroup, type AssignmentCreateRequest as IamGroupMemberAssignment };
|
package/dist/customer-groups.js
CHANGED
package/dist/customer.d.cts
CHANGED
package/dist/customer.d.ts
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -396,6 +396,7 @@ var DefaultTokenProvider = class {
|
|
|
396
396
|
anon;
|
|
397
397
|
anonLock;
|
|
398
398
|
anonStore;
|
|
399
|
+
contextOverride;
|
|
399
400
|
refreshListeners = /* @__PURE__ */ new Set();
|
|
400
401
|
onRefresh(listener) {
|
|
401
402
|
this.refreshListeners.add(listener);
|
|
@@ -508,6 +509,11 @@ var DefaultTokenProvider = class {
|
|
|
508
509
|
this.anon = void 0;
|
|
509
510
|
this.anonStore?.write(null);
|
|
510
511
|
}
|
|
512
|
+
setAnonymousContext(ctx) {
|
|
513
|
+
const base = this.contextOverride ?? this.cfg.credentials.storefront?.context ?? {};
|
|
514
|
+
this.contextOverride = { ...base, ...ctx };
|
|
515
|
+
this.invalidateAnonymous();
|
|
516
|
+
}
|
|
511
517
|
/** Force a stale access token while keeping the refresh token + sessionId. */
|
|
512
518
|
expireAnonymous() {
|
|
513
519
|
if (this.anon) this.anon = { ...this.anon, expiresAt: 0 };
|
|
@@ -524,7 +530,7 @@ var DefaultTokenProvider = class {
|
|
|
524
530
|
const url = new URL(`${this.cfg.host}/customerlogin/auth/anonymous/${mode}`);
|
|
525
531
|
url.searchParams.set("tenant", this.cfg.tenant);
|
|
526
532
|
url.searchParams.set("client_id", sf.clientId);
|
|
527
|
-
const c = sf.context;
|
|
533
|
+
const c = this.contextOverride ?? sf.context;
|
|
528
534
|
if (c?.currency) url.searchParams.set("currency", c.currency);
|
|
529
535
|
if (c?.siteCode) url.searchParams.set("siteCode", c.siteCode);
|
|
530
536
|
if (c?.targetLocation) url.searchParams.set("targetLocation", c.targetLocation);
|
|
@@ -1001,6 +1007,16 @@ var ProductService = class {
|
|
|
1001
1007
|
});
|
|
1002
1008
|
return { items, pageNumber, pageSize, hasNextPage: items.length === pageSize };
|
|
1003
1009
|
}
|
|
1010
|
+
/**
|
|
1011
|
+
* Free-text product search by name. The product `q` is a `field:value` DSL,
|
|
1012
|
+
* so a bare term (e.g. "in time") 400s with "No value for key …". This builds
|
|
1013
|
+
* a `name:(~<term>)` regex filter (regex metacharacters escaped) and delegates
|
|
1014
|
+
* to {@link search}.
|
|
1015
|
+
*/
|
|
1016
|
+
async searchByName(query, params = {}, auth2 = ANON) {
|
|
1017
|
+
const escaped = query.trim().replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1018
|
+
return this.search(`name:(~${escaped})`, params, auth2);
|
|
1019
|
+
}
|
|
1004
1020
|
/**
|
|
1005
1021
|
* Bulk fetch by id. POSTs `/products/search` with `q="id:(id1,id2,…)"`,
|
|
1006
1022
|
* chunking when the list is larger than `options.chunkSize` (default
|
|
@@ -1464,6 +1480,16 @@ var PaymentGatewayService = class {
|
|
|
1464
1480
|
};
|
|
1465
1481
|
|
|
1466
1482
|
// src/services/price.ts
|
|
1483
|
+
function normalizeMatch(raw) {
|
|
1484
|
+
const itemId = raw.itemId ?? raw.itemRef;
|
|
1485
|
+
const base = raw;
|
|
1486
|
+
if (!itemId) return base;
|
|
1487
|
+
const itemRef = {
|
|
1488
|
+
...itemId.itemType !== void 0 ? { itemType: itemId.itemType } : {},
|
|
1489
|
+
...itemId.id !== void 0 ? { id: itemId.id } : {}
|
|
1490
|
+
};
|
|
1491
|
+
return { ...base, itemId, itemRef };
|
|
1492
|
+
}
|
|
1467
1493
|
var ANON3 = { kind: "anonymous" };
|
|
1468
1494
|
var SERVICE = { kind: "service" };
|
|
1469
1495
|
function requireContextAuth(auth2) {
|
|
@@ -1484,24 +1510,26 @@ var PriceService = class {
|
|
|
1484
1510
|
* anonymous; pass a customer/raw context for personalized pricing.
|
|
1485
1511
|
*/
|
|
1486
1512
|
async matchByContext(input, auth2) {
|
|
1487
|
-
|
|
1513
|
+
const rows = await this.ctx.http.request({
|
|
1488
1514
|
method: "POST",
|
|
1489
1515
|
path: `/price/${this.ctx.tenant}/match-prices-by-context`,
|
|
1490
1516
|
auth: requireContextAuth(auth2),
|
|
1491
1517
|
body: input
|
|
1492
1518
|
});
|
|
1519
|
+
return rows.map(normalizeMatch);
|
|
1493
1520
|
}
|
|
1494
1521
|
/**
|
|
1495
1522
|
* Resolves prices from an explicit context. Default auth: service
|
|
1496
1523
|
* (requires `price.price_read` / `price.price_manage`).
|
|
1497
1524
|
*/
|
|
1498
1525
|
async match(input, auth2 = SERVICE) {
|
|
1499
|
-
|
|
1526
|
+
const rows = await this.ctx.http.request({
|
|
1500
1527
|
method: "POST",
|
|
1501
1528
|
path: `/price/${this.ctx.tenant}/match-prices`,
|
|
1502
1529
|
auth: auth2,
|
|
1503
1530
|
body: input
|
|
1504
1531
|
});
|
|
1532
|
+
return rows.map(normalizeMatch);
|
|
1505
1533
|
}
|
|
1506
1534
|
/**
|
|
1507
1535
|
* Chunked variant of {@link matchByContext} for large `items` arrays. The
|
|
@@ -1514,7 +1542,7 @@ var PriceService = class {
|
|
|
1514
1542
|
* `throwOnAnyChunkError: true` to reject on the first failure instead.
|
|
1515
1543
|
*
|
|
1516
1544
|
* **Result order is not guaranteed** — match entries back to your items by
|
|
1517
|
-
* `priceId` / `
|
|
1545
|
+
* `priceId` / `itemId.id`.
|
|
1518
1546
|
*/
|
|
1519
1547
|
async matchByContextChunked(input, opts = {}, auth2) {
|
|
1520
1548
|
const chunkSize = opts.chunkSize ?? 50;
|
|
@@ -2064,7 +2092,10 @@ var CompaniesService = class {
|
|
|
2064
2092
|
body: input
|
|
2065
2093
|
});
|
|
2066
2094
|
}
|
|
2067
|
-
/**
|
|
2095
|
+
/**
|
|
2096
|
+
* Patches a legal entity. The endpoint is a PATCH, so the body is a partial
|
|
2097
|
+
* of the generated `LegalEntityUpdate` (full-replace) shape.
|
|
2098
|
+
*/
|
|
2068
2099
|
async update(legalEntityId, patch, auth2) {
|
|
2069
2100
|
return this.ctx.http.request({
|
|
2070
2101
|
method: "PATCH",
|
|
@@ -2110,7 +2141,10 @@ var ContactsService = class {
|
|
|
2110
2141
|
body: input
|
|
2111
2142
|
});
|
|
2112
2143
|
}
|
|
2113
|
-
/**
|
|
2144
|
+
/**
|
|
2145
|
+
* Patches a contact assignment. PATCH endpoint, so the body is a partial of
|
|
2146
|
+
* the generated `ContactAssignmentUpdate` shape.
|
|
2147
|
+
*/
|
|
2114
2148
|
async update(contactAssignmentId, patch, auth2) {
|
|
2115
2149
|
return this.ctx.http.request({
|
|
2116
2150
|
method: "PATCH",
|
|
@@ -2164,7 +2198,10 @@ var LocationsService = class {
|
|
|
2164
2198
|
body: input
|
|
2165
2199
|
});
|
|
2166
2200
|
}
|
|
2167
|
-
/**
|
|
2201
|
+
/**
|
|
2202
|
+
* Patches a location. PATCH endpoint, so the body is a partial of the
|
|
2203
|
+
* generated `LocationUpdate` shape.
|
|
2204
|
+
*/
|
|
2168
2205
|
async update(locationId, patch, auth2) {
|
|
2169
2206
|
return this.ctx.http.request({
|
|
2170
2207
|
method: "PATCH",
|
|
@@ -2201,6 +2238,23 @@ var CustomerGroupsService = class {
|
|
|
2201
2238
|
auth: auth2
|
|
2202
2239
|
});
|
|
2203
2240
|
}
|
|
2241
|
+
/** Adds a user (customer or employee) to a group. */
|
|
2242
|
+
async addMember(groupId, member, auth2) {
|
|
2243
|
+
return this.ctx.http.request({
|
|
2244
|
+
method: "POST",
|
|
2245
|
+
path: `${this.base()}/${groupId}/users`,
|
|
2246
|
+
auth: auth2,
|
|
2247
|
+
body: member
|
|
2248
|
+
});
|
|
2249
|
+
}
|
|
2250
|
+
/** Removes a user from a group. */
|
|
2251
|
+
async removeMember(groupId, userId, auth2) {
|
|
2252
|
+
await this.ctx.http.request({
|
|
2253
|
+
method: "DELETE",
|
|
2254
|
+
path: `${this.base()}/${groupId}/users/${userId}`,
|
|
2255
|
+
auth: auth2
|
|
2256
|
+
});
|
|
2257
|
+
}
|
|
2204
2258
|
};
|
|
2205
2259
|
|
|
2206
2260
|
// src/services/orders.ts
|
|
@@ -5020,7 +5074,7 @@ var ApprovalService = class {
|
|
|
5020
5074
|
};
|
|
5021
5075
|
|
|
5022
5076
|
// package.json
|
|
5023
|
-
var version = "2.
|
|
5077
|
+
var version = "2.10.0";
|
|
5024
5078
|
|
|
5025
5079
|
// src/version.ts
|
|
5026
5080
|
var SDK_VERSION = version;
|
|
@@ -5172,6 +5226,16 @@ var EmporixClient = class {
|
|
|
5172
5226
|
this.customerAdmin = new CustomerAdminService(mk("customer-admin"));
|
|
5173
5227
|
this.approvals = new ApprovalService(mk("approval"));
|
|
5174
5228
|
}
|
|
5229
|
+
/**
|
|
5230
|
+
* Re-binds the storefront price context (currency / siteCode / targetLocation)
|
|
5231
|
+
* for anonymous pricing and invalidates the current anonymous session, so the
|
|
5232
|
+
* next request re-mints a token bound to the new context. Use this to switch
|
|
5233
|
+
* currency at runtime. Carts are currency-bound — clear the cart after a
|
|
5234
|
+
* currency change (the React `setCurrency` does this for you).
|
|
5235
|
+
*/
|
|
5236
|
+
setStorefrontContext(ctx) {
|
|
5237
|
+
this.tokenProvider.setAnonymousContext?.(ctx);
|
|
5238
|
+
}
|
|
5175
5239
|
/** Sets the runtime log level globally or for one service. */
|
|
5176
5240
|
setLogLevel(level, opts = {}) {
|
|
5177
5241
|
this.resolver.set(level, opts.service, opts.force ?? false);
|
|
@@ -5191,6 +5255,13 @@ var EmporixClient = class {
|
|
|
5191
5255
|
}
|
|
5192
5256
|
};
|
|
5193
5257
|
|
|
5258
|
+
// src/core/yrn.ts
|
|
5259
|
+
function productIdFromYrn(yrn) {
|
|
5260
|
+
if (!yrn) return "";
|
|
5261
|
+
const semi = yrn.lastIndexOf(";");
|
|
5262
|
+
return semi >= 0 ? yrn.slice(semi + 1) : "";
|
|
5263
|
+
}
|
|
5264
|
+
|
|
5194
5265
|
exports.AiService = AiService;
|
|
5195
5266
|
exports.ApprovalService = ApprovalService;
|
|
5196
5267
|
exports.AvailabilityService = AvailabilityService;
|
|
@@ -5254,6 +5325,7 @@ exports.createConsoleLogger = createConsoleLogger;
|
|
|
5254
5325
|
exports.createNoopLogger = createNoopLogger;
|
|
5255
5326
|
exports.errorFromResponse = errorFromResponse;
|
|
5256
5327
|
exports.iterateAll = iterateAll;
|
|
5328
|
+
exports.productIdFromYrn = productIdFromYrn;
|
|
5257
5329
|
exports.redact = redact;
|
|
5258
5330
|
exports.resolveToken = resolveToken;
|
|
5259
5331
|
exports.validateConfig = validateConfig;
|