@djust-b2b/djust-front-sdk 1.12.0 → 1.13.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 +6 -4
- package/lib/interfaces/models/offer.d.ts +1 -1
- package/lib/interfaces/models/quote.d.ts +13 -1
- package/lib/services/auth/index.d.ts +119 -4
- package/lib/services/auth/index.js +119 -4
- package/lib/services/customer-user/definitions.d.ts +0 -3
- package/lib/services/customer-user/index.d.ts +263 -14
- package/lib/services/customer-user/index.js +264 -20
- package/lib/services/quote/definitions.d.ts +25 -1
- package/lib/services/quote/index.d.ts +349 -10
- package/lib/services/quote/index.js +382 -11
- package/lib/services/supplier/definitions.d.ts +3 -0
- package/lib/services/supplier/index.d.ts +92 -4
- package/lib/services/supplier/index.js +96 -5
- package/package.json +1 -1
|
@@ -1,33 +1,282 @@
|
|
|
1
|
-
import { ActivateCustomerUserParameters, CreateCustomerUserParameters, CreateCustomerUserResponse, GetCustomerUserAddressesParameters, GetCustomerUserOrganisationsResponse, RemoveCustomerUserParameters, SendCustomerUserActivationRequestParameters, UpdateCustomerUserParameters, UpdateCustomerUserResponse } from "./definitions";
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
*
|
|
4
|
+
* @document documents/customer-user.md
|
|
4
5
|
*/
|
|
5
|
-
|
|
6
|
+
import { ActivateCustomerUserParameters, CreateCustomerUserParameters, CreateCustomerUserResponse, GetCustomerUserAddressesParameters, GetCustomerUserOrganisationsResponse, SendCustomerUserActivationRequestParameters, UpdateCustomerUserParameters, UpdateCustomerUserResponse } from "./definitions";
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
+
* APICODE(USER-500)
|
|
9
|
+
* Retrieves the authenticated user.
|
|
10
|
+
*
|
|
11
|
+
* This function sends a request to obtain the details of the currently authenticated user.
|
|
12
|
+
*
|
|
13
|
+
* @returns {Promise<any>} - The data of the authenticated user.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* #### input
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const user = await getAuthenticatedUser();
|
|
19
|
+
* ```
|
|
20
|
+
* #### output
|
|
21
|
+
* ```json
|
|
22
|
+
* {
|
|
23
|
+
* "id": "user1",
|
|
24
|
+
* "name": "John Doe"
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
8
27
|
*/
|
|
9
|
-
export declare function
|
|
28
|
+
export declare function getAuthenticatedUser(): Promise<any>;
|
|
10
29
|
/**
|
|
11
|
-
*
|
|
30
|
+
* APICODE(USER-100)
|
|
31
|
+
* Creates a customer user.
|
|
32
|
+
*
|
|
33
|
+
* This function sends a request to create a new customer user with the specified parameters.
|
|
34
|
+
*
|
|
35
|
+
* @param {CreateCustomerUserParameters} params - The parameters for creating the user, including:
|
|
36
|
+
* #### email - `string` | <strong style={{ color: 'red' }}>required</strong>
|
|
37
|
+
*
|
|
38
|
+
* The email address of the user.
|
|
39
|
+
* #### password - `string` | <strong style={{ color: 'red' }}>required</strong>
|
|
40
|
+
*
|
|
41
|
+
* The password of the user.
|
|
42
|
+
* #### firstName - `string` | <strong style={{ color: 'red' }}>required</strong>
|
|
43
|
+
*
|
|
44
|
+
* The first name of the user.
|
|
45
|
+
* #### lastName - `string` | <strong style={{ color: 'red' }}>required</strong>
|
|
46
|
+
*
|
|
47
|
+
* The last name of the user.
|
|
48
|
+
* #### groups - `string[]` | <strong style={{ color: 'red' }}>required</strong>
|
|
49
|
+
*
|
|
50
|
+
* The groups to which the user belongs.
|
|
51
|
+
* #### activationUrl - `string`
|
|
52
|
+
*
|
|
53
|
+
* The URL for user activation.
|
|
54
|
+
* #### civility - `string`
|
|
55
|
+
*
|
|
56
|
+
* The civility of the user (e.g., Mr., Ms.).
|
|
57
|
+
* #### customFieldValues - `object`
|
|
58
|
+
*
|
|
59
|
+
* Custom fields for additional user information.
|
|
60
|
+
* #### externalId - `string`
|
|
61
|
+
*
|
|
62
|
+
* An external identifier for the user.
|
|
63
|
+
* #### status - `string`
|
|
64
|
+
*
|
|
65
|
+
* The status of the user (e.g., active, inactive).
|
|
66
|
+
* #### mainOrganisationId - `string`
|
|
67
|
+
*
|
|
68
|
+
* The ID of the main organization associated with the user.
|
|
69
|
+
* #### organisations - `string[]`
|
|
70
|
+
*
|
|
71
|
+
* The list of organizations associated with the user.
|
|
72
|
+
* #### phone - `string`
|
|
73
|
+
*
|
|
74
|
+
* The phone number of the user.
|
|
75
|
+
*
|
|
76
|
+
* @returns {Promise<CreateCustomerUserResponse>} - The data of the created user.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* #### input
|
|
80
|
+
* ```typescript
|
|
81
|
+
* const newUser = await createCustomerUser({
|
|
82
|
+
* email: 'user@example.com',
|
|
83
|
+
* password: 'securePassword',
|
|
84
|
+
* firstName: 'John',
|
|
85
|
+
* lastName: 'Doe',
|
|
86
|
+
* activationUrl: 'http://example.com/activate',
|
|
87
|
+
* civility: 'Mr.',
|
|
88
|
+
* customFieldValues: {},
|
|
89
|
+
* externalId: 'external123',
|
|
90
|
+
* groups: ['group1'],
|
|
91
|
+
* status: 'active',
|
|
92
|
+
* mainOrganisationId: 'org1',
|
|
93
|
+
* organisations: ['org1', 'org2'],
|
|
94
|
+
* phone: '123-456-7890'
|
|
95
|
+
* });
|
|
96
|
+
* ```
|
|
97
|
+
* #### output
|
|
98
|
+
* ```json
|
|
99
|
+
* {
|
|
100
|
+
* "id": "user1",
|
|
101
|
+
* "detail": "User created successfully"
|
|
102
|
+
* }
|
|
103
|
+
* ```
|
|
12
104
|
*/
|
|
13
|
-
export declare function
|
|
105
|
+
export declare function createCustomerUser(params: CreateCustomerUserParameters): Promise<CreateCustomerUserResponse>;
|
|
14
106
|
/**
|
|
15
|
-
*
|
|
107
|
+
* APICODE(USER-201)
|
|
108
|
+
* Updates a customer user.
|
|
109
|
+
*
|
|
110
|
+
* This function sends a request to update the details of an existing customer user.
|
|
111
|
+
*
|
|
112
|
+
* @param {UpdateCustomerUserParameters} params - The parameters for updating the user, including:
|
|
113
|
+
* #### firstName - `string` | <strong style={{ color: 'red' }}>required</strong>
|
|
114
|
+
*
|
|
115
|
+
* The first name of the user.
|
|
116
|
+
* #### lastName - `string` | <strong style={{ color: 'red' }}>required</strong>
|
|
117
|
+
*
|
|
118
|
+
* The last name of the user.
|
|
119
|
+
* #### civility - `string`
|
|
120
|
+
*
|
|
121
|
+
* The civility of the user (e.g., Mr., Ms.).
|
|
122
|
+
* #### phone - `string`
|
|
123
|
+
*
|
|
124
|
+
* The phone number of the user.
|
|
125
|
+
* #### customFieldValues - `object`
|
|
126
|
+
*
|
|
127
|
+
* Custom fields for additional user information.
|
|
128
|
+
*
|
|
129
|
+
* @returns {Promise<UpdateCustomerUserResponse>} - The data of the updated user.
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* #### input
|
|
133
|
+
* ```typescript
|
|
134
|
+
* const updatedUser = await updateCustomerUser({
|
|
135
|
+
* firstName: 'John',
|
|
136
|
+
* lastName: 'Doe',
|
|
137
|
+
* civility: 'Mr.',
|
|
138
|
+
* phone: '123-456-7890',
|
|
139
|
+
* customFieldValues: {}
|
|
140
|
+
* });
|
|
141
|
+
* ```
|
|
142
|
+
* #### output
|
|
143
|
+
* ```json
|
|
144
|
+
* {
|
|
145
|
+
* "detail": "User updated successfully"
|
|
146
|
+
* }
|
|
147
|
+
* ```
|
|
16
148
|
*/
|
|
17
|
-
export declare function
|
|
149
|
+
export declare function updateCustomerUser({ civility, firstName, lastName, phone, customFieldValues, }: UpdateCustomerUserParameters): Promise<UpdateCustomerUserResponse>;
|
|
18
150
|
/**
|
|
19
|
-
*
|
|
151
|
+
* APICODE(USER-200)
|
|
152
|
+
* Activates a customer user.
|
|
153
|
+
*
|
|
154
|
+
* This function sends a request to activate a customer user with a specified token.
|
|
155
|
+
*
|
|
156
|
+
* @param {ActivateCustomerUserParameters} params - The parameters for activating the user, including:
|
|
157
|
+
* #### token - `string` | <strong style={{ color: 'red' }}>required</strong>
|
|
158
|
+
*
|
|
159
|
+
* The activation token of the user.
|
|
160
|
+
*
|
|
161
|
+
* @returns {Promise<void>} - A promise that resolves when the user is activated.
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* #### input
|
|
165
|
+
* ```typescript
|
|
166
|
+
* await activateCustomerUser({ token: 'activationToken' });
|
|
167
|
+
* ```
|
|
168
|
+
* #### output
|
|
169
|
+
* ```json
|
|
170
|
+
* {
|
|
171
|
+
* "detail": "User activated successfully"
|
|
172
|
+
* }
|
|
173
|
+
* ```
|
|
20
174
|
*/
|
|
21
|
-
export declare function activateCustomerUser(
|
|
175
|
+
export declare function activateCustomerUser(params: ActivateCustomerUserParameters): Promise<void>;
|
|
22
176
|
/**
|
|
23
|
-
*
|
|
177
|
+
* APICODE(USER-501)
|
|
178
|
+
* Retrieves customer user addresses.
|
|
179
|
+
*
|
|
180
|
+
* This function sends a request to obtain the addresses associated with a customer user.
|
|
181
|
+
*
|
|
182
|
+
* @param {GetCustomerUserAddressesParameters} params - The parameters for retrieving the addresses, including:
|
|
183
|
+
* #### shipping - `boolean`
|
|
184
|
+
*
|
|
185
|
+
* Indicates whether to retrieve shipping addresses.
|
|
186
|
+
* #### billing - `boolean`
|
|
187
|
+
*
|
|
188
|
+
* Indicates whether to retrieve billing addresses.
|
|
189
|
+
* #### account - `string`
|
|
190
|
+
*
|
|
191
|
+
* The ID of the account for which to retrieve addresses.
|
|
192
|
+
* #### organisationIds - `string[]`
|
|
193
|
+
*
|
|
194
|
+
* An array of organization IDs to filter the addresses.
|
|
195
|
+
*
|
|
196
|
+
* @returns {Promise<void>} - The addresses of the customer user.
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* #### input
|
|
200
|
+
* ```typescript
|
|
201
|
+
* const addresses = await getCustomerUserAddresses({
|
|
202
|
+
* shipping: true,
|
|
203
|
+
* billing: false,
|
|
204
|
+
* account: 'account1',
|
|
205
|
+
* organisationIds: ['org1', 'org2']
|
|
206
|
+
* });
|
|
207
|
+
* ```
|
|
208
|
+
* #### output
|
|
209
|
+
* ```json
|
|
210
|
+
* {
|
|
211
|
+
* "addresses": [
|
|
212
|
+
* {
|
|
213
|
+
* "id": "address1",
|
|
214
|
+
* "detail": "Address retrieved successfully"
|
|
215
|
+
* }
|
|
216
|
+
* ]
|
|
217
|
+
* }
|
|
218
|
+
* ```
|
|
24
219
|
*/
|
|
25
220
|
export declare function getCustomerUserAddresses({ shipping, billing, account, organisationIds, }: GetCustomerUserAddressesParameters): Promise<void>;
|
|
26
221
|
/**
|
|
27
|
-
*
|
|
222
|
+
* APICODE(USER-502)
|
|
223
|
+
* Retrieves customer user organisations.
|
|
224
|
+
*
|
|
225
|
+
* This function sends a request to obtain the organisations associated with a customer user.
|
|
226
|
+
*
|
|
227
|
+
* @returns {Promise<GetCustomerUserOrganisationsResponse>} - The organisations of the customer user.
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* #### input
|
|
231
|
+
* ```typescript
|
|
232
|
+
* const organisations = await getCustomerUserOrganisations();
|
|
233
|
+
* ```
|
|
234
|
+
* #### output
|
|
235
|
+
* ```json
|
|
236
|
+
* {
|
|
237
|
+
* "organisations": [
|
|
238
|
+
* {
|
|
239
|
+
* "id": "org1",
|
|
240
|
+
* "name": "Organisation 1"
|
|
241
|
+
* },
|
|
242
|
+
* {
|
|
243
|
+
* "id": "org2",
|
|
244
|
+
* "name": "Organisation 2"
|
|
245
|
+
* }
|
|
246
|
+
* ]
|
|
247
|
+
* }
|
|
248
|
+
* ```
|
|
28
249
|
*/
|
|
29
250
|
export declare function getCustomerUserOrganisations(): Promise<GetCustomerUserOrganisationsResponse>;
|
|
30
251
|
/**
|
|
31
|
-
*
|
|
252
|
+
* APICODE(USER-203)
|
|
253
|
+
* Sends a customer user activation request.
|
|
254
|
+
*
|
|
255
|
+
* This function sends a request to resend an activation request to a customer user.
|
|
256
|
+
*
|
|
257
|
+
* @param {SendCustomerUserActivationRequestParameters} params - The parameters for sending the request, including:
|
|
258
|
+
* #### token - `string` | <strong style={{ color: 'red' }}>required</strong>
|
|
259
|
+
*
|
|
260
|
+
* The activation token of the user.
|
|
261
|
+
* #### redirectUrl - `string`
|
|
262
|
+
*
|
|
263
|
+
* The URL to redirect the user after activation.
|
|
264
|
+
*
|
|
265
|
+
* @returns {Promise<void>} - A promise that resolves when the request is sent.
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* #### input
|
|
269
|
+
* ```typescript
|
|
270
|
+
* await sendCustomerUserActivationRequest({
|
|
271
|
+
* token: 'activationToken',
|
|
272
|
+
* redirectUrl: 'http://example.com/redirect'
|
|
273
|
+
* });
|
|
274
|
+
* ```
|
|
275
|
+
* #### output
|
|
276
|
+
* ```json
|
|
277
|
+
* {
|
|
278
|
+
* "detail": "Activation request sent successfully"
|
|
279
|
+
* }
|
|
280
|
+
* ```
|
|
32
281
|
*/
|
|
33
282
|
export declare function sendCustomerUserActivationRequest({ redirectUrl, token, }: SendCustomerUserActivationRequestParameters): Promise<void>;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*
|
|
5
|
+
* @document documents/customer-user.md
|
|
6
|
+
*/
|
|
2
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
8
|
exports.getAuthenticatedUser = getAuthenticatedUser;
|
|
4
9
|
exports.createCustomerUser = createCustomerUser;
|
|
5
10
|
exports.updateCustomerUser = updateCustomerUser;
|
|
6
|
-
exports.removeCustomerUserFromAccount = removeCustomerUserFromAccount;
|
|
7
11
|
exports.activateCustomerUser = activateCustomerUser;
|
|
8
12
|
exports.getCustomerUserAddresses = getCustomerUserAddresses;
|
|
9
13
|
exports.getCustomerUserOrganisations = getCustomerUserOrganisations;
|
|
@@ -11,7 +15,25 @@ exports.sendCustomerUserActivationRequest = sendCustomerUserActivationRequest;
|
|
|
11
15
|
const parameters_validation_1 = require("../../helpers/parameters-validation");
|
|
12
16
|
const fetch_instance_1 = require("../../settings/fetch-instance");
|
|
13
17
|
/**
|
|
14
|
-
*
|
|
18
|
+
* APICODE(USER-500)
|
|
19
|
+
* Retrieves the authenticated user.
|
|
20
|
+
*
|
|
21
|
+
* This function sends a request to obtain the details of the currently authenticated user.
|
|
22
|
+
*
|
|
23
|
+
* @returns {Promise<any>} - The data of the authenticated user.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* #### input
|
|
27
|
+
* ```typescript
|
|
28
|
+
* const user = await getAuthenticatedUser();
|
|
29
|
+
* ```
|
|
30
|
+
* #### output
|
|
31
|
+
* ```json
|
|
32
|
+
* {
|
|
33
|
+
* "id": "user1",
|
|
34
|
+
* "name": "John Doe"
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
15
37
|
*/
|
|
16
38
|
async function getAuthenticatedUser() {
|
|
17
39
|
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
@@ -21,9 +43,83 @@ async function getAuthenticatedUser() {
|
|
|
21
43
|
return data;
|
|
22
44
|
}
|
|
23
45
|
/**
|
|
24
|
-
*
|
|
46
|
+
* APICODE(USER-100)
|
|
47
|
+
* Creates a customer user.
|
|
48
|
+
*
|
|
49
|
+
* This function sends a request to create a new customer user with the specified parameters.
|
|
50
|
+
*
|
|
51
|
+
* @param {CreateCustomerUserParameters} params - The parameters for creating the user, including:
|
|
52
|
+
* #### email - `string` | <strong style={{ color: 'red' }}>required</strong>
|
|
53
|
+
*
|
|
54
|
+
* The email address of the user.
|
|
55
|
+
* #### password - `string` | <strong style={{ color: 'red' }}>required</strong>
|
|
56
|
+
*
|
|
57
|
+
* The password of the user.
|
|
58
|
+
* #### firstName - `string` | <strong style={{ color: 'red' }}>required</strong>
|
|
59
|
+
*
|
|
60
|
+
* The first name of the user.
|
|
61
|
+
* #### lastName - `string` | <strong style={{ color: 'red' }}>required</strong>
|
|
62
|
+
*
|
|
63
|
+
* The last name of the user.
|
|
64
|
+
* #### groups - `string[]` | <strong style={{ color: 'red' }}>required</strong>
|
|
65
|
+
*
|
|
66
|
+
* The groups to which the user belongs.
|
|
67
|
+
* #### activationUrl - `string`
|
|
68
|
+
*
|
|
69
|
+
* The URL for user activation.
|
|
70
|
+
* #### civility - `string`
|
|
71
|
+
*
|
|
72
|
+
* The civility of the user (e.g., Mr., Ms.).
|
|
73
|
+
* #### customFieldValues - `object`
|
|
74
|
+
*
|
|
75
|
+
* Custom fields for additional user information.
|
|
76
|
+
* #### externalId - `string`
|
|
77
|
+
*
|
|
78
|
+
* An external identifier for the user.
|
|
79
|
+
* #### status - `string`
|
|
80
|
+
*
|
|
81
|
+
* The status of the user (e.g., active, inactive).
|
|
82
|
+
* #### mainOrganisationId - `string`
|
|
83
|
+
*
|
|
84
|
+
* The ID of the main organization associated with the user.
|
|
85
|
+
* #### organisations - `string[]`
|
|
86
|
+
*
|
|
87
|
+
* The list of organizations associated with the user.
|
|
88
|
+
* #### phone - `string`
|
|
89
|
+
*
|
|
90
|
+
* The phone number of the user.
|
|
91
|
+
*
|
|
92
|
+
* @returns {Promise<CreateCustomerUserResponse>} - The data of the created user.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* #### input
|
|
96
|
+
* ```typescript
|
|
97
|
+
* const newUser = await createCustomerUser({
|
|
98
|
+
* email: 'user@example.com',
|
|
99
|
+
* password: 'securePassword',
|
|
100
|
+
* firstName: 'John',
|
|
101
|
+
* lastName: 'Doe',
|
|
102
|
+
* activationUrl: 'http://example.com/activate',
|
|
103
|
+
* civility: 'Mr.',
|
|
104
|
+
* customFieldValues: {},
|
|
105
|
+
* externalId: 'external123',
|
|
106
|
+
* groups: ['group1'],
|
|
107
|
+
* status: 'active',
|
|
108
|
+
* mainOrganisationId: 'org1',
|
|
109
|
+
* organisations: ['org1', 'org2'],
|
|
110
|
+
* phone: '123-456-7890'
|
|
111
|
+
* });
|
|
112
|
+
* ```
|
|
113
|
+
* #### output
|
|
114
|
+
* ```json
|
|
115
|
+
* {
|
|
116
|
+
* "id": "user1",
|
|
117
|
+
* "detail": "User created successfully"
|
|
118
|
+
* }
|
|
119
|
+
* ```
|
|
25
120
|
*/
|
|
26
|
-
async function createCustomerUser(
|
|
121
|
+
async function createCustomerUser(params) {
|
|
122
|
+
const { activationUrl, civility, customFieldValues, email, externalId, firstName, lastName, password, groups, status, mainOrganisationId, organisations, phone, } = params;
|
|
27
123
|
(0, parameters_validation_1.required)({ civility, firstName, lastName, email, password, groups });
|
|
28
124
|
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
29
125
|
method: "POST",
|
|
@@ -47,7 +143,47 @@ async function createCustomerUser({ activationUrl, civility, customFieldValues,
|
|
|
47
143
|
return data;
|
|
48
144
|
}
|
|
49
145
|
/**
|
|
50
|
-
*
|
|
146
|
+
* APICODE(USER-201)
|
|
147
|
+
* Updates a customer user.
|
|
148
|
+
*
|
|
149
|
+
* This function sends a request to update the details of an existing customer user.
|
|
150
|
+
*
|
|
151
|
+
* @param {UpdateCustomerUserParameters} params - The parameters for updating the user, including:
|
|
152
|
+
* #### firstName - `string` | <strong style={{ color: 'red' }}>required</strong>
|
|
153
|
+
*
|
|
154
|
+
* The first name of the user.
|
|
155
|
+
* #### lastName - `string` | <strong style={{ color: 'red' }}>required</strong>
|
|
156
|
+
*
|
|
157
|
+
* The last name of the user.
|
|
158
|
+
* #### civility - `string`
|
|
159
|
+
*
|
|
160
|
+
* The civility of the user (e.g., Mr., Ms.).
|
|
161
|
+
* #### phone - `string`
|
|
162
|
+
*
|
|
163
|
+
* The phone number of the user.
|
|
164
|
+
* #### customFieldValues - `object`
|
|
165
|
+
*
|
|
166
|
+
* Custom fields for additional user information.
|
|
167
|
+
*
|
|
168
|
+
* @returns {Promise<UpdateCustomerUserResponse>} - The data of the updated user.
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* #### input
|
|
172
|
+
* ```typescript
|
|
173
|
+
* const updatedUser = await updateCustomerUser({
|
|
174
|
+
* firstName: 'John',
|
|
175
|
+
* lastName: 'Doe',
|
|
176
|
+
* civility: 'Mr.',
|
|
177
|
+
* phone: '123-456-7890',
|
|
178
|
+
* customFieldValues: {}
|
|
179
|
+
* });
|
|
180
|
+
* ```
|
|
181
|
+
* #### output
|
|
182
|
+
* ```json
|
|
183
|
+
* {
|
|
184
|
+
* "detail": "User updated successfully"
|
|
185
|
+
* }
|
|
186
|
+
* ```
|
|
51
187
|
*/
|
|
52
188
|
async function updateCustomerUser({ civility, firstName, lastName, phone, customFieldValues, }) {
|
|
53
189
|
(0, parameters_validation_1.required)({ civility, firstName, lastName });
|
|
@@ -65,19 +201,32 @@ async function updateCustomerUser({ civility, firstName, lastName, phone, custom
|
|
|
65
201
|
return data;
|
|
66
202
|
}
|
|
67
203
|
/**
|
|
68
|
-
*
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
*
|
|
204
|
+
* APICODE(USER-200)
|
|
205
|
+
* Activates a customer user.
|
|
206
|
+
*
|
|
207
|
+
* This function sends a request to activate a customer user with a specified token.
|
|
208
|
+
*
|
|
209
|
+
* @param {ActivateCustomerUserParameters} params - The parameters for activating the user, including:
|
|
210
|
+
* #### token - `string` | <strong style={{ color: 'red' }}>required</strong>
|
|
211
|
+
*
|
|
212
|
+
* The activation token of the user.
|
|
213
|
+
*
|
|
214
|
+
* @returns {Promise<void>} - A promise that resolves when the user is activated.
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* #### input
|
|
218
|
+
* ```typescript
|
|
219
|
+
* await activateCustomerUser({ token: 'activationToken' });
|
|
220
|
+
* ```
|
|
221
|
+
* #### output
|
|
222
|
+
* ```json
|
|
223
|
+
* {
|
|
224
|
+
* "detail": "User activated successfully"
|
|
225
|
+
* }
|
|
226
|
+
* ```
|
|
79
227
|
*/
|
|
80
|
-
async function activateCustomerUser(
|
|
228
|
+
async function activateCustomerUser(params) {
|
|
229
|
+
const { token } = params;
|
|
81
230
|
(0, parameters_validation_1.required)({ token });
|
|
82
231
|
await (0, fetch_instance_1.enhancedFetch)({
|
|
83
232
|
method: "POST",
|
|
@@ -88,7 +237,48 @@ async function activateCustomerUser({ token, }) {
|
|
|
88
237
|
});
|
|
89
238
|
}
|
|
90
239
|
/**
|
|
91
|
-
*
|
|
240
|
+
* APICODE(USER-501)
|
|
241
|
+
* Retrieves customer user addresses.
|
|
242
|
+
*
|
|
243
|
+
* This function sends a request to obtain the addresses associated with a customer user.
|
|
244
|
+
*
|
|
245
|
+
* @param {GetCustomerUserAddressesParameters} params - The parameters for retrieving the addresses, including:
|
|
246
|
+
* #### shipping - `boolean`
|
|
247
|
+
*
|
|
248
|
+
* Indicates whether to retrieve shipping addresses.
|
|
249
|
+
* #### billing - `boolean`
|
|
250
|
+
*
|
|
251
|
+
* Indicates whether to retrieve billing addresses.
|
|
252
|
+
* #### account - `string`
|
|
253
|
+
*
|
|
254
|
+
* The ID of the account for which to retrieve addresses.
|
|
255
|
+
* #### organisationIds - `string[]`
|
|
256
|
+
*
|
|
257
|
+
* An array of organization IDs to filter the addresses.
|
|
258
|
+
*
|
|
259
|
+
* @returns {Promise<void>} - The addresses of the customer user.
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* #### input
|
|
263
|
+
* ```typescript
|
|
264
|
+
* const addresses = await getCustomerUserAddresses({
|
|
265
|
+
* shipping: true,
|
|
266
|
+
* billing: false,
|
|
267
|
+
* account: 'account1',
|
|
268
|
+
* organisationIds: ['org1', 'org2']
|
|
269
|
+
* });
|
|
270
|
+
* ```
|
|
271
|
+
* #### output
|
|
272
|
+
* ```json
|
|
273
|
+
* {
|
|
274
|
+
* "addresses": [
|
|
275
|
+
* {
|
|
276
|
+
* "id": "address1",
|
|
277
|
+
* "detail": "Address retrieved successfully"
|
|
278
|
+
* }
|
|
279
|
+
* ]
|
|
280
|
+
* }
|
|
281
|
+
* ```
|
|
92
282
|
*/
|
|
93
283
|
async function getCustomerUserAddresses({ shipping, billing, account, organisationIds, }) {
|
|
94
284
|
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
@@ -104,7 +294,33 @@ async function getCustomerUserAddresses({ shipping, billing, account, organisati
|
|
|
104
294
|
return data;
|
|
105
295
|
}
|
|
106
296
|
/**
|
|
107
|
-
*
|
|
297
|
+
* APICODE(USER-502)
|
|
298
|
+
* Retrieves customer user organisations.
|
|
299
|
+
*
|
|
300
|
+
* This function sends a request to obtain the organisations associated with a customer user.
|
|
301
|
+
*
|
|
302
|
+
* @returns {Promise<GetCustomerUserOrganisationsResponse>} - The organisations of the customer user.
|
|
303
|
+
*
|
|
304
|
+
* @example
|
|
305
|
+
* #### input
|
|
306
|
+
* ```typescript
|
|
307
|
+
* const organisations = await getCustomerUserOrganisations();
|
|
308
|
+
* ```
|
|
309
|
+
* #### output
|
|
310
|
+
* ```json
|
|
311
|
+
* {
|
|
312
|
+
* "organisations": [
|
|
313
|
+
* {
|
|
314
|
+
* "id": "org1",
|
|
315
|
+
* "name": "Organisation 1"
|
|
316
|
+
* },
|
|
317
|
+
* {
|
|
318
|
+
* "id": "org2",
|
|
319
|
+
* "name": "Organisation 2"
|
|
320
|
+
* }
|
|
321
|
+
* ]
|
|
322
|
+
* }
|
|
323
|
+
* ```
|
|
108
324
|
*/
|
|
109
325
|
async function getCustomerUserOrganisations() {
|
|
110
326
|
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
@@ -114,7 +330,35 @@ async function getCustomerUserOrganisations() {
|
|
|
114
330
|
return data;
|
|
115
331
|
}
|
|
116
332
|
/**
|
|
117
|
-
*
|
|
333
|
+
* APICODE(USER-203)
|
|
334
|
+
* Sends a customer user activation request.
|
|
335
|
+
*
|
|
336
|
+
* This function sends a request to resend an activation request to a customer user.
|
|
337
|
+
*
|
|
338
|
+
* @param {SendCustomerUserActivationRequestParameters} params - The parameters for sending the request, including:
|
|
339
|
+
* #### token - `string` | <strong style={{ color: 'red' }}>required</strong>
|
|
340
|
+
*
|
|
341
|
+
* The activation token of the user.
|
|
342
|
+
* #### redirectUrl - `string`
|
|
343
|
+
*
|
|
344
|
+
* The URL to redirect the user after activation.
|
|
345
|
+
*
|
|
346
|
+
* @returns {Promise<void>} - A promise that resolves when the request is sent.
|
|
347
|
+
*
|
|
348
|
+
* @example
|
|
349
|
+
* #### input
|
|
350
|
+
* ```typescript
|
|
351
|
+
* await sendCustomerUserActivationRequest({
|
|
352
|
+
* token: 'activationToken',
|
|
353
|
+
* redirectUrl: 'http://example.com/redirect'
|
|
354
|
+
* });
|
|
355
|
+
* ```
|
|
356
|
+
* #### output
|
|
357
|
+
* ```json
|
|
358
|
+
* {
|
|
359
|
+
* "detail": "Activation request sent successfully"
|
|
360
|
+
* }
|
|
361
|
+
* ```
|
|
118
362
|
*/
|
|
119
363
|
async function sendCustomerUserActivationRequest({ redirectUrl, token, }) {
|
|
120
364
|
(0, parameters_validation_1.required)({ token });
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { MasterQuote, PageMasterQuote, SupplierQuoteDto } from "../../interfaces/models/quote";
|
|
1
|
+
import { MasterQuote, PageMasterQuote, SupplierQuoteDto, SupplierQuoteIdType } from "../../interfaces/models/quote";
|
|
2
|
+
import { OrderCommercialDto } from "../../interfaces/models/order";
|
|
2
3
|
import { PageableParameters } from "../../interfaces/models/common";
|
|
4
|
+
import { CustomFieldValueRequest } from "../../interfaces/models/custom-field";
|
|
3
5
|
/**
|
|
4
6
|
* Request parameters type definitions
|
|
5
7
|
*/
|
|
@@ -46,6 +48,9 @@ export interface CreateSupplierQuotesParameters {
|
|
|
46
48
|
export interface GetSupplierQuoteParameters {
|
|
47
49
|
supplierQuoteId: string;
|
|
48
50
|
}
|
|
51
|
+
export interface AcceptSupplierQuoteParameters {
|
|
52
|
+
supplierQuoteId: string;
|
|
53
|
+
}
|
|
49
54
|
export interface DeclineSupplierQuoteParameters {
|
|
50
55
|
supplierQuoteId: string;
|
|
51
56
|
}
|
|
@@ -54,6 +59,19 @@ export interface PostMessageToSupplierQuoteParameters {
|
|
|
54
59
|
message: string;
|
|
55
60
|
username: string;
|
|
56
61
|
}
|
|
62
|
+
export interface UpdateSupplierQuoteCustomFieldsParameters {
|
|
63
|
+
supplierQuoteId: string;
|
|
64
|
+
customFieldValues: CustomFieldValueRequest[];
|
|
65
|
+
idType: SupplierQuoteIdType;
|
|
66
|
+
}
|
|
67
|
+
export interface InitializeOrderFromSupplierQuoteParameters {
|
|
68
|
+
supplierQuoteId: string;
|
|
69
|
+
nbPreviewLines: number;
|
|
70
|
+
quoteLineIdsAndQuantities: {
|
|
71
|
+
quantity: number;
|
|
72
|
+
quoteLineId: string;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
57
75
|
/**
|
|
58
76
|
* Response type definitions
|
|
59
77
|
*/
|
|
@@ -71,5 +89,11 @@ export interface GetSupplierQuoteResponse extends SupplierQuoteDto {
|
|
|
71
89
|
}
|
|
72
90
|
export interface DeclineSupplierQuoteResponse extends SupplierQuoteDto {
|
|
73
91
|
}
|
|
92
|
+
export interface AcceptSupplierQuoteResponse extends SupplierQuoteDto {
|
|
93
|
+
}
|
|
74
94
|
export interface PostMessageToSupplierQuoteResponse extends SupplierQuoteDto {
|
|
75
95
|
}
|
|
96
|
+
export interface UpdateSupplierQuoteCustomFieldsResponse extends SupplierQuoteDto {
|
|
97
|
+
}
|
|
98
|
+
export interface InitializeOrderFromSupplierQuoteResponse extends OrderCommercialDto {
|
|
99
|
+
}
|