@open-tender/utils 0.4.2 → 0.4.3

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,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { CartItem, CartLevels, ConfigDisplaySetting } from '@open-tender/types';
3
- export declare const useAccordion: (builtItem: CartItem, toggleOption: (levels: CartLevels) => void, cartId: number | null, displaySettings?: ConfigDisplaySetting, hasCustomize?: boolean) => {
2
+ import { CartItem, CartLevels, ConfigAccordion } from '@open-tender/types';
3
+ export declare const useAccordion: (builtItem: CartItem, toggleOption: (levels: CartLevels) => void, cartId?: number | null, config?: ConfigAccordion) => {
4
4
  open: string | null;
5
5
  setOpen: import("react").Dispatch<import("react").SetStateAction<string | null>>;
6
6
  groups: import("@open-tender/types").CartItemGroups;
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useAccordion = void 0;
4
4
  const react_1 = require("react");
5
5
  const utils_1 = require("../utils");
6
- const useAccordion = (builtItem, toggleOption, cartId, displaySettings, hasCustomize) => {
6
+ const useAccordion = (builtItem, toggleOption, cartId, config) => {
7
7
  var _a;
8
- const { calories: showCals = false, madeFor: showMadeFor = true, notes: showNotes = true } = displaySettings || {};
8
+ const { hasCals: showCals = false, hasCustomize = false, hasMadeFor: showMadeFor = true, hasNotes: showNotes = true } = config || {};
9
9
  const [open, setOpen] = (0, react_1.useState)(null);
10
10
  const { groups, ingredients, totalCals, madeFor, notes } = builtItem;
11
11
  const hasMadeFor = showMadeFor && !cartId ? true : false;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { CartItem, CartLevels, ConfigDisplaySetting } from '@open-tender/types';
3
- export declare const useAccordion: (builtItem: CartItem, toggleOption: (levels: CartLevels) => void, cartId: number | null, displaySettings?: ConfigDisplaySetting, hasCustomize?: boolean) => {
2
+ import { CartItem, CartLevels, ConfigAccordion } from '@open-tender/types';
3
+ export declare const useAccordion: (builtItem: CartItem, toggleOption: (levels: CartLevels) => void, cartId?: number | null, config?: ConfigAccordion) => {
4
4
  open: string | null;
5
5
  setOpen: import("react").Dispatch<import("react").SetStateAction<string | null>>;
6
6
  groups: import("@open-tender/types").CartItemGroups;
@@ -1,8 +1,8 @@
1
1
  import { useState } from 'react';
2
2
  import { calcNutritionalInfo } from '../utils';
3
- export const useAccordion = (builtItem, toggleOption, cartId, displaySettings, hasCustomize) => {
3
+ export const useAccordion = (builtItem, toggleOption, cartId, config) => {
4
4
  var _a;
5
- const { calories: showCals = false, madeFor: showMadeFor = true, notes: showNotes = true } = displaySettings || {};
5
+ const { hasCals: showCals = false, hasCustomize = false, hasMadeFor: showMadeFor = true, hasNotes: showNotes = true } = config || {};
6
6
  const [open, setOpen] = useState(null);
7
7
  const { groups, ingredients, totalCals, madeFor, notes } = builtItem;
8
8
  const hasMadeFor = showMadeFor && !cartId ? true : false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/utils",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
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.1",
39
+ "@open-tender/types": "^0.4.5",
40
40
  "@reduxjs/toolkit": "^1.8.5",
41
41
  "@types/google.maps": "^3.53.5",
42
42
  "@types/jest": "^29.5.11",
@@ -58,7 +58,7 @@
58
58
  "typescript": "^4.8.2"
59
59
  },
60
60
  "peerDependencies": {
61
- "@open-tender/types": "^0.3.10",
61
+ "@open-tender/types": "^0.4.5",
62
62
  "@reduxjs/toolkit": "^1.8.5",
63
63
  "react": "^18.2.0"
64
64
  },