@bzbs/react-api-client 2.1.4 → 2.1.5

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.mjs CHANGED
@@ -1082,6 +1082,7 @@ var CartApi = class extends BaseService {
1082
1082
  * @param params.mode - The mode off adding.
1083
1083
  * @param params.qty - The quantity of the item.
1084
1084
  * @param params.clearCart - Whether to clear the cart before adding the item.
1085
+ * @param params.cartType - The cart type. Defaults to 'normal'.
1085
1086
  * @param params.sideCampaignJson - The side campaign JSON.
1086
1087
  * @param params.options - Additional options for adding the item to the cart.
1087
1088
  * @param requestOptions - The options for the request.
@@ -1089,12 +1090,58 @@ var CartApi = class extends BaseService {
1089
1090
  */
1090
1091
  addCart(params, requestOptions) {
1091
1092
  return __async(this, null, function* () {
1093
+ var _a;
1092
1094
  return yield this.post(
1093
- `cart/${params.id}/add`,
1095
+ `cart/add`,
1094
1096
  __spreadValues({
1095
1097
  mode: params.mode,
1096
1098
  qty: params.qty,
1097
1099
  clearCart: params.clearCart,
1100
+ cartType: (_a = params.cartType) != null ? _a : "normal",
1101
+ json: [
1102
+ {
1103
+ id: params.id,
1104
+ qty: String(params.qty)
1105
+ }
1106
+ ],
1107
+ sideCampaignJson: params.sideCampaignJson
1108
+ }, params.options),
1109
+ {
1110
+ headers: __spreadValues({
1111
+ "Content-Type": "application/x-www-form-urlencoded"
1112
+ }, requestOptions == null ? void 0 : requestOptions.headers),
1113
+ data: requestOptions == null ? void 0 : requestOptions.data,
1114
+ params: requestOptions == null ? void 0 : requestOptions.params
1115
+ }
1116
+ );
1117
+ });
1118
+ }
1119
+ /**
1120
+ * Adds multiple items to the cart.
1121
+ *
1122
+ * @param params - The parameters.
1123
+ * @param params.items - The items to add to the cart.
1124
+ * @param params.mode - The mode of adding.
1125
+ * @param params.clearCart - Whether to clear the cart before adding the items.
1126
+ * @param params.cartType - The cart type. Defaults to 'normal'.
1127
+ * @param params.sideCampaignJson - The side campaign JSON.
1128
+ * @param params.options - Additional options for adding the items to the cart.
1129
+ * @param requestOptions - The options for the request.
1130
+ * @returns A promise that resolves to a ServiceResponse containing the cart count response.
1131
+ */
1132
+ addCartMultiple(params, requestOptions) {
1133
+ return __async(this, null, function* () {
1134
+ var _a;
1135
+ return yield this.post(
1136
+ `cart/add`,
1137
+ __spreadValues({
1138
+ mode: params.mode,
1139
+ clearCart: params.clearCart,
1140
+ cartType: (_a = params.cartType) != null ? _a : "normal",
1141
+ json: params.items.map((item) => ({
1142
+ id: item.id,
1143
+ qty: String(item.qty)
1144
+ })),
1098
1145
  sideCampaignJson: params.sideCampaignJson
1099
1146
  }, params.options),
1100
1147
  {