@devite/shopware-client 1.7.8 → 1.8.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/dist/index.cjs CHANGED
@@ -513,7 +513,7 @@ let DocumentClient$1 = class DocumentClient extends Client {
513
513
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
514
514
  */
515
515
  async reserveNumber(salesChannelId, type, preview) {
516
- const response = await this.post(`/_action/number-range/reserve/${type}/${salesChannelId}`, {
516
+ const response = await this.get(`/_action/number-range/reserve/${type}/${salesChannelId}`, {
517
517
  query: { preview },
518
518
  headers: { Accept: "application/json" }
519
519
  });
@@ -766,10 +766,11 @@ let OrderClient$1 = class OrderClient extends Client {
766
766
  const response = await this.post(`/_action/order/document/${documentTypeName}/create`, {
767
767
  body: new JsonPayload(request)
768
768
  });
769
- if (response.statusCode === 200) return;
769
+ if (response.statusCode === 200)
770
+ return response.body.data;
770
771
  throw new ShopwareError("Failed to create documents", response);
771
772
  }
772
- /** Order Management **/
773
+ /** Order State Management **/
773
774
  /**
774
775
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
775
776
  */
@@ -826,6 +827,25 @@ let OrderClient$1 = class OrderClient extends Client {
826
827
  return response.body.data;
827
828
  throw new ShopwareError("Failed to transition delivery state", response);
828
829
  }
830
+ /** Order Tags Management **/
831
+ /**
832
+ * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
833
+ */
834
+ async addTag(orderId, tagId) {
835
+ const response = await this.post(`/order/${orderId}/tags`, {
836
+ body: new JsonPayload({ id: tagId })
837
+ });
838
+ if (response.statusCode === 204) return;
839
+ throw new ShopwareError("Failed to add tag to order", response);
840
+ }
841
+ /**
842
+ * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
843
+ */
844
+ async removeTag(orderId, tagId) {
845
+ const response = await this.delete(`/order/${orderId}/tags/${tagId}`);
846
+ if (response.statusCode === 204) return;
847
+ throw new ShopwareError("Failed to remove tag from order", response);
848
+ }
829
849
  /** Rest Endpoints **/
830
850
  orders = createRestEndpoint(this, "order", "order");
831
851
  addresses = createRestEndpoint(this, "order-address", "order address");
package/dist/index.d.cts CHANGED
@@ -121,7 +121,7 @@ import { MediaThumbnail as MediaThumbnail$2 } from '#types/api/store/media/Media
121
121
  import { ShopwareDocumentBaseConfig as ShopwareDocumentBaseConfig$2 } from '#types/api/store/document/ShopwareDocumentBaseConfig';
122
122
  import { ShopwareDocumentType as ShopwareDocumentType$2 } from '#types/api/store/document/ShopwareDocumentType';
123
123
  import { ShopwareDocument as ShopwareDocument$2 } from '#types/api/store/document/ShopwareDocument';
124
- import { DownloadMergedRequest, DownloadMergedResponse, DocumentListCreateRequest, StateTransitionRequest, StateTransitionResponse } from '#types/clients/admin/OrderClient';
124
+ import { DownloadMergedRequest, DownloadMergedResponse, DocumentListCreateRequest, DocumentListCreateResponse, StateTransitionRequest, StateTransitionResponse } from '#types/clients/admin/OrderClient';
125
125
  import { Order as Order$2 } from '#types/api/admin/order/Order';
126
126
  import { OrderAddress as OrderAddress$2 } from '#types/api/admin/order/OrderAddress';
127
127
  import { OrderCustomer as OrderCustomer$2 } from '#types/api/admin/order/OrderCustomer';
@@ -3097,6 +3097,8 @@ type ShopwareDocument = ShopwareDocument$2 & {
3097
3097
  referencedDocument?: ShopwareDocument;
3098
3098
  dependantDocuments?: Array<ShopwareDocument>;
3099
3099
  documentMediaFile?: Media;
3100
+ documentA11yMediaFile?: Media;
3101
+ order?: Order;
3100
3102
  };
3101
3103
 
3102
3104
  interface ShopwareDocumentBaseConfigSalesChannel {
@@ -3719,6 +3721,7 @@ type Order = Order$1 & {
3719
3721
  tags?: Array<Tag>;
3720
3722
  createdBy?: User;
3721
3723
  updatedBy?: User;
3724
+ internalComment?: string;
3722
3725
  };
3723
3726
 
3724
3727
  type OrderTransaction = OrderTransaction$1 & {
@@ -3780,8 +3783,8 @@ declare class OrderClient$1 extends Client {
3780
3783
  * @param request
3781
3784
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
3782
3785
  */
3783
- createDocuments(documentTypeName: string, request: DocumentListCreateRequest): Promise<void>;
3784
- /** Order Management **/
3786
+ createDocuments(documentTypeName: string, request: DocumentListCreateRequest): Promise<DocumentListCreateResponse>;
3787
+ /** Order State Management **/
3785
3788
  /**
3786
3789
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
3787
3790
  */
@@ -3807,6 +3810,15 @@ declare class OrderClient$1 extends Client {
3807
3810
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
3808
3811
  */
3809
3812
  transitionDeliveryState(deliveryId: string, transition: string, request: StateTransitionRequest): Promise<StateMachineTransition>;
3813
+ /** Order Tags Management **/
3814
+ /**
3815
+ * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
3816
+ */
3817
+ addTag(orderId: string, tagId: string): Promise<void>;
3818
+ /**
3819
+ * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
3820
+ */
3821
+ removeTag(orderId: string, tagId: string): Promise<void>;
3810
3822
  /** Rest Endpoints **/
3811
3823
  orders: {
3812
3824
  getList: (query?: Criteria) => Promise<{
package/dist/index.d.mts CHANGED
@@ -121,7 +121,7 @@ import { MediaThumbnail as MediaThumbnail$2 } from '#types/api/store/media/Media
121
121
  import { ShopwareDocumentBaseConfig as ShopwareDocumentBaseConfig$2 } from '#types/api/store/document/ShopwareDocumentBaseConfig';
122
122
  import { ShopwareDocumentType as ShopwareDocumentType$2 } from '#types/api/store/document/ShopwareDocumentType';
123
123
  import { ShopwareDocument as ShopwareDocument$2 } from '#types/api/store/document/ShopwareDocument';
124
- import { DownloadMergedRequest, DownloadMergedResponse, DocumentListCreateRequest, StateTransitionRequest, StateTransitionResponse } from '#types/clients/admin/OrderClient';
124
+ import { DownloadMergedRequest, DownloadMergedResponse, DocumentListCreateRequest, DocumentListCreateResponse, StateTransitionRequest, StateTransitionResponse } from '#types/clients/admin/OrderClient';
125
125
  import { Order as Order$2 } from '#types/api/admin/order/Order';
126
126
  import { OrderAddress as OrderAddress$2 } from '#types/api/admin/order/OrderAddress';
127
127
  import { OrderCustomer as OrderCustomer$2 } from '#types/api/admin/order/OrderCustomer';
@@ -3097,6 +3097,8 @@ type ShopwareDocument = ShopwareDocument$2 & {
3097
3097
  referencedDocument?: ShopwareDocument;
3098
3098
  dependantDocuments?: Array<ShopwareDocument>;
3099
3099
  documentMediaFile?: Media;
3100
+ documentA11yMediaFile?: Media;
3101
+ order?: Order;
3100
3102
  };
3101
3103
 
3102
3104
  interface ShopwareDocumentBaseConfigSalesChannel {
@@ -3719,6 +3721,7 @@ type Order = Order$1 & {
3719
3721
  tags?: Array<Tag>;
3720
3722
  createdBy?: User;
3721
3723
  updatedBy?: User;
3724
+ internalComment?: string;
3722
3725
  };
3723
3726
 
3724
3727
  type OrderTransaction = OrderTransaction$1 & {
@@ -3780,8 +3783,8 @@ declare class OrderClient$1 extends Client {
3780
3783
  * @param request
3781
3784
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
3782
3785
  */
3783
- createDocuments(documentTypeName: string, request: DocumentListCreateRequest): Promise<void>;
3784
- /** Order Management **/
3786
+ createDocuments(documentTypeName: string, request: DocumentListCreateRequest): Promise<DocumentListCreateResponse>;
3787
+ /** Order State Management **/
3785
3788
  /**
3786
3789
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
3787
3790
  */
@@ -3807,6 +3810,15 @@ declare class OrderClient$1 extends Client {
3807
3810
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
3808
3811
  */
3809
3812
  transitionDeliveryState(deliveryId: string, transition: string, request: StateTransitionRequest): Promise<StateMachineTransition>;
3813
+ /** Order Tags Management **/
3814
+ /**
3815
+ * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
3816
+ */
3817
+ addTag(orderId: string, tagId: string): Promise<void>;
3818
+ /**
3819
+ * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
3820
+ */
3821
+ removeTag(orderId: string, tagId: string): Promise<void>;
3810
3822
  /** Rest Endpoints **/
3811
3823
  orders: {
3812
3824
  getList: (query?: Criteria) => Promise<{
package/dist/index.d.ts CHANGED
@@ -121,7 +121,7 @@ import { MediaThumbnail as MediaThumbnail$2 } from '#types/api/store/media/Media
121
121
  import { ShopwareDocumentBaseConfig as ShopwareDocumentBaseConfig$2 } from '#types/api/store/document/ShopwareDocumentBaseConfig';
122
122
  import { ShopwareDocumentType as ShopwareDocumentType$2 } from '#types/api/store/document/ShopwareDocumentType';
123
123
  import { ShopwareDocument as ShopwareDocument$2 } from '#types/api/store/document/ShopwareDocument';
124
- import { DownloadMergedRequest, DownloadMergedResponse, DocumentListCreateRequest, StateTransitionRequest, StateTransitionResponse } from '#types/clients/admin/OrderClient';
124
+ import { DownloadMergedRequest, DownloadMergedResponse, DocumentListCreateRequest, DocumentListCreateResponse, StateTransitionRequest, StateTransitionResponse } from '#types/clients/admin/OrderClient';
125
125
  import { Order as Order$2 } from '#types/api/admin/order/Order';
126
126
  import { OrderAddress as OrderAddress$2 } from '#types/api/admin/order/OrderAddress';
127
127
  import { OrderCustomer as OrderCustomer$2 } from '#types/api/admin/order/OrderCustomer';
@@ -3097,6 +3097,8 @@ type ShopwareDocument = ShopwareDocument$2 & {
3097
3097
  referencedDocument?: ShopwareDocument;
3098
3098
  dependantDocuments?: Array<ShopwareDocument>;
3099
3099
  documentMediaFile?: Media;
3100
+ documentA11yMediaFile?: Media;
3101
+ order?: Order;
3100
3102
  };
3101
3103
 
3102
3104
  interface ShopwareDocumentBaseConfigSalesChannel {
@@ -3719,6 +3721,7 @@ type Order = Order$1 & {
3719
3721
  tags?: Array<Tag>;
3720
3722
  createdBy?: User;
3721
3723
  updatedBy?: User;
3724
+ internalComment?: string;
3722
3725
  };
3723
3726
 
3724
3727
  type OrderTransaction = OrderTransaction$1 & {
@@ -3780,8 +3783,8 @@ declare class OrderClient$1 extends Client {
3780
3783
  * @param request
3781
3784
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
3782
3785
  */
3783
- createDocuments(documentTypeName: string, request: DocumentListCreateRequest): Promise<void>;
3784
- /** Order Management **/
3786
+ createDocuments(documentTypeName: string, request: DocumentListCreateRequest): Promise<DocumentListCreateResponse>;
3787
+ /** Order State Management **/
3785
3788
  /**
3786
3789
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
3787
3790
  */
@@ -3807,6 +3810,15 @@ declare class OrderClient$1 extends Client {
3807
3810
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
3808
3811
  */
3809
3812
  transitionDeliveryState(deliveryId: string, transition: string, request: StateTransitionRequest): Promise<StateMachineTransition>;
3813
+ /** Order Tags Management **/
3814
+ /**
3815
+ * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
3816
+ */
3817
+ addTag(orderId: string, tagId: string): Promise<void>;
3818
+ /**
3819
+ * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
3820
+ */
3821
+ removeTag(orderId: string, tagId: string): Promise<void>;
3810
3822
  /** Rest Endpoints **/
3811
3823
  orders: {
3812
3824
  getList: (query?: Criteria) => Promise<{
package/dist/index.mjs CHANGED
@@ -511,7 +511,7 @@ let DocumentClient$1 = class DocumentClient extends Client {
511
511
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
512
512
  */
513
513
  async reserveNumber(salesChannelId, type, preview) {
514
- const response = await this.post(`/_action/number-range/reserve/${type}/${salesChannelId}`, {
514
+ const response = await this.get(`/_action/number-range/reserve/${type}/${salesChannelId}`, {
515
515
  query: { preview },
516
516
  headers: { Accept: "application/json" }
517
517
  });
@@ -764,10 +764,11 @@ let OrderClient$1 = class OrderClient extends Client {
764
764
  const response = await this.post(`/_action/order/document/${documentTypeName}/create`, {
765
765
  body: new JsonPayload(request)
766
766
  });
767
- if (response.statusCode === 200) return;
767
+ if (response.statusCode === 200)
768
+ return response.body.data;
768
769
  throw new ShopwareError("Failed to create documents", response);
769
770
  }
770
- /** Order Management **/
771
+ /** Order State Management **/
771
772
  /**
772
773
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
773
774
  */
@@ -824,6 +825,25 @@ let OrderClient$1 = class OrderClient extends Client {
824
825
  return response.body.data;
825
826
  throw new ShopwareError("Failed to transition delivery state", response);
826
827
  }
828
+ /** Order Tags Management **/
829
+ /**
830
+ * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
831
+ */
832
+ async addTag(orderId, tagId) {
833
+ const response = await this.post(`/order/${orderId}/tags`, {
834
+ body: new JsonPayload({ id: tagId })
835
+ });
836
+ if (response.statusCode === 204) return;
837
+ throw new ShopwareError("Failed to add tag to order", response);
838
+ }
839
+ /**
840
+ * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
841
+ */
842
+ async removeTag(orderId, tagId) {
843
+ const response = await this.delete(`/order/${orderId}/tags/${tagId}`);
844
+ if (response.statusCode === 204) return;
845
+ throw new ShopwareError("Failed to remove tag from order", response);
846
+ }
827
847
  /** Rest Endpoints **/
828
848
  orders = createRestEndpoint(this, "order", "order");
829
849
  addresses = createRestEndpoint(this, "order-address", "order address");
@@ -1,9 +1,12 @@
1
1
  import { ShopwareDocument as StoreApiShopwareDocument } from "#types/api/store/document/ShopwareDocument";
2
2
  import { ShopwareDocumentType } from "./ShopwareDocumentType";
3
3
  import { Media } from "../media/Media";
4
+ import { Order } from "../order/Order";
4
5
  export type ShopwareDocument = StoreApiShopwareDocument & {
5
6
  documentType?: ShopwareDocumentType;
6
7
  referencedDocument?: ShopwareDocument;
7
8
  dependantDocuments?: Array<ShopwareDocument>;
8
9
  documentMediaFile?: Media;
10
+ documentA11yMediaFile?: Media;
11
+ order?: Order;
9
12
  };
@@ -30,4 +30,5 @@ export type Order = StoreApiOrder & {
30
30
  tags?: Array<Tag>;
31
31
  createdBy?: User;
32
32
  updatedBy?: User;
33
+ internalComment?: string;
33
34
  };
@@ -17,6 +17,8 @@ export interface MailSendRequest {
17
17
  recipientsCc?: Record<string, string>;
18
18
  replyTo?: Record<string, string>;
19
19
  returnPath?: Record<string, string>;
20
+ documentIds?: Array<string>;
21
+ mailTemplateData?: Record<string, any>;
20
22
  }
21
23
  export interface MailSendResponse {
22
24
  size?: number;
@@ -7,12 +7,23 @@ export interface DownloadMergedRequest {
7
7
  export type DownloadMergedResponse = Blob;
8
8
  export type DocumentListCreateRequest = Array<{
9
9
  orderId: string;
10
- type: string;
11
10
  fileType?: string;
12
- static: boolean;
11
+ documentNumber?: string;
12
+ documentDate?: string;
13
13
  referencedDocumentId?: string;
14
14
  config?: ShopwareDocumentBaseConfig;
15
+ custom?: Record<string, any>;
15
16
  }>;
17
+ export type DocumentListCreateResponse = {
18
+ data: Array<{
19
+ documentId: string;
20
+ a11yDocumentId?: string;
21
+ }>;
22
+ errors: Array<{
23
+ code?: string;
24
+ detail?: string;
25
+ }>;
26
+ };
16
27
  /** Order Management **/
17
28
  export interface StateTransitionRequest {
18
29
  sendMail?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devite/shopware-client",
3
- "version": "1.7.8",
3
+ "version": "1.8.0",
4
4
  "description": "Third party API client for Shopware 6.",
5
5
  "repository": "devite-io/shopware-client",
6
6
  "license": "MIT",
@@ -41,20 +41,19 @@
41
41
  "dist"
42
42
  ],
43
43
  "devDependencies": {
44
- "@types/node": "^22.16.5",
44
+ "@types/node": "^22.19.3",
45
45
  "@types/qs": "^6.14.0",
46
- "changelogen": "^0.5.7",
47
- "eslint": "^9.32.0",
48
- "prettier": "^3.6.2",
49
- "typescript": "^5.8.3",
50
- "typescript-eslint": "^8.38.0",
51
- "unbuild": "^3.6.0",
52
- "vitest": "^2.1.9"
46
+ "changelogen": "^0.6.2",
47
+ "eslint": "^9.39.2",
48
+ "prettier": "^3.7.4",
49
+ "typescript": "^5.9.3",
50
+ "typescript-eslint": "^8.51.0",
51
+ "unbuild": "^3.6.1",
52
+ "vitest": "^3.2.4"
53
53
  },
54
54
  "dependencies": {
55
- "ofetch": "^1.4.1",
56
- "ohash": "^1.1.6",
57
- "qs": "^6.14.0"
55
+ "ofetch": "^1.5.1",
56
+ "qs": "^6.14.1"
58
57
  },
59
58
  "imports": {
60
59
  "#types/*": "./dist/types/*.d.ts"