@djust-b2b/djust-front-sdk 1.28.0 → 1.29.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
@@ -21,6 +21,7 @@ export declare const DjustSDK: {
21
21
  updateCommercialOrderShippingInformation({ orderId, shippingAddressId, shippingType, }: import("./interfaces").UpdateCommercialOrderShippingInformationParameters): Promise<void>;
22
22
  updateCommercialOrderShippingType({ orderId, shippingType, }: import("./interfaces").UpdateCommercialOrderShippingTypeParameters): Promise<void>;
23
23
  deleteCommercialOrder(commercialOrderId: string): Promise<void>;
24
+ getCommercialOrderLines({ commercialOrderId, page, size, sort, supplierIds, productVariantIds, offerPriceIds, idType, locale, }: import("./interfaces").GetOrderCommercialLinesParameters): Promise<import("./interfaces").GetOrderCommercialLinesResponse>;
24
25
  updateCommercialOrderLines({ commercialOrderId, customFieldIdType, lineIdType, lineType, updateOrderCommercialLines, updateOrderLineIdType, updateOrderLineType, }: import("./interfaces").UpdateCommercialOrderLinesParameters): Promise<import("./interfaces").UpdateCommercialOrderLinesResponse>;
25
26
  deleteCommercialOrderLines({ commercialOrderId, body, }: import("./interfaces").DeleteCommercialOrderLinesParameters): Promise<import("./interfaces").DeleteCommercialOrderLinesResponse>;
26
27
  punchoutOciCommercialOrder({ tenantConfigurationKey, commercialOrderId, locale, }: import("./interfaces").PunchoutOciCommercialOrderParameters): Promise<any>;
@@ -288,6 +288,36 @@ export interface PageOrderLogisticLineDto {
288
288
  totalElements: number;
289
289
  totalPages: number;
290
290
  }
291
+ export interface PageOrderCommercialLinesDto {
292
+ content: OrderCommercialLineDto[];
293
+ empty: boolean;
294
+ first: boolean;
295
+ last: boolean;
296
+ number: number;
297
+ numberOfElements: number;
298
+ pageable: PageableObject;
299
+ size: number;
300
+ sort: Order[];
301
+ totalElements: number;
302
+ totalPages: number;
303
+ }
304
+ export interface OrderCommercialLineDto {
305
+ confirmedQuantity: number;
306
+ customFieldValues: OrderCommercialLineCustomFieldValuesDto[];
307
+ externalId: string;
308
+ externalSource: string;
309
+ id: string;
310
+ incidentDeclared: boolean;
311
+ offerInventorySnapshotDto: OrderCommercialLineOfferInventoryDto;
312
+ offerPriceSnapshotDto: OrderCommercialLineOfferPriceDto;
313
+ orderLogisticLinePriceDto: OrderLogisticLinePriceDto;
314
+ orderLogisticLineProductDto: OrderLogisticLineProductDto;
315
+ orderLogisticLineProductVariantDto: OrderLogisticLineProductVariantDto;
316
+ paymentStatus: string;
317
+ quantity: number;
318
+ quoteLineExternalId: string;
319
+ status: string;
320
+ }
291
321
  export interface ShippingTypeInformationDto {
292
322
  code: string;
293
323
  earliestDays: number;
@@ -375,6 +405,40 @@ export interface ThreadCustomFiedValuesDto {
375
405
  };
376
406
  value: unknown;
377
407
  }
408
+ export interface OrderCommercialLineCustomFieldValuesDto extends ThreadCustomFiedValuesDto {
409
+ }
410
+ export interface OrderCommercialLineOfferInventoryDto extends ThreadCustomFiedValuesDto {
411
+ currency: string;
412
+ customFieldValueSnapshots: OrderCommercialLineCustomFieldValuesDto[];
413
+ externalSource: string;
414
+ offerInventoryExternalId: string;
415
+ packingType: string;
416
+ productTaxCode: string;
417
+ productTaxRate: number;
418
+ quantityPerItem: number;
419
+ shippingTaxCode: string;
420
+ shippingTaxRate: number;
421
+ }
422
+ export interface OrderCommercialLineOfferPriceDto {
423
+ confirmedProductPriceWithoutTaxes: number;
424
+ itemPerPack: number;
425
+ offerPriceExternalId: string;
426
+ offerPriceType: string;
427
+ offerPriceTypeValue: string;
428
+ productPriceWithTaxes: number;
429
+ productPriceWithoutTaxes: number;
430
+ productTaxAmount: number;
431
+ shippingPriceWithTaxes: number;
432
+ shippingPriceWithoutTaxes: number;
433
+ shippingTaxAmount: number;
434
+ taxLegalNotice: string;
435
+ totalPriceWithTaxes: number;
436
+ totalPriceWithoutTaxes: number;
437
+ totalProductPriceWithTaxes: number;
438
+ totalProductPriceWithoutTaxes: number;
439
+ totalProductTaxAmount: number;
440
+ totalTaxAmount: number;
441
+ }
378
442
  export interface RequestGetAccountingDocumentLinkbyID {
379
443
  orderLogisticId: string;
380
444
  docId: string;
@@ -1,6 +1,6 @@
1
1
  import { Channel, Currency, IdType } from "../../interfaces/models/common";
2
2
  import { CustomFieldValueRequest } from "../../interfaces/models/custom-field";
3
- import { BrowserInfo, CardInformationDto, OrderCommercialDto, OrderIdType, OrderLogisticDto, OrderOrigin, PageOrderCommercialDto, PaymentCardInfo, PreauthorizationDto, OfferToDelete, OrderLogisticLineUpdate, OrderLineType } from "../../interfaces/models/order";
3
+ import { BrowserInfo, CardInformationDto, OrderCommercialDto, OrderIdType, OrderLogisticDto, OrderOrigin, PageOrderCommercialDto, PaymentCardInfo, PreauthorizationDto, OfferToDelete, OrderLogisticLineUpdate, OrderLineType, PageOrderCommercialLinesDto } from "../../interfaces/models/order";
4
4
  import { SingleWarningReportDto } from "../../interfaces/models/common";
5
5
  import { PaymentInfoRequest, PaymentOption, PaymentProvider } from "../../interfaces/models/payment";
6
6
  /**
@@ -10,6 +10,17 @@ export interface GetCommercialOrdersParameters {
10
10
  locale: string;
11
11
  nbPreviewLines?: number;
12
12
  }
13
+ export interface GetOrderCommercialLinesParameters {
14
+ commercialOrderId: string;
15
+ page?: number;
16
+ size?: number;
17
+ sort?: string;
18
+ supplierIds?: string[];
19
+ productVariantIds?: string[];
20
+ offerPriceIds: string[];
21
+ idType?: IdType;
22
+ locale?: string;
23
+ }
13
24
  export interface CreateCommercialOrderParameters {
14
25
  nbPreviewLines?: number;
15
26
  channel?: Channel;
@@ -109,6 +120,8 @@ export interface UpdateCommercialOrderLinesParameters {
109
120
  }
110
121
  export interface GetCommercialOrderResponse extends OrderCommercialDto {
111
122
  }
123
+ export interface GetOrderCommercialLinesResponse extends PageOrderCommercialLinesDto {
124
+ }
112
125
  export interface CreateCommercialOrderCardRegistrationResponse extends CardInformationDto {
113
126
  }
114
127
  export interface CreateCommercialOrderPreauthorizationResponse extends PreauthorizationDto {
@@ -1,4 +1,4 @@
1
- import { CreateCommercialOrderCardRegistrationParameters, CreateCommercialOrderCardRegistrationResponse, CreateCommercialOrderParameters, CreateCommercialOrderResponse, CreateCommercialOrderV2Parameters, CreateCommercialOrderV2Response, UpdateCommercialOrderParameters, DeleteCommercialOrderLinesParameters, DeleteCommercialOrderLinesResponse, UpdateCommercialOrderLinesParameters, UpdateCommercialOrderLinesResponse, CreateCommercialOrderPreauthorizationParameters, CreateCommercialOrderPreauthorizationResponse, GetCommercialOrderParameters, GetCommercialOrderPaymentPageUrlParameters, GetCommercialOrderResponse, GetCommercialOrdersParameters, GetCommercialOrdersResponse, SetCommercialOrderStatusAsCreatedParameters, SetCommercialOrderStatusAsOnHoldParameters, UpdateCommercialOrderBillingInformationParameters, UpdateCommercialOrderShippingAddressParameters, UpdateCommercialOrderShippingInformationParameters, UpdateCommercialOrderShippingTypeParameters, PunchoutOciCommercialOrderParameters } from "./definitions";
1
+ import { CreateCommercialOrderCardRegistrationParameters, CreateCommercialOrderCardRegistrationResponse, CreateCommercialOrderParameters, CreateCommercialOrderResponse, CreateCommercialOrderV2Parameters, CreateCommercialOrderV2Response, UpdateCommercialOrderParameters, DeleteCommercialOrderLinesParameters, DeleteCommercialOrderLinesResponse, UpdateCommercialOrderLinesParameters, UpdateCommercialOrderLinesResponse, CreateCommercialOrderPreauthorizationParameters, CreateCommercialOrderPreauthorizationResponse, GetCommercialOrderParameters, GetCommercialOrderPaymentPageUrlParameters, GetCommercialOrderResponse, GetCommercialOrdersParameters, GetCommercialOrdersResponse, SetCommercialOrderStatusAsCreatedParameters, SetCommercialOrderStatusAsOnHoldParameters, UpdateCommercialOrderBillingInformationParameters, UpdateCommercialOrderShippingAddressParameters, UpdateCommercialOrderShippingInformationParameters, UpdateCommercialOrderShippingTypeParameters, GetOrderCommercialLinesParameters, GetOrderCommercialLinesResponse, PunchoutOciCommercialOrderParameters } from "./definitions";
2
2
  /**
3
3
  * COMMERCIAL ORDER ENDPOINT
4
4
  */
@@ -479,6 +479,45 @@ export declare function updateCommercialOrderShippingType({ orderId, shippingTyp
479
479
  * @returns {Promise<void>} A promise resolving when the commercial order is successfully deleted.
480
480
  */
481
481
  export declare function deleteCommercialOrder(commercialOrderId: string): Promise<void>;
482
+ /**
483
+ * 🚚 Gets commercial order lines.
484
+ *
485
+ * This function retrieves the lines of a commercial order identified by the `commercialOrderId`.
486
+ * The `commercialOrderId` parameter is mandatory and validated before the request is executed.
487
+ *
488
+ * 🛠 **Endpoint**: `GET /v1/shop/commercial-orders/${commercialOrderId}/lines` [ORDER-561]
489
+ *
490
+ * | Parameter | Type | Required | Description |
491
+ * |---------------------|--------------------|-----------|----------------------------------------------------------------|
492
+ * | `commercialOrderId` | `string` | ✅ | The ID of the commercial order whose lines are to be retrieved |
493
+ * | `page` | `number` | ❌ | The page number to retrieve |
494
+ * | `size` | `number` | ❌ | The number of items per page |
495
+ * | `sort` | `string` | ❌ | The sort to apply to the results |
496
+ * | `supplierIds` | `string[]` | ❌ | Filter by supplier IDs |
497
+ * | `productVariantIds` | `string[]` | ❌ | Filter by product variant IDs |
498
+ * | `offerPriceIds` | `string[]` | ❌ | Filter by offer price IDs |
499
+ * | `idType` | `string` | ❌ | The ID type to use |
500
+ * | `locale` | `string` | ❌ | The locale for the response data |
501
+ *
502
+ * 📤 **Returns**:
503
+ * A `Promise` resolving to a `GetOrderCommercialLinesResponse` object containing the commercial order lines.
504
+ *
505
+ * 🛠 **Example usage**:
506
+ * ```ts
507
+ * const response = await getCommercialOrderLines({
508
+ * commercialOrderId: "commercialOrder123",
509
+ * page: 0,
510
+ * size: 20,
511
+ * sort: "createdAt,desc",
512
+ * locale: "fr"
513
+ * });
514
+ * ```
515
+ *
516
+ * @param {GetOrderCommercialLinesParameters} params - The parameters for the request
517
+ * @throws {Error} If `commercialOrderId` is missing
518
+ * @returns {Promise<GetOrderCommercialLinesResponse>} A promise resolving to the response containing the commercial order lines
519
+ */
520
+ export declare function getCommercialOrderLines({ commercialOrderId, page, size, sort, supplierIds, productVariantIds, offerPriceIds, idType, locale, }: GetOrderCommercialLinesParameters): Promise<GetOrderCommercialLinesResponse>;
482
521
  /**
483
522
  * 🚚 Update specific commercial order lines.
484
523
  *
@@ -15,6 +15,7 @@ exports.updateCommercialOrderShippingAddress = updateCommercialOrderShippingAddr
15
15
  exports.updateCommercialOrderShippingInformation = updateCommercialOrderShippingInformation;
16
16
  exports.updateCommercialOrderShippingType = updateCommercialOrderShippingType;
17
17
  exports.deleteCommercialOrder = deleteCommercialOrder;
18
+ exports.getCommercialOrderLines = getCommercialOrderLines;
18
19
  exports.updateCommercialOrderLines = updateCommercialOrderLines;
19
20
  exports.deleteCommercialOrderLines = deleteCommercialOrderLines;
20
21
  exports.punchoutOciCommercialOrder = punchoutOciCommercialOrder;
@@ -654,6 +655,62 @@ async function deleteCommercialOrder(commercialOrderId) {
654
655
  path: `/v2/shop/commercial-orders/${commercialOrderId}`,
655
656
  });
656
657
  }
658
+ /**
659
+ * 🚚 Gets commercial order lines.
660
+ *
661
+ * This function retrieves the lines of a commercial order identified by the `commercialOrderId`.
662
+ * The `commercialOrderId` parameter is mandatory and validated before the request is executed.
663
+ *
664
+ * 🛠 **Endpoint**: `GET /v1/shop/commercial-orders/${commercialOrderId}/lines` [ORDER-561]
665
+ *
666
+ * | Parameter | Type | Required | Description |
667
+ * |---------------------|--------------------|-----------|----------------------------------------------------------------|
668
+ * | `commercialOrderId` | `string` | ✅ | The ID of the commercial order whose lines are to be retrieved |
669
+ * | `page` | `number` | ❌ | The page number to retrieve |
670
+ * | `size` | `number` | ❌ | The number of items per page |
671
+ * | `sort` | `string` | ❌ | The sort to apply to the results |
672
+ * | `supplierIds` | `string[]` | ❌ | Filter by supplier IDs |
673
+ * | `productVariantIds` | `string[]` | ❌ | Filter by product variant IDs |
674
+ * | `offerPriceIds` | `string[]` | ❌ | Filter by offer price IDs |
675
+ * | `idType` | `string` | ❌ | The ID type to use |
676
+ * | `locale` | `string` | ❌ | The locale for the response data |
677
+ *
678
+ * 📤 **Returns**:
679
+ * A `Promise` resolving to a `GetOrderCommercialLinesResponse` object containing the commercial order lines.
680
+ *
681
+ * 🛠 **Example usage**:
682
+ * ```ts
683
+ * const response = await getCommercialOrderLines({
684
+ * commercialOrderId: "commercialOrder123",
685
+ * page: 0,
686
+ * size: 20,
687
+ * sort: "createdAt,desc",
688
+ * locale: "fr"
689
+ * });
690
+ * ```
691
+ *
692
+ * @param {GetOrderCommercialLinesParameters} params - The parameters for the request
693
+ * @throws {Error} If `commercialOrderId` is missing
694
+ * @returns {Promise<GetOrderCommercialLinesResponse>} A promise resolving to the response containing the commercial order lines
695
+ */
696
+ async function getCommercialOrderLines({ commercialOrderId, page, size, sort, supplierIds, productVariantIds, offerPriceIds, idType, locale, }) {
697
+ (0, parameters_validation_1.required)({ commercialOrderId });
698
+ const { data } = await (0, fetch_instance_1.enhancedFetch)({
699
+ method: "GET",
700
+ path: `/v1/shop/commercial-orders/${commercialOrderId}/lines`,
701
+ params: {
702
+ page,
703
+ sort,
704
+ size,
705
+ supplierIds,
706
+ productVariantIds,
707
+ offerPriceIds,
708
+ idType,
709
+ locale,
710
+ },
711
+ });
712
+ return data;
713
+ }
657
714
  /**
658
715
  * 🚚 Update specific commercial order lines.
659
716
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djust-b2b/djust-front-sdk",
3
- "version": "1.28.0",
3
+ "version": "1.29.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",