@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.
@@ -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';
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, };
@@ -0,0 +1,5 @@
1
+ interface SmallCheckoutForm {
2
+ contributionValueCurrency: string;
3
+ contributionValueKgs: string;
4
+ }
5
+ export default SmallCheckoutForm;
@@ -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;
@@ -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
- if (!values.contributionValueCurrency) {
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 (values.contributionValueCurrency < MINIMUM_CONTRIBUTION_VALUE_IN_MONEY) {
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 (values.contributionValueCurrency > MAXIMUM_CONTRIBUTION_VALUE_IN_MONEY) {
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: e.target.valueAsNumber,
4440
- contributionValueKgs: e.target.valueAsNumber / pricePerKg / 1000
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 || 0;
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;