@open-tender/utils 0.5.60 → 0.5.61

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,4 +1,4 @@
1
- import { CartItem, CartLevels } from '@open-tender/types';
1
+ import { CartItem, CartItemGroups, CartLevels } from '@open-tender/types';
2
2
  export declare const useBuilder: (orderItem: CartItem, orderTimeoutCallback?: () => void) => {
3
3
  item: CartItem;
4
4
  increment: () => void;
@@ -11,4 +11,5 @@ export declare const useBuilder: (orderItem: CartItem, orderTimeoutCallback?: ()
11
11
  incrementOption: (levels: CartLevels) => CartItem;
12
12
  decrementOption: (levels: CartLevels) => CartItem;
13
13
  setOptionQuantity: (levels: CartLevels, quantity: number) => CartItem;
14
+ setGroups: (groups: CartItemGroups) => void;
14
15
  };
@@ -134,6 +134,10 @@ const useBuilder = (orderItem, orderTimeoutCallback) => {
134
134
  setItem(pricedItem);
135
135
  return pricedItem;
136
136
  };
137
+ const setGroups = (groups) => {
138
+ const pricedItem = (0, utils_1.calcPrices)(Object.assign(Object.assign({}, item), { groups }));
139
+ setItem(pricedItem);
140
+ };
137
141
  return {
138
142
  item,
139
143
  increment,
@@ -145,7 +149,8 @@ const useBuilder = (orderItem, orderTimeoutCallback) => {
145
149
  toggleOption,
146
150
  incrementOption,
147
151
  decrementOption,
148
- setOptionQuantity
152
+ setOptionQuantity,
153
+ setGroups
149
154
  };
150
155
  };
151
156
  exports.useBuilder = useBuilder;
@@ -75,6 +75,7 @@ export declare const useProfileForm: (profile: Customer | null, loading: Request
75
75
  style?: import("react").CSSProperties | undefined;
76
76
  type: string;
77
77
  value?: string | undefined;
78
+ onBlur?: ((evt: any) => void) | undefined;
78
79
  })[];
79
80
  handleChange: (name: string, value: string | number | boolean) => void;
80
81
  handleSubmit: (evt?: React.FormEvent<HTMLFormElement>) => void;
@@ -86,7 +86,7 @@ const getPasswordRequirements = (password) => {
86
86
  },
87
87
  {
88
88
  met: hasOnlyAllowedChars(password) && hasSpecialChar(password),
89
- message: `One special character from: ${ALLOWED_SPECIAL_CHARS} (no other special characters allowed)`,
89
+ message: `One special character from: ${ALLOWED_SPECIAL_CHARS}`,
90
90
  },
91
91
  ];
92
92
  return requirements;
@@ -1,4 +1,4 @@
1
- import { CartItem, CartLevels } from '@open-tender/types';
1
+ import { CartItem, CartItemGroups, CartLevels } from '@open-tender/types';
2
2
  export declare const useBuilder: (orderItem: CartItem, orderTimeoutCallback?: () => void) => {
3
3
  item: CartItem;
4
4
  increment: () => void;
@@ -11,4 +11,5 @@ export declare const useBuilder: (orderItem: CartItem, orderTimeoutCallback?: ()
11
11
  incrementOption: (levels: CartLevels) => CartItem;
12
12
  decrementOption: (levels: CartLevels) => CartItem;
13
13
  setOptionQuantity: (levels: CartLevels, quantity: number) => CartItem;
14
+ setGroups: (groups: CartItemGroups) => void;
14
15
  };
@@ -131,6 +131,10 @@ export const useBuilder = (orderItem, orderTimeoutCallback) => {
131
131
  setItem(pricedItem);
132
132
  return pricedItem;
133
133
  };
134
+ const setGroups = (groups) => {
135
+ const pricedItem = calcPrices(Object.assign(Object.assign({}, item), { groups }));
136
+ setItem(pricedItem);
137
+ };
134
138
  return {
135
139
  item,
136
140
  increment,
@@ -142,6 +146,7 @@ export const useBuilder = (orderItem, orderTimeoutCallback) => {
142
146
  toggleOption,
143
147
  incrementOption,
144
148
  decrementOption,
145
- setOptionQuantity
149
+ setOptionQuantity,
150
+ setGroups
146
151
  };
147
152
  };
@@ -75,6 +75,7 @@ export declare const useProfileForm: (profile: Customer | null, loading: Request
75
75
  style?: import("react").CSSProperties | undefined;
76
76
  type: string;
77
77
  value?: string | undefined;
78
+ onBlur?: ((evt: any) => void) | undefined;
78
79
  })[];
79
80
  handleChange: (name: string, value: string | number | boolean) => void;
80
81
  handleSubmit: (evt?: React.FormEvent<HTMLFormElement>) => void;
@@ -82,7 +82,7 @@ export const getPasswordRequirements = (password) => {
82
82
  },
83
83
  {
84
84
  met: hasOnlyAllowedChars(password) && hasSpecialChar(password),
85
- message: `One special character from: ${ALLOWED_SPECIAL_CHARS} (no other special characters allowed)`,
85
+ message: `One special character from: ${ALLOWED_SPECIAL_CHARS}`,
86
86
  },
87
87
  ];
88
88
  return requirements;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/utils",
3
- "version": "0.5.60",
3
+ "version": "0.5.61",
4
4
  "description": "A library of utils for use with Open Tender applications that utilize our cloud-based Order API.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -57,7 +57,7 @@
57
57
  "typescript": "^4.8.2"
58
58
  },
59
59
  "peerDependencies": {
60
- "@open-tender/types": "^0.4.172",
60
+ "@open-tender/types": "^0.4.174",
61
61
  "@reduxjs/toolkit": "^1.8.5",
62
62
  "react": "^18.2.0"
63
63
  },