@viu/emporix-sdk 2.22.0 → 2.23.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.
Files changed (105) hide show
  1. package/CHANGELOG.md +122 -0
  2. package/dist/availability.cjs +118 -0
  3. package/dist/availability.cjs.map +1 -1
  4. package/dist/availability.d.cts +178 -2
  5. package/dist/availability.d.ts +178 -2
  6. package/dist/availability.js +1 -1
  7. package/dist/cart.cjs +156 -11
  8. package/dist/cart.cjs.map +1 -1
  9. package/dist/cart.d.cts +176 -3
  10. package/dist/cart.d.ts +176 -3
  11. package/dist/cart.js +1 -1
  12. package/dist/category.cjs +192 -2
  13. package/dist/category.cjs.map +1 -1
  14. package/dist/category.d.cts +398 -1
  15. package/dist/category.d.ts +398 -1
  16. package/dist/category.js +1 -1
  17. package/dist/{chunk-HD5RBCM6.js → chunk-27NLS646.js} +10 -2
  18. package/dist/chunk-27NLS646.js.map +1 -0
  19. package/dist/{chunk-MMX5FGMI.js → chunk-6PJFOX3A.js} +109 -2
  20. package/dist/chunk-6PJFOX3A.js.map +1 -0
  21. package/dist/chunk-HWVFF6B2.js +378 -0
  22. package/dist/chunk-HWVFF6B2.js.map +1 -0
  23. package/dist/chunk-LQFRJSVT.js +224 -0
  24. package/dist/chunk-LQFRJSVT.js.map +1 -0
  25. package/dist/chunk-P7G4LOOV.js +264 -0
  26. package/dist/chunk-P7G4LOOV.js.map +1 -0
  27. package/dist/{chunk-44F52KRE.js → chunk-QQMLN76U.js} +27 -2
  28. package/dist/chunk-QQMLN76U.js.map +1 -0
  29. package/dist/chunk-UNW6SFSB.js +363 -0
  30. package/dist/chunk-UNW6SFSB.js.map +1 -0
  31. package/dist/chunk-V3275BA7.js +181 -0
  32. package/dist/chunk-V3275BA7.js.map +1 -0
  33. package/dist/chunk-W2KBVWJ2.js +323 -0
  34. package/dist/chunk-W2KBVWJ2.js.map +1 -0
  35. package/dist/{chunk-5DWCYDQD.js → chunk-YVZ6GOLE.js} +158 -13
  36. package/dist/chunk-YVZ6GOLE.js.map +1 -0
  37. package/dist/chunk-ZOFGDNSX.js +305 -0
  38. package/dist/chunk-ZOFGDNSX.js.map +1 -0
  39. package/dist/companies.cjs +25 -0
  40. package/dist/companies.cjs.map +1 -1
  41. package/dist/companies.d.cts +14 -0
  42. package/dist/companies.d.ts +14 -0
  43. package/dist/companies.js +1 -1
  44. package/dist/contacts.cjs +8 -0
  45. package/dist/contacts.cjs.map +1 -1
  46. package/dist/contacts.d.cts +2 -0
  47. package/dist/contacts.d.ts +2 -0
  48. package/dist/contacts.js +1 -1
  49. package/dist/customer-groups-BxSNFHq1.d.cts +706 -0
  50. package/dist/customer-groups-GlzWhDsi.d.ts +706 -0
  51. package/dist/customer-groups.cjs +200 -17
  52. package/dist/customer-groups.cjs.map +1 -1
  53. package/dist/customer-groups.d.cts +2 -110
  54. package/dist/customer-groups.d.ts +2 -110
  55. package/dist/customer-groups.js +1 -1
  56. package/dist/index.cjs +2220 -391
  57. package/dist/index.cjs.map +1 -1
  58. package/dist/index.d.cts +433 -11
  59. package/dist/index.d.ts +433 -11
  60. package/dist/index.js +668 -340
  61. package/dist/index.js.map +1 -1
  62. package/dist/orders.cjs +160 -2
  63. package/dist/orders.cjs.map +1 -1
  64. package/dist/orders.d.cts +221 -1
  65. package/dist/orders.d.ts +221 -1
  66. package/dist/orders.js +1 -1
  67. package/dist/payment.cjs +107 -0
  68. package/dist/payment.cjs.map +1 -1
  69. package/dist/payment.d.cts +299 -1
  70. package/dist/payment.d.ts +299 -1
  71. package/dist/payment.js +1 -1
  72. package/dist/price.cjs +197 -0
  73. package/dist/price.cjs.map +1 -1
  74. package/dist/price.d.cts +577 -1
  75. package/dist/price.d.ts +577 -1
  76. package/dist/price.js +1 -1
  77. package/dist/product.cjs +190 -0
  78. package/dist/product.cjs.map +1 -1
  79. package/dist/product.d.cts +503 -1
  80. package/dist/product.d.ts +503 -1
  81. package/dist/product.js +1 -1
  82. package/dist/segment.cjs +179 -0
  83. package/dist/segment.cjs.map +1 -1
  84. package/dist/segment.d.cts +181 -1
  85. package/dist/segment.d.ts +181 -1
  86. package/dist/segment.js +1 -1
  87. package/package.json +1 -1
  88. package/dist/chunk-36T4YPQJ.js +0 -106
  89. package/dist/chunk-36T4YPQJ.js.map +0 -1
  90. package/dist/chunk-3BTPX7IJ.js +0 -41
  91. package/dist/chunk-3BTPX7IJ.js.map +0 -1
  92. package/dist/chunk-44F52KRE.js.map +0 -1
  93. package/dist/chunk-5DWCYDQD.js.map +0 -1
  94. package/dist/chunk-A3LYJUD4.js +0 -108
  95. package/dist/chunk-A3LYJUD4.js.map +0 -1
  96. package/dist/chunk-DXOLWAOY.js +0 -188
  97. package/dist/chunk-DXOLWAOY.js.map +0 -1
  98. package/dist/chunk-FZMP5NQZ.js +0 -173
  99. package/dist/chunk-FZMP5NQZ.js.map +0 -1
  100. package/dist/chunk-HD5RBCM6.js.map +0 -1
  101. package/dist/chunk-IVCCGJN5.js +0 -63
  102. package/dist/chunk-IVCCGJN5.js.map +0 -1
  103. package/dist/chunk-MMX5FGMI.js.map +0 -1
  104. package/dist/chunk-NE7MIZPR.js +0 -144
  105. package/dist/chunk-NE7MIZPR.js.map +0 -1
package/dist/cart.d.cts CHANGED
@@ -17,6 +17,15 @@ import { C as ClientContext, b as AuthContext } from './context-CfXJcYKP.cjs';
17
17
  *
18
18
  */
19
19
  type Restriction = string | null;
20
+ type Search = {
21
+ /**
22
+ * A standard query parameter is used to search for specific values.
23
+ *
24
+ * See: [Standard practises - Query parameter](https://developer.emporix.io/api-references/standard-practices/q-param/)
25
+ *
26
+ */
27
+ q?: string;
28
+ };
20
29
  type BaseCart = {
21
30
  /**
22
31
  * Cart unique identifier generated when a cart is created.
@@ -106,6 +115,16 @@ type BaseCart = {
106
115
  */
107
116
  nonDelivery?: Array<string>;
108
117
  };
118
+ type CartGetAll = BaseCart & {
119
+ /**
120
+ * Items added to the cart.
121
+ */
122
+ items?: Array<BaseCartItemResponse>;
123
+ /**
124
+ * Informs whether cart is still open or it is already closed.
125
+ */
126
+ status?: 'OPEN' | 'CLOSED';
127
+ };
109
128
  type Cart$1 = BaseCart & {
110
129
  /**
111
130
  * Items added to the cart.
@@ -180,6 +199,19 @@ type Cart$1 = BaseCart & {
180
199
  [key: string]: unknown;
181
200
  };
182
201
  };
202
+ /**
203
+ * Cart delivery time restrictions.
204
+ */
205
+ type CartDtRestrictions = {
206
+ /**
207
+ * Time needed to prepare the products for the delivery, expressed in hours. Time is calculated based on the products added to the cart. It is equal to the maximum lead time of all the products - `mixins.productCustomAttributes.leadTime`.
208
+ */
209
+ leadTime?: number;
210
+ /**
211
+ * List of days on which the products cannot be delivered. Days are presented by numbers where Monday is `0`, Tuesday is `1` etc. `nonDelivery` list is the union of all `mixins.productCustomAttributes.nonDelivery` products values.
212
+ */
213
+ nonDelivery?: Array<string>;
214
+ };
183
215
  type CartItemRequest = {
184
216
  /**
185
217
  * Cart item's unique identifier.
@@ -1111,6 +1143,63 @@ type Total = {
1111
1143
  */
1112
1144
  discount?: number;
1113
1145
  };
1146
+ type UpdateCart = {
1147
+ /**
1148
+ * Customer unique identifier generated when a customer account is created through the Customer Service.
1149
+ */
1150
+ customerId?: string;
1151
+ restriction?: Restriction;
1152
+ /**
1153
+ * Three-letter currency code, compliant with the ISO 4217 standard.
1154
+ */
1155
+ currency?: string;
1156
+ /**
1157
+ * ID of the legal entity to which customer is assigned.
1158
+ */
1159
+ legalEntityId?: string;
1160
+ /**
1161
+ * Delivery window unique identifier, as defined in the Shipping Service.
1162
+ */
1163
+ deliveryWindowId?: string;
1164
+ deliveryWindow?: DeliveryWindow;
1165
+ /**
1166
+ * Cart type. You can use this field if your store offers different types of carts, such as shopping carts and wishlists.
1167
+ */
1168
+ type?: string;
1169
+ /**
1170
+ * Customer address - zip code.
1171
+ */
1172
+ zipCode?: string;
1173
+ /**
1174
+ * Two-letter country code, compliant with the ISO 3166 standard.
1175
+ */
1176
+ countryCode?: string;
1177
+ /**
1178
+ * Order unique identifier generated when a checkout is triggered through the Checkout Service.
1179
+ */
1180
+ orderId?: string;
1181
+ /**
1182
+ * Quote unique identifier generated when a quote is created through the Quote Service out of a cart.
1183
+ */
1184
+ quoteId?: string;
1185
+ /**
1186
+ * Cart status.
1187
+ */
1188
+ status?: 'OPEN' | 'CLOSED';
1189
+ channel?: Channel;
1190
+ /**
1191
+ * External discounts that should be applied to this cart. Requires `cart.cart_manage_external_prices` scope
1192
+ */
1193
+ externalDiscounts?: Array<ExternalCartDiscount>;
1194
+ /**
1195
+ * List of addresses that should be associated with the cart and used for tax determination and shipping cost. There can be one address of type `BILLING` and one of type `SHIPPING` - others are ignored. These addresses are returned with the origin `REQUEST` in the cart response.
1196
+ */
1197
+ addresses?: Array<AddressRequest>;
1198
+ metadata?: MetadataRequest;
1199
+ mixins?: {
1200
+ [key: string]: unknown;
1201
+ };
1202
+ };
1114
1203
  type UpdateCartItem = {
1115
1204
  externalFees?: Array<ExternalFee>;
1116
1205
  /**
@@ -1832,6 +1921,16 @@ type CartItem = CartItemResponse;
1832
1921
  type CartItemsBatchUpdateInput = CartItemsBatchUpdateRequest;
1833
1922
  /** Per-entry response for a multi-item update (generated). */
1834
1923
  type CartItemsBatchUpdateResult = CartItemsBatchUpdateResponse;
1924
+ /** Body for searching carts (`POST /carts/search`) — a `q` filter. */
1925
+ type CartSearchInput = Search;
1926
+ /** A cart summary as returned by `POST /carts/search`. */
1927
+ type CartSummary = CartGetAll;
1928
+ /** Body for a full cart update (`PUT /carts/{id}`). */
1929
+ type CartUpdateInput = UpdateCart;
1930
+ /** A discount entry as returned by `GET /carts/{id}/discounts`. */
1931
+ type CartDiscount = DiscountResponse;
1932
+ /** Lead-time and non-delivery-time restrictions for a cart (`GET …/dtRestrictions`). */
1933
+ type CartDeliveryRestrictions = CartDtRestrictions;
1835
1934
  /** Cart operations. Every method requires an explicit customer/anonymous context. */
1836
1935
  declare class CartService {
1837
1936
  private readonly ctx;
@@ -1912,10 +2011,40 @@ declare class CartService {
1912
2011
  * do not throw — inspect each entry.
1913
2012
  */
1914
2013
  updateItemsBatch(cartId: string, items: CartItemsBatchUpdateInput, auth: AuthContext): Promise<CartItemsBatchUpdateResult>;
1915
- /** Sets the shipping address. */
2014
+ /**
2015
+ * Sets the cart's shipping address, preserving the billing address.
2016
+ *
2017
+ * The API has no per-type address endpoint: addresses live in the cart's
2018
+ * `addresses` array, written via `PUT /carts/{cartId}`. That array is a **full
2019
+ * replace** — sending only one type leaves the other as an empty stub — so
2020
+ * this method reads the cart, merges, writes, and re-fetches. Use
2021
+ * {@link setAddresses} to set both in a single request.
2022
+ */
1916
2023
  setShippingAddress(cartId: string, address: CartAddress, auth: AuthContext): Promise<Cart>;
1917
- /** Sets the billing address. */
2024
+ /**
2025
+ * Sets the cart's billing address, preserving the shipping address. See
2026
+ * {@link setShippingAddress} for why this reads before writing.
2027
+ */
1918
2028
  setBillingAddress(cartId: string, address: CartAddress, auth: AuthContext): Promise<Cart>;
2029
+ /**
2030
+ * Sets both cart addresses in one request (`PUT /carts/{cartId}`), skipping
2031
+ * the read that {@link setShippingAddress} needs.
2032
+ *
2033
+ * **This replaces the cart's address set**: a type you omit is cleared, and
2034
+ * `{}` clears both. Use it when you already hold both addresses (a checkout
2035
+ * form submitting them together); use the per-type setters to change one and
2036
+ * keep the other.
2037
+ */
2038
+ setAddresses(cartId: string, addresses: {
2039
+ shipping?: CartAddress;
2040
+ billing?: CartAddress;
2041
+ }, auth: AuthContext): Promise<Cart>;
2042
+ /**
2043
+ * Reads the cart, replaces the entry of `type` with `address` (keeping every
2044
+ * other type verbatim — resending it unchanged is what stops the server from
2045
+ * wiping it), writes, and returns the re-fetched cart.
2046
+ */
2047
+ private mergeAddress;
1919
2048
  /**
1920
2049
  * Merges one or more anonymous carts into the specified customer cart.
1921
2050
  * Per Emporix: the target cart in the path **must belong to the logged-in
@@ -1925,6 +2054,50 @@ declare class CartService {
1925
2054
  * Requires a customer `AuthContext`.
1926
2055
  */
1927
2056
  merge(customerCartId: string, anonymousCartIds: string[], auth: AuthContext): Promise<Cart>;
2057
+ /**
2058
+ * Searches carts tenant-wide (`POST /carts/search`, body `{ q }`). This is a
2059
+ * backend/admin operation — a customer token cannot scan other customers'
2060
+ * carts, so `auth` is forwarded unguarded (pass a service token for admin
2061
+ * use). The server enforces scope (403 on insufficient).
2062
+ */
2063
+ search(query: CartSearchInput, auth: AuthContext, params?: {
2064
+ pageNumber?: number;
2065
+ pageSize?: number;
2066
+ sort?: string;
2067
+ fields?: string;
2068
+ }): Promise<CartSummary[]>;
2069
+ /**
2070
+ * Deletes a cart (`DELETE /carts/{cartId}`). Backend/admin or owner
2071
+ * operation — `auth` is forwarded unguarded (service or customer). Returns
2072
+ * nothing; the cart no longer exists.
2073
+ */
2074
+ delete(cartId: string, auth: AuthContext): Promise<void>;
2075
+ /**
2076
+ * Full-updates a cart (`PUT /carts/{cartId}`, body `UpdateCart`). Backend or
2077
+ * owner operation — `auth` is forwarded unguarded. The endpoint returns 204,
2078
+ * so the cart is re-fetched with the same `auth` (via a direct GET, not
2079
+ * `get()`, so a service token is not rejected by the cart-auth guard) and
2080
+ * returned.
2081
+ */
2082
+ update(cartId: string, input: CartUpdateInput, auth: AuthContext): Promise<Cart>;
2083
+ /** Fetches a single cart item's details (`GET /carts/{cartId}/items/{itemId}`). */
2084
+ getItem(cartId: string, itemId: string, auth: AuthContext): Promise<CartItem>;
2085
+ /** Lists the discounts applied to a cart (`GET /carts/{cartId}/discounts`). */
2086
+ listDiscounts(cartId: string, auth: AuthContext): Promise<CartDiscount[]>;
2087
+ /**
2088
+ * Removes all discounts from a cart (`DELETE /carts/{cartId}/discounts` with
2089
+ * no `codes` filter), then re-fetches and returns the updated cart. Use
2090
+ * `removeCoupon(code)` to remove a specific coupon by code.
2091
+ */
2092
+ removeAllDiscounts(cartId: string, auth: AuthContext): Promise<Cart>;
2093
+ /**
2094
+ * Removes a single discount by its index (`DELETE
2095
+ * /carts/{cartId}/discounts/{discountIndex}`), then re-fetches and returns
2096
+ * the updated cart.
2097
+ */
2098
+ removeDiscountByIndex(cartId: string, discountIndex: string, auth: AuthContext): Promise<Cart>;
2099
+ /** Retrieves the cart's lead-time and non-delivery-time restrictions (`GET /carts/{cartId}/dtRestrictions`). */
2100
+ getDeliveryRestrictions(cartId: string, auth: AuthContext): Promise<CartDeliveryRestrictions>;
1928
2101
  }
1929
2102
 
1930
- export { type Cart, type CartAddress, type CartCreated, type CartItem, type CartItemBatchEntry, type CartItemInput, type CartItemUpdate, type CartItemsBatchResponse, type CartItemsBatchUpdateInput, type CartItemsBatchUpdateResult, CartService, type CartValidationResult, type CreateCartInput };
2103
+ export { type Cart, type CartAddress, type CartCreated, type CartDeliveryRestrictions, type CartDiscount, type CartItem, type CartItemBatchEntry, type CartItemInput, type CartItemUpdate, type CartItemsBatchResponse, type CartItemsBatchUpdateInput, type CartItemsBatchUpdateResult, type CartSearchInput, CartService, type CartSummary, type CartUpdateInput, type CartValidationResult, type CreateCartInput };
package/dist/cart.d.ts CHANGED
@@ -17,6 +17,15 @@ import { C as ClientContext, b as AuthContext } from './context-CfXJcYKP.js';
17
17
  *
18
18
  */
19
19
  type Restriction = string | null;
20
+ type Search = {
21
+ /**
22
+ * A standard query parameter is used to search for specific values.
23
+ *
24
+ * See: [Standard practises - Query parameter](https://developer.emporix.io/api-references/standard-practices/q-param/)
25
+ *
26
+ */
27
+ q?: string;
28
+ };
20
29
  type BaseCart = {
21
30
  /**
22
31
  * Cart unique identifier generated when a cart is created.
@@ -106,6 +115,16 @@ type BaseCart = {
106
115
  */
107
116
  nonDelivery?: Array<string>;
108
117
  };
118
+ type CartGetAll = BaseCart & {
119
+ /**
120
+ * Items added to the cart.
121
+ */
122
+ items?: Array<BaseCartItemResponse>;
123
+ /**
124
+ * Informs whether cart is still open or it is already closed.
125
+ */
126
+ status?: 'OPEN' | 'CLOSED';
127
+ };
109
128
  type Cart$1 = BaseCart & {
110
129
  /**
111
130
  * Items added to the cart.
@@ -180,6 +199,19 @@ type Cart$1 = BaseCart & {
180
199
  [key: string]: unknown;
181
200
  };
182
201
  };
202
+ /**
203
+ * Cart delivery time restrictions.
204
+ */
205
+ type CartDtRestrictions = {
206
+ /**
207
+ * Time needed to prepare the products for the delivery, expressed in hours. Time is calculated based on the products added to the cart. It is equal to the maximum lead time of all the products - `mixins.productCustomAttributes.leadTime`.
208
+ */
209
+ leadTime?: number;
210
+ /**
211
+ * List of days on which the products cannot be delivered. Days are presented by numbers where Monday is `0`, Tuesday is `1` etc. `nonDelivery` list is the union of all `mixins.productCustomAttributes.nonDelivery` products values.
212
+ */
213
+ nonDelivery?: Array<string>;
214
+ };
183
215
  type CartItemRequest = {
184
216
  /**
185
217
  * Cart item's unique identifier.
@@ -1111,6 +1143,63 @@ type Total = {
1111
1143
  */
1112
1144
  discount?: number;
1113
1145
  };
1146
+ type UpdateCart = {
1147
+ /**
1148
+ * Customer unique identifier generated when a customer account is created through the Customer Service.
1149
+ */
1150
+ customerId?: string;
1151
+ restriction?: Restriction;
1152
+ /**
1153
+ * Three-letter currency code, compliant with the ISO 4217 standard.
1154
+ */
1155
+ currency?: string;
1156
+ /**
1157
+ * ID of the legal entity to which customer is assigned.
1158
+ */
1159
+ legalEntityId?: string;
1160
+ /**
1161
+ * Delivery window unique identifier, as defined in the Shipping Service.
1162
+ */
1163
+ deliveryWindowId?: string;
1164
+ deliveryWindow?: DeliveryWindow;
1165
+ /**
1166
+ * Cart type. You can use this field if your store offers different types of carts, such as shopping carts and wishlists.
1167
+ */
1168
+ type?: string;
1169
+ /**
1170
+ * Customer address - zip code.
1171
+ */
1172
+ zipCode?: string;
1173
+ /**
1174
+ * Two-letter country code, compliant with the ISO 3166 standard.
1175
+ */
1176
+ countryCode?: string;
1177
+ /**
1178
+ * Order unique identifier generated when a checkout is triggered through the Checkout Service.
1179
+ */
1180
+ orderId?: string;
1181
+ /**
1182
+ * Quote unique identifier generated when a quote is created through the Quote Service out of a cart.
1183
+ */
1184
+ quoteId?: string;
1185
+ /**
1186
+ * Cart status.
1187
+ */
1188
+ status?: 'OPEN' | 'CLOSED';
1189
+ channel?: Channel;
1190
+ /**
1191
+ * External discounts that should be applied to this cart. Requires `cart.cart_manage_external_prices` scope
1192
+ */
1193
+ externalDiscounts?: Array<ExternalCartDiscount>;
1194
+ /**
1195
+ * List of addresses that should be associated with the cart and used for tax determination and shipping cost. There can be one address of type `BILLING` and one of type `SHIPPING` - others are ignored. These addresses are returned with the origin `REQUEST` in the cart response.
1196
+ */
1197
+ addresses?: Array<AddressRequest>;
1198
+ metadata?: MetadataRequest;
1199
+ mixins?: {
1200
+ [key: string]: unknown;
1201
+ };
1202
+ };
1114
1203
  type UpdateCartItem = {
1115
1204
  externalFees?: Array<ExternalFee>;
1116
1205
  /**
@@ -1832,6 +1921,16 @@ type CartItem = CartItemResponse;
1832
1921
  type CartItemsBatchUpdateInput = CartItemsBatchUpdateRequest;
1833
1922
  /** Per-entry response for a multi-item update (generated). */
1834
1923
  type CartItemsBatchUpdateResult = CartItemsBatchUpdateResponse;
1924
+ /** Body for searching carts (`POST /carts/search`) — a `q` filter. */
1925
+ type CartSearchInput = Search;
1926
+ /** A cart summary as returned by `POST /carts/search`. */
1927
+ type CartSummary = CartGetAll;
1928
+ /** Body for a full cart update (`PUT /carts/{id}`). */
1929
+ type CartUpdateInput = UpdateCart;
1930
+ /** A discount entry as returned by `GET /carts/{id}/discounts`. */
1931
+ type CartDiscount = DiscountResponse;
1932
+ /** Lead-time and non-delivery-time restrictions for a cart (`GET …/dtRestrictions`). */
1933
+ type CartDeliveryRestrictions = CartDtRestrictions;
1835
1934
  /** Cart operations. Every method requires an explicit customer/anonymous context. */
1836
1935
  declare class CartService {
1837
1936
  private readonly ctx;
@@ -1912,10 +2011,40 @@ declare class CartService {
1912
2011
  * do not throw — inspect each entry.
1913
2012
  */
1914
2013
  updateItemsBatch(cartId: string, items: CartItemsBatchUpdateInput, auth: AuthContext): Promise<CartItemsBatchUpdateResult>;
1915
- /** Sets the shipping address. */
2014
+ /**
2015
+ * Sets the cart's shipping address, preserving the billing address.
2016
+ *
2017
+ * The API has no per-type address endpoint: addresses live in the cart's
2018
+ * `addresses` array, written via `PUT /carts/{cartId}`. That array is a **full
2019
+ * replace** — sending only one type leaves the other as an empty stub — so
2020
+ * this method reads the cart, merges, writes, and re-fetches. Use
2021
+ * {@link setAddresses} to set both in a single request.
2022
+ */
1916
2023
  setShippingAddress(cartId: string, address: CartAddress, auth: AuthContext): Promise<Cart>;
1917
- /** Sets the billing address. */
2024
+ /**
2025
+ * Sets the cart's billing address, preserving the shipping address. See
2026
+ * {@link setShippingAddress} for why this reads before writing.
2027
+ */
1918
2028
  setBillingAddress(cartId: string, address: CartAddress, auth: AuthContext): Promise<Cart>;
2029
+ /**
2030
+ * Sets both cart addresses in one request (`PUT /carts/{cartId}`), skipping
2031
+ * the read that {@link setShippingAddress} needs.
2032
+ *
2033
+ * **This replaces the cart's address set**: a type you omit is cleared, and
2034
+ * `{}` clears both. Use it when you already hold both addresses (a checkout
2035
+ * form submitting them together); use the per-type setters to change one and
2036
+ * keep the other.
2037
+ */
2038
+ setAddresses(cartId: string, addresses: {
2039
+ shipping?: CartAddress;
2040
+ billing?: CartAddress;
2041
+ }, auth: AuthContext): Promise<Cart>;
2042
+ /**
2043
+ * Reads the cart, replaces the entry of `type` with `address` (keeping every
2044
+ * other type verbatim — resending it unchanged is what stops the server from
2045
+ * wiping it), writes, and returns the re-fetched cart.
2046
+ */
2047
+ private mergeAddress;
1919
2048
  /**
1920
2049
  * Merges one or more anonymous carts into the specified customer cart.
1921
2050
  * Per Emporix: the target cart in the path **must belong to the logged-in
@@ -1925,6 +2054,50 @@ declare class CartService {
1925
2054
  * Requires a customer `AuthContext`.
1926
2055
  */
1927
2056
  merge(customerCartId: string, anonymousCartIds: string[], auth: AuthContext): Promise<Cart>;
2057
+ /**
2058
+ * Searches carts tenant-wide (`POST /carts/search`, body `{ q }`). This is a
2059
+ * backend/admin operation — a customer token cannot scan other customers'
2060
+ * carts, so `auth` is forwarded unguarded (pass a service token for admin
2061
+ * use). The server enforces scope (403 on insufficient).
2062
+ */
2063
+ search(query: CartSearchInput, auth: AuthContext, params?: {
2064
+ pageNumber?: number;
2065
+ pageSize?: number;
2066
+ sort?: string;
2067
+ fields?: string;
2068
+ }): Promise<CartSummary[]>;
2069
+ /**
2070
+ * Deletes a cart (`DELETE /carts/{cartId}`). Backend/admin or owner
2071
+ * operation — `auth` is forwarded unguarded (service or customer). Returns
2072
+ * nothing; the cart no longer exists.
2073
+ */
2074
+ delete(cartId: string, auth: AuthContext): Promise<void>;
2075
+ /**
2076
+ * Full-updates a cart (`PUT /carts/{cartId}`, body `UpdateCart`). Backend or
2077
+ * owner operation — `auth` is forwarded unguarded. The endpoint returns 204,
2078
+ * so the cart is re-fetched with the same `auth` (via a direct GET, not
2079
+ * `get()`, so a service token is not rejected by the cart-auth guard) and
2080
+ * returned.
2081
+ */
2082
+ update(cartId: string, input: CartUpdateInput, auth: AuthContext): Promise<Cart>;
2083
+ /** Fetches a single cart item's details (`GET /carts/{cartId}/items/{itemId}`). */
2084
+ getItem(cartId: string, itemId: string, auth: AuthContext): Promise<CartItem>;
2085
+ /** Lists the discounts applied to a cart (`GET /carts/{cartId}/discounts`). */
2086
+ listDiscounts(cartId: string, auth: AuthContext): Promise<CartDiscount[]>;
2087
+ /**
2088
+ * Removes all discounts from a cart (`DELETE /carts/{cartId}/discounts` with
2089
+ * no `codes` filter), then re-fetches and returns the updated cart. Use
2090
+ * `removeCoupon(code)` to remove a specific coupon by code.
2091
+ */
2092
+ removeAllDiscounts(cartId: string, auth: AuthContext): Promise<Cart>;
2093
+ /**
2094
+ * Removes a single discount by its index (`DELETE
2095
+ * /carts/{cartId}/discounts/{discountIndex}`), then re-fetches and returns
2096
+ * the updated cart.
2097
+ */
2098
+ removeDiscountByIndex(cartId: string, discountIndex: string, auth: AuthContext): Promise<Cart>;
2099
+ /** Retrieves the cart's lead-time and non-delivery-time restrictions (`GET /carts/{cartId}/dtRestrictions`). */
2100
+ getDeliveryRestrictions(cartId: string, auth: AuthContext): Promise<CartDeliveryRestrictions>;
1928
2101
  }
1929
2102
 
1930
- export { type Cart, type CartAddress, type CartCreated, type CartItem, type CartItemBatchEntry, type CartItemInput, type CartItemUpdate, type CartItemsBatchResponse, type CartItemsBatchUpdateInput, type CartItemsBatchUpdateResult, CartService, type CartValidationResult, type CreateCartInput };
2103
+ export { type Cart, type CartAddress, type CartCreated, type CartDeliveryRestrictions, type CartDiscount, type CartItem, type CartItemBatchEntry, type CartItemInput, type CartItemUpdate, type CartItemsBatchResponse, type CartItemsBatchUpdateInput, type CartItemsBatchUpdateResult, type CartSearchInput, CartService, type CartSummary, type CartUpdateInput, type CartValidationResult, type CreateCartInput };
package/dist/cart.js CHANGED
@@ -1,4 +1,4 @@
1
- export { CartService } from './chunk-5DWCYDQD.js';
1
+ export { CartService } from './chunk-YVZ6GOLE.js';
2
2
  import './chunk-UWGGF4MC.js';
3
3
  //# sourceMappingURL=cart.js.map
4
4
  //# sourceMappingURL=cart.js.map
package/dist/category.cjs CHANGED
@@ -14,7 +14,7 @@ async function* iterateAll(fetchPage, start = 1) {
14
14
  // src/core/query.ts
15
15
  function resolveQuery(q, cap) {
16
16
  if (typeof q === "string") return q;
17
- if (q.usesCompound === true && true) {
17
+ if (q.usesCompound === true && !cap.compoundLogicalQuery) {
18
18
  throw new Error(
19
19
  "This filter uses or()/compoundLogicalQuery, which the target service does not support. Combine conditions with and() (space-separated AND) instead."
20
20
  );
@@ -57,7 +57,7 @@ var CategoryService = class {
57
57
  * support `compoundLogicalQuery`, so `or()` filters are rejected.
58
58
  */
59
59
  async search(query, params = {}, auth = ANON) {
60
- const q = resolveQuery(query);
60
+ const q = resolveQuery(query, { compoundLogicalQuery: false });
61
61
  const pageNumber = params.pageNumber ?? 1;
62
62
  const pageSize = params.pageSize ?? 50;
63
63
  const items = await this.ctx.http.request({
@@ -202,6 +202,196 @@ var CategoryService = class {
202
202
  auth
203
203
  });
204
204
  }
205
+ // --- Admin write CRUD. Default auth: service. ---
206
+ /**
207
+ * Creates a category (`POST /categories`). Default auth: service.
208
+ * `options.publish` sets the `publish` query flag (needs the
209
+ * `category.category_publish` scope).
210
+ */
211
+ async create(input, options = {}, auth = SERVICE) {
212
+ return this.ctx.http.request({
213
+ method: "POST",
214
+ path: `/category/${this.ctx.tenant}/categories`,
215
+ ...options.publish === void 0 ? {} : { query: { publish: String(options.publish) } },
216
+ body: input,
217
+ auth
218
+ });
219
+ }
220
+ /**
221
+ * Full-replaces a category (`PUT /categories/{categoryId}`). This is an
222
+ * upsert: with a caller-supplied id it may create (201, returns the id) or
223
+ * update an existing one (204, returns nothing). Default auth: service.
224
+ */
225
+ async update(categoryId, input, options = {}, auth = SERVICE) {
226
+ return this.ctx.http.request({
227
+ method: "PUT",
228
+ path: `/category/${this.ctx.tenant}/categories/${categoryId}`,
229
+ ...options.publish === void 0 ? {} : { query: { publish: String(options.publish) } },
230
+ body: input,
231
+ auth
232
+ });
233
+ }
234
+ /**
235
+ * Partially updates a category (`PATCH /categories/{categoryId}`). Default
236
+ * auth: service. `options.publish` sets the `publish` query flag.
237
+ */
238
+ async patch(categoryId, input, options = {}, auth = SERVICE) {
239
+ await this.ctx.http.request({
240
+ method: "PATCH",
241
+ path: `/category/${this.ctx.tenant}/categories/${categoryId}`,
242
+ ...options.publish === void 0 ? {} : { query: { publish: String(options.publish) } },
243
+ body: input,
244
+ auth
245
+ });
246
+ }
247
+ /** Deletes a category (`DELETE /categories/{categoryId}`). Default auth: service. */
248
+ async delete(categoryId, auth = SERVICE) {
249
+ await this.ctx.http.request({
250
+ method: "DELETE",
251
+ path: `/category/${this.ctx.tenant}/categories/${categoryId}`,
252
+ auth
253
+ });
254
+ }
255
+ /**
256
+ * Searches categories via `POST /categories/search`. Same query capability
257
+ * as {@link search} (`compoundLogicalQuery: false` — Category rejects `or()`
258
+ * filters); the POST body avoids URL-length limits for large `q` filters.
259
+ * `params.showRoots` / `params.showUnpublished` are POST-only flags. Default
260
+ * auth: anonymous.
261
+ */
262
+ async searchByQuery(query, params = {}, auth = ANON) {
263
+ const q = resolveQuery(query, { compoundLogicalQuery: false });
264
+ const pageNumber = params.pageNumber ?? 1;
265
+ const pageSize = params.pageSize ?? 50;
266
+ const items = await this.ctx.http.request({
267
+ method: "POST",
268
+ path: `/category/${this.ctx.tenant}/categories/search`,
269
+ query: {
270
+ pageNumber,
271
+ pageSize,
272
+ ...params.sort === void 0 ? {} : { sort: params.sort },
273
+ ...params.showRoots === void 0 ? {} : { showRoots: String(params.showRoots) },
274
+ ...params.showUnpublished === void 0 ? {} : { showUnpublished: String(params.showUnpublished) }
275
+ },
276
+ body: { q },
277
+ idempotent: true,
278
+ // pure read over POST — safe to replay on 5xx/429
279
+ auth
280
+ });
281
+ return { items, pageNumber, pageSize, hasNextPage: items.length === pageSize };
282
+ }
283
+ /**
284
+ * Searches category trees via `POST /category-trees/search` — returns the
285
+ * trees that include at least one of the given `categoryIds`. Default auth:
286
+ * anonymous.
287
+ */
288
+ async searchTrees(input, options = {}, auth = ANON) {
289
+ return this.ctx.http.request({
290
+ method: "POST",
291
+ path: `/category/${this.ctx.tenant}/category-trees/search`,
292
+ ...options.showUnpublished === void 0 ? {} : { query: { showUnpublished: String(options.showUnpublished) } },
293
+ body: input,
294
+ idempotent: true,
295
+ // pure read over POST — safe to replay on 5xx/429
296
+ auth
297
+ });
298
+ }
299
+ /**
300
+ * Category ↔ resource assignments. Writes default to service auth. The
301
+ * assignment `ref.type` is `'PRODUCT'` (per the API); category hierarchy is
302
+ * managed via `parentId` on the category, not via assignments.
303
+ */
304
+ assignments = {
305
+ /** One page of a category's assignments. Default auth: anonymous. */
306
+ list: async (categoryId, params = {}, auth = ANON) => this.ctx.http.request({
307
+ method: "GET",
308
+ path: `/category/${this.ctx.tenant}/categories/${categoryId}/assignments`,
309
+ query: {
310
+ ...params.pageNumber === void 0 ? {} : { pageNumber: params.pageNumber },
311
+ ...params.pageSize === void 0 ? {} : { pageSize: params.pageSize },
312
+ ...params.sort === void 0 ? {} : { sort: params.sort },
313
+ ...params.expandSupercategoriesIds === void 0 ? {} : { expandSupercategoriesIds: String(params.expandSupercategoriesIds) },
314
+ ...params.showUnpublished === void 0 ? {} : { showUnpublished: String(params.showUnpublished) }
315
+ },
316
+ auth
317
+ }),
318
+ /** Assigns a single resource to a category (`POST …/assignments`). Default auth: service. */
319
+ create: async (categoryId, input, auth = SERVICE) => this.ctx.http.request({
320
+ method: "POST",
321
+ path: `/category/${this.ctx.tenant}/categories/${categoryId}/assignments`,
322
+ body: input,
323
+ auth
324
+ }),
325
+ /** Bulk-assigns resources to a category (`POST …/assignments/bulk`). Default auth: service. */
326
+ bulkCreate: async (categoryId, input, auth = SERVICE) => this.ctx.http.request({
327
+ method: "POST",
328
+ path: `/category/${this.ctx.tenant}/categories/${categoryId}/assignments/bulk`,
329
+ body: input,
330
+ auth
331
+ }),
332
+ /** Removes one assignment by id (`DELETE …/assignments/{assignmentId}`). Default auth: service. */
333
+ remove: async (categoryId, assignmentId, auth = SERVICE) => {
334
+ await this.ctx.http.request({
335
+ method: "DELETE",
336
+ path: `/category/${this.ctx.tenant}/categories/${categoryId}/assignments/${assignmentId}`,
337
+ auth
338
+ });
339
+ },
340
+ /** Removes all of a category's assignments (`DELETE …/assignments`). Default auth: service. */
341
+ removeAll: async (categoryId, options = {}, auth = SERVICE) => {
342
+ await this.ctx.http.request({
343
+ method: "DELETE",
344
+ path: `/category/${this.ctx.tenant}/categories/${categoryId}/assignments`,
345
+ ...options.assignmentType === void 0 ? {} : { query: { assignmentType: options.assignmentType } },
346
+ auth
347
+ });
348
+ },
349
+ /** Upserts an assignment by reference id — no body (`PUT …/assignments/references/{referenceId}`). Default auth: service. */
350
+ upsertByReference: async (categoryId, referenceId, auth = SERVICE) => this.ctx.http.request({
351
+ method: "PUT",
352
+ path: `/category/${this.ctx.tenant}/categories/${categoryId}/assignments/references/${referenceId}`,
353
+ auth
354
+ }),
355
+ /** Removes an assignment by reference id (`DELETE …/assignments/references/{referenceId}`). Default auth: service. */
356
+ removeByReference: async (categoryId, referenceId, auth = SERVICE) => {
357
+ await this.ctx.http.request({
358
+ method: "DELETE",
359
+ path: `/category/${this.ctx.tenant}/categories/${categoryId}/assignments/references/${referenceId}`,
360
+ auth
361
+ });
362
+ },
363
+ /** Bulk-upserts assignment references (`PUT …/assignments/references/bulk`). Default auth: service. */
364
+ bulkUpsertByReference: async (categoryId, input, auth = SERVICE) => this.ctx.http.request({
365
+ method: "PUT",
366
+ path: `/category/${this.ctx.tenant}/categories/${categoryId}/assignments/references/bulk`,
367
+ body: input,
368
+ auth
369
+ }),
370
+ /**
371
+ * Lists every category assigned to the given reference id — tenant-wide
372
+ * (`GET /assignments/references/{referenceId}`). Default auth: anonymous.
373
+ */
374
+ listCategoriesByReference: async (referenceId, params = {}, auth = ANON) => this.ctx.http.request({
375
+ method: "GET",
376
+ path: `/category/${this.ctx.tenant}/assignments/references/${referenceId}`,
377
+ query: {
378
+ ...params.pageNumber === void 0 ? {} : { pageNumber: params.pageNumber },
379
+ ...params.pageSize === void 0 ? {} : { pageSize: params.pageSize },
380
+ ...params.sort === void 0 ? {} : { sort: params.sort },
381
+ ...params.showUnpublished === void 0 ? {} : { showUnpublished: String(params.showUnpublished) },
382
+ ...params.expandSupercategoriesIds === void 0 ? {} : { expandSupercategoriesIds: String(params.expandSupercategoriesIds) }
383
+ },
384
+ auth
385
+ }),
386
+ /** Removes all assignments to a given reference id — tenant-wide (`DELETE /assignments/references/{referenceId}`). Default auth: service. */
387
+ removeAllByReference: async (referenceId, auth = SERVICE) => {
388
+ await this.ctx.http.request({
389
+ method: "DELETE",
390
+ path: `/category/${this.ctx.tenant}/assignments/references/${referenceId}`,
391
+ auth
392
+ });
393
+ }
394
+ };
205
395
  };
206
396
 
207
397
  exports.CategoryService = CategoryService;