@open-tender/utils 0.1.149 → 0.1.150
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/cjs/utils/helpers.d.ts +0 -1
- package/dist/cjs/utils/helpers.js +1 -5
- package/dist/cjs/utils/menu.d.ts +6 -1
- package/dist/cjs/utils/menu.js +36 -1
- package/dist/esm/utils/helpers.d.ts +0 -1
- package/dist/esm/utils/helpers.js +0 -3
- package/dist/esm/utils/menu.d.ts +6 -1
- package/dist/esm/utils/menu.js +34 -0
- package/package.json +1 -1
|
@@ -10,7 +10,6 @@ export declare const serialize: (obj: Record<string | number, string | number |
|
|
|
10
10
|
export declare const capitalize: (s: string) => string;
|
|
11
11
|
export declare const cleanPhone: (phone: string) => string;
|
|
12
12
|
export declare const makePhone: (phone: string) => string;
|
|
13
|
-
export declare const isPhone: (value: string) => boolean;
|
|
14
13
|
export declare const validatePhone: (phone: string) => boolean;
|
|
15
14
|
export declare const makeBirthDate: (birthDate: string) => string | null;
|
|
16
15
|
export declare const slashesToDashes: (birthDate: string) => DateString | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasEntities = exports.convertStringToArray = exports.formatDollars = exports.formatQuantity = exports.addCommas = exports.displayPrice = exports.makeSlides = exports.makeImageUrl = exports.makeImageMap = exports.getHeight = exports.getWidth = exports.makeRandomNumberString = exports.checkNotFound = exports.checkGuestData = exports.checkEmpty = exports.validateEmail = exports.dashesToSlashes = exports.slashesToDashes = exports.makeBirthDate = exports.validatePhone = exports.
|
|
3
|
+
exports.hasEntities = exports.convertStringToArray = exports.formatDollars = exports.formatQuantity = exports.addCommas = exports.displayPrice = exports.makeSlides = exports.makeImageUrl = exports.makeImageMap = exports.getHeight = exports.getWidth = exports.makeRandomNumberString = exports.checkNotFound = exports.checkGuestData = exports.checkEmpty = exports.validateEmail = exports.dashesToSlashes = exports.slashesToDashes = exports.makeBirthDate = exports.validatePhone = exports.makePhone = exports.cleanPhone = exports.capitalize = exports.serialize = exports.stripTags = exports.slugify = exports.contains = exports.isNum = exports.isEmpty = exports.isObject = exports.isString = void 0;
|
|
4
4
|
const isString = (str) => {
|
|
5
5
|
return typeof str === 'string';
|
|
6
6
|
};
|
|
@@ -74,10 +74,6 @@ const makePhone = (phone) => {
|
|
|
74
74
|
return p;
|
|
75
75
|
};
|
|
76
76
|
exports.makePhone = makePhone;
|
|
77
|
-
const isPhone = (value) => {
|
|
78
|
-
return /^\d+$/.test(value.replace('-', ''));
|
|
79
|
-
};
|
|
80
|
-
exports.isPhone = isPhone;
|
|
81
77
|
const validatePhone = (phone) => {
|
|
82
78
|
var _a;
|
|
83
79
|
if (!phone)
|
package/dist/cjs/utils/menu.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MenuCategories, MenuDisplayedSections } from '@open-tender/types';
|
|
1
|
+
import { MenuCategories, MenuDisplayedSections, ThemeImagePosition } from '@open-tender/types';
|
|
2
2
|
export declare const getBinaryArr: <T>(arr: T[]) => T[][];
|
|
3
3
|
export declare const makeItemChunks: <T extends {
|
|
4
4
|
id: number;
|
|
@@ -104,3 +104,8 @@ export declare const makeFlatCategories: (categories: MenuCategories) => {
|
|
|
104
104
|
slug: string;
|
|
105
105
|
small_image_url: string | null;
|
|
106
106
|
}[];
|
|
107
|
+
export declare const makeMenuItemLayout: (position: ThemeImagePosition) => {
|
|
108
|
+
hideImage: boolean;
|
|
109
|
+
flexDirection: string;
|
|
110
|
+
alignItems: string;
|
|
111
|
+
};
|
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.makeItemChunks = exports.getBinaryArr = void 0;
|
|
3
|
+
exports.makeMenuItemLayout = 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 = [];
|
|
@@ -45,3 +45,38 @@ const makeFlatCategories = (categories) => {
|
|
|
45
45
|
.map(c => (Object.assign(Object.assign({}, c), { key: (0, helpers_1.slugify)(c.name), data: c.items.map((i, idx) => (Object.assign(Object.assign({}, i), { key: `${(0, helpers_1.slugify)(c.name)}-${i.id}-${idx}` }))) })));
|
|
46
46
|
};
|
|
47
47
|
exports.makeFlatCategories = makeFlatCategories;
|
|
48
|
+
const makeMenuItemLayout = (position) => {
|
|
49
|
+
switch (position) {
|
|
50
|
+
case 'HIDDEN':
|
|
51
|
+
return {
|
|
52
|
+
hideImage: true,
|
|
53
|
+
flexDirection: 'column',
|
|
54
|
+
alignItems: 'stretch'
|
|
55
|
+
};
|
|
56
|
+
case 'LEFT':
|
|
57
|
+
return {
|
|
58
|
+
hideImage: false,
|
|
59
|
+
flexDirection: 'row',
|
|
60
|
+
alignItems: 'flex-start'
|
|
61
|
+
};
|
|
62
|
+
case 'RIGHT':
|
|
63
|
+
return {
|
|
64
|
+
hideImage: false,
|
|
65
|
+
flexDirection: 'row-reverse',
|
|
66
|
+
alignItems: 'flex-start'
|
|
67
|
+
};
|
|
68
|
+
case 'BOTTOM':
|
|
69
|
+
return {
|
|
70
|
+
hideImage: false,
|
|
71
|
+
flexDirection: 'column-reverse',
|
|
72
|
+
alignItems: 'stretch'
|
|
73
|
+
};
|
|
74
|
+
default:
|
|
75
|
+
return {
|
|
76
|
+
hideImage: false,
|
|
77
|
+
flexDirection: 'column',
|
|
78
|
+
alignItems: 'stretch'
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
exports.makeMenuItemLayout = makeMenuItemLayout;
|
|
@@ -10,7 +10,6 @@ export declare const serialize: (obj: Record<string | number, string | number |
|
|
|
10
10
|
export declare const capitalize: (s: string) => string;
|
|
11
11
|
export declare const cleanPhone: (phone: string) => string;
|
|
12
12
|
export declare const makePhone: (phone: string) => string;
|
|
13
|
-
export declare const isPhone: (value: string) => boolean;
|
|
14
13
|
export declare const validatePhone: (phone: string) => boolean;
|
|
15
14
|
export declare const makeBirthDate: (birthDate: string) => string | null;
|
|
16
15
|
export declare const slashesToDashes: (birthDate: string) => DateString | null;
|
package/dist/esm/utils/menu.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MenuCategories, MenuDisplayedSections } from '@open-tender/types';
|
|
1
|
+
import { MenuCategories, MenuDisplayedSections, ThemeImagePosition } from '@open-tender/types';
|
|
2
2
|
export declare const getBinaryArr: <T>(arr: T[]) => T[][];
|
|
3
3
|
export declare const makeItemChunks: <T extends {
|
|
4
4
|
id: number;
|
|
@@ -104,3 +104,8 @@ export declare const makeFlatCategories: (categories: MenuCategories) => {
|
|
|
104
104
|
slug: string;
|
|
105
105
|
small_image_url: string | null;
|
|
106
106
|
}[];
|
|
107
|
+
export declare const makeMenuItemLayout: (position: ThemeImagePosition) => {
|
|
108
|
+
hideImage: boolean;
|
|
109
|
+
flexDirection: string;
|
|
110
|
+
alignItems: string;
|
|
111
|
+
};
|
package/dist/esm/utils/menu.js
CHANGED
|
@@ -38,3 +38,37 @@ export const makeFlatCategories = (categories) => {
|
|
|
38
38
|
.filter(c => c.items.length)
|
|
39
39
|
.map(c => (Object.assign(Object.assign({}, c), { key: slugify(c.name), data: c.items.map((i, idx) => (Object.assign(Object.assign({}, i), { key: `${slugify(c.name)}-${i.id}-${idx}` }))) })));
|
|
40
40
|
};
|
|
41
|
+
export const makeMenuItemLayout = (position) => {
|
|
42
|
+
switch (position) {
|
|
43
|
+
case 'HIDDEN':
|
|
44
|
+
return {
|
|
45
|
+
hideImage: true,
|
|
46
|
+
flexDirection: 'column',
|
|
47
|
+
alignItems: 'stretch'
|
|
48
|
+
};
|
|
49
|
+
case 'LEFT':
|
|
50
|
+
return {
|
|
51
|
+
hideImage: false,
|
|
52
|
+
flexDirection: 'row',
|
|
53
|
+
alignItems: 'flex-start'
|
|
54
|
+
};
|
|
55
|
+
case 'RIGHT':
|
|
56
|
+
return {
|
|
57
|
+
hideImage: false,
|
|
58
|
+
flexDirection: 'row-reverse',
|
|
59
|
+
alignItems: 'flex-start'
|
|
60
|
+
};
|
|
61
|
+
case 'BOTTOM':
|
|
62
|
+
return {
|
|
63
|
+
hideImage: false,
|
|
64
|
+
flexDirection: 'column-reverse',
|
|
65
|
+
alignItems: 'stretch'
|
|
66
|
+
};
|
|
67
|
+
default:
|
|
68
|
+
return {
|
|
69
|
+
hideImage: false,
|
|
70
|
+
flexDirection: 'column',
|
|
71
|
+
alignItems: 'stretch'
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
};
|
package/package.json
CHANGED