@feedmepos/order-plugin-gallery 0.0.2 → 0.0.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,11 +1,3 @@
|
|
|
1
1
|
import { PluginFunction } from "@feedmepos/ordering-sdk";
|
|
2
|
-
type CategoryLimitConfigItem = {
|
|
3
|
-
categoryId: string;
|
|
4
|
-
hideCategoryWhenOrderedItemExceed: number;
|
|
5
|
-
maxSubmitableItems?: number;
|
|
6
|
-
};
|
|
7
|
-
export interface MaxItemInCategoryOptions {
|
|
8
|
-
categoryLimitConfig: CategoryLimitConfigItem[];
|
|
9
|
-
}
|
|
10
2
|
declare const maxItemInCategoryPlugin: PluginFunction;
|
|
11
3
|
export default maxItemInCategoryPlugin;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
const maxItemInCategoryPlugin = ({ sdk, onAfterComputeMenuState, onBeforeSubmitOrder,
|
|
2
|
-
const
|
|
3
|
-
const { categoryLimitConfig = [] } = pluginParams || {};
|
|
1
|
+
const maxItemInCategoryPlugin = ({ sdk, onAfterComputeMenuState, onBeforeSubmitOrder, pluginParams, }) => {
|
|
2
|
+
const categoryLimitConfig = pluginParams?.categoryLimitConfig || [];
|
|
4
3
|
onBeforeSubmitOrder(() => {
|
|
5
4
|
const currentOrder = sdk.orderManager.state.value.order;
|
|
6
5
|
const cartItems = currentOrder?.draft || [];
|