@djust-b2b/djust-front-sdk 1.7.7 → 1.9.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/lib/index.d.ts CHANGED
@@ -89,6 +89,7 @@ export declare const DjustSDK: {
89
89
  getAuthenticatedUser(): Promise<any>;
90
90
  createCustomerUser({ activationUrl, civility, customFieldValues, email, externalId, firstName, lastName, password, groups, status, mainOrganisationId, organisations, phone, }: import("./interfaces").CreateCustomerUserParameters): Promise<import("./interfaces").CreateCustomerUserResponse>;
91
91
  updateCustomerUser({ civility, firstName, lastName, phone, customFieldValues, }: import("./interfaces").UpdateCustomerUserParameters): Promise<import("./interfaces").UpdateCustomerUserResponse>;
92
+ removeCustomerUserFromAccount({ userId, }: import("./interfaces").RemoveCustomerUserParameters): Promise<void>;
92
93
  activateCustomerUser({ token, }: import("./interfaces").ActivateCustomerUserParameters): Promise<void>;
93
94
  getCustomerUserAddresses({ shipping, billing, account, organisationIds, }: import("./interfaces").GetCustomerUserAddressesParameters): Promise<void>;
94
95
  getCustomerUserOrganisations(): Promise<import("./interfaces").GetCustomerUserOrganisationsResponse>;
@@ -102,8 +103,10 @@ export declare const DjustSDK: {
102
103
  updateCustomerAccountAddress({ addressId, additionalAddress, address, billing, city, company, country, fullName, label, phone, shipping, state, zipcode, }: import("./interfaces").UpdateCustomerAccountAddressParameters): Promise<import("./interfaces").UpdateCustomerAccountAddressResponse>;
103
104
  getCustomerAccountOrders({ pageable, locale, }: import("./interfaces").GetCustomerAccountOrdersParameters): Promise<import("./interfaces").GetCustomerAccountOrdersResponse>;
104
105
  getCustomerAccountUsers({ pageable, }: import("./interfaces").GetCustomerAccountUsersParameters): Promise<import("./interfaces").GetCustomerAccountUsersResponse>;
106
+ createCustomerAccountUser({ accountId, civility, firstName, lastName, email, password, groups, }: import("./interfaces").CreateCustomerAccountUsersParameters): Promise<void>;
105
107
  createCustomerAccountOrganisation({ externalId, name, parentId, }: import("./interfaces").CreateCustomerAccountOrganisationParameters): Promise<import("./interfaces").CreateCustomerAccountOrganisationResponse>;
106
108
  updateCustomerAccountOrganisation({ organisationId, name, parentId, status, }: import("./interfaces").UpdateCustomerAccountOrganisationParameters): Promise<import("./interfaces").UpdateCustomerAccountOrganisationResponse>;
109
+ getCustomerAccountOrganisations(): Promise<import("./interfaces").GetCustomerAccountOrganisationResponse>;
107
110
  getCustomerAccountOrganisationAddresses({ organisationId, }: import("./interfaces").GetCustomerAccountOrganisationAddressesParameters): Promise<import("./interfaces").GetCustomerAccountOrganisationAddressesResponse>;
108
111
  deleteCustomerAccountOrganisationAddress({ organisationId, addressId, }: import("./interfaces").DeleteCustomerAccountOrganisationAddressParameters): Promise<void>;
109
112
  updateCustomerAccountOrganisationAddress({ organisationId, addressId, additionalAddress, address, billing, city, company, country, fullName, label, phone, shipping, state, zipcode, }: import("./interfaces").UpdateCustomerAccountOrganisationAddressParameters): Promise<import("./interfaces").UpdateCustomerAccountOrganisationAddressResponse>;
@@ -26,6 +26,15 @@ export interface UpdateCustomerAccountParameters {
26
26
  vatNumber?: string;
27
27
  website?: string;
28
28
  }
29
+ export interface CreateCustomerAccountUsersParameters {
30
+ accountId: string;
31
+ civility: string;
32
+ firstName: string;
33
+ lastName: string;
34
+ email: string;
35
+ password: string;
36
+ groups: string[];
37
+ }
29
38
  export interface GetCustomerAccountAddressesParameters {
30
39
  shipping?: boolean;
31
40
  billing?: boolean;
@@ -109,6 +118,8 @@ export interface CreateCustomerAccountOrganisationResponse extends CustomerOrgan
109
118
  }
110
119
  export interface UpdateCustomerAccountOrganisationResponse extends CustomerOrganisationDto {
111
120
  }
121
+ export interface GetCustomerAccountOrganisationResponse extends CustomerOrganisationDto {
122
+ }
112
123
  export interface GetCustomerAccountOrganisationAddressesResponse extends Array<AddressDto> {
113
124
  }
114
125
  export interface UpdateCustomerAccountOrganisationAddressResponse extends AddressDto {
@@ -1,4 +1,4 @@
1
- import { CreateCustomerAccountAddressParameters, CreateCustomerAccountAddressResponse, CreateCustomerAccountOrganisationParameters, CreateCustomerAccountOrganisationResponse, CreateCustomerAccountParameters, CreateCustomerAccountResponse, DeleteCustomerAccountAddressParameters, DeleteCustomerAccountOrganisationAddressParameters, GetCustomerAccountAddressesParameters, GetCustomerAccountAddressesResponse, GetCustomerAccountOrdersParameters, GetCustomerAccountOrdersResponse, GetCustomerAccountOrganisationAddressesParameters, GetCustomerAccountOrganisationAddressesResponse, GetCustomerAccountOrganisationOrdersParameters, GetCustomerAccountOrganisationOrdersResponse, GetCustomerAccountOrganisationUsersParameters, GetCustomerAccountOrganisationUsersResponse, GetCustomerAccountResponse, GetCustomerAccountUsersParameters, GetCustomerAccountUsersResponse, UpdateCustomerAccountAddressParameters, UpdateCustomerAccountAddressResponse, UpdateCustomerAccountOrganisationAddressParameters, UpdateCustomerAccountOrganisationAddressResponse, UpdateCustomerAccountOrganisationParameters, UpdateCustomerAccountOrganisationResponse, UpdateCustomerAccountOrganisationUserParameters, UpdateCustomerAccountOrganisationUserResponse, UpdateCustomerAccountParameters, UpdateCustomerAccountResponse } from "./definitions";
1
+ import { CreateCustomerAccountAddressParameters, CreateCustomerAccountAddressResponse, CreateCustomerAccountOrganisationParameters, CreateCustomerAccountOrganisationResponse, CreateCustomerAccountParameters, CreateCustomerAccountResponse, CreateCustomerAccountUsersParameters, DeleteCustomerAccountAddressParameters, DeleteCustomerAccountOrganisationAddressParameters, GetCustomerAccountAddressesParameters, GetCustomerAccountAddressesResponse, GetCustomerAccountOrdersParameters, GetCustomerAccountOrdersResponse, GetCustomerAccountOrganisationAddressesParameters, GetCustomerAccountOrganisationAddressesResponse, GetCustomerAccountOrganisationOrdersParameters, GetCustomerAccountOrganisationOrdersResponse, GetCustomerAccountOrganisationResponse, GetCustomerAccountOrganisationUsersParameters, GetCustomerAccountOrganisationUsersResponse, GetCustomerAccountResponse, GetCustomerAccountUsersParameters, GetCustomerAccountUsersResponse, UpdateCustomerAccountAddressParameters, UpdateCustomerAccountAddressResponse, UpdateCustomerAccountOrganisationAddressParameters, UpdateCustomerAccountOrganisationAddressResponse, UpdateCustomerAccountOrganisationParameters, UpdateCustomerAccountOrganisationResponse, UpdateCustomerAccountOrganisationUserParameters, UpdateCustomerAccountOrganisationUserResponse, UpdateCustomerAccountParameters, UpdateCustomerAccountResponse } from "./definitions";
2
2
  /**
3
3
  * Retrieve a customer account
4
4
  */
@@ -35,6 +35,10 @@ export declare function getCustomerAccountOrders({ pageable, locale, }: GetCusto
35
35
  * Get a customer account's users
36
36
  */
37
37
  export declare function getCustomerAccountUsers({ pageable, }: GetCustomerAccountUsersParameters): Promise<GetCustomerAccountUsersResponse>;
38
+ /**
39
+ * Create a customer account's user
40
+ */
41
+ export declare function createCustomerAccountUser({ accountId, civility, firstName, lastName, email, password, groups, }: CreateCustomerAccountUsersParameters): Promise<void>;
38
42
  /**
39
43
  * Create a customer account's organisation
40
44
  */
@@ -43,6 +47,10 @@ export declare function createCustomerAccountOrganisation({ externalId, name, pa
43
47
  * Update a customer account's organisation
44
48
  */
45
49
  export declare function updateCustomerAccountOrganisation({ organisationId, name, parentId, status, }: UpdateCustomerAccountOrganisationParameters): Promise<UpdateCustomerAccountOrganisationResponse>;
50
+ /**
51
+ * Get organisations from customer account
52
+ */
53
+ export declare function getCustomerAccountOrganisations(): Promise<GetCustomerAccountOrganisationResponse>;
46
54
  /**
47
55
  * Get addresses from a customer account organisation
48
56
  */
@@ -9,8 +9,10 @@ exports.deleteCustomerAccountAddress = deleteCustomerAccountAddress;
9
9
  exports.updateCustomerAccountAddress = updateCustomerAccountAddress;
10
10
  exports.getCustomerAccountOrders = getCustomerAccountOrders;
11
11
  exports.getCustomerAccountUsers = getCustomerAccountUsers;
12
+ exports.createCustomerAccountUser = createCustomerAccountUser;
12
13
  exports.createCustomerAccountOrganisation = createCustomerAccountOrganisation;
13
14
  exports.updateCustomerAccountOrganisation = updateCustomerAccountOrganisation;
15
+ exports.getCustomerAccountOrganisations = getCustomerAccountOrganisations;
14
16
  exports.getCustomerAccountOrganisationAddresses = getCustomerAccountOrganisationAddresses;
15
17
  exports.deleteCustomerAccountOrganisationAddress = deleteCustomerAccountOrganisationAddress;
16
18
  exports.updateCustomerAccountOrganisationAddress = updateCustomerAccountOrganisationAddress;
@@ -188,6 +190,32 @@ async function getCustomerAccountUsers({ pageable, }) {
188
190
  });
189
191
  return data;
190
192
  }
193
+ /**
194
+ * Create a customer account's user
195
+ */
196
+ async function createCustomerAccountUser({ accountId, civility, firstName, lastName, email, password, groups, }) {
197
+ (0, parameters_validation_1.required)({
198
+ accountId,
199
+ civility,
200
+ firstName,
201
+ lastName,
202
+ email,
203
+ password,
204
+ groups,
205
+ });
206
+ await (0, fetch_instance_1.enhancedFetch)({
207
+ method: "POST",
208
+ path: `/v1/shop/customer-accounts/${accountId}/customer-users`,
209
+ body: JSON.stringify({
210
+ civility,
211
+ firstName,
212
+ lastName,
213
+ email,
214
+ password,
215
+ groups,
216
+ }),
217
+ });
218
+ }
191
219
  /**
192
220
  * Create a customer account's organisation
193
221
  */
@@ -220,6 +248,16 @@ async function updateCustomerAccountOrganisation({ organisationId, name, parentI
220
248
  });
221
249
  return data;
222
250
  }
251
+ /**
252
+ * Get organisations from customer account
253
+ */
254
+ async function getCustomerAccountOrganisations() {
255
+ const { data } = await (0, fetch_instance_1.enhancedFetch)({
256
+ method: "GET",
257
+ path: `/v1/shop/customer-accounts/organisations`,
258
+ });
259
+ return data;
260
+ }
223
261
  /**
224
262
  * Get addresses from a customer account organisation
225
263
  */
@@ -27,6 +27,9 @@ export interface UpdateCustomerUserParameters {
27
27
  lastName: string;
28
28
  phone?: string;
29
29
  }
30
+ export interface RemoveCustomerUserParameters {
31
+ userId: string;
32
+ }
30
33
  export interface ActivateCustomerUserParameters {
31
34
  token: string;
32
35
  }
@@ -1,4 +1,4 @@
1
- import { ActivateCustomerUserParameters, CreateCustomerUserParameters, CreateCustomerUserResponse, GetCustomerUserAddressesParameters, GetCustomerUserOrganisationsResponse, SendCustomerUserActivationRequestParameters, UpdateCustomerUserParameters, UpdateCustomerUserResponse } from "./definitions";
1
+ import { ActivateCustomerUserParameters, CreateCustomerUserParameters, CreateCustomerUserResponse, GetCustomerUserAddressesParameters, GetCustomerUserOrganisationsResponse, RemoveCustomerUserParameters, SendCustomerUserActivationRequestParameters, UpdateCustomerUserParameters, UpdateCustomerUserResponse } from "./definitions";
2
2
  /**
3
3
  * Get authenticated user
4
4
  */
@@ -11,6 +11,10 @@ export declare function createCustomerUser({ activationUrl, civility, customFiel
11
11
  * Update a customer user
12
12
  */
13
13
  export declare function updateCustomerUser({ civility, firstName, lastName, phone, customFieldValues, }: UpdateCustomerUserParameters): Promise<UpdateCustomerUserResponse>;
14
+ /**
15
+ * Remove a customer user's access to an account
16
+ */
17
+ export declare function removeCustomerUserFromAccount({ userId, }: RemoveCustomerUserParameters): Promise<void>;
14
18
  /**
15
19
  * Activate a customer user
16
20
  */
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAuthenticatedUser = getAuthenticatedUser;
4
4
  exports.createCustomerUser = createCustomerUser;
5
5
  exports.updateCustomerUser = updateCustomerUser;
6
+ exports.removeCustomerUserFromAccount = removeCustomerUserFromAccount;
6
7
  exports.activateCustomerUser = activateCustomerUser;
7
8
  exports.getCustomerUserAddresses = getCustomerUserAddresses;
8
9
  exports.getCustomerUserOrganisations = getCustomerUserOrganisations;
@@ -63,6 +64,16 @@ async function updateCustomerUser({ civility, firstName, lastName, phone, custom
63
64
  });
64
65
  return data;
65
66
  }
67
+ /**
68
+ * Remove a customer user's access to an account
69
+ */
70
+ async function removeCustomerUserFromAccount({ userId, }) {
71
+ (0, parameters_validation_1.required)({ userId });
72
+ await (0, fetch_instance_1.enhancedFetch)({
73
+ method: "PUT",
74
+ path: `/v1/shop/customer-users/${userId}/accounts`,
75
+ });
76
+ }
66
77
  /**
67
78
  * Activate a customer user
68
79
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djust-b2b/djust-front-sdk",
3
- "version": "1.7.7",
3
+ "version": "1.9.0",
4
4
  "description": "DJUST Front SDK is a versatile JavaScript Software Development Kit (SDK) ",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",