@feedmepos/order-plugin-gallery 0.0.10-beta.5 → 0.0.10-beta.6

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.
@@ -95,9 +95,11 @@ const autoAddCompulsoryItems = async (sdk, rules, slotActiveBills) => {
95
95
  const compulsoryItemsPlugin = (args) => {
96
96
  const { sdk, onBeforeSubmitOrder, pluginParams } = args;
97
97
  const { onOrderSessionReady } = args;
98
+ const getPluginParams = () => {
99
+ return (pluginParams || {});
100
+ };
98
101
  const getRules = () => {
99
- const params = (pluginParams || {});
100
- return getNormalizedRules(params.itemLimitConfig);
102
+ return getNormalizedRules(getPluginParams().itemLimitConfig);
101
103
  };
102
104
  if (typeof onOrderSessionReady === "function") {
103
105
  onOrderSessionReady(async (params) => {
@@ -118,11 +120,13 @@ const compulsoryItemsPlugin = (args) => {
118
120
  if (violationMessages.length === 0) {
119
121
  return true;
120
122
  }
123
+ const submitErrorMessage = getPluginParams().submitErrorMessage?.trim();
121
124
  sdk.ui.toast.show({
122
- title: [
123
- "Please update your cart before submitting:",
124
- ...violationMessages.map((message) => `- ${message}`),
125
- ].join("\n"),
125
+ title: submitErrorMessage ||
126
+ [
127
+ "Please update your cart before submitting:",
128
+ ...violationMessages.map((message) => `- ${message}`),
129
+ ].join("\n"),
126
130
  type: "error",
127
131
  duration: 6000,
128
132
  });
@@ -6,6 +6,7 @@ export type CompulsoryItemRule = {
6
6
  };
7
7
  export type CompulsoryItemsPluginParams = {
8
8
  itemLimitConfig: CompulsoryItemRule[];
9
+ submitErrorMessage?: string;
9
10
  };
10
11
  export type QuantityItem = {
11
12
  productId?: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/order-plugin-gallery",
3
- "version": "0.0.10-beta.5",
3
+ "version": "0.0.10-beta.6",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"