@feedmepos/order-plugin-gallery 0.0.10-beta.3 → 0.0.10-beta.4
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.
|
@@ -92,19 +92,23 @@ const autoAddCompulsoryItems = async (sdk, rules, slotActiveBills) => {
|
|
|
92
92
|
await sdk.orderManager.updateItems(itemsToAdd);
|
|
93
93
|
}
|
|
94
94
|
};
|
|
95
|
-
const compulsoryItemsPlugin = (
|
|
95
|
+
const compulsoryItemsPlugin = (args) => {
|
|
96
|
+
const { sdk, onBeforeSubmitOrder, pluginParams } = args;
|
|
97
|
+
const { onOrderSessionReady } = args;
|
|
96
98
|
const getRules = () => {
|
|
97
99
|
const params = (pluginParams || {});
|
|
98
100
|
return getNormalizedRules(params.itemLimitConfig);
|
|
99
101
|
};
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
102
|
+
if (typeof onOrderSessionReady === "function") {
|
|
103
|
+
onOrderSessionReady(async (params) => {
|
|
104
|
+
if (params.isPreviewMode)
|
|
105
|
+
return;
|
|
106
|
+
const rules = getRules();
|
|
107
|
+
if (rules.length === 0)
|
|
108
|
+
return;
|
|
109
|
+
await autoAddCompulsoryItems(sdk, rules, params.slotActiveBills);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
108
112
|
onBeforeSubmitOrder(() => {
|
|
109
113
|
const rules = getRules();
|
|
110
114
|
if (rules.length === 0)
|