@open-tender/utils 0.1.120 → 0.1.122
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/.DS_Store +0 -0
- package/dist/cjs/hooks/useModifier.d.ts +2 -2
- package/dist/cjs/hooks/useModifier.js +1 -1
- package/dist/cjs/utils/menu.d.ts +6 -4
- package/dist/cjs/utils/menu.js +3 -3
- package/dist/cjs/utils/theme.js +1 -1
- package/dist/esm/hooks/useModifier.d.ts +2 -2
- package/dist/esm/hooks/useModifier.js +1 -1
- package/dist/esm/utils/menu.d.ts +6 -4
- package/dist/esm/utils/menu.js +1 -1
- package/dist/esm/utils/theme.js +1 -1
- package/package.json +1 -1
package/dist/.DS_Store
CHANGED
|
Binary file
|
|
@@ -8,8 +8,8 @@ export declare const useModifier: (group: CartItemGroup, option: CartItemOption,
|
|
|
8
8
|
showImage: boolean;
|
|
9
9
|
showDescription: boolean;
|
|
10
10
|
hasCals: boolean;
|
|
11
|
-
hasIngredients: boolean
|
|
12
|
-
hasInfo: boolean
|
|
11
|
+
hasIngredients: boolean;
|
|
12
|
+
hasInfo: boolean;
|
|
13
13
|
allergenAlert: boolean;
|
|
14
14
|
bgStyle: {
|
|
15
15
|
backgroundImage: string;
|
|
@@ -21,7 +21,7 @@ const useModifier = (group, option, levels = [], toggleOption, incrementOption,
|
|
|
21
21
|
const cals = showCals ? option.cals : null;
|
|
22
22
|
const allergens = showAllergens ? option.allergens : [];
|
|
23
23
|
const tags = showTags ? option.tags : [];
|
|
24
|
-
const hasIngredients = option.ingredients && option.ingredients.length > 0;
|
|
24
|
+
const hasIngredients = option.ingredients && option.ingredients.length > 0 ? true : false;
|
|
25
25
|
const hasCals = cals !== null;
|
|
26
26
|
const itemAllergens = allergens && allergens.length
|
|
27
27
|
? allergens.filter(allergen => allergenAlerts.includes(allergen))
|
package/dist/cjs/utils/menu.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { MenuCategories, MenuDisplayedSections
|
|
1
|
+
import { MenuCategories, MenuDisplayedSections } from '@open-tender/types';
|
|
2
2
|
export declare const getBinaryArr: <T>(arr: T[]) => T[][];
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const makeItemChunks: <T extends {
|
|
4
|
+
id: number;
|
|
5
|
+
}>(items: T[], chunkSize: number) => {
|
|
4
6
|
key: string;
|
|
5
|
-
items:
|
|
7
|
+
items: T[];
|
|
6
8
|
}[];
|
|
7
9
|
export declare const makeOtherMenuSections: (displayedSections: MenuDisplayedSections, length?: number) => {
|
|
8
10
|
name: string;
|
|
@@ -90,7 +92,7 @@ export declare const makeFlatCategories: (categories: MenuCategories) => {
|
|
|
90
92
|
children: MenuCategories;
|
|
91
93
|
description: string | null;
|
|
92
94
|
id: number;
|
|
93
|
-
items: MenuItems;
|
|
95
|
+
items: import("@open-tender/types").MenuItems;
|
|
94
96
|
large_image_url: string | null;
|
|
95
97
|
menu_name: string;
|
|
96
98
|
menu_name_id: number;
|
package/dist/cjs/utils/menu.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeFlatCategories = exports.makeOtherMenuSections = exports.
|
|
3
|
+
exports.makeFlatCategories = exports.makeOtherMenuSections = exports.makeItemChunks = exports.getBinaryArr = void 0;
|
|
4
4
|
const helpers_1 = require("./helpers");
|
|
5
5
|
const getBinaryArr = (arr) => {
|
|
6
6
|
const result = [];
|
|
@@ -12,7 +12,7 @@ const getBinaryArr = (arr) => {
|
|
|
12
12
|
return result;
|
|
13
13
|
};
|
|
14
14
|
exports.getBinaryArr = getBinaryArr;
|
|
15
|
-
const
|
|
15
|
+
const makeItemChunks = (items, chunkSize) => {
|
|
16
16
|
const arr = [];
|
|
17
17
|
for (let i = 0; i < items.length; i += chunkSize) {
|
|
18
18
|
const chunk = items.slice(i, i + chunkSize);
|
|
@@ -21,7 +21,7 @@ const makeMenuItemChunks = (items, chunkSize) => {
|
|
|
21
21
|
}
|
|
22
22
|
return arr;
|
|
23
23
|
};
|
|
24
|
-
exports.
|
|
24
|
+
exports.makeItemChunks = makeItemChunks;
|
|
25
25
|
const makeOtherMenuSections = (displayedSections, length = 10) => {
|
|
26
26
|
return Object.entries(displayedSections).map(([section, items]) => {
|
|
27
27
|
const slug = (0, helpers_1.slugify)(section);
|
package/dist/cjs/utils/theme.js
CHANGED
|
@@ -154,7 +154,7 @@ const makeWelcome = (welcome) => {
|
|
|
154
154
|
};
|
|
155
155
|
const makeItem = (item) => {
|
|
156
156
|
const { mobile } = item;
|
|
157
|
-
return Object.assign(Object.assign({}, mobile), {
|
|
157
|
+
return Object.assign(Object.assign({}, mobile), { imageMargin: boxRemsToPixels(mobile.imageMargin), imageMaxHeight: (0, exports.remsToPixels)(mobile.imageMaxHeight), imageMinHeight: (0, exports.remsToPixels)(mobile.imageMinHeight), imagePadding: (0, exports.remsToPixels)(mobile.imagePadding), imagePaddingAll: boxRemsToPixels(mobile.imagePaddingAll), maxWidth: (0, exports.remsToPixels)(mobile.maxWidth), padding: (0, exports.remsToPixels)(mobile.padding) });
|
|
158
158
|
};
|
|
159
159
|
const makeCategories = (categories) => {
|
|
160
160
|
const { mobile } = categories;
|
|
@@ -8,8 +8,8 @@ export declare const useModifier: (group: CartItemGroup, option: CartItemOption,
|
|
|
8
8
|
showImage: boolean;
|
|
9
9
|
showDescription: boolean;
|
|
10
10
|
hasCals: boolean;
|
|
11
|
-
hasIngredients: boolean
|
|
12
|
-
hasInfo: boolean
|
|
11
|
+
hasIngredients: boolean;
|
|
12
|
+
hasInfo: boolean;
|
|
13
13
|
allergenAlert: boolean;
|
|
14
14
|
bgStyle: {
|
|
15
15
|
backgroundImage: string;
|
|
@@ -18,7 +18,7 @@ export const useModifier = (group, option, levels = [], toggleOption, incrementO
|
|
|
18
18
|
const cals = showCals ? option.cals : null;
|
|
19
19
|
const allergens = showAllergens ? option.allergens : [];
|
|
20
20
|
const tags = showTags ? option.tags : [];
|
|
21
|
-
const hasIngredients = option.ingredients && option.ingredients.length > 0;
|
|
21
|
+
const hasIngredients = option.ingredients && option.ingredients.length > 0 ? true : false;
|
|
22
22
|
const hasCals = cals !== null;
|
|
23
23
|
const itemAllergens = allergens && allergens.length
|
|
24
24
|
? allergens.filter(allergen => allergenAlerts.includes(allergen))
|
package/dist/esm/utils/menu.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { MenuCategories, MenuDisplayedSections
|
|
1
|
+
import { MenuCategories, MenuDisplayedSections } from '@open-tender/types';
|
|
2
2
|
export declare const getBinaryArr: <T>(arr: T[]) => T[][];
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const makeItemChunks: <T extends {
|
|
4
|
+
id: number;
|
|
5
|
+
}>(items: T[], chunkSize: number) => {
|
|
4
6
|
key: string;
|
|
5
|
-
items:
|
|
7
|
+
items: T[];
|
|
6
8
|
}[];
|
|
7
9
|
export declare const makeOtherMenuSections: (displayedSections: MenuDisplayedSections, length?: number) => {
|
|
8
10
|
name: string;
|
|
@@ -90,7 +92,7 @@ export declare const makeFlatCategories: (categories: MenuCategories) => {
|
|
|
90
92
|
children: MenuCategories;
|
|
91
93
|
description: string | null;
|
|
92
94
|
id: number;
|
|
93
|
-
items: MenuItems;
|
|
95
|
+
items: import("@open-tender/types").MenuItems;
|
|
94
96
|
large_image_url: string | null;
|
|
95
97
|
menu_name: string;
|
|
96
98
|
menu_name_id: number;
|
package/dist/esm/utils/menu.js
CHANGED
|
@@ -8,7 +8,7 @@ export const getBinaryArr = (arr) => {
|
|
|
8
8
|
}
|
|
9
9
|
return result;
|
|
10
10
|
};
|
|
11
|
-
export const
|
|
11
|
+
export const makeItemChunks = (items, chunkSize) => {
|
|
12
12
|
const arr = [];
|
|
13
13
|
for (let i = 0; i < items.length; i += chunkSize) {
|
|
14
14
|
const chunk = items.slice(i, i + chunkSize);
|
package/dist/esm/utils/theme.js
CHANGED
|
@@ -145,7 +145,7 @@ const makeWelcome = (welcome) => {
|
|
|
145
145
|
};
|
|
146
146
|
const makeItem = (item) => {
|
|
147
147
|
const { mobile } = item;
|
|
148
|
-
return Object.assign(Object.assign({}, mobile), {
|
|
148
|
+
return Object.assign(Object.assign({}, mobile), { imageMargin: boxRemsToPixels(mobile.imageMargin), imageMaxHeight: remsToPixels(mobile.imageMaxHeight), imageMinHeight: remsToPixels(mobile.imageMinHeight), imagePadding: remsToPixels(mobile.imagePadding), imagePaddingAll: boxRemsToPixels(mobile.imagePaddingAll), maxWidth: remsToPixels(mobile.maxWidth), padding: remsToPixels(mobile.padding) });
|
|
149
149
|
};
|
|
150
150
|
const makeCategories = (categories) => {
|
|
151
151
|
const { mobile } = categories;
|
package/package.json
CHANGED