@open-tender/utils 0.4.81 → 0.4.84

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.
@@ -34,6 +34,7 @@ export declare const useMenuItem: (builtItem: CartItem, auth: Auth | null, looku
34
34
  upsellItems: number[];
35
35
  list_name: string | null;
36
36
  list_id: string | null;
37
+ menu_position: number | null;
37
38
  allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
38
39
  cals: number | null;
39
40
  groups: import("@open-tender/types").CartItemGroups;
@@ -22,6 +22,7 @@ export declare const useOrderItem: (orderItem: CartItem, favorite?: MenuItemFavo
22
22
  upsellItems: number[];
23
23
  list_name: string | null;
24
24
  list_id: string | null;
25
+ menu_position: number | null;
25
26
  allergens: string[];
26
27
  allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
27
28
  cals: number | null;
@@ -26,6 +26,7 @@ export declare const rehydrateCart: (menuItems: MenuItems, simpleCartItems: Simp
26
26
  upsellItems: number[];
27
27
  list_name: string | null;
28
28
  list_id: string | null;
29
+ menu_position: number | null;
29
30
  allergens: string[];
30
31
  allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
31
32
  cals: number | null;
@@ -120,6 +121,7 @@ export declare const combineCarts: (cart: Cart, guestCart: Cart, cartOwner: Cart
120
121
  upsellItems: number[];
121
122
  list_name: string | null;
122
123
  list_id: string | null;
124
+ menu_position: number | null;
123
125
  allergens: string[];
124
126
  allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
125
127
  cals: number | null;
@@ -283,7 +283,7 @@ const makeOrderItem = (item, isEdit, soldOut = [], simpleItem, hasPoints = false
283
283
  id: item.id,
284
284
  imageUrl: item.large_image_url,
285
285
  increment: item.increment,
286
- index: item.index,
286
+ //index: null,
287
287
  ingredients: item.ingredients,
288
288
  isSoldOut: isSoldOut,
289
289
  madeFor: simpleItem ? simpleItem.made_for || null : null,
@@ -310,7 +310,8 @@ const makeOrderItem = (item, isEdit, soldOut = [], simpleItem, hasPoints = false
310
310
  itemShape: (_b = item.item_shape) !== null && _b !== void 0 ? _b : null,
311
311
  excludeFromBuilder: (_c = item.exclude_from_builder) !== null && _c !== void 0 ? _c : false,
312
312
  list_id: item.list_id,
313
- list_name: item.list_name
313
+ list_name: item.list_name,
314
+ menu_position: item.menu_position
314
315
  };
315
316
  const pricedItem = (0, exports.calcPrices)(orderItem);
316
317
  return pricedItem;
@@ -2,3 +2,4 @@ import { Discount, DiscountEnhanced, Discounts, OrderType, ServiceType } from '@
2
2
  export declare const makeValidDeals: (deals: Discounts | null, orderType?: OrderType | null, serviceType?: ServiceType | null, revenueCenterId?: number | null) => Discounts;
3
3
  export declare const makeLimitations: (item: Discount) => string;
4
4
  export declare const makeDiscountEnhanced: (item: Discount) => DiscountEnhanced;
5
+ export declare const getIsRewardExpired: (end_at: string | null) => boolean;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeDiscountEnhanced = exports.makeLimitations = exports.makeValidDeals = void 0;
3
+ exports.getIsRewardExpired = exports.makeDiscountEnhanced = exports.makeLimitations = exports.makeValidDeals = void 0;
4
4
  const datetimes_1 = require("./datetimes");
5
5
  const helpers_1 = require("./helpers");
6
6
  const makeValidDeals = (deals, orderType, serviceType, revenueCenterId) => {
@@ -104,3 +104,7 @@ const makeDiscountEnhanced = (item) => {
104
104
  return Object.assign(Object.assign({}, item), { imageUrl, expiration, todayOnly, limitations });
105
105
  };
106
106
  exports.makeDiscountEnhanced = makeDiscountEnhanced;
107
+ const getIsRewardExpired = (end_at) => {
108
+ return end_at ? (0, datetimes_1.dateStrToDate)(end_at) < new Date() : false;
109
+ };
110
+ exports.getIsRewardExpired = getIsRewardExpired;
@@ -34,6 +34,7 @@ export declare const useMenuItem: (builtItem: CartItem, auth: Auth | null, looku
34
34
  upsellItems: number[];
35
35
  list_name: string | null;
36
36
  list_id: string | null;
37
+ menu_position: number | null;
37
38
  allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
38
39
  cals: number | null;
39
40
  groups: import("@open-tender/types").CartItemGroups;
@@ -22,6 +22,7 @@ export declare const useOrderItem: (orderItem: CartItem, favorite?: MenuItemFavo
22
22
  upsellItems: number[];
23
23
  list_name: string | null;
24
24
  list_id: string | null;
25
+ menu_position: number | null;
25
26
  allergens: string[];
26
27
  allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
27
28
  cals: number | null;
@@ -26,6 +26,7 @@ export declare const rehydrateCart: (menuItems: MenuItems, simpleCartItems: Simp
26
26
  upsellItems: number[];
27
27
  list_name: string | null;
28
28
  list_id: string | null;
29
+ menu_position: number | null;
29
30
  allergens: string[];
30
31
  allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
31
32
  cals: number | null;
@@ -120,6 +121,7 @@ export declare const combineCarts: (cart: Cart, guestCart: Cart, cartOwner: Cart
120
121
  upsellItems: number[];
121
122
  list_name: string | null;
122
123
  list_id: string | null;
124
+ menu_position: number | null;
123
125
  allergens: string[];
124
126
  allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
125
127
  cals: number | null;
@@ -268,7 +268,7 @@ export const makeOrderItem = (item, isEdit, soldOut = [], simpleItem, hasPoints
268
268
  id: item.id,
269
269
  imageUrl: item.large_image_url,
270
270
  increment: item.increment,
271
- index: item.index,
271
+ //index: null,
272
272
  ingredients: item.ingredients,
273
273
  isSoldOut: isSoldOut,
274
274
  madeFor: simpleItem ? simpleItem.made_for || null : null,
@@ -295,7 +295,8 @@ export const makeOrderItem = (item, isEdit, soldOut = [], simpleItem, hasPoints
295
295
  itemShape: (_b = item.item_shape) !== null && _b !== void 0 ? _b : null,
296
296
  excludeFromBuilder: (_c = item.exclude_from_builder) !== null && _c !== void 0 ? _c : false,
297
297
  list_id: item.list_id,
298
- list_name: item.list_name
298
+ list_name: item.list_name,
299
+ menu_position: item.menu_position
299
300
  };
300
301
  const pricedItem = calcPrices(orderItem);
301
302
  return pricedItem;
@@ -2,3 +2,4 @@ import { Discount, DiscountEnhanced, Discounts, OrderType, ServiceType } from '@
2
2
  export declare const makeValidDeals: (deals: Discounts | null, orderType?: OrderType | null, serviceType?: ServiceType | null, revenueCenterId?: number | null) => Discounts;
3
3
  export declare const makeLimitations: (item: Discount) => string;
4
4
  export declare const makeDiscountEnhanced: (item: Discount) => DiscountEnhanced;
5
+ export declare const getIsRewardExpired: (end_at: string | null) => boolean;
@@ -1,4 +1,4 @@
1
- import { formatDateStr, getMinutesfromDate, makeLocalDateStr, time24ToMinutes } from './datetimes';
1
+ import { dateStrToDate, formatDateStr, getMinutesfromDate, makeLocalDateStr, time24ToMinutes } from './datetimes';
2
2
  import { makeImageMap } from './helpers';
3
3
  export const makeValidDeals = (deals, orderType, serviceType, revenueCenterId) => {
4
4
  if (!deals || !deals.length)
@@ -98,3 +98,6 @@ export const makeDiscountEnhanced = (item) => {
98
98
  const limitations = makeLimitations(item);
99
99
  return Object.assign(Object.assign({}, item), { imageUrl, expiration, todayOnly, limitations });
100
100
  };
101
+ export const getIsRewardExpired = (end_at) => {
102
+ return end_at ? dateStrToDate(end_at) < new Date() : false;
103
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/utils",
3
- "version": "0.4.81",
3
+ "version": "0.4.84",
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",
@@ -36,7 +36,7 @@
36
36
  "private": false,
37
37
  "devDependencies": {
38
38
  "@emotion/react": "^11.10.4",
39
- "@open-tender/types": "^0.4.111",
39
+ "@open-tender/types": "^0.4.118",
40
40
  "@reduxjs/toolkit": "^1.8.5",
41
41
  "@types/google.maps": "^3.53.5",
42
42
  "@types/jest": "^29.5.11",