@treely/strapi-slices 5.8.0 → 5.9.0
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/components/PreviewAlert/PreviewAlert.d.ts +2 -0
- package/dist/components/PreviewAlert/PreviewAlert.stories.d.ts +3 -0
- package/dist/components/PreviewAlert/index.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/models/forms/SmallCheckoutForm.d.ts +5 -0
- package/dist/slices/Hero/Hero.d.ts +2 -2
- package/dist/slices/IconGrid/IconGrid.d.ts +2 -2
- package/dist/strapi-slices.cjs.development.js +28 -14
- 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 +28 -15
- package/dist/strapi-slices.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/PreviewAlert/PreviewAlert.stories.tsx +12 -0
- package/src/components/PreviewAlert/PreviewAlert.test.tsx +15 -0
- package/src/components/PreviewAlert/PreviewAlert.tsx +10 -0
- package/src/components/PreviewAlert/index.ts +1 -0
- package/src/components/portfolio/SmallCheckout/SmallCheckout.tsx +28 -26
- package/src/index.tsx +1 -0
- package/src/models/forms/SmallCheckoutForm.ts +6 -0
- package/src/slices/Hero/Hero.tsx +1 -1
- package/src/slices/IconGrid/IconGrid.tsx +1 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0fc72a6d").R, unknown>;
|
|
2
|
+
export default _default;
|
|
3
|
+
export declare const Default: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, unknown>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PreviewAlert } from './PreviewAlert';
|
package/dist/index.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ import mergeGlobalAndStrapiPageData from './utils/mergeGlobalAndStrapiPageData';
|
|
|
52
52
|
import mergeGlobalAndStrapiProjectData from './utils/mergeGlobalAndStrapiProjectData';
|
|
53
53
|
import strapiLinkUrl from './utils/strapiLinkUrl';
|
|
54
54
|
import strapiMediaUrl from './utils/strapiMediaUrl';
|
|
55
|
+
export * from './components/PreviewAlert';
|
|
55
56
|
export * from './components/SEOTags';
|
|
56
57
|
export * from './components/SliceRenderer';
|
|
57
58
|
export { mergeGlobalAndStrapiBlogPostData, mergeGlobalAndStrapiCustomerStoryData, mergeGlobalAndStrapiPageData, mergeGlobalAndStrapiProjectData, strapiLinkUrl, strapiMediaUrl, getPortfolioProjects, getStaticPathsFromStrapi, getStaticPropsFromStrapi, };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import StrapiImage from '../../models/strapi/StrapiImage';
|
|
3
3
|
import StrapiLink from '../../models/strapi/StrapiLink';
|
|
4
4
|
import StrapiButtonWithVariant from '../../models/strapi/StrapiButtonWithVariant';
|
|
@@ -14,4 +14,4 @@ export interface HeroProps {
|
|
|
14
14
|
shape?: StrapiImage;
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
export declare const Hero:
|
|
17
|
+
export declare const Hero: ({ slice }: HeroProps) => JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import StrapiImage from '../../models/strapi/StrapiImage';
|
|
3
3
|
import StrapiLink from '../../models/strapi/StrapiLink';
|
|
4
4
|
export interface IconGridProps {
|
|
@@ -15,4 +15,4 @@ export interface IconGridProps {
|
|
|
15
15
|
}[];
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
export declare const IconGrid:
|
|
18
|
+
export declare const IconGrid: ({ slice }: IconGridProps) => JSX.Element;
|
|
@@ -6,8 +6,8 @@ var axios = require('axios');
|
|
|
6
6
|
var qs = require('qs');
|
|
7
7
|
var axiosCacheInterceptor = require('axios-cache-interceptor');
|
|
8
8
|
var React = require('react');
|
|
9
|
-
var Head = require('next/head');
|
|
10
9
|
var boemly = require('boemly');
|
|
10
|
+
var Head = require('next/head');
|
|
11
11
|
var Image = require('next/image');
|
|
12
12
|
var reactUse = require('react-use');
|
|
13
13
|
var react = require('@phosphor-icons/react');
|
|
@@ -756,6 +756,17 @@ var strapiLinkUrl = function strapiLinkUrl(strapiLink) {
|
|
|
756
756
|
return ((_strapiLink2 = strapiLink) == null ? void 0 : _strapiLink2.url) || '/';
|
|
757
757
|
};
|
|
758
758
|
|
|
759
|
+
var PreviewAlert = function PreviewAlert() {
|
|
760
|
+
return React__default.default.createElement(boemly.Box, {
|
|
761
|
+
position: "fixed",
|
|
762
|
+
top: "4",
|
|
763
|
+
left: "4"
|
|
764
|
+
}, React__default.default.createElement(boemly.BoemlyAlert, {
|
|
765
|
+
text: "Preview",
|
|
766
|
+
status: "error"
|
|
767
|
+
}));
|
|
768
|
+
};
|
|
769
|
+
|
|
759
770
|
var SEOTags = function SEOTags(_ref) {
|
|
760
771
|
var _shareImage$url, _shareImage$alt;
|
|
761
772
|
var title = _ref.title,
|
|
@@ -4342,15 +4353,16 @@ var SmallCheckout = function SmallCheckout(_ref) {
|
|
|
4342
4353
|
push = _useRouter.push;
|
|
4343
4354
|
var validateForm = React.useCallback(function (values) {
|
|
4344
4355
|
var errors = {};
|
|
4345
|
-
|
|
4356
|
+
var value = parseInt(values.contributionValueCurrency);
|
|
4357
|
+
if (!values.contributionValueCurrency || isNaN(value)) {
|
|
4346
4358
|
errors.contributionValueCurrency = formatMessage({
|
|
4347
4359
|
id: 'portfolio.smallCheckout.contributionValueCurrency.validation.empty'
|
|
4348
4360
|
});
|
|
4349
|
-
} else if (
|
|
4361
|
+
} else if (value < MINIMUM_CONTRIBUTION_VALUE_IN_MONEY) {
|
|
4350
4362
|
errors.contributionValueCurrency = formatMessage({
|
|
4351
4363
|
id: "portfolio.smallCheckout.contributionValueCurrency.validation.tooLow." + currency
|
|
4352
4364
|
});
|
|
4353
|
-
} else if (
|
|
4365
|
+
} else if (value > MAXIMUM_CONTRIBUTION_VALUE_IN_MONEY) {
|
|
4354
4366
|
errors.contributionValueCurrency = formatMessage({
|
|
4355
4367
|
id: 'portfolio.smallCheckout.contributionValueCurrency.validation.tooHigh'
|
|
4356
4368
|
});
|
|
@@ -4367,7 +4379,7 @@ var SmallCheckout = function SmallCheckout(_ref) {
|
|
|
4367
4379
|
checkoutURL = new URL(FPM_API_URI + "/v1/webhooks/shop/checkout");
|
|
4368
4380
|
currentURL = new URL(window.location.href);
|
|
4369
4381
|
checkoutURL.searchParams.append('batchId', batchId);
|
|
4370
|
-
checkoutURL.searchParams.append('quantity', Math.floor(contributionValueCurrency / pricePerKg).toString());
|
|
4382
|
+
checkoutURL.searchParams.append('quantity', Math.floor(parseInt(contributionValueCurrency) / pricePerKg).toString());
|
|
4371
4383
|
checkoutURL.searchParams.append('cancelPath', currentURL.pathname);
|
|
4372
4384
|
push(checkoutURL.toString());
|
|
4373
4385
|
case 7:
|
|
@@ -4408,8 +4420,8 @@ var SmallCheckout = function SmallCheckout(_ref) {
|
|
|
4408
4420
|
}))
|
|
4409
4421
|
}))), React__default.default.createElement(formik.Formik, {
|
|
4410
4422
|
initialValues: {
|
|
4411
|
-
contributionValueCurrency: initialContributionValue,
|
|
4412
|
-
contributionValueKgs: initialContributionValue / pricePerKg / 1000
|
|
4423
|
+
contributionValueCurrency: initialContributionValue.toString(),
|
|
4424
|
+
contributionValueKgs: (initialContributionValue / pricePerKg / 1000).toString()
|
|
4413
4425
|
},
|
|
4414
4426
|
validate: validateForm,
|
|
4415
4427
|
onSubmit: onSubmit
|
|
@@ -4433,11 +4445,12 @@ var SmallCheckout = function SmallCheckout(_ref) {
|
|
|
4433
4445
|
size: "md",
|
|
4434
4446
|
inputProps: {
|
|
4435
4447
|
type: 'number',
|
|
4436
|
-
value: field.value,
|
|
4448
|
+
value: field.value || '',
|
|
4437
4449
|
onChange: function onChange(e) {
|
|
4450
|
+
var value = e.target.valueAsNumber;
|
|
4438
4451
|
setValues({
|
|
4439
|
-
contributionValueCurrency:
|
|
4440
|
-
contributionValueKgs:
|
|
4452
|
+
contributionValueCurrency: value.toString(),
|
|
4453
|
+
contributionValueKgs: (value / pricePerKg / 1000).toString()
|
|
4441
4454
|
});
|
|
4442
4455
|
}
|
|
4443
4456
|
},
|
|
@@ -4463,12 +4476,12 @@ var SmallCheckout = function SmallCheckout(_ref) {
|
|
|
4463
4476
|
size: "md",
|
|
4464
4477
|
inputProps: {
|
|
4465
4478
|
type: 'number',
|
|
4466
|
-
value: field.value,
|
|
4479
|
+
value: field.value || '',
|
|
4467
4480
|
onChange: function onChange(e) {
|
|
4468
|
-
var value = e.target.valueAsNumber
|
|
4481
|
+
var value = e.target.valueAsNumber;
|
|
4469
4482
|
setValues({
|
|
4470
|
-
contributionValueCurrency: value * pricePerKg * 1000,
|
|
4471
|
-
contributionValueKgs: value
|
|
4483
|
+
contributionValueCurrency: (value * pricePerKg * 1000).toString(),
|
|
4484
|
+
contributionValueKgs: value.toString()
|
|
4472
4485
|
});
|
|
4473
4486
|
}
|
|
4474
4487
|
},
|
|
@@ -5579,6 +5592,7 @@ var SliceRenderer = function SliceRenderer(_ref) {
|
|
|
5579
5592
|
}));
|
|
5580
5593
|
};
|
|
5581
5594
|
|
|
5595
|
+
exports.PreviewAlert = PreviewAlert;
|
|
5582
5596
|
exports.SEOTags = SEOTags;
|
|
5583
5597
|
exports.SliceRenderer = SliceRenderer;
|
|
5584
5598
|
exports.getPortfolioProjects = getPortfolioProjects;
|