@djust-b2b/djust-front-sdk 1.12.0 → 1.14.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
@@ -30,14 +30,15 @@ export declare const DjustSDK: {
30
30
  getCommercialOrders({ locale, nbPreviewLines, }: import("./interfaces").GetCommercialOrdersParameters): Promise<import("./interfaces").GetCommercialOrdersResponse>;
31
31
  createCommercialOrder({ nbPreviewLines, channel, customFields, locale, originId, paymentInfo, }: import("./interfaces").CreateCommercialOrderParameters): Promise<import("./interfaces").CreateCommercialOrderResponse>;
32
32
  getCommercialOrder({ orderId, idType, locale, nbPreviewLines, }: import("./interfaces").GetCommercialOrderParameters): Promise<import("./interfaces").GetCommercialOrderResponse>;
33
+ createCommercialOrderCardRegistration({ orderId, paymentProvider, currency, }: import("./interfaces").CreateCommercialOrderCardRegistrationParameters): Promise<import("./interfaces").CreateCommercialOrderCardRegistrationResponse>;
33
34
  updateCommercialOrderBillingInformation({ orderId, billingAddressId, }: import("./interfaces").UpdateCommercialOrderBillingInformationParameters): Promise<void>;
34
35
  setCommercialOrderStatusAsCreated({ orderId, paymentInfo, }: import("./interfaces").SetCommercialOrderStatusAsCreatedParameters): Promise<void>;
35
36
  setCommercialOrderStatusAsOnHold({ orderId, }: import("./interfaces").SetCommercialOrderStatusAsOnHoldParameters): Promise<void>;
36
37
  getCommercialOrderPaymentPageUrl({ orderId, paymentOption, paymentProvider, }: import("./interfaces").GetCommercialOrderPaymentPageUrlParameters): Promise<string>;
38
+ createCommercialOrderPreauthorization({ orderId, paymentProvider, authorId, browserInfo, ipAddress, paymentCardInfo, }: import("./interfaces").CreateCommercialOrderPreauthorizationParameters): Promise<import("./interfaces").CreateCommercialOrderPreauthorizationResponse>;
37
39
  updateCommercialOrderShippingAddress({ orderId, shippingAddressId, }: import("./interfaces").UpdateCommercialOrderShippingAddressParameters): Promise<void>;
38
40
  updateCommercialOrderShippingInformation({ orderId, shippingAddressId, shippingType, }: import("./interfaces").UpdateCommercialOrderShippingInformationParameters): Promise<void>;
39
41
  updateCommercialOrderShippingType({ orderId, shippingType, }: import("./interfaces").UpdateCommercialOrderShippingTypeParameters): Promise<void>;
40
- updateLogisticOrderCustomFieldsValue({ orderLogisticId, customFieldsValues, }: import("./interfaces").UpdateOrderLogisticCustomFieldParameters): Promise<import("./interfaces").UpdateOrderLogisticCustomFieldResponse>;
41
42
  getLogisticOrders({ approvalIds, locale, logisticStatus, incident, paymentOptions, nbPreviewLines, page, size, sort, }: import("./interfaces").GetLogisticOrdersParameters): Promise<import("./interfaces").GetLogisticOrdersResponse>;
42
43
  getLogisticOrderCustomFields({ customFieldIds, page, size, sort, }: import("./interfaces").GetLogisticOrderCustomFieldsParameters): Promise<import("./interfaces").GetLogisticOrderCustomFieldsResponse>;
43
44
  getLogisticOrderLineCustomFields({ customFieldIds, page, size, sort, }: import("./interfaces").GetLogisticOrderLineCustomFieldsParameters): Promise<import("./interfaces").GetLogisticOrderLineCustomFieldsResponse>;
@@ -50,21 +51,24 @@ export declare const DjustSDK: {
50
51
  updateLogisticOrderBillingInformation({ orderId, billingAddressId, }: import("./interfaces").UpdateLogisticOrderBillingInformationParameters): Promise<void>;
51
52
  cancelLogisticOrder({ orderId, locale, nbPreviewLines, }: import("./interfaces").CancelLogisticOrderParameters): Promise<import("./interfaces").CancelLogisticOrderResponse>;
52
53
  confirmLogisticOrderReception({ orderId, locale, nbPreviewLines, }: import("./interfaces").ConfirmLogisticOrderReceptionParameters): Promise<import("./interfaces").ConfirmLogisticOrderReceptionResponse>;
54
+ createLogisticOrder({ orderId, }: import("./interfaces").CreateLogisticOrderParameters): Promise<void>;
53
55
  disapproveLogisticOrder({ orderId, locale, nbPreviewLines, }: import("./interfaces").DisapproveLogisticOrderParameters): Promise<import("./interfaces").DisapproveLogisticOrderResponse>;
54
56
  getLogisticOrderDocuments({ orderId, idType, }: import("./interfaces").GetLogisticOrderDocumentsParameters): Promise<import("./interfaces").GetLogisticOrderDocumentsResponse>;
55
57
  getLogisticOrderDocumentUrl({ orderId, documentId, }: import("./interfaces").GetLogisticOrderDocumentUrlParameters): Promise<string[]>;
56
58
  getLogisticOrderLines({ orderId, page, size, sort, locale, }: import("./interfaces").GetLogisticOrderLinesParameters): Promise<import("./interfaces").GetLogisticOrderLinesResponse>;
59
+ updateOnHoldLogisticOrderLines({ orderId, lines, }: import("./interfaces").UpdateOnHoldLogisticOrderLinesParameters): Promise<import("./interfaces").UpdateOnHoldLogisticOrderLinesResponse>;
57
60
  updateLogisticOrderLineCustomFields({ orderId, lineId, locale, customFields, }: import("./interfaces").UpdateLogisticOrderLineCustomFieldsParameters): Promise<import("./interfaces").UpdateLogisticOrderLineCustomFieldsResponse>;
61
+ updateOnHoldLogisticOrderLine({ orderId, orderLineId, quantity, }: import("./interfaces").UpdateOnHoldLogisticOrderLineParameters): Promise<void>;
58
62
  updateLogisticOrderShippingAddress({ orderId, shippingAddressId, }: import("./interfaces").UpdateLogisticOrderShippingAddressParameters): Promise<void>;
59
63
  getLogisticOrderShippingInformation({ orderId, }: import("./interfaces").GetLogisticOrderShippingAddressParameters): Promise<import("./interfaces").GetLogisticOrderShippingAddressResponse>;
60
64
  updateLogisticOrderShippingInformation({ orderId, shippingAddressId, shippingType, }: import("./interfaces").UpdateLogisticOrderShippingInformationParameters): Promise<void>;
61
65
  updateLogisticOrderShippingType({ orderId, shippingType, }: import("./interfaces").UpdateLogisticOrderShippingTypeParameters): Promise<void>;
62
66
  createLogisticOrderThread({ orderId, lineId, message, reasonCode, }: import("./interfaces").CreateLogisticOrderThreadParameters): Promise<void>;
63
67
  getLogisticOrderReview({ orderId, }: import("./interfaces").GetLogisticOrderReviewParameters): Promise<import("./interfaces").GetLogisticOrderReviewResponse>;
64
- addLogisitcOrderReview({ orderId, comment, grade, }: import("./interfaces").AddLogisticOrderReviewParameters): Promise<import("./interfaces").AddLogisticOrderReviewResponse>;
68
+ addLogisticOrderReview({ orderId, comment, grade, }: import("./interfaces").AddLogisticOrderReviewParameters): Promise<import("./interfaces").AddLogisticOrderReviewResponse>;
65
69
  getThreadReasonTypes(): Promise<import("./interfaces").GetThreadReasonTypesResponse>;
66
70
  getThreadSubReasons({ reasonType, }: import("./interfaces").GetThreadSubReasonsParameters): Promise<import("./interfaces").GetThreadSubReasonsResponse>;
67
- getSuppliers({ pageable, }: import("./interfaces").GetSuppliersParameters): Promise<import("./interfaces").GetSuppliersResponse>;
71
+ getSuppliers({ pageable, supplierStatus, supplierIds, idType, }: import("./interfaces").GetSuppliersParameters): Promise<import("./interfaces").GetSuppliersResponse>;
68
72
  getSupplier({ supplierId, idType, }: import("./interfaces").GetSupplierParameters): Promise<import("./interfaces").GetSupplierResponse>;
69
73
  getSupplierEvaluations({ supplierId, idType, pageable, }: import("./interfaces").GetSupplierEvaluationsParameters): Promise<import("./interfaces").GetSupplierEvaluationsResponse>;
70
74
  getMasterQuotes({ fromCustomerAccount, pageable, }?: import("./interfaces").GetMasterQuotesParameters): Promise<import("./interfaces").GetMasterQuotesResponse>;
@@ -74,8 +78,11 @@ export declare const DjustSDK: {
74
78
  updateMasterQuote({ masterQuoteId, customFieldValues, masterQuoteDetailsToAdd, masterQuoteDetailsToRemove, }: import("./interfaces").UpdateMasterQuoteParameters): Promise<import("./interfaces").UpdateMasterQuoteResponse>;
75
79
  createSupplierQuotes({ billingAddressId, createSupplierQuoteRequests, masterQuoteId, supplierQuoteUrl, }: import("./interfaces").CreateSupplierQuotesParameters): Promise<import("./interfaces").CreateSupplierQuotesResponse>;
76
80
  getSupplierQuote({ supplierQuoteId, }: import("./interfaces").GetSupplierQuoteParameters): Promise<import("./interfaces").GetSupplierQuoteResponse>;
81
+ acceptSupplierQuote({ supplierQuoteId, }: import("./interfaces").AcceptSupplierQuoteParameters): Promise<import("./interfaces").AcceptSupplierQuoteResponse>;
82
+ updateSupplierQuoteCustomFields({ supplierQuoteId, customFieldValues, idType, }: import("./interfaces").UpdateSupplierQuoteCustomFieldsParameters): Promise<import("./interfaces").UpdateSupplierQuoteCustomFieldsResponse>;
77
83
  declineSupplierQuote({ supplierQuoteId, }: import("./interfaces").DeclineSupplierQuoteParameters): Promise<import("./interfaces").DeclineSupplierQuoteResponse>;
78
84
  postMessageToSupplierQuote({ supplierQuoteId, message, username, }: import("./interfaces").PostMessageToSupplierQuoteParameters): Promise<import("./interfaces").PostMessageToSupplierQuoteResponse>;
85
+ initializeOrderFromSupplierQuote({ supplierQuoteId, nbPreviewLines, quoteLineIdsAndQuantities, }: import("./interfaces").InitializeOrderFromSupplierQuoteParameters): Promise<import("./interfaces").InitializeOrderFromSupplierQuoteResponse>;
79
86
  autoCompleteSearchProducts({ input, locale, currency, pageable, aggregation, productTags, }: import("./interfaces").AutoCompleteSearchProductsParameters): Promise<import("./interfaces").SearchProductsResponse>;
80
87
  getProductsList({ locale, filters, pageable, }: import("./interfaces").GetProductsListParameters): Promise<import("./interfaces").GetProductsListResponse>;
81
88
  getProductVariantsList({ productSku, locale, pageable, }: import("./interfaces").GetProductVariantsListParameters): Promise<import("./interfaces").GetProductVariantsListResponse>;
@@ -93,11 +100,10 @@ export declare const DjustSDK: {
93
100
  getNavigationCategories({ locale, }: import("./interfaces").GetNavigationCategoriesParameters): Promise<import("./interfaces").GetNavigationCategoriesResponse>;
94
101
  getNavigationCategory({ locale, idType, navigationCategoryId, }: import("./interfaces").GetNavigationCategoryParameters): Promise<import("./interfaces").GetNavigationCategoryResponse>;
95
102
  getNavigationCategoryBreadcrumbs({ locale, idType, navigationCategoryId, }: import("./interfaces").GetNavigationCategoryBreadcrumbsParameters): Promise<import("./interfaces").GetNavigationCategoryBreadcrumbsResponse>;
96
- getAuthenticatedUser(): Promise<any>;
97
- createCustomerUser({ activationUrl, civility, customFieldValues, email, externalId, firstName, lastName, password, groups, status, mainOrganisationId, organisations, phone, }: import("./interfaces").CreateCustomerUserParameters): Promise<import("./interfaces").CreateCustomerUserResponse>;
103
+ getAuthenticatedUser(): Promise<import("./interfaces").GetAuthenticatedUserResponse>;
104
+ createCustomerUser(params: import("./interfaces").CreateCustomerUserParameters): Promise<import("./interfaces").CreateCustomerUserResponse>;
98
105
  updateCustomerUser({ civility, firstName, lastName, phone, customFieldValues, }: import("./interfaces").UpdateCustomerUserParameters): Promise<import("./interfaces").UpdateCustomerUserResponse>;
99
- removeCustomerUserFromAccount({ userId, }: import("./interfaces").RemoveCustomerUserParameters): Promise<void>;
100
- activateCustomerUser({ token, }: import("./interfaces").ActivateCustomerUserParameters): Promise<void>;
106
+ activateCustomerUser(params: import("./interfaces").ActivateCustomerUserParameters): Promise<void>;
101
107
  getCustomerUserAddresses({ shipping, billing, account, organisationIds, }: import("./interfaces").GetCustomerUserAddressesParameters): Promise<void>;
102
108
  getCustomerUserOrganisations(): Promise<import("./interfaces").GetCustomerUserOrganisationsResponse>;
103
109
  sendCustomerUserActivationRequest({ redirectUrl, token, }: import("./interfaces").SendCustomerUserActivationRequestParameters): Promise<void>;
@@ -110,7 +116,6 @@ export declare const DjustSDK: {
110
116
  updateCustomerAccountAddress({ addressId, additionalAddress, address, billing, city, company, country, fullName, label, phone, shipping, state, zipcode, }: import("./interfaces").UpdateCustomerAccountAddressParameters): Promise<import("./interfaces").UpdateCustomerAccountAddressResponse>;
111
117
  getCustomerAccountOrders({ pageable, locale, }: import("./interfaces").GetCustomerAccountOrdersParameters): Promise<import("./interfaces").GetCustomerAccountOrdersResponse>;
112
118
  getCustomerAccountUsers({ pageable, }: import("./interfaces").GetCustomerAccountUsersParameters): Promise<import("./interfaces").GetCustomerAccountUsersResponse>;
113
- createCustomerAccountUser({ accountId, civility, firstName, lastName, email, password, groups, }: import("./interfaces").CreateCustomerAccountUsersParameters): Promise<void>;
114
119
  createCustomerAccountOrganisation({ externalId, name, parentId, }: import("./interfaces").CreateCustomerAccountOrganisationParameters): Promise<import("./interfaces").CreateCustomerAccountOrganisationResponse>;
115
120
  updateCustomerAccountOrganisation({ organisationId, name, parentId, status, }: import("./interfaces").UpdateCustomerAccountOrganisationParameters): Promise<import("./interfaces").UpdateCustomerAccountOrganisationResponse>;
116
121
  getCustomerAccountOrganisations(): Promise<import("./interfaces").GetCustomerAccountOrganisationResponse>;
@@ -1,5 +1,6 @@
1
1
  import { CustomFieldValueObject, CustomFieldValueRequest } from "./custom-field";
2
2
  import { Order, PageableObject } from "./common";
3
+ import { CustomerAccountDto } from "./customer-account";
3
4
  export type CivilityType = "MR" | "MRS" | "MISS";
4
5
  export type UserStatus = "ACTIVE" | "INACTIVE" | "NEW" | "WAITING_ACTIVATION" | "APPROBATION_REFUSED";
5
6
  export interface CustomerUserWithoutAccountDto {
@@ -100,4 +101,9 @@ export interface SimpleUserView {
100
101
  firstName: string;
101
102
  lastName: string;
102
103
  }
104
+ export interface UserInfoDto {
105
+ account: CustomerAccountDto;
106
+ accounts: CustomerAccountDto[];
107
+ user: CustomerUserDto;
108
+ }
103
109
  export {};
@@ -62,7 +62,7 @@ export interface OfferInventory {
62
62
  minShippingPrice: number;
63
63
  minShippingPriceAdditional: number;
64
64
  minShippingType: number;
65
- minShippingZone: String;
65
+ minShippingZone: string;
66
66
  leadTimeToShip: number;
67
67
  customFieldValues: CustomFieldValueDto[];
68
68
  }
@@ -77,6 +77,12 @@ export interface OrderLogisticLineDto {
77
77
  quantity: number;
78
78
  status: OrderLineStatus;
79
79
  }
80
+ export interface OrderLogisticLineUpdate {
81
+ customFieldValues: CustomFieldValueObject[];
82
+ id: string;
83
+ quantity: number;
84
+ updateAction: string;
85
+ }
80
86
  interface OfferCustomFieldSnapshot {
81
87
  externalId: string;
82
88
  externalSource: string;
@@ -303,4 +309,94 @@ export interface RequestGetOrderLogisticDocumentbyID {
303
309
  orderLogisticId: string;
304
310
  documentId: string;
305
311
  }
312
+ export interface CardInformationDto {
313
+ AccessKey: string;
314
+ CardId: string;
315
+ CardRegistrationURL: string;
316
+ CardType: string;
317
+ CreationDate: string;
318
+ Currency: string;
319
+ Id: string;
320
+ PreregistrationData: string;
321
+ RegistrationData: string;
322
+ ResultCode: string;
323
+ Status: string;
324
+ Tag: string;
325
+ UserId: string;
326
+ }
327
+ export interface BrowserInfo {
328
+ AcceptHeader: string;
329
+ ColorDepth: number;
330
+ JavaEnabled: boolean;
331
+ JavascriptEnabled: boolean;
332
+ Language: string;
333
+ ScreenHeight: number;
334
+ ScreenWidth: number;
335
+ TimeZoneOffset: string;
336
+ UserAgent: string;
337
+ }
338
+ export interface PaymentCardInfo {
339
+ amount: number;
340
+ cardId: string;
341
+ currency: string;
342
+ }
343
+ export interface PreauthorizationDto {
344
+ Applied3DSVersion: string;
345
+ AuthorId: string;
346
+ Billing: {
347
+ Address: {
348
+ AddressLine1: string;
349
+ AddressLine2: string;
350
+ City: string;
351
+ Country: string;
352
+ PostalCode: string;
353
+ Region: string;
354
+ };
355
+ FirstName: string;
356
+ LastName: string;
357
+ };
358
+ BrowserInfo: BrowserInfo;
359
+ CardId: string;
360
+ CreationDate: number;
361
+ Culture: string;
362
+ DebitedFunds: {
363
+ Amount: number;
364
+ Currency: Currency;
365
+ };
366
+ ExecutionType: string;
367
+ ExpirationDate: number;
368
+ Id: string;
369
+ IpAddress: string;
370
+ MultiCapture: true;
371
+ PaymentStatus: string;
372
+ RemainingFunds: {
373
+ Amount: number;
374
+ Currency: Currency;
375
+ };
376
+ Requested3DSVersion: string;
377
+ ResultCode: string;
378
+ ResultMessage: string;
379
+ SecureMode: string;
380
+ SecureModeNeeded: true;
381
+ SecureModeRedirectURL: string;
382
+ SecureModeReturnURL: string;
383
+ SecurityInfo: {
384
+ AVSResult: string;
385
+ };
386
+ Shipping: {
387
+ Address: {
388
+ AddressLine1: string;
389
+ AddressLine2: string;
390
+ City: string;
391
+ Country: string;
392
+ PostalCode: string;
393
+ Region: string;
394
+ };
395
+ FirstName: string;
396
+ LastName: string;
397
+ };
398
+ StatementDescriptor: string;
399
+ Status: string;
400
+ Tag: string;
401
+ }
306
402
  export {};
@@ -2,7 +2,10 @@ import { SupplierSimpleView } from "./supplier";
2
2
  import { AddressDto } from "./address";
3
3
  import { Order, PageableObject } from "./common";
4
4
  import { ProductVariantResponse } from "./product";
5
- export type SupplierQuoteStatus = "STAGING" | "NEW" | "WAITING_FOR_CUSTOMER" | "WAITING_FOR_SUPPLIER_INFOS" | "WAITING_FOR_OPERATOR" | "DECLINED_BY_OPERATOR" | "DECLINED_BY_SUPPLIER" | "DECLINED_BY_CUSTOMER" | "VALIDATED" | "CLOSED";
5
+ import { CustomFieldValueObject } from "./custom-field";
6
+ export type SupplierQuoteStatus = "STAGING" | "NEW" | "WAITING_FOR_CUSTOMER" | "WAITING_FOR_SUPPLIER_INFOS" | "WAITING_FOR_OPERATOR" | "DECLINED_BY_OPERATOR" | "DECLINED_BY_SUPPLIER" | "DECLINED_BY_CUSTOMER" | "VALIDATED" | "CLOSED" | "EXPIRED";
7
+ export type SupplierQuoteOrderingState = "TO_ORDER" | "PARTIALLY_ORDERED" | "FULLY_ORDERED";
8
+ export type SupplierQuoteIdType = "DJUST_ID" | "EXTERNAL_ID";
6
9
  export interface PageMasterQuote {
7
10
  content: MasterQuote[];
8
11
  empty: boolean;
@@ -17,6 +20,7 @@ export interface PageMasterQuote {
17
20
  totalPages: number;
18
21
  }
19
22
  export interface MasterQuote {
23
+ customFieldValues: CustomFieldValueObject[];
20
24
  description: string;
21
25
  id: string;
22
26
  masterQuoteDetails: MasterQuoteDetail[];
@@ -31,17 +35,24 @@ export interface MasterQuoteDetail {
31
35
  export interface SupplierQuoteDto {
32
36
  billingAddress: AddressDto;
33
37
  createdAt: string;
38
+ customFieldValue: CustomFieldValueObject[];
34
39
  customerName: string;
35
40
  customerThread: ThreadMessage[];
36
41
  customerUserId: string;
42
+ externalId: string;
43
+ globalDiscount: number;
37
44
  id: string;
45
+ orderingState: SupplierQuoteOrderingState;
38
46
  quoteLines: QuoteLine[];
47
+ quoteWithMultipleOrders: boolean;
39
48
  status: SupplierQuoteStatus;
40
49
  supplier: SupplierSimpleView;
41
50
  updatedAt: string;
42
51
  validityDate: string;
43
52
  }
44
53
  interface QuoteLine {
54
+ customFieldValues: CustomFieldValueObject[];
55
+ externalId: string;
45
56
  id: string;
46
57
  offerInventoryId: string;
47
58
  price: number;
@@ -53,6 +64,7 @@ interface QuoteLine {
53
64
  quantity: number;
54
65
  shippingAddress: AddressDto;
55
66
  }[];
67
+ remainingQuantity: number;
56
68
  shippingPrice: number;
57
69
  shippingTaxAmount: number;
58
70
  shippingTaxRate: number;
@@ -1,36 +1,150 @@
1
+ /**
2
+ * @packageDocumentation
3
+ *
4
+ * @document documents/auth.md
5
+ */
1
6
  import { IsTokenValidParameters, LoginParameters, LoginResponse, RefreshTokenParameters, RefreshTokenResponse, ResetPasswordParameters, SendResetPasswordEmailParameters } from "./definitions";
2
7
  /**
3
- * Returns true if the token is valid and not expired, false otherwise
8
+ * CART ENDPOINT
9
+ */
10
+ /**
11
+ * ##R eturns true if the token is valid and not expired, false otherwise
12
+ * ### APICODE(TOK-200)
4
13
  * @param {IsTokenValidParameters} params - The parameters for the function
14
+ * #### token - `string` | <strong style={{ color: 'red' }}>required</strong>
15
+ * The token to validate.
16
+ *
5
17
  * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the token is valid or not
18
+ *
19
+ * @example
20
+ * #### input
21
+ * ```typescript
22
+ * const isValidToken = await isTokenValid({
23
+ * token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
24
+ * });
25
+ * ```
26
+ * #### output
27
+ * ```json
28
+ * true
29
+ * ```
6
30
  */
7
31
  export declare function isTokenValid({ token, }: IsTokenValidParameters): Promise<boolean>;
8
32
  /**
9
- * Ask for a new token from a refresh token
10
- * @param {RefreshTokenParameters} params - The parameters for the function
33
+ * ## Ask for a new token from a refresh token
34
+ * ### APICODE(AUTH-102)
35
+ * @param {RefreshTokenParameters} params - The parameters for the function, including:
36
+ * #### refreshToken - `string` | <strong style={{ color: 'red' }}>required</strong>
37
+ * The refresh token to request a new access token (required)
38
+ *
11
39
  * @returns {Promise<RefreshTokenResponse>} - A promise that resolves to the response containing the new token
40
+ *
41
+ * @example
42
+ * #### input
43
+ * ```typescript
44
+ * const response = await refreshToken({ refreshToken: 'string' });
45
+ * ```
46
+ * #### output
47
+ * ```json
48
+ * {
49
+ * "token": {
50
+ * "accessToken": "string",
51
+ * "expireAt": 0,
52
+ * "refreshToken": "string"
53
+ * },
54
+ * "user": {
55
+ * "id": "userID"
56
+ * }
57
+ * }
58
+ * ```
12
59
  */
13
60
  export declare function refreshToken({ refreshToken, }: RefreshTokenParameters): Promise<RefreshTokenResponse>;
14
61
  /**
15
- * Reset the password of a user
62
+ * ## Reset the password of a user
63
+ * ### APICODE(PWD-102)
16
64
  * @param {ResetPasswordParameters} params - The parameters for the function
17
- * @returns {Promise<void>} - A promise that resolves when the password is reset
65
+ * #### newPassword - `string` | <strong style={{ color: 'red' }}>required</strong>
66
+ * The new password to set for the user.
67
+ * #### resetPasswordToken - `string` | <strong style={{ color: 'red' }}>required</strong>
68
+ * The token required to authenticate the password reset process.
69
+ *
70
+ * @returns {Promise<void>} - Resolves to a success message `"OK"` when the password is successfully reset
71
+ *
72
+ * @example
73
+ * #### input
74
+ * ```typescript
75
+ * await resetPassword({ newPassword: 'string', resetPasswordToken: 'string' });
76
+ * ```
77
+ * #### output
78
+ * ```json
79
+ * "OK" (No output, resolves on success)
80
+ * ```
18
81
  */
19
82
  export declare function resetPassword({ newPassword, resetPasswordToken, }: ResetPasswordParameters): Promise<void>;
20
83
  /**
21
- * Send an email to the user with a reset password link
22
- * @param {SendResetPasswordEmailParameters} params - The parameters for the function
84
+ * ## Send an email to the user with a reset password link
85
+ * ### APICODE(PWD-101)
86
+ * @param {SendResetPasswordEmailParameters} params - The parameters for the function, including:
87
+ * #### email - `string` | <strong style={{ color: 'red' }}>required</strong>
88
+ * The email address to send the reset link to.
89
+ *
23
90
  * @returns {Promise<void>} - A promise that resolves when the email is sent
91
+ *
92
+ * @example
93
+ * #### input
94
+ * ```typescript
95
+ * await sendResetPasswordEmail({ email: 'user@example.com' });
96
+ * ```
97
+ * #### output
98
+ * ```json
99
+ * "OK" (No output, resolves on success)
100
+ * ```
24
101
  */
25
102
  export declare function sendResetPasswordEmail({ email, }: SendResetPasswordEmailParameters): Promise<void>;
26
103
  /**
27
- * Login a user
28
- * @param {LoginParameters} params - The parameters for the function
104
+ * ##Login a user
105
+ * ### APICODE(AUTH-101)
106
+ * @param {LoginParameters} params - The parameters for the function, including:
107
+ * #### username - `string` | <strong style={{ color: 'red' }}>required</strong>
108
+ * The username of the user to log in.
109
+ * #### password - `string` | <strong style={{ color: 'red' }}>required</strong>
110
+ * The password of the user to log in.
111
+ *
29
112
  * @returns {Promise<LoginResponse>} - A promise that resolves to the response containing the user's login information
113
+ *
114
+ * @example
115
+ * #### input
116
+ * ```typescript
117
+ * const loginResponse = await login({ username: 'user@example.com', password: 'password123' });
118
+ * ```
119
+ * #### output
120
+ * ```json
121
+ * {
122
+ * "token": {
123
+ * "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
124
+ * "expireAt": 1679022000,
125
+ * "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
126
+ * },
127
+ * "user": {
128
+ * "id": "userID"
129
+ * }
130
+ * }
131
+ * ```
30
132
  */
31
133
  export declare function login({ username, password, }: LoginParameters): Promise<LoginResponse>;
32
134
  /**
33
- * Logout the user
135
+ * ### Logout the user
136
+ * ### APICODE(AUTH-103)
137
+ *
34
138
  * @returns {Promise<void>} - A promise that resolves when the user is logged out
139
+ *
140
+ * @example
141
+ * #### input
142
+ * ```typescript
143
+ * await logout();
144
+ * ```
145
+ * #### output
146
+ * ```json
147
+ * "OK" (No output, resolves on success)
148
+ * ```
35
149
  */
36
150
  export declare function logout(): Promise<void>;
@@ -1,4 +1,9 @@
1
1
  "use strict";
2
+ /**
3
+ * @packageDocumentation
4
+ *
5
+ * @document documents/auth.md
6
+ */
2
7
  Object.defineProperty(exports, "__esModule", { value: true });
3
8
  exports.isTokenValid = isTokenValid;
4
9
  exports.refreshToken = refreshToken;
@@ -9,9 +14,28 @@ exports.logout = logout;
9
14
  const parameters_validation_1 = require("../../helpers/parameters-validation");
10
15
  const fetch_instance_1 = require("../../settings/fetch-instance");
11
16
  /**
12
- * Returns true if the token is valid and not expired, false otherwise
17
+ * CART ENDPOINT
18
+ */
19
+ /**
20
+ * ##R eturns true if the token is valid and not expired, false otherwise
21
+ * ### APICODE(TOK-200)
13
22
  * @param {IsTokenValidParameters} params - The parameters for the function
23
+ * #### token - `string` | <strong style={{ color: 'red' }}>required</strong>
24
+ * The token to validate.
25
+ *
14
26
  * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the token is valid or not
27
+ *
28
+ * @example
29
+ * #### input
30
+ * ```typescript
31
+ * const isValidToken = await isTokenValid({
32
+ * token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
33
+ * });
34
+ * ```
35
+ * #### output
36
+ * ```json
37
+ * true
38
+ * ```
15
39
  */
16
40
  async function isTokenValid({ token, }) {
17
41
  (0, parameters_validation_1.required)({ token });
@@ -25,9 +49,32 @@ async function isTokenValid({ token, }) {
25
49
  return response === null || response === void 0 ? void 0 : response.data;
26
50
  }
27
51
  /**
28
- * Ask for a new token from a refresh token
29
- * @param {RefreshTokenParameters} params - The parameters for the function
52
+ * ## Ask for a new token from a refresh token
53
+ * ### APICODE(AUTH-102)
54
+ * @param {RefreshTokenParameters} params - The parameters for the function, including:
55
+ * #### refreshToken - `string` | <strong style={{ color: 'red' }}>required</strong>
56
+ * The refresh token to request a new access token (required)
57
+ *
30
58
  * @returns {Promise<RefreshTokenResponse>} - A promise that resolves to the response containing the new token
59
+ *
60
+ * @example
61
+ * #### input
62
+ * ```typescript
63
+ * const response = await refreshToken({ refreshToken: 'string' });
64
+ * ```
65
+ * #### output
66
+ * ```json
67
+ * {
68
+ * "token": {
69
+ * "accessToken": "string",
70
+ * "expireAt": 0,
71
+ * "refreshToken": "string"
72
+ * },
73
+ * "user": {
74
+ * "id": "userID"
75
+ * }
76
+ * }
77
+ * ```
31
78
  */
32
79
  async function refreshToken({ refreshToken, }) {
33
80
  (0, parameters_validation_1.required)({ refreshToken });
@@ -41,9 +88,25 @@ async function refreshToken({ refreshToken, }) {
41
88
  return data;
42
89
  }
43
90
  /**
44
- * Reset the password of a user
91
+ * ## Reset the password of a user
92
+ * ### APICODE(PWD-102)
45
93
  * @param {ResetPasswordParameters} params - The parameters for the function
46
- * @returns {Promise<void>} - A promise that resolves when the password is reset
94
+ * #### newPassword - `string` | <strong style={{ color: 'red' }}>required</strong>
95
+ * The new password to set for the user.
96
+ * #### resetPasswordToken - `string` | <strong style={{ color: 'red' }}>required</strong>
97
+ * The token required to authenticate the password reset process.
98
+ *
99
+ * @returns {Promise<void>} - Resolves to a success message `"OK"` when the password is successfully reset
100
+ *
101
+ * @example
102
+ * #### input
103
+ * ```typescript
104
+ * await resetPassword({ newPassword: 'string', resetPasswordToken: 'string' });
105
+ * ```
106
+ * #### output
107
+ * ```json
108
+ * "OK" (No output, resolves on success)
109
+ * ```
47
110
  */
48
111
  async function resetPassword({ newPassword, resetPasswordToken, }) {
49
112
  (0, parameters_validation_1.required)({ newPassword, resetPasswordToken });
@@ -57,9 +120,23 @@ async function resetPassword({ newPassword, resetPasswordToken, }) {
57
120
  });
58
121
  }
59
122
  /**
60
- * Send an email to the user with a reset password link
61
- * @param {SendResetPasswordEmailParameters} params - The parameters for the function
123
+ * ## Send an email to the user with a reset password link
124
+ * ### APICODE(PWD-101)
125
+ * @param {SendResetPasswordEmailParameters} params - The parameters for the function, including:
126
+ * #### email - `string` | <strong style={{ color: 'red' }}>required</strong>
127
+ * The email address to send the reset link to.
128
+ *
62
129
  * @returns {Promise<void>} - A promise that resolves when the email is sent
130
+ *
131
+ * @example
132
+ * #### input
133
+ * ```typescript
134
+ * await sendResetPasswordEmail({ email: 'user@example.com' });
135
+ * ```
136
+ * #### output
137
+ * ```json
138
+ * "OK" (No output, resolves on success)
139
+ * ```
63
140
  */
64
141
  async function sendResetPasswordEmail({ email, }) {
65
142
  (0, parameters_validation_1.required)({ email });
@@ -72,9 +149,34 @@ async function sendResetPasswordEmail({ email, }) {
72
149
  });
73
150
  }
74
151
  /**
75
- * Login a user
76
- * @param {LoginParameters} params - The parameters for the function
152
+ * ##Login a user
153
+ * ### APICODE(AUTH-101)
154
+ * @param {LoginParameters} params - The parameters for the function, including:
155
+ * #### username - `string` | <strong style={{ color: 'red' }}>required</strong>
156
+ * The username of the user to log in.
157
+ * #### password - `string` | <strong style={{ color: 'red' }}>required</strong>
158
+ * The password of the user to log in.
159
+ *
77
160
  * @returns {Promise<LoginResponse>} - A promise that resolves to the response containing the user's login information
161
+ *
162
+ * @example
163
+ * #### input
164
+ * ```typescript
165
+ * const loginResponse = await login({ username: 'user@example.com', password: 'password123' });
166
+ * ```
167
+ * #### output
168
+ * ```json
169
+ * {
170
+ * "token": {
171
+ * "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
172
+ * "expireAt": 1679022000,
173
+ * "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
174
+ * },
175
+ * "user": {
176
+ * "id": "userID"
177
+ * }
178
+ * }
179
+ * ```
78
180
  */
79
181
  async function login({ username, password, }) {
80
182
  (0, parameters_validation_1.required)({ username, password });
@@ -89,8 +191,20 @@ async function login({ username, password, }) {
89
191
  return data;
90
192
  }
91
193
  /**
92
- * Logout the user
194
+ * ### Logout the user
195
+ * ### APICODE(AUTH-103)
196
+ *
93
197
  * @returns {Promise<void>} - A promise that resolves when the user is logged out
198
+ *
199
+ * @example
200
+ * #### input
201
+ * ```typescript
202
+ * await logout();
203
+ * ```
204
+ * #### output
205
+ * ```json
206
+ * "OK" (No output, resolves on success)
207
+ * ```
94
208
  */
95
209
  async function logout() {
96
210
  await (0, fetch_instance_1.enhancedFetch)({