@treely/strapi-slices 7.2.0 → 7.4.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 (56) hide show
  1. package/README.md +2 -1
  2. package/dist/__mocks__/swr/index.d.ts +6 -0
  3. package/dist/__mocks__/swr/infinite.d.ts +4 -0
  4. package/dist/components/EventCard/EventCard.d.ts +6 -0
  5. package/dist/components/EventCard/index.d.ts +2 -0
  6. package/dist/components/EventCard/messages.de.d.ts +15 -0
  7. package/dist/components/EventCard/messages.en.d.ts +15 -0
  8. package/dist/components/StrapiLinkButton/StrapiLinkButton.d.ts +1 -0
  9. package/dist/index.d.ts +2 -1
  10. package/dist/models/SWRData.d.ts +5 -0
  11. package/dist/models/hooks/UseInfiniteDataHookProps.d.ts +11 -0
  12. package/dist/models/hooks/useEvents.d.ts +9 -0
  13. package/dist/models/strapi/StrapiEvent.d.ts +48 -0
  14. package/dist/rootMessages.de.d.ts +21 -0
  15. package/dist/rootMessages.en.d.ts +21 -0
  16. package/dist/slices/Events/Events.d.ts +11 -0
  17. package/dist/slices/Events/Events.stories.d.ts +4 -0
  18. package/dist/slices/Events/index.d.ts +2 -0
  19. package/dist/slices/Events/messages.de.d.ts +12 -0
  20. package/dist/slices/Events/messages.en.d.ts +12 -0
  21. package/dist/strapi-slices.cjs.development.js +822 -43
  22. package/dist/strapi-slices.cjs.development.js.map +1 -1
  23. package/dist/strapi-slices.cjs.production.min.js +1 -1
  24. package/dist/strapi-slices.cjs.production.min.js.map +1 -1
  25. package/dist/strapi-slices.esm.js +823 -45
  26. package/dist/strapi-slices.esm.js.map +1 -1
  27. package/dist/test/strapiMocks/strapiEventMock.d.ts +3 -0
  28. package/dist/utils/getCountryFlag.d.ts +2 -0
  29. package/dist/utils/getMessages.d.ts +42 -0
  30. package/package.json +16 -2
  31. package/src/components/ContextProvider/ContextProvider.tsx +32 -4
  32. package/src/components/CustomerQuoteCard/CustomerQuoteCard.tsx +1 -0
  33. package/src/components/EventCard/EventCard.test.tsx +127 -0
  34. package/src/components/EventCard/EventCard.tsx +313 -0
  35. package/src/components/EventCard/index.ts +3 -0
  36. package/src/components/EventCard/messages.de.ts +16 -0
  37. package/src/components/EventCard/messages.en.ts +16 -0
  38. package/src/components/SliceRenderer/SliceRenderer.tsx +5 -0
  39. package/src/components/StrapiLinkButton/StrapiLinkButton.tsx +1 -0
  40. package/src/index.tsx +2 -0
  41. package/src/models/SWRData.ts +6 -0
  42. package/src/models/hooks/UseInfiniteDataHookProps.tsx +13 -0
  43. package/src/models/hooks/useEvents.ts +46 -0
  44. package/src/models/strapi/StrapiEvent.ts +51 -0
  45. package/src/rootMessages.de.ts +4 -0
  46. package/src/rootMessages.en.ts +4 -0
  47. package/src/slices/Events/Events.stories.tsx +36 -0
  48. package/src/slices/Events/Events.test.tsx +350 -0
  49. package/src/slices/Events/Events.tsx +473 -0
  50. package/src/slices/Events/index.ts +3 -0
  51. package/src/slices/Events/messages.de.ts +14 -0
  52. package/src/slices/Events/messages.en.ts +13 -0
  53. package/src/test/strapiMocks/strapiEventMock.ts +57 -0
  54. package/src/utils/getCountryFlag.test.ts +9 -0
  55. package/src/utils/getCountryFlag.ts +6 -0
  56. package/src/utils/strapiMediaUrl.ts +1 -2
package/README.md CHANGED
@@ -39,7 +39,8 @@ npm run build
39
39
  npm pack
40
40
  ```
41
41
 
42
- Go to the project which uses the strapi-slices package and remove the `node_modules` and the `.next` folder before installing the package there:
42
+ Go to the project which uses the strapi-slices package and remove the
43
+ `node_modules` and the `.next` folder before installing the package there:
43
44
 
44
45
  ```bash
45
46
  cd ../path/to/your/project
@@ -0,0 +1,6 @@
1
+ /// <reference types="jest" />
2
+ export declare const useSwrConfigMutateMock: jest.Mock<any, any, any>;
3
+ declare const useSWR: jest.Mock<any, any, any>;
4
+ export declare const useSWRConfig: jest.Mock<any, any, any>;
5
+ export declare const mutate: jest.Mock<any, any, any>;
6
+ export default useSWR;
@@ -0,0 +1,4 @@
1
+ /// <reference types="jest" />
2
+ declare const useSWRInfinite: jest.Mock<any, any, any>;
3
+ export declare const mutate: jest.Mock<any, any, any>;
4
+ export default useSWRInfinite;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import StrapiEvent from '../../models/strapi/StrapiEvent';
3
+ export interface EventCardProps {
4
+ event: StrapiEvent;
5
+ }
6
+ export declare const EventCard: ({ event }: EventCardProps) => JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { EventCard } from './EventCard';
2
+ export default EventCard;
@@ -0,0 +1,15 @@
1
+ declare const messagesDe: {
2
+ 'sections.eventCard.recommendedEvent': string;
3
+ 'sections.eventCard.buttonShowMore': string;
4
+ 'sections.eventCard.buttonShowLess': string;
5
+ 'sections.eventCard.eventType.conference': string;
6
+ 'sections.eventCard.eventType.webinar': string;
7
+ 'sections.eventCard.eventType.forestwalk': string;
8
+ 'sections.eventCard.eventType.partnerevent': string;
9
+ 'sections.eventCard.eventType.lunch&learn': string;
10
+ 'sections.eventCard.eventType.fair': string;
11
+ 'sections.eventCard.eventType.festival': string;
12
+ 'sections.eventCard.eventType.roadshow': string;
13
+ 'sections.eventCard.eventType.meetup': string;
14
+ };
15
+ export default messagesDe;
@@ -0,0 +1,15 @@
1
+ declare const messagesEn: {
2
+ 'sections.eventCard.recommendedEvent': string;
3
+ 'sections.eventCard.buttonShowMore': string;
4
+ 'sections.eventCard.buttonShowLess': string;
5
+ 'sections.eventCard.eventType.conference': string;
6
+ 'sections.eventCard.eventType.webinar': string;
7
+ 'sections.eventCard.eventType.forestwalk': string;
8
+ 'sections.eventCard.eventType.partnerevent': string;
9
+ 'sections.eventCard.eventType.lunch&learn': string;
10
+ 'sections.eventCard.eventType.fair': string;
11
+ 'sections.eventCard.eventType.festival': string;
12
+ 'sections.eventCard.eventType.roadshow': string;
13
+ 'sections.eventCard.eventType.meetup': string;
14
+ };
15
+ export default messagesEn;
@@ -14,5 +14,6 @@ export interface StrapiLinkButtonProps {
14
14
  mx?: any;
15
15
  my?: any;
16
16
  background?: string;
17
+ width?: string;
17
18
  }
18
19
  export declare const StrapiLinkButton: React.FC<StrapiLinkButtonProps>;
package/dist/index.d.ts CHANGED
@@ -12,6 +12,7 @@ import StrapiContactArea from './models/strapi/StrapiContactArea';
12
12
  import StrapiCustomerStory from './models/strapi/StrapiCustomerStory';
13
13
  import StrapiCustomerStoryProps from './models/strapi/StrapiCustomerStoryProps';
14
14
  import StrapiDefaultHeader from './models/strapi/StrapiDefaultHeader';
15
+ import StrapiEvent from './models/strapi/StrapiEvent';
15
16
  import StrapiGlobal from './models/strapi/StrapiGlobal';
16
17
  import StrapiGlossaryItem from './models/strapi/StrapiGlossaryItem';
17
18
  import StrapiHeroCard from './models/strapi/StrapiHeroCard';
@@ -57,4 +58,4 @@ export * from './components/PreviewAlert';
57
58
  export * from './components/SEOTags';
58
59
  export * from './components/SliceRenderer';
59
60
  export { mergeGlobalAndStrapiBlogPostData, mergeGlobalAndStrapiCustomerStoryData, mergeGlobalAndStrapiPageData, mergeGlobalAndStrapiProjectData, strapiLinkUrl, strapiMediaUrl, getAllSlugsFromStrapi, getPortfolioProjects, getStrapiCollectionType, getStrapiSingleType, };
60
- export type { IStrapi, IStrapiData, IStrapiResponse, StrapiAuthor, StrapiAvatarWithName, StrapiBanner, StrapiBlogPost, StrapiBlogPostProps, StrapiButtonWithVariant, StrapiCategory, StrapiContactArea, StrapiCustomerStory, StrapiCustomerStoryProps, StrapiDefaultHeader, StrapiGlobal, StrapiGlossaryItem, StrapiHeroCard, StrapiImage, StrapiImageFormat, StrapiImageWithLink, StrapiLink, StrapiLinkList, StrapiLinkPage, StrapiLinkWithIcon, StrapiLocalization, StrapiMedia, StrapiMetadata, StrapiNavMenu, StrapiPage, StrapiPageProps, StrapiPortfolio, StrapiPortfolioCard, StrapiProject, StrapiProjectCard, StrapiProjectProps, StrapiQuoteCard, StrapiShapesCard, StrapiTextCardWithIcons, StrapiTopBanner, HeaderType, Image, Locale, PageMetadata, PageProps, PortfolioProject, };
61
+ export type { IStrapi, IStrapiData, IStrapiResponse, StrapiAuthor, StrapiAvatarWithName, StrapiBanner, StrapiBlogPost, StrapiBlogPostProps, StrapiButtonWithVariant, StrapiCategory, StrapiContactArea, StrapiCustomerStory, StrapiCustomerStoryProps, StrapiDefaultHeader, StrapiEvent, StrapiGlobal, StrapiGlossaryItem, StrapiHeroCard, StrapiImage, StrapiImageFormat, StrapiImageWithLink, StrapiLink, StrapiLinkList, StrapiLinkPage, StrapiLinkWithIcon, StrapiLocalization, StrapiMedia, StrapiMetadata, StrapiNavMenu, StrapiPage, StrapiPageProps, StrapiPortfolio, StrapiPortfolioCard, StrapiProject, StrapiProjectCard, StrapiProjectProps, StrapiQuoteCard, StrapiShapesCard, StrapiTextCardWithIcons, StrapiTopBanner, HeaderType, Image, Locale, PageMetadata, PageProps, PortfolioProject, };
@@ -0,0 +1,5 @@
1
+ interface SWRData<Data = any> {
2
+ body?: Data;
3
+ headers: Headers;
4
+ }
5
+ export default SWRData;
@@ -0,0 +1,11 @@
1
+ import SWRData from '../SWRData';
2
+ interface UseInfiniteDataHookProps<T> {
3
+ data: SWRData<T[]>[] | undefined;
4
+ isLoading: boolean;
5
+ isLoadingMore: boolean;
6
+ canLoadMore: boolean;
7
+ refetch: () => void;
8
+ loadMore: () => void;
9
+ count: number;
10
+ }
11
+ export default UseInfiniteDataHookProps;
@@ -0,0 +1,9 @@
1
+ import { SWRInfiniteKeyLoader } from 'swr/infinite';
2
+ import UseInfiniteDataHookProps from './UseInfiniteDataHookProps';
3
+ import IStrapiResponse from '../../models/strapi/IStrapiResponse';
4
+ import StrapiEvent from '../strapi/StrapiEvent';
5
+ declare const useEvents: ({ getKey, batchSize, }: {
6
+ getKey: SWRInfiniteKeyLoader;
7
+ batchSize: number;
8
+ }) => UseInfiniteDataHookProps<IStrapiResponse<StrapiEvent[]>[]>;
9
+ export default useEvents;
@@ -0,0 +1,48 @@
1
+ import Locale from '../Locale';
2
+ import StrapiImage from './StrapiImage';
3
+ import StrapiLink from './StrapiLink';
4
+ import StrapiLocalization from './StrapiLocalization';
5
+ import StrapiTopBanner from './StrapiTopBanner';
6
+ export declare enum EventType {
7
+ CONFERENCE = "Conference",
8
+ MEET_UP = "Meet Up",
9
+ WEBINAR = "Webinar",
10
+ FOREST_WALK = "Forest Walk",
11
+ LUNCH_AND_LEARN = "Lunch & Learn",
12
+ FESTIVAL = "Festival",
13
+ ROADSHOW = "RoadShow",
14
+ PARTNER_EVENT = "Partner Event",
15
+ FAIR = "Fair"
16
+ }
17
+ interface StrapiEvent {
18
+ title: string;
19
+ description: string;
20
+ button?: StrapiLink;
21
+ buttonVariant?: 'outline' | 'ghost' | 'link' | 'solid' | 'outlineWhite';
22
+ recommended?: boolean;
23
+ speakers?: {
24
+ id: number;
25
+ name: string;
26
+ image: StrapiImage;
27
+ }[];
28
+ image: StrapiImage;
29
+ logo: StrapiImage;
30
+ eventTypes: {
31
+ id: number;
32
+ eventType: EventType;
33
+ }[];
34
+ languages: {
35
+ id: number;
36
+ language: string;
37
+ countryCode: string;
38
+ }[];
39
+ location?: string;
40
+ locale: Locale;
41
+ online?: boolean;
42
+ start: Date;
43
+ end: Date;
44
+ slices: any[];
45
+ localizations: StrapiLocalization[];
46
+ topBanner?: StrapiTopBanner;
47
+ }
48
+ export default StrapiEvent;
@@ -24,6 +24,15 @@ declare const rootMessagesDe: {
24
24
  'sections.glossary.copyButtonLabel': string;
25
25
  'sections.glossary.copySuccessMessage': string;
26
26
  'sections.glossary.copyFailureMessage': string;
27
+ 'sections.events.loadMore': string;
28
+ 'sections.events.noUpcomingEvents': string;
29
+ 'sections.events.noPastEvents': string;
30
+ 'sections.eventsFilter.searchPlaceholder': string;
31
+ 'sections.events.eventsFilter.eventType': string;
32
+ 'sections.events.eventsFilter.language': string;
33
+ 'sections.events.eventsFilter.sortBy.title': string;
34
+ 'sections.events.eventsFilter.sortBy.newest': string;
35
+ 'sections.events.eventsFilter.sortBy.oldest': string;
27
36
  'sections.customerQuoteCard.more': string;
28
37
  'sections.customerCard.more': string;
29
38
  'sections.cta.backgroundShapes': string;
@@ -59,6 +68,18 @@ declare const rootMessagesDe: {
59
68
  'features.projectInfo.properties.year': string;
60
69
  'features.portfolio.documentsDownloadList.projectDocuments': string;
61
70
  'features.portfolio.documentsDownloadList.downloadDocument': string;
71
+ 'sections.eventCard.recommendedEvent': string;
72
+ 'sections.eventCard.buttonShowMore': string;
73
+ 'sections.eventCard.buttonShowLess': string;
74
+ 'sections.eventCard.eventType.conference': string;
75
+ 'sections.eventCard.eventType.webinar': string;
76
+ 'sections.eventCard.eventType.forestwalk': string;
77
+ 'sections.eventCard.eventType.partnerevent': string;
78
+ 'sections.eventCard.eventType.lunch&learn': string;
79
+ 'sections.eventCard.eventType.fair': string;
80
+ 'sections.eventCard.eventType.festival': string;
81
+ 'sections.eventCard.eventType.roadshow': string;
82
+ 'sections.eventCard.eventType.meetup': string;
62
83
  'components.creditsAvailableBadge.text.yes': string;
63
84
  'components.creditsAvailableBadge.text.some': string;
64
85
  'components.creditsAvailableBadge.text.no': string;
@@ -24,6 +24,15 @@ declare const rootMessagesEn: {
24
24
  'sections.glossary.copyButtonLabel': string;
25
25
  'sections.glossary.copySuccessMessage': string;
26
26
  'sections.glossary.copyFailureMessage': string;
27
+ 'sections.events.loadMore': string;
28
+ 'sections.events.noUpcomingEvents': string;
29
+ 'sections.events.noPastEvents': string;
30
+ 'sections.events.eventsFilter.searchPlaceholder': string;
31
+ 'sections.events.eventsFilter.eventType': string;
32
+ 'sections.events.eventsFilter.language': string;
33
+ 'sections.events.eventsFilter.sortBy.title': string;
34
+ 'sections.events.eventsFilter.sortBy.newest': string;
35
+ 'sections.events.eventsFilter.sortBy.oldest': string;
27
36
  'sections.customerQuoteCard.more': string;
28
37
  'sections.customerCard.more': string;
29
38
  'sections.cta.backgroundShapesDark': string;
@@ -59,6 +68,18 @@ declare const rootMessagesEn: {
59
68
  'features.projectInfo.properties.year': string;
60
69
  'features.portfolio.documentsDownloadList.projectDocuments': string;
61
70
  'features.portfolio.documentsDownloadList.downloadDocument': string;
71
+ 'sections.eventCard.recommendedEvent': string;
72
+ 'sections.eventCard.buttonShowMore': string;
73
+ 'sections.eventCard.buttonShowLess': string;
74
+ 'sections.eventCard.eventType.conference': string;
75
+ 'sections.eventCard.eventType.webinar': string;
76
+ 'sections.eventCard.eventType.forestwalk': string;
77
+ 'sections.eventCard.eventType.partnerevent': string;
78
+ 'sections.eventCard.eventType.lunch&learn': string;
79
+ 'sections.eventCard.eventType.fair': string;
80
+ 'sections.eventCard.eventType.festival': string;
81
+ 'sections.eventCard.eventType.roadshow': string;
82
+ 'sections.eventCard.eventType.meetup': string;
62
83
  'components.creditsAvailableBadge.text.yes': string;
63
84
  'components.creditsAvailableBadge.text.some': string;
64
85
  'components.creditsAvailableBadge.text.no': string;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ export interface EventsProps {
3
+ slice: {
4
+ upcomingTitle?: string;
5
+ upcomingDescription?: string;
6
+ pastTitle: string;
7
+ pastDescription?: string;
8
+ filterSearch?: boolean;
9
+ };
10
+ }
11
+ export declare const Events: React.FC<EventsProps>;
@@ -0,0 +1,4 @@
1
+ declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0fc72a6d").R, import("./Events").EventsProps>;
2
+ export default _default;
3
+ export declare const Minimal: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./Events").EventsProps>;
4
+ export declare const WithFilterSearch: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./Events").EventsProps>;
@@ -0,0 +1,2 @@
1
+ import { Events } from './Events';
2
+ export default Events;
@@ -0,0 +1,12 @@
1
+ declare const messagesDe: {
2
+ 'sections.events.loadMore': string;
3
+ 'sections.events.noUpcomingEvents': string;
4
+ 'sections.events.noPastEvents': string;
5
+ 'sections.eventsFilter.searchPlaceholder': string;
6
+ 'sections.events.eventsFilter.eventType': string;
7
+ 'sections.events.eventsFilter.language': string;
8
+ 'sections.events.eventsFilter.sortBy.title': string;
9
+ 'sections.events.eventsFilter.sortBy.newest': string;
10
+ 'sections.events.eventsFilter.sortBy.oldest': string;
11
+ };
12
+ export default messagesDe;
@@ -0,0 +1,12 @@
1
+ declare const messagesDe: {
2
+ 'sections.events.loadMore': string;
3
+ 'sections.events.noUpcomingEvents': string;
4
+ 'sections.events.noPastEvents': string;
5
+ 'sections.events.eventsFilter.searchPlaceholder': string;
6
+ 'sections.events.eventsFilter.eventType': string;
7
+ 'sections.events.eventsFilter.language': string;
8
+ 'sections.events.eventsFilter.sortBy.title': string;
9
+ 'sections.events.eventsFilter.sortBy.newest': string;
10
+ 'sections.events.eventsFilter.sortBy.oldest': string;
11
+ };
12
+ export default messagesDe;