Compare commits

...

2 Commits

Author SHA1 Message Date
semantic-release-bot 383638f702 🔖 chore(release): v1.0.0-beta.33 [skip ci]
# [1.0.0-beta.33](https://github.com/perfect-panel/ppanel-web/compare/v1.0.0-beta.32...v1.0.0-beta.33) (2025-03-18)

### 🐛 Bug Fixes

* **subscribe**: Handle optional values in price and discount calculations ([5939763](https://github.com/perfect-panel/ppanel-web/commit/5939763))
2025-03-18 07:53:53 +00:00
web@ppanel 5939763b57 🐛 fix(subscribe): Handle optional values in price and discount calculations 2025-03-18 14:50:48 +07:00
4 changed files with 11 additions and 5 deletions
+7
View File
@@ -1,6 +1,13 @@
<a name="readme-top"></a>
# Changelog
# [1.0.0-beta.33](https://github.com/perfect-panel/ppanel-web/compare/v1.0.0-beta.32...v1.0.0-beta.33) (2025-03-18)
### 🐛 Bug Fixes
* **subscribe**: Handle optional values in price and discount calculations ([5939763](https://github.com/perfect-panel/ppanel-web/commit/5939763))
# [1.0.0-beta.32](https://github.com/perfect-panel/ppanel-web/compare/v1.0.0-beta.31...v1.0.0-beta.32) (2025-03-17)
@@ -564,7 +564,7 @@ export default function SubscribeForm<T extends Record<string, any>>({
return {
...data,
price: evaluateWithPrecision(
`${unit_price} * ${data.quantity} * ${data.discount} / 100`,
`${unit_price || 0} * ${data.quantity || 0} * ${data.discount || 0} / 100`,
),
};
},
@@ -581,7 +581,7 @@ export default function SubscribeForm<T extends Record<string, any>>({
return {
...data,
discount: evaluateWithPrecision(
`${data.price} / ${data.quantity} / ${unit_price} * 100`,
`${data.price || 0} / ${data.quantity || 0} / ${unit_price || 0} * 100`,
),
};
},
@@ -589,7 +589,6 @@ export default function SubscribeForm<T extends Record<string, any>>({
]}
value={field.value}
onChange={(value) => {
console.log(value);
form.setValue(field.name, value);
}}
/>
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "ppanel-web",
"version": "1.0.0-beta.32",
"version": "1.0.0-beta.33",
"private": true,
"homepage": "https://github.com/perfect-panel/ppanel-web",
"bugs": {
@@ -36,7 +36,7 @@ export function ObjectInput<T extends Record<string, any>>({
let updatedState = { ...internalState, ...value };
fields.forEach((field) => {
if (field.calculateValue) {
if (field?.calculateValue) {
updatedState = field.calculateValue(updatedState);
}
});