@swift-food-services/catering-widget 0.1.0-beta.13 → 0.1.0-beta.14

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
@@ -6169,18 +6169,19 @@ function groupItemsByRestaurant(orderItems) {
6169
6169
  }
6170
6170
  function createPricingApi(client) {
6171
6171
  return {
6172
- calculateCateringPricing: (orderItems, promoCodes, deliveryLocation) => client.requestJson(
6172
+ calculateCateringPricing: (orderItems, promoCodes, deliveryLocation, userId) => client.requestJson(
6173
6173
  "/pricing/catering-verify-cart",
6174
6174
  {
6175
6175
  method: "POST",
6176
6176
  body: JSON.stringify({
6177
6177
  orderItems,
6178
6178
  promoCodes,
6179
- ...deliveryLocation && { deliveryLocation }
6179
+ ...deliveryLocation && { deliveryLocation },
6180
+ ...userId && { userId }
6180
6181
  })
6181
6182
  }
6182
6183
  ),
6183
- calculateCateringPricingWithMealSessions: async (mealSessions, promoCodes, deliveryLocation) => {
6184
+ calculateCateringPricingWithMealSessions: async (mealSessions, promoCodes, deliveryLocation, userId) => {
6184
6185
  const mealSessionRequests = mealSessions.filter((s) => s.orderItems.length > 0).map((session, index) => ({
6185
6186
  sessionName: session.sessionName || `Session ${index + 1}`,
6186
6187
  sessionDate: session.sessionDate,
@@ -6197,7 +6198,8 @@ function createPricingApi(client) {
6197
6198
  body: JSON.stringify({
6198
6199
  mealSessions: mealSessionRequests,
6199
6200
  promoCodes,
6200
- ...deliveryLocation && { deliveryLocation }
6201
+ ...deliveryLocation && { deliveryLocation },
6202
+ ...userId && { userId }
6201
6203
  })
6202
6204
  }
6203
6205
  );
@@ -6212,13 +6214,13 @@ function createPricingApi(client) {
6212
6214
  };
6213
6215
  }
6214
6216
  },
6215
- validatePromoCode: async (promoCode, orderItems) => {
6217
+ validatePromoCode: async (promoCode, orderItems, userId) => {
6216
6218
  try {
6217
6219
  return await client.requestJson(
6218
6220
  "/promotions/validate-catering",
6219
6221
  {
6220
6222
  method: "POST",
6221
- body: JSON.stringify({ code: promoCode, orderItems })
6223
+ body: JSON.stringify({ code: promoCode, orderItems, ...userId && { userId } })
6222
6224
  }
6223
6225
  );
6224
6226
  } catch {
@@ -6228,11 +6230,11 @@ function createPricingApi(client) {
6228
6230
  };
6229
6231
  }
6230
6232
  },
6231
- validatePromoCodeWithMealSessions: async function(promoCode, mealSessions) {
6233
+ validatePromoCodeWithMealSessions: async function(promoCode, mealSessions, userId) {
6232
6234
  const allOrderItems = mealSessions.flatMap(
6233
6235
  (s) => groupItemsByRestaurant(s.orderItems)
6234
6236
  );
6235
- return this.validatePromoCode(promoCode, allOrderItems);
6237
+ return this.validatePromoCode(promoCode, allOrderItems, userId);
6236
6238
  }
6237
6239
  };
6238
6240
  }