@stigg/react-sdk 4.4.0-beta.6 → 4.4.0-beta.7

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.4.0-beta.6",
2
+ "version": "4.4.0-beta.7",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -63,8 +63,9 @@ function AddonListItem({
63
63
  setAddon(addon, initialAddonState.quantity);
64
64
  } else {
65
65
  removeAddon(addon.id);
66
- onAddonsValidationChange({ addonId: addon.id, isValid: true });
67
66
  }
67
+
68
+ onAddonsValidationChange({ addonId: addon.id, isValid: true });
68
69
  };
69
70
 
70
71
  return (
@@ -102,7 +103,12 @@ function AddonListItem({
102
103
  FormHelperTextProps={{ sx: { margin: '4px' } }}
103
104
  onChange={(event) => handleQuantityChange(event?.target?.value ? Number(event?.target?.value) : null)}
104
105
  />
105
- <TrashButton color="error" onClick={() => removeAddon(addon.id)}>
106
+ <TrashButton
107
+ color="error"
108
+ onClick={() => {
109
+ removeAddon(addon.id);
110
+ onAddonsValidationChange({ addonId: addon.id, isValid: true });
111
+ }}>
106
112
  <Icon icon="Trash" style={{ display: 'flex' }} />
107
113
  </TrashButton>
108
114
  </>
@@ -124,8 +130,7 @@ export function CheckoutAddonsStep() {
124
130
  const { initialAddons, addons, availableAddons, setAddon, removeAddon } = useAddonsStepModel();
125
131
  const [addonsValidation, setAddonsValidation] = useState(
126
132
  availableAddons?.reduce<Record<string, boolean>>((acc, curr) => {
127
- const addonState = addons.find((x) => x.addon.id === curr.id);
128
- acc[curr.id] = !!addonState && addonState.quantity > 0;
133
+ acc[curr.id] = true;
129
134
  return acc;
130
135
  }, {}) || {},
131
136
  );