@bzbs/react-api-client 2.1.4 → 2.1.6

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,18 +1090,60 @@ 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
+ ],
1098
1107
  sideCampaignJson: params.sideCampaignJson
1099
1108
  }, params.options),
1100
1109
  {
1101
- headers: __spreadValues({
1102
- "Content-Type": "application/x-www-form-urlencoded"
1103
- }, requestOptions == null ? void 0 : requestOptions.headers),
1110
+ headers: requestOptions == null ? void 0 : requestOptions.headers,
1111
+ data: requestOptions == null ? void 0 : requestOptions.data,
1112
+ params: requestOptions == null ? void 0 : requestOptions.params
1113
+ }
1114
+ );
1115
+ });
1116
+ }
1117
+ /**
1118
+ * Adds multiple items to the cart.
1119
+ *
1120
+ * @param params - The parameters.
1121
+ * @param params.items - The items to add to the cart.
1122
+ * @param params.mode - The mode of adding.
1123
+ * @param params.clearCart - Whether to clear the cart before adding the items.
1124
+ * @param params.cartType - The cart type. Defaults to 'normal'.
1125
+ * @param params.sideCampaignJson - The side campaign JSON.
1126
+ * @param params.options - Additional options for adding the items to the cart.
1127
+ * @param requestOptions - The options for the request.
1128
+ * @returns A promise that resolves to a ServiceResponse containing the cart count response.
1129
+ */
1130
+ addCartMultiple(params, requestOptions) {
1131
+ return __async(this, null, function* () {
1132
+ var _a;
1133
+ return yield this.post(
1134
+ `cart/add`,
1135
+ __spreadValues({
1136
+ mode: params.mode,
1137
+ clearCart: params.clearCart,
1138
+ cartType: (_a = params.cartType) != null ? _a : "normal",
1139
+ json: params.items.map((item) => ({
1140
+ id: item.id,
1141
+ qty: String(item.qty)
1142
+ })),
1143
+ sideCampaignJson: params.sideCampaignJson
1144
+ }, params.options),
1145
+ {
1146
+ headers: requestOptions == null ? void 0 : requestOptions.headers,
1104
1147
  data: requestOptions == null ? void 0 : requestOptions.data,
1105
1148
  params: requestOptions == null ? void 0 : requestOptions.params
1106
1149
  }
@@ -1139,14 +1182,12 @@ var CartApi = class extends BaseService {
1139
1182
  cartAccess(params, requestOptions) {
1140
1183
  return __async(this, null, function* () {
1141
1184
  return yield this.post(
1142
- "setting",
1185
+ "setting/add",
1143
1186
  {
1144
1187
  data: JSON.stringify(params)
1145
1188
  },
1146
1189
  {
1147
- headers: __spreadValues({
1148
- "Content-Type": "application/x-www-form-urlencoded"
1149
- }, requestOptions == null ? void 0 : requestOptions.headers),
1190
+ headers: requestOptions == null ? void 0 : requestOptions.headers,
1150
1191
  data: requestOptions == null ? void 0 : requestOptions.data,
1151
1192
  params: requestOptions == null ? void 0 : requestOptions.params
1152
1193
  }