@open-tender/utils 0.1.3 → 0.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.
@@ -1,5 +1,5 @@
1
1
  import { CartCounts, Favorite, CartItem, ConfigDisplaySetting } from '@open-tender/types';
2
- export declare const useOrderItem: (orderItem: CartItem, favorite: Favorite | null | undefined, allergenAlerts: string[] | undefined, displaySettings: ConfigDisplaySetting, cartCounts?: CartCounts, isMobile?: boolean) => {
2
+ export declare const useOrderItem: (orderItem: CartItem, favorite?: Favorite | null, allergenAlerts?: string[], displaySettings?: ConfigDisplaySetting | null, cartCounts?: CartCounts, isMobile?: boolean) => {
3
3
  showImage: boolean;
4
4
  displayDesc: string | null;
5
5
  displayTags: string[];
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useOrderItem = void 0;
4
4
  const utils_1 = require("../../utils");
5
- const useOrderItem = (orderItem, favorite = null, allergenAlerts = [], displaySettings, cartCounts = {}, isMobile = true) => {
6
- const { menuImages: showImage, calories: showCals, tags: showTags, allergens: showAllergens, quickAdd, quickAddMobile, menuItemDescription, menuItemDescriptionMobile } = displaySettings;
5
+ const useOrderItem = (orderItem, favorite = null, allergenAlerts = [], displaySettings = null, cartCounts = {}, isMobile = true) => {
6
+ const { menuImages: showImage = true, calories: showCals = false, tags: showTags = false, allergens: showAllergens = false, quickAdd = false, quickAddMobile = false, menuItemDescription = 'SHOW', menuItemDescriptionMobile = 'SHOW' } = displaySettings || {};
7
7
  const showQuickAdd = isMobile ? quickAddMobile : quickAdd;
8
8
  const { description, shortDescription, quantity, price, totalPrice, cals, totalCals, tags, allergens, groups, isSoldOut } = orderItem;
9
9
  const cartCount = cartCounts[orderItem.id] || 0;
@@ -1,8 +1,8 @@
1
- import { UnpreparedOrderData, Money, Order, Tender, CheckoutConfig, SoldOut, MenuCategories, Address, MenuItem, CartItem, OrderItem, Cart, Favorites, Orders, CartItemGroups, Customer, CartItemOption, CartOwner, SimpleCartItem, MenuItems, SimpleCart, SimpleCartGroups, OrderItemGroups, NutritionalInfoCalcs, OrderItemImages, DisplayItems, DisplayItem, GroupOrderGuests, GroupOrderGuest } from '@open-tender/types';
1
+ import { UnpreparedOrderData, Money, Order, Tender, CheckoutConfig, SoldOut, MenuCategories, Address, MenuItem, CartItem, OrderItem, Cart, Favorites, Orders, CartItemGroups, Customer, CartItemOption, CartOwner, SimpleCartItem, MenuItems, SimpleCart, SimpleCartGroups, OrderItemGroups, NutritionalInfoCalcs, OrderItemImages, DisplayItems, DisplayItem, GroupOrderGuests, GroupOrderGuest, CartLevels } from '@open-tender/types';
2
2
  export declare const getItemOptions: (item: Partial<CartItem>) => CartItemOption[];
3
3
  export declare const makeModifierNames: (item: CartItem) => string;
4
4
  export declare const hasGroupsBelowMin: (option: CartItemOption | null, groups: CartItemGroups) => boolean;
5
- export declare const makeModifierGroups: (groups: CartItemGroups) => (number[][] | CartItemGroups)[];
5
+ export declare const makeModifierGroups: (groups: CartItemGroups) => [CartItemGroups, CartLevels];
6
6
  export declare const makeUpsellItems: (itemIds: number[], itemLookup: Record<string, MenuItem>) => (CartItem | CartItemOption)[];
7
7
  export declare const calcNutrition: (item: CartItemOption) => NutritionalInfoCalcs;
8
8
  export declare const calcPrices: (item: CartItem | CartItemOption) => CartItem | CartItemOption;
@@ -107,8 +107,8 @@ export declare const combineCarts: (cart: Cart, guestCart: SimpleCart, cartOwner
107
107
  id: number;
108
108
  quantity: number;
109
109
  groups: SimpleCartGroups;
110
- made_for?: string | undefined;
111
- notes?: string | undefined;
110
+ made_for?: string | null | undefined;
111
+ notes?: string | null | undefined;
112
112
  cart_guest_id?: number | undefined;
113
113
  customer_id?: number | undefined;
114
114
  })[];
@@ -1,5 +1,5 @@
1
1
  import { CartCounts, Favorite, CartItem, ConfigDisplaySetting } from '@open-tender/types';
2
- export declare const useOrderItem: (orderItem: CartItem, favorite: Favorite | null | undefined, allergenAlerts: string[] | undefined, displaySettings: ConfigDisplaySetting, cartCounts?: CartCounts, isMobile?: boolean) => {
2
+ export declare const useOrderItem: (orderItem: CartItem, favorite?: Favorite | null, allergenAlerts?: string[], displaySettings?: ConfigDisplaySetting | null, cartCounts?: CartCounts, isMobile?: boolean) => {
3
3
  showImage: boolean;
4
4
  displayDesc: string | null;
5
5
  displayTags: string[];
@@ -1,6 +1,6 @@
1
1
  import { formatDollars, getItemOptions, hasGroupsBelowMin } from '../../utils';
2
- export const useOrderItem = (orderItem, favorite = null, allergenAlerts = [], displaySettings, cartCounts = {}, isMobile = true) => {
3
- const { menuImages: showImage, calories: showCals, tags: showTags, allergens: showAllergens, quickAdd, quickAddMobile, menuItemDescription, menuItemDescriptionMobile } = displaySettings;
2
+ export const useOrderItem = (orderItem, favorite = null, allergenAlerts = [], displaySettings = null, cartCounts = {}, isMobile = true) => {
3
+ const { menuImages: showImage = true, calories: showCals = false, tags: showTags = false, allergens: showAllergens = false, quickAdd = false, quickAddMobile = false, menuItemDescription = 'SHOW', menuItemDescriptionMobile = 'SHOW' } = displaySettings || {};
4
4
  const showQuickAdd = isMobile ? quickAddMobile : quickAdd;
5
5
  const { description, shortDescription, quantity, price, totalPrice, cals, totalCals, tags, allergens, groups, isSoldOut } = orderItem;
6
6
  const cartCount = cartCounts[orderItem.id] || 0;
@@ -1,8 +1,8 @@
1
- import { UnpreparedOrderData, Money, Order, Tender, CheckoutConfig, SoldOut, MenuCategories, Address, MenuItem, CartItem, OrderItem, Cart, Favorites, Orders, CartItemGroups, Customer, CartItemOption, CartOwner, SimpleCartItem, MenuItems, SimpleCart, SimpleCartGroups, OrderItemGroups, NutritionalInfoCalcs, OrderItemImages, DisplayItems, DisplayItem, GroupOrderGuests, GroupOrderGuest } from '@open-tender/types';
1
+ import { UnpreparedOrderData, Money, Order, Tender, CheckoutConfig, SoldOut, MenuCategories, Address, MenuItem, CartItem, OrderItem, Cart, Favorites, Orders, CartItemGroups, Customer, CartItemOption, CartOwner, SimpleCartItem, MenuItems, SimpleCart, SimpleCartGroups, OrderItemGroups, NutritionalInfoCalcs, OrderItemImages, DisplayItems, DisplayItem, GroupOrderGuests, GroupOrderGuest, CartLevels } from '@open-tender/types';
2
2
  export declare const getItemOptions: (item: Partial<CartItem>) => CartItemOption[];
3
3
  export declare const makeModifierNames: (item: CartItem) => string;
4
4
  export declare const hasGroupsBelowMin: (option: CartItemOption | null, groups: CartItemGroups) => boolean;
5
- export declare const makeModifierGroups: (groups: CartItemGroups) => (number[][] | CartItemGroups)[];
5
+ export declare const makeModifierGroups: (groups: CartItemGroups) => [CartItemGroups, CartLevels];
6
6
  export declare const makeUpsellItems: (itemIds: number[], itemLookup: Record<string, MenuItem>) => (CartItem | CartItemOption)[];
7
7
  export declare const calcNutrition: (item: CartItemOption) => NutritionalInfoCalcs;
8
8
  export declare const calcPrices: (item: CartItem | CartItemOption) => CartItem | CartItemOption;
@@ -107,8 +107,8 @@ export declare const combineCarts: (cart: Cart, guestCart: SimpleCart, cartOwner
107
107
  id: number;
108
108
  quantity: number;
109
109
  groups: SimpleCartGroups;
110
- made_for?: string | undefined;
111
- notes?: string | undefined;
110
+ made_for?: string | null | undefined;
111
+ notes?: string | null | undefined;
112
112
  cart_guest_id?: number | undefined;
113
113
  customer_id?: number | undefined;
114
114
  })[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/utils",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "A library of utils for use with Open Tender applications that utilize our cloud-based Order API.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",