@treely/strapi-slices 5.8.1 → 5.10.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.
Files changed (32) hide show
  1. package/dist/components/PreviewAlert/PreviewAlert.d.ts +2 -0
  2. package/dist/components/PreviewAlert/PreviewAlert.stories.d.ts +3 -0
  3. package/dist/components/PreviewAlert/index.d.ts +1 -0
  4. package/dist/components/portfolio/SmallCheckout/SmallCheckout.d.ts +2 -1
  5. package/dist/components/portfolio/SmallCheckout/messages.de.d.ts +2 -0
  6. package/dist/components/portfolio/SmallCheckout/messages.en.d.ts +2 -0
  7. package/dist/index.d.ts +1 -0
  8. package/dist/rootMessages.de.d.ts +2 -0
  9. package/dist/rootMessages.en.d.ts +2 -0
  10. package/dist/slices/Hero/Hero.d.ts +2 -2
  11. package/dist/slices/IconGrid/IconGrid.d.ts +2 -2
  12. package/dist/slices/ProjectFacts/ProjectFacts.d.ts +1 -0
  13. package/dist/strapi-slices.cjs.development.js +41 -4
  14. package/dist/strapi-slices.cjs.development.js.map +1 -1
  15. package/dist/strapi-slices.cjs.production.min.js +1 -1
  16. package/dist/strapi-slices.cjs.production.min.js.map +1 -1
  17. package/dist/strapi-slices.esm.js +42 -6
  18. package/dist/strapi-slices.esm.js.map +1 -1
  19. package/package.json +2 -2
  20. package/src/components/PreviewAlert/PreviewAlert.stories.tsx +12 -0
  21. package/src/components/PreviewAlert/PreviewAlert.test.tsx +15 -0
  22. package/src/components/PreviewAlert/PreviewAlert.tsx +10 -0
  23. package/src/components/PreviewAlert/index.ts +1 -0
  24. package/src/components/portfolio/SmallCheckout/SmallCheckout.test.tsx +7 -0
  25. package/src/components/portfolio/SmallCheckout/SmallCheckout.tsx +31 -2
  26. package/src/components/portfolio/SmallCheckout/messages.de.ts +4 -0
  27. package/src/components/portfolio/SmallCheckout/messages.en.ts +3 -0
  28. package/src/index.tsx +1 -0
  29. package/src/slices/Hero/Hero.tsx +1 -1
  30. package/src/slices/IconGrid/IconGrid.tsx +1 -1
  31. package/src/slices/ProjectFacts/ProjectFacts.stories.tsx +1 -0
  32. package/src/slices/ProjectFacts/ProjectFacts.tsx +2 -0
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const PreviewAlert: () => JSX.Element;
@@ -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';
@@ -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;
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, };
@@ -28,6 +28,8 @@ declare const rootMessagesDe: {
28
28
  'sections.cta.backgroundShapes': string;
29
29
  'sections.cta.backgroundShapesLight': string;
30
30
  'sections.comparison.backgroundShapes': string;
31
+ 'portfolio.smallCheckout.price.taxNotIncluded': string;
32
+ 'portfolio.smallCheckout.price.taxIncluded': string;
31
33
  'portfolio.smallCheckout.contributionValueCurrency.label.CHF': string;
32
34
  'portfolio.smallCheckout.contributionValueCurrency.label.EUR': string;
33
35
  'portfolio.smallCheckout.contributionValueCurrency.unit.EUR': string;
@@ -28,6 +28,8 @@ declare const rootMessagesEn: {
28
28
  'sections.cta.backgroundShapesDark': string;
29
29
  'sections.cta.backgroundShapesLight': string;
30
30
  'sections.comparison.backgroundShapes': string;
31
+ 'portfolio.smallCheckout.price.taxNotIncluded': string;
32
+ 'portfolio.smallCheckout.price.taxIncluded': string;
31
33
  'portfolio.smallCheckout.contributionValueCurrency.label.CHF': string;
32
34
  'portfolio.smallCheckout.contributionValueCurrency.label.EUR': string;
33
35
  'portfolio.smallCheckout.contributionValueCurrency.unit.EUR': string;
@@ -1,4 +1,4 @@
1
- import React from 'react';
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: React.FC<HeroProps>;
17
+ export declare const Hero: ({ slice }: HeroProps) => JSX.Element;
@@ -1,4 +1,4 @@
1
- import React from 'react';
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: React.FC<IconGridProps>;
18
+ export declare const IconGrid: ({ slice }: IconGridProps) => JSX.Element;
@@ -9,6 +9,7 @@ export interface ProjectFactsProps {
9
9
  batchId?: string;
10
10
  currency?: 'EUR' | 'CHF';
11
11
  pricePerKg?: number;
12
+ taxInPercent?: number;
12
13
  initialContributionValue?: number;
13
14
  checkoutText?: string;
14
15
  customTitle?: string;
@@ -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,
@@ -2225,6 +2236,8 @@ var messagesDe$5 = {
2225
2236
  };
2226
2237
 
2227
2238
  var messagesDe$4 = {
2239
+ 'portfolio.smallCheckout.price.taxNotIncluded': 'ohne Steuern',
2240
+ 'portfolio.smallCheckout.price.taxIncluded': 'Preis inklusive Steuern: {number}',
2228
2241
  'portfolio.smallCheckout.contributionValueCurrency.label.CHF': 'Geben Sie den Beitrag in Fr. ein',
2229
2242
  'portfolio.smallCheckout.contributionValueCurrency.label.EUR': 'Geben Sie den Beitrag in € ein',
2230
2243
  'portfolio.smallCheckout.contributionValueCurrency.unit.EUR': '€',
@@ -2340,6 +2353,8 @@ var messagesEn$3 = {
2340
2353
  };
2341
2354
 
2342
2355
  var messagesEn$2 = {
2356
+ 'portfolio.smallCheckout.price.taxNotIncluded': 'not including tax',
2357
+ 'portfolio.smallCheckout.price.taxIncluded': 'Price including tax: {number}',
2343
2358
  'portfolio.smallCheckout.contributionValueCurrency.label.CHF': 'Contribution Amount in CHF',
2344
2359
  'portfolio.smallCheckout.contributionValueCurrency.label.EUR': 'Contribution Amount in €',
2345
2360
  'portfolio.smallCheckout.contributionValueCurrency.unit.EUR': '€',
@@ -4330,6 +4345,7 @@ var SmallCheckout = function SmallCheckout(_ref) {
4330
4345
  currency = _ref.currency,
4331
4346
  batchId = _ref.batchId,
4332
4347
  initialContributionValue = _ref.initialContributionValue,
4348
+ taxInPercent = _ref.taxInPercent,
4333
4349
  checkoutText = _ref.checkoutText,
4334
4350
  title = _ref.title,
4335
4351
  subtitle = _ref.subtitle,
@@ -4340,6 +4356,9 @@ var SmallCheckout = function SmallCheckout(_ref) {
4340
4356
  locale = _useContext.locale;
4341
4357
  var _useRouter = router.useRouter(),
4342
4358
  push = _useRouter.push;
4359
+ var _useState = React.useState(initialContributionValue),
4360
+ contributionValue = _useState[0],
4361
+ setContributionValue = _useState[1];
4343
4362
  var validateForm = React.useCallback(function (values) {
4344
4363
  var errors = {};
4345
4364
  var value = parseInt(values.contributionValueCurrency);
@@ -4389,7 +4408,7 @@ var SmallCheckout = function SmallCheckout(_ref) {
4389
4408
  padding: "6",
4390
4409
  direction: "column"
4391
4410
  }, React__default.default.createElement(boemly.Flex, {
4392
- gap: "1",
4411
+ gap: "2",
4393
4412
  alignItems: "end",
4394
4413
  mb: "6"
4395
4414
  }, React__default.default.createElement(boemly.Text, {
@@ -4407,6 +4426,10 @@ var SmallCheckout = function SmallCheckout(_ref) {
4407
4426
  currency: currency,
4408
4427
  maximumFractionDigits: 0
4409
4428
  }))
4429
+ })), React__default.default.createElement(boemly.Text, {
4430
+ size: "smLowNormal"
4431
+ }, React__default.default.createElement(reactIntl.FormattedMessage, {
4432
+ id: "portfolio.smallCheckout.price.taxNotIncluded"
4410
4433
  }))), React__default.default.createElement(formik.Formik, {
4411
4434
  initialValues: {
4412
4435
  contributionValueCurrency: initialContributionValue.toString(),
@@ -4437,6 +4460,7 @@ var SmallCheckout = function SmallCheckout(_ref) {
4437
4460
  value: field.value || '',
4438
4461
  onChange: function onChange(e) {
4439
4462
  var value = e.target.valueAsNumber;
4463
+ setContributionValue(value);
4440
4464
  setValues({
4441
4465
  contributionValueCurrency: value.toString(),
4442
4466
  contributionValueKgs: (value / pricePerKg / 1000).toString()
@@ -4483,7 +4507,18 @@ var SmallCheckout = function SmallCheckout(_ref) {
4483
4507
  isInvalid: !!errors.contributionValueKgs && touched.contributionValueKgs,
4484
4508
  errorMessage: errors.contributionValueKgs
4485
4509
  });
4486
- }))), React__default.default.createElement(boemly.Spacer, {
4510
+ }))), contributionValue > 0 && taxInPercent && taxInPercent > 0 && React__default.default.createElement(boemly.Text, {
4511
+ size: "smLowNormal",
4512
+ mt: "2"
4513
+ }, formatMessage({
4514
+ id: 'portfolio.smallCheckout.price.taxIncluded'
4515
+ }, {
4516
+ number: formatNumber(contributionValue + contributionValue * taxInPercent / 100, {
4517
+ style: 'currency',
4518
+ currency: currency,
4519
+ maximumFractionDigits: 2
4520
+ })
4521
+ })), React__default.default.createElement(boemly.Spacer, {
4487
4522
  height: "4"
4488
4523
  }), React__default.default.createElement(boemly.Button, {
4489
4524
  type: "submit",
@@ -4801,7 +4836,8 @@ var ProjectFacts = function ProjectFacts(_ref) {
4801
4836
  pricePerKg: slice.pricePerKg,
4802
4837
  title: slice.customTitle,
4803
4838
  subtitle: slice.customSubtitle,
4804
- button: slice.customButton
4839
+ button: slice.customButton,
4840
+ taxInPercent: slice.taxInPercent
4805
4841
  }) : (slice.contactTitle || slice.contactText || slice.contactButton || slice.contactAvatar) && React__default.default.createElement(Contact, {
4806
4842
  title: slice.contactTitle,
4807
4843
  text: slice.contactText,
@@ -5581,6 +5617,7 @@ var SliceRenderer = function SliceRenderer(_ref) {
5581
5617
  }));
5582
5618
  };
5583
5619
 
5620
+ exports.PreviewAlert = PreviewAlert;
5584
5621
  exports.SEOTags = SEOTags;
5585
5622
  exports.SliceRenderer = SliceRenderer;
5586
5623
  exports.getPortfolioProjects = getPortfolioProjects;