@treely/strapi-slices 5.9.0 → 5.11.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/portfolio/SmallCheckout/SmallCheckout.d.ts +2 -1
- package/dist/components/portfolio/SmallCheckout/messages.de.d.ts +2 -0
- package/dist/components/portfolio/SmallCheckout/messages.en.d.ts +2 -0
- package/dist/rootMessages.de.d.ts +4 -0
- package/dist/rootMessages.en.d.ts +4 -0
- package/dist/slices/ProjectFacts/ProjectFacts.d.ts +1 -0
- package/dist/slices/ShopCheckout/ShopCheckout.d.ts +1 -0
- package/dist/slices/ShopCheckout/ShopCheckout.stories.d.ts +1 -0
- package/dist/slices/ShopCheckout/messages.de.d.ts +2 -0
- package/dist/slices/ShopCheckout/messages.en.d.ts +2 -0
- package/dist/strapi-slices.cjs.development.js +49 -6
- 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 +50 -7
- package/dist/strapi-slices.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/portfolio/SmallCheckout/SmallCheckout.test.tsx +7 -0
- package/src/components/portfolio/SmallCheckout/SmallCheckout.tsx +31 -2
- package/src/components/portfolio/SmallCheckout/messages.de.ts +4 -0
- package/src/components/portfolio/SmallCheckout/messages.en.ts +3 -0
- package/src/slices/ProjectFacts/ProjectFacts.stories.tsx +1 -0
- package/src/slices/ProjectFacts/ProjectFacts.tsx +2 -0
- package/src/slices/ShopCheckout/ShopCheckout.stories.tsx +13 -0
- package/src/slices/ShopCheckout/ShopCheckout.test.tsx +7 -0
- package/src/slices/ShopCheckout/ShopCheckout.tsx +92 -62
- package/src/slices/ShopCheckout/messages.de.ts +3 -0
- package/src/slices/ShopCheckout/messages.en.ts +3 -0
|
@@ -4,11 +4,12 @@ export interface SmallCheckoutProps {
|
|
|
4
4
|
batchId: string;
|
|
5
5
|
pricePerKg: number;
|
|
6
6
|
initialContributionValue: number;
|
|
7
|
+
taxInPercent?: number;
|
|
7
8
|
checkoutText?: string;
|
|
8
9
|
currency: 'EUR' | 'CHF';
|
|
9
10
|
title?: string;
|
|
10
11
|
subtitle?: string;
|
|
11
12
|
button?: StrapiLink;
|
|
12
13
|
}
|
|
13
|
-
declare const SmallCheckout: ({ pricePerKg, currency, batchId, initialContributionValue, checkoutText, title, subtitle, button, }: SmallCheckoutProps) => React.JSX.Element;
|
|
14
|
+
declare const SmallCheckout: ({ pricePerKg, currency, batchId, initialContributionValue, taxInPercent, checkoutText, title, subtitle, button, }: SmallCheckoutProps) => React.JSX.Element;
|
|
14
15
|
export default SmallCheckout;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
declare const messagesDe: {
|
|
2
|
+
'portfolio.smallCheckout.price.taxNotIncluded': string;
|
|
3
|
+
'portfolio.smallCheckout.price.taxIncluded': string;
|
|
2
4
|
'portfolio.smallCheckout.contributionValueCurrency.label.CHF': string;
|
|
3
5
|
'portfolio.smallCheckout.contributionValueCurrency.label.EUR': string;
|
|
4
6
|
'portfolio.smallCheckout.contributionValueCurrency.unit.EUR': string;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
declare const messagesEn: {
|
|
2
|
+
'portfolio.smallCheckout.price.taxNotIncluded': string;
|
|
3
|
+
'portfolio.smallCheckout.price.taxIncluded': string;
|
|
2
4
|
'portfolio.smallCheckout.contributionValueCurrency.label.CHF': string;
|
|
3
5
|
'portfolio.smallCheckout.contributionValueCurrency.label.EUR': string;
|
|
4
6
|
'portfolio.smallCheckout.contributionValueCurrency.unit.EUR': string;
|
|
@@ -16,6 +16,8 @@ declare const rootMessagesDe: {
|
|
|
16
16
|
'sections.shopCheckout.contributionValue.validation.tooHigh': string;
|
|
17
17
|
'sections.shopCheckout.summary.kg': string;
|
|
18
18
|
'sections.shopCheckout.summary.price': string;
|
|
19
|
+
'sections.shopCheckout.summary.taxNotIncluded': string;
|
|
20
|
+
'sections.shopCheckout.summary.taxIncluded': string;
|
|
19
21
|
'sections.shopCheckout.submit': string;
|
|
20
22
|
'sections.projectsMap.link.text': string;
|
|
21
23
|
'sections.projectFacts.projectInfo.value': string;
|
|
@@ -28,6 +30,8 @@ declare const rootMessagesDe: {
|
|
|
28
30
|
'sections.cta.backgroundShapes': string;
|
|
29
31
|
'sections.cta.backgroundShapesLight': string;
|
|
30
32
|
'sections.comparison.backgroundShapes': string;
|
|
33
|
+
'portfolio.smallCheckout.price.taxNotIncluded': string;
|
|
34
|
+
'portfolio.smallCheckout.price.taxIncluded': string;
|
|
31
35
|
'portfolio.smallCheckout.contributionValueCurrency.label.CHF': string;
|
|
32
36
|
'portfolio.smallCheckout.contributionValueCurrency.label.EUR': string;
|
|
33
37
|
'portfolio.smallCheckout.contributionValueCurrency.unit.EUR': string;
|
|
@@ -16,6 +16,8 @@ declare const rootMessagesEn: {
|
|
|
16
16
|
'sections.shopCheckout.contributionValue.validation.tooHigh': string;
|
|
17
17
|
'sections.shopCheckout.summary.kg': string;
|
|
18
18
|
'sections.shopCheckout.summary.price': string;
|
|
19
|
+
'sections.shopCheckout.summary.price.taxNotIncluded': string;
|
|
20
|
+
'sections.shopCheckout.summary.price.taxIncluded': string;
|
|
19
21
|
'sections.shopCheckout.submit': string;
|
|
20
22
|
'sections.projectsMap.link.text': string;
|
|
21
23
|
'sections.projectFacts.projectInfo.value': string;
|
|
@@ -28,6 +30,8 @@ declare const rootMessagesEn: {
|
|
|
28
30
|
'sections.cta.backgroundShapesDark': string;
|
|
29
31
|
'sections.cta.backgroundShapesLight': string;
|
|
30
32
|
'sections.comparison.backgroundShapes': string;
|
|
33
|
+
'portfolio.smallCheckout.price.taxNotIncluded': string;
|
|
34
|
+
'portfolio.smallCheckout.price.taxIncluded': string;
|
|
31
35
|
'portfolio.smallCheckout.contributionValueCurrency.label.CHF': string;
|
|
32
36
|
'portfolio.smallCheckout.contributionValueCurrency.label.EUR': string;
|
|
33
37
|
'portfolio.smallCheckout.contributionValueCurrency.unit.EUR': string;
|
|
@@ -5,3 +5,4 @@ export declare const WithTagline: import("@storybook/types").AnnotatedStoryFn<im
|
|
|
5
5
|
export declare const WithText: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./ShopCheckout").ShopCheckoutProps>;
|
|
6
6
|
export declare const WithBadge: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./ShopCheckout").ShopCheckoutProps>;
|
|
7
7
|
export declare const WithCHF: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./ShopCheckout").ShopCheckoutProps>;
|
|
8
|
+
export declare const WithTaxMessage: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./ShopCheckout").ShopCheckoutProps>;
|
|
@@ -10,6 +10,8 @@ declare const messagesDe: {
|
|
|
10
10
|
'sections.shopCheckout.contributionValue.validation.tooHigh': string;
|
|
11
11
|
'sections.shopCheckout.summary.kg': string;
|
|
12
12
|
'sections.shopCheckout.summary.price': string;
|
|
13
|
+
'sections.shopCheckout.summary.taxNotIncluded': string;
|
|
14
|
+
'sections.shopCheckout.summary.taxIncluded': string;
|
|
13
15
|
'sections.shopCheckout.submit': string;
|
|
14
16
|
};
|
|
15
17
|
export default messagesDe;
|
|
@@ -10,6 +10,8 @@ declare const messagesEn: {
|
|
|
10
10
|
'sections.shopCheckout.contributionValue.validation.tooHigh': string;
|
|
11
11
|
'sections.shopCheckout.summary.kg': string;
|
|
12
12
|
'sections.shopCheckout.summary.price': string;
|
|
13
|
+
'sections.shopCheckout.summary.price.taxNotIncluded': string;
|
|
14
|
+
'sections.shopCheckout.summary.price.taxIncluded': string;
|
|
13
15
|
'sections.shopCheckout.submit': string;
|
|
14
16
|
};
|
|
15
17
|
export default messagesEn;
|
|
@@ -2236,6 +2236,8 @@ var messagesDe$5 = {
|
|
|
2236
2236
|
};
|
|
2237
2237
|
|
|
2238
2238
|
var messagesDe$4 = {
|
|
2239
|
+
'portfolio.smallCheckout.price.taxNotIncluded': 'ohne Steuern',
|
|
2240
|
+
'portfolio.smallCheckout.price.taxIncluded': 'Preis inklusive Steuern: {number}',
|
|
2239
2241
|
'portfolio.smallCheckout.contributionValueCurrency.label.CHF': 'Geben Sie den Beitrag in Fr. ein',
|
|
2240
2242
|
'portfolio.smallCheckout.contributionValueCurrency.label.EUR': 'Geben Sie den Beitrag in € ein',
|
|
2241
2243
|
'portfolio.smallCheckout.contributionValueCurrency.unit.EUR': '€',
|
|
@@ -2263,6 +2265,8 @@ var messagesDe$3 = {
|
|
|
2263
2265
|
'sections.shopCheckout.contributionValue.validation.tooHigh': 'Für größere Einkäufe kontaktieren Sie bitte unser Verkaufsteam über office@tree.ly',
|
|
2264
2266
|
'sections.shopCheckout.summary.kg': 'Menge',
|
|
2265
2267
|
'sections.shopCheckout.summary.price': 'Preis',
|
|
2268
|
+
'sections.shopCheckout.summary.taxNotIncluded': 'ohne Steuern',
|
|
2269
|
+
'sections.shopCheckout.summary.taxIncluded': 'Preis inklusive Steuern: {number}',
|
|
2266
2270
|
'sections.shopCheckout.submit': 'Kaufen'
|
|
2267
2271
|
};
|
|
2268
2272
|
|
|
@@ -2351,6 +2355,8 @@ var messagesEn$3 = {
|
|
|
2351
2355
|
};
|
|
2352
2356
|
|
|
2353
2357
|
var messagesEn$2 = {
|
|
2358
|
+
'portfolio.smallCheckout.price.taxNotIncluded': 'not including tax',
|
|
2359
|
+
'portfolio.smallCheckout.price.taxIncluded': 'Price including tax: {number}',
|
|
2354
2360
|
'portfolio.smallCheckout.contributionValueCurrency.label.CHF': 'Contribution Amount in CHF',
|
|
2355
2361
|
'portfolio.smallCheckout.contributionValueCurrency.label.EUR': 'Contribution Amount in €',
|
|
2356
2362
|
'portfolio.smallCheckout.contributionValueCurrency.unit.EUR': '€',
|
|
@@ -2378,6 +2384,8 @@ var messagesEn$1 = {
|
|
|
2378
2384
|
'sections.shopCheckout.contributionValue.validation.tooHigh': 'For bigger purchases please contact our sales team via office@tree.ly',
|
|
2379
2385
|
'sections.shopCheckout.summary.kg': 'Quantity',
|
|
2380
2386
|
'sections.shopCheckout.summary.price': 'Price',
|
|
2387
|
+
'sections.shopCheckout.summary.price.taxNotIncluded': 'not including tax',
|
|
2388
|
+
'sections.shopCheckout.summary.price.taxIncluded': 'Price including tax: {number}',
|
|
2381
2389
|
'sections.shopCheckout.submit': 'Checkout'
|
|
2382
2390
|
};
|
|
2383
2391
|
|
|
@@ -4047,7 +4055,10 @@ var ShopCheckout = function ShopCheckout(_ref) {
|
|
|
4047
4055
|
}) + "/" + formatNumber(100, {
|
|
4048
4056
|
style: 'unit',
|
|
4049
4057
|
unit: 'kilogram'
|
|
4050
|
-
}) + " CO\u2082"
|
|
4058
|
+
}) + " CO\u2082",
|
|
4059
|
+
caption: formatMessage({
|
|
4060
|
+
id: 'sections.shopCheckout.summary.price.taxNotIncluded'
|
|
4061
|
+
})
|
|
4051
4062
|
}), React__default.default.createElement(boemly.Spacer, {
|
|
4052
4063
|
height: "6"
|
|
4053
4064
|
}), React__default.default.createElement(boemly.Divider, null), React__default.default.createElement(boemly.Spacer, {
|
|
@@ -4063,6 +4074,7 @@ var ShopCheckout = function ShopCheckout(_ref) {
|
|
|
4063
4074
|
touched = _ref3.touched,
|
|
4064
4075
|
handleSubmit = _ref3.handleSubmit,
|
|
4065
4076
|
values = _ref3.values;
|
|
4077
|
+
var summaryPrice = Math.floor(values.contributionValue / slice.pricePerKg) * slice.pricePerKg;
|
|
4066
4078
|
return React__default.default.createElement(formik.Form, {
|
|
4067
4079
|
onSubmit: handleSubmit
|
|
4068
4080
|
}, React__default.default.createElement(boemly.Box, {
|
|
@@ -4106,12 +4118,22 @@ var ShopCheckout = function ShopCheckout(_ref) {
|
|
|
4106
4118
|
label: formatMessage({
|
|
4107
4119
|
id: 'sections.shopCheckout.summary.price'
|
|
4108
4120
|
}),
|
|
4109
|
-
number: formatNumber(
|
|
4121
|
+
number: formatNumber(summaryPrice, {
|
|
4110
4122
|
style: 'currency',
|
|
4111
4123
|
currency: slice.currency,
|
|
4112
4124
|
minimumFractionDigits: 2,
|
|
4113
4125
|
maximumFractionDigits: 2
|
|
4114
|
-
})
|
|
4126
|
+
}),
|
|
4127
|
+
caption: slice.taxInPercent && slice.taxInPercent > 0 && summaryPrice > 0 ? formatMessage({
|
|
4128
|
+
id: 'sections.shopCheckout.summary.price.taxIncluded'
|
|
4129
|
+
}, {
|
|
4130
|
+
number: formatNumber(summaryPrice + summaryPrice * (slice.taxInPercent / 100), {
|
|
4131
|
+
style: 'currency',
|
|
4132
|
+
currency: slice.currency,
|
|
4133
|
+
minimumFractionDigits: 2,
|
|
4134
|
+
maximumFractionDigits: 2
|
|
4135
|
+
})
|
|
4136
|
+
}) : ''
|
|
4115
4137
|
})), React__default.default.createElement(boemly.Spacer, {
|
|
4116
4138
|
height: "6"
|
|
4117
4139
|
}), React__default.default.createElement(boemly.Button, {
|
|
@@ -4341,6 +4363,7 @@ var SmallCheckout = function SmallCheckout(_ref) {
|
|
|
4341
4363
|
currency = _ref.currency,
|
|
4342
4364
|
batchId = _ref.batchId,
|
|
4343
4365
|
initialContributionValue = _ref.initialContributionValue,
|
|
4366
|
+
taxInPercent = _ref.taxInPercent,
|
|
4344
4367
|
checkoutText = _ref.checkoutText,
|
|
4345
4368
|
title = _ref.title,
|
|
4346
4369
|
subtitle = _ref.subtitle,
|
|
@@ -4351,6 +4374,9 @@ var SmallCheckout = function SmallCheckout(_ref) {
|
|
|
4351
4374
|
locale = _useContext.locale;
|
|
4352
4375
|
var _useRouter = router.useRouter(),
|
|
4353
4376
|
push = _useRouter.push;
|
|
4377
|
+
var _useState = React.useState(initialContributionValue),
|
|
4378
|
+
contributionValue = _useState[0],
|
|
4379
|
+
setContributionValue = _useState[1];
|
|
4354
4380
|
var validateForm = React.useCallback(function (values) {
|
|
4355
4381
|
var errors = {};
|
|
4356
4382
|
var value = parseInt(values.contributionValueCurrency);
|
|
@@ -4400,7 +4426,7 @@ var SmallCheckout = function SmallCheckout(_ref) {
|
|
|
4400
4426
|
padding: "6",
|
|
4401
4427
|
direction: "column"
|
|
4402
4428
|
}, React__default.default.createElement(boemly.Flex, {
|
|
4403
|
-
gap: "
|
|
4429
|
+
gap: "2",
|
|
4404
4430
|
alignItems: "end",
|
|
4405
4431
|
mb: "6"
|
|
4406
4432
|
}, React__default.default.createElement(boemly.Text, {
|
|
@@ -4418,6 +4444,10 @@ var SmallCheckout = function SmallCheckout(_ref) {
|
|
|
4418
4444
|
currency: currency,
|
|
4419
4445
|
maximumFractionDigits: 0
|
|
4420
4446
|
}))
|
|
4447
|
+
})), React__default.default.createElement(boemly.Text, {
|
|
4448
|
+
size: "smLowNormal"
|
|
4449
|
+
}, React__default.default.createElement(reactIntl.FormattedMessage, {
|
|
4450
|
+
id: "portfolio.smallCheckout.price.taxNotIncluded"
|
|
4421
4451
|
}))), React__default.default.createElement(formik.Formik, {
|
|
4422
4452
|
initialValues: {
|
|
4423
4453
|
contributionValueCurrency: initialContributionValue.toString(),
|
|
@@ -4448,6 +4478,7 @@ var SmallCheckout = function SmallCheckout(_ref) {
|
|
|
4448
4478
|
value: field.value || '',
|
|
4449
4479
|
onChange: function onChange(e) {
|
|
4450
4480
|
var value = e.target.valueAsNumber;
|
|
4481
|
+
setContributionValue(value);
|
|
4451
4482
|
setValues({
|
|
4452
4483
|
contributionValueCurrency: value.toString(),
|
|
4453
4484
|
contributionValueKgs: (value / pricePerKg / 1000).toString()
|
|
@@ -4494,7 +4525,18 @@ var SmallCheckout = function SmallCheckout(_ref) {
|
|
|
4494
4525
|
isInvalid: !!errors.contributionValueKgs && touched.contributionValueKgs,
|
|
4495
4526
|
errorMessage: errors.contributionValueKgs
|
|
4496
4527
|
});
|
|
4497
|
-
}))), React__default.default.createElement(boemly.
|
|
4528
|
+
}))), contributionValue > 0 && taxInPercent && taxInPercent > 0 && React__default.default.createElement(boemly.Text, {
|
|
4529
|
+
size: "smLowNormal",
|
|
4530
|
+
mt: "2"
|
|
4531
|
+
}, formatMessage({
|
|
4532
|
+
id: 'portfolio.smallCheckout.price.taxIncluded'
|
|
4533
|
+
}, {
|
|
4534
|
+
number: formatNumber(contributionValue + contributionValue * taxInPercent / 100, {
|
|
4535
|
+
style: 'currency',
|
|
4536
|
+
currency: currency,
|
|
4537
|
+
maximumFractionDigits: 2
|
|
4538
|
+
})
|
|
4539
|
+
})), React__default.default.createElement(boemly.Spacer, {
|
|
4498
4540
|
height: "4"
|
|
4499
4541
|
}), React__default.default.createElement(boemly.Button, {
|
|
4500
4542
|
type: "submit",
|
|
@@ -4812,7 +4854,8 @@ var ProjectFacts = function ProjectFacts(_ref) {
|
|
|
4812
4854
|
pricePerKg: slice.pricePerKg,
|
|
4813
4855
|
title: slice.customTitle,
|
|
4814
4856
|
subtitle: slice.customSubtitle,
|
|
4815
|
-
button: slice.customButton
|
|
4857
|
+
button: slice.customButton,
|
|
4858
|
+
taxInPercent: slice.taxInPercent
|
|
4816
4859
|
}) : (slice.contactTitle || slice.contactText || slice.contactButton || slice.contactAvatar) && React__default.default.createElement(Contact, {
|
|
4817
4860
|
title: slice.contactTitle,
|
|
4818
4861
|
text: slice.contactText,
|