@treely/strapi-slices 5.8.0 → 5.8.1
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/dist/models/forms/SmallCheckoutForm.d.ts +5 -0
- package/dist/strapi-slices.cjs.development.js +15 -13
- package/dist/strapi-slices.cjs.development.js.map +1 -1
- package/dist/strapi-slices.cjs.production.min.js +1 -1
- package/dist/strapi-slices.cjs.production.min.js.map +1 -1
- package/dist/strapi-slices.esm.js +15 -13
- package/dist/strapi-slices.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/portfolio/SmallCheckout/SmallCheckout.tsx +28 -26
- package/src/models/forms/SmallCheckoutForm.ts +6 -0
|
@@ -4342,15 +4342,16 @@ var SmallCheckout = function SmallCheckout(_ref) {
|
|
|
4342
4342
|
push = _useRouter.push;
|
|
4343
4343
|
var validateForm = React.useCallback(function (values) {
|
|
4344
4344
|
var errors = {};
|
|
4345
|
-
|
|
4345
|
+
var value = parseInt(values.contributionValueCurrency);
|
|
4346
|
+
if (!values.contributionValueCurrency || isNaN(value)) {
|
|
4346
4347
|
errors.contributionValueCurrency = formatMessage({
|
|
4347
4348
|
id: 'portfolio.smallCheckout.contributionValueCurrency.validation.empty'
|
|
4348
4349
|
});
|
|
4349
|
-
} else if (
|
|
4350
|
+
} else if (value < MINIMUM_CONTRIBUTION_VALUE_IN_MONEY) {
|
|
4350
4351
|
errors.contributionValueCurrency = formatMessage({
|
|
4351
4352
|
id: "portfolio.smallCheckout.contributionValueCurrency.validation.tooLow." + currency
|
|
4352
4353
|
});
|
|
4353
|
-
} else if (
|
|
4354
|
+
} else if (value > MAXIMUM_CONTRIBUTION_VALUE_IN_MONEY) {
|
|
4354
4355
|
errors.contributionValueCurrency = formatMessage({
|
|
4355
4356
|
id: 'portfolio.smallCheckout.contributionValueCurrency.validation.tooHigh'
|
|
4356
4357
|
});
|
|
@@ -4367,7 +4368,7 @@ var SmallCheckout = function SmallCheckout(_ref) {
|
|
|
4367
4368
|
checkoutURL = new URL(FPM_API_URI + "/v1/webhooks/shop/checkout");
|
|
4368
4369
|
currentURL = new URL(window.location.href);
|
|
4369
4370
|
checkoutURL.searchParams.append('batchId', batchId);
|
|
4370
|
-
checkoutURL.searchParams.append('quantity', Math.floor(contributionValueCurrency / pricePerKg).toString());
|
|
4371
|
+
checkoutURL.searchParams.append('quantity', Math.floor(parseInt(contributionValueCurrency) / pricePerKg).toString());
|
|
4371
4372
|
checkoutURL.searchParams.append('cancelPath', currentURL.pathname);
|
|
4372
4373
|
push(checkoutURL.toString());
|
|
4373
4374
|
case 7:
|
|
@@ -4408,8 +4409,8 @@ var SmallCheckout = function SmallCheckout(_ref) {
|
|
|
4408
4409
|
}))
|
|
4409
4410
|
}))), React__default.default.createElement(formik.Formik, {
|
|
4410
4411
|
initialValues: {
|
|
4411
|
-
contributionValueCurrency: initialContributionValue,
|
|
4412
|
-
contributionValueKgs: initialContributionValue / pricePerKg / 1000
|
|
4412
|
+
contributionValueCurrency: initialContributionValue.toString(),
|
|
4413
|
+
contributionValueKgs: (initialContributionValue / pricePerKg / 1000).toString()
|
|
4413
4414
|
},
|
|
4414
4415
|
validate: validateForm,
|
|
4415
4416
|
onSubmit: onSubmit
|
|
@@ -4433,11 +4434,12 @@ var SmallCheckout = function SmallCheckout(_ref) {
|
|
|
4433
4434
|
size: "md",
|
|
4434
4435
|
inputProps: {
|
|
4435
4436
|
type: 'number',
|
|
4436
|
-
value: field.value,
|
|
4437
|
+
value: field.value || '',
|
|
4437
4438
|
onChange: function onChange(e) {
|
|
4439
|
+
var value = e.target.valueAsNumber;
|
|
4438
4440
|
setValues({
|
|
4439
|
-
contributionValueCurrency:
|
|
4440
|
-
contributionValueKgs:
|
|
4441
|
+
contributionValueCurrency: value.toString(),
|
|
4442
|
+
contributionValueKgs: (value / pricePerKg / 1000).toString()
|
|
4441
4443
|
});
|
|
4442
4444
|
}
|
|
4443
4445
|
},
|
|
@@ -4463,12 +4465,12 @@ var SmallCheckout = function SmallCheckout(_ref) {
|
|
|
4463
4465
|
size: "md",
|
|
4464
4466
|
inputProps: {
|
|
4465
4467
|
type: 'number',
|
|
4466
|
-
value: field.value,
|
|
4468
|
+
value: field.value || '',
|
|
4467
4469
|
onChange: function onChange(e) {
|
|
4468
|
-
var value = e.target.valueAsNumber
|
|
4470
|
+
var value = e.target.valueAsNumber;
|
|
4469
4471
|
setValues({
|
|
4470
|
-
contributionValueCurrency: value * pricePerKg * 1000,
|
|
4471
|
-
contributionValueKgs: value
|
|
4472
|
+
contributionValueCurrency: (value * pricePerKg * 1000).toString(),
|
|
4473
|
+
contributionValueKgs: value.toString()
|
|
4472
4474
|
});
|
|
4473
4475
|
}
|
|
4474
4476
|
},
|