@treely/strapi-slices 5.5.0 → 5.5.2
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/slices/BlogCards/BlogCards.stories.d.ts +5 -0
- package/dist/slices/Comparison/Comparison.stories.d.ts +6 -0
- package/dist/slices/Cta/Cta.stories.d.ts +9 -0
- package/dist/slices/CtaOnly/CtaOnly.stories.d.ts +3 -0
- package/dist/slices/CustomerStories/CustomerStories.stories.d.ts +6 -0
- package/dist/slices/Facts/Facts.stories.d.ts +7 -0
- package/dist/slices/FullWidthHighlightQuote/FullWidthHighlightQuote.stories.d.ts +4 -0
- package/dist/slices/FullWidthImage/FullWidthImage.stories.d.ts +5 -0
- package/dist/slices/FullWidthImageSlider/FullWidthImageSlider.stories.d.ts +3 -0
- package/dist/slices/Glossary/Glossary.stories.d.ts +3 -0
- package/dist/slices/Hero/Hero.stories.d.ts +9 -0
- package/dist/slices/IconGrid/IconGrid.stories.d.ts +5 -0
- package/dist/slices/ImageGrid/ImageGrid.stories.d.ts +5 -0
- package/dist/slices/ImageTextSequence/ImageTextSequence.stories.d.ts +7 -0
- package/dist/slices/LeftTextRightCard/LeftTextRightCard.stories.d.ts +8 -0
- package/dist/slices/LinkCardsGrid/LinkCardsGrid.stories.d.ts +5 -0
- package/dist/slices/LogoGridWithText/LogoGridWithText.stories.d.ts +6 -0
- package/dist/slices/MapHero/MapHero.stories.d.ts +8 -0
- package/dist/slices/ProjectFacts/ProjectFacts.stories.d.ts +8 -0
- package/dist/slices/ProjectsGrid/ProjectsGrid.stories.d.ts +3 -0
- package/dist/slices/ProjectsMap/ProjectsMap.stories.d.ts +6 -0
- package/dist/slices/QAndA/QAndA.stories.d.ts +7 -0
- package/dist/slices/QuoteCards/QuoteCards.stories.d.ts +8 -0
- package/dist/slices/RichTextSection/RichTextSection.stories.d.ts +3 -0
- package/dist/slices/ShopCheckout/ShopCheckout.stories.d.ts +7 -0
- package/dist/slices/SideBySideImages/SideBySideImages.stories.d.ts +3 -0
- package/dist/slices/SmallHero/SmallHero.stories.d.ts +11 -0
- package/dist/slices/Steps/Steps.stories.d.ts +7 -0
- package/dist/slices/TextCardGrid/TextCardGrid.stories.d.ts +8 -0
- package/dist/slices/TextCarousel/TextCarousel.stories.d.ts +6 -0
- package/dist/slices/TextWithCard/TextWithCard.stories.d.ts +10 -0
- package/dist/slices/TextWithTextCards/TextWithTextCards.stories.d.ts +7 -0
- package/dist/slices/Timeline/Timeline.stories.d.ts +9 -0
- package/dist/slices/Video/Video.stories.d.ts +3 -0
- package/dist/strapi-slices.cjs.development.js +18 -19
- 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 +18 -19
- package/dist/strapi-slices.esm.js.map +1 -1
- package/package.json +6 -1
- package/src/components/portfolio/SmallCheckout/SmallCheckout.tsx +10 -11
- package/src/slices/BlogCards/BlogCards.stories.tsx +16 -11
- package/src/slices/ImageTextSequence/ImageTextSequence.stories.tsx +8 -1
- package/src/slices/ProjectsMap/ProjectsMap.stories.tsx +5 -5
- package/src/slices/ShopCheckout/ShopCheckout.tsx +9 -7
- package/src/slices/Steps/Steps.tsx +1 -0
- package/src/slices/TextWithCard/TextWithCard.stories.tsx +3 -2
- package/src/slices/Timeline/Timeline.stories.tsx +6 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@treely/strapi-slices",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Tree.ly GmbH",
|
|
6
6
|
"description": "@treely/strapi-slices is a open source library maintained by Tree.ly.",
|
|
@@ -110,8 +110,13 @@
|
|
|
110
110
|
"@types/mapbox-gl": "^2.7.19",
|
|
111
111
|
"@types/react": "^18.2.38",
|
|
112
112
|
"@types/react-dom": "^18.2.17",
|
|
113
|
+
"@typescript-eslint/eslint-plugin": "^7.9.0",
|
|
114
|
+
"@typescript-eslint/parser": "^7.9.0",
|
|
113
115
|
"dts-cli": "^2.0.3",
|
|
114
116
|
"esbuild": "^0.19.8",
|
|
117
|
+
"eslint-config-airbnb-typescript": "^18.0.0",
|
|
118
|
+
"eslint-config-next": "^14.2.3",
|
|
119
|
+
"eslint-config-prettier": "^9.1.0",
|
|
115
120
|
"husky": "^8.0.3",
|
|
116
121
|
"identity-obj-proxy": "^3.0.0",
|
|
117
122
|
"jest": "^29.7.0",
|
|
@@ -56,7 +56,7 @@ const SmallCheckout = ({
|
|
|
56
56
|
button,
|
|
57
57
|
}: SmallCheckoutProps) => {
|
|
58
58
|
const { formatNumber, formatMessage, locale } = useContext(IntlContext);
|
|
59
|
-
const {
|
|
59
|
+
const { push } = useRouter();
|
|
60
60
|
|
|
61
61
|
const validateForm = useCallback(
|
|
62
62
|
(values: SmallCheckoutForm) => {
|
|
@@ -86,18 +86,19 @@ const SmallCheckout = ({
|
|
|
86
86
|
);
|
|
87
87
|
|
|
88
88
|
const onSubmit = async ({ contributionValueCurrency }: SmallCheckoutForm) => {
|
|
89
|
-
const
|
|
89
|
+
const checkoutURL = new URL(`${FPM_API_URI}/v1/webhooks/shop/checkout`);
|
|
90
|
+
const currentURL = new URL(window.location.href);
|
|
90
91
|
|
|
91
|
-
|
|
92
|
+
checkoutURL.searchParams.append('batchId', batchId);
|
|
92
93
|
|
|
93
|
-
|
|
94
|
+
checkoutURL.searchParams.append(
|
|
94
95
|
'quantity',
|
|
95
96
|
Math.floor(contributionValueCurrency / pricePerKg).toString()
|
|
96
97
|
);
|
|
97
98
|
|
|
98
|
-
|
|
99
|
+
checkoutURL.searchParams.append('cancelPath', currentURL.pathname);
|
|
99
100
|
|
|
100
|
-
push(
|
|
101
|
+
push(checkoutURL.toString());
|
|
101
102
|
};
|
|
102
103
|
|
|
103
104
|
return (
|
|
@@ -154,12 +155,10 @@ const SmallCheckout = ({
|
|
|
154
155
|
type: 'number',
|
|
155
156
|
value: field.value,
|
|
156
157
|
onChange: (e) => {
|
|
157
|
-
// valueAsNumber might be NaN
|
|
158
|
-
const value = e.target.valueAsNumber || 0;
|
|
159
|
-
|
|
160
158
|
setValues({
|
|
161
|
-
contributionValueCurrency:
|
|
162
|
-
contributionValueKgs:
|
|
159
|
+
contributionValueCurrency: e.target.valueAsNumber,
|
|
160
|
+
contributionValueKgs:
|
|
161
|
+
e.target.valueAsNumber / pricePerKg / 1000,
|
|
163
162
|
});
|
|
164
163
|
},
|
|
165
164
|
}}
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
import StrapiBlogPost from '../../models/strapi/StrapiBlogPost';
|
|
8
8
|
import IStrapiData from '../../models/strapi/IStrapiData';
|
|
9
9
|
import BlogCards from '.';
|
|
10
|
+
import { IStrapi, StrapiCategory } from '../..';
|
|
10
11
|
|
|
11
12
|
export default {
|
|
12
13
|
title: 'slices/BlogCards',
|
|
@@ -14,6 +15,17 @@ export default {
|
|
|
14
15
|
} as Meta<typeof BlogCards>;
|
|
15
16
|
|
|
16
17
|
const Template: StoryFn<typeof BlogCards> = (args) => <BlogCards {...args} />;
|
|
18
|
+
const blogPostCategory: IStrapi<IStrapiData<StrapiCategory>> = {
|
|
19
|
+
data: {
|
|
20
|
+
id: 1,
|
|
21
|
+
attributes: {
|
|
22
|
+
name: 'Business',
|
|
23
|
+
locale: 'en',
|
|
24
|
+
createdAt: '2022-01-10T14:59:44.830Z',
|
|
25
|
+
updatedAt: '2022-01-10T14:59:44.839Z',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
17
29
|
const blogPost: IStrapiData<StrapiBlogPost> = {
|
|
18
30
|
id: 1,
|
|
19
31
|
attributes: {
|
|
@@ -40,17 +52,7 @@ const blogPost: IStrapiData<StrapiBlogPost> = {
|
|
|
40
52
|
},
|
|
41
53
|
},
|
|
42
54
|
},
|
|
43
|
-
category:
|
|
44
|
-
data: {
|
|
45
|
-
id: 1,
|
|
46
|
-
attributes: {
|
|
47
|
-
name: 'Business',
|
|
48
|
-
locale: 'en',
|
|
49
|
-
createdAt: '2022-01-10T14:59:44.830Z',
|
|
50
|
-
updatedAt: '2022-01-10T14:59:44.839Z',
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
},
|
|
55
|
+
category: blogPostCategory,
|
|
54
56
|
locale: 'en',
|
|
55
57
|
createdAt: '2022-01-10T15:04:32.897Z',
|
|
56
58
|
updatedAt: '2022-01-11T10:21:42.317Z',
|
|
@@ -85,6 +87,7 @@ White.args = {
|
|
|
85
87
|
title: 'Title',
|
|
86
88
|
subTitle: 'Sub title',
|
|
87
89
|
variant: 'white',
|
|
90
|
+
blogPostCategory,
|
|
88
91
|
},
|
|
89
92
|
blogPosts: [
|
|
90
93
|
blogPost,
|
|
@@ -108,6 +111,7 @@ Gray.args = {
|
|
|
108
111
|
title: 'Title',
|
|
109
112
|
subTitle: 'Sub title',
|
|
110
113
|
variant: 'gray',
|
|
114
|
+
blogPostCategory,
|
|
111
115
|
},
|
|
112
116
|
blogPosts: [
|
|
113
117
|
blogPost,
|
|
@@ -131,6 +135,7 @@ WithButton.args = {
|
|
|
131
135
|
title: 'Title',
|
|
132
136
|
subTitle: 'Sub title',
|
|
133
137
|
variant: 'white',
|
|
138
|
+
blogPostCategory,
|
|
134
139
|
button: { id: 1, url: 'url', text: 'Button' },
|
|
135
140
|
},
|
|
136
141
|
blogPosts: [
|
|
@@ -3,6 +3,7 @@ import { StoryFn, Meta } from '@storybook/react';
|
|
|
3
3
|
|
|
4
4
|
import { storybookStrapiCoverMock } from '../../test/storybookMocks/storybookStrapiMedia';
|
|
5
5
|
import ImageTextSequence from '.';
|
|
6
|
+
import { StrapiImage, StrapiLink } from '../..';
|
|
6
7
|
|
|
7
8
|
export default {
|
|
8
9
|
title: 'slices/ImageTextSequence',
|
|
@@ -13,7 +14,13 @@ const Template: StoryFn<typeof ImageTextSequence> = (args) => (
|
|
|
13
14
|
<ImageTextSequence {...args} />
|
|
14
15
|
);
|
|
15
16
|
|
|
16
|
-
const imageTextRows
|
|
17
|
+
const imageTextRows: {
|
|
18
|
+
id: number;
|
|
19
|
+
title: string;
|
|
20
|
+
text: string;
|
|
21
|
+
button?: StrapiLink;
|
|
22
|
+
image: StrapiImage;
|
|
23
|
+
}[] = [
|
|
17
24
|
{
|
|
18
25
|
id: 1,
|
|
19
26
|
title: 'Row title 1',
|
|
@@ -24,7 +24,7 @@ Minimal.args = {
|
|
|
24
24
|
...fpmProjectMock,
|
|
25
25
|
geom: {
|
|
26
26
|
type: 'Point',
|
|
27
|
-
coordinates: [10.
|
|
27
|
+
coordinates: [10.33654214510088, 47.82636837845707],
|
|
28
28
|
},
|
|
29
29
|
},
|
|
30
30
|
],
|
|
@@ -45,7 +45,7 @@ WithHero.args = {
|
|
|
45
45
|
...fpmProjectMock,
|
|
46
46
|
geom: {
|
|
47
47
|
type: 'Point',
|
|
48
|
-
coordinates: [10.
|
|
48
|
+
coordinates: [10.33654214510088, 47.82636837845707],
|
|
49
49
|
},
|
|
50
50
|
},
|
|
51
51
|
],
|
|
@@ -67,7 +67,7 @@ InitialPosition.args = {
|
|
|
67
67
|
isPublic: true,
|
|
68
68
|
geom: {
|
|
69
69
|
type: 'Point',
|
|
70
|
-
coordinates: [10.
|
|
70
|
+
coordinates: [10.33654214510088, 47.82636837845707],
|
|
71
71
|
},
|
|
72
72
|
},
|
|
73
73
|
],
|
|
@@ -82,7 +82,7 @@ FullProps.args = {
|
|
|
82
82
|
|
|
83
83
|
defaultCenterCoordinates: {
|
|
84
84
|
latitude: 47.82636837845707,
|
|
85
|
-
longitude: 10.
|
|
85
|
+
longitude: 10.33654214510088,
|
|
86
86
|
},
|
|
87
87
|
defaultZoomLevel: 10,
|
|
88
88
|
},
|
|
@@ -95,7 +95,7 @@ FullProps.args = {
|
|
|
95
95
|
isPublic: true,
|
|
96
96
|
geom: {
|
|
97
97
|
type: 'Point',
|
|
98
|
-
coordinates: [10.
|
|
98
|
+
coordinates: [10.33654214510088, 47.82636837845707],
|
|
99
99
|
},
|
|
100
100
|
},
|
|
101
101
|
],
|
|
@@ -45,7 +45,7 @@ export interface ShopCheckoutProps {
|
|
|
45
45
|
export const ShopCheckout = ({ slice }: ShopCheckoutProps): JSX.Element => {
|
|
46
46
|
const [primary50] = useToken('colors', ['primary.50']);
|
|
47
47
|
const { formatMessage, formatNumber, locale } = useContext(IntlContext);
|
|
48
|
-
const {
|
|
48
|
+
const { push } = useRouter();
|
|
49
49
|
|
|
50
50
|
const validateForm = useCallback(
|
|
51
51
|
(values: CheckoutForm) => {
|
|
@@ -75,20 +75,22 @@ export const ShopCheckout = ({ slice }: ShopCheckoutProps): JSX.Element => {
|
|
|
75
75
|
);
|
|
76
76
|
|
|
77
77
|
const onSubmit = ({ contributionValue }: CheckoutForm) => {
|
|
78
|
-
const
|
|
78
|
+
const checkoutURL = new URL(`${FPM_API_URI}/v1/webhooks/shop/checkout`);
|
|
79
|
+
const currentURL = new URL(window.location.href);
|
|
79
80
|
|
|
80
|
-
|
|
81
|
+
checkoutURL.searchParams.append('batchId', slice.batchId);
|
|
81
82
|
|
|
82
|
-
|
|
83
|
+
checkoutURL.searchParams.append(
|
|
83
84
|
'quantity',
|
|
84
85
|
Math.floor(contributionValue / slice.pricePerKg).toString()
|
|
85
86
|
);
|
|
86
87
|
|
|
87
|
-
|
|
88
|
+
checkoutURL.searchParams.append('cancelPath', currentURL.pathname);
|
|
88
89
|
|
|
89
|
-
if (slice.couponId)
|
|
90
|
+
if (slice.couponId)
|
|
91
|
+
checkoutURL.searchParams.append('couponId', slice.couponId);
|
|
90
92
|
|
|
91
|
-
push(
|
|
93
|
+
push(checkoutURL.toString());
|
|
92
94
|
};
|
|
93
95
|
|
|
94
96
|
return (
|
|
@@ -4,6 +4,7 @@ import { StoryFn, Meta } from '@storybook/react';
|
|
|
4
4
|
import { storybookStrapiCoverMock } from '../../test/storybookMocks/storybookStrapiMedia';
|
|
5
5
|
import TextWithCard from '.';
|
|
6
6
|
import CreditsAvailableState from '../../models/CreditsAvailableState';
|
|
7
|
+
import { IStrapiData, PortfolioProject, StrapiProject } from '../..';
|
|
7
8
|
|
|
8
9
|
export default {
|
|
9
10
|
title: 'slices/TextWithCard',
|
|
@@ -37,7 +38,7 @@ const card = {
|
|
|
37
38
|
footerTitle: 'Footer title',
|
|
38
39
|
footerSubTitle: 'Footer sub title',
|
|
39
40
|
};
|
|
40
|
-
const portfolioProject = {
|
|
41
|
+
const portfolioProject: PortfolioProject = {
|
|
41
42
|
id: '1',
|
|
42
43
|
title: 'Project 1',
|
|
43
44
|
geom: {
|
|
@@ -77,7 +78,7 @@ const portfolioProject = {
|
|
|
77
78
|
id: 1,
|
|
78
79
|
},
|
|
79
80
|
};
|
|
80
|
-
const project = {
|
|
81
|
+
const project: IStrapiData<StrapiProject> = {
|
|
81
82
|
id: 1,
|
|
82
83
|
attributes: {
|
|
83
84
|
slug: 'slug',
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
} from '../../test/storybookMocks/storybookStrapiMedia';
|
|
8
8
|
import Timeline from '.';
|
|
9
9
|
import { TimelineItem } from './Timeline';
|
|
10
|
+
import { StrapiImage } from '../..';
|
|
10
11
|
|
|
11
12
|
export default {
|
|
12
13
|
title: 'slices/Timeline',
|
|
@@ -27,14 +28,17 @@ const button = {
|
|
|
27
28
|
text: 'Button',
|
|
28
29
|
url: 'https://tree.ly',
|
|
29
30
|
};
|
|
30
|
-
const badge
|
|
31
|
+
const badge: { text: string; variant: 'orange' | 'green' | 'red' | 'gray' } = {
|
|
32
|
+
text: 'Badge',
|
|
33
|
+
variant: 'green',
|
|
34
|
+
};
|
|
31
35
|
const image = { id: 71, alt: 'Alt', img: { data: storybookStrapiCoverMock } };
|
|
32
36
|
const icon = {
|
|
33
37
|
id: 1,
|
|
34
38
|
alt: 'Icon alt text',
|
|
35
39
|
img: { data: storybookStrapiTreeIconMock },
|
|
36
40
|
};
|
|
37
|
-
const logo = {
|
|
41
|
+
const logo: StrapiImage = {
|
|
38
42
|
id: 2,
|
|
39
43
|
alt: 'Avatar image alt text',
|
|
40
44
|
img: { data: storybookStrapiAvatarMock },
|